@mndw/cli 0.2.0 → 0.3.1
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 +45 -21
- package/dist/mndw.js +72 -23
- package/host-dev/assets/index-D5JwgvHN.js +94 -0
- package/host-dev/assets/index-DN-pqOy8.css +1 -0
- package/host-dev/assets/{sandbox-url-D8HO7UBF.js → sandbox-url-Cn4lLhV3.js} +1 -1
- package/host-dev/index.html +3 -3
- package/host-dev/shared/{mndw-ui@0.2.0.js → mndw-ui@0.3.1.js} +98 -83
- package/package.json +14 -14
- package/templates/angular/i18n/en.json +4 -0
- package/templates/angular/i18n/ru.json +4 -0
- package/templates/angular/src/app.component.ts +0 -6
- package/templates/angular/src/index.ts +4 -4
- package/templates/angular/src/l10n.test.ts +4 -4
- package/templates/go/i18n/en.json +4 -0
- package/templates/go/i18n/ru.json +4 -0
- package/templates/go/manifest.json +1 -0
- package/templates/go/src/index.test.ts +4 -2
- package/templates/go/src/index.ts +2 -9
- package/templates/go/src/l10n.test.ts +4 -1
- package/templates/svelte/i18n/en.json +4 -0
- package/templates/svelte/i18n/ru.json +4 -0
- package/templates/svelte/src/App.svelte +1 -7
- package/templates/svelte/src/index.ts +1 -1
- package/templates/svelte/src/l10n.test.ts +5 -5
- package/templates/vanilla/i18n/en.json +4 -0
- package/templates/vanilla/i18n/ru.json +4 -0
- package/templates/vanilla/src/index.ts +2 -9
- package/templates/vanilla/src/l10n.test.ts +4 -1
- package/templates/vue/i18n/en.json +4 -0
- package/templates/vue/i18n/ru.json +4 -0
- package/templates/vue/src/App.vue +1 -7
- package/templates/vue/src/index.ts +1 -1
- package/templates/vue/src/l10n.test.ts +1 -1
- package/host-dev/assets/index-BqQCCILo.css +0 -1
- package/host-dev/assets/index-DFVRx7na.js +0 -94
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
var O_=Object.defineProperty;var M_=Object.getPrototypeOf;var N_=Reflect.get;var Kf=t=>{throw TypeError(t)};var I_=(t,e,n)=>e in t?O_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var W=(t,e,n)=>I_(t,typeof e!="symbol"?e+"":e,n),Lc=(t,e,n)=>e.has(t)||Kf("Cannot "+n);var T=(t,e,n)=>(Lc(t,e,"read from private field"),n?n.call(t):e.get(t)),Se=(t,e,n)=>e.has(t)?Kf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),$e=(t,e,n,r)=>(Lc(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),je=(t,e,n)=>(Lc(t,e,"access private method"),n);var Yf=(t,e,n)=>N_(M_(t),n,e);import{setMndwUiLocale as L_,coercePlacement as Xf,isMobileSheet as z_,resolveSizing as Jf,computePopoverCoords as D_,createFocusTrap as Ou,composedContains as H_,tabbableElements as B_,column as oi,deepActiveElement as U_,defineMndwUi as $_}from"/shared/mndw-ui@0.2.0.js";import{ReplaySubject as j_,Observable as ll,tap as zc,timer as F_,exhaustMap as G_,catchError as V_,EMPTY as Z_,Subject as W_,Subscription as q_,filter as K_,BehaviorSubject as Y_,map as X_,firstValueFrom as Tg,timeout as xg,takeUntil as Qf}from"/shared/rxjs@7.8.2.js";import{FetchTransport as J_,SessionManager as Q_,RciManager as ew}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 tw="/assets/sprite-XQfBvd_1.svg",Pg=!1;var Jl=Array.isArray,nw=Array.prototype.indexOf,cl=Array.prototype.includes,Ql=Array.from,rw=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Cg=Object.getOwnPropertyDescriptors,Rg=Object.prototype,iw=Array.prototype,ec=Object.getPrototypeOf,eh=Object.isExtensible;const sw=()=>{};function ow(t){for(var e=0;e<t.length;e++)t[e]()}function Ag(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function aw(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 an=2,Ps=4,tc=8,Id=1<<24,pr=16,rr=32,Wr=64,Mu=128,tr=512,Jt=1024,Wt=2048,br=4096,Rn=8192,nr=16384,Fs=32768,Nu=1<<25,mi=65536,ul=1<<17,lw=1<<18,Gs=1<<19,cw=1<<20,Rr=1<<25,Gi=65536,dl=1<<21,us=1<<22,di=1<<23,fi=Symbol("$state"),uw=Symbol(""),Ja=Symbol("attributes"),Iu=Symbol("class"),Lu=Symbol("style"),fo=Symbol("text"),fa=new class extends Error{constructor(){super(...arguments);W(this,"name","StaleReactionError");W(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var kg;const Ld=!!((kg=globalThis.document)!=null&&kg.contentType)&&globalThis.document.contentType.includes("xml");function zd(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function dw(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function fw(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function hw(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function pw(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function gw(t){throw new Error("https://svelte.dev/e/effect_orphan")}function mw(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function vw(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function bw(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function _w(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ww(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const yw=1,kw=2,Og=4,Ew=8,Sw=16,Tw=1,xw=2,Vt=Symbol("uninitialized"),Pw="http://www.w3.org/1999/xhtml",Cw="@attach";function Rw(){console.warn("https://svelte.dev/e/derived_inert")}function Aw(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Ow(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Mg(t){return t===this.v}function Ng(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Ig(t){return!Ng(t,this.v)}let ha=!1,Mw=!1;function Nw(){ha=!0}const Iw=[];function Ca(t,e=!1,n=!1){return Qa(t,new Map,"",Iw,null,n)}function Qa(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(Jl(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]=Qa(c,e,n,r,null,s))}return a}if(ec(t)===Rg){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=Qa(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return Qa(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let vt=null;function Cs(t){vt=t}function Lw(t){return Dd().get(t)}function zw(t,e){return Dd().set(t,e),e}function Dw(t){return Dd().has(t)}function Fe(t,e=!1,n){vt={p:vt,i:!1,c:null,e:null,s:t,x:null,r:ot,l:ha&&!e?{s:null,u:null,$:[]}:null}}function Ge(t){var e=vt,n=e.e;if(n!==null){e.e=null;for(var r of n)tm(r)}return e.i=!0,vt=e.p,{}}function Vs(){return!ha||vt!==null&&vt.l===null}function Dd(t){return vt===null&&zd(),vt.c??(vt.c=new Map(Hw(vt)||void 0))}function Hw(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let Ri=[];function Lg(){var t=Ri;Ri=[],ow(t)}function Ar(t){if(Ri.length===0&&!Ao){var e=Ri;queueMicrotask(()=>{e===Ri&&Lg()})}Ri.push(t)}function Bw(){for(;Ri.length>0;)Lg()}function zg(t){var e=ot;if(e===null)return et.f|=di,t;if((e.f&Fs)===0&&(e.f&Ps)===0)throw t;ai(t,e)}function ai(t,e){if(!(e!==null&&(e.f&nr)!==0)){for(;e!==null;){if((e.f&Mu)!==0){if((e.f&Fs)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const Uw=-7169;function Ut(t,e){t.f=t.f&Uw|e}function Hd(t){(t.f&tr)!==0||t.deps===null?Ut(t,Jt):Ut(t,br)}function Dg(t){if(t!==null)for(const e of t)(e.f&an)===0||(e.f&Gi)===0||(e.f^=Gi,Dg(e.deps))}function Hg(t,e,n){(t.f&Wt)!==0?e.add(t):(t.f&br)!==0&&n.add(t),Dg(t.deps),Ut(t,Jt)}function $w(t,e){if(e){const n=document.body;t.autofocus=!0,Ar(()=>{document.activeElement===n&&t.focus()})}}function pa(t){var e=et,n=ot;Hn(null),ir(null);try{return t()}finally{Hn(e),ir(n)}}function jw(t){let e=0,n=qr(0),r;return()=>{Fd()&&(d(n),Vd(()=>(e===0&&(r=Ei(()=>t(()=>on(n)))),e+=1,()=>{Ar(()=>{e-=1,e===0&&(r==null||r(),r=void 0,on(n))})})))}}var Fw=mi|Gs;function Gw(t,e,n,r){new Vw(t,e,n,r)}var Jn,Nd,Qn,Ni,Mn,er,xn,Zn,Hr,Ii,ri,_s,Jo,Qo,Br,Zl,Pt,Zw,Ww,zu,qw,Du,el,tl,Hu,Bu;class Vw{constructor(e,n,r,i){Se(this,Pt);W(this,"parent");W(this,"is_pending",!1);W(this,"transform_error");Se(this,Jn);Se(this,Nd,null);Se(this,Qn);Se(this,Ni);Se(this,Mn);Se(this,er,null);Se(this,xn,null);Se(this,Zn,null);Se(this,Hr,null);Se(this,Ii,0);Se(this,ri,0);Se(this,_s,!1);Se(this,Jo,new Set);Se(this,Qo,new Set);Se(this,Br,null);Se(this,Zl,jw(()=>($e(this,Br,qr(T(this,Ii))),()=>{$e(this,Br,null)})));var s;$e(this,Jn,e),$e(this,Qn,n),$e(this,Ni,o=>{var a=ot;a.b=this,a.f|=Mu,r(o)}),this.parent=ot.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),$e(this,Mn,Zs(()=>{je(this,Pt,Du).call(this)},Fw))}defer_effect(e){Hg(e,T(this,Jo),T(this,Qo))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!T(this,Qn).pending}update_pending_count(e,n){je(this,Pt,Hu).call(this,e,n),$e(this,Ii,T(this,Ii)+e),!(!T(this,Br)||T(this,_s))&&($e(this,_s,!0),Ar(()=>{$e(this,_s,!1),T(this,Br)&&Rs(T(this,Br),T(this,Ii))}))}get_effect_pending(){return T(this,Zl).call(this),d(T(this,Br))}error(e){if(!T(this,Qn).onerror&&!T(this,Qn).failed)throw e;We!=null&&We.is_fork?(T(this,er)&&We.skip_effect(T(this,er)),T(this,xn)&&We.skip_effect(T(this,xn)),T(this,Zn)&&We.skip_effect(T(this,Zn)),We.oncommit(()=>{je(this,Pt,Bu).call(this,e)})):je(this,Pt,Bu).call(this,e)}}Jn=new WeakMap,Nd=new WeakMap,Qn=new WeakMap,Ni=new WeakMap,Mn=new WeakMap,er=new WeakMap,xn=new WeakMap,Zn=new WeakMap,Hr=new WeakMap,Ii=new WeakMap,ri=new WeakMap,_s=new WeakMap,Jo=new WeakMap,Qo=new WeakMap,Br=new WeakMap,Zl=new WeakMap,Pt=new WeakSet,Zw=function(){try{$e(this,er,Ln(()=>T(this,Ni).call(this,T(this,Jn))))}catch(e){this.error(e)}},Ww=function(e){const n=T(this,Qn).failed,{reset:r,invoke_onerror:i}=je(this,Pt,zu).call(this,e);Ar(i),n&&$e(this,Zn,Ln(()=>{n(T(this,Jn),()=>e,()=>r)}))},zu=function(e){var n=!1,r=!1;const i=()=>{if(n){Ow();return}n=!0,r&&ww(),T(this,Zn)!==null&&Ui(T(this,Zn),()=>{$e(this,Zn,null)}),je(this,Pt,tl).call(this,()=>{je(this,Pt,Du).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=T(this,Qn)).onerror)==null||a.call(o,e,i),r=!1}catch(l){ai(l,T(this,Mn)&&T(this,Mn).parent)}}}},qw=function(){const e=T(this,Qn).pending;e&&(this.is_pending=!0,$e(this,xn,Ln(()=>e(T(this,Jn)))),Ar(()=>{var n=$e(this,Hr,document.createDocumentFragment()),r=Vr();n.append(r),$e(this,er,je(this,Pt,tl).call(this,()=>Ln(()=>T(this,Ni).call(this,r)))),T(this,ri)===0&&(T(this,Jn).before(n),$e(this,Hr,null),Ui(T(this,xn),()=>{$e(this,xn,null)}),je(this,Pt,el).call(this,We))}))},Du=function(){try{if(this.is_pending=this.has_pending_snippet(),$e(this,ri,0),$e(this,Ii,0),$e(this,er,Ln(()=>{T(this,Ni).call(this,T(this,Jn))})),T(this,ri)>0){var e=$e(this,Hr,document.createDocumentFragment());Wd(T(this,er),e);const n=T(this,Qn).pending;$e(this,xn,Ln(()=>n(T(this,Jn))))}else je(this,Pt,el).call(this,We)}catch(n){this.error(n)}},el=function(e){this.is_pending=!1,e.transfer_effects(T(this,Jo),T(this,Qo))},tl=function(e){var n=ot,r=et,i=vt;ir(T(this,Mn)),Hn(T(this,Mn)),Cs(T(this,Mn).ctx);try{return Vi.ensure(),e()}catch(s){return zg(s),null}finally{ir(n),Hn(r),Cs(i)}},Hu=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&je(r=this.parent,Pt,Hu).call(r,e,n);return}$e(this,ri,T(this,ri)+e),T(this,ri)===0&&(je(this,Pt,el).call(this,n),T(this,xn)&&Ui(T(this,xn),()=>{$e(this,xn,null)}),T(this,Hr)&&(T(this,Jn).before(T(this,Hr)),$e(this,Hr,null)))},Bu=function(e){T(this,er)&&(gn(T(this,er)),$e(this,er,null)),T(this,xn)&&(gn(T(this,xn)),$e(this,xn,null)),T(this,Zn)&&(gn(T(this,Zn)),$e(this,Zn,null));let n=T(this,Qn).failed;const r=i=>{const{reset:s,invoke_onerror:o}=je(this,Pt,zu).call(this,i);o(),n&&$e(this,Zn,je(this,Pt,tl).call(this,()=>{try{return Ln(()=>{var a=ot;a.b=this,a.f|=Mu,n(T(this,Jn),()=>i,()=>s)})}catch(a){return ai(a,T(this,Mn).parent),null}}))};Ar(()=>{var i;try{i=this.transform_error(e)}catch(s){ai(s,T(this,Mn)&&T(this,Mn).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>ai(s,T(this,Mn)&&T(this,Mn).parent)):r(i)})};function Bg(t,e,n,r){const i=Vs()?Bd:$g;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=ot,l=Kw(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&nr)===0){l();try{r([...o,...p])}catch(g){ai(g,a)}fl()}}var f=Ug();if(n.length===0){c.then(()=>u([])).finally(f);return}function h(){Promise.all(n.map(p=>Yw(p))).then(u).catch(p=>ai(p,a)).finally(f)}c?c.then(()=>{l(),h(),fl()}):h()}function Kw(){var t=ot,e=et,n=vt,r=We;return function(s=!0){ir(t),Hn(e),Cs(n),s&&(t.f&nr)===0&&(r==null||r.activate(),r==null||r.apply())}}function fl(t=!0){ir(null),Hn(null),Cs(null),t&&(We==null||We.deactivate())}function Ug(){var t=ot,e=t.b,n=We,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 Bd(t){var e=an|Wt;return ot!==null&&(ot.f|=Gs),{ctx:vt,deps:null,effects:null,equals:Mg,f:e,fn:t,reactions:null,rv:0,v:Vt,wv:0,parent:ot,ac:null}}const ho=Symbol("obsolete");function Yw(t,e,n){let r=ot;r===null&&dw();var i=void 0,s=qr(Vt),o=!et,a=new Set;return fy(()=>{var p,g;var l=ot,c=Ag();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==fa&&c.reject(m)}).finally(fl)}catch(m){c.reject(m),fl()}var u=We;if(o){if((l.f&Fs)!==0)var f=Ug();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(ho);else for(const m of a.values())m.reject(ho);a.add(c),u.async_deriveds.set(l,c)}const h=(m,_=void 0)=>{f==null||f(),a.delete(c),_!==ho&&(u.activate(),_?(s.f|=di,Rs(s,_)):((s.f&di)!==0&&(s.f^=di),Rs(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Gd(()=>{for(const l of a)l.reject(ho)}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function V(t){const e=Bd(t);return am(e),e}function $g(t){const e=Bd(t);return e.equals=Ig,e}function Xw(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)gn(e[n])}}function Ud(t){var e,n=ot,r=t.parent;if(!vi&&r!==null&&t.v!==Vt&&(r.f&(nr|Rn))!==0)return Rw(),t.v;ir(r);try{t.f&=~Gi,Xw(t),e=dm(t)}finally{ir(n)}return e}function jg(t){var e=Ud(t);if(!t.equals(e)&&(t.wv=cm(),(!(We!=null&&We.is_fork)||t.deps===null)&&(We!==null?(We.capture(t,e,!0),Ro==null||Ro.capture(t,e,!0)):t.v=e,t.deps===null))){Ut(t,Jt);return}vi||(hn!==null?(Fd()||We!=null&&We.is_fork)&&hn.set(t,e):Hd(t))}function Jw(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&&pa(()=>{n.ac.abort(fa),n.ac=null}),n.fn!==null&&(n.teardown=sw),Bo(n,0),Zd(n))}function Fg(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&As(e)}let Dc=null,Qi=null,We=null,Ro=null,hn=null,Uu=null,Ao=!1,Hc=!1,as=null,nl=null;var th=0;let Qw=1;var ws,ii,Li,ys,ks,Es,Ur,Ss,Nn,ea,$r,cr,Sr,Ts,zi,bt,$u,po,ju,Gg,Vg,ss,ey,go;const Wl=class Wl{constructor(){Se(this,bt);W(this,"id",Qw++);Se(this,ws,!1);W(this,"linked",!0);Se(this,ii,null);Se(this,Li,null);W(this,"async_deriveds",new Map);W(this,"current",new Map);W(this,"previous",new Map);Se(this,ys,new Set);Se(this,ks,new Set);Se(this,Es,0);Se(this,Ur,new Map);Se(this,Ss,null);Se(this,Nn,[]);Se(this,ea,[]);Se(this,$r,new Set);Se(this,cr,new Set);Se(this,Sr,new Map);Se(this,Ts,new Set);W(this,"is_fork",!1);Se(this,zi,!1);Qi===null?Dc=Qi=this:($e(Qi,Li,this),$e(this,ii,Qi)),Qi=this}skip_effect(e){T(this,Sr).has(e)||T(this,Sr).set(e,{d:[],m:[]}),T(this,Ts).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=T(this,Sr).get(e);if(r){T(this,Sr).delete(e);for(var i of r.d)Ut(i,Wt),n(i);for(i of r.m)Ut(i,br),n(i)}T(this,Ts).add(e)}capture(e,n,r=!1){e.v!==Vt&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&di)===0&&(this.current.set(e,[n,r]),hn==null||hn.set(e,n)),this.is_fork||(e.v=n)}activate(){We=this}deactivate(){We=null,hn=null}flush(){try{Hc=!0,We=this,je(this,bt,po).call(this)}finally{th=0,Uu=null,as=null,nl=null,Hc=!1,We=null,hn=null,Bi.clear()}}discard(){var e;for(const n of T(this,ks))n(this);T(this,ks).clear();for(const n of this.async_deriveds.values())n.reject(ho);je(this,bt,go).call(this),(e=T(this,Ss))==null||e.resolve()}register_created_effect(e){T(this,ea).push(e)}increment(e,n){if($e(this,Es,T(this,Es)+1),e){let r=T(this,Ur).get(n)??0;T(this,Ur).set(n,r+1)}}decrement(e,n){if($e(this,Es,T(this,Es)-1),e){let r=T(this,Ur).get(n)??0;r===1?T(this,Ur).delete(n):T(this,Ur).set(n,r-1)}T(this,zi)||($e(this,zi,!0),Ar(()=>{$e(this,zi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)T(this,$r).add(r);for(const r of n)T(this,cr).add(r);e.clear(),n.clear()}oncommit(e){T(this,ys).add(e)}ondiscard(e){T(this,ks).add(e)}settled(){return(T(this,Ss)??$e(this,Ss,Ag())).promise}static ensure(){if(We===null){const e=We=new Wl;!Hc&&!Ao&&Ar(()=>{T(e,ws)||e.flush()})}return We}apply(){{hn=null;return}}schedule(e){var i;if(Uu=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Ps|tc|Id))!==0&&(e.f&Fs)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(as!==null&&n===ot&&(et===null||(et.f&an)===0))return;if((r&(Wr|rr))!==0){if((r&Jt)===0)return;n.f^=Jt}}T(this,Nn).push(n)}};ws=new WeakMap,ii=new WeakMap,Li=new WeakMap,ys=new WeakMap,ks=new WeakMap,Es=new WeakMap,Ur=new WeakMap,Ss=new WeakMap,Nn=new WeakMap,ea=new WeakMap,$r=new WeakMap,cr=new WeakMap,Sr=new WeakMap,Ts=new WeakMap,zi=new WeakMap,bt=new WeakSet,$u=function(){if(this.is_fork)return!0;for(const r of T(this,Ur).keys()){for(var e=r,n=!1;e.parent!==null;){if(T(this,Sr).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},po=function(){var l,c,u,f;$e(this,ws,!0),th++>1e3&&(je(this,bt,go).call(this),ny());for(const h of T(this,$r))T(this,cr).delete(h),Ut(h,Wt),this.schedule(h);for(const h of T(this,cr))Ut(h,br),this.schedule(h);const e=T(this,Nn);$e(this,Nn,[]),this.apply();var n=as=[],r=[],i=nl=[];for(const h of e)try{je(this,bt,ju).call(this,h,n,r)}catch(p){throw qg(h),je(this,bt,$u).call(this)||this.discard(),p}if(We=null,i.length>0){var s=Wl.ensure();for(const h of i)s.schedule(h)}if(as=null,nl=null,je(this,bt,$u).call(this)){je(this,bt,ss).call(this,r),je(this,bt,ss).call(this,n);for(const[h,p]of T(this,Sr))Wg(h,p);i.length>0&&je(l=We,bt,po).call(l);return}const o=je(this,bt,Gg).call(this);if(o){je(this,bt,ss).call(this,r),je(this,bt,ss).call(this,n),je(c=o,bt,Vg).call(c,this);return}T(this,$r).clear(),T(this,cr).clear();for(const h of T(this,ys))h(this);T(this,ys).clear(),Ro=this,nh(r),nh(n),Ro=null,(u=T(this,Ss))==null||u.resolve();var a=We;if(T(this,Es)===0&&(T(this,Nn).length===0||a!==null)&&je(this,bt,go).call(this),T(this,Nn).length>0)if(a!==null){const h=a;T(h,Nn).push(...T(this,Nn).filter(p=>!T(h,Nn).includes(p)))}else a=this;a!==null&&je(f=a,bt,po).call(f)},ju=function(e,n,r){e.f^=Jt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(rr|Wr))!==0,a=o&&(s&Jt)!==0,l=a||(s&Rn)!==0||T(this,Sr).has(i);if(!l&&i.fn!==null){o?i.f^=Jt:(s&Ps)!==0?n.push(i):ma(i)&&((s&pr)!==0&&T(this,cr).add(i),As(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}}},Gg=function(){for(var e=T(this,ii);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=T(e,ii)}return null},Vg=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(T(e,$r),T(e,cr));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&an)!==0&&(i.f&(Wt|br))===0))for(const l of s){var o=l.f;if((o&an)!==0)n(l);else{var a=l;o&(us|pr)&&!this.async_deriveds.has(a)&&(T(this,cr).delete(a),Ut(a,Wt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),je(r=e,bt,go).call(r),We=this,je(this,bt,po).call(this)},ss=function(e){for(var n=0;n<e.length;n+=1)Hg(e[n],T(this,$r),T(this,cr))},ey=function(){var f;for(let h=Dc;h!==null;h=T(h,Li)){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(!(!T(h,ws)||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 T(this,Ts))h.unskip_effect(p,g=>{var m;(g.f&(pr|us))!==0?h.schedule(g):je(m=h,bt,ss).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)Zg(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 T(this,ea))(p.f&(nr|Rn|ul))===0&&$d(p,c,a)&&((p.f&(us|pr))!==0?(Ut(p,Wt),h.schedule(p)):T(h,$r).add(p));if(T(h,Nn).length>0&&!T(h,zi)){h.apply();for(var u of T(h,Nn))je(f=h,bt,ju).call(f,u,[],[]);$e(h,Nn,[])}h.deactivate()}}}},go=function(){if(this.linked){var e=T(this,ii),n=T(this,Li);e===null?Dc=n:$e(e,Li,n),n===null?Qi=e:$e(n,ii,e),this.linked=!1}};let Vi=Wl;function ty(t){var e=Ao;Ao=!0;try{for(var n;;){if(Bw(),We===null)return n;We.flush()}}finally{Ao=e}}function ny(){try{mw()}catch(t){ai(t,Uu)}}let lr=null;function nh(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(nr|Rn))===0&&ma(r)&&(lr=new Set,As(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&im(r),(lr==null?void 0:lr.size)>0)){Bi.clear();for(const i of lr){if((i.f&(nr|Rn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)lr.has(o)&&(lr.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(nr|Rn))===0&&As(l)}}lr.clear()}}lr=null}}function Zg(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&an)!==0?Zg(i,e,n,r):(s&(us|pr))!==0&&(s&Wt)===0&&$d(i,e,r)&&(Ut(i,Wt),jd(i))}}function $d(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(cl.call(e,i))return!0;if((i.f&an)!==0&&$d(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function jd(t){We.schedule(t)}function Wg(t,e){if(!((t.f&rr)!==0&&(t.f&Jt)!==0)){(t.f&Wt)!==0?e.d.push(t):(t.f&br)!==0&&e.m.push(t),Ut(t,Jt);for(var n=t.first;n!==null;)Wg(n,e),n=n.next}}function qg(t){Ut(t,Jt);for(var e=t.first;e!==null;)qg(e),e=e.next}let hl=new Set;const Bi=new Map;let Kg=!1;function qr(t,e){var n={f:0,v:t,reactions:null,equals:Mg,rv:0,wv:0};return n}function se(t,e){const n=qr(t);return am(n),n}function ry(t,e=!1,n=!0){var i;const r=qr(t);return e||(r.equals=Ig),ha&&n&&vt!==null&&vt.l!==null&&((i=vt.l).s??(i.s=[])).push(r),r}function k(t,e,n=!1){et!==null&&(!gr||(et.f&ul)!==0)&&Vs()&&(et.f&(an|pr|us|ul))!==0&&(Or===null||!Or.has(t))&&_w();let r=n?lt(e):e;return Rs(t,r,nl)}function Rs(t,e,n=null){if(!t.equals(e)){Bi.set(t,vi?e:t.v);var r=Vi.ensure();if(r.capture(t,e),(t.f&an)!==0){const i=t;(t.f&Wt)!==0&&Ud(i),hn===null&&Hd(i)}t.wv=cm(),Yg(t,Wt,n),Vs()&&ot!==null&&(ot.f&Jt)!==0&&(ot.f&(rr|Wr))===0&&(Xn===null?gy([t]):Xn.push(t)),!r.is_fork&&hl.size>0&&!Kg&&iy()}return e}function iy(){Kg=!1;for(const t of hl){(t.f&Jt)!==0&&Ut(t,br);let e;try{e=ma(t)}catch{e=!0}e&&As(t)}hl.clear()}function on(t){k(t,t.v+1)}function Yg(t,e,n){var r=t.reactions;if(r!==null)for(var i=Vs(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===ot)){var c=(l&Wt)===0;if(c&&Ut(a,e),(l&ul)!==0)hl.add(a);else if((l&an)!==0){var u=a;hn==null||hn.delete(u),(l&Gi)===0&&(l&tr&&(ot===null||(ot.f&dl)===0)&&(a.f|=Gi),Yg(u,br,n))}else if(c){var f=a;(l&pr)!==0&&lr!==null&&lr.add(f),n!==null?n.push(f):jd(f)}}}}function lt(t){if(typeof t!="object"||t===null||fi in t)return t;const e=ec(t);if(e!==Rg&&e!==iw)return t;var n=new Map,r=Jl(t),i=se(0),s=_r,o=a=>{if(_r===s)return a();var l=et,c=_r;Hn(null),sh(s);var u=a();return Hn(l),sh(c),u};return r&&n.set("length",se(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&vw();var u=n.get(l);return u===void 0?o(()=>{var f=se(c.value);return n.set(l,f),f}):k(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>se(Vt));n.set(l,u),on(i)}}else k(c,Vt),on(i);return!0},get(a,l,c){var p;if(l===fi)return t;var u=n.get(l),f=l in a;if(u===void 0&&(!f||(p=Co(a,l))!=null&&p.writable)&&(u=o(()=>{var g=lt(f?a[l]:Vt),m=se(g);return m}),n.set(l,u)),u!==void 0){var h=d(u);return h===Vt?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=d(u))}else if(c===void 0){var f=n.get(l),h=f==null?void 0:f.v;if(f!==void 0&&h!==Vt)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===fi)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Vt||Reflect.has(a,l);if(c!==void 0||ot!==null&&(!u||(h=Co(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?lt(a[l]):Vt,g=se(p);return g}),n.set(l,c));var f=d(c);if(f===Vt)return!1}return u},set(a,l,c,u){var M;var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<f.v;p+=1){var g=n.get(p+"");g!==void 0?k(g,Vt):p in a&&(g=o(()=>se(Vt)),n.set(p+"",g))}if(f===void 0)(!h||(M=Co(a,l))!=null&&M.writable)&&(f=o(()=>se(void 0)),k(f,lt(c)),n.set(l,f));else{h=f.v!==Vt;var m=o(()=>lt(c));k(f,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_!=null&&_.set&&_.set.call(u,c),!h){if(r&&typeof l=="string"){var w=n.get("length"),E=Number(l);Number.isInteger(E)&&E>=w.v&&k(w,E+1)}on(i)}return!0},ownKeys(a){d(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==Vt});for(var[c,u]of n)u.v!==Vt&&!(c in a)&&l.push(c);return l},setPrototypeOf(){bw()}})}function rh(t){try{if(t!==null&&typeof t=="object"&&fi in t)return t[fi]}catch{}return t}function sy(t,e){return Object.is(rh(t),rh(e))}var Ho,Xg,Jg,Qg;function oy(){if(Ho===void 0){Ho=window,Xg=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Jg=Co(e,"firstChild").get,Qg=Co(e,"nextSibling").get,eh(t)&&(t[Iu]=void 0,t[Ja]=null,t[Lu]=void 0,t.__e=void 0),eh(n)&&(n[fo]=void 0)}}function Vr(t=""){return document.createTextNode(t)}function pl(t){return Jg.call(t)}function ga(t){return Qg.call(t)}function v(t,e){return pl(t)}function tt(t,e=!1){{var n=pl(t);return n instanceof Comment&&n.data===""?ga(n):n}}function x(t,e=1,n=!1){let r=t;for(;e--;)r=ga(r);return r}function ay(t){t.textContent=""}function em(){return!1}function ly(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function cy(t){ot===null&&(et===null&&gw(),pw()),vi&&hw()}function uy(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Ir(t,e){var n=ot;n!==null&&(n.f&Rn)!==0&&(t|=Rn);var r={ctx:vt,deps:null,nodes:null,f:t|Wt|tr,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};We==null||We.register_created_effect(r);var i=r;if((t&Ps)!==0)as!==null?as.push(r):Vi.ensure().schedule(r);else if(e!==null){try{As(r)}catch(o){throw gn(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Gs)===0&&(i=i.first,(t&pr)!==0&&(t&mi)!==0&&i!==null&&(i.f|=mi))}if(i!==null&&(i.parent=n,n!==null&&uy(i,n),et!==null&&(et.f&an)!==0&&(t&Wr)===0)){var s=et;(s.effects??(s.effects=[])).push(i)}return r}function Fd(){return et!==null&&!gr}function Gd(t){const e=Ir(tc,null);return Ut(e,Jt),e.teardown=t,e}function Kn(t){cy();var e=ot.f,n=!et&&(e&rr)!==0&&vt!==null&&!vt.i;if(n){var r=vt;(r.e??(r.e=[])).push(t)}else return tm(t)}function tm(t){return Ir(Ps|cw,t)}function dy(t){Vi.ensure();const e=Ir(Wr|Gs,t);return(n={})=>new Promise(r=>{n.outro?Ui(e,()=>{gn(e),r(void 0)}):(gn(e),r(void 0))})}function nc(t){return Ir(Ps,t)}function fy(t){return Ir(us|Gs,t)}function Vd(t,e=0){return Ir(tc|e,t)}function y(t,e=[],n=[],r=[]){Bg(r,e,n,i=>{Ir(tc,()=>{t(...i.map(d))})})}function Zs(t,e=0){var n=Ir(pr|e,t);return n}function nm(t,e=0){var n=Ir(Id|e,t);return n}function Ln(t){return Ir(rr|Gs,t)}function rm(t){var e=t.teardown;if(e!==null){const n=vi,r=et;ih(!0),Hn(null);try{e.call(null)}finally{ih(n),Hn(r)}}}function Zd(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&pa(()=>{i.abort(fa)});var r=n.next;(n.f&Wr)!==0?n.parent=null:gn(n,e),n=r}}function hy(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&rr)===0&&gn(e),e=n}}function gn(t,e=!0){var n=!1;(e||(t.f&lw)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(py(t.nodes.start,t.nodes.end),n=!0),t.f|=Nu,Zd(t,e&&!n),Bo(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();rm(t),t.f^=Nu,t.f|=nr;var i=t.parent;i!==null&&i.first!==null&&im(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function py(t,e){for(;t!==null;){var n=t===e?null:ga(t);t.remove(),t=n}}function im(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 Ui(t,e,n=!0){var r=[];sm(t,r,!0);var i=()=>{n&&gn(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function sm(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&Wr)===0){var o=(i.f&mi)!==0||(i.f&rr)!==0&&(t.f&pr)!==0;sm(i,e,o?n:!1)}i=s}}}function gl(t){om(t,!0)}function om(t,e){if((t.f&Rn)!==0){t.f^=Rn,(t.f&Jt)===0&&(Ut(t,Wt),Vi.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&mi)!==0||(n.f&rr)!==0;om(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 Wd(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:ga(n);e.append(n),n=i}}let rl=!1,vi=!1;function ih(t){vi=t}let et=null,gr=!1;function Hn(t){et=t}let ot=null;function ir(t){ot=t}let Or=null;function am(t){et!==null&&(Or??(Or=new Set)).add(t)}let In=null,Vn=0,Xn=null;function gy(t){Xn=t}let lm=1,Ai=0,_r=Ai;function sh(t){_r=t}function cm(){return++lm}function ma(t){var e=t.f;if((e&Wt)!==0)return!0;if(e&an&&(t.f&=~Gi),(e&br)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(ma(s)&&jg(s),s.wv>t.wv)return!0}(e&tr)!==0&&hn===null&&Ut(t,Jt)}return!1}function um(t,e,n=!0){var r=t.reactions;if(r!==null&&!(Or!==null&&Or.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&an)!==0?um(s,e,!1):e===s&&(n?Ut(s,Wt):(s.f&Jt)!==0&&Ut(s,br),jd(s))}}function dm(t){var m;var e=In,n=Vn,r=Xn,i=et,s=Or,o=vt,a=gr,l=_r,c=t.f;In=null,Vn=0,Xn=null,et=(c&(rr|Wr))===0?t:null,Or=null,Cs(t.ctx),gr=!1,_r=++Ai,t.ac!==null&&(pa(()=>{t.ac.abort(fa)}),t.ac=null);try{t.f|=dl;var u=t.fn,f=u();t.f|=Fs;var h=t.deps,p=We==null?void 0:We.is_fork;if(In!==null){var g;if(p||Bo(t,Vn),h!==null&&Vn>0)for(h.length=Vn+In.length,g=0;g<In.length;g++)h[Vn+g]=In[g];else t.deps=h=In;if(Fd()&&(t.f&tr)!==0)for(g=Vn;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&Vn<h.length&&(Bo(t,Vn),h.length=Vn);if(Vs()&&Xn!==null&&!gr&&h!==null&&(t.f&(an|br|Wt))===0)for(g=0;g<Xn.length;g++)um(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&di)!==0&&(t.f^=di),f}catch(_){return zg(_)}finally{t.f^=dl,In=e,Vn=n,Xn=r,et=i,Or=s,Cs(o),gr=a,_r=l}}function my(t,e){let n=e.reactions;if(n!==null){var r=nw.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&an)!==0&&(In===null||!cl.call(In,e))){var s=e;(s.f&tr)!==0&&(s.f^=tr,s.f&=~Gi),s.v!==Vt&&Hd(s),s.ac!==null&&pa(()=>{s.ac.abort(fa),s.ac=null,Ut(s,Wt)}),Jw(s),Bo(s,0)}}function Bo(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)my(t,n[r])}function As(t){var e=t.f;if((e&nr)===0){Ut(t,Jt);var n=ot,r=rl;ot=t,rl=(e&(rr|Wr))===0;try{(e&(pr|Id))!==0?hy(t):Zd(t),rm(t);var i=dm(t);t.teardown=typeof i=="function"?i:null,t.wv=lm;var s;Pg&&Mw&&(t.f&Wt)!==0&&t.deps}finally{rl=r,ot=n}}}async function Oo(){await Promise.resolve(),ty()}function d(t){var e=t.f,n=(e&an)!==0;if(et!==null&&!gr){var r=ot!==null&&(ot.f&nr)!==0;if(!r&&(Or===null||!Or.has(t))){var i=et.deps;if((et.f&dl)!==0)t.rv<Ai&&(t.rv=Ai,In===null&&i!==null&&i[Vn]===t?Vn++:In===null?In=[t]:In.push(t));else{et.deps??(et.deps=[]),cl.call(et.deps,t)||et.deps.push(t);var s=t.reactions;s===null?t.reactions=[et]:cl.call(s,et)||s.push(et)}}}if(vi&&Bi.has(t))return Bi.get(t);if(n){var o=t;if(vi){var a=o.v;return((o.f&Jt)===0&&o.reactions!==null||hm(o))&&(a=Ud(o)),Bi.set(o,a),a}var l=(o.f&tr)===0&&!gr&&et!==null&&(rl||(et.f&tr)!==0),c=(o.f&Fs)===0;ma(o)&&(l&&(o.f|=tr),jg(o)),l&&!c&&(Fg(o),fm(o))}if(hn!=null&&hn.has(t))return hn.get(t);if((t.f&di)!==0)throw t.v;return t.v}function fm(t){if(t.f|=tr,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&an)!==0&&(e.f&tr)===0&&(Fg(e),fm(e))}function hm(t){if(t.v===Vt)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Bi.has(e)||(e.f&an)!==0&&hm(e))return!0;return!1}function Ei(t){var e=gr;try{return gr=!0,t()}finally{gr=e}}function vy(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(fi in t)Fu(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&fi in n&&Fu(n)}}}function Fu(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{Fu(t[r],e)}catch{}const n=ec(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=Cg(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function by(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const _y=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function wy(t){return _y.includes(t)}const yy={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 ky(t){return t=t.toLowerCase(),yy[t]??t}const Ey=["touchstart","touchmove"];function Sy(t){return Ey.includes(t)}const Oi=Symbol("events"),pm=new Set,Gu=new Set;function qd(t,e,n,r={}){function i(s){if(r.capture||Vu.call(e,s),!s.cancelBubble)return pa(()=>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 oh(t,e,n,r={}){var i=qd(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function kt(t,e,n,r,i){var s={capture:r,passive:i},o=qd(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Gd(()=>{e.removeEventListener(t,o,s)})}function ge(t,e,n){(e[Oi]??(e[Oi]={}))[t]=n}function ht(t){for(var e=0;e<t.length;e++)pm.add(t[e]);for(var n of Gu)n(t)}let ah=null;function Vu(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;ah=t;var o=0,a=ah===t&&t[Oi];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[Oi]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){rw(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=et,f=ot;Hn(null),ir(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(_=s[Oi])==null?void 0:_[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(w){h?p.push(w):h=w}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let w of p)queueMicrotask(()=>{throw w});throw h}}finally{t[Oi]=e,delete t.currentTarget,Hn(u),ir(f)}}}var Eg;const Bc=((Eg=globalThis==null?void 0:globalThis.window)==null?void 0:Eg.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Ty(t){return(Bc==null?void 0:Bc.createHTML(t))??t}function xy(t){var e=ly("template");return e.innerHTML=Ty(t.replaceAll("<!>","<!---->")),e.content}function ml(t,e){var n=ot;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function I(t,e){var n=(e&Tw)!==0,r=(e&xw)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=xy(s?t:"<!>"+t),n||(i=pl(i)));var o=r||Xg?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=pl(o),l=o.lastChild;ml(a,l)}else ml(o,o);return o}}function Ra(t=""){{var e=Vr(t+"");return ml(e,e),e}}function Bn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Vr();return t.append(e,n),ml(e,n),t}function R(t,e){t!==null&&t.before(e)}function S(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[fo]??(t[fo]=t.nodeValue))&&(t[fo]=n,t.nodeValue=`${n}`)}function rc(t,e){return Py(t,e)}const Aa=new Map;function Py(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){oy();var l=void 0,c=dy(()=>{var u=n??e.appendChild(Vr());Gw(u,{pending:()=>{}},p=>{Fe({});var g=vt;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Ge()},a);var f=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!f.has(m)){f.add(m);var _=Sy(m);for(const M of[e,document]){var w=Aa.get(M);w===void 0&&(w=new Map,Aa.set(M,w));var E=w.get(m);E===void 0?(M.addEventListener(m,Vu,{passive:_}),w.set(m,1)):w.set(m,E+1)}}}};return h(Ql(pm)),Gu.add(h),()=>{var _;for(var p of f)for(const w of[e,document]){var g=Aa.get(w),m=g.get(p);--m==0?(w.removeEventListener(p,Vu),g.delete(p),g.size===0&&Aa.delete(w)):g.set(p,m)}Gu.delete(h),u!==n&&((_=u.parentNode)==null||_.removeChild(u))}});return Zu.set(l,c),l}let Zu=new WeakMap;function Kd(t,e){const n=Zu.get(t);return n?(Zu.delete(t),n(e)):Promise.resolve()}var ur,Tr,Wn,Di,ta,na,ql;class ic{constructor(e,n=!0){W(this,"anchor");Se(this,ur,new Map);Se(this,Tr,new Map);Se(this,Wn,new Map);Se(this,Di,new Set);Se(this,ta,!0);Se(this,na,e=>{if(T(this,ur).has(e)){var n=T(this,ur).get(e),r=T(this,Tr).get(n);if(r)gl(r),T(this,Di).delete(n);else{var i=T(this,Wn).get(n);i&&(gl(i.effect),T(this,Tr).set(n,i.effect),T(this,Wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of T(this,ur)){if(T(this,ur).delete(s),s===e)break;const a=T(this,Wn).get(o);a&&(gn(a.effect),T(this,Wn).delete(o))}for(const[s,o]of T(this,Tr)){if(s===n||T(this,Di).has(s))continue;const a=()=>{if(Array.from(T(this,ur).values()).includes(s)){var c=document.createDocumentFragment();Wd(o,c),c.append(Vr()),T(this,Wn).set(s,{effect:o,fragment:c})}else gn(o);T(this,Di).delete(s),T(this,Tr).delete(s)};T(this,ta)||!r?(T(this,Di).add(s),Ui(o,a,!1)):a()}}});Se(this,ql,e=>{T(this,ur).delete(e);const n=Array.from(T(this,ur).values());for(const[r,i]of T(this,Wn))n.includes(r)||(gn(i.effect),T(this,Wn).delete(r))});this.anchor=e,$e(this,ta,n)}ensure(e,n){var r=We,i=em();if(n&&!T(this,Tr).has(e)&&!T(this,Wn).has(e))if(i){var s=document.createDocumentFragment(),o=Vr();s.append(o),T(this,Wn).set(e,{effect:Ln(()=>n(o)),fragment:s})}else T(this,Tr).set(e,Ln(()=>n(this.anchor)));if(T(this,ur).set(r,e),i){for(const[a,l]of T(this,Tr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of T(this,Wn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(T(this,na)),r.ondiscard(T(this,ql))}else T(this,na).call(this,r)}}ur=new WeakMap,Tr=new WeakMap,Wn=new WeakMap,Di=new WeakMap,ta=new WeakMap,na=new WeakMap,ql=new WeakMap;function X(t,e,n=!1){var r=new ic(t),i=n?mi:0;function s(o,a){r.ensure(o,a)}Zs(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}const Cy=Symbol("NaN");function gm(t,e,n){var r=new ic(t),i=!Vs();Zs(()=>{var s=e();s!==s&&(s=Cy),i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}function Ry(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let f=e[a];Ui(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var h=t.outrogroups;Wu(t,Ql(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;ay(u),u.append(c),t.items.clear()}Wu(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function Wu(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|=Rr;const o=document.createDocumentFragment();Wd(s,o)}else gn(e[i],n)}}var lh;function xt(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&Og)!==0;if(l){var c=t;o=c.appendChild(Vr())}var u=null,f=$g(()=>{var M=n();return Jl(M)?M:M==null?[]:Ql(M)}),h,p=new Map,g=!0;function m(M){(E.effect.f&nr)===0&&(E.pending.delete(M),E.fallback=u,Ay(E,h,o,e,r),u!==null&&(h.length===0?(u.f&Rr)===0?gl(u):(u.f^=Rr,mo(u,null,o)):Ui(u,()=>{u=null})))}function _(M){E.pending.delete(M)}var w=Zs(()=>{h=d(f);for(var M=h.length,C=new Set,O=We,A=em(),N=0;N<M;N+=1){var z=h[N],D=r(z,N),G=g?null:a.get(D);G?(G.v&&Rs(G.v,z),G.i&&Rs(G.i,N),A&&O.unskip_effect(G.e)):(G=Oy(a,g?o:lh??(lh=Vr()),z,D,N,i,e,n),g||(G.e.f|=Rr),a.set(D,G)),C.add(D)}if(M===0&&s&&!u&&(g?u=Ln(()=>s(o)):(u=Ln(()=>s(lh??(lh=Vr()))),u.f|=Rr)),M>C.size&&fw(),!g)if(p.set(O,C),A){for(const[K,oe]of a)C.has(K)||O.skip_effect(oe.e);O.oncommit(m),O.ondiscard(_)}else m(O);d(f)}),E={effect:w,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function so(t){for(;t!==null&&(t.f&rr)===0;)t=t.next;return t}function Ay(t,e,n,r,i){var G,K,oe,re,ye,q,Z,J,me;var s=(r&Ew)!==0,o=e.length,a=t.items,l=so(t.effect.first),c,u=null,f,h=[],p=[],g,m,_,w;if(s)for(w=0;w<o;w+=1)g=e[w],m=i(g,w),_=a.get(m).e,(_.f&Rr)===0&&((K=(G=_.nodes)==null?void 0:G.a)==null||K.measure(),(f??(f=new Set)).add(_));for(w=0;w<o;w+=1){if(g=e[w],m=i(g,w),_=a.get(m).e,t.outrogroups!==null)for(const ce of t.outrogroups)ce.pending.delete(_),ce.done.delete(_);if((_.f&Rn)!==0&&(gl(_),s&&((re=(oe=_.nodes)==null?void 0:oe.a)==null||re.unfix(),(f??(f=new Set)).delete(_))),(_.f&Rr)!==0)if(_.f^=Rr,_===l)mo(_,null,n);else{var E=u?u.next:l;_===t.effect.last&&(t.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),ti(t,u,_),ti(t,_,E),mo(_,E,n),u=_,h=[],p=[],l=so(u.next);continue}if(_!==l){if(c!==void 0&&c.has(_)){if(h.length<p.length){var M=p[0],C;u=M.prev;var O=h[0],A=h[h.length-1];for(C=0;C<h.length;C+=1)mo(h[C],M,n);for(C=0;C<p.length;C+=1)c.delete(p[C]);ti(t,O.prev,A.next),ti(t,u,O),ti(t,A,M),l=M,u=A,w-=1,h=[],p=[]}else c.delete(_),mo(_,l,n),ti(t,_.prev,_.next),ti(t,_,u===null?t.effect.first:u.next),ti(t,u,_),u=_;continue}for(h=[],p=[];l!==null&&l!==_;)(c??(c=new Set)).add(l),p.push(l),l=so(l.next);if(l===null)continue}(_.f&Rr)===0&&h.push(_),u=_,l=so(_.next)}if(t.outrogroups!==null){for(const ce of t.outrogroups)ce.pending.size===0&&(Wu(t,Ql(ce.done)),(ye=t.outrogroups)==null||ye.delete(ce));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var N=[];if(c!==void 0)for(_ of c)(_.f&Rn)===0&&N.push(_);for(;l!==null;)(l.f&Rn)===0&&l!==t.fallback&&N.push(l),l=so(l.next);var z=N.length;if(z>0){var D=(r&Og)!==0&&o===0?n:null;if(s){for(w=0;w<z;w+=1)(Z=(q=N[w].nodes)==null?void 0:q.a)==null||Z.measure();for(w=0;w<z;w+=1)(me=(J=N[w].nodes)==null?void 0:J.a)==null||me.fix()}Ry(t,N,D)}}s&&Ar(()=>{var ce,Ee;if(f!==void 0)for(_ of f)(Ee=(ce=_.nodes)==null?void 0:ce.a)==null||Ee.apply()})}function Oy(t,e,n,r,i,s,o,a){var l=(o&yw)!==0?(o&Sw)===0?ry(n,!1,!1):qr(n):null,c=(o&kw)!==0?qr(i):null;return{v:l,i:c,e:Ln(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function mo(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&Rr)===0?e.nodes.start:n;r!==null;){var o=ga(r);if(s.before(r),r===i)return;r=o}}function ti(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function My(t,e,...n){var r=new ic(t);Zs(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},mi)}function Ny(t,e,n){var r=new ic(t);Zs(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},mi)}function Ws(t,e,n){nc(()=>{var r=Ei(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};Vd(()=>{var o=n();vy(o),i&&Ng(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function Iy(t,e){var n=void 0,r;nm(()=>{n!==(n=e())&&(r&&(gn(r),r=null),n&&(r=Ln(()=>{nc(()=>n(t))})))})}function mm(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=mm(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ly(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=mm(t))&&(r&&(r+=" "),r+=e);return r}function zy(t){return typeof t=="object"?Ly(t):t??""}const ch=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Dy(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||ch.includes(r[o-1]))&&(a===r.length||ch.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function uh(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 Uc(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Hy(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(Uc)),i&&l.push(...Object.keys(i).map(Uc));var c=0,u=-1;const m=t.length;for(var f=0;f<m;f++){var h=t[f];if(a?h==="/"&&t[f-1]==="*"&&(a=!1):s?s===h&&(s=!1):h==="/"&&t[f+1]==="*"?a=!0:h==='"'||h==="'"?s=h:h==="("?o++:h===")"&&o--,!a&&s===!1&&o===0){if(h===":"&&u===-1)u=f;else if(h===";"||f===m-1){if(u!==-1){var p=Uc(t.substring(c,u).trim());if(!l.includes(p)){h!==";"&&f++;var g=t.substring(c,f).trim();n+=" "+g+";"}}c=f+1,u=-1}}}}return r&&(n+=uh(r)),i&&(n+=uh(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[Iu];if(o!==n||o===void 0){var a=Dy(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[Iu]=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 $c(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 Uo(t,e,n,r){var i=t[Lu];if(i!==e){var s=Hy(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t[Lu]=e}else r&&(Array.isArray(r)?($c(t,n==null?void 0:n[0],r[0]),$c(t,n==null?void 0:n[1],r[1],"important")):$c(t,n,r));return r}function qu(t,e,n=!1){if(t.multiple){if(e==null)return;if(!Jl(e))return Aw();for(var r of t.options)r.selected=e.includes(dh(r));return}for(r of t.options){var i=dh(r);if(sy(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function By(t){var e=new MutationObserver(()=>{"__value"in t&&qu(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Gd(()=>{e.disconnect()})}function dh(t){return"__value"in t?t.__value:t.value}const Oa=Symbol("class"),oo=Symbol("style"),vm=Symbol("is custom element"),bm=Symbol("is html"),Uy=Ld?"input":"INPUT",$y=Ld?"option":"OPTION",jy=Ld?"select":"SELECT";function Fy(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Oe(t,e,n,r){var i=_m(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[uw]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Yd(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function P(t,e,n){var r=et,i=ot;Hn(null),ir(null);try{e!=="style"&&(Ku.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?Yd(t).includes(e):n&&typeof n=="object")?t[e]=n:Oe(t,e,n==null?n:String(n))}finally{Hn(r),ir(i)}}function Gy(t,e,n,r,i=!1,s=!1){var o=_m(t),a=o[vm],l=!o[bm],c=e||{},u=t.nodeName===$y;for(var f in e)f in n||(n[f]=null);n.class?n.class=zy(n.class):n.class=null,n[oo]&&(n.style??(n.style=null));var h=Yd(t);if(t.nodeName===Uy&&"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,Oe(t,"type",p))}for(const C in n){let O=n[C];if(u&&C==="value"&&O==null){t.value=t.__value="",c[C]=O;continue}if(C==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Ne(t,g,O,r,e==null?void 0:e[Oa],n[Oa]),c[C]=O,c[Oa]=n[Oa];continue}if(C==="style"){Uo(t,O,e==null?void 0:e[oo],n[oo]),c[C]=O,c[oo]=n[oo];continue}var m=c[C];if(!(O===m&&!(O===void 0&&t.hasAttribute(C)))){c[C]=O;var _=C[0]+C[1];if(_!=="$$")if(_==="on"){const A={},N="$$"+C;let z=C.slice(2);var w=wy(z);if(by(z)&&(z=z.slice(0,-7),A.capture=!0),!w&&m){if(O!=null)continue;t.removeEventListener(z,c[N],A),c[N]=null}if(w)ge(z,t,O),ht([z]);else if(O!=null){let D=function(G){c[C].call(this,G)};c[N]=qd(z,t,D,A)}}else if(C==="style")Oe(t,C,O);else if(C==="autofocus")$w(t,!!O);else if(!a&&(C==="__value"||C==="value"&&O!=null))t.value=t.__value=O;else if(C==="selected"&&u)Fy(t,O);else{var E=C;l||(E=ky(E));var M=E==="defaultValue"||E==="defaultChecked";if(O==null&&!a&&!M)if(o[C]=null,E==="value"||E==="checked"){let A=t;const N=e===void 0;if(E==="value"){let z=A.defaultValue;A.removeAttribute(E),A.defaultValue=z,A.value=A.__value=N?z:null}else{let z=A.defaultChecked;A.removeAttribute(E),A.defaultChecked=z,A.checked=N?z:!1}}else t.removeAttribute(C);else M||h.includes(E)&&(a||typeof O!="string")?(t[E]=O,E in o&&(o[E]=Vt)):typeof O!="function"&&Oe(t,E,O)}}}return c}function Vy(t,e,n=[],r=[],i=[],s,o=!1,a=!1){Bg(i,n,r,l=>{var c=void 0,u={},f=t.nodeName===jy,h=!1;if(nm(()=>{var g=e(...l.map(d)),m=Gy(t,c,g,s,o,a);h&&f&&"value"in g&&qu(t,g.value);for(let w of Object.getOwnPropertySymbols(u))g[w]||gn(u[w]);for(let w of Object.getOwnPropertySymbols(g)){var _=g[w];w.description===Cw&&(!c||_!==c[w])&&(u[w]&&gn(u[w]),u[w]=Ln(()=>Iy(t,()=>_))),m[w]=_}c=m}),f){var p=t;nc(()=>{qu(p,c.value,!0),By(p)})}h=!0})}function _m(t){return t[Ja]??(t[Ja]={[vm]:t.nodeName.includes("-"),[bm]:t.namespaceURI===Pw})}var Ku=new Map;function Yd(t){var e=t.getAttribute("is")||t.nodeName,n=Ku.get(e);if(n)return n;Ku.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=Cg(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.push(o);i=ec(i)}return n}function jc(t,e){return t===e||(t==null?void 0:t[fi])===e}function bi(t={},e,n,r){var i=vt.r,s=ot;return nc(()=>{var o,a;return Vd(()=>{o=a,a=(r==null?void 0:r())||[],Ei(()=>{jc(n(...a),t)||(e(t,...a),o&&jc(n(...o),t)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.fΝ)l=l.parent;const c=()=>{a&&jc(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function Xt(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 Un(t){vt===null&&zd(),ha&&vt.l!==null?Zy(vt).m.push(t):Kn(()=>{const e=Ei(t);if(typeof e=="function")return e})}function Si(t){vt===null&&zd(),Un(()=>()=>Ei(t))}function Zy(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const Wy="5";var Sg;typeof window<"u"&&((Sg=window.__svelte??(window.__svelte={})).v??(Sg.v=new Set)).add(Wy);const qy="modulepreload",Ky=function(t){return"/"+t},fh={},vl=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(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};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=Ky(c),c in fh)return;fh[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":qy,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 Mo(t,e){if(e)for(const n in e)t=t.replace(`:${n}`,String(e[n]));return Tt.name==="#"?t==="/"?"/#/":bl("#",t):Tt.name?bl(Tt.name,t):t}function Yy(t,e){let n=Mo(t,e==null?void 0:e.params);return e!=null&&e.search&&(n+=Qd(e.search)),e!=null&&e.hash&&!e.hash.startsWith("#")&&(n+="#"+e.hash),n}function wm(t){return Promise.all(t.map(e=>Xy(e)))}function Xy(t){return new Promise(e=>{Jy(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function Jy(t){return typeof t=="function"&&!!/\(\)\s?=>\s?(import|__vite_ssr_dynamic_import__)\(.*\)/.test(String(t))}function bl(...t){let e="";for(let n of t)n.startsWith("/")||(e+="/"),n.endsWith("/")&&(n=n.slice(0,-1)),e+=n;return e}function Xd(t){return Tt.name&&t.startsWith(Tt.name)&&(t=t.slice(Tt.name.length)||"/"),t}function Jd(){const t=Tt.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=Tt.name==="#"?"":globalThis.location.hash;return{pathname:t,search:globalThis.location.search,state:history.state,hash:e}}function Qd(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 ef(t){if(!t)return{};if(typeof t=="string"){const e=new URLSearchParams(t);return Object.fromEntries([...e.entries()].map(([n,r])=>[n,Qy(r)]))}return t}function Qy(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 Yu(t,e){return ym((n,r)=>n===r,t,e)}Yu.startsWith=(t,e)=>ym((n,r)=>n.startsWith(r),t,e);function ym(t,e,n){if(!e.includes(":")){const s=Tt.name&&Tt.name!=="#"?Mo(e):e;return t(zn.pathname,s)}if(n)return Tt.name==="#"?t(zn.pathname,Mo(e,n).replace("/#","")):t(zn.pathname,Mo(e,n));const r=e.split("/").slice(1);let i=zn.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 tf(t,e){t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/").slice(1),r=e0(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 f of r){const h=f.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 C=g.slice(1);C&&(a[C]=n.slice(p).map(decodeURIComponent).join("/")),u?s=[]:"layout"in e&&e.layout&&s.push(e.layout);const O=(p?"/":"")+h.join("/");i=e[O];break e}else if(g.toLowerCase()!==(m==null?void 0:m.toLowerCase())&&!_)break;if(p!==h.length-1)continue;const w=e["/"+h.join("/")];if(typeof w=="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 w=="function"){if(h.length===n.length){i=w;break e}continue}const E=_?t:"/"+n.slice(p+1).join("/"),M=tf(E,w);if(M.match)i=M.match,a={...a,...M.params},o.push(...M.hooks),l={...l,...M.meta},M.breakFromLayouts?(s=[],u=!0):s.push(...M.layouts);else continue;break e}}return{match:i,layouts:s,hooks:o,params:a,meta:l,breakFromLayouts:u}}function e0(t){return t.toSorted((e,n)=>hh(e)-hh(n))}function hh(t){return t===""||t==="/"?1:t.includes("*")?4:t.includes(":")?3:2}const t0=200,n0=Math.PI/6,r0=50;async function km(t,e,n){const{match:r,layouts:i,hooks:s,meta:o}=tf(e,t);for(const{onPreload:a}of s)a==null||a({pathname:e,meta:o,...n,search:ef(n==null?void 0:n.search)});await wm(r?[...i,r]:i)}const ph=new Set,es=new Set;function i0(t){function e(o){if(!o.getAttribute("href"))return;const l=new URL(o.href),c=Xd(l.pathname),{replace:u,state:f}=o.dataset;km(t,c,{replace:u===""||u==="true",search:l.search,state:f,hash:l.hash})}let n=null;function r(o){if(!o.getPredictedEvents||n)return;if(n=setTimeout(()=>{n=null},r0),es.size===0){document.removeEventListener("pointermove",r);return}const l=o.getPredictedEvents().at(-1);if(!l)return;const c=o.clientX,u=o.clientY,f=l.clientX-c,h=l.clientY-u,p=Math.hypot(f,h);if(p<2)return;const g=f/p,m=h/p;e:for(const _ of es){_.isConnected||es.delete(_);const w=_.getBoundingClientRect(),E=[{x:w.left,y:w.top},{x:w.right,y:w.top},{x:w.left,y:w.bottom},{x:w.right,y:w.bottom},{x:w.left+w.width/2,y:w.top+w.height/2}];for(const M of E){const C=M.x-c,O=M.y-u,A=Math.hypot(C,O);if(A>t0||A<.001)continue;const N=C/A,z=O/A,D=g*N+m*z;if(Math.acos(Math.max(-1,Math.min(1,D)))<=n0){e(_),es.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(!ph.has(a)){switch(ph.add(a),a.dataset.preload){case"":case"true":case"hover":{a.addEventListener("mouseenter",function l(){a.removeEventListener("mouseenter",l),e(a)});break}case"predict":{es.size===0&&document.addEventListener("pointermove",r),es.add(a);break}case"viewport":{i.observe(a);break}default:{console.warn(`Unknown preload strategy \`${a.dataset.preload}\` on`,a,`
|
|
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 gh extends Error{constructor(e){super(`Navigating to: ${e}`),this.name="Redirect"}}var s0=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],o0=["difference","intersection","symmetricDifference","union"],mh=!1,xs,dr,si,Kl,js,Em,Sm;const Yl=class Yl extends Set{constructor(n){super();Se(this,js);Se(this,xs,new Map);Se(this,dr,se(0));Se(this,si,se(0));Se(this,Kl,_r||-1);if(n){for(var r of n)super.add(r);T(this,si).v=super.size}mh||je(this,js,Sm).call(this)}has(n){var r=super.has(n),i=T(this,xs),s=i.get(n);if(s===void 0){if(!r)return d(T(this,dr)),!1;s=je(this,js,Em).call(this,!0),i.set(n,s)}return d(s),r}add(n){return super.has(n)||(super.add(n),k(T(this,si),super.size),on(T(this,dr))),this}delete(n){var r=super.delete(n),i=T(this,xs),s=i.get(n);return s!==void 0&&(i.delete(n),k(s,!1)),r&&(k(T(this,si),super.size),on(T(this,dr))),r}clear(){if(super.size!==0){super.clear();var n=T(this,xs);for(var r of n.values())k(r,!1);n.clear(),k(T(this,si),0),on(T(this,dr))}}keys(){return this.values()}values(){return d(T(this,dr)),super.values()}entries(){return d(T(this,dr)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return d(T(this,si))}};xs=new WeakMap,dr=new WeakMap,si=new WeakMap,Kl=new WeakMap,js=new WeakSet,Em=function(n){return _r===T(this,Kl)?se(n):qr(n)},Sm=function(){mh=!0;var n=Yl.prototype,r=Set.prototype;for(const i of s0)n[i]=function(...s){return d(T(this,dr)),r[i].apply(this,s)};for(const i of o0)n[i]=function(...s){d(T(this,dr));var o=r[i].apply(this,s);return new Yl(o)}};let _l=Yl;var xr,Pr,jr,Xl,vr,vo,il;const qf=class qf extends Map{constructor(n){super();Se(this,vr);Se(this,xr,new Map);Se(this,Pr,se(0));Se(this,jr,se(0));Se(this,Xl,_r||-1);if(n){for(var[r,i]of n)super.set(r,i);T(this,jr).v=super.size}}has(n){var r=T(this,xr),i=r.get(n);if(i===void 0)if(super.has(n))i=je(this,vr,vo).call(this,0),r.set(n,i);else return d(T(this,Pr)),!1;return d(i),!0}forEach(n,r){je(this,vr,il).call(this),super.forEach(n,r)}get(n){var r=T(this,xr),i=r.get(n);if(i===void 0)if(super.has(n))i=je(this,vr,vo).call(this,0),r.set(n,i);else{d(T(this,Pr));return}return d(i),super.get(n)}set(n,r){var f;var i=T(this,xr),s=i.get(n),o=super.get(n),a=super.set(n,r),l=T(this,Pr);if(s===void 0)s=je(this,vr,vo).call(this,0),i.set(n,s),k(T(this,jr),super.size),on(l);else if(o!==r){on(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((f=s.reactions)!=null&&f.every(h=>c.has(h)));u&&on(l)}return a}delete(n){var r=T(this,xr),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),k(i,-1)),s&&(k(T(this,jr),super.size),on(T(this,Pr))),s}clear(){if(super.size!==0){super.clear();var n=T(this,xr);k(T(this,jr),0);for(var r of n.values())k(r,-1);on(T(this,Pr)),n.clear()}}keys(){return d(T(this,Pr)),super.keys()}values(){return je(this,vr,il).call(this),super.values()}entries(){return je(this,vr,il).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(T(this,jr)),super.size}};xr=new WeakMap,Pr=new WeakMap,jr=new WeakMap,Xl=new WeakMap,vr=new WeakSet,vo=function(n){return _r===T(this,Xl)?se(n):qr(n)},il=function(){d(T(this,Pr));var n=T(this,xr);if(T(this,jr).v!==n.size){for(var r of Yf(qf.prototype,this,"keys").call(this))if(!n.has(r)){var i=je(this,vr,vo).call(this,0);n.set(r,i)}}for([,i]of T(this,xr))d(i)};let Zi=qf;const a0=Symbol("replace");var dn,ra,Fr,Hi,bo;class l0 extends URLSearchParams{constructor(){super(...arguments);Se(this,Hi);Se(this,dn,se(0));Se(this,ra,u0());Se(this,Fr,!1)}[a0](n){if(!T(this,Fr)&&n.toString()!==super.toString()){$e(this,Fr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);on(T(this,dn)),$e(this,Fr,!1)}}append(n,r){super.append(n,r),je(this,Hi,bo).call(this),on(T(this,dn))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(je(this,Hi,bo).call(this),on(T(this,dn)))}get(n){return d(T(this,dn)),super.get(n)}getAll(n){return d(T(this,dn)),super.getAll(n)}has(n,r){return d(T(this,dn)),super.has(n,r)}keys(){return d(T(this,dn)),super.keys()}forEach(n,r){d(T(this,dn)),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]))&&(je(this,Hi,bo).call(this),on(T(this,dn)))}sort(){super.sort(),je(this,Hi,bo).call(this),on(T(this,dn))}toString(){return d(T(this,dn)),super.toString()}values(){return d(T(this,dn)),super.values()}entries(){return d(T(this,dn)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(T(this,dn)),super.size}}dn=new WeakMap,ra=new WeakMap,Fr=new WeakMap,Hi=new WeakSet,bo=function(){if(!T(this,ra)||T(this,Fr))return;$e(this,Fr,!0);const n=this.toString();T(this,ra).search=n&&`?${n}`,$e(this,Fr,!1)};let c0=null;function u0(){return c0}let Ma=new l0(globalThis.location.search);function vh(t){if(Ma.toString()===t)return;const e=new URLSearchParams(t);for(const[n,r]of e)Ma.set(n,r);for(const n of Ma.keys())e.has(n)||Ma.delete(n)}let No;const Tt={name:void 0};let Xu=lt({value:[]}),zn=lt({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Jd();zn.pathname=t.pathname,zn.search=t.search,zn.state=t.state,zn.hash=t.hash});let Ju=lt({value:{}}),Tm=lt({value:{}}),Ci=null,Na=null,sl=null;function d0(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(Tt.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(Tt.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(Tt.name)||(e.pathname=bl(Tt.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(zn,Jd())}function f0(t){return No=t,i0(No),{p:Yy,navigate:h0,isActive:Yu,async preload(e){await km(No,e)},route:{get params(){return Ju.value},getParams(e){if(!Yu(e))throw new Error(`\`${e}\` does not match the current route`);return Ju.value},get pathname(){return Xd(zn.pathname)},get search(){return ef(zn.search)},get state(){return zn.state},get hash(){return zn.hash},get meta(){return Tm.value}}}}async function h0(t,e={}){if(typeof t=="number")return globalThis.history.go(t),new gh(`History entry: ${t}`);t=Mo(t,e.params),Tt.name==="#"?t=t.replace("/#",""):e.hash&&!e.hash.startsWith("#")&&(e.hash="#"+e.hash);const n=wl(t,e);return sl=n,await n,new gh(`${t}${Qd((e==null?void 0:e.search)??"")}${(e==null?void 0:e.hash)??""}`)}async function wl(t,e={}){if(!No)throw new Error("Router not initialized: `createRouter` was not called.");if(Na&&Na!==Ci)return;Ci==null||Ci.abort(),Ci=new AbortController;const{signal:n}=Ci,r=p0(t),{match:i,layouts:s,hooks:o,meta:a,params:l}=tf(r,No),c=ef(e.search),u={pathname:r,meta:a,...e,search:c};let f=[];for(const p of o){if(n.aborted)return sl;try{const{beforeLoad:g}=p;f.push(p),Na=Ci,await(g==null?void 0:g(u))}catch(g){if(n.aborted)return sl;for(const{onError:m}of f)m==null||m(g,u);return}finally{Na=null}}let h;try{h=await wm(i?[...s,i]:s)}catch(p){for(const{onError:g}of o)g==null||g(p,u);throw p}if(n.aborted)return sl;if(t){const p=Qd(e.search),g=new URL(globalThis.location.toString());g.search=p||"",g.hash=e.hash||"",Tt.name==="#"?g.hash=t:Tt.name&&!t.startsWith(Tt.name)?g.pathname=bl(Tt.name,t):g.pathname=t;const m=e.replace?"replaceState":"pushState";globalThis.history[m](e.state||{},"",g.toString()),vh(p)}else vh(globalThis.location.search);e.viewTransition&&document.startViewTransition!==void 0?document.startViewTransition(()=>{Xu.value=h}):Xu.value=h,Ju.value=l,Tm.value=a,Object.assign(zn,Jd()),e.scrollToTop!==!1&&window.scrollTo({top:0,left:0,behavior:e.scrollToTop});for(const{afterLoad:p}of o)p==null||p(u)}function p0(t){let e;return t?e=t:Tt.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,Tt.name&&e.startsWith(Tt.name)&&(e=e.slice(Tt.name.length)||"/"),Xd(e)}function g0(t){var f;const e=t.target.closest("a");if(!e||e.hasAttribute("target")||e.hasAttribute("download")||!e.hasAttribute("href")||(f=e.getAttribute("href"))!=null&&f.startsWith("#"))return;const n=new URL(e.href),r=globalThis.location.origin;if(n.origin!==r)return;const i=Tt.name==="#"?n.hash:n.pathname,s=Tt.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}wl(i,{replace:o===""||o==="true",search:n.search,state:u,hash:s,scrollToTop:l==="false"?!1:l,viewTransition:c===""||c==="true"})}function xm(t,e){Fe(e,!0);const n=V(()=>e.tree[0]),r=V(()=>e.tree.slice(1));var i=Bn(),s=tt(i);Ny(s,()=>d(n),(o,a)=>{a(o,{children:(l,c)=>{var u=Bn(),f=tt(u);{var h=p=>{xm(p,{get tree(){return d(r)}})};X(f,p=>{d(r).length>0&&p(h)})}R(l,u)},$$slots:{default:!0}})}),R(t,i),Ge()}function m0(t,e){Fe(e,!0),d0(e.base),wl(),Kn(()=>{const n=oh(globalThis,"popstate",()=>wl()),r=oh(globalThis,"click",g0);return()=>{n(),r()}}),xm(t,{get tree(){return Xu.value}}),Ge()}const v0=720;function va(){return window.matchMedia("(max-width: "+v0+"px)")}function Pm(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Cm(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(Pm(s))Cm(s,e,o,r);else throw new Error(`Plugin catalog ${e} key "${o}" must be a string or object`)}}function b0(t,e){if(!Pm(t))throw new Error(`Plugin catalog ${e} must be a JSON object`);const n={};return Cm(t,e,"",n),Object.freeze(n)}var bh;function F(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 f=0;f<u.length;f++){const h=u[f];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 ds extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Rm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(bh=globalThis).__zod_globalConfig??(bh.__zod_globalConfig={});const nf=globalThis.__zod_globalConfig;function Kr(t){return nf}function Am(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 Qu(t,e){return typeof e=="bigint"?e.toString():e}function sc(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function rf(t){return t==null}function sf(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function _0(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 _h=Symbol("evaluating");function _t(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==_h)return r===void 0&&(r=_h,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Wi(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ti(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function wh(t){return JSON.stringify(t)}function w0(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Om="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function $o(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const y0=sc(()=>{var t;if(nf.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 Os(t){if($o(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!($o(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Mm(t){return Os(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const k0=new Set(["string","number","symbol"]);function Ms(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xi(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 Ce(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 E0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const S0={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 T0(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=Ti(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 Wi(this,"shape",o),o},checks:[]});return xi(t,s)}function x0(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=Ti(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 Wi(this,"shape",o),o},checks:[]});return xi(t,s)}function P0(t,e){if(!Os(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=Ti(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return Wi(this,"shape",s),s}});return xi(t,i)}function C0(t,e){if(!Os(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ti(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return Wi(this,"shape",r),r}});return xi(t,n)}function R0(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=Ti(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return Wi(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return xi(t,n)}function A0(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=Ti(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 Wi(this,"shape",l),l},checks:[]});return xi(e,o)}function O0(t,e,n){const r=Ti(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 Wi(this,"shape",s),s}});return xi(e,r)}function ls(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 M0(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 cs(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Ia(t){return typeof t=="string"?t:t==null?void 0:t.message}function Yr(t,e,n){var l,c,u,f,h,p;const r=t.message?t.message:Ia((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??Ia((f=e==null?void 0:e.error)==null?void 0:f.call(e,t))??Ia((h=n.customError)==null?void 0:h.call(n,t))??Ia((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 of(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function jo(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Nm=(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,Qu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Im=F("$ZodError",Nm),Lm=F("$ZodError",Nm,{Parent:Error});function N0(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 I0(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 af=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 ds;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Yr(l,s,Kr())));throw Om(a,i==null?void 0:i.callee),a}return o.value},lf=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=>Yr(l,s,Kr())));throw Om(a,i==null?void 0:i.callee),a}return o.value},oc=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 ds;return s.issues.length?{success:!1,error:new(t??Im)(s.issues.map(o=>Yr(o,i,Kr())))}:{success:!0,data:s.value}},L0=oc(Lm),ac=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=>Yr(o,i,Kr())))}:{success:!0,data:s.value}},z0=ac(Lm),D0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return af(t)(e,n,i)},H0=t=>(e,n,r)=>af(t)(e,n,r),B0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return lf(t)(e,n,i)},U0=t=>async(e,n,r)=>lf(t)(e,n,r),$0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return oc(t)(e,n,i)},j0=t=>(e,n,r)=>oc(t)(e,n,r),F0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ac(t)(e,n,i)},G0=t=>async(e,n,r)=>ac(t)(e,n,r),V0=/^[cC][0-9a-z]{6,}$/,Z0=/^[0-9a-z]+$/,W0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q0=/^[0-9a-vA-V]{20}$/,K0=/^[A-Za-z0-9]{27}$/,Y0=/^[a-zA-Z0-9_-]{21}$/,X0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,J0=/^([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})$/,yh=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)$/,Q0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function t1(){return new RegExp(e1,"u")}const n1=/^(?:(?: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])$/,r1=/^(([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}|:))$/,i1=/^((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])$/,s1=/^(([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])$/,o1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zm=/^[A-Za-z0-9_-]*$/,a1=/^https?$/,l1=/^\+[1-9]\d{6,14}$/,Dm="(?:(?:\\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])))",c1=new RegExp(`^${Dm}$`);function Hm(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 u1(t){return new RegExp(`^${Hm(t)}$`)}function d1(t){const e=Hm({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(`^${Dm}T(?:${r})$`)}const f1=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}$`)},h1=/^-?\d+$/,Bm=/^-?\d+(?:\.\d+)?$/,p1=/^(?:true|false)$/i,g1=/^[^A-Z]*$/,m1=/^[^a-z]*$/,$n=F("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Um={number:"number",bigint:"bigint",object:"date"},$m=F("$ZodCheckLessThan",(t,e)=>{$n.init(t,e);const n=Um[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})}}),jm=F("$ZodCheckGreaterThan",(t,e)=>{$n.init(t,e);const n=Um[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})}}),v1=F("$ZodCheckMultipleOf",(t,e)=>{$n.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):_0(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})}}),b1=F("$ZodCheckNumberFormat",(t,e)=>{var o;$n.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]=S0[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=h1)}),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})}}),_1=F("$ZodCheckMaxLength",(t,e)=>{var n;$n.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rf(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=of(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),w1=F("$ZodCheckMinLength",(t,e)=>{var n;$n.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rf(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=of(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),y1=F("$ZodCheckLengthEquals",(t,e)=>{var n;$n.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rf(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=of(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})}}),lc=F("$ZodCheckStringFormat",(t,e)=>{var n,r;$n.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=()=>{})}),k1=F("$ZodCheckRegex",(t,e)=>{lc.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})}}),E1=F("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=g1),lc.init(t,e)}),S1=F("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=m1),lc.init(t,e)}),T1=F("$ZodCheckIncludes",(t,e)=>{$n.init(t,e);const n=Ms(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})}}),x1=F("$ZodCheckStartsWith",(t,e)=>{$n.init(t,e);const n=new RegExp(`^${Ms(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})}}),P1=F("$ZodCheckEndsWith",(t,e)=>{$n.init(t,e);const n=new RegExp(`.*${Ms(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})}}),C1=F("$ZodCheckOverwrite",(t,e)=>{$n.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class R1{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
|
-
`).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(`
|
|
5
|
-
`))}}const A1={major:4,minor:4,patch:3},Dt=F("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=A1;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const s of r)for(const o of s._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,l,c)=>{let u=ls(a),f;for(const h of l){if(h._zod.def.when){if(M0(a)||!h._zod.def.when(a))continue}else if(u)continue;const p=a.issues.length,g=h._zod.check(a);if(g instanceof Promise&&(c==null?void 0:c.async)===!1)throw new ds;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==p&&(u||(u=ls(a,p)))});else{if(a.issues.length===p)continue;u||(u=ls(a,p))}}return f?f.then(()=>a):a},o=(a,l,c)=>{if(ls(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new ds;return u.then(f=>t._zod.parse(f,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(f=>o(f,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new ds;return c.then(u=>s(u,r,l))}return s(c,r,l)}}_t(t,"~standard",()=>({validate:s=>{var o;try{const a=L0(t,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return z0(t,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),cf=F("$ZodString",(t,e)=>{var n;Dt.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??f1(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Lt=F("$ZodStringFormat",(t,e)=>{lc.init(t,e),cf.init(t,e)}),O1=F("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=J0),Lt.init(t,e)}),M1=F("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=yh(r))}else e.pattern??(e.pattern=yh());Lt.init(t,e)}),N1=F("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Q0),Lt.init(t,e)}),I1=F("$ZodURL",(t,e)=>{Lt.init(t,e),t._zod.check=n=>{var r;try{const i=n.value.trim();if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===a1.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const s=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=s.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),L1=F("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=t1()),Lt.init(t,e)}),z1=F("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Y0),Lt.init(t,e)}),D1=F("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=V0),Lt.init(t,e)}),H1=F("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Z0),Lt.init(t,e)}),B1=F("$ZodULID",(t,e)=>{e.pattern??(e.pattern=W0),Lt.init(t,e)}),U1=F("$ZodXID",(t,e)=>{e.pattern??(e.pattern=q0),Lt.init(t,e)}),$1=F("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=K0),Lt.init(t,e)}),j1=F("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=d1(e)),Lt.init(t,e)}),F1=F("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=c1),Lt.init(t,e)}),G1=F("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=u1(e)),Lt.init(t,e)}),V1=F("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=X0),Lt.init(t,e)}),Z1=F("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=n1),Lt.init(t,e),t._zod.bag.format="ipv4"}),W1=F("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=r1),Lt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),q1=F("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=i1),Lt.init(t,e)}),K1=F("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=s1),Lt.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Fm(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Y1=F("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=o1),Lt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Fm(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function X1(t){if(!zm.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Fm(n)}const J1=F("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=zm),Lt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{X1(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Q1=F("$ZodE164",(t,e)=>{e.pattern??(e.pattern=l1),Lt.init(t,e)});function ek(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const tk=F("$ZodJWT",(t,e)=>{Lt.init(t,e),t._zod.check=n=>{ek(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Gm=F("$ZodNumber",(t,e)=>{Dt.init(t,e),t._zod.pattern=t._zod.bag.pattern??Bm,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),n}}),nk=F("$ZodNumberFormat",(t,e)=>{b1.init(t,e),Gm.init(t,e)}),rk=F("$ZodBoolean",(t,e)=>{Dt.init(t,e),t._zod.pattern=p1,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),ik=F("$ZodUnknown",(t,e)=>{Dt.init(t,e),t._zod.parse=n=>n}),sk=F("$ZodNever",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function kh(t,e,n){t.issues.length&&e.issues.push(...cs(n,t.issues)),e.value[n]=t.value}const ok=F("$ZodArray",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>kh(c,n,o))):kh(l,n,o)}return s.length?Promise.all(s).then(()=>n):n}});function yl(t,e,n,r,i,s){const o=n in r;if(t.issues.length){if(i&&s&&!o)return;e.issues.push(...cs(n,t.issues))}if(!o&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?o&&(e.value[n]=void 0):e.value[n]=t.value}function Vm(t){var r,i,s,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(s=(i=(r=t.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=E0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Zm(t,e,n,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u=l.optin==="optional",f=l.optout==="optional";for(const h in e){if(h==="__proto__"||a.has(h))continue;if(c==="never"){o.push(h);continue}const p=l.run({value:e[h],issues:[]},r);p instanceof Promise?t.push(p.then(g=>yl(g,n,h,e,u,f))):yl(p,n,h,e,u,f)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const ak=F("$ZodObject",(t,e)=>{Dt.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=sc(()=>Vm(e));_t(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const f of u.values)l[c].add(f)}}return l});const i=$o,s=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],f=o.shape;for(const h of o.keys){const p=f[h],g=p._zod.optin==="optional",m=p._zod.optout==="optional",_=p._zod.run({value:c[h],issues:[]},l);_ instanceof Promise?u.push(_.then(w=>yl(w,a,h,c,g,m))):yl(_,a,h,c,g,m)}return s?Zm(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),lk=F("$ZodObjectJIT",(t,e)=>{ak.init(t,e);const n=t._zod.parse,r=sc(()=>Vm(e)),i=h=>{var M,C;const p=new R1(["shape","payload","ctx"]),g=r.value,m=O=>{const A=wh(O);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};p.write("const input = payload.value;");const _=Object.create(null);let w=0;for(const O of g.keys)_[O]=`key_${w++}`;p.write("const newResult = {};");for(const O of g.keys){const A=_[O],N=wh(O),z=h[O],D=((M=z==null?void 0:z._zod)==null?void 0:M.optin)==="optional",G=((C=z==null?void 0:z._zod)==null?void 0:C.optout)==="optional";p.write(`const ${A} = ${m(O)};`),D&&G?p.write(`
|
|
6
|
-
if (${A}.issues.length) {
|
|
7
|
-
if (${N} in input) {
|
|
8
|
-
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
9
|
-
...iss,
|
|
10
|
-
path: iss.path ? [${N}, ...iss.path] : [${N}]
|
|
11
|
-
})));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (${A}.value === undefined) {
|
|
16
|
-
if (${N} in input) {
|
|
17
|
-
newResult[${N}] = undefined;
|
|
18
|
-
}
|
|
19
|
-
} else {
|
|
20
|
-
newResult[${N}] = ${A}.value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
`):D?p.write(`
|
|
24
|
-
if (${A}.issues.length) {
|
|
25
|
-
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
26
|
-
...iss,
|
|
27
|
-
path: iss.path ? [${N}, ...iss.path] : [${N}]
|
|
28
|
-
})));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (${A}.value === undefined) {
|
|
32
|
-
if (${N} in input) {
|
|
33
|
-
newResult[${N}] = undefined;
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
newResult[${N}] = ${A}.value;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
`):p.write(`
|
|
40
|
-
const ${A}_present = ${N} in input;
|
|
41
|
-
if (${A}.issues.length) {
|
|
42
|
-
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
43
|
-
...iss,
|
|
44
|
-
path: iss.path ? [${N}, ...iss.path] : [${N}]
|
|
45
|
-
})));
|
|
46
|
-
}
|
|
47
|
-
if (!${A}_present && !${A}.issues.length) {
|
|
48
|
-
payload.issues.push({
|
|
49
|
-
code: "invalid_type",
|
|
50
|
-
expected: "nonoptional",
|
|
51
|
-
input: undefined,
|
|
52
|
-
path: [${N}]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (${A}_present) {
|
|
57
|
-
if (${A}.value === undefined) {
|
|
58
|
-
newResult[${N}] = undefined;
|
|
59
|
-
} else {
|
|
60
|
-
newResult[${N}] = ${A}.value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");const E=p.compile();return(O,A)=>E(h,O,A)};let s;const o=$o,a=!nf.jitless,c=a&&y0.value,u=e.catchall;let f;t._zod.parse=(h,p)=>{f??(f=r.value);const g=h.value;return o(g)?a&&c&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(s||(s=i(e.shape)),h=s(h,p),u?Zm([],g,h,p,f,t):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),h)}});function Eh(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!ls(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(o=>Yr(o,r,Kr())))}),e)}const Wm=F("$ZodUnion",(t,e)=>{Dt.init(t,e),_t(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),_t(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),_t(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),_t(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>sf(i.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const a of e.options){const l=a._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)o.push(l),s=!0;else{if(l.issues.length===0)return l;o.push(l)}}return s?Promise.all(o).then(a=>Eh(a,r,t,i)):Eh(o,r,t,i)}}),ck=F("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Wm.init(t,e);const n=t._zod.parse;_t(t._zod,"propValues",()=>{const i={};for(const s of e.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[a,l]of Object.entries(o)){i[a]||(i[a]=new Set);for(const c of l)i[a].add(c)}}return i});const r=sc(()=>{var o;const i=e.options,s=new Map;for(const a of i){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});t._zod.parse=(i,s)=>{const o=i.value;if(!$o(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(i,s):e.unionFallback||s.direction==="backward"?n(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:o,path:[e.discriminator],inst:t}),i)}}),uk=F("$ZodIntersection",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,c])=>Sh(n,l,c)):Sh(n,s,o)}});function ed(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Os(t)&&Os(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};for(const s of r){const o=ed(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],o=ed(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Sh(t,e,n){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&t.issues.push({...i,keys:s}),ls(t))return t;const o=ed(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const dk=F("$ZodRecord",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Os(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const s=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>Yr(p,r,Kr())),input:c,path:[c],inst:t});continue}const f=u.value,h=e.valueType._zod.run({value:i[c],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&n.issues.push(...cs(c,p.issues)),n.value[f]=p.value})):(h.issues.length&&n.issues.push(...cs(c,h.issues)),n.value[f]=h.value)}let l;for(const c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Bm.test(a)&&l.issues.length){const f=e.keyType._zod.run({value:Number(a),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){e.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Yr(f,r,Kr())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:i[a],issues:[]},r);u instanceof Promise?s.push(u.then(f=>{f.issues.length&&n.issues.push(...cs(a,f.issues)),n.value[l.value]=f.value})):(u.issues.length&&n.issues.push(...cs(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),fk=F("$ZodEnum",(t,e)=>{Dt.init(t,e);const n=Am(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>k0.has(typeof i)).map(i=>typeof i=="string"?Ms(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),hk=F("$ZodLiteral",(t,e)=>{if(Dt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ms(r):r?Ms(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),pk=F("$ZodTransform",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Rm(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n.fallback=!0,n));if(i instanceof Promise)throw new ds;return n.value=i,n.fallback=!0,n}});function Th(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const qm=F("$ZodOptional",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",_t(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),_t(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${sf(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=n.value,s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>Th(o,i)):Th(s,i)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),gk=F("$ZodExactOptional",(t,e)=>{qm.init(t,e),_t(t._zod,"values",()=>e.innerType._zod.values),_t(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),mk=F("$ZodNullable",(t,e)=>{Dt.init(t,e),_t(t._zod,"optin",()=>e.innerType._zod.optin),_t(t._zod,"optout",()=>e.innerType._zod.optout),_t(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${sf(n.source)}|null)$`):void 0}),_t(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),vk=F("$ZodDefault",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",_t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>xh(s,e)):xh(i,e)}});function xh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const bk=F("$ZodPrefault",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",_t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),_k=F("$ZodNonOptional",(t,e)=>{Dt.init(t,e),_t(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Ph(s,t)):Ph(i,t)}});function Ph(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const wk=F("$ZodCatch",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",_t(t._zod,"optout",()=>e.innerType._zod.optout),_t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(o=>Yr(o,r,Kr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Yr(s,r,Kr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Km=F("$ZodPipe",(t,e)=>{Dt.init(t,e),_t(t._zod,"values",()=>e.in._zod.values),_t(t._zod,"optin",()=>e.in._zod.optin),_t(t._zod,"optout",()=>e.out._zod.optout),_t(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(o=>La(o,e.in,r)):La(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>La(s,e.out,r)):La(i,e.out,r)}});function La(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const yk=F("$ZodPreprocess",(t,e)=>{Km.init(t,e)}),kk=F("$ZodReadonly",(t,e)=>{Dt.init(t,e),_t(t._zod,"propValues",()=>e.innerType._zod.propValues),_t(t._zod,"values",()=>e.innerType._zod.values),_t(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),_t(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(Ch):Ch(i)}});function Ch(t){return t.value=Object.freeze(t.value),t}const Ek=F("$ZodCustom",(t,e)=>{$n.init(t,e),Dt.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Rh(s,n,r,t));Rh(i,n,r,t)}});function Rh(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(jo(i))}}var Ah;class Sk{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Tk(){return new Sk}(Ah=globalThis).__zod_globalRegistry??(Ah.__zod_globalRegistry=Tk());const _o=globalThis.__zod_globalRegistry;function xk(t,e){return new t({type:"string",...Ce(e)})}function Pk(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Ce(e)})}function Oh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(e)})}function Ck(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(e)})}function Rk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(e)})}function Ak(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(e)})}function Ok(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(e)})}function Mk(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ce(e)})}function Nk(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(e)})}function Ik(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(e)})}function Lk(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(e)})}function zk(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(e)})}function Dk(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(e)})}function Hk(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(e)})}function Bk(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(e)})}function Uk(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(e)})}function $k(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(e)})}function jk(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(e)})}function Fk(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(e)})}function Gk(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(e)})}function Vk(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(e)})}function Zk(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(e)})}function Wk(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(e)})}function qk(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(e)})}function Kk(t,e){return new t({type:"string",format:"date",check:"string_format",...Ce(e)})}function Yk(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Ce(e)})}function Xk(t,e){return new t({type:"string",format:"duration",check:"string_format",...Ce(e)})}function Jk(t,e){return new t({type:"number",checks:[],...Ce(e)})}function Qk(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(e)})}function eE(t,e){return new t({type:"boolean",...Ce(e)})}function tE(t){return new t({type:"unknown"})}function nE(t,e){return new t({type:"never",...Ce(e)})}function Mh(t,e){return new $m({check:"less_than",...Ce(e),value:t,inclusive:!1})}function Fc(t,e){return new $m({check:"less_than",...Ce(e),value:t,inclusive:!0})}function Nh(t,e){return new jm({check:"greater_than",...Ce(e),value:t,inclusive:!1})}function Gc(t,e){return new jm({check:"greater_than",...Ce(e),value:t,inclusive:!0})}function Ih(t,e){return new v1({check:"multiple_of",...Ce(e),value:t})}function Ym(t,e){return new _1({check:"max_length",...Ce(e),maximum:t})}function kl(t,e){return new w1({check:"min_length",...Ce(e),minimum:t})}function Xm(t,e){return new y1({check:"length_equals",...Ce(e),length:t})}function rE(t,e){return new k1({check:"string_format",format:"regex",...Ce(e),pattern:t})}function iE(t){return new E1({check:"string_format",format:"lowercase",...Ce(t)})}function sE(t){return new S1({check:"string_format",format:"uppercase",...Ce(t)})}function oE(t,e){return new T1({check:"string_format",format:"includes",...Ce(e),includes:t})}function aE(t,e){return new x1({check:"string_format",format:"starts_with",...Ce(e),prefix:t})}function lE(t,e){return new P1({check:"string_format",format:"ends_with",...Ce(e),suffix:t})}function qs(t){return new C1({check:"overwrite",tx:t})}function cE(t){return qs(e=>e.normalize(t))}function uE(){return qs(t=>t.trim())}function dE(){return qs(t=>t.toLowerCase())}function fE(){return qs(t=>t.toUpperCase())}function hE(){return qs(t=>w0(t))}function pE(t,e,n){return new t({type:"array",element:e,...Ce(n)})}function gE(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Ce(n)})}function mE(t,e){const n=vE(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(jo(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(jo(s))}},t(r.value,r)),e);return n}function vE(t,e){const n=new $n({check:"custom",...Ce(e)});return n._zod.check=t,n}function Jm(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??_o,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function qt(t,e,n={path:[],schemaPath:[]}){var u,f;var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(f=(u=t._zod).toJSONSchema)==null?void 0:f.call(u);if(a)o.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,h);else{const g=o.schema,m=e.processors[i.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);m(t,e,g,h)}const p=t._zod.parent;p&&(o.ref||(o.ref=p),qt(p,e,h),e.seen.get(p).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&Tn(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Qm(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const f=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(f){const h=r.get(f);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,u[0])}}const i=u=>{var m;const f=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const _=(m=t.external.registry.get(u[0]))==null?void 0:m.id,w=t.external.uri??(M=>M);if(_)return{ref:w(_)};const E=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=E,{defId:E,ref:`${w("__shared")}#/${f}/${E}`}}if(u[1]===n)return{ref:"#"};const p=`#/${f}/`,g=u[1].schema.id??`__schema${t.counter++}`;return{defId:g,ref:p+g}},s=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:h,defId:p}=i(u);f.def={...f.schema},p&&(f.defId=p);const g=f.schema;for(const m in g)delete g[m];g.$ref=h};if(t.cycles==="throw")for(const u of t.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${(a=f.cycle)==null?void 0:a.join("/")}/<root>
|
|
65
|
-
|
|
66
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const f=u[1];if(e===u[0]){s(u);continue}if(t.external){const p=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&p){s(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){s(u);continue}if(f.cycle){s(u);continue}if(f.count>1&&t.reused==="ref"){s(u);continue}}}function ev(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=f=>{const h=t.seen.get(f);if(h.ref===null)return;const p=h.def??h.schema,g={...p},m=h.ref;if(h.ref=null,m){r(m);const w=t.seen.get(m),E=w.schema;if(E.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(E)):Object.assign(p,E),Object.assign(p,g),f._zod.parent===m)for(const C in p)C==="$ref"||C==="allOf"||C in g||delete p[C];if(E.$ref&&w.def)for(const C in p)C==="$ref"||C==="allOf"||C in w.def&&JSON.stringify(p[C])===JSON.stringify(w.def[C])&&delete p[C]}const _=f._zod.parent;if(_&&_!==m){r(_);const w=t.seen.get(_);if(w!=null&&w.schema.$ref&&(p.$ref=w.schema.$ref,w.def))for(const E in p)E==="$ref"||E==="allOf"||E in w.def&&JSON.stringify(p[E])===JSON.stringify(w.def[E])&&delete p[E]}t.override({zodSchema:f,jsonSchema:p,path:h.path??[]})};for(const f of[...t.seen.entries()].reverse())r(f[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const f=(l=t.external.registry.get(e))==null?void 0:l.id;if(!f)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(f)}Object.assign(i,n.def??n.schema);const s=(c=t.metadataRegistry.get(e))==null?void 0:c.id;s!==void 0&&i.id===s&&delete i.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const f of t.seen.entries()){const h=f[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,o[h.defId]=h.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const f=JSON.parse(JSON.stringify(i));return Object.defineProperty(f,"~standard",{value:{...e["~standard"],jsonSchema:{input:El(e,"input",t.processors),output:El(e,"output",t.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Tn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Tn(r.element,n);if(r.type==="set")return Tn(r.valueType,n);if(r.type==="lazy")return Tn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Tn(r.innerType,n);if(r.type==="intersection")return Tn(r.left,n)||Tn(r.right,n);if(r.type==="record"||r.type==="map")return Tn(r.keyType,n)||Tn(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Tn(r.in,n)||Tn(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Tn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Tn(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Tn(i,n))return!0;return!!(r.rest&&Tn(r.rest,n))}return!1}const bE=(t,e={})=>n=>{const r=Jm({...n,processors:e});return qt(t,r),Qm(r,t),ev(r,t)},El=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Jm({...i??{},target:s,io:e,processors:n});return qt(t,o),Qm(o,t),ev(o,t)},_E={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wE=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=_E[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},yE=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const f=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),h=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";f?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),h?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},kE=(t,e,n,r)=>{n.type="boolean"},EE=(t,e,n,r)=>{n.not={}},SE=(t,e,n,r)=>{},TE=(t,e,n,r)=>{const i=t._zod.def,s=Am(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},xE=(t,e,n,r)=>{const i=t._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},PE=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},CE=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},RE=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=qt(s.element,e,{...r,path:[...r.path,"items"]})},AE=(t,e,n,r)=>{var c;const i=n,s=t._zod.def;i.type="object",i.properties={};const o=s.shape;for(const u in o)i.properties[u]=qt(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const f=s.shape[u]._zod;return e.io==="input"?f.optin===void 0:f.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=qt(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},OE=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>qt(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},ME=(t,e,n,r)=>{const i=t._zod.def,s=qt(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=qt(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},NE=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=qt(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const f of l)i.patternProperties[f.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=qt(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=qt(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(f=>typeof f=="string"||typeof f=="number");u.length>0&&(i.required=u)}},IE=(t,e,n,r)=>{const i=t._zod.def,s=qt(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},LE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},zE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},DE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},HE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},BE=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;qt(o,e,r);const a=e.seen.get(t);a.ref=o},UE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},tv=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},$E=F("ZodISODateTime",(t,e)=>{j1.init(t,e),Bt.init(t,e)});function jE(t){return qk($E,t)}const FE=F("ZodISODate",(t,e)=>{F1.init(t,e),Bt.init(t,e)});function GE(t){return Kk(FE,t)}const VE=F("ZodISOTime",(t,e)=>{G1.init(t,e),Bt.init(t,e)});function ZE(t){return Yk(VE,t)}const WE=F("ZodISODuration",(t,e)=>{V1.init(t,e),Bt.init(t,e)});function qE(t){return Xk(WE,t)}const KE=(t,e)=>{Im.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>I0(t,n)},flatten:{value:n=>N0(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Qu,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Qu,2)}},isEmpty:{get(){return t.issues.length===0}}})},sr=F("ZodError",KE,{Parent:Error}),YE=af(sr),XE=lf(sr),JE=oc(sr),QE=ac(sr),eS=D0(sr),tS=H0(sr),nS=B0(sr),rS=U0(sr),iS=$0(sr),sS=j0(sr),oS=F0(sr),aS=G0(sr),Lh=new WeakMap;function ba(t,e,n){const r=Object.getPrototypeOf(t);let i=Lh.get(r);if(i||(i=new Set,Lh.set(r,i)),!i.has(e)){i.add(e);for(const s in n){const o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const Ht=F("ZodType",(t,e)=>(Dt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:El(t,"input"),output:El(t,"output")}}),t.toJSONSchema=bE(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>YE(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>JE(t,n,r),t.parseAsync=async(n,r)=>XE(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>QE(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>eS(t,n,r),t.decode=(n,r)=>tS(t,n,r),t.encodeAsync=async(n,r)=>nS(t,n,r),t.decodeAsync=async(n,r)=>rS(t,n,r),t.safeEncode=(n,r)=>iS(t,n,r),t.safeDecode=(n,r)=>sS(t,n,r),t.safeEncodeAsync=async(n,r)=>oS(t,n,r),t.safeDecodeAsync=async(n,r)=>aS(t,n,r),ba(t,"ZodType",{check(...n){const r=this.def;return this.clone(Ti(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return xi(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(JS(n,r))},superRefine(n,r){return this.check(QS(n,r))},overwrite(n){return this.check(qs(n))},optional(){return Bh(this)},exactOptional(){return BS(this)},nullable(){return Uh(this)},nullish(){return Bh(Uh(this))},nonoptional(n){return VS(this,n)},array(){return zt(this)},or(n){return li([this,n])},and(n){return LS(this,n)},transform(n){return $h(this,sv(n))},default(n){return jS(this,n)},prefault(n){return GS(this,n)},catch(n){return WS(this,n)},pipe(n){return $h(this,n)},readonly(){return YS(this)},describe(n){const r=this.clone();return _o.add(r,{description:n}),r},meta(...n){if(n.length===0)return _o.get(this);const r=this.clone();return _o.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=_o.get(t))==null?void 0:n.description},configurable:!0}),t)),nv=F("_ZodString",(t,e)=>{cf.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>wE(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,ba(t,"_ZodString",{regex(...r){return this.check(rE(...r))},includes(...r){return this.check(oE(...r))},startsWith(...r){return this.check(aE(...r))},endsWith(...r){return this.check(lE(...r))},min(...r){return this.check(kl(...r))},max(...r){return this.check(Ym(...r))},length(...r){return this.check(Xm(...r))},nonempty(...r){return this.check(kl(1,...r))},lowercase(r){return this.check(iE(r))},uppercase(r){return this.check(sE(r))},trim(){return this.check(uE())},normalize(...r){return this.check(cE(...r))},toLowerCase(){return this.check(dE())},toUpperCase(){return this.check(fE())},slugify(){return this.check(hE())}})}),lS=F("ZodString",(t,e)=>{cf.init(t,e),nv.init(t,e),t.email=n=>t.check(Pk(cS,n)),t.url=n=>t.check(Mk(uS,n)),t.jwt=n=>t.check(Wk(TS,n)),t.emoji=n=>t.check(Nk(dS,n)),t.guid=n=>t.check(Oh(zh,n)),t.uuid=n=>t.check(Ck(za,n)),t.uuidv4=n=>t.check(Rk(za,n)),t.uuidv6=n=>t.check(Ak(za,n)),t.uuidv7=n=>t.check(Ok(za,n)),t.nanoid=n=>t.check(Ik(fS,n)),t.guid=n=>t.check(Oh(zh,n)),t.cuid=n=>t.check(Lk(hS,n)),t.cuid2=n=>t.check(zk(pS,n)),t.ulid=n=>t.check(Dk(gS,n)),t.base64=n=>t.check(Gk(kS,n)),t.base64url=n=>t.check(Vk(ES,n)),t.xid=n=>t.check(Hk(mS,n)),t.ksuid=n=>t.check(Bk(vS,n)),t.ipv4=n=>t.check(Uk(bS,n)),t.ipv6=n=>t.check($k(_S,n)),t.cidrv4=n=>t.check(jk(wS,n)),t.cidrv6=n=>t.check(Fk(yS,n)),t.e164=n=>t.check(Zk(SS,n)),t.datetime=n=>t.check(jE(n)),t.date=n=>t.check(GE(n)),t.time=n=>t.check(ZE(n)),t.duration=n=>t.check(qE(n))});function be(t){return xk(lS,t)}const Bt=F("ZodStringFormat",(t,e)=>{Lt.init(t,e),nv.init(t,e)}),cS=F("ZodEmail",(t,e)=>{N1.init(t,e),Bt.init(t,e)}),zh=F("ZodGUID",(t,e)=>{O1.init(t,e),Bt.init(t,e)}),za=F("ZodUUID",(t,e)=>{M1.init(t,e),Bt.init(t,e)}),uS=F("ZodURL",(t,e)=>{I1.init(t,e),Bt.init(t,e)}),dS=F("ZodEmoji",(t,e)=>{L1.init(t,e),Bt.init(t,e)}),fS=F("ZodNanoID",(t,e)=>{z1.init(t,e),Bt.init(t,e)}),hS=F("ZodCUID",(t,e)=>{D1.init(t,e),Bt.init(t,e)}),pS=F("ZodCUID2",(t,e)=>{H1.init(t,e),Bt.init(t,e)}),gS=F("ZodULID",(t,e)=>{B1.init(t,e),Bt.init(t,e)}),mS=F("ZodXID",(t,e)=>{U1.init(t,e),Bt.init(t,e)}),vS=F("ZodKSUID",(t,e)=>{$1.init(t,e),Bt.init(t,e)}),bS=F("ZodIPv4",(t,e)=>{Z1.init(t,e),Bt.init(t,e)}),_S=F("ZodIPv6",(t,e)=>{W1.init(t,e),Bt.init(t,e)}),wS=F("ZodCIDRv4",(t,e)=>{q1.init(t,e),Bt.init(t,e)}),yS=F("ZodCIDRv6",(t,e)=>{K1.init(t,e),Bt.init(t,e)}),kS=F("ZodBase64",(t,e)=>{Y1.init(t,e),Bt.init(t,e)}),ES=F("ZodBase64URL",(t,e)=>{J1.init(t,e),Bt.init(t,e)}),SS=F("ZodE164",(t,e)=>{Q1.init(t,e),Bt.init(t,e)}),TS=F("ZodJWT",(t,e)=>{tk.init(t,e),Bt.init(t,e)}),rv=F("ZodNumber",(t,e)=>{Gm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>yE(t,r,i),ba(t,"ZodNumber",{gt(r,i){return this.check(Nh(r,i))},gte(r,i){return this.check(Gc(r,i))},min(r,i){return this.check(Gc(r,i))},lt(r,i){return this.check(Mh(r,i))},lte(r,i){return this.check(Fc(r,i))},max(r,i){return this.check(Fc(r,i))},int(r){return this.check(Dh(r))},safe(r){return this.check(Dh(r))},positive(r){return this.check(Nh(0,r))},nonnegative(r){return this.check(Gc(0,r))},negative(r){return this.check(Mh(0,r))},nonpositive(r){return this.check(Fc(0,r))},multipleOf(r,i){return this.check(Ih(r,i))},step(r,i){return this.check(Ih(r,i))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function pn(t){return Jk(rv,t)}const xS=F("ZodNumberFormat",(t,e)=>{nk.init(t,e),rv.init(t,e)});function Dh(t){return Qk(xS,t)}const PS=F("ZodBoolean",(t,e)=>{rk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>kE(t,n,r)});function Mr(t){return eE(PS,t)}const CS=F("ZodUnknown",(t,e)=>{ik.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>SE()});function td(){return tE(CS)}const RS=F("ZodNever",(t,e)=>{sk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>EE(t,n,r)});function AS(t){return nE(RS,t)}const OS=F("ZodArray",(t,e)=>{ok.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>RE(t,n,r,i),t.element=e.element,ba(t,"ZodArray",{min(n,r){return this.check(kl(n,r))},nonempty(n){return this.check(kl(1,n))},max(n,r){return this.check(Ym(n,r))},length(n,r){return this.check(Xm(n,r))},unwrap(){return this.element}})});function zt(t,e){return pE(OS,t,e)}const MS=F("ZodObject",(t,e)=>{lk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>AE(t,n,r,i),_t(t,"shape",()=>e.shape),ba(t,"ZodObject",{keyof(){return kn(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:td()})},loose(){return this.clone({...this._zod.def,catchall:td()})},strict(){return this.clone({...this._zod.def,catchall:AS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return P0(this,n)},safeExtend(n){return C0(this,n)},merge(n){return R0(this,n)},pick(n){return T0(this,n)},omit(n){return x0(this,n)},partial(...n){return A0(ov,this,n[0])},required(...n){return O0(av,this,n[0])}})});function Ye(t,e){const n={type:"object",shape:t??{},...Ce(e)};return new MS(n)}const iv=F("ZodUnion",(t,e)=>{Wm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>OE(t,n,r,i),t.options=e.options});function li(t,e){return new iv({type:"union",options:t,...Ce(e)})}const NS=F("ZodDiscriminatedUnion",(t,e)=>{iv.init(t,e),ck.init(t,e)});function uf(t,e,n){return new NS({type:"union",options:e,discriminator:t,...Ce(n)})}const IS=F("ZodIntersection",(t,e)=>{uk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ME(t,n,r,i)});function LS(t,e){return new IS({type:"intersection",left:t,right:e})}const Hh=F("ZodRecord",(t,e)=>{dk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>NE(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Ks(t,e,n){return!e||!e._zod?new Hh({type:"record",keyType:be(),valueType:t,...Ce(e)}):new Hh({type:"record",keyType:t,valueType:e,...Ce(n)})}const nd=F("ZodEnum",(t,e)=>{fk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>TE(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new nd({...e,checks:[],...Ce(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new nd({...e,checks:[],...Ce(i),entries:s})}});function kn(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new nd({type:"enum",entries:n,...Ce(e)})}const zS=F("ZodLiteral",(t,e)=>{hk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>xE(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Zt(t,e){return new zS({type:"literal",values:Array.isArray(t)?t:[t],...Ce(e)})}const DS=F("ZodTransform",(t,e)=>{pk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>CE(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Rm(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(jo(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(jo(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function sv(t){return new DS({type:"transform",transform:t})}const ov=F("ZodOptional",(t,e)=>{qm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>tv(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Bh(t){return new ov({type:"optional",innerType:t})}const HS=F("ZodExactOptional",(t,e)=>{gk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>tv(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function BS(t){return new HS({type:"optional",innerType:t})}const US=F("ZodNullable",(t,e)=>{mk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>IE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Uh(t){return new US({type:"nullable",innerType:t})}const $S=F("ZodDefault",(t,e)=>{vk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>zE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function jS(t,e){return new $S({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Mm(e)}})}const FS=F("ZodPrefault",(t,e)=>{bk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>DE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function GS(t,e){return new FS({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Mm(e)}})}const av=F("ZodNonOptional",(t,e)=>{_k.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>LE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function VS(t,e){return new av({type:"nonoptional",innerType:t,...Ce(e)})}const ZS=F("ZodCatch",(t,e)=>{wk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>HE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function WS(t,e){return new ZS({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const lv=F("ZodPipe",(t,e)=>{Km.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>BE(t,n,r,i),t.in=e.in,t.out=e.out});function $h(t,e){return new lv({type:"pipe",in:t,out:e})}const qS=F("ZodPreprocess",(t,e)=>{lv.init(t,e),yk.init(t,e)}),KS=F("ZodReadonly",(t,e)=>{kk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>UE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function YS(t){return new KS({type:"readonly",innerType:t})}const XS=F("ZodCustom",(t,e)=>{Ek.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>PE(t,n)});function JS(t,e={}){return gE(XS,t,e)}function QS(t,e){return mE(t,e)}function eT(t,e){return new qS({type:"pipe",in:sv(t),out:e})}const tT=be().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/),Ie=be().min(1),df=pn().int(),Da=df.nonnegative(),jh=4*1024;kn(["hook","log","internal"]);const nT=/^events:(\*|[a-z][a-z0-9]*(?:,[a-z][a-z0-9]*)*)$/,rT=be().regex(nT),yt=(t,e,n)=>{const r=typeof e=="string"?Zt(e):e;return Ye({id:tT,ts:df,topic:Zt(t),source:r,payload:n}).strict()},nn=t=>Ye(t).strict(),Fh=li([yt("wan.connected",li([Zt("hook"),Zt("log")]),nn({interface:Ie,address:Ie,mask:Ie,gateway:Ie})),yt("wan.disconnected",li([Zt("hook"),Zt("log")]),nn({interface:Ie})),yt("net.ip_changed",li([Zt("hook"),Zt("log")]),Ye({address:Ie,mask:Ie,link:Ie,connected:Mr()}).strict()),yt("net.dhcp_lease","log",nn({mac:Ie,ip:Ie,hostname:Ie,action:Ie})),yt("net.dns_changed","log",Ye({resolvers:zt(Ie)}).strict()),yt("wifi.client_join","log",nn({mac:Ie,band:Ie,ssid:Ie,iface:Ie})),yt("wifi.client_leave","log",nn({mac:Ie,band:Ie,ssid:Ie,iface:Ie})),yt("firewall.rebuilt","hook",nn({table_type:Ie,table:Ie})),yt("usb.attached","hook",nn({device:Ie,model:Ie,vendor:Ie,port:Ie})),yt("usb.detached","hook",nn({device:Ie,port:Ie})),yt("fs.mounted","hook",nn({fs_type:Ie,label:Ie,directory:Ie})),yt("fs.unmounted","hook",nn({label:Ie,directory:Ie})),yt("clock.synced","hook",Ye({offset_ms:df.optional()}).strict()),yt("schedule.fired","hook",Ye({name:Ie,action:Ie,elapsed:Da}).strict()),yt("button.pressed","hook",nn({button:Ie,gesture:Ie})),yt("auth.login","log",Ye({user:Ie,ip:Ie,success:Mr()}).strict()),yt("firmware.available","log",nn({version:Ie})),yt("plugin.installed","internal",nn({name:Ie,version:Ie})),yt("plugin.removed","internal",nn({name:Ie})),yt("plugin.approved","internal",nn({name:Ie,version:Ie})),yt("plugin.started","internal",nn({name:Ie})),yt("plugin.stopped","internal",Ye({name:Ie,reason:Ie}).strict()),yt("daemon.started","internal",Ye({version:Ie,uptime_ms:Da}).strict()),yt("daemon.stopping","internal",nn({reason:Ie})),yt("daemon.updated","internal",nn({version:Ie})),yt("storage.low","internal",Ye({path:Zt("/opt"),available_bytes:Da,threshold_bytes:Da}).strict()),yt("telemetry.gathering_changed","internal",Ye({enabled:Mr()}).strict())]).superRefine((t,e)=>{new TextEncoder().encode(JSON.stringify(t.payload)).length>jh&&e.addIssue({code:"custom",message:`payload exceeds ${jh} bytes`})});function Vc(t,e){const n=e&&e.cache?e.cache:uT,r=e&&e.serializer?e.serializer:lT;return(e&&e.strategy?e.strategy:oT)(t,{cache:n,serializer:r})}function iT(t){return t==null||typeof t=="number"||typeof t=="boolean"}function sT(t,e,n,r){const i=iT(r)?r:n(r);let s=e.get(i);return typeof s>"u"&&(s=t.call(this,r),e.set(i,s)),s}function cv(t,e,n){const r=Array.prototype.slice.call(arguments,3),i=n(r);let s=e.get(i);return typeof s>"u"&&(s=t.apply(this,r),e.set(i,s)),s}function uv(t,e,n,r,i){return n.bind(e,t,r,i)}function oT(t,e){const n=t.length===1?sT:cv;return uv(t,this,n,e.cache.create(),e.serializer)}function aT(t,e){return uv(t,this,cv,e.cache.create(),e.serializer)}const lT=function(){return JSON.stringify(arguments)};var cT=class{constructor(){this.cache=Object.create(null)}get(t){return this.cache[t]}set(t,e){this.cache[t]=e}};const uT={create:function(){return new cT}},Zc={variadic:aT},dT=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function fT(t){const e={};return t.replace(dT,n=>{const r=n.length;switch(n[0]){case"G":e.era=r===4?"long":r===5?"narrow":"short";break;case"y":e.year=r===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":e.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":e.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":e.weekday=r===4?"long":r===5?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][r-3];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][r-3];break;case"a":e.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":e.hourCycle="h12",e.hour=["numeric","2-digit"][r-1];break;case"H":e.hourCycle="h23",e.hour=["numeric","2-digit"][r-1];break;case"K":e.hourCycle="h11",e.hour=["numeric","2-digit"][r-1];break;case"k":e.hourCycle="h24",e.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":e.minute=["numeric","2-digit"][r-1];break;case"s":e.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":e.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),e}const hT=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function pT(t){if(t.length===0)throw new Error("Number skeleton cannot be empty");const e=t.split(hT).filter(r=>r.length>0),n=[];for(const r of e){let i=r.split("/");if(i.length===0)throw new Error("Invalid number skeleton");const[s,...o]=i;for(const a of o)if(a.length===0)throw new Error("Invalid number skeleton");n.push({stem:s,options:o})}return n}function gT(t){return t.replace(/^(.*?)-/,"")}const Gh=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,dv=/^(@+)?(\+|#+)?[rs]?$/g,mT=/(\*)(0+)|(#+)(0+)|(0+)/g,fv=/^(0+)$/;function Vh(t){const e={};return t[t.length-1]==="r"?e.roundingPriority="morePrecision":t[t.length-1]==="s"&&(e.roundingPriority="lessPrecision"),t.replace(dv,function(n,r,i){return typeof i!="string"?(e.minimumSignificantDigits=r.length,e.maximumSignificantDigits=r.length):i==="+"?e.minimumSignificantDigits=r.length:r[0]==="#"?e.maximumSignificantDigits=r.length:(e.minimumSignificantDigits=r.length,e.maximumSignificantDigits=r.length+(typeof i=="string"?i.length:0)),""}),e}function hv(t){switch(t){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function vT(t){let e;if(t[0]==="E"&&t[1]==="E"?(e={notation:"engineering"},t=t.slice(2)):t[0]==="E"&&(e={notation:"scientific"},t=t.slice(1)),e){const n=t.slice(0,2);if(n==="+!"?(e.signDisplay="always",t=t.slice(2)):n==="+?"&&(e.signDisplay="exceptZero",t=t.slice(2)),!fv.test(t))throw new Error("Malformed concise eng/scientific notation");e.minimumIntegerDigits=t.length}return e}function Zh(t){const e={},n=hv(t);return n||e}function bT(t){let e={};for(const n of t){switch(n.stem){case"percent":case"%":e.style="percent";continue;case"%x100":e.style="percent",e.scale=100;continue;case"currency":e.style="currency",e.currency=n.options[0];continue;case"group-off":case",_":e.useGrouping=!1;continue;case"precision-integer":case".":e.maximumFractionDigits=0;continue;case"measure-unit":case"unit":e.style="unit",e.unit=gT(n.options[0]);continue;case"compact-short":case"K":e.notation="compact",e.compactDisplay="short";continue;case"compact-long":case"KK":e.notation="compact",e.compactDisplay="long";continue;case"scientific":e={...e,notation:"scientific",...n.options.reduce((s,o)=>({...s,...Zh(o)}),{})};continue;case"engineering":e={...e,notation:"engineering",...n.options.reduce((s,o)=>({...s,...Zh(o)}),{})};continue;case"notation-simple":e.notation="standard";continue;case"unit-width-narrow":e.currencyDisplay="narrowSymbol",e.unitDisplay="narrow";continue;case"unit-width-short":e.currencyDisplay="code",e.unitDisplay="short";continue;case"unit-width-full-name":e.currencyDisplay="name",e.unitDisplay="long";continue;case"unit-width-iso-code":e.currencyDisplay="symbol";continue;case"scale":e.scale=parseFloat(n.options[0]);continue;case"rounding-mode-floor":e.roundingMode="floor";continue;case"rounding-mode-ceiling":e.roundingMode="ceil";continue;case"rounding-mode-down":e.roundingMode="trunc";continue;case"rounding-mode-up":e.roundingMode="expand";continue;case"rounding-mode-half-even":e.roundingMode="halfEven";continue;case"rounding-mode-half-down":e.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":e.roundingMode="halfExpand";continue;case"integer-width":if(n.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");n.options[0].replace(mT,function(s,o,a,l,c,u){if(o)e.minimumIntegerDigits=a.length;else{if(l&&c)throw new Error("We currently do not support maximum integer digits");if(u)throw new Error("We currently do not support exact integer digits")}return""});continue}if(fv.test(n.stem)){e.minimumIntegerDigits=n.stem.length;continue}if(Gh.test(n.stem)){if(n.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");n.stem.replace(Gh,function(o,a,l,c,u,f){return l==="*"?e.minimumFractionDigits=a.length:c&&c[0]==="#"?e.maximumFractionDigits=c.length:u&&f?(e.minimumFractionDigits=u.length,e.maximumFractionDigits=u.length+f.length):(e.minimumFractionDigits=a.length,e.maximumFractionDigits=a.length),""});const s=n.options[0];s==="w"?e={...e,trailingZeroDisplay:"stripIfInteger"}:s&&(e={...e,...Vh(s)});continue}if(dv.test(n.stem)){e={...e,...Vh(n.stem)};continue}const r=hv(n.stem);r&&(e={...e,...r});const i=vT(n.stem);i&&(e={...e,...i})}return e}let _T=(function(t){return t[t.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",t[t.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",t[t.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",t[t.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",t[t.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",t[t.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",t[t.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",t[t.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",t[t.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",t[t.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",t[t.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",t[t.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",t[t.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",t[t.INVALID_TAG=23]="INVALID_TAG",t[t.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",t[t.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",t[t.UNCLOSED_TAG=27]="UNCLOSED_TAG",t})({});function Wh(t){return t.type===0}function wT(t){return t.type===1}function pv(t){return t.type===2}function gv(t){return t.type===3}function mv(t){return t.type===4}function vv(t){return t.type===5}function bv(t){return t.type===6}function yT(t){return t.type===7}function _v(t){return t.type===8}function wv(t){return!!(t&&typeof t=="object"&&t.type===0)}function rd(t){return!!(t&&typeof t=="object"&&t.type===1)}const yv=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Ha={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GS:["H","h","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ku-SY":["H","hB"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function kT(t,e){let n="";for(let r=0;r<t.length;r++){const i=t.charAt(r);if(i==="j"){let s=0;for(;r+1<t.length&&t.charAt(r+1)===i;)s++,r++;let o=1+(s&1),a=s<2?1:3+(s>>1),l="a",c=ET(e);for((c=="H"||c=="k")&&(a=0);a-- >0;)n+=l;for(;o-- >0;)n=c+n}else i==="J"?n+="H":n+=i}return n}function ET(t){let e=t.hourCycle;if(e===void 0&&t.hourCycles&&t.hourCycles.length&&(e=t.hourCycles[0]),e)switch(e){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}const n=t.language;let r;return n!=="root"&&(r=t.maximize().region),(Ha[r||""]||Ha[n||""]||Ha[`${n}-001`]||Ha["001"])[0]}const ST=new RegExp(`^${yv.source}*`),TT=new RegExp(`${yv.source}*$`);function at(t,e){return{start:t,end:e}}const xT=!!Object.fromEntries,PT=!!String.prototype.trimStart,CT=!!String.prototype.trimEnd,qh=xT?Object.fromEntries:function(e){const n={};for(const[r,i]of e)n[r]=i;return n},RT=PT?function(e){return e.trimStart()}:function(e){return e.replace(ST,"")},AT=CT?function(e){return e.trimEnd()}:function(e){return e.replace(TT,"")},Kh=new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");function OT(t,e){return Kh.lastIndex=e,Kh.exec(t)[1]??""}function MT(t){if(t.length===0)return null;let e=1,n=1;for(let r=0;r<t.length;){const i=t.charCodeAt(r);switch(i){case 35:case 39:case 60:case 123:case 125:return null}if(i===10)e++,n=1,r++;else if(n++,i>=55296&&i<=56319&&r+1<t.length){const s=t.charCodeAt(r+1);r+=s>=56320&&s<=57343?2:1}else r++}return{offset:t.length,line:e,column:n}}var NT=class{constructor(t,e={}){this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!e.ignoreTag,this.locale=e.locale,this.requiresOtherClause=!!e.requiresOtherClause,this.shouldParseSkeletons=!!e.shouldParseSkeletons}parse(){if(this.offset()!==0)throw Error("parser can only be used once");if(this.message.length>0){const t=this.message.charCodeAt(0);if(t!==35&&t!==39&&t!==60&&t!==123&&t!==125){const e=MT(this.message);if(e){const n=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:at(n,this.clonePosition())}],err:null}}}}return this.parseMessage(0,"",!1)}parseMessage(t,e,n){let r=[];for(;!this.isEOF();){const i=this.char();if(i===123){const s=this.parseArgument(t,n);if(s.err)return s;r.push(s.val)}else{if(i===125&&t>0)break;if(i===35&&(e==="plural"||e==="selectordinal")){const s=this.clonePosition();this.bump(),r.push({type:7,location:at(s,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,at(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&id(this.peek()||0)){const s=this.parseTag(t,e);if(s.err)return s;r.push(s.val)}else{const s=this.parseLiteral(t,e);if(s.err)return s;r.push(s.val)}}}return{val:r,err:null}}parseTag(t,e){const n=this.clonePosition();this.bump();const r=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:0,value:`<${r}/>`,location:at(n,this.clonePosition())},err:null};if(this.bumpIf(">")){const i=this.parseMessage(t+1,e,!0);if(i.err)return i;const s=i.val,o=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!id(this.char()))return this.error(23,at(o,this.clonePosition()));const a=this.clonePosition();return r!==this.parseTagName()?this.error(26,at(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:8,value:r,children:s,location:at(n,this.clonePosition())},err:null}:this.error(23,at(o,this.clonePosition())))}else return this.error(27,at(n,this.clonePosition()))}else return this.error(23,at(n,this.clonePosition()))}parseTagName(){const t=this.offset();for(this.bump();!this.isEOF()&<(this.char());)this.bump();return this.message.slice(t,this.offset())}parseLiteral(t,e){const n=this.clonePosition();let r="";for(;;){const s=this.tryParseQuote(e);if(s){r+=s;continue}const o=this.tryParseUnquoted(t,e);if(o){r+=o;continue}const a=this.tryParseLeftAngleBracket();if(a){r+=a;continue}break}const i=at(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!IT(this.peek()||0))?(this.bump(),"<"):null}tryParseQuote(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();const e=[this.char()];for(this.bump();!this.isEOF();){const n=this.char();if(n===39)if(this.peek()===39)e.push(39),this.bump();else{this.bump();break}else e.push(n);this.bump()}return String.fromCodePoint(...e)}tryParseUnquoted(t,e){if(this.isEOF())return null;const n=this.char();return n===60||n===123||n===35&&(e==="plural"||e==="selectordinal")||n===125&&t>0?null:(this.bump(),String.fromCodePoint(n))}parseArgument(t,e){const n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(1,at(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,at(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,at(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,at(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:at(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,at(n,this.clonePosition())):this.parseArgumentOptions(t,e,r,n);default:return this.error(3,at(n,this.clonePosition()))}}parseIdentifierIfPossible(){const t=this.clonePosition(),e=this.offset(),n=OT(this.message,e),r=e+n.length;return this.bumpTo(r),{value:n,location:at(t,this.clonePosition())}}parseArgumentOptions(t,e,n,r){let i=this.clonePosition(),s=this.parseIdentifierIfPossible().value,o=this.clonePosition();switch(s){case"":return this.error(4,at(i,o));case"number":case"date":case"time":{this.bumpSpace();let a=null;if(this.bumpIf(",")){this.bumpSpace();const u=this.clonePosition(),f=this.parseSimpleArgStyleIfPossible();if(f.err)return f;const h=AT(f.val);if(h.length===0)return this.error(6,at(this.clonePosition(),this.clonePosition()));a={style:h,styleLocation:at(u,this.clonePosition())}}const l=this.tryParseArgumentClose(r);if(l.err)return l;const c=at(r,this.clonePosition());if(a&&a.style.startsWith("::")){let u=RT(a.style.slice(2));if(s==="number"){const f=this.parseNumberSkeletonFromString(u,a.styleLocation);return f.err?f:{val:{type:2,value:n,location:c,style:f.val},err:null}}else{if(u.length===0)return this.error(10,c);let f=u;this.locale&&(f=kT(u,this.locale));const h={type:1,pattern:f,location:a.styleLocation,parsedOptions:this.shouldParseSkeletons?fT(f):{}};return{val:{type:s==="date"?3:4,value:n,location:c,style:h},err:null}}}return{val:{type:s==="number"?2:s==="date"?3:4,value:n,location:c,style:(a==null?void 0:a.style)??null},err:null}}case"plural":case"selectordinal":case"select":{const a=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(12,at(a,{...a}));this.bumpSpace();let l=this.parseIdentifierIfPossible(),c=0;if(s!=="select"&&l.value==="offset"){if(!this.bumpIf(":"))return this.error(13,at(this.clonePosition(),this.clonePosition()));this.bumpSpace();const p=this.tryParseDecimalInteger(13,14);if(p.err)return p;this.bumpSpace(),l=this.parseIdentifierIfPossible(),c=p.val}const u=this.tryParsePluralOrSelectOptions(t,s,e,l);if(u.err)return u;const f=this.tryParseArgumentClose(r);if(f.err)return f;const h=at(r,this.clonePosition());return s==="select"?{val:{type:5,value:n,options:qh(u.val),location:h},err:null}:{val:{type:6,value:n,options:qh(u.val),offset:c,pluralType:s==="plural"?"cardinal":"ordinal",location:h},err:null}}default:return this.error(5,at(i,o))}}tryParseArgumentClose(t){return this.isEOF()||this.char()!==125?this.error(1,at(t,this.clonePosition())):(this.bump(),{val:!0,err:null})}parseSimpleArgStyleIfPossible(){let t=0;const e=this.clonePosition();for(;!this.isEOF();)switch(this.char()){case 39:{this.bump();let n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(11,at(n,this.clonePosition()));this.bump();break}case 123:t+=1,this.bump();break;case 125:if(t>0)t-=1;else return{val:this.message.slice(e.offset,this.offset()),err:null};break;default:this.bump();break}return{val:this.message.slice(e.offset,this.offset()),err:null}}parseNumberSkeletonFromString(t,e){let n=[];try{n=pT(t)}catch{return this.error(7,e)}return{val:{type:0,tokens:n,location:e,parsedOptions:this.shouldParseSkeletons?bT(n):{}},err:null}}tryParsePluralOrSelectOptions(t,e,n,r){let i=!1;const s=[],o=new Set;let{value:a,location:l}=r;for(;;){if(a.length===0){const h=this.clonePosition();if(e!=="select"&&this.bumpIf("=")){const p=this.tryParseDecimalInteger(16,19);if(p.err)return p;l=at(h,this.clonePosition()),a=this.message.slice(h.offset,this.offset())}else break}if(o.has(a))return this.error(e==="select"?21:20,l);a==="other"&&(i=!0),this.bumpSpace();const c=this.clonePosition();if(!this.bumpIf("{"))return this.error(e==="select"?17:18,at(this.clonePosition(),this.clonePosition()));const u=this.parseMessage(t+1,e,n);if(u.err)return u;const f=this.tryParseArgumentClose(c);if(f.err)return f;s.push([a,{value:u.val,location:at(c,this.clonePosition())}]),o.add(a),this.bumpSpace(),{value:a,location:l}=this.parseIdentifierIfPossible()}return s.length===0?this.error(e==="select"?15:16,at(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,at(this.clonePosition(),this.clonePosition())):{val:s,err:null}}tryParseDecimalInteger(t,e){let n=1;const r=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);let i=!1,s=0;for(;!this.isEOF();){const a=this.char();if(a>=48&&a<=57)i=!0,s=s*10+(a-48),this.bump();else break}const o=at(r,this.clonePosition());return i?(s*=n,Number.isSafeInteger(s)?{val:s,err:null}:this.error(e,o)):this.error(t,o)}offset(){return this.position.offset}isEOF(){return this.offset()===this.message.length}clonePosition(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}}char(){const t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");const e=this.message.codePointAt(t);if(e===void 0)throw Error(`Offset ${t} is at invalid UTF-16 code unit boundary`);return e}error(t,e){return{val:null,err:{kind:t,message:this.message,location:e}}}bump(){if(this.isEOF())return;const t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}bumpIf(t){if(this.message.startsWith(t,this.offset())){for(let e=0;e<t.length;e++)this.bump();return!0}return!1}bumpUntil(t){const e=this.offset(),n=this.message.indexOf(t,e);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)}bumpTo(t){if(this.offset()>t)throw Error(`targetOffset ${t} must be greater than or equal to the current offset ${this.offset()}`);for(t=Math.min(t,this.message.length);;){const e=this.offset();if(e===t)break;if(e>t)throw Error(`targetOffset ${t} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}}bumpSpace(){for(;!this.isEOF()&&zT(this.char());)this.bump()}peek(){if(this.isEOF())return null;const t=this.char(),e=this.offset();return this.message.charCodeAt(e+(t>=65536?2:1))??null}};function id(t){return t>=97&&t<=122||t>=65&&t<=90}function IT(t){return id(t)||t===47}function LT(t){return t===45||t===46||t>=48&&t<=57||t===95||t>=97&&t<=122||t>=65&&t<=90||t==183||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8255&&t<=8256||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}function zT(t){return t>=9&&t<=13||t===32||t===133||t>=8206&&t<=8207||t===8232||t===8233}function sd(t){t.forEach(e=>{if(delete e.location,vv(e)||bv(e))for(const n in e.options)delete e.options[n].location,sd(e.options[n].value);else pv(e)&&wv(e.style)||(gv(e)||mv(e))&&rd(e.style)?delete e.style.location:_v(e)&&sd(e.children)})}function DT(t,e={}){e={shouldParseSkeletons:!0,requiresOtherClause:!0,...e};const n=new NT(t,e).parse();if(n.err){const r=SyntaxError(_T[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return e!=null&&e.captureLocation||sd(n.val),n.val}var cc=class extends Error{constructor(t,e,n){super(t),this.code=e,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},Yh=class extends cc{constructor(t,e,n,r){super(`Invalid values for "${t}": "${e}". Options are "${Object.keys(n).join('", "')}"`,"INVALID_VALUE",r)}},HT=class extends cc{constructor(t,e,n){super(`Value for "${t}" must be of type ${e}`,"INVALID_VALUE",n)}},BT=class extends cc{constructor(t,e){super(`The intl string context variable "${t}" was not provided to the string "${e}"`,"MISSING_VALUE",e)}};function UT(t){return t.length<2?t:t.reduce((e,n)=>{const r=e[e.length-1];return!r||r.type!==0||n.type!==0?e.push(n):r.value+=n.value,e},[])}function $T(t){return typeof t=="function"}function ol(t,e,n,r,i,s,o){if(t.length===1&&Wh(t[0]))return[{type:0,value:t[0].value}];const a=[];for(const l of t){if(Wh(l)){a.push({type:0,value:l.value});continue}if(yT(l)){typeof s=="number"&&a.push({type:0,value:n.getNumberFormat(e).format(s)});continue}const{value:c}=l;if(!(i&&c in i))throw new BT(c,o);let u=i[c];if(wT(l)){(!u||typeof u=="string"||typeof u=="number"||typeof u=="bigint")&&(u=typeof u=="string"||typeof u=="number"||typeof u=="bigint"?String(u):""),a.push({type:typeof u=="string"?0:1,value:u});continue}if(gv(l)){const f=typeof l.style=="string"?r.date[l.style]:rd(l.style)?l.style.parsedOptions:void 0;a.push({type:0,value:n.getDateTimeFormat(e,f).format(u)});continue}if(mv(l)){const f=typeof l.style=="string"?r.time[l.style]:rd(l.style)?l.style.parsedOptions:r.time.medium;a.push({type:0,value:n.getDateTimeFormat(e,f).format(u)});continue}if(pv(l)){const f=typeof l.style=="string"?r.number[l.style]:wv(l.style)?l.style.parsedOptions:void 0;if(f&&f.scale){const h=f.scale||1;if(typeof u=="bigint"){if(!Number.isInteger(h))throw new TypeError(`Cannot apply fractional scale ${h} to bigint value. Scale must be an integer when formatting bigint.`);u=u*BigInt(h)}else u=u*h}a.push({type:0,value:n.getNumberFormat(e,f).format(u)});continue}if(_v(l)){const{children:f,value:h}=l,p=i[h];if(!$T(p))throw new HT(h,"function",o);let g=p(ol(f,e,n,r,i,s).map(m=>m.value));Array.isArray(g)||(g=[g]),a.push(...g.map(m=>({type:typeof m=="string"?0:1,value:m})))}if(vv(l)){const f=u,h=(Object.prototype.hasOwnProperty.call(l.options,f)?l.options[f]:void 0)||l.options.other;if(!h)throw new Yh(l.value,u,Object.keys(l.options),o);a.push(...ol(h.value,e,n,r,i));continue}if(bv(l)){const f=`=${u}`;let h=Object.prototype.hasOwnProperty.call(l.options,f)?l.options[f]:void 0;if(!h){if(!Intl.PluralRules)throw new cc(`Intl.PluralRules is not available in this environment.
|
|
67
|
-
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
68
|
-
`,"MISSING_INTL_API",o);const g=typeof u=="bigint"?Number(u):u,m=n.getPluralRules(e,{type:l.pluralType}).select(g-(l.offset||0));h=(Object.prototype.hasOwnProperty.call(l.options,m)?l.options[m]:void 0)||l.options.other}if(!h)throw new Yh(l.value,u,Object.keys(l.options),o);const p=typeof u=="bigint"?Number(u):u;a.push(...ol(h.value,e,n,r,i,p-(l.offset||0)));continue}}return UT(a)}function jT(t,e){return e?{...t,...e,...Object.keys(t).reduce((n,r)=>(n[r]={...t[r],...e[r]},n),{})}:t}function FT(t,e){return e?Object.keys(t).reduce((n,r)=>(n[r]=jT(t[r],e[r]),n),{...t}):t}function Wc(t){return{create(){return{get(e){return t[e]},set(e,n){t[e]=n}}}}}function GT(t={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:Vc((...e)=>new Intl.NumberFormat(...e),{cache:Wc(t.number),strategy:Zc.variadic}),getDateTimeFormat:Vc((...e)=>new Intl.DateTimeFormat(...e),{cache:Wc(t.dateTime),strategy:Zc.variadic}),getPluralRules:Vc((...e)=>new Intl.PluralRules(...e),{cache:Wc(t.pluralRules),strategy:Zc.variadic})}}var fn,VT=(fn=class{constructor(e,n=fn.defaultLocale,r,i){if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=s=>{const o=this.formatToParts(s);if(o.length===1)return o[0].value;const a=o.reduce((l,c)=>(!l.length||c.type!==0||typeof l[l.length-1]!="string"?l.push(c.value):l[l.length-1]+=c.value,l),[]);return a.length<=1?a[0]||"":a},this.formatToParts=s=>ol(this.ast,this.locales,this.formatters,this.formats,s,void 0,this.message),this.resolvedOptions=()=>{var s;return{locale:((s=this.resolvedLocale)==null?void 0:s.toString())||Intl.NumberFormat.supportedLocalesOf(this.locales)[0]}},this.getAst=()=>this.ast,this.locales=n,this.resolvedLocale=fn.resolveLocale(n),typeof e=="string"){if(this.message=e,!fn.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");const{...s}=i||{};this.ast=fn.__parse(e,{...s,locale:this.resolvedLocale})}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=FT(fn.formats,r),this.formatters=i&&i.formatters||GT(this.formatterCache)}static get defaultLocale(){return fn.memoizedDefaultLocale||(fn.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),fn.memoizedDefaultLocale}},fn.memoizedDefaultLocale=null,fn.resolveLocale=e=>{if(typeof Intl.Locale>"u")return;const n=Intl.NumberFormat.supportedLocalesOf(e);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof e=="string"?e:e[0])},fn.__parse=DT,fn.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},fn),ZT=VT;function Fo(t){return t==="en-XA"?"en":t}function kv(t,e,n){if(e===void 0)return t;try{const r=new ZT(t,Fo(n)).format(e);return typeof r=="string"?r:String(r)}catch{return t}}const ff=["persistent-rci-session:read","persistent-rci-session:write"],Ev=kn(ff),Sv=li([Ev,rT]),WT=t=>ff.includes(t);function qT(t){const e=t.replace("#",""),n=e.length===3?e.split("").map(r=>r+r).join(""):e;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}function qc(t){const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Xh(t){const[e,n,r]=qT(t);return .2126*qc(e)+.7152*qc(n)+.0722*qc(r)}function Io(t,e){const n=Xh(t),r=Xh(e),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}const hf=[{token:"bg",cssVar:"--mndw-bg"},{token:"surface",cssVar:"--mndw-surface"},{token:"surfaceRaised",cssVar:"--mndw-surface-raised"},{token:"border",cssVar:"--mndw-border"},{token:"textSubtle",cssVar:"--mndw-text-subtle"},{token:"textMuted",cssVar:"--mndw-text-muted"},{token:"text",cssVar:"--mndw-text"},{token:"accent",cssVar:"--mndw-accent"},{token:"accentHover",cssVar:"--mndw-accent-hover"},{token:"accentContrast",cssVar:"--mndw-accent-contrast"},{token:"danger",cssVar:"--mndw-danger"},{token:"dangerBg",cssVar:"--mndw-danger-bg"},{token:"success",cssVar:"--mndw-success"},{token:"successBg",cssVar:"--mndw-success-bg"},{token:"warning",cssVar:"--mndw-warning"},{token:"warningBg",cssVar:"--mndw-warning-bg"},{token:"info",cssVar:"--mndw-info"},{token:"infoBg",cssVar:"--mndw-info-bg"},{token:"focusRing",cssVar:"--mndw-focus-ring"},{token:"surfaceHover",cssVar:"--mndw-surface-hover"},{token:"controlHover",cssVar:"--mndw-control-hover"},{token:"shadowColor",cssVar:"--mndw-shadow-color"}],KT=[{fg:"text",bg:"surface",min:4.5},{fg:"text",bg:"bg",min:4.5},{fg:"textMuted",bg:"surface",min:4.5},{fg:"textSubtle",bg:"surface",min:4.5},{fg:"border",bg:"surface",min:3},{fg:"accentContrast",bg:"accent",min:4.5},{fg:"danger",bg:"dangerBg",min:4.5},{fg:"text",bg:"surfaceRaised",min:4.5},{fg:"text",bg:"surfaceHover",min:4.5},{fg:"text",bg:"controlHover",min:4.5},{fg:"textSubtle",bg:"surfaceRaised",min:4.5},{fg:"textMuted",bg:"surfaceRaised",min:4.5},{fg:"border",bg:"surfaceRaised",min:3},{fg:"focusRing",bg:"surfaceRaised",min:3},{fg:"success",bg:"successBg",min:4.5},{fg:"warning",bg:"warningBg",min:4.5},{fg:"info",bg:"infoBg",min:4.5}];function YT(t,e={}){const n=e.selector??":root",r=i=>hf.map(s=>` ${s.cssVar}: ${t[i][s.token]};`).join(`
|
|
69
|
-
`);return`${n},
|
|
70
|
-
${n}[data-theme='dark'] {
|
|
71
|
-
${r("dark")}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
${n}[data-theme='light'] {
|
|
75
|
-
${r("light")}
|
|
76
|
-
}
|
|
77
|
-
`}const Tv=(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}}},XT={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},JT=t=>Tv(XT[t.toLowerCase()],6),QT=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,ex=t=>{let e;return(e=t.match(QT))?Tv(parseInt(e[1],16),e[1].length):void 0},hi="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Lo=`${hi}%`,pf=`(?:${hi}%|${hi})`,tx=`(?:${hi}(deg|grad|rad|turn)|${hi})`,Ns="\\s*,\\s*",nx=new RegExp(`^rgba?\\(\\s*${hi}${Ns}${hi}${Ns}${hi}\\s*(?:,\\s*${pf}\\s*)?\\)$`),rx=new RegExp(`^rgba?\\(\\s*${Lo}${Ns}${Lo}${Ns}${Lo}\\s*(?:,\\s*${pf}\\s*)?\\)$`),ix=t=>{let e={mode:"rgb"},n;if(n=t.match(nx))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(rx))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},Sl=(t,e)=>t===void 0?void 0:typeof t!="object"?hx(t):t.mode!==void 0?t:e?{...t,mode:e}:void 0,_i=(t="rgb")=>e=>(e=Sl(e,t))!==void 0?e.mode===t?e:Cr[e.mode][t]?Cr[e.mode][t](e):t==="rgb"?Cr[e.mode].rgb(e):Cr.rgb[t](Cr[e.mode].rgb(e)):void 0,Cr={},xv={},Tl=[],Pv={},sx=t=>t,gt=t=>(Cr[t.mode]={...Cr[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{Cr[e]||(Cr[e]={}),Cr[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=sx)}),xv[t.mode]=t,(t.parse||[]).forEach(e=>{ox(e,t.mode)}),_i(t.mode)),uc=t=>xv[t],ox=(t,e)=>{if(typeof t=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");Pv[t]=e}else typeof t=="function"&&Tl.indexOf(t)<0&&Tl.push(t)},od=/[^\x00-\x7F]|[a-zA-Z_]/,ax=/[^\x00-\x7F]|[-\w]/,de={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let He=0;function Ba(t){let e=t[He],n=t[He+1];return e==="-"||e==="+"?/\d/.test(n)||n==="."&&/\d/.test(t[He+2]):e==="."?/\d/.test(n):/\d/.test(e)}function ad(t){if(He>=t.length)return!1;let e=t[He];if(od.test(e))return!0;if(e==="-"){if(t.length-He<2)return!1;let n=t[He+1];return!!(n==="-"||od.test(n))}return!1}const lx={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function ao(t){let e="";if((t[He]==="-"||t[He]==="+")&&(e+=t[He++]),e+=Ua(t),t[He]==="."&&/\d/.test(t[He+1])&&(e+=t[He++]+Ua(t)),(t[He]==="e"||t[He]==="E")&&((t[He+1]==="-"||t[He+1]==="+")&&/\d/.test(t[He+2])?e+=t[He++]+t[He++]+Ua(t):/\d/.test(t[He+1])&&(e+=t[He++]+Ua(t))),ad(t)){let n=xl(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:de.Hue,value:e*lx[n]}:void 0}return t[He]==="%"?(He++,{type:de.Percentage,value:+e}):{type:de.Number,value:+e}}function Ua(t){let e="";for(;/\d/.test(t[He]);)e+=t[He++];return e}function xl(t){let e="";for(;He<t.length&&ax.test(t[He]);)e+=t[He++];return e}function cx(t){let e=xl(t);return t[He]==="("?(He++,{type:de.Function,value:e}):e==="none"?{type:de.None,value:void 0}:{type:de.Ident,value:e}}function ux(t=""){let e=t.trim(),n=[],r;for(He=0;He<e.length;){if(r=e[He++],r===`
|
|
78
|
-
`||r===" "||r===" "){for(;He<e.length&&(e[He]===`
|
|
79
|
-
`||e[He]===" "||e[He]===" ");)He++;continue}if(r===",")return;if(r===")"){n.push({type:de.ParenClose});continue}if(r==="+"){if(He--,Ba(e)){n.push(ao(e));continue}return}if(r==="-"){if(He--,Ba(e)){n.push(ao(e));continue}if(ad(e)){n.push({type:de.Ident,value:xl(e)});continue}return}if(r==="."){if(He--,Ba(e)){n.push(ao(e));continue}return}if(r==="/"){for(;He<e.length&&(e[He]===`
|
|
80
|
-
`||e[He]===" "||e[He]===" ");)He++;let i;if(Ba(e)&&(i=ao(e),i.type!==de.Hue)){n.push({type:de.Alpha,value:i});continue}if(ad(e)&&xl(e)==="none"){n.push({type:de.Alpha,value:{type:de.None,value:void 0}});continue}return}if(/\d/.test(r)){He--,n.push(ao(e));continue}if(od.test(r)){He--,n.push(cx(e));continue}return}return n}function dx(t){t._i=0;let e=t[t._i++];if(!e||e.type!==de.Function||e.value!=="color"||(e=t[t._i++],e.type!==de.Ident))return;const n=Pv[e.value];if(!n)return;const r={mode:n},i=Cv(t,!1);if(!i)return;const s=uc(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==de.None&&(r[l]=a.type===de.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function Cv(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===de.None||r.type===de.Number||r.type===de.Alpha||r.type===de.Percentage||e&&r.type===de.Hue){n.push(r);continue}if(r.type===de.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==de.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:de.None,value:void 0}),n.every(i=>i.type!==de.Alpha)?n:void 0}}function fx(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==de.Function)return;let r=Cv(t,e);if(r)return r.unshift(n.value),r}const hx=t=>{if(typeof t!="string")return;const e=ux(t),n=e?fx(e,!0):void 0;let r,i=0,s=Tl.length;for(;i<s;)if((r=Tl[i++](t,n))!==void 0)return r;return e?dx(e):void 0};function px(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===de.Hue||i.type===de.Hue||s.type===de.Hue))return r.type!==de.None&&(n.r=r.type===de.Number?r.value/255:r.value/100),i.type!==de.None&&(n.g=i.type===de.Number?i.value/255:i.value/100),s.type!==de.None&&(n.b=s.type===de.Number?s.value/255:s.value/100),o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const gx=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,mx=(t,e,n)=>t+n*(e-t),vx=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},bx=t=>e=>{let n=vx(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)}},_e=bx(mx),Qt=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},Ys={mode:"rgb",channels:["r","g","b","alpha"],parse:[px,ex,ix,JT,gx,"srgb"],serialize:"srgb",interpolate:{r:_e,g:_e,b:_e,alpha:{use:_e,fixup:Qt}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Kc=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Jh=t=>{let e=Kc(t.r),n=Kc(t.g),r=Kc(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},Yc=t=>Math.pow(Math.abs(t),256/563)*Math.sign(t),Qh=({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:Yc(t*2.0415879038107465-e*.5650069742788597-.3447313507783297*n),g:Yc(t*-.9692436362808798+e*1.8759675015077206+.0415550574071756*n),b:Yc(t*.0134442806320312-e*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(i.alpha=r),i},Xc=(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)},Xs=({r:t,g:e,b:n,alpha:r})=>{let i={mode:"lrgb",r:Xc(t),g:Xc(e),b:Xc(n)};return r!==void 0&&(i.alpha=r),i},qi=t=>{let{r:e,g:n,b:r,alpha:i}=Xs(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},Jc=(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},Js=({r:t,g:e,b:n,alpha:r},i="rgb")=>{let s={mode:i,r:Jc(t),g:Jc(e),b:Jc(n)};return r!==void 0&&(s.alpha=r),s},Ki=({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=Js({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},_x={...Ys,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Qh(qi(t)),xyz65:Qh},toMode:{rgb:t=>Ki(Jh(t)),xyz65:Jh}},mn=t=>(t=t%360)<0?t+360:t,wx=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=mn(n);return r===0||t[r-1]===void 0?s:e(s-mn(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),[]),Xr=t=>wx(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),rn=[-.14861,1.78277,-.29227,-.90649,1.97294,0],yx=Math.PI/180,kx=180/Math.PI;let ep=rn[3]*rn[4],tp=rn[1]*rn[4],np=rn[1]*rn[2]-rn[0]*rn[3];const Ex=({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=(np*n+t*ep-e*tp)/(np+ep-tp),s=n-i,o=(rn[4]*(e-i)-rn[2]*s)/rn[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(rn[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*kx-120),r!==void 0&&(a.alpha=r),a},Sx=({h:t,s:e,l:n,alpha:r})=>{let i={mode:"rgb"};t=(t===void 0?0:t+120)*yx,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*(rn[0]*o+rn[1]*a),i.g=n+s*(rn[2]*o+rn[3]*a),i.b=n+s*(rn[4]*o+rn[5]*a),r!==void 0&&(i.alpha=r),i},dc=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=mn(t.h),r=mn(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},Tx=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=mn(t.h),r=mn(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},fc=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=mn(t.h),r=mn(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},Jr=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},xx={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Ex},toMode:{rgb:Sx},interpolate:{h:{use:_e,fixup:Xr},s:_e,l:_e,alpha:{use:_e,fixup:Qt}},difference:{h:dc},average:{h:Jr}},wi=({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=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},yi=({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},Rv=Math.pow(29,3)/Math.pow(3,3),Av=Math.pow(6,3)/Math.pow(29,3),Kt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},fs={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let Qc=t=>Math.pow(t,3)>Av?Math.pow(t,3):(116*t-16)/Rv;const Ov=({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:Qc(s)*fs.X,y:Qc(i)*fs.Y,z:Qc(o)*fs.Z};return r!==void 0&&(a.alpha=r),a},hc=t=>Ki(Ov(t)),eu=t=>t>Av?Math.cbrt(t):(Rv*t+16)/116,Mv=({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=eu(t/fs.X),s=eu(e/fs.Y),o=eu(n/fs.Z),a={mode:"lab65",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},pc=t=>{let e=Mv(qi(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Pl=1,Nv=1,Go=26/180*Math.PI,Cl=Math.cos(Go),Rl=Math.sin(Go),Iv=100/Math.log(139/100),ld=({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*Pl/Iv)-1)/.0039},s=(Math.exp(.0435*e*Nv*Pl)-1)/.075,o=s*Math.cos(n/180*Math.PI-Go),a=s*Math.sin(n/180*Math.PI-Go);return i.a=o*Cl-a/.83*Rl,i.b=o*Rl+a/.83*Cl,r!==void 0&&(i.alpha=r),i},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=e*Cl+n*Rl,s=.83*(n*Cl-e*Rl),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Iv/Pl*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Nv*Pl)};return a.c&&(a.h=mn((Math.atan2(s,i)+Go)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},rp=t=>ld(wi(t,"dlch")),ip=t=>yi(cd(t),"dlab"),Px={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:rp,rgb:t=>hc(rp(t))},fromMode:{lab65:ip,rgb:t=>ip(pc(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:_e,a:_e,b:_e,alpha:{use:_e,fixup:Qt}}},Cx={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:ld,dlab:t=>yi(t,"dlab"),rgb:t=>hc(ld(t))},fromMode:{lab65:cd,dlab:t=>wi(t,"dlch"),rgb:t=>cd(pc(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:_e,c:_e,h:{use:_e,fixup:Xr},alpha:{use:_e,fixup:Qt}},difference:{h:fc},average:{h:Jr}};function Rx({h:t,s:e,i:n,alpha:r}){t=mn(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 Ax({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 Ox={mode:"hsi",toMode:{rgb:Rx},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:Ax},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:_e,fixup:Xr},s:_e,i:_e,alpha:{use:_e,fixup:Qt}},difference:{h:dc},average:{h:Jr}};function Mx({h:t,s:e,l:n,alpha:r}){t=mn(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 Ix=(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}},Lx=new RegExp(`^hsla?\\(\\s*${tx}${Ns}${Lo}${Ns}${Lo}\\s*(?:,\\s*${pf}\\s*)?\\)$`),zx=t=>{let e=t.match(Lx);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=Ix(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 Dx(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==de.None){if(r.type===de.Percentage)return;n.h=r.value}if(i.type!==de.None){if(i.type===de.Hue)return;n.s=i.value/100}if(s.type!==de.None){if(s.type===de.Hue)return;n.l=s.value/100}return o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const Lv={mode:"hsl",toMode:{rgb:Mx},fromMode:{rgb:Nx},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Dx,zx],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:_e,fixup:Xr},s:_e,l:_e,alpha:{use:_e,fixup:Qt}},difference:{h:dc},average:{h:Jr}};function zv({h:t,s:e,v:n,alpha:r}){t=mn(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 Dv({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 Hv={mode:"hsv",toMode:{rgb:zv},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Dv},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:_e,fixup:Xr},s:_e,v:_e,alpha:{use:_e,fixup:Qt}},difference:{h:dc},average:{h:Jr}};function Hx({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 zv({h:t,s:n===1?1:1-e/(1-n),v:1-n,alpha:r})}function Bx(t){let e=Dv(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 Ux(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==de.None){if(r.type===de.Percentage)return;n.h=r.value}if(i.type!==de.None){if(i.type===de.Hue)return;n.w=i.value/100}if(s.type!==de.None){if(s.type===de.Hue)return;n.b=s.value/100}return o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const $x={mode:"hwb",toMode:{rgb:Hx},fromMode:{rgb:Bx},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Ux],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:_e,fixup:Xr},w:_e,b:_e,alpha:{use:_e,fixup:Qt}},difference:{h:Tx},average:{h:Jr}},Bv=203,gc=.1593017578125,Uv=78.84375,mc=.8359375,vc=18.8515625,bc=18.6875;function tu(t){if(t<0)return 0;const e=Math.pow(t,1/Uv);return 1e4*Math.pow(Math.max(0,e-mc)/(vc-bc*e),1/gc)}function nu(t){if(t<0)return 0;const e=Math.pow(t/1e4,gc);return Math.pow((mc+vc*e)/(1+bc*e),Uv)}const ru=t=>Math.max(t/Bv,0),sp=({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=tu(t+.008609037037932761*e+.11102962500302593*n),s=tu(t-.00860903703793275*e-.11102962500302599*n),o=tu(t+.5600313357106791*e-.32062717498731885*n),a={mode:"xyz65",x:ru(2.070152218389422*i-1.3263473389671556*s+.2066510476294051*o),y:ru(.3647385209748074*i+.680566024947227*s-.0453045459220346*o),z:ru(-.049747207535812*i-.0492609666966138*s+1.1880659249923042*o)};return r!==void 0&&(a.alpha=r),a},iu=(t=0)=>Math.max(t*Bv,0),op=({x:t,y:e,z:n,alpha:r})=>{const i=iu(t),s=iu(e),o=iu(n),a=nu(.3592832590121217*i+.6976051147779502*s-.0358915932320289*o),l=nu(-.1920808463704995*i+1.1004767970374323*s+.0753748658519118*o),c=nu(.0070797844607477*i+.0748396662186366*s+.8433265453898765*o),u=.5*a+.5*l,f=1.61376953125*a-3.323486328125*l+1.709716796875*c,h=4.378173828125*a-4.24560546875*l-.132568359375*c,p={mode:"itp",i:u,t:f,p:h};return r!==void 0&&(p.alpha=r),p},jx={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:sp,rgb:t=>Ki(sp(t))},fromMode:{xyz65:op,rgb:t=>op(qi(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:_e,t:_e,p:_e,alpha:{use:_e,fixup:Qt}}},Fx=134.03437499999998,Gx=16295499532821565e-27,su=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,gc);return Math.pow((mc+vc*e)/(1+bc*e),Fx)},ou=(t=0)=>Math.max(t*203,0),$v=({x:t,y:e,z:n,alpha:r})=>{t=ou(t),e=ou(e),n=ou(n);let i=1.15*t-.15*n,s=.66*e+.34*t,o=su(.41478972*i+.579999*s+.014648*n),a=su(-.20151*i+1.120649*s+.0531008*n),l=su(-.0166008*i+.2648*s+.6684799*n),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-Gx,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},Vx=134.03437499999998,ap=16295499532821565e-27,au=t=>{if(t<0)return 0;let e=Math.pow(t,1/Vx);return 1e4*Math.pow((mc-e)/(bc*e-vc),1/gc)},lu=t=>t/203,jv=({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+ap)/(.44+.56*(t+ap)),s=au(i+.13860504*e+.058047316*n),o=au(i-.13860504*e-.058047316*n),a=au(i-.096019242*e-.8118919*n),l={mode:"xyz65",x:lu(1.661373024652174*s-.914523081304348*o+.23136208173913045*a),y:lu(-.3250758611844533*s+1.571847026732543*o-.21825383453227928*a),z:lu(-.090982811*s-.31272829*o+1.5227666*a)};return r!==void 0&&(l.alpha=r),l},Fv=t=>{let e=$v(qi(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Gv=t=>Ki(jv(t)),Zx={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Fv,xyz65:$v},toMode:{rgb:Gv,xyz65:jv},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:_e,a:_e,b:_e,alpha:{use:_e,fixup:Qt}}},lp=({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=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},cp=({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},Wx={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:cp,rgb:t=>Gv(cp(t))},fromMode:{rgb:t=>lp(Fv(t)),jab:lp},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:_e,fixup:Xr},c:_e,j:_e,alpha:{use:_e,fixup:Qt}},difference:{h:fc},average:{h:Jr}},_c=Math.pow(29,3)/Math.pow(3,3),gf=Math.pow(6,3)/Math.pow(29,3);let cu=t=>Math.pow(t,3)>gf?Math.pow(t,3):(116*t-16)/_c;const mf=({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:cu(s)*Kt.X,y:cu(i)*Kt.Y,z:cu(o)*Kt.Z};return r!==void 0&&(a.alpha=r),a},_a=({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=Js({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},Vv=t=>_a(mf(t)),wa=t=>{let{r:e,g:n,b:r,alpha:i}=Xs(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},uu=t=>t>gf?Math.cbrt(t):(_c*t+16)/116,vf=({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=uu(t/Kt.X),s=uu(e/Kt.Y),o=uu(n/Kt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Zv=t=>{let e=vf(wa(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function qx(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===de.Hue||i.type===de.Hue||s.type===de.Hue))return r.type!==de.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==de.None&&(n.a=i.type===de.Number?i.value:i.value*125/100),s.type!==de.None&&(n.b=s.type===de.Number?s.value:s.value*125/100),o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const bf={mode:"lab",toMode:{xyz50:mf,rgb:Vv},fromMode:{xyz50:vf,rgb:Zv},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[qx],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:_e,a:_e,b:_e,alpha:{use:_e,fixup:Qt}}},Kx={...bf,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Ov,rgb:hc},fromMode:{xyz65:Mv,rgb:pc},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function Yx(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==de.None){if(r.type===de.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==de.None&&(n.c=Math.max(0,i.type===de.Number?i.value:i.value*150/100)),s.type!==de.None){if(s.type===de.Percentage)return;n.h=s.value}return o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const _f={mode:"lch",toMode:{lab:yi,rgb:t=>Vv(yi(t))},fromMode:{rgb:t=>wi(Zv(t)),lab:wi},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Yx],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:_e,fixup:Xr},c:_e,l:_e,alpha:{use:_e,fixup:Qt}},difference:{h:fc},average:{h:Jr}},Xx={..._f,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>yi(t,"lab65"),rgb:t=>hc(yi(t,"lab65"))},fromMode:{rgb:t=>wi(pc(t),"lch65"),lab65:t=>wi(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Wv=({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=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},qv=({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},Kv=(t,e,n)=>4*t/(t+15*e+3*n),Yv=(t,e,n)=>9*e/(t+15*e+3*n),Jx=Kv(Kt.X,Kt.Y,Kt.Z),Qx=Yv(Kt.X,Kt.Y,Kt.Z),e2=t=>t<=gf?_c*t:116*Math.cbrt(t)-16,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=e2(e/Kt.Y),s=Kv(t,e,n),o=Yv(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-Jx),o=13*i*(o-Qx));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},t2=(t,e,n)=>4*t/(t+15*e+3*n),n2=(t,e,n)=>9*e/(t+15*e+3*n),r2=t2(Kt.X,Kt.Y,Kt.Z),i2=n2(Kt.X,Kt.Y,Kt.Z),dd=({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)+r2,s=n/(13*t)+i2,o=Kt.Y*(t<=8?t/_c: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},s2=t=>Wv(ud(wa(t))),o2=t=>_a(dd(qv(t))),a2={mode:"lchuv",toMode:{luv:qv,rgb:o2},fromMode:{rgb:s2,luv:Wv},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:_e,fixup:Xr},c:_e,l:_e,alpha:{use:_e,fixup:Qt}},difference:{h:fc},average:{h:Jr}},l2={...Ys,mode:"lrgb",toMode:{rgb:Js},fromMode:{rgb:Xs},parse:["srgb-linear"],serialize:"srgb-linear"},c2={mode:"luv",toMode:{xyz50:dd,rgb:t=>_a(dd(t))},fromMode:{xyz50:ud,rgb:t=>ud(wa(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:_e,u:_e,v:_e,alpha:{use:_e,fixup:Qt}}},Xv=({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},wc=t=>{let e=Xv(Xs(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},ya=({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},yc=t=>Js(ya(t));function fd(t){const r=1.170873786407767;return .5*(r*t-.206+Math.sqrt((r*t-.206)*(r*t-.206)+4*.03*r*t))}function Al(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function u2(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,f=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let g=1+u*f,m=1+u*h,_=1+u*p,w=g*g*g,E=m*m*m,M=_*_*_,C=3*f*g*g,O=3*h*m*m,A=3*p*_*_,N=6*f*f*g,z=6*h*h*m,D=6*p*p*_,G=a*w+l*E+c*M,K=a*C+l*O+c*A,oe=a*N+l*z+c*D;u=u-G*K/(K*K-.5*G*oe)}return u}function wf(t,e){let n=u2(t,e),r=ya({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 d2(t,e,n,r,i,s=null){s||(s=wf(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,f=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,g=a+l*f;{let m=i*(1-o)+o*n,_=o*r,w=m+_*c,E=m+_*u,M=m+_*f,C=w*w*w,O=E*E*E,A=M*M*M,N=3*h*w*w,z=3*p*E*E,D=3*g*M*M,G=6*h*h*w,K=6*p*p*E,oe=6*g*g*M,re=4.0767416621*C-3.3077115913*O+.2309699292*A-1,ye=4.0767416621*N-3.3077115913*z+.2309699292*D,q=4.0767416621*G-3.3077115913*K+.2309699292*oe,Z=ye/(ye*ye-.5*re*q),J=-re*Z,me=-1.2684380046*C+2.6097574011*O-.3413193965*A-1,ce=-1.2684380046*N+2.6097574011*z-.3413193965*D,Ee=-1.2684380046*G+2.6097574011*K-.3413193965*oe,xe=ce/(ce*ce-.5*me*Ee),Ze=-me*xe,he=-.0041960863*C-.7034186147*O+1.707614701*A-1,pe=-.0041960863*N-.7034186147*z+1.707614701*D,De=-.0041960863*G-.7034186147*K+1.707614701*oe,qe=pe/(pe*pe-.5*he*De),Y=-he*qe;J=Z>=0?J:1e6,Ze=xe>=0?Ze:1e6,Y=qe>=0?Y:1e6,o+=Math.min(J,Math.min(Ze,Y))}}}return o}function yf(t,e,n=null){n||(n=wf(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function Jv(t,e,n){let r=wf(e,n),i=d2(e,n,t,1,t,r),s=yf(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,f=.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))),f,i]}function up(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:fd(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]=Jv(e,n/s,r/s),c;if(s<a){let u=0,f=.8*o,h=1-f/a;c=(s-u)/(f+h*(s-u))*.8}else{let u=a,f=.2*a*a*1.25*1.25/o,h=1-f/(l-a);c=.8+.2*((s-u)/(f+h*(s-u)))}return c&&(i.s=c,i.h=mn(Math.atan2(r,n)*180/Math.PI)),i}function dp(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:Al(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]=Jv(i.l,s,o),u,f,h,p;n<.8?(u=1.25*n,f=0,h=.8*a,p=1-h/l):(u=5*(n-.8),f=l,h=.2*l*l*1.25*1.25/a,p=1-h/(c-l));let g=f+u*h/(1-p*u);return i.a=g*s,i.b=g*o,i}const f2={...Lv,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:up,rgb:t=>up(wc(t))},toMode:{oklab:dp,rgb:t=>yc(dp(t))}};function fp(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]=yf(s,o),c=.5,u=1-c/a,f=l/(i+e*l),h=f*e,p=f*i,g=Al(h),m=p*g/h,_=ya({l:g,a:s*m,b:o*m}),w=Math.cbrt(1/Math.max(_.r,_.g,_.b,0));e=e/w,i=i/w*fd(e)/e,e=fd(e);const E={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return E.s&&(E.h=mn(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(E.alpha=t.alpha),E}function hp(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]=yf(s,o),c=.5,u=1-c/a,f=1-r*c/(c+l-l*u*r),h=r*l*c/(c+l-l*u*r),p=Al(f),g=h*p/f,m=ya({l:p,a:s*g,b:o*g}),_=Math.cbrt(1/Math.max(m.r,m.g,m.b,0)),w=Al(i*f),E=h*w/f;return e.l=w*_,e.a=E*s*_,e.b=E*o*_,e}const h2={...Hv,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:fp,rgb:t=>fp(wc(t))},toMode:{oklab:hp,rgb:t=>yc(hp(t))}};function p2(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===de.Hue||i.type===de.Hue||s.type===de.Hue))return r.type!==de.None&&(n.l=Math.min(Math.max(0,r.type===de.Number?r.value:r.value/100),1)),i.type!==de.None&&(n.a=i.type===de.Number?i.value:i.value*.4/100),s.type!==de.None&&(n.b=s.type===de.Number?s.value:s.value*.4/100),o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const g2={...bf,mode:"oklab",toMode:{lrgb:ya,rgb:yc},fromMode:{lrgb:Xv,rgb:wc},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[p2],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 m2(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==de.None){if(r.type===de.Hue)return;n.l=Math.min(Math.max(0,r.type===de.Number?r.value:r.value/100),1)}if(i.type!==de.None&&(n.c=Math.max(0,i.type===de.Number?i.value:i.value*.4/100)),s.type!==de.None){if(s.type===de.Percentage)return;n.h=s.value}return o.type!==de.None&&(n.alpha=Math.min(1,Math.max(0,o.type===de.Number?o.value:o.value/100))),n}const v2={..._f,mode:"oklch",toMode:{oklab:t=>yi(t,"oklab"),rgb:t=>yc(yi(t,"oklab"))},fromMode:{rgb:t=>wi(wc(t),"oklch"),oklab:t=>wi(t,"oklch")},parse:[m2],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]}},pp=t=>{let{r:e,g:n,b:r,alpha:i}=Xs(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},gp=({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=Js({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},b2={...Ys,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>gp(qi(t)),xyz65:gp},toMode:{rgb:t=>Ki(pp(t)),xyz65:pp}},du=t=>{let e=Math.abs(t);return e>=1/512?Math.sign(t)*Math.pow(e,1/1.8):16*t},mp=({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:du(t*1.3457868816471585-e*.2555720873797946-.0511018649755453*n),g:du(t*-.5446307051249019+e*1.5082477428451466+.0205274474364214*n),b:du(t*0+e*0+1.2119675456389452*n)};return r!==void 0&&(i.alpha=r),i},fu=(t=0)=>{let e=Math.abs(t);return e>=16/512?Math.sign(t)*Math.pow(e,1.8):t/16},vp=t=>{let e=fu(t.r),n=fu(t.g),r=fu(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},_2={...Ys,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:mp,rgb:t=>mp(wa(t))},toMode:{xyz50:vp,rgb:t=>_a(vp(t))}},bp=1.09929682680944,w2=.018053968510807,hu=t=>{const e=Math.abs(t);return e>w2?(Math.sign(t)||1)*(bp*Math.pow(e,.45)-(bp-1)):4.5*t},_p=({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:hu(t*1.7166511879712683-e*.3556707837763925-.2533662813736599*n),g:hu(t*-.6666843518324893+e*1.6164812366349395+.0157685458139111*n),b:hu(t*.0176398574453108-e*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(i.alpha=r),i},wp=1.09929682680944,y2=.018053968510807,pu=(t=0)=>{let e=Math.abs(t);return e<y2*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+wp-1)/wp,1/.45)},yp=t=>{let e=pu(t.r),n=pu(t.g),r=pu(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},k2={...Ys,mode:"rec2020",fromMode:{xyz65:_p,rgb:t=>_p(qi(t))},toMode:{xyz65:yp,rgb:t=>Ki(yp(t))},parse:["rec2020"],serialize:"rec2020"},$i=.0037930732552754493,Qv=Math.cbrt($i),gu=t=>Math.cbrt(t)-Qv,E2=t=>{const{r:e,g:n,b:r,alpha:i}=Xs(t),s=gu(.3*e+.622*n+.078*r+$i),o=gu(.23*e+.692*n+.078*r+$i),a=gu(.2434226892454782*e+.2047674442449682*n+.5518098665095535*r+$i),l={mode:"xyb",x:(s-o)/2,y:(s+o)/2,b:a-(s+o)/2};return i!==void 0&&(l.alpha=i),l},mu=t=>Math.pow(t+Qv,3),S2=({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=mu(t+e)-$i,s=mu(e-t)-$i,o=mu(n+e)-$i,a=Js({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},T2={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:S2},fromMode:{rgb:E2},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:_e,y:_e,b:_e,alpha:{use:_e,fixup:Qt}}},x2={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:_a,lab:vf},fromMode:{rgb:wa,lab:mf},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:_e,y:_e,z:_e,alpha:{use:_e,fixup:Qt}}},P2=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},C2=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},R2={mode:"xyz65",toMode:{rgb:Ki,xyz50:P2},fromMode:{rgb:qi,xyz50:C2},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:_e,y:_e,z:_e,alpha:{use:_e,fixup:Qt}}},A2=({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},O2=({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},M2={mode:"yiq",toMode:{rgb:O2},fromMode:{rgb:A2},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:_e,i:_e,q:_e,alpha:{use:_e,fixup:Qt}}},N2=t=>Math.max(0,Math.min(1,t||0)),vu=t=>Math.round(N2(t)*255),I2=_i("rgb"),L2=t=>{if(t===void 0)return;let e=vu(t.r),n=vu(t.g),r=vu(t.b);return"#"+(1<<24|e<<16|n<<8|r).toString(16).slice(1)},z2=t=>L2(I2(t)),eb=_i("rgb"),tb=t=>{const e={mode:t.mode,r:Math.max(0,Math.min(t.r!==void 0?t.r:0,1)),g:Math.max(0,Math.min(t.g!==void 0?t.g:0,1)),b:Math.max(0,Math.min(t.b!==void 0?t.b:0,1))};return t.alpha!==void 0&&(e.alpha=t.alpha),e},D2=t=>tb(eb(t)),nb=t=>t!==void 0&&(t.r===void 0||t.r>=0&&t.r<=1)&&(t.g===void 0||t.g>=0&&t.g<=1)&&(t.b===void 0||t.b>=0&&t.b<=1);function H2(t){return nb(eb(t))}function rb(t="rgb"){const{gamut:e}=uc(t);if(!e)return r=>!0;const n=_i(typeof e=="string"?e:t);return r=>nb(n(r))}function B2(t="rgb"){const{gamut:e}=uc(t);if(!e)return s=>Sl(s);const n=typeof e=="string"?e:t,r=_i(n),i=rb(n);return s=>{const o=Sl(s);if(!o)return;const a=r(o);if(i(a))return o;const l=tb(a);return o.mode===l.mode?l:_i(o.mode)(l)}}function U2(t,e="lch",n="rgb"){t=Sl(t);let r=n==="rgb"?H2:rb(n),i=n==="rgb"?D2:B2(n);if(t===void 0||r(t))return t;let s=_i(t.mode);t=_i(e)(t);let o={...t,c:0};if(!r(o))return s(i(o));let a=0,l=t.c!==void 0?t.c:0,c=uc(e).ranges.c,u=(c[1]-c[0])/Math.pow(2,13),f=o.c;for(;l-a>u;)o.c=a+(l-a)*.5,r(o)?(f=o.c,a=o.c):l=o.c;return s(r(o)?o:{...o,c:f})}gt(_x);gt(xx);gt(Px);gt(Cx);gt(Ox);gt(Lv);gt(Hv);gt($x);gt(jx);gt(Zx);gt(Wx);gt(bf);gt(Kx);gt(_f);gt(Xx);gt(a2);gt(l2);gt(c2);gt(f2);gt(h2);gt(g2);const $2=gt(v2);gt(b2);gt(_2);gt(k2);gt(Ys);gt(T2);gt(x2);gt(R2);gt(M2);function wo(t,e,n){const r=U2({mode:"oklch",l:t,c:e,h:n},"oklch");return z2(r??{mode:"oklch",l:t,c:0,h:n})}function ib(t){const e=$2(t);return e?{l:e.l,c:e.c,h:e.h??0}:{l:0,c:0,h:0}}function j2(t,e){const{l:n,c:r,h:i}=ib(t);return wo(Math.min(1,Math.max(0,n+e)),r,i)}function F2(t){const{hue:e,chroma:n,bgHex:r,target:i}=t,s=.01;let o=t.l;const a=Io(wo(1,0,e),r),l=Io(wo(0,0,e),r),c=a>=l?s:-s;let u=wo(o,n,e);for(;Io(u,r)<i&&o>0&&o<1;)o=Math.min(1,Math.max(0,o+c)),u=wo(o,n,e);return u}function G2(t,e,n){const{l:r,c:i,h:s}=ib(t);return F2({hue:s,chroma:i,l:r,bgHex:e,target:n})}const V2={dark:.12,light:-.12};function Z2(t,e,n){const r=j2(t,V2[n]);return Io(r,e)>=4.5?r:G2(r,e,4.5)}const al=["dark","light"],hd=hf.map(t=>t.token),W2=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function sb(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q2(t,e,n){if(!sb(t))return n.push(`"${e}" must be an object of palette colour tokens.`),!1;let r=!0;for(const i of hd){const s=t[i];if(s===void 0){if(i==="controlHover")continue;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}W2.test(s)||(n.push(`"${e}.${i}" must be a hex colour like #1a2b3c, got "${s}".`),r=!1)}for(const i of Object.keys(t))hd.includes(i)||(n.push(`"${e}" has an unknown token "${i}".`),r=!1);return r}function K2(t){const e=[];for(const n of al)for(const r of KT){const i=Io(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 ob(t){const e=[];if(!sb(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 al){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}q2(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))al.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 al){const s=t[i];for(const o of hd)o==="controlHover"&&s[o]===void 0?r[i].controlHover=Z2(s.surface,s.text,i):r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:K2(r)}}const Ol=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),ab=Ye({permission:Ev,reason:be().min(1),prerequisite:be().min(1).optional()}),kf=pn().int().nonnegative().nullable(),Y2=Ye({kind:kn(["exec","service"]),state:Zt("blocked"),retryAfterSeconds:kf,blockers:zt(ab).min(1)}),X2=Ye({kind:kn(["exec","service"]),state:Zt("incompatible"),retryAfterSeconds:kf,requiredProtocol:pn().int(),supportedProtocols:zt(pn().int())}),J2=Ye({kind:kn(["exec","service"]),state:kn(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:kf}),Q2=t=>{if(!Ol(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},eP=eT(Q2,uf("state",[Y2,X2,J2])),tP=new Set(["BACKEND_BUSY","BACKEND_STARTING","BACKEND_UNAVAILABLE","BACKEND_MAINTENANCE","BAD_GATEWAY","SERVER_BUSY","REQUEST_TIMEOUT","SCRIPT_TIMEOUT","STATUS_QUERY_FAILED"]),nP=(t,e)=>t==="HTTP_ERROR"?e===408||e===425||e===429||e!==void 0&&e>=500:tP.has(t);class An extends Error{constructor(n,r,i,s={}){super(n);W(this,"id");W(this,"code");W(this,"status");W(this,"retryable");W(this,"details");this.name="BackendError",this.code=r,this.id=i,this.status=s.status,this.retryable=s.retryable??nP(r,s.status),this.details=s.details}}class pd extends An{constructor(n,r={}){const i=r.code??"UNKNOWN_ID";super(`Unknown backend binding id: "${n}"`,i,n,r);W(this,"code");this.code=i,this.name="BackendUnknownId"}}class lb extends An{constructor(n,r={}){super(`Backend "${n}" is not approved`,"NOT_APPROVED",n,r);W(this,"code","NOT_APPROVED");this.name="BackendNotApproved"}}class cb extends An{constructor(n,r={}){super(`Backend "${n}" is disabled`,"DISABLED",n,r);W(this,"code","DISABLED");this.name="BackendDisabled"}}class kp extends An{constructor(n,r,i={}){super(`Backend route "${n}" is not an ${r} route`,"TRANSPORT_MISMATCH",n,i);W(this,"code","TRANSPORT_MISMATCH");this.expected=r,this.name="BackendTransportMismatch"}}class rP extends An{constructor(n,r,i={}){super(`Backend "${n}" is starting`,"BACKEND_STARTING",n,i);W(this,"code","BACKEND_STARTING");this.retryAfterSeconds=r,this.name="BackendStarting"}}class iP extends An{constructor(n,r={}){super(`Backend "${n}" is unavailable`,"BACKEND_UNAVAILABLE",n,r);W(this,"code","BACKEND_UNAVAILABLE");this.name="BackendUnavailable"}}class sP extends An{constructor(n,r={}){super(`Backend "${n}" is incompatible`,"BACKEND_INCOMPATIBLE",n,r);W(this,"code","BACKEND_INCOMPATIBLE");this.name="BackendIncompatible"}}class oP extends An{constructor(n,r,i={}){super(`Backend "${n}" is under maintenance`,"BACKEND_MAINTENANCE",n,i);W(this,"code","BACKEND_MAINTENANCE");this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class aP extends An{constructor(n,r,i,s={}){super(`Backend "${n}" is blocked on an unmet activation prerequisite`,"BACKEND_BLOCKED",n,s);W(this,"code","BACKEND_BLOCKED");this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class lP extends An{constructor(n,r={}){super(`Backend "${n}" returned a bad gateway response`,"BAD_GATEWAY",n,r);W(this,"code","BAD_GATEWAY");this.name="BackendBadGateway"}}class bu extends An{constructor(n,r){super(r,"STATUS_QUERY_FAILED",void 0,{status:n??void 0});W(this,"code","STATUS_QUERY_FAILED");this.httpStatus=n,this.name="BackendStatusQueryError"}}const _u=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},cP=t=>{const e=zt(ab).safeParse(t);return e.success?e.data:[]},ar=(t,e)=>(n,r,i,s)=>new An(i.message??e,t,n,{...s,status:r.status}),ub={DISABLED:(t,e,n,r)=>new cb(t,r),NOT_APPROVED:(t,e,n,r)=>new lb(t,r),ROUTE_NOT_FOUND:(t,e,n,r)=>new pd(t,{...r,code:"ROUTE_NOT_FOUND"}),BACKEND_STARTING:(t,e,n,r)=>new rP(t,_u(e),r),BACKEND_UNAVAILABLE:(t,e,n,r)=>new iP(t,r),BACKEND_INCOMPATIBLE:(t,e,n,r)=>new sP(t,r),BACKEND_MAINTENANCE:(t,e,n,r)=>new oP(t,_u(e),r),BACKEND_BLOCKED:(t,e,n,r)=>new aP(t,cP(n.detail),_u(e),r),BAD_GATEWAY:(t,e,n,r)=>new lP(t,r),BAD_REQUEST:ar("BAD_REQUEST","Backend request was rejected"),INTERNAL:ar("INTERNAL","Backend request failed"),SERVER_BUSY:ar("SERVER_BUSY","Backend request intake is busy"),REQUEST_TIMEOUT:ar("REQUEST_TIMEOUT","Backend request timed out"),SCRIPT_FAILED:ar("SCRIPT_FAILED","Backend script failed"),SCRIPT_TIMEOUT:ar("SCRIPT_TIMEOUT","Backend script timed out"),BACKEND_BUSY:ar("BACKEND_BUSY","Backend is busy"),BACKEND_BODY_TOO_LARGE:ar("BACKEND_BODY_TOO_LARGE","Backend request body is too large"),BACKEND_OUTPUT_TOO_LARGE:ar("BACKEND_OUTPUT_TOO_LARGE","Backend output is too large"),CSRF_REQUIRED:ar("CSRF_REQUIRED","Backend request requires CSRF protection"),UNAUTHORIZED:ar("UNAUTHORIZED","Backend request is unauthorized")},uP="X-Mndw-Error",dP="INTERNAL",fP="Backend platform request failed",hP=t=>Object.prototype.hasOwnProperty.call(ub,t)?t:void 0,pP=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}`:""},gP=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),mP=t=>t.startsWith("https:")?"wss:":"ws:",Ep=(t,e)=>t.enabled?t.approval!=="approved"?new lb(e):null:new cb(e),vP=async(t,e)=>{if(e.ok||e.redirected!==!1||!e.headers.has(uP))return e;let n;try{n=await e.clone().json()}catch{n=void 0}const r=Ol(n)&&Ol(n.error)?n.error:void 0,i={code:typeof(r==null?void 0:r.code)=="string"?r.code:void 0,message:typeof(r==null?void 0:r.message)=="string"?r.message:void 0,detail:r==null?void 0:r.detail},s=i.code?hP(i.code):void 0,o={status:e.status,details:i.detail};throw s?ub[s](t,e,i,o):new An(i.message??fP,dP,t,o)},bP=t=>Ol(t)&&t.name==="AbortError",_P=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${pP(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&&(gP(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 vP(n,a)};function wP(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")},i=(o,a={})=>{const l=e.routes[o];if(!l)throw new pd(o);if(l.transport!=="http"||!l.method)throw new kp(o,"http");const c=Ep(e,o);return c?Promise.reject(c):_P(r,l,o,a)};function s(o,a={}){return i(o,a).then(async l=>{var h,p;if(!l.ok){const g=await l.text();throw new An(`Backend route "${o}" returned HTTP ${l.status}`,"HTTP_ERROR",o,{status:l.status,details:g})}const c=((p=(h=l.headers.get("content-type"))==null?void 0:h.split(";",1)[0])==null?void 0:p.trim().toLowerCase())??"",u=a.as??(c==="application/json"||c.endsWith("+json")?"json":c.startsWith("text/")?"text":"blob");if(u==="text")return l.text();if(u==="blob")return l.blob();const f=await l.text();try{return JSON.parse(f)}catch(g){throw bP(g)?g:new An(`Backend route "${o}" returned invalid JSON`,"INVALID_RESPONSE",o,{status:l.status,details:f})}})}return{fetch(o,a={}){return i(o,a)},call:s,socket(o,a={}){const l=e.routes[o];if(!l)throw new pd(o);if(l.transport!=="websocket")throw new kp(o,"websocket");const c=Ep(e,o);if(c)throw c;const u=`${mP(r.origin)}//${r.origin.replace(/^[a-z]+:\/\//,"")}/ws/plugins/${r.pluginName}/${l.path}`,f=a.protocols??l.protocols;return new r.WebSocketCtor(u,f)},status(o={}){const a=`${r.origin}/api/plugins/${r.pluginName}/_mndw/status`;return r.fetchImpl(a,{method:"GET",signal:o.signal}).then(async l=>{if(!l.ok)throw new bu(l.status,`Backend status query failed with HTTP ${l.status}`);try{return eP.parse(await l.json())}catch(c){throw c instanceof bu?c:new bu(l.status,"Backend status response is invalid")}})}}}class Sp extends Error{constructor(n,r){super(r);W(this,"status");this.name="TelemetryError",this.status=n}}const pi=t=>typeof t=="number"&&Number.isFinite(t),yP=["unanchored","anchored","suspect"],kP=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"||!yP.includes(n))throw new Error("telemetry clock state is invalid");if(r!==null&&(!pi(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}},EP=new Set(["accent","success","warning","muted"]),SP=t=>{if(typeof t!="string"||!EP.has(t))throw new Error(`invalid projected chart color: ${String(t)}`);return t},Tp=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!pi(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!pi(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}},TP=(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(!pi(n.time)||!pi(n.min)||!pi(n.max))throw new Error(`projected band point in ${e} is invalid`);return{time:n.time,min:n.min,max:n.max}},xP=(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(typeof n.unit!="string"||n.unit.length===0)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=>Tp(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=>Tp(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=>TP(c,t)),color:SP(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(!pi(a.min)||!pi(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}},PP=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]=xP(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:kP(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},CP=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function RP(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 Sp(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw CP(o)?o:new Sp(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,PP,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const AP={loading:"Loading…",error:"Something went wrong.","plugin-load-error":"Couldn't load plugins."},OP={"toggle-menu":"Toggle menu",close:"Close navigation",dashboard:"Dashboard","package-manager":"Entware",plugins:"Plugins","page-load-failed":"Page failed to load",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:"Log out"},MP={"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","plugin-load-failed":"Plugin “{label}” failed to load","retry-plugin-load":"Retry","remove-failed-plugin":"Remove","widget-error":"Error loading widget","empty-error-title":"Widgets unavailable","empty-error-text":"Plugins could not be loaded — see the message above.","empty-no-plugins":"No enabled plugins provide widgets.","empty-install-plugins":"Manage plugins","empty-title":"Dashboard is empty","empty-add-widget":"Add a widget to get started.","widget-removed":"Widget “{label}” removed"},NP=JSON.parse(`{"title":"Settings","general-tab":"General","diagnostics-tab":"Diagnostics","plugins-tab":"Plugins","self-update-tab":"mndw 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":"mndw 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":"Entware is busy installing or updating packages. 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":"Interface","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 background router access session is needed for telemetry.","telemetry-session-link":"Configure background router access","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":"Background router access","persistent-rci-description":"mndw keeps its own RCI sign-in to this router so telemetry history and plugins work without an open browser tab. Tokens stay inside mndw.","persistent-loading":"Loading background router access…","configure-persistent":"Configure background router access","persistent-tokenless-toggle":"Controller and extender access","persistent-tokenless-description":"No controller token is needed on this firmware.","persistent-needs-token":"Firmware now requires a controller token for background router access.","persistent-storage-disabled":"Background router access storage is disabled.","persistent-storage-decrypt-failed":"Background router access storage could not be decrypted.","controller-token":"Controller token","controller-token-hint":"Create a token in the router's web interface on the Users & Access page, or in the router's command line.","controller-token-set-placeholder":"Token is set","test":"Test","save":"Save","clear-controller-session":"Clear controller access","update-firmware-persistent":"Update device firmware to enable background router access.","controller-token-valid":"Controller token is valid","persistent-extenders-title":"Extenders","persistent-extenders-summary":"Extenders ({count})","persistent-extenders-summary-problems":"Extenders ({count}) · {problems} without access","persistent-enumeration-stale":"Extender membership is temporarily stale; live connections 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":"Background router access state unavailable","persistent-request-failed":"Background router access request failed","controller-token-rejected":"Controller token rejected","firmware-unsupported":"Device firmware does not support background router access","device-unreachable":"Device unreachable","palette-import-aria-label":"Import palette JSON","palette":{"title":"Palette","loading":"Loading palette…","reading":"Reading palette…","saved":"Saved.","drop":"Drop a palette JSON file here or choose one.","read-failed":"Could not read palette file.","invalid-json":"Invalid JSON file.","invalid-structure":"The palette file is invalid.","load-failed":"Could not load the palette.","operation-failed":"Could not update the palette.","preview-note":"Previewing the imported palette. Nothing is saved to the device until you confirm.","contrast-warnings":"Contrast warnings ({theme})","warning-item":"{pair}: {ratio} (needs {min})","theme-dark":"Dark theme","theme-light":"Light theme","confirm":"Confirm","discard":"Discard","reset-confirmation":"Discard the imported palette and return to the built-in colours?","reset-confirm":"Yes, reset","reset":"Reset to default","export":"Export palette"},"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","plugin-risk-warning":"Plugins run with full access. A plugin page runs in this dashboard and can call the router API; if it has a backend, that backend runs on the router as root. Manifest permissions describe what the plugin asks for; they are not a sandbox. Install plugins only from authors you trust.","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","plugin-updated-notice":"A newer plugin version is installed. Reload to use it.","reload-now":"Reload now","later":"Later","loading":"Loading plugins…","retry":"Retry","dismiss":"Dismiss","keep-notice":"Keep","diagnostics":"Diagnostics","last-error":"Last error","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.","no-installed-next":"Upload a plugin to add it to this router.","version":"Version","type-widget":"Widget","type-page":"Page","builtin":"Built-in","uploaded":"Uploaded","installing-dependencies":"Installing dependencies…","dependency-install-failed":"Dependency install failed","plugin-load-failed":"Failed to load","plugin-load-timeout":"Did not load within {seconds} seconds","plugin-load-error":"The plugin file did not load or contains an error","version-mismatch":"Version mismatch","sdk-major-badge":"Built for another SDK version","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":"{count, plural, one {# endpoint} other {# endpoints}}","websocket":"{count, plural, one {# websocket} other {# 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":"Waiting for a free slot","runtime-state-starting":"Starting","runtime-state-ready":"Running","runtime-state-backoff":"Restarting after a failure","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":"Background process","backend-kind-exec":"Runs a command per request","packages":"Installs packages","service-args":"Service arguments","public-routes":"Public routes (reachable from the LAN without sign-in)","permissions":"Permissions","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 {limit} upload limit.","upload-limit-unit":"MiB","upload-target-mismatch":"{filename} targets {archiveTarget}, but this device reports {deviceTarget}. Choose the matching archive."}}`),IP={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry",undo:"Undo"},LP={username:"Username",password:"Password",hint:"Use the router's administrator username and password.",submit:"Log in","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},zP={region:"Notifications",dismiss:"Dismiss"},DP={tab:"Packages",title:"Entware packages",refresh:"Check for updates",reload:"Reload",search:"Search packages…","search-label":"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","empty-next":"Refresh the package list to check again.","no-match":"No packages match your filter","no-match-next":"Try a different search or package filter.","show-all":"Show all packages",package:"Package",version:"Version",status:"Status",description:"Description",expand:"Expand {name}",collapse:"Collapse {name}",loaded:"{count} packages loaded","never-refreshed":"Metadata never refreshed","just-now":"Metadata refreshed just now","refreshed-ago":"Metadata refreshed {age}","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."},HP={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","empty-next":"Refresh to check the service list again.","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."},BP={"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 {limit} 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":"Background router access could not start. Try again."},db={app:AP,nav:OP,dashboard:MP,settings:NP,"page-plugin":{opening:"Opening {title}…","open-error":"Could not open the page of plugin {title}.","load-failed":"Page “{title}” failed to load",slow:"The plugin is taking too long to respond."},"plugin-load":{failed:"Plugins failed to load: {names}",loaded:"Plugins loaded"},common:IP,login:LP,toast:zP,packages:DP,services:HP,errors:BP},UP={loading:"Загрузка…",error:"Произошла ошибка.","plugin-load-error":"Не удалось загрузить плагины."},$P={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Панель управления","package-manager":"Entware",plugins:"Плагины","page-load-failed":"Не удалось загрузить страницу",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},jP={"add-widget":"Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости","plugin-load-failed":"Не удалось загрузить плагин «{label}»","retry-plugin-load":"Повторить","remove-failed-plugin":"Удалить","widget-error":"Не удалось загрузить виджет","empty-error-title":"Виджеты недоступны","empty-error-text":"Не удалось загрузить плагины — см. сообщение выше.","empty-no-plugins":"Ни один включённый плагин не предоставляет виджетов.","empty-install-plugins":"Управление плагинами","empty-title":"Панель управления пуста","empty-add-widget":"Добавьте виджет, чтобы начать.","widget-removed":"Виджет «{label}» удалён"},FP=JSON.parse('{"title":"Настройки","general-tab":"Общие","diagnostics-tab":"Диагностика","plugins-tab":"Плагины","self-update-tab":"Обновление mndw","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":"Обновление mndw","self-update-checking":"Проверка…","self-update-preparing":"Подготовка обновления…","self-update-updating":"Обновление до {version}…","self-update-reverting":"Откат до {version}…","self-update-success":"Обновление завершено. Текущая версия: {version}","self-update-busy":"Entware занят установкой или обновлением пакетов. Повторите попытку позже.","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":"Для телеметрии нужна сессия фонового доступа к роутеру.","telemetry-session-link":"Настроить фоновый доступ к роутеру","telemetry-wear-note":"Сбор телеметрии увеличит нагрузку на накопитель, на котором установлен Entware, и может ускорить его износ.","telemetry-error":"Не удалось обновить фоновую телеметрию.","name":"Имя:","vendor":"Производитель:","firmware":"Прошивка:","device-unavailable":"Информация об устройстве недоступна.","persistent-rci-title":"Фоновый доступ к роутеру","persistent-rci-description":"mndw хранит собственную сессию входа на роутер, чтобы история телеметрии и плагины работали без открытой вкладки браузера. Токены остаются внутри mndw.","persistent-loading":"Загрузка фонового доступа к роутеру…","configure-persistent":"Настроить фоновый доступ к роутеру","persistent-tokenless-toggle":"Доступ к контроллеру и ретрансляторам","persistent-tokenless-description":"Для этой прошивки токен контроллера не нужен.","persistent-needs-token":"Для фонового доступа к роутеру прошивка требует токен контроллера.","persistent-storage-disabled":"Хранилище фонового доступа к роутеру отключено.","persistent-storage-decrypt-failed":"Не удалось расшифровать хранилище фонового доступа к роутеру.","controller-token":"Токен контроллера","controller-token-hint":"Токен создаётся в веб-интерфейсе роутера на странице «Пользователи и доступ» или в командной строке роутера.","controller-token-set-placeholder":"Токен задан","test":"Проверить","save":"Сохранить","clear-controller-session":"Удалить доступ к контроллеру","update-firmware-persistent":"Обновите прошивку устройства, чтобы включить фоновый доступ к роутеру.","controller-token-valid":"Токен контроллера действителен","persistent-extenders-title":"Ретрансляторы","persistent-extenders-summary":"Ретрансляторы ({count})","persistent-extenders-summary-problems":"Ретрансляторы ({count}) · без доступа: {problems}","persistent-enumeration-stale":"Список ретрансляторов временно устарел; активные подключения всё ещё проверяются.","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":"Состояние фонового доступа к роутеру недоступно","persistent-request-failed":"Не удалось запросить состояние фонового доступа к роутеру","controller-token-rejected":"Токен контроллера отклонён","firmware-unsupported":"Прошивка устройства не поддерживает фоновый доступ к роутеру","device-unreachable":"Устройство недоступно","palette-import-aria-label":"Импорт JSON-палитры","palette":{"title":"Палитра","loading":"Загрузка палитры…","reading":"Чтение палитры…","saved":"Сохранено.","drop":"Перетащите JSON-файл палитры сюда или выберите файл.","read-failed":"Не удалось прочитать файл палитры.","invalid-json":"Файл содержит неверный JSON.","invalid-structure":"Файл палитры недействителен.","load-failed":"Не удалось загрузить палитру.","operation-failed":"Не удалось обновить палитру.","preview-note":"Предпросмотр импортированной палитры. На устройство ничего не сохранится, пока вы не подтвердите.","contrast-warnings":"Предупреждения о контрасте ({theme})","warning-item":"{pair}: {ratio} (минимум {min})","theme-dark":"Тёмная тема","theme-light":"Светлая тема","confirm":"Подтвердить","discard":"Не применять","reset-confirmation":"Сбросить импортированную палитру и вернуться к встроенным цветам?","reset-confirm":"Да, сбросить","reset":"Сбросить к встроенным цветам","export":"Экспорт палитры"},"backend-capacity":"Ёмкость серверной части","backend-approval-title":"Подтвердить серверную часть для {label}","backend-approval-declaration":"объявляет серверную часть. Проверьте её возможности перед подтверждением.","backend-approval-deny":"Отклонить","backend-approval-approve":"Подтвердить","plugin-risk-warning":"Плагины работают с полным доступом. Страница плагина работает внутри панели и может вызывать API роутера; если у плагина есть серверная часть, она запускается на роутере с правами root. Разрешения в манифесте описывают запросы плагина, но не изолируют его. Устанавливайте плагины только от авторов, которым доверяете.","upload-plugin-zip":"Загрузить ZIP плагина","diagnostics-description":"Скачать состояние демона и плагинов для диагностики.","download-diagnostics":"Скачать диагностику","downloading":"Скачивание…","diagnostics-failed":"Не удалось скачать диагностику","plugin-manager":{"title":"Менеджер плагинов","plugin-updated-notice":"Установлена новая версия плагина. Перезагрузите страницу, чтобы использовать её.","reload-now":"Перезагрузить сейчас","later":"Позже","loading":"Загрузка плагинов…","retry":"Повторить","dismiss":"Скрыть","keep-notice":"Оставить","diagnostics":"Диагностика","last-error":"Последняя ошибка","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":"Плагины не установлены.","no-installed-next":"Загрузите плагин, чтобы добавить его на этот роутер.","version":"Версия","type-widget":"Виджет","type-page":"Страница","builtin":"Встроенный","uploaded":"Загруженный","installing-dependencies":"Установка зависимостей…","dependency-install-failed":"Не удалось установить зависимости","plugin-load-failed":"Не удалось загрузить","plugin-load-timeout":"Загрузка не завершилась за {seconds} с","plugin-load-error":"Файл плагина не загрузился или содержит ошибку","version-mismatch":"Несоответствие версии","sdk-major-badge":"Собран для другой версии SDK","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":"{count, plural, one {# конечная точка} few {# конечные точки} many {# конечных точек} other {# конечной точки}}","websocket":"{count, plural, one {# веб-сокет} few {# веб-сокета} many {# веб-сокетов} other {# веб-сокета}}","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":"Фоновый процесс","backend-kind-exec":"Команда на каждый запрос","packages":"Устанавливает пакеты","service-args":"Аргументы сервиса","public-routes":"Публичные маршруты (доступны из локальной сети без входа)","permissions":"Разрешения","upload-drop":"Перетащите ZIP плагина сюда или выберите файл.","uploading":"Загрузка плагина…","waiting-approval":"Ожидание подтверждения…","installed-success":"Плагин «{label}» установлен.","approved-success":"Плагин «{label}» подтверждён.","choose-zip":"Выберите ZIP-файл.","empty-zip":"ZIP-файл пуст.","zip-too-large":"Размер ZIP-файла превышает лимит загрузки {limit}.","upload-limit-unit":"МБ","upload-target-mismatch":"Файл {filename} предназначен для {archiveTarget}, но устройство сообщает {deviceTarget}. Выберите подходящий архив."}}'),GP={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить",undo:"Отменить"},VP={username:"Имя пользователя",password:"Пароль",hint:"Используйте логин и пароль администратора роутера.",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},ZP={region:"Уведомления",dismiss:"Закрыть"},WP={tab:"Пакеты",title:"Пакеты Entware",refresh:"Проверить обновления",reload:"Перезагрузить",search:"Поиск пакетов…","search-label":"Поиск пакетов",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:"Пакеты не найдены","empty-next":"Обновите список пакетов, чтобы проверить ещё раз.","no-match":"Нет пакетов, соответствующих фильтру","no-match-next":"Измените поисковый запрос или фильтр пакетов.","show-all":"Показать все пакеты",package:"Пакет",version:"Версия",status:"Состояние",description:"Описание",expand:"Развернуть {name}",collapse:"Свернуть {name}",loaded:"Загружено пакетов: {count}","never-refreshed":"Метаданные ещё не обновлялись","just-now":"Метаданные обновлены только что","refreshed-ago":"Метаданные обновлены {age}","detail-failed":"Не удалось загрузить сведения о пакете",size:"Размер в репозитории","installed-size":"Установленный размер","installed-time":"Время установки",dependencies:"Зависимости","confirm-remove-title":"Подтвердите удаление пакета","confirm-remove":"Удалить {names}?",protected:"Защищённый пакет","dependency-conflict":"Невозможно удалить {package}: от него зависит {dependents}.","dependency-conflict-generic":"Невозможно удалить {package}: от него зависят другие установленные пакеты."},qP={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:"Сервисы не найдены","empty-next":"Обновите список, чтобы проверить сервисы ещё раз.","load-failed":"Не удалось загрузить сервисы",unavailable:"Менеджер сервисов недоступен","unavailable-description":"На устройстве нет доступного каталога init-сервисов.",protected:"Защищённый сервис","confirm-title":"Подтвердите действие с сервисом",confirm:"{action} сервис {name}?","confirm-enable-boot":"Включать {name} при загрузке? Работающий сервис не изменится до перезагрузки.","confirm-disable-boot":"Не включать {name} при загрузке? Работающий сервис не изменится до перезагрузки."},KP={"device-timeout":"Устройство не отвечает.","invalid-manifest":"Манифест плагина недействителен.","invalid-zip":"Файл не является ZIP-архивом.","manifest-missing":"В архиве нет manifest.json в корне.","unsupported-manifest-version":"Версия манифеста плагина больше не поддерживается.",conflict:"Плагин с таким именем уже существует.","upload-too-large":"Плагин превышает лимит загрузки {limit}.","opkg-failed":"Не удалось установить системные пакеты плагина.","daemon-failed":"Не удалось запустить серверную часть плагина.",unauthorized:"Сессия истекла. Войдите снова.","service-capacity":"Нет свободных сервисных ресурсов.","backend-busy":"Серверная часть занята. Повторите позже.","backend-unavailable":"Серверная часть недоступна.","backend-incompatible":"Протокол серверной части не поддерживается.","backend-maintenance":"Серверная часть обновляется. Повторите позже.","controller-session-unavailable":"Сессия токена контроллера недоступна.","rci-socket-start-failed":"Не удалось запустить фоновый доступ к роутеру. Повторите попытку."},YP={app:UP,nav:$P,dashboard:jP,settings:FP,"page-plugin":{opening:"Открываем {title}…","open-error":"Не удалось открыть страницу плагина {title}.","load-failed":"Не удалось загрузить страницу «{title}»",slow:"Плагин долго не отвечает."},"plugin-load":{failed:"Не удалось загрузить плагины: {names}",loaded:"Плагины загружены"},common:GP,login:VP,toast:ZP,packages:WP,services:qP,errors:KP},Ef="mndw",Is=`${Ef}:plugin`,fb=["en","ru"],hb=5e3,XP=300,JP=1e4,QP=6e4,eC=24e4,xp=15e3,pb=10*1024*1024,Sf=Object.freeze({theme:"dark",locale:"en"}),Tf=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([])})}),gb="/api/mgmt/list",tC="/api/mgmt/permission",nC="/api/mgmt/upload",Pp="/api/mgmt/approve",rC="/api/mgmt/deny",iC="/api/mgmt/enable",sC="/api/mgmt/disable",oC="/api/mgmt/delete",aC="/api/mgmt/restart",lC="/api/mgmt/runtime",wu="/api/mgmt/palette",cC="/api/mgmt/device-hardware",Cp="/api/mgmt/telemetry",uC="/api/mgmt/opkg/list",dC="/api/mgmt/opkg/install",fC="/api/mgmt/opkg/remove",hC="/api/mgmt/opkg/update",pC="/api/mgmt/opkg/upgrade",gC="/api/mgmt/opkg/info",mC="/api/mgmt/self-update/status",vC="/api/mgmt/self-update/check",bC="/api/mgmt/self-update/apply",_C="/api/mgmt/self-update/revert",wC="/api/mgmt/service/list",yC="/api/mgmt/service/status",kC="/api/mgmt/service/start",EC="/api/mgmt/service/stop",SC="/api/mgmt/service/restart",TC="/api/mgmt/service/set-enabled",Rp={builtin:"/plugins/",user:"/user-plugins/"},xC={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 PC(t){return[...t].map(e=>xC[e]??e).join("")}function CC(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`[${PC(e)}]`}function mb(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?CC(n):mb(n)]))}function vb(){const t=new j_(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 $a(t,e,n){return new ll(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 RC(t,e){return new ll(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 gd=3e3;function AC(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??NC,now:t.now??Date.now,setTimeout:t.setTimeout??globalThis.setTimeout.bind(globalThis),queueMicrotask:t.queueMicrotask??globalThis.queueMicrotask.bind(globalThis)}}function yu(t,e){return`${t.name}/${t.version}/${e}`}function OC(t,e){const n=t.locales[e];if(n!==void 0)return`${t.baseUrl.replace(/\/$/,"")}/${n}?v=${encodeURIComponent(t.version)}`}function MC(t){return t.split("-")[0]}function bb(t,e){if(t.locales[e]!==void 0)return e;const n=MC(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function NC(t){const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return b0(await e.json(),t)}async function Ap(t,e,n,r){const i=t.catalogSuccessCache.get(yu(e,n));if(i!==void 0)return i;const s=OC(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(yu(e,n),o),o}catch(o){throw t.catalogSuccessCache.delete(yu(e,n)),o}}function IC(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 _b(t,e,n,r){var f,h;const i=bb(e,n),s=e.defaultLocale,o=Ap(t,e,i,r),a=i===s?o:Ap(t,e,s,r),l=await Promise.race([Promise.allSettled([o,a]),IC(t,r)]).catch(()=>{}),c=Array.isArray(l)&&((f=l[0])==null?void 0:f.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 wb(t,e){return{hostLocale:e,resolvedCatalogLocale:bb(t,e),fallbackStatus:"key"}}class LC{constructor(e,n){W(this,"source");W(this,"state");W(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=wb(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 zC(t,e,n){const r=new LC(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function DC(t,e){t.catalogCells.add(e)}function HC(t,e){t.catalogCells.delete(e)}function BC(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function yb(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function UC(t,e,n,r=gd){e.commit(await _b(t,e.source,n,t.now()+r))}class $C{constructor(e,n){W(this,"runtime");W(this,"token");W(this,"targetLocale");W(this,"deadline");W(this,"promise");W(this,"pending",0);W(this,"initialEnrollmentDone",!1);W(this,"settled",!1);W(this,"cells",new Map);W(this,"resolvedStates",new Map);W(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+gd,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),gd)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=_b(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>wb(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 jC(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new $C(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function FC(t,e){t.commit(e)}function GC(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function VC(t){return t.activeGeneration}function ZC(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 kv(s,n,r)}function WC(t,e,n,r){const i={get locale(){return e()},direction:"ltr",t:(s,o)=>ZC(t,s,o,e()),formatNumber:(s,o)=>new Intl.NumberFormat(Fo(e()),o).format(s),formatDate:(s,o)=>new Intl.DateTimeFormat(Fo(e()),o).format(s),change$:RC((t==null?void 0:t.subscribe.bind(t))??n,r)};return Object.freeze(i)}function qC(t={}){const e=AC(t);return{createPluginCatalogCell:(n,r)=>zC(e,n,r),registerPluginCatalogCell:n=>DC(e,n),unregisterPluginCatalogCell:n=>HC(e,n),clearPluginCatalogCells:()=>BC(e),loadInitialPluginCatalog:(n,r,i)=>UC(e,n,r,i),preparePluginCatalogGeneration:n=>jC(e,n),commitPluginCatalogGeneration:(n,r)=>FC(n,r),discardPluginCatalogGeneration:n=>GC(e,n),getActivePluginCatalogGeneration:()=>VC(e)}}const kc=qC(),kb=`${Ef}:locale`,ku={en:db,ru:YP};mb(db);function Eb(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 KC(){return!1}function xf(){return fb}function Sb(t){const e=Eb(t);return xf().find(n=>n===e)}function Op(t){const e=Eb(t);if(e!==void 0)return Sb(e)??xf().find(n=>n===e.split("-")[0])}function YC(t){try{return(t==null?void 0:t.getItem(kb))??void 0}catch{return}}function XC(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function JC(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??L_;let s=fb[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=YC(n),w=(m===void 0?void 0:Sb(m))??XC().map(Op).find(E=>E!==void 0)??"en";return u(w),w},getLocale:()=>s,setLocale:async m=>{const _=Op(m)??"en";if(_===s)return;o=!0;for(const E of l)E(!0);const w=e.preparePluginCatalogGeneration(_);await w.promise,e.commitPluginCatalogGeneration(w,()=>{u(_);try{n==null||n.setItem(kb,_)}catch{}}),o=!1;for(const E of l)E(!1)},subscribeLocale:m=>(a.add(m),()=>{a.delete(m)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:m=>(l.add(m),()=>{l.delete(m)}),hostT:(m,_,w=s)=>{const E=ku[w]??ku.en,M=Mp(E,m)??Mp(ku.en,m)??m;return _===void 0?M:kv(M,_,w)},hostFormatNumber:(m,_)=>new Intl.NumberFormat(Fo(s),_).format(m),hostFormatDate:(m,_)=>new Intl.DateTimeFormat(Fo(s),_).format(m),getAvailableLocales:xf,isPseudoLocaleEnabled:KC})}const ka=JC({catalog:kc}),QC=ka,Pf=()=>ka.getLocale(),eR=t=>ka.subscribeLocale(t),tR=t=>ka.subscribeLocalePending(t),sn=(t,e,n)=>ka.hostT(t,e,n);function Mp(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 Tb=`${Ef}:theme`,md="dark";let ci=md;const vd=new Set;function nR(){try{const t=localStorage.getItem(Tb);return t==="light"||t==="dark"?t:md}catch{return md}}function xb(t){document.documentElement.dataset.theme=t}function Pb(t){for(const e of vd)e(t)}function rR(){return ci=nR(),xb(ci),Pb(ci),ci}function Ls(){return ci}function iR(t){if(t!==ci){ci=t,xb(t);try{localStorage.setItem(Tb,t)}catch{}Pb(t)}}function hs(){iR(ci==="dark"?"light":"dark")}function Ec(t){return vd.add(t),()=>{vd.delete(t)}}function Np(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}const sR=["/","/login","/packages","/packages/services","/settings"],oR=new Set(sR);function Cb(t){return oR.has(t)}const aR=be().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),lR=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),Rb=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},Cf=be().min(1).refine(lR,{message:"must be a safe relative path"}),cR=Cf.refine(Rb,{message:"entry must include a file name"}),bd=t=>{try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}},uR=be().min(1).superRefine((t,e)=>{const n=bd(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})`})}),dR=Cf.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),fR=Ye({defaultLocale:uR,locales:Ks(be(),dR)}).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=bd(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=bd(t.defaultLocale);i!==void 0&&!r.has(i)&&e.addIssue({code:"custom",path:["defaultLocale"],message:"defaultLocale must be present in locales"})}),Ab=be().regex(/^[a-z0-9][a-z0-9+_.-]*$/),Ob=kn(["session","public"]).default("session"),hR=be().transform(t=>t.toUpperCase()).pipe(kn(["GET","HEAD","POST","PUT","PATCH","DELETE"])),Mb=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"},Nb=Cf.regex(/^backend\//,{message:"command must start with backend/"}).refine(Rb,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),pR=be().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"}),Ib=Ye({id:be().min(1),transport:Zt("http"),method:hR,path:be().refine(Mb,{message:"path must be canonical and safe"}),access:Ob}),gR=Ye({id:be().min(1),transport:Zt("websocket"),path:be().refine(Mb,{message:"path must be canonical and safe"}),access:Ob,protocols:zt(be().min(1)).optional()}),mR=Ib.extend({command:Nb}),Lb=(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"})},vR=Ye({kind:Zt("exec"),packages:zt(Ab).optional(),routes:zt(mR).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{Lb(t.routes,e)}),bR=Ye({kind:Zt("service"),protocolVersion:pn().int().positive(),command:Nb,args:zt(pR).optional(),packages:zt(Ab).optional(),routes:zt(li([Ib,gR])).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{Lb(t.routes,e)}),_R=li([vR,bR]),Ip=pn().int({message:"gridColumns must be an integer"}).min(1,{message:"gridColumns must be at least 1"}).max(12,{message:"gridColumns must be at most 12"}),Lp=pn().int().positive(),wR=Zt(1).describe("Manifest format version. Must be 1."),yR=aR.describe("Unique plugin id used as the on-disk folder and URL segment."),kR=be().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,{message:"version must be valid SemVer (for example, 1.2.3)"}).describe("Semantic version of this plugin."),ER=be().min(1).describe("Human-readable name shown in the dashboard or navigation."),SR=cR.describe("Relative path to the bundled entry module."),TR=be().optional().describe("Optional icon name."),xR=Sv,PR=zt(xR).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"permissions contains duplicate permission"})}),CR=Ye({w:Ip,h:Lp,minW:Ip.optional(),minH:Lp.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"]}),RR=be().regex(/^\/[^/?#*]+$/).refine(t=>!Cb(t),{message:"route is reserved by the host"}),zb={manifestVersion:wR,name:yR,version:kR,label:ER,entry:SR,icon:TR,permissions:PR.optional(),i18n:fR.optional(),backend:_R.optional()},AR=Ye({...zb,type:Zt("widget"),size:CR,fixedHeight:Mr().optional()}),OR=Ye({...zb,type:Zt("page"),route:RR}),MR=uf("type",[AR,OR]);class NR 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}`);W(this,"issues");this.issues=i}}function Db(t){const e=MR.safeParse(t);if(!e.success){const n=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new NR(n,e.error.issues)}return e.data}Ye({cid:be().optional(),mac:be().optional(),ip:be().optional(),fqdn:be().optional(),"fqdn-certificate-valid":Mr().optional(),capabilities:Ks(be(),td()).optional()}).passthrough();const IR=[{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.2.0",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"}],Rf=()=>Object.fromEntries(IR.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),LR=kn(["builtin","registry","upload"]),zR=kn(["pending","approved"]),DR=kn(["ready","installing","failed"]),HR=kn(["stopped","capacity_blocked","starting","ready","backoff","failed"]),BR=Ye({kind:kn(["exec","service"]),packages:zt(be()).optional(),args:zt(be()).optional(),publicRoutes:zt(be()).optional()}),UR=Ks(be(),Mr()).superRefine((t,e)=>{for(const n of Object.keys(t))WT(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI permissions may be granted"})}),$R=Ye({transport:kn(["http","websocket"]),path:be(),method:kn(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:zt(be()).optional()}),jR=Ye({routes:Ks(be(),$R)}),FR=Ye({w:pn(),h:pn(),minW:pn().optional(),minH:pn().optional()}),GR=Ye({defaultLocale:be(),locales:Ks(be(),be())}),VR=Ye({state:HR,restartCount:pn(),consecutiveFailures:pn(),startedAt:be().optional(),nextAttemptAt:be().optional(),lastExit:be().optional(),lastError:be().optional(),recentStderr:zt(be()).optional(),requiredProtocol:pn().optional(),compatible:Mr().optional(),supportedProtocols:zt(pn()).optional()}),ZR=Ye({sdkVersion:be(),sharedDependencies:Ks(be(),be())}),Hb={name:be(),version:be(),label:be(),entry:be(),icon:be().optional(),source:LR,approval:zR,enabled:Mr(),permissions:zt(Sv).optional(),permissionGrants:UR.optional(),depsStatus:DR,backend:jR,review:BR.optional(),i18n:GR.optional(),catalogBaseUrl:be().optional(),runtime:VR.optional(),lock:ZR.optional()},WR=Ye({...Hb,type:Zt("widget"),size:FR,fixedHeight:Mr().optional()}),qR=Ye({...Hb,type:Zt("page"),route:be()}),Bb=uf("type",[WR,qR]),KR=Ye({plugins:zt(Bb)}),Ub=t=>KR.parse(t).plugins,Eu=t=>Bb.parse(t),Ml=new Zi;function Sc(t){return Ml.get(t)??"ready"}function zs(t){Ml.clear();for(const e of t)Ml.set(e.name,e.depsStatus)}let YR=0,ja=null,zp;function XR(){clearTimeout(zp),zp=void 0,ja==null||ja.abort(),ja=null,YR+=1}let Vo=0,Zo=new AbortController;function JR(t=!1){return Zo.abort(),Zo=new AbortController,Vo+=1,t||(ee.pluginLoadError=null),ee.authInitInFlight=!0,Vo}function Nr(){return Vo}function QR(){return Zo.signal}function eA(t){t===Vo&&(ee.authInitInFlight=!1)}const ee=lt({authenticated:!1,ready:!1,authInitInFlight:!1,pluginLoadRevision:0,pluginLoadFailureSeq:0,hostInfo:null,deviceInfo:null,pluginLoadError:null,loginError:null,loginUsername:"",mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:Ls(),locale:Pf(),localeSwitchPending:!1});function Su(){va().matches?ee.mobileSidebarOpen=!ee.mobileSidebarOpen:ee.desktopSidebarCollapsed=!ee.desktopSidebarCollapsed}function Tc(){Vo+=1,Zo.abort(),Zo=new AbortController,XR(),ee.authenticated=!1,ee.ready=!1,ee.authInitInFlight=!1,ee.pluginLoadError=null,ee.loginError=null,ee.loginUsername="",ee.pluginLoadFailureSeq=0,ee.hostInfo=null,ee.deviceInfo=null}Ec(t=>{ee.theme=t});eR(t=>{ee.locale=t});tR(t=>{ee.localeSwitchPending=t});function b(t,e){return sn(t,e,ee.locale)}var tA=I('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),nA=I('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">×</button>'),rA=I('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),iA=I('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),sA=I('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function oA(t,e){Fe(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=V(()=>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=sA(),l=v(a);{var c=p=>{var g=rA(),m=v(g);{var _=M=>{var C=tA(),O=v(C);y(()=>{Oe(C,"id",r),S(O,e.layer.shell.title)}),R(M,C)};X(m,M=>{var C;(C=e.layer.shell)!=null&&C.title&&M(_)})}var w=x(m,2);{var E=M=>{var C=nA();y(O=>Oe(C,"aria-label",O),[()=>b("common.close")]),ge("click",C,()=>e.layer.close(void 0,"action")),R(M,C)};X(w,M=>{var C;(C=e.layer.shell)!=null&&C.showCloseButton&&M(E)})}R(p,g)};X(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 f=p=>{var g=iA(),m=v(g);y(()=>{Oe(g,"id",i),S(m,e.layer.shell.description)}),R(p,g)};X(u,p=>{var g;(g=e.layer.shell)!=null&&g.description&&p(f)})}var h=x(u,2);Ws(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"),Oe(a,"data-locale",ee.locale),Oe(a,"aria-modal",e.layer.kind==="modal"||e.layer.kind==="drawer"?"true":void 0),Oe(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Oe(a,"aria-describedby",(g=e.layer.shell)!=null&&g.description?i:void 0),Uo(a,d(o))}),R(t,a),Ge()}ht(["click"]);const aA=1e4;function lA(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 ia,sa,oa,aa,la,ca;class Dp{constructor(e,n,r,i,s){W(this,"id");W(this,"pluginName");W(this,"instanceId");W(this,"kind");W(this,"hostElement");W(this,"contentElement");Se(this,ia,se("opening"));Se(this,sa,se(null));Se(this,oa,se("center"));W(this,"mobileSheet");Se(this,aa,se(void 0));Se(this,la,se(lt({})));Se(this,ca,se(null));W(this,"behavior");W(this,"closeOnEscape");W(this,"closeOnOutsideClick");W(this,"trapFocus");W(this,"restoreFocus");W(this,"lockScroll");W(this,"backdrop");W(this,"closed");W(this,"abortController",new AbortController);W(this,"anchorElement");W(this,"cleanup",null);W(this,"onCloseListeners",new Set);W(this,"previousFocus");W(this,"closedResolve");W(this,"openTimeout");W(this,"focusTrap",null);W(this,"repositionHandler",null);W(this,"anchorObserver",null);W(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=lA(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=Xf(i.kind,i.placement),this.mobileSheet=z_(i.kind),this.className=i.className,this.sizing=Jf(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")},aA),this.attachAnchorObservers()}get state(){return d(T(this,ia))}set state(e){k(T(this,ia),e,!0)}get shell(){return d(T(this,sa))}set shell(e){k(T(this,sa),e,!0)}get placement(){return d(T(this,oa))}set placement(e){k(T(this,oa),e,!0)}get className(){return d(T(this,aa))}set className(e){k(T(this,aa),e,!0)}get sizing(){return d(T(this,la))}set sizing(e){k(T(this,la),e,!0)}get position(){return d(T(this,ca))}set position(e){k(T(this,ca),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=Xf(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=Jf(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=D_({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=Ou(this.hostElement,{initialFocus:()=>B_(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&H_(n.hostElement,e))}))}}ia=new WeakMap,sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,la=new WeakMap,ca=new WeakMap;var ua;class cA{constructor(){Se(this,ua,se(lt([])))}get layers(){return d(T(this,ua))}set layers(e){k(T(this,ua),e,!0)}}ua=new WeakMap;function uA(){const t=new cA;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 $b=uA(),dA=$b;function Af(t,e,n=$b){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 Dp(n,t,e,l,null);return n.addLayer(c),c},open(l){i();const{title:c,description:u,showCloseButton:f,mount:h,kind:p,...g}=l,m=new Dp(n,t,e,{kind:p,...g},{title:c,description:u,showCloseButton:f??!0});n.addLayer(m);try{const _=h(m.contentElement,m,m.signal);_ instanceof Promise?_.then(()=>m.markReady()).catch(w=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,w),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 fA=I('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),hA=I("<div><!> <div></div></div>");function pA(t,e){Fe(e,!0);let n=Xt(e,"runtime",3,dA);const r=1e3,i=V(()=>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;opacity:0;pointer-events:none":""}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=rc(oA,{target:g.hostElement,props:{layer:g}})),requestAnimationFrame(()=>{g.state!=="closed"&&g.reposition()}),{destroy(){m&&Kd(m),g.hostElement.remove()}}}function c(p){if(p.key==="Escape"){for(let g=d(i).length-1;g>=0;g--)if(d(i)[g].closeOnEscape){d(i)[g].closeWithReason("escape"),p.stopPropagation();return}}}function u(p){const g=p.composedPath();for(let m=d(i).length-1;m>=0;m--){const _=d(i)[m];if(g.includes(_.hostElement)||_.anchorElement&&g.includes(_.anchorElement))return;if(_.closeOnOutsideClick){_.closeWithReason("outside-click");return}if(o(_))return}}Kn(()=>{const p=d(i).some(m=>m.lockScroll),g=document.body.style.overflow;return p&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=g}});var f=Bn();kt("keydown",Ho,c),kt("pointerdown",Ho,u);var h=tt(f);xt(h,19,()=>d(i),p=>p.id,(p,g,m)=>{var _=hA();let w;var E=v(_);{var M=A=>{var N=fA();R(A,N)},C=V(()=>o(d(g))&&d(g).backdrop);X(E,A=>{d(C)&&A(M)})}var O=x(E,2);Ws(O,(A,N)=>l==null?void 0:l(A,N),()=>d(g)),y((A,N)=>{Ne(_,1,`mndw-overlay-layer mndw-overlay-layer--${d(g).kind??""}`,"svelte-11o3k6p"),w=Uo(_,"",w,A),Ne(O,1,`mndw-overlay-positioner mndw-overlay-positioner--${d(g).kind??""} mndw-overlay-positioner--${d(g).placement??""} ${d(g).mobileSheet?"mndw-overlay-positioner--sheet":""} ${d(g).kind==="popover"&&!d(g).position?"mndw-overlay-positioner--unpositioned":""}`,"svelte-11o3k6p"),Uo(O,N)},[()=>({"z-index":s(d(m))}),()=>a(d(g))]),R(p,_)}),R(t,f),Ge()}const gA={success:4e3,info:4e3,error:0},mA=4,vA=.35,bA=.5;function _A(t,e,n){return e<=0?!1:Math.abs(t)>=e*vA||Math.abs(n)>=bA}var da;class wA{constructor(){Se(this,da,se(lt([])));W(this,"nextId",1);W(this,"maxToasts",mA);W(this,"timers",new Zi)}get toasts(){return d(T(this,da))}set toasts(e){k(T(this,da),e,!0)}show(e){const n=e.variant??"info",r=e.duration??gA[n],i=e.key===void 0?-1:this.toasts.findIndex(s=>s.key===e.key);if(i!==-1){const s=this.toasts[i];return s===void 0?this.add(e,n,r):(this.clearTimer(s.id),this.toasts[i]={id:s.id,message:e.message,variant:n,duration:r,...e.key===void 0?{}:{key:e.key},...e.action===void 0?{}:{action:e.action}},this.startTimer(s.id,r),s.id)}return this.add(e,n,r)}add(e,n,r){const i=this.nextId++;return this.toasts.push({id:i,message:e.message,variant:n,duration:r,...e.key===void 0?{}:{key:e.key},...e.action===void 0?{}:{action:e.action}}),this.enforceCap(),this.startTimer(i,r),i}startTimer(e,n){n>0&&this.timers.set(e,setTimeout(()=>this.dismiss(e),n))}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)}dismissKey(e){const n=this.toasts.find(r=>r.key===e);n!==void 0&&this.dismiss(n.id)}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))}}da=new WeakMap;const Ve=new wA;var yA=I('<button type="button" class="mndw-toast__action svelte-1g105wt"> </button>'),kA=I('<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),EA=I('<div role="region"></div>');function SA(t,e){Fe(e,!0);let n=Xt(e,"store",3,Ve);const r=va();let i=se(lt(r.matches));const s=h=>{k(i,h.matches,!0),n().setMaxToasts(h.matches?3:4)};function o(h){return h==="error"?"danger":h}function a(h){try{const p=h.onAction();p!==void 0&&p.catch(g=>{console.error("[mndw] Toast action failed:",g)})}catch(p){console.error("[mndw] Toast action failed:",p)}}function l(h,p){let g=p,m=null,_=0,w=0,E=!1;const M=N=>{h.style.transition="transform 0.15s ease, opacity 0.15s ease",h.style.transform="",h.style.opacity=""},C=N=>{!g.enabled||N.pointerType==="mouse"||m!==null||(m=N.pointerId,_=N.clientX,w=N.timeStamp,E=!0,h.style.transition="",h.setPointerCapture(N.pointerId))},O=N=>{if(!E||N.pointerId!==m)return;const z=N.clientX-_;h.style.transform=`translateX(${z}px)`,h.style.opacity=String(Math.max(.3,1-Math.abs(z)/h.offsetWidth))},A=N=>{if(!E||N.pointerId!==m)return;const z=N.clientX-_,D=Math.max(1,N.timeStamp-w),G=z/D;E=!1,m=null,_A(z,h.offsetWidth,G)?g.onDismiss():M()};return h.style.touchAction="pan-y",h.addEventListener("pointerdown",C),h.addEventListener("pointermove",O),h.addEventListener("pointerup",A),h.addEventListener("pointercancel",A),{update(N){g=N},destroy(){h.removeEventListener("pointerdown",C),h.removeEventListener("pointermove",O),h.removeEventListener("pointerup",A),h.removeEventListener("pointercancel",A)}}}Un(()=>(n().setMaxToasts(d(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var c=Bn(),u=tt(c);{var f=h=>{var p=EA();let g;xt(p,21,()=>n().toasts,m=>m.id,(m,_)=>{var w=kA(),E=v(w),M=v(E),C=x(E,2);{var O=z=>{var D=yA(),G=v(D);y(()=>{D.disabled=d(_).action.busy===!0,Oe(D,"aria-busy",d(_).action.busy===!0?"true":void 0),S(G,d(_).action.label)}),ge("click",D,()=>{d(_).action!==void 0&&a(d(_).action)}),R(z,D)};X(C,z=>{d(_).action!==void 0&&z(O)})}var A=x(C,2),N=v(A);P(N,"name","x"),Ws(w,(z,D)=>l==null?void 0:l(z,D),()=>({enabled:d(i),onDismiss:()=>n().dismiss(d(_).id)})),y((z,D)=>{Ne(w,1,`mndw-toast mndw-alert mndw-alert--${z??""}`,"svelte-1g105wt"),Oe(w,"role",d(_).variant==="error"?"alert":"status"),Oe(w,"aria-live",d(_).variant==="error"?"assertive":"polite"),S(M,d(_).message),Oe(A,"aria-label",D)},[()=>o(d(_).variant),()=>b("toast.dismiss")]),ge("click",A,()=>n().dismiss(d(_).id)),R(m,w)}),y(m=>{g=Ne(p,1,"mndw-toast-host svelte-1g105wt",null,g,{"mndw-toast-host--mobile":d(i)}),Oe(p,"aria-label",m)},[()=>b("toast.region")]),R(h,p)};X(u,h=>{n().toasts.length>0&&h(f)})}R(t,c),Ge()}ht(["click"]);const jb=globalThis.fetch.bind(globalThis);async function yo(t,e={},n=2e4){const r=new AbortController,i=e.signal,s=()=>r.abort(i==null?void 0:i.reason);i!=null&&(i.aborted?s():i.addEventListener("abort",s,{once:!0}));const o=globalThis.setTimeout(()=>r.abort(),n);try{return await jb(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(o),i==null||i.removeEventListener("abort",s)}}class _d extends Error{constructor(n,r,i){super(r,i);W(this,"code");this.name="PageRouteError",this.code=n}}const TA=["execute","queue","initBackgroundProcess","queueBackgroundProcess"],xA={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",controlHover:"#c6cbcc",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",controlHover:"#292b2c",shadowColor:"#0102038c"}},Of="0.2.0",PA=1;function CA(t){return typeof t!="object"||t===null||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string")}async function RA(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!==PA)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!CA(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function ko(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 ui(t){const e=ko(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function Fb(t,e=Rf(),n=Of){const r=[],i=ko(t.sdkVersion),s=ko(n),o=ui(t.sdkVersion),a=ui(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 f=ko(c),h=ko(u),p=ui(c),g=ui(u);f!==null&&h!==null&&p!==null&&g!==null&&p!==g&&r.push({kind:"shared-major",name:l,pluginVersion:c,hostVersion:u})}return r}function AA(t,e=Rf(),n=Of){const r=[];for(const[o,a]of Object.entries(t.sharedDependencies)){const l=e[o];if(l===void 0)continue;const c=ui(a),u=ui(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=ui(t.sdkVersion),s=ui(n);return i!==null&&s!==null&&i!==s&&r.push(`@mndw/sdk @${i} (host provides @${s})`),r}function OA(t,e,n=Rf(),r=Of){const i=AA(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 MA{constructor(e={catalog:kc}){W(this,"plugins",new Zi);W(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)}remove(e){const n=this.plugins.get(e);if(n!==void 0)return this.plugins.delete(e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),n}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 Yi=new MA,Wo=lt({});function NA(){for(const t of Object.keys(Wo))delete Wo[t]}function Gb(t,e){if(e.length===0){delete Wo[t];return}Wo[t]=[...e]}function IA(t){return Wo[t]??[]}const ji=lt({});let Vb=se("pending"),wd=se(0);function Hp(){return d(wd)}function Yn(){return d(Vb)}function gi(t){k(Vb,t,!0)}function Mf(t){for(const e of Object.keys(ji))delete ji[e];for(const e of t){const n=e.enabled&&e.approval==="approved";ji[e.name]={runnable:n,status:n?"loading":"not-runnable",type:e.type,label:e.label,...e.type==="widget"?{size:e.size}:{},...e.type==="page"?{route:e.route}:{}}}}function xc(t){Mf(t),k(wd,d(wd)+1)}function Dn(t,e,n){const r=ji[t];if(r!==void 0){const{failureKind:i,...s}=r;ji[t]={...s,...e==="not-runnable"?{runnable:!1}:{},status:e,...e==="failed"&&n!==void 0?{failureKind:n}:{}}}}function yn(t){return ji[t]}function Pc(){return ji}const ps="plugin-load";let yd=0,Ds=0,gs=!1,Hs=!1;function Zb(){return gs||Ds>0}function Wb(){return Object.entries(Pc()).filter(([,t])=>t.runnable&&t.status==="failed").map(([t,e])=>({name:t,label:e.label})).sort((t,e)=>t.label.localeCompare(e.label)||t.name.localeCompare(e.name))}function Bp(t,e,n){Ve.error(t,{key:ps,action:{label:b("common.retry"),busy:Zb(),onAction:()=>LA(e,n)}})}async function LA(t,e){if(!e()||gs)return;gs=!0,Hs=!0,Bs(t,e);const n=Wb().map(({name:r})=>r);await Promise.all(n.map(async r=>{try{await t(r)}catch(i){console.error(`[mndw] Plugin retry failed for "${r}":`,i)}})),e()&&(gs=!1,Bs(t,e))}function Bs(t,e){if(!e())return;const n=Wb();if(n.length>0){const r=n.map(({label:i})=>i).join(", ");Bp(b("plugin-load.failed",{names:r}),t,e);return}if(Zb()){const r=Ve.toasts.find(({key:i})=>i===ps);r!==void 0&&Bp(r.message,t,e);return}if(Hs){Ve.success(b("plugin-load.loaded"),{key:ps,duration:4e3}),Hs=!1;return}Ve.dismissKey(ps)}function zA(t,e){Ds+=1,Hs=!0,Bs(t,e)}function DA(t,e){Ds=Math.max(0,Ds-1),Bs(t,e)}function HA(){return yd+=1,Ds=0,gs=!1,Hs=!1,Ve.dismissKey(ps),yd}function BA(t){t===yd&&(Ds=0,gs=!1,Hs=!1,Ve.dismissKey(ps))}let kd=0,ts,Dr;const qb=15e3,Tu=new Set;function UA(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}async function $A(t,e){Tu.has(t)||await new Promise(n=>{if(document.querySelector(`link[data-plugin-style="${e}"][href="${t}"]`)){Tu.add(t),n();return}const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.dataset.pluginStyle=e,i.onload=()=>{Tu.add(t),n()},i.onerror=()=>{console.warn(`[mndw] No stylesheet for plugin "${e}" at ${t}`),n()},document.head.appendChild(i)})}function jA(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function FA(t){const e=await jb(gb,{signal:t});if(!e.ok)throw new Error(`HTTP ${e.status}`);return Ub(await e.json())}async function GA(t,e){const n=await RA(e);return n?OA(t.name,n):[]}function Kb(t){const e=new Set,n=new Set,r=new Set,i=new Set,s=t.filter(o=>{if(e.has(o.name))return console.error(`[mndw] Skipping duplicate plugin "${o.name}"`),i.add(o.name),!1;if(e.add(o.name),o.type==="page"){if(n.has(o.route))return console.error(`[mndw] Skipping duplicate page route "${o.route}"`),i.add(o.name),!1;n.add(o.route)}return r.add(o.name),!0});for(const o of i)r.has(o)||Dn(o,"not-runnable");return s}let zo;const Eo=new Map;async function VA(t,e,n,r){const s=`${t.source==="builtin"?Rp.builtin:Rp.user}${t.name}`,o=a=>UA(s,a,t.version);try{if(await e.loadStylesheet(o("index.css"),t.name),!r()||n.aborted)return{loaded:!1};const a=await e.importModule(o(t.entry)),l=jA(a,t.name),c=yb(t.name,t.version,t.catalogBaseUrl??s,t.i18n),u=c===void 0?void 0:e.catalogService.createPluginCatalogCell(c,e.getLocale());return u!==void 0&&await e.catalogService.loadInitialPluginCatalog(u,e.getLocale()),n.aborted||!r()?{loaded:!1}:(e.registry.register({entry:t,module:l,...u===void 0?{}:{catalog:u}}),console.log(`[mndw] Loaded plugin: ${t.name} (${t.source})`),Promise.resolve().then(()=>e.checkVersions(t,s)).then(f=>{r()&&Gb(t.name,f)}).catch(f=>{console.error(`[mndw] Version check failed for "${t.name}":`,f)}),{loaded:!0})}catch(a){return console.error(`[mndw] Failed to load plugin "${t.name}":`,a),{loaded:!1,failureKind:"error"}}}async function ZA(t,e,n){const r=new AbortController,i=new Promise(o=>{r.signal.addEventListener("abort",()=>{console.error(`[mndw] Plugin "${t.name}" did not load within ${e.loadTimeoutMs} ms; skipping it`),o({loaded:!1,failureKind:"timeout"})},{once:!0})}),s=setTimeout(()=>r.abort(),e.loadTimeoutMs);try{return await Promise.race([VA(t,e,r.signal,n),i])}finally{clearTimeout(s)}}function ms(t){return t.generation===kd&&t.authGeneration===Nr()&&!t.authSignal.aborted}async function Nf(t,e,n=e.pluginTokens.get(t.name)??0){Dn(t.name,"loading");const r=()=>ms(e)&&e.pluginTokens.get(t.name)===n,i=await ZA(t,e.deps,r);return r()&&Dn(t.name,i.loaded?"loaded":"failed",i.failureKind),i.loaded}async function Us(t){const e=zo,n=e==null?void 0:e.entries.get(t),r=yn(t);if(e===void 0||n===void 0||(r==null?void 0:r.runnable)!==!0||!ms(e))return!1;const i=Eo.get(t);if(i!==void 0)return i;const s=()=>ms(e);zA(Us,s);const o=Nf(n,e).finally(()=>{Eo.get(t)===o&&Eo.delete(t),s()&&DA(Us,s)});return Eo.set(t,o),o}async function WA(t){const e=zo;if(e===void 0||!ms(e))return!1;const n={...Pc()},r=Kb(t.filter(a=>a.enabled&&a.approval==="approved")),i=new Map(r.map(a=>[a.name,a]));let s=!1;zs(t),xc(t),gi("ok");for(const a of e.entries.keys())i.has(a)||(e.pluginTokens.set(a,(e.pluginTokens.get(a)??0)+1),e.entries.delete(a),e.deps.registry.remove(a),Gb(a,[]));const o=[];for(const a of r){const l=a.name,c=e.entries.get(l),u=n[l],f=e.deps.registry.get(l),h=c!==void 0&&c.version!==a.version;if(e.entries.set(l,a),f!==void 0){f.entry.version!==a.version&&(s=!0),Dn(l,"loaded");continue}if(c===void 0||h){const p=(e.pluginTokens.get(l)??0)+1;e.pluginTokens.set(l,p),o.push(Nf(a,e,p));continue}(u==null?void 0:u.status)==="failed"?Dn(l,"failed",u.failureKind):(u==null?void 0:u.status)==="loading"?Dn(l,"loading"):Dn(l,"failed","error")}return await Promise.all(o),ms(e)&&(ee.pluginLoadError=null,Bs(Us,()=>ms(e))),s}async function qA(t={}){ts==null||ts.abort();const e=++kd,n=Nr(),r=QR(),i=new AbortController;ts=i;const s=()=>i.abort(r.reason);r.aborted?s():r.addEventListener("abort",s,{once:!0});const o=()=>e===kd&&n===Nr(),a=t.fetchList??FA,l={importModule:t.importModule??(g=>import(g)),loadStylesheet:t.loadStylesheet??$A,checkVersions:t.checkVersions??GA,catalogService:t.catalogService??kc,registry:t.registry??Yi,getLocale:t.getLocale??Pf,loadTimeoutMs:t.loadTimeoutMs??qb};zo=void 0,Eo.clear(),Dr!==void 0&&(Dr.signal.removeEventListener("abort",Dr.handler),Dr=void 0);const c=HA(),u=()=>{(Dr==null?void 0:Dr.handler)===u&&(Dr=void 0),BA(c)};r.aborted?u():(Dr={signal:r,handler:u},r.addEventListener("abort",u,{once:!0})),gi("pending"),Mf([]),l.registry.clear(),zs([]),NA();let f;try{let g,m=()=>{};const _=new Promise((M,C)=>{m=C}),w=()=>{m(i.signal.reason??new DOMException("Plugin list request aborted","AbortError"))};i.signal.addEventListener("abort",w,{once:!0}),i.signal.aborted&&w();const E=new Promise((M,C)=>{g=setTimeout(()=>{C(new Error(`Plugin list fetch timed out after ${xp} ms`)),i.abort()},xp)});try{f=await Promise.race([a(i.signal),E,_])}finally{clearTimeout(g),i.signal.removeEventListener("abort",w),r.removeEventListener("abort",s),ts===i&&(ts=void 0)}}catch(g){o()&&(r.aborted||(zo={generation:e,authGeneration:n,authSignal:r,deps:l,entries:new Map,pluginTokens:new Map}),console.error("[mndw] Failed to load plugin list:",g),ee.pluginLoadError="list",gi("failed"));return}if(!o())return;zs(f),xc(f),gi("ok");const h=Kb(f.filter(g=>g.enabled&&g.approval==="approved")),p={generation:e,authGeneration:n,authSignal:r,deps:l,entries:new Map(h.map(g=>[g.name,g])),pluginTokens:new Map(h.map(g=>[g.name,0]))};zo=p,await Promise.all(h.map(g=>Nf(g,p,0))),o()&&(ee.pluginLoadError=null,Bs(Us,o))}const Ed="mndw:sandbox-reloaded";function KA(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function YA(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 Yb(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:YA(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 If(t,e){let n=e;if(n===void 0){const l=await t.importManifestModule();if(l.default===void 0||l.default===null)throw new Error("Sandbox manifest module has no default export");const c=Db(l.default),u=t.catalogBaseUrl??l.__catalogBaseUrl;n=Yb(c,u)}const r=KA(await t.importPluginModule()),i=t.catalogService,s=t.getLocale,o=yb(n.name,n.version,n.catalogBaseUrl??`/plugins/${n.name}`,n.i18n),a=o===void 0?void 0:i.createPluginCatalogCell(o,s());return a!==void 0&&await i.loadInitialPluginCatalog(a,s()),{entry:n,module:r,...a===void 0?{}:{catalog:a}}}let fr,Sd=0;const So=new Map;function Nl(){return Sd+=1,Sd}function Il(t,e){return t===Sd&&e()}async function XA(t){const e=t.registry,n=()=>t.isCurrent===void 0||t.isCurrent();if(!n())return;const r=Nl(),i=()=>Il(r,n);if(!i())return;fr=void 0,So.clear(),gi("pending"),Mf([]),zs([]),e.clear();let s;try{const o=await t.importManifestModule();if(o.default===void 0||o.default===null)throw new Error("Sandbox manifest module has no default export");const a=Db(o.default);if(s=Yb(a,t.catalogBaseUrl??o.__catalogBaseUrl),!i())return;zs([s]),xc([s]),gi("ok"),ee.pluginLoadError=null,fr={deps:{...t,isCurrent:n},entry:s,isCurrent:n};const c=await If(t,s);if(!i())return;e.register(c),Dn(s.name,"loaded"),console.log(`[mndw] Sandbox plugin loaded: ${c.entry.name}`)}catch(o){if(!i())return;s===void 0?(ee.pluginLoadError="list",gi("failed")):Dn(s.name,"failed","error"),console.error("[mndw] Failed to load sandbox plugin:",o)}}async function JA(t){const e=fr,n=yn(t);if((e==null?void 0:e.entry.name)!==t||(n==null?void 0:n.runnable)!==!0||n.status!=="failed"||!e.isCurrent())return!1;const r=So.get(t);if(r!==void 0)return r;const i=Nl(),s=()=>fr===e&&Il(i,e.isCurrent);if(!s())return!1;Dn(t,"loading");const o=(async()=>{try{const a=await If(e.deps,e.entry);return s()?(e.deps.registry.get(t)===void 0&&e.deps.registry.register(a),Dn(t,"loaded"),!0):!1}catch(a){return s()&&(Dn(t,"failed","error"),console.error("[mndw] Failed to retry sandbox plugin:",a)),!1}})().finally(()=>{So.get(t)===o&&So.delete(t)});return So.set(t,o),o}async function QA(t){const e=t.registry,n=t.remountWidgets??eO,r=t.reloadPage??tO,i=t.pluginContextServices,s=t.isCurrent??(fr==null?void 0:fr.isCurrent)??(()=>!0),o=t.isCurrent===void 0?{...t,isCurrent:s}:t;if(!s())return"failed";let a;try{a=await If(o)}catch(g){return s()&&console.error("[mndw] Sandbox reload rejected (invalid update kept previous plugin):",g),"failed"}if(!s())return"failed";const l=a.entry.name,c=e.get(l);if(c===void 0){const g=Nl();return Il(g,s)?(e.register(a),zs([a.entry]),xc([a.entry]),gi("ok"),Dn(l,"loaded"),ee.pluginLoadError=null,fr={deps:o,entry:a.entry,isCurrent:s},"reloaded"):"failed"}const u=Nl(),f=()=>Il(u,s);if(!f())return"failed";const h=fr;let p;try{p=e.replace(a)}catch(g){return console.error(`[mndw] Sandbox reload needs a restart of \`mndw dev\`: ${g.message}`),"restart-required"}fr={deps:o,entry:a.entry,isCurrent:s};try{const g=await n(l,a,c,e,i);if(!f())return"failed";const m=await r(l,a,c);if(!f())return"failed";if(!g||!m)throw new Error("a widget or page remount reported failure");return Dn(l,"loaded"),console.log(`[mndw] Sandbox plugin reloaded: ${l}`),"reloaded"}catch(g){return f()&&(e.replace(p),fr=h,console.error(`[mndw] Sandbox reload failed, kept previous plugin "${l}":`,g)),"failed"}}async function eO(t,e,n,r,i){const{remountWidgetTiles:s}=await vl(async()=>{const{remountWidgetTiles:o}=await Promise.resolve().then(()=>JO);return{remountWidgetTiles:o}},[]);return s(i,r,t,e,n)}async function tO(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(Ed,{detail:i})),(await Promise.all(r)).every(Boolean)}var nO=I('<a class="mndw-empty-state__link"> </a>'),rO=I("<mndw-button> </mndw-button>",2),iO=I('<section><h2 class="mndw-empty-state__title"> </h2> <p class="mndw-empty-state__text"> </p> <!></section>');function Fi(t,e){Fe(e,!0);let n=Xt(e,"mode",3,"dashboard");var r=iO();let i;var s=v(r),o=v(s),a=x(s,2),l=v(a),c=x(a,2);{var u=h=>{var p=nO(),g=v(p);y(()=>{Oe(p,"href",e.action.href),S(g,e.action.label)}),R(h,p)},f=h=>{var p=rO();y(()=>P(p,"variant",e.action.variant??"primary"));var g=v(p);y(()=>S(g,e.action.label)),ge("click",p,function(...m){var _;(_=e.action.onActivate)==null||_.apply(this,m)}),R(h,p)};X(c,h=>{var p,g;((p=e.action)==null?void 0:p.href)!==void 0?h(u):((g=e.action)==null?void 0:g.onActivate)!==void 0&&h(f,1)})}y(()=>{i=Ne(r,1,"mndw-empty-state",null,i,{"mndw-empty-state--compact":n()==="compact"}),S(o,e.title),S(l,e.text)}),R(t,r),Ge()}ht(["click"]);class H{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 H.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"&&H.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&&(H.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:H.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=H.getScrollElement(n),s=i.clientHeight,o=i===H.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=H.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]=H.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=H.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");H.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 Gr{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&&H.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?H.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,H.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&&H.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&&H.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,f=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?f=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(f=(c.x+c.w-s.x)/c.w);const h=Math.min(f,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=H.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=H.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=H.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=H.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??Gr._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 H.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,H.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||H.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),H.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!H.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=H.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||H.samePos(e,e._orig)||(H.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(f=>H.isIntercepted(u,f))||((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 Gr({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&&(H.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new Gr({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=H.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=H.copyPos({},e,!0);if(H.copyPos(s,n),this.nodeBoundFix(s,i),H.copyPos(n,s),!n.forceCollide&&H.samePos(e,n))return!1;const o=H.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const f=e._moving&&!n.nested;let h=f?this.directionCollideCoverage(e,n,a):a[0];if(f&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=H.areaIntercept(n.rect,h._rect),g=H.area(n.rect),m=H.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&&!H.samePos(e,s)&&(e._dirty=!0,H.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!H.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(f=>f._id===l._id),u={...l,...c||{}};H.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:H.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 f=o.find(h=>h._id===u._id);f&&(!i&&!u.autoPosition&&(f.x=u.x??f.x,f.y=u.y??f.y),f.w=u.w??f.w,(u.x==null||u.y===void 0)&&(f.autoPosition=!0))})),l.forEach(u=>{const f=o.findIndex(h=>h._id===u._id);if(f!==-1){const h=o[f];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(f,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(f=>{f.x=n===1?0:c?Math.round(f.x*l):Math.min(f.x,n-1),f.w=n===1||e===1?1:u?Math.round(f.w*l)||1:Math.min(f.w,n),s.push(f)}),o=[]}s=H.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)??Gr._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??Gr._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}}Gr._idSeq=0;const Gn={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 Le{}const mr=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 qn{}function Ll(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),H.simulateMouseEvent(t.changedTouches[0],e))}function Xb(t,e){t.cancelable&&t.preventDefault(),H.simulateMouseEvent(t,e)}function zl(t){qn.touchHandled||(qn.touchHandled=!0,Ll(t,"mousedown"))}function Dl(t){qn.touchHandled&&Ll(t,"mousemove")}function Hl(t){if(!qn.touchHandled)return;qn.pointerLeaveTimeout&&(window.clearTimeout(qn.pointerLeaveTimeout),delete qn.pointerLeaveTimeout);const e=!!Le.dragElement;Ll(t,"mouseup"),e||Ll(t,"click"),qn.touchHandled=!1}function Bl(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function Up(t){Le.dragElement&&t.pointerType!=="mouse"&&Xb(t,"mouseenter")}function $p(t){Le.dragElement&&t.pointerType!=="mouse"&&(qn.pointerLeaveTimeout=window.setTimeout(()=>{delete qn.pointerLeaveTimeout,Xb(t,"mouseleave")},10))}class Cc{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(`${Cc.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),mr&&(this.el.addEventListener("touchstart",zl),this.el.addEventListener("pointerdown",Bl)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),mr&&(this.el.removeEventListener("touchstart",zl),this.el.removeEventListener("pointerdown",Bl)),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),mr&&(this.el.addEventListener("touchmove",Dl),this.el.addEventListener("touchend",Hl)),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),mr&&(this.el.removeEventListener("touchmove",Dl),this.el.removeEventListener("touchend",Hl)),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}}Cc.prefix="ui-resizable-";class Lf{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 qo extends Lf{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),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(e){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Cc(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=H.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=H.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=H.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=H.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=H.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=qo._originStyleProp.map(r=>this.el.style[r]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=H.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 qo._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)),f=Math.min(l,Math.max(c,n));return{width:u,height:f}}_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}}qo._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const sO='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Ko extends Lf{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),f=l>0?u:-u,h=a.scrollTop;if(a.scrollTop+=f,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),mr&&(e.addEventListener("touchstart",zl),e.addEventListener("pointerdown",Bl))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),mr&&(n.removeEventListener("touchstart",zl),n.removeEventListener("pointerdown",Bl))}),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(qn.touchHandled&&e.isTrusted&&(qn.touchHandled=!1),!Le.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(sO)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete Le.dragElement,delete Le.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),mr&&(e.currentTarget.addEventListener("touchmove",Dl),e.currentTarget.addEventListener("touchend",Hl)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=H.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),Le.pauseDrag){const i=Number.isInteger(Le.pauseDrag)?Le.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,Le.dragElement=this;const i=(r=this.el.gridstackNode)==null?void 0:r.grid;i?Le.dropElement=i.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=H.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=H.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),mr&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Dl,!0),e.currentTarget.removeEventListener("touchend",Hl,!0)),this.dragging){delete this.dragging,(n=this.el.gridstackNode)==null||delete n._origRotate,document.removeEventListener("keydown",this._keyEvent),((r=Le.dropElement)==null?void 0:r.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const i=H.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),Le.dropElement&&Le.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,e.preventDefault()}_keyEvent(e){var i,s;const n=this.el.gridstackNode,r=(n==null?void 0:n.grid)||((s=(i=Le.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(!H.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",H.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=H.cloneNode(this.el)),e.parentElement||H.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Ko.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",Ko.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=H.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}}}}Ko.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class oO extends Lf{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),mr&&(this.el.addEventListener("pointerenter",Up),this.el.addEventListener("pointerleave",$p)))}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),mr&&(this.el.removeEventListener("pointerenter",Up),this.el.removeEventListener("pointerleave",$p)))}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(!Le.dragElement||qn.touchHandled&&e.isTrusted||!this._canDrop(Le.dragElement.el))return;e.preventDefault(),e.stopPropagation(),Le.dragElement._stopScrolling(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(e,!0),Le.dropElement=this;const n=H.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(Le.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){var i;if(!Le.dragElement||Le.dropElement!==this)return;e.preventDefault(),e.stopPropagation(),n&&Le.dragElement._stopScrolling();const r=H.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(r,this._ui(Le.dragElement)),this.triggerEvent("dropout",r),Le.dropElement===this&&(delete Le.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=H.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(Le.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 zf{static init(e){return e.ddElement||(e.ddElement=new zf(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 Ko(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 qo(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 oO(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class aO{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,Le.dragElement?Le.dragElement.el:s.target,Le.dragElement?Le.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=H.getElements(e);return i.length?i.map(o=>o.ddElement||(r?zf.init(o):null)).filter(o=>o):[]}}/*!
|
|
81
|
-
* GridStack 12.6.0
|
|
82
|
-
* https://gridstackjs.com/
|
|
83
|
-
*
|
|
84
|
-
* Copyright (c) 2021-2025 Alain Dumesny
|
|
85
|
-
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
86
|
-
*/const Sn=new aO;class Ae{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const r=Ae.getGridElement(n);return r?(r.gridstack||(r.gridstack=new Ae(r,H.cloneDeep(e))),r.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
|
|
87
|
-
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},n=".grid-stack"){const r=[];return typeof document>"u"||(Ae.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new Ae(i,H.cloneDeep(e))),r.push(i.gridstack)}),r.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
|
|
88
|
-
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),r}static addGrid(e,n={}){if(!e)return null;let r=e;if(r.gridstack){const o=r.gridstack;return n&&(o.opts={...o.opts,...n}),n.children!==void 0&&o.load(n.children),o}return(!e.classList.contains("grid-stack")||Ae.addRemoveCB)&&(Ae.addRemoveCB?r=Ae.addRemoveCB(e,n,!0,!0):r=H.createDiv(["grid-stack",n.class],e)),Ae.init(n,r)}static registerEngine(e){Ae.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=H.createDiv([this.opts.placeholderClass,Gn.itemClass,this.opts.itemClass]);const e=H.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){var c;this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const r=H.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const u=i.breakpoints;!i.columnWidth&&!(u!=null&&u.length)?delete n.columnOpts:(i.columnMax=i.columnMax||12,(u==null?void 0:u.length)>1&&u.sort((f,h)=>(h.w||0)-(f.w||0)))}const s={...H.cloneDeep(Gn),column:H.toNumber(e.getAttribute("gs-column"))||Gn.column,minRow:r||H.toNumber(e.getAttribute("gs-min-row"))||Gn.minRow,maxRow:r||H.toNumber(e.getAttribute("gs-max-row"))||Gn.maxRow,staticGrid:H.toBool(e.getAttribute("gs-static"))||Gn.staticGrid,sizeToContent:H.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Gn.draggable.handle},removableOptions:{accept:n.itemClass||Gn.removableOptions.accept,decline:Gn.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=H.toBool(e.getAttribute("gs-animate"))),n=H.defaults(n,s),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const o=this.el.closest("."+Gn.itemClass),a=o==null?void 0:o.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==Gn.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const u=n.cellHeight;delete n.cellHeight,this.cellHeight(u)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=mr),this._setStaticClass();const l=n.engineClass||Ae.engineClass||Gr;if(this.engine=new l({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:u=>{u.forEach(f=>{const h=f.el;h&&(f._removeDOM?(h&&h.remove(),delete f._removeDOM):this._writePosAttr(h,f))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(u=>this._prepareElement(u)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const u=n.children;delete n.children,u.length&&this.load(u)}this.setAnimation(),n.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((c=n.draggable)==null?void 0:c.pause)!==void 0&&(Le.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,r=e;if(r.grid=this,r.el?n=r.el:Ae.addRemoveCB?n=Ae.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(r),!n)return;if(r=n.gridstackNode,r&&n.parentElement===this.el&&this.engine.nodes.find(s=>s._id===r._id))return n;const i=this._readAttr(n);return H.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=H.createDiv(["grid-stack-item",this.opts.itemClass]),r=H.createDiv(["grid-stack-item-content"],n);return H.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{var s,o;i.isIntersecting&&((s=e.visibleObservable)==null||s.disconnect(),delete e.visibleObservable,Ae.renderCB(r,e),(o=e.grid)==null||o.prepareDragDrop(e.el))}),window.setTimeout(()=>{var i;return(i=e.visibleObservable)==null?void 0:i.observe(n)})):Ae.renderCB(r,e),n}makeSubGrid(e,n,r,i=!0){var p,g,m;let s=e.gridstackNode;if(s||(s=this.makeWidget(e).gridstackNode),(p=s.subGrid)!=null&&p.el)return s.subGrid;let o,a=this;for(;a&&!o;)o=(g=a.opts)==null?void 0:g.subGridOpts,a=(m=a.parentGridNode)==null?void 0:m.grid;n=H.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...o||{},...n||s.subGridOpts||{}}),s.subGridOpts=n;let l;n.column==="auto"&&(l=!0,n.column=Math.max(s.w||1,(r==null?void 0:r.w)||1),delete n.columnOpts);let c=s.el.querySelector(".grid-stack-item-content"),u,f;if(i&&(this._removeDD(s.el),f={...s,x:0,y:0},H.removeInternalForSave(f),delete f.subGridOpts,s.content&&(f.content=s.content,delete s.content),Ae.addRemoveCB?u=Ae.addRemoveCB(this.el,f,!0,!1):(u=H.createDiv(["grid-stack-item"]),u.appendChild(c),c=H.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),r){const _=l?n.column:s.w,w=s.h+r.h,E=s.el.style;E.transition="none",this.update(s.el,{w:_,h:w}),setTimeout(()=>E.transition=null)}const h=s.subGrid=Ae.addGrid(c,n);return r!=null&&r._moving&&(h._isTemp=!0),l&&(h._autoColumn=!0),i&&h.makeWidget(u,f),r&&(r._moving?window.setTimeout(()=>H.simulateMouseEvent(r._event,"mouseenter",h.el),0):h.makeWidget(s.el,s)),this.resizeToContentCheck(!1,s),h}removeAsSubGrid(e){var r;const n=(r=this.parentGridNode)==null?void 0:r.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,n.makeWidget(i.el,i)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>H.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,r=Ae.saveCB,i){const s=this.engine.save(e,r,i);if(s.forEach(o=>{var a;if(e&&o.el&&!o.subGrid&&!r){const l=o.el.querySelector(".grid-stack-item-content");o.content=l==null?void 0:l.innerHTML,o.content||delete o.content}else if(!e&&!r&&delete o.content,(a=o.subGrid)!=null&&a.el){const l=o.w||o.subGrid.getColumn(),c=o.subGrid.save(e,n,r,l);o.subGridOpts=n?c:{children:c},delete o.subGrid}delete o.el}),n){const o=H.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,H.removeInternalAndSame(o,Gn),o.children=s,o}return s}load(e,n=Ae.addRemoveCB||!0){e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=H.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(u=>{r=Math.max(r,(u.x||0)+u.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r);const i=this.getColumn();r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const s=Ae.addRemoveCB;typeof n=="function"&&(Ae.addRemoveCB=n);const o=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&n&&[...this.engine.nodes].forEach(f=>{if(!f.id)return;H.find(e,f.id)||(Ae.addRemoveCB&&Ae.addRemoveCB(this.el,f,!1,!1),o.push(f),this.removeWidget(f.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>H.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{var h;const f=H.find(c,u.id);if(f){if(H.shouldSizeToContent(f)&&(u.h=f.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||f.w,u.h=u.h||f.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(f),H.samePos(f,u)&&this.engine.nodes.length>1&&(this.moveNode(f,{...u,forceCollide:!0}),H.copyPos(u,f)),this.update(f.el,u),(h=u.subGridOpts)!=null&&h.children){const p=f.el.querySelector(".grid-stack");p&&p.gridstack&&p.gridstack.load(u.subGridOpts.children)}}else n&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=o,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,s?Ae.addRemoveCB=s:delete Ae.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=H.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const r=parseInt(this.el.getAttribute("gs-current-row"));return r?Math.round(this.el.getBoundingClientRect().height/r):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const r=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+r}const n=H.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var n;return e&&((n=this.opts.columnOpts)!=null&&n.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var s,o;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((s=e.breakpoints)!=null&&s.length))return!1;const n=this.getColumn();let r=n;const i=this._widthOrContainer(!0);if(e.columnWidth)r=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{r=e.columnMax;let a=0;for(;a<e.breakpoints.length&&i<=e.breakpoints[a].w;)r=e.breakpoints[a++].c||n}if(r!==n){const a=(o=e.breakpoints)==null?void 0:o.find(l=>l.c===r);return this.column(r,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const r=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+r),this._updateColumnVar(),this.engine.columnChanged(r,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var n;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(n=this._placeholder)==null||delete n.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const r=this.el.getBoundingClientRect();let i;n?i={top:r.top+document.documentElement.scrollTop,left:r.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const s=e.left-i.left,o=e.top-i.top,a=r.width/this.getColumn(),l=r.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/a),y:Math.floor(o/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,r,i){return this.engine.isAreaEmpty(e,n,r,i)}makeWidget(e,n){const r=Ae.getElement(e);if(!r||r.gridstackNode)return r;r.parentElement||this.el.appendChild(r),this._prepareElement(r,!0,n);const i=r.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(r,i.subGridOpts,void 0,!1);let s;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(s=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),s&&delete this._ignoreLayoutsNodeChange,r}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.on(i,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=i=>n(i):this._gsEventHandler[e]=i=>{i.detail&&n(i,i.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.off(r)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,r=!0){return e?(Ae.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let s=i.gridstackNode;s||(s=this.engine.nodes.find(o=>i===o.el)),s&&(n&&Ae.addRemoveCB&&Ae.addRemoveCB(this.el,s,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(s,n,r),n&&i.parentElement&&i.remove())}),r&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(r=>{e&&Ae.addRemoveCB&&Ae.addRemoveCB(this.el,r,!1,!1),delete r.el.gridstackNode,this.opts.staticGrid||this._removeDD(r.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,r=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.setStatic(e,n,r)}),n&&this._setStaticClass(),this)}updateOptions(e){var r;const n=this.opts;if(e===n)return this;if(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts){const i=!!this.opts.columnOpts;this.opts.columnOpts=e.columnOpts,i!==!!this.opts.columnOpts&&this._updateResizeEvent(),this.checkDynamicColumn()}else e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column);return e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=this.engine.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),(r=e.children)!=null&&r.length&&this.load(e.children),this}update(e,n){return Ae.getElements(e).forEach(r=>{var u;const i=r==null?void 0:r.gridstackNode;if(!i)return;const s={...H.copyPos({},i),...H.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const o=["x","y","w","h"];let a;if(o.some(f=>s[f]!==void 0&&s[f]!==i[f])&&(a={},o.forEach(f=>{a[f]=s[f]!==void 0?s[f]:i[f],delete s[f]})),!a&&(s.minW||s.minH||s.maxW||s.maxH)&&(a={}),s.content!==void 0){const f=r.querySelector(".grid-stack-item-content");f&&f.textContent!==s.content&&(i.content=s.content,Ae.renderCB(f,s),(u=i.subGrid)!=null&&u.el&&(f.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete s.content}let l=!1,c=!1;for(const f in s)f[0]!=="_"&&i[f]!==s[f]&&(i[f]=s[f],l=!0,c=c||!this.opts.staticGrid&&(f==="noResize"||f==="noMove"||f==="locked"));if(H.sanitizeMinMax(i),a){const f=a.w!==void 0&&a.w!==i.w;this.moveNode(i,a),f&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(f,i),delete i._orig}(a||l)&&this._writeAttr(r,i),c&&this.prepareDragDrop(i.el),Ae.updateCB&&Ae.updateCB(i)}),this}moveNode(e,n){const r=e._updating;r||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),r||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var h,p;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const r=n.grid;if(!r||e.parentElement!==r.el)return;const i=r.getCellHeight(!0);if(!i)return;let s=n.h?n.h*i:e.clientHeight,o;if(n.resizeToContentParent&&(o=e.querySelector(n.resizeToContentParent)),o||(o=e.querySelector(Ae.resizeToContentParent)),!o)return;const a=e.clientHeight-o.clientHeight,l=n.h?n.h*i-a:o.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const g=n.subGrid.el.getBoundingClientRect(),m=e.getBoundingClientRect();c+=g.top-m.top}else{if((p=(h=n.subGridOpts)==null?void 0:h.children)!=null&&p.length)return;{const g=o.firstElementChild;if(!g){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${Ae.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=g.getBoundingClientRect().height||l}}if(l===c)return;s+=c-l;let u=Math.ceil(s/i);const f=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;f&&u>f&&(u=f,e.classList.add("size-to-content-max")),n.minH&&u<n.minH?u=n.minH:n.maxH&&u>n.maxH&&(u=n.maxH),u!==n.h&&(r._ignoreLayoutsNodeChange=!0,r.moveNode(n,{h:u}),delete r._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){Ae.resizeToContentCB?Ae.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;if(!H.canBeRotated(i))return;const s={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const a=n.left>0?Math.floor(n.left/this.cellWidth()):0,l=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;s.x=i.x+a-(i.h-(l+1)),s.y=i.y+l-a}Object.keys(s).forEach(a=>{s[a]===void 0&&delete s[a]});const o=i._orig;this.update(r,s),i._orig=o}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const r=H.parseHeight(e);if(this.opts.marginUnit===r.unit&&this.opts.margin===r.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(r=>{delete r._dirty});const n=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",n)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const n=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",n)}return this}_triggerEvent(e,n){const r=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(r),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const r=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!r)return this;if(!e&&!this.opts.minRow){const s=H.parseHeight(getComputedStyle(this.el).minHeight);if(s.h>0&&s.unit===i){const o=Math.floor(s.h/r);n<o&&(n=o)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*r+i),e&&H.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,r){r=r||this._readAttr(e),e.gridstackNode=r,r.el=e,r.grid=this,r=this.engine.addNode(r,n),this._writeAttr(e,r),e.classList.add(Gn.itemClass,this.opts.itemClass);const i=H.shouldSizeToContent(r);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,r),H.lazyLoad(r)||this.prepareDragDrop(r.el),this}_writePosAttr(e,n){if(!n._moving&&!n._resizing||this._placeholder===e){const r=this.opts.rtl?"right":"left";e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style[r]=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null}return e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const r={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in r)n[i]?e.setAttribute(r[i],String(n[i])):e.removeAttribute(r[i]);return this}_readAttr(e,n=!0){const r={};r.x=H.toNumber(e.getAttribute("gs-x")),r.y=H.toNumber(e.getAttribute("gs-y")),r.w=H.toNumber(e.getAttribute("gs-w")),r.h=H.toNumber(e.getAttribute("gs-h")),r.autoPosition=H.toBool(e.getAttribute("gs-auto-position")),r.noResize=H.toBool(e.getAttribute("gs-no-resize")),r.noMove=H.toBool(e.getAttribute("gs-no-move")),r.locked=H.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?r.sizeToContent=H.toBool(i):r.sizeToContent=parseInt(i,10)),r.id=e.getAttribute("gs-id"),r.maxW=H.toNumber(e.getAttribute("gs-max-w")),r.minW=H.toNumber(e.getAttribute("gs-min-w")),r.maxH=H.toNumber(e.getAttribute("gs-max-h")),r.minH=H.toNumber(e.getAttribute("gs-min-h")),n&&(r.w===1&&e.removeAttribute("gs-w"),r.h===1&&e.removeAttribute("gs-h"),r.maxW&&e.removeAttribute("gs-max-w"),r.minW&&e.removeAttribute("gs-min-w"),r.maxH&&e.removeAttribute("gs-max-h"),r.minH&&e.removeAttribute("gs-min-h"));for(const s in r){if(!r.hasOwnProperty(s))return;!r[s]&&r[s]!==0&&s!=="sizeToContent"&&delete r[s]}return r}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(n=>(n=this.el)==null?void 0:n.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let r=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),r=!0):r=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(r),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)H.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(r=>H.shouldSizeToContent(r))){const r=[...this.engine.nodes];this.batchUpdate(),r.forEach(i=>{H.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(r=>r.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=H.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return H.getElement(e)}static getElements(e=".grid-stack-item"){return H.getElements(e)}static getGridElement(e){return Ae.getElement(e)}static getGridElements(e){return H.getElements(e)}_initMargin(){let e,n=0,r=[];typeof this.opts.margin=="string"&&(r=this.opts.margin.split(" ")),r.length===2?(this.opts.marginTop=this.opts.marginBottom=r[0],this.opts.marginLeft=this.opts.marginRight=r[1]):r.length===4?(this.opts.marginTop=r[0],this.opts.marginRight=r[1],this.opts.marginBottom=r[2],this.opts.marginLeft=r[3]):(e=H.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(o=>{this.opts[o]===void 0?this.opts[o]=n:(e=H.parseHeight(this.opts[o]),this.opts[o]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const s=this.el.style;return s.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Sn}static setupDragIn(e,n,r,i=document){(n==null?void 0:n.pause)!==void 0&&(Le.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?H.getElements(e,i):e).forEach((o,a)=>{Sn.isDraggable(o)||Sn.dragIn(o,n),r!=null&&r[a]&&(o.gridstackNode=r[a])})}movable(e,n){return this.opts.staticGrid?this:(Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&n&&r.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&n&&r.subGrid.enableResize(e,n)}),this)}cancelDrag(){var n;const e=(n=this._placeholder)==null?void 0:n.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&Ae._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Sn.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Sn.droppable(this.el,"destroy"),this;let e,n;const r=(i,s,o)=>{var h;o=o||s;const a=o.gridstackNode;if(!a)return;if(!((h=a.grid)!=null&&h.el)){o.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const p=o.getBoundingClientRect();o.style.left=p.x+(this.dragTransform.xScale-1)*(i.clientX-p.x)/this.dragTransform.xScale+"px",o.style.top=p.y+(this.dragTransform.yScale-1)*(i.clientY-p.y)/this.dragTransform.yScale+"px",o.style.transformOrigin="0px 0px"}let{top:l,left:c}=o.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,l-=u.top;const f={position:{top:l*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/n)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){Sn.off(s,"drag");return}a._willFitPos&&(H.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(o,i,f,a,n,e)}else this._dragOrResize(o,i,f,a,n,e)};return Sn.droppable(this.el,{accept:i=>{const s=i.gridstackNode||this._readAttr(i,!1);if((s==null?void 0:s.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let o=!0;if(typeof this.opts.acceptWidgets=="function")o=this.opts.acceptWidgets(i);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;o=i.matches(a)}if(o&&s&&this.opts.maxRow){const a={w:s.w,h:s.h,minW:s.minW,minH:s.minH};o=this.engine.willItFit(a)}return o}}).on(this.el,"dropover",(i,s,o)=>{let a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(s,o),o=o||s,n=this.cellWidth(),e=this.getCellHeight(!0),!a){const u=o.getAttribute("data-gs-widget")||o.getAttribute("gridstacknode");if(u){try{a=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}o.removeAttribute("data-gs-widget"),o.removeAttribute("gridstacknode")}a||(a=this._readAttr(o)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,o.gridstackNode=a);const l=a.w||Math.round(o.offsetWidth/n)||1,c=a.h||Math.round(o.offsetHeight/e)||1;return a.grid&&a.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=a),s.gridstackNode=a={...a,w:l,h:c,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=c,a._temporaryRemoved=!0),Ae._itemRemoving(a.el,!1),Sn.on(s,"drag",r),r(i,s,o),!1}).on(this.el,"dropout",(i,s,o)=>{const a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(s,o),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(i,s,o)=>{var h,p,g;const a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,c=s!==o;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const u=s._gridstackNodeOrig;if(delete s._gridstackNodeOrig,l&&(u!=null&&u.grid)&&u.grid!==this){const m=u.grid;m.engine.removeNodeFromLayoutCache(u),m.engine.removedNodes.push(u),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(h=a.grid)==null||delete h._isTemp,Sn.off(s,"drag"),o!==s?(o.remove(),s=o):s.remove(),this._removeDD(s),!l))return!1;const f=(g=(p=a.subGrid)==null?void 0:p.el)==null?void 0:g.gridstack;return H.copyPos(a,this._readAttr(this.placeholder)),H.removePositioningStyles(s),c&&(a.content||a.subGridOpts||Ae.addRemoveCB)?(delete a.el,s=this.addWidget(a)):(this._prepareElement(s,!0,a),this.el.appendChild(s),this.resizeToContentCheck(!1,a),f&&(f.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},u&&u.grid?u:void 0,a),!1}),this}static _itemRemoving(e,n){if(!e)return;const r=e?e.gridstackNode:void 0;!(r!=null&&r.grid)||e.classList.contains(r.grid.opts.removableOptions.decline)||(n?r._isAboutToRemove=!0:delete r._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Sn.isDroppable(e)&&Sn.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,r)=>Ae._itemRemoving(r,!0)).on(e,"dropout",(n,r)=>Ae._itemRemoving(r,!1)),this):this}prepareDragDrop(e,n=!1){const r=e==null?void 0:e.gridstackNode;if(!r)return;const i=r.noMove||this.opts.disableDrag,s=r.noResize||this.opts.disableResize,o=this.opts.staticGrid||i&&s;if((n||o)&&(r._initDD&&(this._removeDD(e),delete r._initDD),o))return e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!r._initDD){let a,l;const c=(h,p)=>{this.triggerEvent(h,h.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,h,p,r,a,l)},u=(h,p)=>{this._dragOrResize(e,h,p,r,a,l)},f=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete r._moving,delete r._resizing,delete r._event,delete r._lastTried;const p=r.w!==r._orig.w,g=h.target;if(!(!g.gridstackNode||g.gridstackNode.grid!==this)){if(r.el=g,r._isAboutToRemove){const m=e.gridstackNode.grid;m._gsEventHandler[h.type]&&m._gsEventHandler[h.type](h,g),m.engine.nodes.push(r),m.removeWidget(e,!0,!0)}else H.removePositioningStyles(g),r._temporaryRemoved?(this._writePosAttr(g,r),this.engine.addNode(r)):this._writePosAttr(g,r),this.triggerEvent(h,g);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(r.sizeToContent)&&(r.sizeToContent=r.h),this.resizeToContentCheck(p,r))}};Sn.draggable(e,{start:c,stop:f,drag:u,rtl:this.opts.rtl}).resizable(e,{start:c,stop:f,resize:u,rtl:this.opts.rtl}),r._initDD=!0}return Sn.draggable(e,i?"disable":"enable").resizable(e,s?"disable":"enable"),this}_onStartMoving(e,n,r,i,s,o){var a;if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,(a=i.grid)!=null&&a.el)this.dragTransform=H.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=H.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=r.position,i._prevYPix=r.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(s,o,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,c=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Sn.resizable(e,"option","minWidth",s*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",o*Math.min(i.minH||1,c)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxHeightMoveUp",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,r,i,s,o){var _;const a={...i._orig};let l,c=this.opts.marginLeft,u=this.opts.marginRight,f=this.opts.marginTop,h=this.opts.marginBottom;const p=Math.round(o*.1),g=Math.round(s*.1);if(c=Math.min(c,g),u=Math.min(u,g),f=Math.min(f,p),h=Math.min(h,p),n.type==="drag"){if(i._temporaryRemoved)return;i._prevYPix=r.position.top,this.opts.draggable.scroll!==!1&&((_=Le.dragElement)==null||_.updateScrollPosition(this.el));const w=r.position.left+(r.position.left>i._lastUiPosition.left?-u:c),E=r.position.top+(r.position.top>i._lastUiPosition.top?-h:f);a.x=Math.round(w/s),a.y=Math.round(E/o);const M=this._extraDragRow;if(this.engine.collide(i,a)){const C=this.getRow();let O=Math.max(0,a.y+i.h-C);this.opts.maxRow&&C+O>this.opts.maxRow&&(O=Math.max(0,this.opts.maxRow-C)),this._extraDragRow=O}else this._extraDragRow=0;if(this._extraDragRow!==M&&this._updateContainerHeight(),i.x===a.x&&i.y===a.y)return}else if(n.type==="resize"){if(a.x<0||(H.updateScrollResize(n,e,o),a.w=Math.round((r.size.width-c)/s),a.h=Math.round((r.size.height-f)/o),i.w===a.w&&i.h===a.h)||i._lastTried&&i._lastTried.w===a.w&&i._lastTried.h===a.h)return;if(n.hasMovedX){const w=r.position.left+c;a.x=Math.round(w/s)}if(n.hasMovedY){const w=r.position.top+f;a.y=Math.round(w/o)}l=!0}i._event=n,i._lastTried=a;const m={x:r.position.left+c,y:r.position.top+f,w:(r.size?r.size.width:i.w*s)-c-u,h:(r.size?r.size.height:i.h*o)-f-h};if(this.engine.moveNodeCheck(i,{...a,cellWidth:s,cellHeight:o,rect:m,resizing:l})){i._lastUiPosition=r.position,this.engine.cacheRects(s,o,f,u,h,c),delete i._skipDown,l&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const w=n.target;i._sidebarOrig||this._writePosAttr(w,i),this.triggerEvent(n,w)}}triggerEvent(e,n){let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;r._gsEventHandler[e.type]&&r._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const r=n.gridstackNode;if(!r||(n.style.transform=n.style.transformOrigin=null,Sn.off(e,"drag"),r._temporaryRemoved))return;r._temporaryRemoved=!0,this.engine.removeNode(r),r.el=r._isExternal&&n?n:e;const i=r._sidebarOrig;r._isExternal&&this.engine.cleanupNode(r),r._sidebarOrig=i,this.opts.removable===!0&&Ae._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):r._isExternal&&this.engine.restoreInitial()}}Ae.renderCB=(t,e)=>{t&&(e!=null&&e.content)&&(t.textContent=e.content)};Ae.resizeToContentParent=".grid-stack-item-content";Ae.Utils=H;Ae.Engine=Gr;Ae.GDRev="12.6.0";function Td(t){return{...t,w:Math.max(t.w,t.minW??t.w),h:Math.max(t.h,t.minH??t.h)}}const Df="mndw:dashboard:grid-layout",lO=/^widget-(.+):([1-9]\d*)$/;function Pn(t){const e=lO.exec(t);if(e===null)return null;const n=Number(e[2]);return!Number.isSafeInteger(n)||n<1?null:{pluginName:e[1],counter:n}}function Hf(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.id=="string"&&Number.isInteger(e.x)&&e.x>=0&&Number.isInteger(e.y)&&e.y>=0&&Number.isInteger(e.w)&&e.w>0&&Number.isInteger(e.h)&&e.h>0}function jp(t){return Hf(t)?{id:t.id,x:t.x,y:t.y,w:t.w,h:t.h}:null}function Fp(){try{localStorage.removeItem(Df)}catch(t){console.error("[mndw] Failed to clear dashboard layout:",t)}}function cO(t,e){const n=Pn(t),r=Pn(e);return n===null||r===null?t.localeCompare(e):n.pluginName.localeCompare(r.pluginName)||n.counter-r.counter}function uO(t){return[...t].sort((e,n)=>e.y-n.y||e.x-n.x||cO(e.id,n.id)).map(e=>e.id)}function dO(t,e){const n=new Set(e.map(s=>s.id)),r=new Set,i=[];if(Array.isArray(t))for(const s of t)typeof s=="string"&&n.has(s)&&!r.has(s)&&(r.add(s),i.push(s));for(const s of uO(e))r.has(s)||(r.add(s),i.push(s));return i}function fO(t,e){const n=Td(e);return{x:0,y:t.reduce((i,s)=>Math.max(i,s.y+s.h),0),w:Math.min(n.w,12),h:n.h}}function hO(t,e,n){const r=new Set,i=[];for(const s of t){if(!Hf(s)||r.has(s.id))continue;const o=Pn(s.id);if(o===null)continue;const a=n==null?void 0:n(o.pluginName);if(n!==void 0&&(a==null?void 0:a.type)!=="widget")continue;if(a!==void 0&&(!a.runnable||a.status!=="loaded")){r.add(s.id),i.push({id:s.id,x:s.x,y:s.y,w:s.w,h:s.h});continue}const l=(a==null?void 0:a.size)??e(o.pluginName);if(l===void 0)continue;const c=Math.min(Math.max(s.w,l.minW??1),12),u=Math.max(s.h,l.minH??1);r.add(s.id),i.push({id:s.id,x:Math.min(s.x,12-c),y:s.y,w:c,h:u})}return i}function pO(t){const e=new Set,n=[];for(const r of t)!Hf(r)||e.has(r.id)||Pn(r.id)===null||(e.add(r.id),n.push({id:r.id,x:r.x,y:r.y,w:r.w,h:r.h}));return n}function gO(t){return typeof t=="object"&&t!==null&&!("version"in t)&&Array.isArray(t.tiles)}function mO(t){const e={tiles:t.tiles.map(({id:n,x:r,y:i,w:s,h:o})=>({id:n,x:r,y:i,w:s,h:o})),mobileOrder:[...t.mobileOrder]};try{localStorage.setItem(Df,JSON.stringify(e))}catch(n){console.error("[mndw] Failed to save dashboard layout:",n)}}function vO(t,e){let n;try{n=localStorage.getItem(Df)}catch(o){return console.error("[mndw] Failed to load dashboard layout:",o),null}if(n===null)return null;let r;try{r=JSON.parse(n)}catch(o){return console.warn("[mndw] Failed to parse dashboard layout, discarding:",o),Fp(),null}if(!gO(r))return console.warn("[mndw] Malformed dashboard layout, discarding"),Fp(),null;const s=(e==null?void 0:e.listOutcome)==="failed"||(e==null?void 0:e.listOutcome)==="pending"?pO(r.tiles):hO(r.tiles,t,e===void 0?void 0:e.getPlugin);return{tiles:s,mobileOrder:dO(r.mobileOrder,s)}}var bO=I('<div class="mndw-grid-scroll mndw-scrollbar"><div class="grid-stack"></div></div>');function _O(t,e){Fe(e,!0);let n;const r=12,i="mndw-grid-resize-indicator",s=`.${i}`;function o(f){const h=f.gridstackNode;return h===void 0||!Number.isInteger(h.w)||!Number.isInteger(h.h)?null:{w:h.w,h:h.h}}function a(f){var h;(h=f.querySelector(s))==null||h.remove()}function l(f){const h=o(f);if(h===null){a(f);return}let p=f.querySelector(s);p===null&&(p=document.createElement("div"),p.className=i,p.setAttribute("aria-hidden","true"),f.appendChild(p)),p.textContent=`${h.w} × ${h.h}`}Un(()=>{const f=Ae.init({column:r,animate:!0,float:!1,cellHeight:60,margin:10,draggable:{handle:".mndw-grid-tile__title"},resizable:{handles:"se"}},n);f.on("removed",(p,g)=>{for(const m of g)typeof m.id=="string"&&e.onWidgetRemoved(m.id,jp(m)??void 0)});const h=()=>{const p=f.save(!1,!1,(m,_)=>{_.x??(_.x=m.x),_.y??(_.y=m.y),_.w??(_.w=m.w),_.h??(_.h=m.h)}),g=Array.isArray(p)?p.map(jp).filter(m=>m!==null):[];e.onLayoutChanged(g)};return f.on("added",h),f.on("change",h),f.on("resizestart",(p,g)=>{l(g)}),f.on("resize",(p,g)=>{l(g)}),f.on("resizestop",(p,g)=>{a(g);const m=g.gridstackNode;m!==void 0&&typeof m.id=="string"&&Number.isInteger(m.w)&&Number.isInteger(m.h)&&e.onWidgetResized(m.id,{w:m.w,h:m.h})}),e.onGridReady(f),()=>{f.off("removed"),f.off("added"),f.off("change"),f.off("resizestart"),f.off("resize"),f.off("resizestop"),n.querySelectorAll(s).forEach(p=>{p.remove()}),f.destroy(!1),e.onGridDestroyed()}});var c=bO(),u=v(c);bi(u,f=>n=f,()=>n),R(t,c),Ge()}const Ul=Symbol("mndw.host-services");function wO(t){zw(Ul,t)}function Lr(){if(!Dw(Ul))throw new Error("Host services context was not set");return Lw(Ul)}function yO(t){return new Map([[Ul,t]])}var kO=I('<span class="mndw-floating-panel__deps"> </span>'),EO=I('<span class="mndw-floating-panel__deps mndw-floating-panel__deps--failed"> </span>'),SO=I("<mndw-button> <!></mndw-button>",2),TO=I('<div class="mndw-floating-panel"><!></div>');function xO(t,e){Fe(e,!0);const n=Lr().registry;let r=V(()=>[...n.getWidgets()].sort((c,u)=>c.entry.label.localeCompare(u.entry.label)||c.entry.name.localeCompare(u.entry.name)));function i(c){e.onAddWidget(c),e.close(void 0)}var s=TO(),o=v(s);{var a=c=>{{let u=V(()=>b("dashboard.no-widgets")),f=V(()=>b("dashboard.empty-no-plugins"));Fi(c,{mode:"compact",get title(){return d(u)},get text(){return d(f)}})}},l=c=>{var u=Bn(),f=tt(u);xt(f,17,()=>d(r),h=>h.entry.name,(h,p)=>{const g=V(()=>Sc(d(p).entry.name));var m=SO();P(m,"variant","secondary");var _=v(m),w=x(_);{var E=C=>{var O=kO(),A=v(O);y(N=>S(A,N),[()=>b("dashboard.preparing")]),R(C,O)},M=C=>{var O=EO(),A=v(O);y(N=>S(A,N),[()=>b("dashboard.unavailable")]),R(C,O)};X(w,C=>{d(g)==="installing"?C(E):d(g)==="failed"&&C(M,1)})}y(()=>S(_,`${d(p).entry.label??""} `)),ge("click",m,()=>i(d(p).entry.name)),R(h,m)}),R(c,u)};X(o,c=>{d(r).length===0?c(a):c(l,-1)})}R(t,s),Ge()}ht(["click"]);const PO=3e4,CO={path:"show.system"};class RO{constructor(){W(this,"transport");W(this,"heartbeatSubscription",null);W(this,"driver");W(this,"auth");const e=window.location.origin;this.transport=new J_,this.auth=new Q_(e,this.transport),this.driver=new ew(e,this.transport)}login(e,n){return this.auth.login(e,n).pipe(zc(r=>{r?this.startHeartbeat():this.stopHeartbeat()}))}logout(){return this.stopHeartbeat(),this.auth.logout()}isAuthenticated(){return this.auth.isAuthenticated().pipe(zc(e=>{e?this.startHeartbeat():this.stopHeartbeat()}))}get authError$(){return this.transport.authError$.pipe(zc(()=>this.stopHeartbeat()))}startHeartbeat(){this.heartbeatSubscription===null&&(this.heartbeatSubscription=F_(0,PO).pipe(G_(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(CO).pipe(V_(()=>Z_))}}const Bf=new RO,Uf=new Map;function AO(t){return t.includes(":instance:")}function $f(t){return Uf.get(t)}function OO(t){const e=Symbol();return Uf.set(t,e),e}function Jb(t){const e=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r!=null&&r.startsWith(t)&&e.push(r)}for(const n of e)localStorage.removeItem(n)}class Gp{constructor(e){W(this,"prefix");W(this,"instanceRevision");this.prefix=e,this.instanceRevision=AO(e)?OO(e):null}async get(e){return Promise.resolve(localStorage.getItem(this.prefix+e))}async set(e,n){return this.canWrite()&&localStorage.setItem(this.prefix+e,n),Promise.resolve()}async delete(e){return this.canWrite()&&localStorage.removeItem(this.prefix+e),Promise.resolve()}async keys(){const e=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r!=null&&r.startsWith(this.prefix)&&e.push(r.slice(this.prefix.length))}return Promise.resolve(e)}canWrite(){return this.instanceRevision===null||$f(this.prefix)===this.instanceRevision}}function Yo(t,e){const n=`${Is}:${t}:instance:${e}:`;Jb(n)}function MO(t,e){return $f(`${Is}:${t}:instance:${e}:`)}function Vp(t,e,n){const r=`${Is}:${t}:instance:${e}:`;$f(r)===n&&(Jb(r),Uf.delete(r))}function NO(t,e){const n=Object.create(null);for(const r of e){const i=t[r];typeof i=="function"&&(n[r]=i.bind(t))}return Object.freeze(n)}function Qb(t){if(t===null||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(const e of Object.values(t))Qb(e);return Object.freeze(t)}function IO(t){const e={list:t.switchports.list.map(l=>({...l})),layout:t.switchports.layout.map(l=>[...l]),hasPortStats:t.switchports.hasPortStats},n={ports:[...t.usb.ports]},r=[...t.features],i=[...t.components],s=new Set(r.map(l=>l.toLowerCase())),o=new Set(i.map(l=>l.toLowerCase())),a={...t,features:r,components:i,switchports:e,usb:n,hasFeature:l=>s.has(l.toLowerCase()),hasComponent:l=>o.has(l.toLowerCase())};return Qb(a)}const ut={dashboard:"/",login:"/login",packages:"/packages",packageServices:"/packages/services",settings:"/settings",settingsTab:{general:"/settings/general",diagnostics:"/settings/diagnostics",plugins:"/settings/plugins","self-update":"/settings/self-update"}},Zp=ut.settingsTab,LO=/^[a-z][a-z\d+.-]*:/i;function zO(t){if(t==="")return"";if(t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#")||LO.test(t))return;const e=t.endsWith("/")?t.slice(0,-1):t;if(e==="")return;const n=e.split("/");for(const r of n){if(r==="")return;let i;try{i=decodeURIComponent(r)}catch{return}if(i==="."||i===".."||i.includes("/")||i.includes("\\"))return}return e}function DO(t,e){try{if(typeof t!="object"||t===null)return;const n=t;switch(n.kind){case"dashboard":return ut.dashboard;case"packages":return ut.packages;case"settings":{const r=n.tab;return r===void 0?ut.settings:typeof r!="string"||!Object.hasOwn(Zp,r)?void 0:Zp[r]}case"plugin-page":{if(typeof n.plugin!="string")return;const r=e.pageTable.baseRouteOf(n.plugin);if(r===void 0)return;const i=n.path;if(i!==void 0&&typeof i!="string")return;const s=zO(i??"");return s===void 0?void 0:s===""?r:`${r}/${s}`}default:return}}catch{return}}function Wp(t,e){try{const n=e.getRouter();if(n===void 0)return;const r=DO(t,n);return r===void 0?void 0:{router:n,path:r}}catch{return}}function HO(t){return Object.freeze({href:e=>{var n;return(n=Wp(e,t))==null?void 0:n.path},navigate:e=>{try{if(t.isDisposed())return!1;const n=Wp(e,t);return n===void 0?!1:(n.router.navigate(n.path),!0)}catch{return!1}}})}const BO=()=>new Worker(new URL("/assets/ticker-pool.worker-DJA1ERT2.js",import.meta.url),{type:"module"});function UO(t=BO){const e=new Map;let n=1,r;const i=()=>{let l=0;for(const c of e.values())c.running&&!c.destroyed&&(l+=1);return l},s=()=>{if(i()!==0||r===void 0)return;const l=r;r=void 0,l.onmessage=null,l.terminate()},o=()=>{if(r!==void 0)return r;const l=t();return l.onmessage=c=>{const u=e.get(c.data.id);u!==void 0&&u.running&&!u.destroyed&&u.subject.next({timestamp:c.data.timestamp,drift:c.data.drift})},r=l,l};return Object.freeze({create:l=>{const c={id:n++,subject:new W_,running:!1,destroyed:!1,interval:1e3};e.set(c.id,c);const u=new q_,f=()=>{c.destroyed||(c.running&&(c.running=!1,r==null||r.postMessage({command:"stop",id:c.id})),c.destroyed=!0,e.delete(c.id),u.unsubscribe(),c.subject.complete(),s())};return u.add(l.ended$.subscribe(f)),{start:h=>{c.destroyed||(c.interval=h,c.running=!0,o().postMessage({command:"start",id:c.id,interval:h}))},setInterval:h=>{c.destroyed||(c.interval=h,r!==void 0&&r.postMessage({command:"setInterval",id:c.id,interval:h}))},stop:()=>{c.destroyed||!c.running||(c.running=!1,r==null||r.postMessage({command:"stop",id:c.id}),s())},tick$:c.subject.asObservable(),destroy:f}}})}const $O=UO();let jO=0;const FO=()=>{const t=globalThis.crypto;return(t==null?void 0:t.randomUUID)!==void 0?t.randomUUID():`event-context-${++jO}`};function GO(t){const{routes:e}=t.backend;if(Object.keys(e??{}).length===0)return;const n={routes:e??{},approval:t.approval,enabled:t.enabled};return wP(t.name,n)}function jf(t){const{entry:e,instanceId:n,deviceInfo:r,setTileTitle:i,pageRoute:s,catalogCell:o,services:a}=t,l=()=>a.locale.getLocale(),c=re=>a.locale.subscribeLocale(()=>re()),u=re=>a.locale.subscribeLocale(re),f=()=>a.palette.getTokens(),h=a.eventStream;if(e.type==="page"&&s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);const p=vb(),g=new AbortController,m=$a(Ls,Ec,p),_=$a(l,u,p),w=$a(f,re=>a.palette.subscribePalette(re),p),E=$a(()=>a.telemetryGathering.get(),re=>a.telemetryGathering.subscribe(()=>re(a.telemetryGathering.get())),p).pipe(K_(re=>re!==null)),M={fetchProjected:(...re)=>a.telemetry.fetchProjected(...re),gathering$:E},{service:C,dispose:O}=Af(e.name,n),A=FO(),N=h.createFacade(A,e.name,e.permissions??[],p);let z=!1;const D=HO({getRouter:()=>a.navigation(),isDisposed:()=>z}),G=re=>{z||(z=!0,g.abort(),p.end(),N!==void 0&&h.disposeFacade(A),O(re))},K=e.type==="page"?(()=>{if(s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);return{kind:"page",pageRoute:s}})():i===void 0?{kind:"widget"}:{kind:"widget",setTileTitle:i},oe={signal:g.signal,navigation:D,telemetry:M,events:N,rciManager:NO(Bf.driver,TA),storage:new Gp(`${Is}:${e.name}:instance:${n}:`),sharedStorage:new Gp(`${Is}:${e.name}:shared:`),deviceInfo:IO(r),i18n:WC(o,l,c,p),instanceId:n,createTicker:()=>$O.create(p),backend:GO(e),overlay:C,...K,get theme(){return Ls()},theme$:m,get locale(){return l()},locale$:_,get palette(){return f()},palette$:w};return Object.setPrototypeOf(oe,null),{context:Object.freeze(oe),dispose:G}}function VO(t,e,n,r,i,s){ee.hostInfo;const o=ee.deviceInfo??Tf,a=e.get(n);if(!a)throw new Error(`No loaded plugin "${n}"`);return jf({entry:a.entry,instanceId:r,deviceInfo:o,setTileTitle:s,catalogCell:a.catalog,services:t})}function ZO(t){return t===null||typeof t!="object"&&typeof t!="function"?!1:typeof t.then=="function"}function WO(t,e,n,r,i){const s=e.entry.name;try{const o=e.module.createInstance(t,n);return ZO(o)?Promise.resolve(o).then(a=>({pluginName:s,instanceId:n.instanceId,instance:a,disposeOverlayService:r})).catch(a=>(console.error(`[mndw] Plugin "${s}" createInstance failed:`,a),r("plugin-unmount"),i!=null&&i.errorText&&(t.textContent=i.errorText),null)):{pluginName:s,instanceId:n.instanceId,instance:o,disposeOverlayService:r}}catch(o){return console.error(`[mndw] Plugin "${s}" createInstance failed:`,o),r("plugin-unmount"),i!=null&&i.errorText&&(t.textContent=i.errorText),null}}function qp(t,e,n,r){var i,s;if(r)try{(i=t.disposeOverlayService)==null||i.call(t,(n==null?void 0:n.closeReason)??"plugin-unmount")}catch(o){console.error(`[mndw] Plugin "${t.pluginName}" overlay teardown failed:`,o)}try{(s=t.instance.unmount())==null||s.catch(o=>{console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,o)})}catch(o){console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,o)}(n==null?void 0:n.clearStorage)!==!1&&Yo(t.pluginName,t.instanceId),e.innerHTML=""}function e_(t,e,n,r){let i=null,s=!1,o=!1,a,l=!1;const c=h=>{l||(l=!0,n.dispose(h))},u=WO(t,e,n.context,c,r);let f;return u instanceof Promise?f=u.then(h=>(s=!0,i=h,o&&(h!==null?qp(h,t,a,!1):((a==null?void 0:a.clearStorage)===!0&&Yo(e.entry.name,n.context.instanceId),t.innerHTML=""),i=null),h!==null)):(s=!0,i=u,f=Promise.resolve(u!==null)),{getMounted:()=>i,whenReady:()=>f,dispose(h){if(!o){if(o=!0,a=h,i!==null){qp(i,t,h,!0),i=null;return}if(!s){try{c((h==null?void 0:h.closeReason)??"plugin-unmount")}catch(p){console.error(`[mndw] Plugin "${e.entry.name}" context teardown failed:`,p)}t.innerHTML="";return}(h==null?void 0:h.clearStorage)===!0&&Yo(e.entry.name,n.context.instanceId)}}}}function t_(t,e,n){return e_(t,e,n,{errorText:sn("dashboard.widget-error")})}const wr=new Map;function xd(){return{getMounted:()=>null,whenReady:()=>Promise.resolve(!1),dispose:()=>{}}}function Kp(t,e){t.textContent="";const n=document.createElement("div");n.className=`mndw-grid-tile__notice mndw-grid-tile__notice--${e}`,n.setAttribute("role",e==="installing"?"status":"alert"),n.textContent=sn(e==="installing"?"dashboard.preparing-dependencies":"dashboard.dependency-install-failed"),t.appendChild(n)}function n_(t,e,n){var f;const r=yn(t.pluginName),i=(r==null?void 0:r.status)==="loading",s=(r==null?void 0:r.label)??t.pluginName,o=t.body.querySelector(".mndw-grid-tile__notice--plugin-load-failed");if((o==null?void 0:o.getAttribute("aria-busy"))===String(i)&&((f=o.querySelector("h3"))==null?void 0:f.textContent)===sn("dashboard.plugin-load-failed",{label:s}))return;const a=document.createElement("section");a.className="mndw-grid-tile__notice mndw-grid-tile__notice--plugin-load-failed",a.setAttribute("role","alert"),a.setAttribute("aria-busy",String(i));const l=document.createElement("h3");l.textContent=sn("dashboard.plugin-load-failed",{label:s});const c=document.createElement("button");c.type="button",c.className="mndw-grid-tile__retry",c.textContent=sn("dashboard.retry-plugin-load"),c.disabled=i,c.setAttribute("aria-busy",String(i)),c.onclick=()=>{c.disabled||(c.disabled=!0,c.setAttribute("aria-busy","true"),a.setAttribute("aria-busy","true"),n())};const u=document.createElement("button");u.type="button",u.className="mndw-grid-tile__remove-failed",u.textContent=sn("dashboard.remove-failed-plugin"),u.onclick=()=>e(t.id),a.append(l,c,u),t.body.replaceChildren(a),t.retrying=i}async function r_(t){if(!t.retrying){t.retrying=!0;try{await JA(t.pluginName)}finally{t.retrying=!1}}}function qO(t,e){const n=document.createElement("div");n.className="mndw-grid-tile";const r=document.createElement("div");r.className="mndw-grid-tile__title",r.textContent=t,r.setAttribute("data-manifest-label",t);let i=t;const s=document.createElement("button");s.type="button",s.className="mndw-grid-tile__close";const o=document.createElement("mndw-icon");o.setAttribute("name","x"),s.append(o),s.setAttribute("aria-label",sn("dashboard.remove-widget",{label:t})),s.onclick=u=>{u.stopPropagation(),e()};const a=document.createElement("div");a.className="mndw-grid-tile__body";const l=u=>{const f=r.getAttribute("data-manifest-label")??t,h=u||f;i=h,r.textContent=h,s.setAttribute("aria-label",sn("dashboard.remove-widget",{label:f}))},c=()=>i;return n.append(r,s,a),{frame:n,body:a,setTileTitle:l,getTileTitle:c}}function Ff(t,e,n,r){const i=Sc(t.pluginName);if(t.pluginLoadPlaceholder=!1,t.retrying=!1,i==="installing"){Kp(t.body,"installing"),t.handle=xd(),t.pending=!0;return}if(i==="failed"){Kp(t.body,"failed"),t.handle=xd(),t.pending=!1;return}t.body.textContent="",t.handle=t_(t.body,e,VO(n,r,t.pluginName,t.instanceId,void 0,t.setTileTitle)),t.pending=!1}function Rc(t,e,n,r,i){const s=`widget-${r}`,o=wr.get(s);if(o!==void 0)return o;const a=e.get(n),l=(a==null?void 0:a.entry.type)==="widget"?a:void 0,c=yn(n);if(l===void 0&&!((c==null?void 0:c.runnable)===!0&&c.type==="widget"&&(c.status==="failed"||c.status==="loading")))return null;const u=(l==null?void 0:l.entry.label)??(c==null?void 0:c.label)??n,{frame:f,body:h,setTileTitle:p,getTileTitle:g}=qO(u,()=>i(s));h.dataset.theme=Ls();const m=Ec(w=>{h.dataset.theme=w}),_={id:s,pluginName:n,instanceId:r,frame:f,body:h,themeUnsubscribe:m,handle:xd(),setTileTitle:p,getTileTitle:g,pending:!1,pluginLoadPlaceholder:l===void 0,retrying:(c==null?void 0:c.status)==="loading",onRemoveRequest:i};return wr.set(s,_),_.pluginLoadPlaceholder?n_(_,i,()=>{r_(_)}):l!==void 0&&Ff(_,l,t,e),_}function KO(t,e,n,r){if(wr.get(t.id)!==t||!t.pluginLoadPlaceholder)return;const i=yn(t.pluginName);if((i==null?void 0:i.status)==="loaded"){const s=n.get(t.pluginName);(s==null?void 0:s.entry.type)==="widget"&&Ff(t,s,r,n);return}((i==null?void 0:i.status)==="failed"||(i==null?void 0:i.status)==="loading")&&n_(t,e,()=>{r_(t)})}function i_(t,e){for(const n of wr.values())n.pluginLoadPlaceholder&&KO(n,n.onRemoveRequest,e,t)}function $l(t){return wr.get(t)}function s_(t,e){for(const n of wr.values()){if(!n.pending)continue;const r=e.get(n.pluginName);if((r==null?void 0:r.entry.type)!=="widget"){n.pending=!1;continue}Ff(n,r,t,e)}}function os(t,e={}){const n=wr.get(t);n!==void 0&&(wr.delete(t),n.themeUnsubscribe(),n.frame.remove(),n.handle.dispose({clearStorage:e.clearStorage??!0,closeReason:"plugin-unmount"}))}function YO(t,e){var r;const n=t.querySelector(".mndw-grid-tile__title");n!==null&&(n.textContent=e,n.setAttribute("data-manifest-label",e)),(r=t.querySelector(".mndw-grid-tile__close"))==null||r.setAttribute("aria-label",sn("dashboard.remove-widget",{label:e}))}async function XO(t,e,n,r,i){const s=[...wr.values()].filter(u=>u.pluginName===n&&!u.pending);if(s.length===0)return!0;for(const u of s)u.handle.dispose({clearStorage:!1,closeReason:"host-navigation"});const o=u=>s.map(f=>{YO(f.frame,u.entry.label),f.setTileTitle(""),ee.hostInfo;const h=ee.deviceInfo??Tf;return f.handle=t_(f.body,u,jf({entry:u.entry,instanceId:f.instanceId,deviceInfo:h,setTileTitle:f.setTileTitle,catalogCell:u.catalog,services:t})),f.handle}),a=o(r);if((await Promise.all(a.map(u=>u.whenReady()))).every(Boolean))return!0;for(const u of a)u.dispose({clearStorage:!1,closeReason:"host-navigation"});const c=o(i);return await Promise.all(c.map(u=>u.whenReady())),!1}function o_(t="plugin-unmount"){for(const[e,n]of wr)try{n.handle.dispose({clearStorage:!1,closeReason:t})}catch(r){console.error(`[mndw] Failed to unmount tile ${e}:`,r)}finally{n.themeUnsubscribe()}wr.clear()}const JO=Object.freeze(Object.defineProperty({__proto__:null,destroyAllTiles:o_,ensureTileController:Rc,getTileController:$l,hydratePendingTiles:s_,refreshPluginLoadPlaceholders:i_,remountWidgetTiles:XO,removeTileController:os},Symbol.toStringTag,{value:"Module"}));var QO=I('<div class="mndw-mobile-tile"></div>'),eM=I('<div class="mndw-mobile-dashboard mndw-scrollbar"></div>');function tM(t,e){Fe(e,!0);const n=Lr(),r=n.registry,i={locale:n.locale,palette:n.palette,telemetry:n.telemetry,telemetryGathering:n.telemetryGathering,eventStream:n.eventStream,navigation:xa};function s(a,l){const c=Pn(l);if(c===null){a.remove();return}const u=Rc(i,r,c.pluginName,`${c.pluginName}:${c.counter}`,e.onRemoveRequest);if(u===null){a.remove();return}a.appendChild(u.frame)}var o=eM();xt(o,20,()=>e.order,a=>a,(a,l)=>{var c=QO();Ws(c,(u,f)=>s==null?void 0:s(u,f),()=>l),R(a,c)}),R(t,o),Ge()}var nM=I('<li><span class="mndw-order-card__handle" aria-hidden="true"><mndw-icon></mndw-icon></span> <span class="mndw-order-card__label"> </span> <span class="mndw-order-card__moves"><mndw-button><mndw-icon></mndw-icon></mndw-button> <mndw-button><mndw-icon></mndw-icon></mndw-button></span></li>',2),rM=I('<div class="mndw-order-overlay"><ul class="mndw-order-overlay__list"></ul> <div class="mndw-order-overlay__actions"><mndw-button> </mndw-button></div></div>',2);function iM(t,e){Fe(e,!0);let n=se(lt(Ei(()=>e.cards.map(m=>({...m}))))),r=se(null),i=lt([]);function s(){e.onCommit(d(n).map(m=>m.id)),e.close(void 0)}function o(m,_){const w=m+_;if(w<0||w>=d(n).length)return;const E=[...d(n)],[M]=E.splice(m,1);M!==void 0&&(E.splice(w,0,M),k(n,E,!0))}function a(m,_){var w,E;k(r,_,!0),(E=(w=m.currentTarget).setPointerCapture)==null||E.call(w,m.pointerId)}function l(m){var w;const _=d(r);if(_!==null)for(let E=0;E<d(n).length;E+=1){if(E===_)continue;const M=(w=i[E])==null?void 0:w.getBoundingClientRect();if(M!==void 0&&m.clientY>=M.top&&m.clientY<=M.bottom){o(_,E-_),k(r,E,!0);return}}}function c(){k(r,null)}var u=rM(),f=v(u);xt(f,23,()=>d(n),m=>m.id,(m,_,w)=>{var E=nM();let M;var C=v(E),O=v(C);P(O,"name","menu");var A=x(C,2),N=v(A),z=x(A,2),D=v(z);P(D,"variant","ghost"),y(()=>P(D,"disabled",d(w)===0)),y(()=>P(D,"aria-label",b("dashboard.move-up",{label:d(_).label})));var G=v(D);P(G,"name","arrow-up");var K=x(D,2);P(K,"variant","ghost"),y(()=>P(K,"disabled",d(w)===d(n).length-1)),y(()=>P(K,"aria-label",b("dashboard.move-down",{label:d(_).label})));var oe=v(K);P(oe,"name","arrow-down"),bi(E,(re,ye)=>i[ye]=re,re=>i==null?void 0:i[re],()=>[d(w)]),y(()=>{M=Ne(E,1,"mndw-order-card",null,M,{"mndw-order-card--dragging":d(r)===d(w)}),S(N,d(_).label)}),ge("pointerdown",C,re=>a(re,d(w))),ge("pointermove",C,l),ge("pointerup",C,c),ge("click",D,()=>o(d(w),-1)),ge("click",K,()=>o(d(w),1)),R(m,E)});var h=x(f,2),p=v(h);P(p,"variant","primary");var g=v(p);y(m=>S(g,m),[()=>b("common.save")]),ge("click",p,s),R(t,u),Ge()}ht(["pointerdown","pointermove","pointerup","click"]);const Xo=new Map;function a_(t){return`${Is}:${t}:counter`}function l_(t){return Number.isSafeInteger(t)&&t>=0}function sM(t){try{const e=localStorage.getItem(a_(t));if(e===null||e.trim()==="")return 0;const n=Number(e);return l_(n)?(Xo.set(t,Math.max(Xo.get(t)??0,n)),n):0}catch(e){return console.error(`[mndw] Failed to read widget counter for "${t}":`,e),0}}function c_(t){return Math.max(sM(t),Xo.get(t)??0)}function u_(t,e){try{localStorage.setItem(a_(t),String(e))}catch(n){console.error(`[mndw] Failed to write widget counter for "${t}":`,n)}}function d_(t){const e=c_(t);if(e===Number.MAX_SAFE_INTEGER)throw new RangeError(`Widget instance counter exhausted for "${t}"`);const n=e+1;return Xo.set(t,n),u_(t,n),`${t}:${n}`}function oM(t,e){if(!l_(e)){console.error(`[mndw] Ignoring invalid restored widget counter for "${t}":`,e);return}e>c_(t)&&(Xo.set(t,e),u_(t,e))}function aM(t){return(t==null?void 0:t.entry.type)==="widget"}function xu(t,e,n,r,i,s){const o=e.get(r),a=aM(o)?o:void 0,l=yn(r),c=(l==null?void 0:l.runnable)===!0&&l.type==="widget"&&(l.status==="failed"||l.status==="loading");if(a===void 0&&!c)return null;const u=(s==null?void 0:s.instanceId)??d_(r),f=Rc(t,e,r,u,i);if(f===null)return null;const h=a!==void 0?Td(a.entry.size):s===void 0?Td((l==null?void 0:l.size)??{w:4,h:3}):{w:s.w,h:s.h},p=n.addWidget({id:f.id,x:s==null?void 0:s.x,y:s==null?void 0:s.y,w:(s==null?void 0:s.w)??h.w,h:(s==null?void 0:s.h)??h.h,...a===void 0?{}:{minW:h.minW,minH:h.minH}}),g=p.querySelector(".grid-stack-item-content");return g===null?(n.removeWidget(p,!0),null):(g.appendChild(f.frame),n.prepareDragDrop(p,!0),f.id)}function lM(t,e){var i;const n=$l(t),r=(i=n==null?void 0:n.handle.getMounted())==null?void 0:i.instance;if((r==null?void 0:r.onResize)!==void 0)try{r.onResize(e)}catch(s){console.error(`[mndw] Widget "${n==null?void 0:n.pluginName}" onResize failed:`,s)}}const{service:cM}=Af("@host","@host");function ki(t,e){return cM.open({kind:"modal",title:e.title,showCloseButton:e.showCloseButton??!0,closeOnEscape:e.closeOnEscape??!0,closeOnOutsideClick:e.closeOnOutsideClick??!1,mount(n,r){let i,s=()=>{};const o=new Promise(l=>{s=l}),a={...e.props,close(l){r.close(l)}};r.setCleanup(async()=>{await o,i&&await Kd(i)});try{i=rc(t,{target:n,props:a,...e.context===void 0?{}:{context:e.context}})}finally{s()}}})}var uM=I("<mndw-button> </mndw-button>",2),dM=I("<mndw-button><mndw-icon></mndw-icon> </mndw-button> <!>",3),fM=I('<div class="mndw-dashboard__grid-wrapper"><!></div>'),hM=I('<div class="mndw-dashboard-page"><div class="mndw-dashboard__toolbar"><!></div> <!> <!></div>');function Pu(t,e){Fe(e,!0);const n=500,r="dashboard-widget-removal",i=8e3,s=Lr(),o=yO(s),a=s.registry,l={locale:s.locale,palette:s.palette,telemetry:s.telemetry,telemetryGathering:s.telemetryGathering,eventStream:s.eventStream,navigation:xa};function c(B){const fe=a.get(B);return(fe==null?void 0:fe.entry.type)==="widget"?fe.entry.size:void 0}const u=va();let f,h=se(null),p=se(!1),g=null,m=null,_=se(lt(u.matches)),w=se(lt([])),E=se(lt([])),M=V(()=>d(w).filter(B=>D(B.id))),C=V(()=>{const B=new Set(d(M).map(fe=>fe.id));return d(E).filter(fe=>B.has(fe))}),O=!1,A,N=se(null),z=null;{const B=vO(c,{listOutcome:Yn(),getPlugin:yn});if(B!==null){k(w,B.tiles,!0),k(E,B.mobileOrder,!0);const fe=new Map;for(const ae of B.tiles){const Q=Pn(ae.id);Q!==null&&fe.set(Q.pluginName,Math.max(fe.get(Q.pluginName)??0,Q.counter))}for(const[ae,Q]of fe)oM(ae,Q)}}function D(B){var Q;const fe=Pn(B);if(fe===null)return!1;const ae=yn(fe.pluginName);return ae!==void 0?ae.runnable&&ae.type==="widget"&&ae.status!=="not-runnable":((Q=a.get(fe.pluginName))==null?void 0:Q.entry.type)==="widget"}function G(B){const fe=Pn(B.id);if(fe===null)return!1;const ae=yn(fe.pluginName);return ae!==void 0&&ae.type==="widget"&&!ae.runnable}function K(B){const fe=new Set(B.map(Q=>Q.id)),ae=d(w).filter(Q=>G(Q)&&!fe.has(Q.id));return[...B,...ae]}function oe(B){const fe=new Set(d(C));let ae=0;const Q=d(E).map(ze=>{if(!fe.has(ze))return ze;const Be=B[ae];return ae+=1,Be??ze});for(const ze of B.slice(ae))Q.includes(ze)||Q.push(ze);return Q}function re(B={tiles:Ca(d(w)),mobileOrder:Ca(d(E))}){if(Yn()!=="ok"){clearTimeout(A),z=null;return}clearTimeout(A),z=null,mO(B)}function ye(){Yn()==="ok"&&(clearTimeout(A),z={tiles:Ca(d(w)),mobileOrder:Ca(d(E))},A=setTimeout(()=>{z!==null&&re(z)},n))}function q(){const B=d(N);B!==null&&(k(N,null),Yo(B.pluginName,B.instanceId),B.mountSettlement!==null&&B.mountSettlement.then(()=>Vp(B.pluginName,B.instanceId,B.storageRevision),()=>Vp(B.pluginName,B.instanceId,B.storageRevision)))}function Z(){const B=d(N);B!==null&&(k(N,null),k(w,[...d(w)],!0),d(w).splice(Math.min(B.tileIndex,d(w).length),0,B.tile),k(E,[...d(E)],!0),d(E).splice(Math.min(B.mobileIndex,d(E).length),0,B.tile.id),!d(_)&&d(h)!==null&&Ee(),re(),Ve.dismiss(B.toastId))}function J(B,fe){var ct;if(O||Yn()!=="ok")return;const ae=Pn(B),Q=d(w).findIndex(tn=>tn.id===B),ze=fe??d(w)[Q]??{id:B,x:0,y:0,w:1,h:1};if(ae===null||Q===-1){os(B,{clearStorage:!0});return}q();const Be=$l(B),Rt=((ct=Be==null?void 0:Be.handle)==null?void 0:ct.whenReady())??null,nt=`${ae.pluginName}:${ae.counter}`,mt=a.get(ae.pluginName),j=(Be==null?void 0:Be.getTileTitle())||(mt==null?void 0:mt.entry.label)||ae.pluginName,we=d(E).indexOf(B);os(B,{clearStorage:!1}),k(w,d(w).filter(tn=>tn.id!==B),!0),k(E,d(E).filter(tn=>tn!==B),!0),re();const Ue=Ve.info(b("dashboard.widget-removed",{label:j}),{key:r,duration:i,action:{label:b("common.undo"),onAction:Z}});k(N,{tile:ze,tileIndex:Q,mobileIndex:we===-1?d(E).length:we,pluginName:ae.pluginName,instanceId:nt,storageRevision:MO(ae.pluginName,nt),mountSettlement:Rt,toastId:Ue},!0)}function me(B){if(Yn()!=="ok")return;const fe=d(h);if(!d(_)&&fe!==null){const ae=fe.getGridItems().find(Q=>{var ze;return((ze=Q.gridstackNode)==null?void 0:ze.id)===B});if(ae!==void 0){fe.removeWidget(ae,!0);return}}J(B)}function ce(B){k(h,B,!0),O=!0;try{for(const fe of d(M)){const ae=Pn(fe.id);ae!==null&&xu(l,a,B,ae.pluginName,me,{x:fe.x,y:fe.y,w:fe.w,h:fe.h,instanceId:`${ae.pluginName}:${ae.counter}`})}}finally{O=!1}}function Ee(){var ae;if(d(_)||d(h)===null)return;const B=new Map(d(w).filter(Q=>D(Q.id)).map(Q=>[Q.id,Q])),fe=[];O=!0;try{for(const Q of d(h).getGridItems()){const ze=(ae=Q.gridstackNode)==null?void 0:ae.id;if(typeof ze!="string"){d(h).removeWidget(Q,!0,!1);continue}const Be=B.get(ze);if(Be===void 0){d(h).removeWidget(Q,!0,!1);const Rt=Pn(ze),nt=Rt===null?void 0:yn(Rt.pluginName),mt=(nt==null?void 0:nt.type)==="widget"&&!nt.runnable;os(ze,{clearStorage:!mt});continue}fe.push(ze),d(h).update(Q,{x:Be.x,y:Be.y,w:Be.w,h:Be.h})}for(const Q of B.values()){if(fe.includes(Q.id))continue;const ze=Pn(Q.id);ze!==null&&xu(l,a,d(h),ze.pluginName,me,{x:Q.x,y:Q.y,w:Q.w,h:Q.h,instanceId:`${ze.pluginName}:${ze.counter}`})}}finally{O=!1}}function xe(){k(h,null)}function Ze(B){O||Yn()!=="ok"||(k(w,K(B),!0),ye())}function he(B,fe){lM(B,fe)}function pe(B){if(Yn()!=="ok")return!1;const fe=c(B);if(fe===void 0)return!1;const ae=d_(B),Q=Rc(l,a,B,ae,me);return Q===null?!1:(k(w,[...d(w),{id:Q.id,...fO(d(w),fe)}],!0),k(E,[...d(E),Q.id],!0),re(),!0)}function De(B){if(Yn()!=="ok")return!1;if(d(_))return pe(B);const fe=d(h);if(fe===null)return!1;const ae=xu(l,a,fe,B,me);return ae!==null?(k(E,[...d(E),ae],!0),re(),!0):!1}function qe(){if(g!==null)return;const B=document.activeElement;let fe=!1;const ae=ki(xO,{title:b("dashboard.add-widget"),props:{onAddWidget:Q=>{fe=De(Q)}},closeOnOutsideClick:!0,context:o});g=ae,ae.closed.then(async()=>{if(g===ae&&(g=null),fe&&B instanceof HTMLElement&&!B.isConnected){await Oo();const Q=(f==null?void 0:f.querySelector(".mndw-dashboard__toolbar mndw-button"))??(f==null?void 0:f.querySelector(".mndw-grid-tile__close"));Q==null||Q.focus()}})}function Y(){if(m!==null)return;k(p,!0);const B=ki(iM,{title:b("dashboard.arrange-widgets"),props:{cards:d($),onCommit:ie},closeOnOutsideClick:!0});m=B,B.closed.then(()=>{m===B&&(m=null,k(p,!1))})}const ke=B=>{k(_,B.matches,!0),B.matches||(m==null||m.close(),m=null,k(p,!1))},$=V(()=>d(p)?d(C).flatMap(B=>{var ze,Be;const fe=Pn(B);if(fe===null)return[];const ae=((ze=a.get(fe.pluginName))==null?void 0:ze.entry.label)??fe.pluginName,Q=((Be=$l(B))==null?void 0:Be.getTileTitle())??"";return[{id:B,label:Q||ae}]}):[]);function ie(B){Yn()==="ok"&&(k(E,oe(B),!0),re())}let le=Yn(),Te=Hp(),Ke=!1;function Xe(){var Rt;const B=d(N);B!==null&&((Rt=yn(B.pluginName))==null?void 0:Rt.type)!=="widget"&&(q(),Ve.dismiss(B.toastId));const fe=d(w).filter(nt=>{var j;const mt=Pn(nt.id);return mt!==null&&((j=yn(mt.pluginName))==null?void 0:j.type)==="widget"}),ae=new Set(fe.map(nt=>nt.id)),Q=d(E).filter(nt=>ae.has(nt)),ze=fe.length!==d(w).length,Be=Q.length!==d(E).length;for(const nt of d(w)){const mt=Pn(nt.id);if(mt===null||!ae.has(nt.id)){os(nt.id,{clearStorage:!0}),mt!==null&&Yo(mt.pluginName,`${mt.pluginName}:${mt.counter}`);continue}const j=yn(mt.pluginName);(j==null?void 0:j.type)==="widget"&&!j.runnable&&os(nt.id,{clearStorage:!1})}return!ze&&!Be?!1:(k(w,fe,!0),k(E,Q,!0),!0)}Kn(()=>{[...Ml.entries()],Object.values(Pc()).map(ae=>`${ae.status}:${ae.runnable}`);const B=Yn(),fe=Hp();if(s_(l,a),i_(l,a),B==="ok"){if(!Ke||le!=="ok"||Te!==fe){const ae=le!=="ok",Q=Xe();Ke=!0,Ee(),(ae||Q)&&re()}}else Ke=!1;le=B,Te=fe}),Kn(()=>{const B=d(N);B!==null&&!Ve.toasts.some(fe=>fe.id===B.toastId)&&q()}),Un(()=>(u.addEventListener("change",ke),window.addEventListener("pagehide",wt),()=>{u.removeEventListener("change",ke),window.removeEventListener("pagehide",wt)}));function wt(){q(),Ve.dismissKey(r)}Si(()=>{z!==null&&Yn()==="ok"&&re(z),q(),Ve.dismissKey(r),g==null||g.close(),m==null||m.close(),o_("host-navigation")});var Et=hM(),Re=v(Et),Je=v(Re);{var Qe=B=>{var fe=dM(),ae=tt(fe);P(ae,"variant","secondary");var Q=v(ae);P(Q,"name","plus"),P(Q,"aria-hidden","true");var ze=x(Q),Be=x(ae,2);{var Rt=nt=>{var mt=uM();P(mt,"variant","secondary");var j=v(mt);y(we=>S(j,we),[()=>b("dashboard.arrange-widgets")]),ge("click",mt,Y),R(nt,mt)};X(Be,nt=>{d(_)&&d(C).length>1&&nt(Rt)})}y(nt=>S(ze,` ${nt??""}`),[()=>b("dashboard.add-widget")]),ge("click",ae,qe),R(B,fe)},$t=V(()=>a.getWidgets().length>0&&d(M).length>0);X(Je,B=>{d($t)&&B(Qe)})}var Ct=x(Re,2);{var ln=B=>{{let fe=V(()=>b("dashboard.empty-error-title")),ae=V(()=>b("dashboard.empty-error-text"));Fi(B,{get title(){return d(fe)},get text(){return d(ae)}})}},jt=B=>{{let fe=V(()=>b("dashboard.no-widgets")),ae=V(()=>b("dashboard.empty-no-plugins")),Q=V(()=>({label:b("dashboard.empty-install-plugins"),href:ut.settingsTab.plugins}));Fi(B,{get title(){return d(fe)},get text(){return d(ae)},get action(){return d(Q)}})}},cn=V(()=>a.getWidgets().length===0&&d(M).length===0),en=B=>{{let fe=V(()=>b("dashboard.empty-title")),ae=V(()=>b("dashboard.empty-add-widget")),Q=V(()=>({label:b("dashboard.add-widget"),onActivate:qe}));Fi(B,{get title(){return d(fe)},get text(){return d(ae)},get action(){return d(Q)}})}};X(Ct,B=>{ee.pluginLoadError!==null?B(ln):d(cn)?B(jt,1):d(M).length===0&&B(en,2)})}var un=x(Ct,2);{var vn=B=>{tM(B,{get order(){return d(C)},onRemoveRequest:me})},jn=B=>{var fe=fM(),ae=v(fe);_O(ae,{onGridReady:ce,onGridDestroyed:xe,onWidgetRemoved:J,onLayoutChanged:Ze,onWidgetResized:he}),R(B,fe)};X(un,B=>{d(_)?B(vn):B(jn,-1)})}bi(Et,B=>f=B,()=>f),y(()=>Oe(Et,"data-locale",ee.locale)),R(t,Et),Ge()}ht(["click"]);const f_="mndw-sidebar",h_="mndw-sidebar-toggle";var pM=I('<span class="mndw-header__device"> </span>'),gM=I('<header class="mndw-header"><div class="mndw-header__left"><mndw-button><mndw-icon></mndw-icon></mndw-button> <span class="mndw-header__brand">mndw</span> <!></div> <div class="mndw-header__right"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <mndw-button><mndw-icon></mndw-icon></mndw-button> <mndw-button><mndw-icon></mndw-icon> </mndw-button></div></header>',2);function mM(t,e){Fe(e,!0);const n=Lr(),r=va();let i=se(lt(r.matches));Un(()=>{const A=N=>{k(i,N.matches,!0)};return r.addEventListener("change",A),()=>{r.removeEventListener("change",A)}});function s(A){ee.localeSwitchPending||n.locale.setLocale(A.detail.value).catch(()=>{})}async function o(){try{await new Promise(A=>{n.rci.logout().subscribe({next:()=>A(),error:()=>A()})})}finally{Tc()}}var a=gM(),l=v(a),c=v(l);y(()=>P(c,"id",h_)),P(c,"variant","ghost"),Ne(c,1,"mndw-header__menu-toggle"),y(()=>P(c,"aria-label",b("nav.toggle-menu"))),y(()=>P(c,"aria-expanded",d(i)?ee.mobileSidebarOpen:!ee.desktopSidebarCollapsed)),y(()=>P(c,"aria-controls",f_));var u=v(c);P(u,"name","menu");var f=x(c,4);{var h=A=>{var N=pM(),z=v(N);y(()=>S(z,ee.deviceInfo.deviceName)),R(A,N)};X(f,A=>{ee.deviceInfo&&A(h)})}var p=x(l,2),g=v(p);Ne(g,1,"mndw-header__locale-select"),y(()=>P(g,"label",b("nav.language"))),y(()=>P(g,"value",ee.locale)),y(()=>P(g,"aria-busy",String(ee.localeSwitchPending)));var m=v(g);P(m,"value","en");var _=x(m,2);P(_,"value","ru");var w=x(g,2);P(w,"variant","ghost"),Ne(w,1,"mndw-header__theme-toggle"),y(()=>P(w,"title",ee.theme==="dark"?b("nav.light-theme"):b("nav.dark-theme"))),y(()=>P(w,"aria-label",b("nav.color-theme")));var E=v(w);y(()=>P(E,"name",ee.theme==="dark"?"sun":"moon"));var M=x(w,2);P(M,"variant","ghost"),Ne(M,1,"mndw-header__logout");var C=v(M);P(C,"name","log-out");var O=x(C);y(A=>{Oe(a,"data-locale",ee.locale),S(O,` ${A??""}`)},[()=>b("nav.logout")]),ge("click",c,function(...A){Su==null||Su.apply(this,A)}),kt("mndwchange",g,s),ge("click",w,function(...A){hs==null||hs.apply(this,A)}),ge("click",M,o),R(t,a),Ge()}ht(["click"]);const Cu=(t,e)=>{let n=null,r=!1,i=!1,s=e;const o=a=>{s=a,r=(a==null?void 0:a.enabled)??!0,r&&!n?t.hasAttribute("inert")?queueMicrotask(()=>{r&&!i&&!n&&!t.hasAttribute("inert")&&(n=Ou(t,s))}):n=Ou(t,s):!r&&n&&(n.deactivate(),n=null)};return o(e),{update:o,destroy(){i=!0,n==null||n.deactivate(),n=null}}};function Gf(t){const e=t.getPages().map(i=>({name:i.entry.name,label:i.entry.label,route:i.entry.route,status:"loaded"})),n=new Set(e.map(({name:i})=>i)),r=Object.entries(Pc()).flatMap(([i,s])=>!s.runnable||s.status!=="failed"&&s.status!=="loading"||s.type!=="page"||s.route===void 0||n.has(i)?[]:[{name:i,label:s.label,route:s.route,status:s.status}]);return[...e,...r].sort((i,s)=>i.label.localeCompare(s.label)||i.name.localeCompare(s.name))}var vM=I('<div class="mndw-sidebar-backdrop" role="presentation"></div>'),bM=I('<mndw-icon></mndw-icon> <span class="mndw-visually-hidden svelte-mfxfye"> </span>',3),_M=I("<a> <!></a>"),wM=I('<div class="mndw-sidebar__section-label"> </div> <!>',1),yM=I('<!> <nav><a> </a> <a> </a> <!> <div class="mndw-sidebar__spacer"></div> <a> </a></nav>',1);function kM(t,e){Fe(e,!0);const n=Lr().registry,r=va();let i=se(lt(r.matches)),s;const o=V(()=>d(i)?!ee.mobileSidebarOpen:ee.desktopSidebarCollapsed);let a=Ei(()=>d(i)?!ee.mobileSidebarOpen:ee.desktopSidebarCollapsed);const l=q=>{k(i,q.matches,!0)},c=V(()=>Gf(n).map(q=>({...q,failed:q.status!=="loaded"}))),u=V(()=>(It==null?void 0:It.route.pathname)??globalThis.location.pathname);function f(q){return(q.length>1&&q.endsWith("/")?q.slice(0,-1):q).toLowerCase()}function h(q){const Z=f(d(u)),J=f(q);return J==="/"?Z==="/":Z===J||Z.startsWith(`${J}/`)}function p(){d(i)&&(ee.mobileSidebarOpen=!1)}function g(q){q.key==="Escape"&&d(i)&&ee.mobileSidebarOpen&&(ee.mobileSidebarOpen=!1)}Un(()=>(r.addEventListener("change",l),()=>{r.removeEventListener("change",l)})),Kn(()=>{var J;const q=d(o),Z=a;a=q,!Z&&q&&(s!=null&&s.contains(document.activeElement))&&((J=document.getElementById(h_))==null||J.focus())});var m=yM();kt("keydown",Ho,g);var _=tt(m);{var w=q=>{var Z=vM();ge("click",Z,p),R(q,Z)};X(_,q=>{d(i)&&ee.mobileSidebarOpen&&q(w)})}var E=x(_,2);let M;var C=v(E);let O;var A=v(C),N=x(C,2);let z;var D=v(N),G=x(N,2);{var K=q=>{var Z=wM(),J=tt(Z),me=v(J),ce=x(J,2);xt(ce,17,()=>d(c),Ee=>Ee.name,(Ee,xe)=>{var Ze=_M();let he;var pe=v(Ze),De=x(pe);{var qe=Y=>{var ke=bM(),$=tt(ke);Ne($,1,"mndw-sidebar__warning svelte-mfxfye"),P($,"name","circle-alert"),y(()=>P($,"title",b("nav.page-load-failed"))),P($,"aria-hidden","true");var ie=x($,2),le=v(ie);y(Te=>S(le,Te),[()=>b("nav.page-load-failed")]),R(Y,ke)};X(De,Y=>{d(xe).failed&&Y(qe)})}y((Y,ke)=>{Oe(Ze,"href",d(xe).route),he=Ne(Ze,1,"mndw-sidebar__link",null,he,Y),Oe(Ze,"aria-current",ke),S(pe,`${d(xe).label??""} `)},[()=>({active:h(d(xe).route)}),()=>h(d(xe).route)?"page":void 0]),ge("click",Ze,p),R(Ee,Ze)}),y(Ee=>S(me,Ee),[()=>b("nav.plugins")]),R(q,Z)};X(G,q=>{d(c).length>0&&q(K)})}var oe=x(G,4);let re;var ye=v(oe);bi(E,q=>s=q,()=>s),Ws(E,(q,Z)=>Cu==null?void 0:Cu(q,Z),()=>({enabled:d(i)&&ee.mobileSidebarOpen})),y((q,Z,J,me,ce,Ee,xe,Ze,he)=>{Oe(E,"id",f_),M=Ne(E,1,"mndw-sidebar",null,M,{collapsed:!d(i)&&ee.desktopSidebarCollapsed,"mobile-collapsed":d(i)&&!ee.mobileSidebarOpen}),Oe(E,"data-locale",ee.locale),E.inert=d(o),Oe(C,"href",ut.dashboard),O=Ne(C,1,"mndw-sidebar__link",null,O,q),Oe(C,"aria-current",Z),S(A,J),Oe(N,"href",ut.packages),z=Ne(N,1,"mndw-sidebar__link",null,z,me),Oe(N,"aria-current",ce),S(D,Ee),Oe(oe,"href",ut.settings),re=Ne(oe,1,"mndw-sidebar__link",null,re,xe),Oe(oe,"aria-current",Ze),S(ye,he)},[()=>({active:h(ut.dashboard)}),()=>h(ut.dashboard)?"page":void 0,()=>b("nav.dashboard"),()=>({active:h(ut.packages)}),()=>h(ut.packages)?"page":void 0,()=>b("nav.package-manager"),()=>({active:h(ut.settings)}),()=>h(ut.settings)?"page":void 0,()=>b("nav.settings")]),ge("click",C,p),ge("click",N,p),ge("click",oe,p),R(t,m),Ge()}ht(["click"]);var EM=I('<div class="mndw-alert mndw-alert--danger mndw-plugin-load-alert svelte-1bwqjg3" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),SM=I('<div class="mndw-app-shell"><!> <!> <div class="mndw-app-shell__body"><!> <main class="mndw-app-shell__content"><!></main></div></div>');function TM(t,e){Fe(e,!0);const n=Lr();let r=se(void 0);function i(){var w;const g=document.activeElement;if(g===null)return!1;const m=g.getRootNode(),_=m instanceof ShadowRoot?m.host:g;return((w=d(r))==null?void 0:w.contains(_))??!1}async function s(){var w,E,M;if(ee.authInitInFlight)return;const g=i();let m,_;try{const C=Wf(n,{preservePluginLoadError:!0});_=Nr(),m=await C}catch{(_===void 0||_===Nr())&&Tc();return}if(!(m===void 0||m!==Nr())){if(ee.ready&&ee.pluginLoadError===null)ee.pluginLoadRevision+=1;else if(ee.pluginLoadError!==null&&(ee.pluginLoadFailureSeq+=1,g)){await Oo();const C=(w=d(r))==null?void 0:w.querySelector("mndw-button");(M=(E=C==null?void 0:C.shadowRoot)==null?void 0:E.querySelector("button"))==null||M.focus()}}}var o=SM(),a=v(o);mM(a,{});var l=x(a,2);{var c=g=>{var m=Bn(),_=tt(m);gm(_,()=>ee.pluginLoadFailureSeq,w=>{var E=EM(),M=v(E),C=v(M),O=x(M,2);P(O,"variant","secondary"),y(()=>P(O,"disabled",ee.authInitInFlight)),y(()=>P(O,"aria-busy",ee.authInitInFlight));var A=v(O);bi(E,N=>k(r,N),()=>d(r)),y((N,z)=>{S(C,N),S(A,z)},[()=>b("app.plugin-load-error"),()=>b("common.retry")]),ge("click",O,s),R(w,E)}),R(g,m)};X(l,g=>{ee.authenticated&&ee.pluginLoadError==="list"&&g(c)})}var u=x(l,2),f=v(u);kM(f,{});var h=x(f,2),p=v(h);My(p,()=>e.children),R(t,o),Ge()}ht(["click"]);function Pd(t){return t==="/"?"":t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Fa(t,e){return new _d("INVALID_PATH",`Invalid page child path "${t}"`,{cause:e})}function xM(t){if(t===""||t==="/")return"";if(!t.startsWith("/")||t.startsWith("//")||t.includes("?")||t.includes("#"))throw Fa(t);const e=Pd(t);if(e==="")return"";const n=e.slice(1).split("/"),r=n.length-1;for(const[i,s]of n.entries()){if(s===""){if(i!==r)throw Fa(t);continue}let o;try{o=decodeURIComponent(s)}catch(a){throw Fa(t,a)}if(o==="."||o===".."||o.includes("/")||o.includes("\\"))throw Fa(t)}return e}class PM{constructor(e,n,r){W(this,"baseRoute");W(this,"deps");W(this,"childPathSubject");W(this,"currentChildPath");W(this,"completed",!1);W(this,"navigationSerial",0);W(this,"pageRoute");this.baseRoute=e,this.deps=r,this.currentChildPath=Pd(n),this.childPathSubject=new Y_(this.currentChildPath),this.pageRoute=Object.freeze({childPath$:this.childPathSubject.asObservable(),navigate:(i,s)=>this.navigate(i,s)})}setPath(e){if(this.completed)return;const n=Pd(e);n!==this.currentChildPath&&(this.currentChildPath=n,this.childPathSubject.next(n))}complete(){this.completed||(this.completed=!0,this.childPathSubject.complete())}async navigate(e,n){if(this.completed)throw new _d("COMPLETED","Page route is no longer active");const r=xM(e);if(r===this.currentChildPath)return;const i=++this.navigationSerial,s=this.deps.getLocation();try{await this.deps.navigate(`${this.baseRoute}${r}`,{replace:(n==null?void 0:n.replace)??!1,search:s.search,hash:s.hash,scrollToTop:(n==null?void 0:n.scrollToTop)===!1?!1:"auto"})}catch(o){throw new _d("NAVIGATION_FAILED",`Navigation to "${r}" failed`,{cause:o})}!this.completed&&i===this.navigationSerial&&this.setPath(r)}}var CM=I('<div class="mndw-page-plugin__notice"> </div>'),RM=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4"><span> </span> <mndw-button> </mndw-button></div>',2),AM=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"> </div>'),OM=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"><span> </span> <mndw-button> </mndw-button></div>',2),MM=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),NM=I('<div class="mndw-page-plugin-wrap"><!> <div class="mndw-page-plugin"></div></div>');function Yp(t,e){Fe(e,!0);const n={clearStorage:!1,closeReason:"host-navigation"};let r,i=null,s=0,o=null,a=se("none"),l=se(null),c,u;const f=Lr(),h=f.registry,p={locale:f.locale,palette:f.palette,telemetry:f.telemetry,telemetryGathering:f.telemetryGathering,eventStream:f.eventStream,navigation:xa};function g(Y){return r=Y,{destroy(){r=void 0}}}const m=V(()=>Zf(It.route.pathname,vg())),_=V(()=>{var Y;return((Y=d(m))==null?void 0:Y.name)??null}),w=V(()=>d(_)===null?"ready":Sc(d(_))),E=V(()=>d(_)===null?void 0:yn(d(_))),M=V(()=>{var Y;return((Y=d(E))==null?void 0:Y.status)==="loading"}),C=V(()=>{var Y;return((Y=d(E))==null?void 0:Y.status)==="failed"}),O=V(()=>d(w)==="ready"&&!d(M)&&!d(C)?d(_):null),A=V(()=>{var Y,ke;return((Y=d(E))==null?void 0:Y.label)??(d(_)===null?"":((ke=h.get(d(_)))==null?void 0:ke.entry.label)??"")}),N=V(()=>{var Y;return ee.locale,((Y=d(l))==null?void 0:Y.entry.label)??""}),z=V(()=>d(M)||d(a)==="pending"||d(a)==="loading"||d(a)==="slow");async function D(){var Y;d(_)!==null&&((Y=d(E))==null?void 0:Y.runnable)===!0&&!d(M)&&await Us(d(_))}function G(){c!==void 0&&(clearTimeout(c),c=void 0),u!==void 0&&(clearTimeout(u),u=void 0)}function K(){G(),k(a,"none"),k(l,null)}function oe(Y,ke){G(),k(a,"pending"),k(l,ke),c=setTimeout(()=>{Y===s&&d(a)==="pending"&&k(a,"loading")},XP),u=setTimeout(()=>{Y===s&&(d(a)==="pending"||d(a)==="loading")&&k(a,"slow")},JP)}function re(){var Y;s+=1,K(),o!==null&&(o.controller.complete(),(Y=o.mount)==null||Y.dispose(n),o.unsubscribeTheme(),o.child.remove(),o=null)}function ye(Y){var $;if(i=Y,Y===null)return;const ke=h.get(Y);r===void 0||ke===void 0||ke.entry.type!=="page"||q(ke,(($=d(m))==null?void 0:$.name)===Y?d(m).childPath:"")}function q(Y,ke,$="full"){if(r===void 0)return Promise.resolve(!1);s+=1;const ie=s,le=document.createElement("div");le.className="mndw-page-plugin__mount",le.dataset.theme=Ls();const Te=Ec(Qe=>{le.dataset.theme=Qe});r.appendChild(le);const Ke=vg().find(Qe=>Qe.name===Y.entry.name);if(Ke===void 0)return Te(),le.remove(),Promise.resolve(!1);oe(ie,Y);const Xe=new PM(Ke.route,ke,{navigate:(Qe,$t)=>It.navigate(Qe,$t),getLocation:()=>({search:globalThis.location.search,hash:globalThis.location.hash})}),wt={generation:ie,pluginName:Y.entry.name,child:le,controller:Xe,mount:null,unsubscribeTheme:Te};o=wt,ee.hostInfo;const Et=ee.deviceInfo??Tf,Re=jf({entry:Y.entry,instanceId:`${Y.entry.name}:1`,deviceInfo:Et,pageRoute:Xe.pageRoute,catalogCell:Y.catalog,services:p}),Je=e_(le,Y,Re);return wt.mount=Je,Je.whenReady().then(Qe=>(ie!==s?le.remove():(G(),Qe?(k(a,"none"),k(l,null)):$==="full"?(le.replaceChildren(),k(a,"error")):(k(a,"none"),k(l,null))),Qe))}async function Z(Y,ke){var $,ie;return re(),await q(Y,(($=d(m))==null?void 0:$.childPath)??"","loading-only")?!0:(re(),await q(ke,((ie=d(m))==null?void 0:ie.childPath)??"","full"),!1)}function J(){re(),ye(d(O))}function me(Y){const{detail:ke}=Y;o===null||ke.pluginName!==i||ke.register(Z(ke.next,ke.prior))}Kn(()=>{d(O)!==i&&(re(),ye(d(O)))}),Kn(()=>{const Y=d(m);Y!==null&&(o==null?void 0:o.pluginName)===Y.name&&o.controller.setPath(Y.childPath)}),Kn(()=>(window.addEventListener(Ed,me),()=>window.removeEventListener(Ed,me))),Si(re);var ce=NM(),Ee=v(ce);{var xe=Y=>{var ke=CM(),$=v(ke);y(ie=>{Oe(ke,"role",d(w)==="failed"?"alert":"status"),S($,ie)},[()=>d(w)==="installing"?b("dashboard.preparing-dependencies"):b("dashboard.dependency-install-failed")]),R(Y,ke)},Ze=Y=>{var ke=RM(),$=v(ke),ie=v($),le=x($,2);P(le,"variant","secondary"),y(()=>P(le,"disabled",d(M))),y(()=>P(le,"aria-busy",d(M)?"true":void 0));var Te=v(le);y((Ke,Xe)=>{Oe(ke,"role",d(M)?"status":"alert"),S(ie,Ke),S(Te,Xe)},[()=>b("page-plugin.load-failed",{title:d(A)}),()=>b("common.retry")]),ge("click",le,D),R(Y,ke)},he=Y=>{var ke=AM(),$=v(ke);y(ie=>S($,ie),[()=>b("page-plugin.opening",{title:d(N)})]),R(Y,ke)},pe=Y=>{var ke=OM(),$=v(ke),ie=v($),le=x($,2);P(le,"variant","secondary");var Te=v(le);y((Ke,Xe)=>{S(ie,Ke),S(Te,Xe)},[()=>b("page-plugin.slow"),()=>b("common.retry")]),ge("click",le,J),R(Y,ke)},De=Y=>{var ke=MM(),$=v(ke),ie=v($),le=x($,2);P(le,"variant","secondary");var Te=v(le);y((Ke,Xe)=>{S(ie,Ke),S(Te,Xe)},[()=>b("page-plugin.open-error",{title:d(N)}),()=>b("common.retry")]),ge("click",le,J),R(Y,ke)};X(Ee,Y=>{d(_)!==null&&d(w)!=="ready"?Y(xe):d(C)||d(M)?Y(Ze,1):d(a)==="loading"?Y(he,2):d(a)==="slow"?Y(pe,3):d(a)==="error"&&Y(De,4)})}var qe=x(Ee,2);Ws(qe,Y=>g==null?void 0:g(Y)),y(()=>Oe(qe,"aria-busy",d(z)?"true":void 0)),R(t,ce),Ge()}ht(["click"]);Nw();function Ea(t,e){return()=>{let n,r,i;const s=o=>{if(n!==void 0){if(i===void 0){const a=lt({row:o.row,value:o.value,colId:o.colId}),l=Object.assign(a,e(a));i=l,r=rc(t,{target:n,props:l});return}i.row=o.row,i.value=o.value,i.colId=o.colId}};return{mount(o){n=o.node,s(o)},update(o){s(o)},destroy(){r!==void 0&&(Kd(r),r=void 0),n=void 0,i=void 0}}}}function Do(){return t=>Ea(t,()=>({}))}const En=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Zr=t=>typeof t=="string"&&t.length>0,To=Object.freeze({"X-Mndw-Csrf":"1"}),IM=async t=>{try{return await t.json()}catch{return}};function LM(t,e){const n=En(t)?t:void 0,r=n==null?void 0:n.error,i=En(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:Zr(s)?s:"UNKNOWN",message:Zr(o)?o:e,detail:i==null?void 0:i.detail}}class Sa extends Error{constructor(n,r,i,s){super(n);W(this,"code");W(this,"detail");W(this,"status");this.name="HostApiError",this.code=r,this.detail=i,this.status=s}}function zM(t){const e={};if(t instanceof Headers)return t.forEach((n,r)=>{e[r]=n}),e;if(Array.isArray(t)){for(const[n,r]of t)e[n]=r;return e}return t!==void 0&&Object.assign(e,t),e}function Xp(t,e,n){const r=Object.keys(t).find(i=>i.toLowerCase()===e.toLowerCase());t[r??e]=n}function ft(t){return t("Malformed response","UNKNOWN")}function Ta(t,e){const n=()=>ft(e);async function r(o){try{return await o.json()}catch{throw n()}}async function i(o){const a=LM(await IM(o),o.statusText);return e(a.message,a.code,a.detail,o.status)}return{request:(async(o,a={})=>{var w;const{csrf:l,json:c,response:u,...f}=a,h=((w=f.method)==null?void 0:w.toUpperCase())??"GET",p=h!=="GET"&&h!=="HEAD"||l===!0,g=Object.prototype.hasOwnProperty.call(a,"json"),m={...f};if(g&&(m.body=JSON.stringify(c)),p||g){const E=zM(f.headers);if(g&&Xp(E,"Content-Type","application/json"),p)for(const[M,C]of Object.entries(To))Xp(E,M,C);m.headers=E}const _=await t(o,m);if(!_.ok)throw await i(_);return u==="raw"?_:await r(_)}),parseJson:r,malformed:n,errorFromResponse:i}}class xo extends Sa{constructor(e,n,r,i){super(e,n,r,i),this.name="OpkgError"}}const Cn=(t,e,n,r)=>new xo(t,e,n,r);function DM(t){if(t.code!=="DEPENDENCY_CONFLICT"||!En(t.detail))return;const e=t.detail.package,n=t.detail.dependents;if(typeof e!="string"||e.length===0)return;const r=Array.isArray(n)&&n.every(i=>typeof i=="string");return{package:e,dependents:r?n:[]}}function HM(t){if(!En(t))throw ft(Cn);const e=t.name,n=t.version,r=t.description,i=t.status,s=t.newVersion,o=i==="installed"||i==="update_available"||i==="available";if(typeof e!="string"||e.length===0||typeof n!="string"||typeof r!="string"||!o||(i==="available"||i==="update_available")&&n.length===0)throw ft(Cn);if(i==="update_available"){if(typeof s!="string"||s.length===0)throw ft(Cn)}else if(s!==void 0)throw ft(Cn);return{name:e,version:n,description:r,status:i,...s===void 0?{}:{newVersion:s}}}function BM(t){if(!En(t)||!Array.isArray(t.packages))throw ft(Cn);const e=t.metadataUpdatedAt;if(e!==null&&typeof e!="string"||typeof e=="string"&&Number.isNaN(Date.parse(e)))throw ft(Cn);return{packages:t.packages.map(n=>HM(n)),metadataUpdatedAt:e}}function UM(t){if(!En(t))throw ft(Cn);const e=t.status;if(typeof t.name!="string"||t.name.length===0||typeof t.version!="string"||typeof t.description!="string"||!Array.isArray(t.dependencies)||!t.dependencies.every(o=>typeof o=="string")||e!=="installed"&&e!=="update_available"&&e!=="available")throw ft(Cn);const n=["size","installedSize","installedTime"];for(const o of n)if(t[o]!==void 0&&typeof t[o]!="string")throw ft(Cn);const r=typeof t.size=="string"?t.size:void 0,i=typeof t.installedSize=="string"?t.installedSize:void 0,s=typeof t.installedTime=="string"?t.installedTime:void 0;return{name:t.name,version:t.version,description:t.description,dependencies:t.dependencies,status:e,...r===void 0?{}:{size:r},...i===void 0?{}:{installedSize:i},...s===void 0?{}:{installedTime:s}}}function $M(t){if(!En(t)||t.ok!==!0||typeof t.message!="string"||!Array.isArray(t.packages)||!t.packages.every(e=>typeof e=="string"))throw ft(Cn);return{message:t.message,packages:t.packages}}function jM(t){if(!En(t)||t.ok!==!0||typeof t.message!="string")throw ft(Cn);return{message:t.message}}function FM(t=globalThis.fetch){const e=Ta(t,Cn);async function n(r,i){const s=await e.request(r,{method:"POST",json:{packages:i}});return $M(s)}return{async list(){const r=await e.request(uC,{method:"GET"});return BM(r)},async info(r){const i=new URLSearchParams({name:r}),s=await e.request(`${gC}?${i.toString()}`,{method:"GET"});return UM(s)},install:r=>n(dC,r),remove:r=>n(fC,r),upgrade:r=>n(pC,r),async update(){const r=await e.request(hC,{method:"POST",json:{}});return jM(r)}}}const ns=FM();var GM=I('<span class="package-name svelte-84q0nr"> </span>');function VM(t,e){var n=GM(),r=v(n);y(()=>{Oe(n,"title",e.value),S(r,e.value)}),R(t,n)}var ZM=I('<span class="new-version svelte-sgt4ns"> </span>'),WM=I('<span class="ver-value svelte-sgt4ns"> </span><!>',1);function qM(t,e){Fe(e,!0);var n=WM(),r=tt(n),i=v(r),s=x(r);{var o=a=>{var l=ZM(),c=v(l);y(()=>S(c,`→ ${e.row.newVersion??""}`)),R(a,l)};X(s,a=>{e.row.newVersion&&a(o)})}y(()=>{Oe(r,"data-col",e.colId),Oe(r,"title",e.value),S(i,e.value)}),R(t,n),Ge()}var KM=I("<span> </span>");function YM(t,e){Fe(e,!0);const n=V(()=>e.value==="update_available"?b("packages.update-available"):e.value==="available"?b("packages.available"):e.value);var r=KM(),i=v(r);y(()=>{Ne(r,1,`badge badge-${e.value??""}`,"svelte-tq54e2"),Oe(r,"data-col",e.colId),S(i,d(n))}),R(t,r),Ge()}var XM=I("<mndw-button> </mndw-button>",2);function JM(t,e){Fe(e,!0);const n=V(()=>e.row.name==="mndw"||e.row.name==="lighttpd"),r=V(()=>e.row.status==="available"?"install":e.row.status==="update_available"?"upgrade":"remove"),i=V(()=>d(r)==="install"?b("packages.install"):d(r)==="upgrade"?b("packages.update"):b("packages.remove"));var s=XM();y(()=>P(s,"variant",d(r)==="remove"?"secondary":"primary")),y(()=>P(s,"data-package",e.row.name)),P(s,"data-package-action","primary"),P(s,"data-no-expand",!0),y(()=>P(s,"disabled",d(r)==="remove"&&d(n))),y(()=>P(s,"title",d(n)?b("packages.protected"):void 0));var o=v(s);y(()=>S(o,d(i))),ge("click",s,()=>e.onAction(d(r))),R(t,s),Ge()}ht(["click"]);function QM(t){return Ea(JM,e=>({onAction:n=>t(n,e.row.name)}))}var eN=I("<p> </p>"),tN=I('<p role="alert"> </p> <mndw-button> </mndw-button>',3),Ga=I('<dt class="svelte-uhnzp9"> </dt><dd class="svelte-uhnzp9"> </dd>',1),nN=I('<dl class="svelte-uhnzp9"><dt class="svelte-uhnzp9"> </dt> <dd class="svelte-uhnzp9"> </dd> <!> <!> <!> <!></dl>'),rN=I("<mndw-button> </mndw-button>",2),iN=I('<div class="detail svelte-uhnzp9"><!> <!></div>');function sN(t,e){Fe(e,!0);let n=V(()=>e.value.name);const r=V(()=>e.row.name==="mndw"||e.row.name==="lighttpd");let i=V(()=>e.cache.get(d(n)));Kn(()=>{e.load(d(n))});var s=iN(),o=v(s);{var a=h=>{var p=eN(),g=v(p);y(m=>S(g,m),[()=>b("packages.loading")]),R(h,p)},l=h=>{var p=tN(),g=tt(p),m=v(g),_=x(g,2);P(_,"variant","secondary");var w=v(_);y(E=>{S(m,d(i).message),S(w,E)},[()=>b("common.retry")]),ge("click",_,()=>e.retry(d(n))),R(h,p)},c=h=>{var p=nN(),g=v(p),m=v(g),_=x(g,2),w=v(_),E=x(_,2);{var M=G=>{var K=Ga(),oe=tt(K),re=v(oe),ye=x(oe),q=v(ye);y(Z=>{S(re,Z),S(q,d(i).info.size)},[()=>b("packages.size")]),R(G,K)};X(E,G=>{d(i).info.size&&G(M)})}var C=x(E,2);{var O=G=>{var K=Ga(),oe=tt(K),re=v(oe),ye=x(oe),q=v(ye);y(Z=>{S(re,Z),S(q,d(i).info.installedSize)},[()=>b("packages.installed-size")]),R(G,K)};X(C,G=>{d(i).info.installedSize&&G(O)})}var A=x(C,2);{var N=G=>{var K=Ga(),oe=tt(K),re=v(oe),ye=x(oe),q=v(ye);y(Z=>{S(re,Z),S(q,d(i).info.installedTime)},[()=>b("packages.installed-time")]),R(G,K)};X(A,G=>{d(i).info.installedTime&&G(N)})}var z=x(A,2);{var D=G=>{var K=Ga(),oe=tt(K),re=v(oe),ye=x(oe),q=v(ye);y((Z,J)=>{S(re,Z),S(q,J)},[()=>b("packages.dependencies"),()=>d(i).info.dependencies.join(", ")]),R(G,K)};X(z,G=>{d(i).info.dependencies.length>0&&G(D)})}y(G=>{S(m,G),S(w,d(i).info.description)},[()=>b("packages.description")]),R(h,p)};X(o,h=>{var p;((p=d(i))==null?void 0:p.status)==="pending"||d(i)===void 0?h(a):d(i).status==="failure"?h(l,1):d(i).status==="success"&&h(c,2)})}var u=x(o,2);{var f=h=>{var p=rN();P(p,"variant","secondary"),y(()=>P(p,"data-package",d(n))),P(p,"data-package-action","detail"),P(p,"data-no-expand",!0);var g=v(p);y(m=>S(g,m),[()=>b("packages.remove")]),ge("click",p,()=>e.onRemove()),R(h,p)};X(u,h=>{e.row.status==="update_available"&&!d(r)&&h(f)})}y(()=>{Oe(s,"data-col",e.colId),Oe(s,"data-package",d(n))}),R(t,s),Ge()}ht(["click"]);function oN(t){return Ea(sN,e=>({cache:t.cache,load:t.load,retry:t.retry,onRemove:()=>t.onRemove(e.row.name)}))}const Jp=/[.\-+]/,Qp=t=>t.length>0&&/^[0-9]+$/.test(t);function aN(t,e){const n=t.split(Jp),r=e.split(Jp),i=Math.min(n.length,r.length);for(let s=0;s<i;s+=1){const o=n[s],a=r[s];if(o!==a)if(Qp(o)&&Qp(a)){const l=Number(o)-Number(a);if(l!==0)return l<0?-1:1}else{const l=o.localeCompare(a);if(l!==0)return l<0?-1:1}}return n.length-r.length}var lN=I('<div class="confirm-modal svelte-erapy5"><p class="svelte-erapy5"> </p> <div class="actions svelte-erapy5"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function jl(t,e){Fe(e,!0);var n=lN(),r=v(n),i=v(r),s=x(r,2),o=v(s);P(o,"variant","secondary");var a=v(o),l=x(o,2);P(l,"variant","danger");var c=v(l);y(u=>{S(i,e.message),S(a,u),S(c,e.confirmLabel)},[()=>b("common.cancel")]),ge("click",o,()=>e.close(!1)),ge("click",l,()=>e.close(!0)),R(t,n),Ge()}ht(["click"]);var cN=I('<span class="selected-count svelte-m3c4ux"> </span>'),uN=I('<div class="bulk-bar mndw-table-controls svelte-m3c4ux"><span class="bulk-label svelte-m3c4ux"> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button> <!></div>',2),dN=I('<div class="msg-cell svelte-m3c4ux" role="status"> </div>'),fN=I('<div class="mndw-alert mndw-alert--danger package-load-error svelte-m3c4ux" role="alert"><p class="svelte-m3c4ux"> </p> <mndw-button> </mndw-button></div>',2),hN=I("<mndw-table></mndw-table>",2),pN=I('<section class="packages-panel svelte-m3c4ux"><div class="header-row mndw-table-controls svelte-m3c4ux"><div><h1 class="svelte-m3c4ux"> </h1> <span> </span></div> <div class="header-actions svelte-m3c4ux"><mndw-button> </mndw-button></div></div> <div class="filter-row mndw-table-controls svelte-m3c4ux"><mndw-field><mndw-input></mndw-input></mndw-field> <mndw-tabs><mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab></mndw-tabs></div> <!> <div class="table-wrap svelte-m3c4ux"><!></div></section>',2);function gN(t,e){Fe(e,!0);const n="packages.list",r="packages.refresh";function i(U){return`packages.${U}`}let s=Xt(e,"now",3,()=>new Date),o=se(lt([])),a=se(null),l=se(null),c=new _l,u=se(""),f=se("installed"),h=se(!1),p=se(!1),g=se(""),m=se(null),_,w=0,E=!1;Si(()=>{E=!0});const M=new Zi;let C=0;const O=V(()=>d(o).filter(U=>d(f)==="installed"&&U.status==="available"||d(f)==="updates"&&U.status!=="update_available"?!1:U.name.toLowerCase().includes(d(u).toLowerCase()))),A=V(()=>c.size),N=V(()=>d(o).filter(U=>U.status==="update_available").length),z=V(()=>[...c]),D=V(()=>d(O).some(U=>c.has(U.name)&&U.status==="available")),G=V(()=>d(O).some(U=>c.has(U.name)&&U.status!=="available"&&!q(U.name))),K=V(()=>d(O).some(U=>c.has(U.name)&&U.status==="update_available")),oe=V(()=>{if(d(a)===null)return b("packages.never-refreshed");if(d(l)===null)return"";const U=Math.max(0,d(l).getTime()-Date.parse(d(a)));if(U<6e4)return b("packages.just-now");const ne=new Intl.RelativeTimeFormat(ee.locale,{numeric:"auto"}),L=Math.floor(U/6e4);if(L<60)return b("packages.refreshed-ago",{age:ne.format(-L,"minute")});const te=Math.floor(U/36e5);if(te<24)return b("packages.refreshed-ago",{age:ne.format(-te,"hour")});const ue=Math.floor(U/864e5);return b("packages.refreshed-ago",{age:ne.format(-ue,"day")})}),re=V(()=>d(a)===null||d(l)===null?!1:d(l).getTime()-Date.parse(d(a))>3600*1e3);async function ye(){k(u,""),k(f,"all"),await Oo(),_==null||_.focus()}function q(U){return U==="mndw"||U==="lighttpd"}function Z(){C+=1,M.clear()}function J(U){if(M.has(U))return;const ne=C,L=ns.info(U);M.set(U,{status:"pending",promise:L}),L.then(te=>{var ue;ne===C&&((ue=M.get(U))==null?void 0:ue.status)==="pending"&&M.set(U,{status:"success",info:te})}).catch(te=>{var ue;ne===C&&((ue=M.get(U))==null?void 0:ue.status)==="pending"&&M.set(U,{status:"failure",message:te instanceof xo?te.message:b("packages.detail-failed")})})}function me(U){var ne;((ne=M.get(U))==null?void 0:ne.status)==="failure"&&(M.delete(U),J(U))}async function ce(U=!1){k(h,!0);try{const ne=await ns.list();if(E)return;k(o,ne.packages,!0),k(a,ne.metadataUpdatedAt,!0),k(l,s()(),!0),Z(),k(p,!1),k(g,""),c.clear(),Ve.dismissKey(n),U||Ve.info(b("packages.loaded",{count:d(o).length}),{key:n})}catch(ne){if(E)return;k(o,[],!0),c.clear(),k(p,!0),k(g,ne instanceof xo?ne.message:b("packages.load-failed"),!0)}finally{E||k(h,!1)}}async function Ee(U,ne){const L=Array.from(c).filter(te=>{const ue=d(o).find(Me=>Me.name===te);return ue!==void 0&&ne(ue)});if(L.length!==0){if(U==="remove"){const ue=await ki(jl,{title:b("packages.confirm-remove-title"),props:{message:b("packages.confirm-remove",{names:L.join(", ")}),confirmLabel:b("packages.remove")}}).closed;if(E)return;ue.result&&await xe("remove",L);return}await xe(U,L)}}async function xe(U,ne,L){k(h,!0);const te=U==="install"?"packages.installing":U==="remove"?"packages.removing":"packages.updating",ue=i(U);try{const Me=U==="install"?await ns.install(ne):U==="remove"?await ns.remove(ne):await ns.upgrade(ne);if(E||(await ce(!0),E))return;Ve.success(Me.message,{key:ue})}catch(Me){if(E)return;Ve.error(he(Me,te),{key:ue})}finally{E||k(h,!1),!E&&L!==void 0&&await Ze(L)}}async function Ze(U){if(await Oo(),E)return;const ne=d(m);ne!==null&&await ne.updateComplete,await Oo();const L=[...document.querySelectorAll("mndw-button[data-package][data-package-action]")].filter(Me=>Me.dataset.package===U.packageName&&!Me.disabled),ue=L.find(Me=>Me.dataset.packageAction===U.source)??L[0]??document.querySelector(".packages-panel .header-actions mndw-button");ue==null||ue.focus()}function he(U,ne){if(!(U instanceof xo))return b("packages.action-failed",{action:b(ne)});const L=DM(U);return L===void 0?U.message:L.dependents.length>0?b("packages.dependency-conflict",{package:L.package,dependents:L.dependents.join(", ")}):b("packages.dependency-conflict-generic",{package:L.package})}async function pe(){k(h,!0);try{const U=await ns.update();if(E||(await ce(!0),E))return;Ve.success(U.message,{key:r})}catch(U){if(E)return;Ve.error(U instanceof xo?U.message:b("app.error"),{key:r})}finally{E||k(h,!1)}}function De(U){const ne=U.detail.value;(ne==="all"||ne==="installed"||ne==="updates")&&k(f,ne,!0)}function qe(U){k(u,U.detail.value,!0)}async function Y(U,ne="primary"){const te=await ki(jl,{title:b("packages.confirm-remove-title"),props:{message:b("packages.confirm-remove",{names:U}),confirmLabel:b("packages.remove")}}).closed;E||te.result&&await xe("remove",[U],{packageName:U,source:ne})}const ke={installed:0,update_available:1,available:2},$=Do()(VM),ie=Do()(qM),le=Do()(YM),Te=oN({cache:M,load:J,retry:me,onRemove:U=>Y(U,"detail")}),Ke=QM((U,ne)=>{if(U==="remove"){Y(ne);return}xe(U,[ne],{packageName:ne,source:"primary"})}),Xe=V(()=>[oi()({id:"name",label:b("packages.package"),accessor:U=>U.name,sortable:!0,width:"11.25rem",renderer:$}),oi()({id:"version",label:b("packages.version"),accessor:U=>U.version,sortable:!0,comparator:aN,renderer:ie}),oi()({id:"status",label:b("packages.status"),accessor:U=>U.status,sortable:!0,comparator:(U,ne)=>ke[U]-ke[ne],renderer:le}),oi()({id:"actions",label:"",renderer:Ke})]);let wt=new _l,Et=se(null);const Re=V(()=>({expandRow:U=>b("packages.expand",{name:U}),collapseRow:U=>b("packages.collapse",{name:U})}));function Je(U){c.clear();for(const ne of U.detail.selected)c.add(ne)}function Qe(U){k(Et,U.detail.sort,!0)}function $t(U){wt.clear();for(const ne of U.detail.expanded)wt.add(ne)}Kn(()=>{const U=new Set(d(O).map(ne=>ne.name));Ei(()=>{const ne=[...wt].filter(L=>!U.has(L));for(const L of ne)wt.delete(L)})}),Kn(()=>{var te;const U=(te=d(O)[0])==null?void 0:te.name,ne=d(m),L=++w;U===void 0||ne===null||(async()=>{var ue;await ne.updateComplete,!(L!==w||((ue=d(O)[0])==null?void 0:ue.name)!==U)&&ne.scrollToRow(U,{align:"start"})})()}),Un(()=>{ce()});var Ct=pN(),ln=v(Ct),jt=v(ln),cn=v(jt),en=v(cn),un=x(cn,2);let vn;var jn=v(un),B=x(jt,2),fe=v(B);P(fe,"variant","secondary"),y(()=>P(fe,"disabled",d(h)));var ae=v(fe),Q=x(ln,2),ze=v(Q);Ne(ze,1,"search-field svelte-m3c4ux"),y(()=>P(ze,"label",b("packages.search-label")));var Be=v(ze);P(Be,"type","search"),y(()=>P(Be,"value",d(u))),y(()=>P(Be,"placeholder",b("packages.search"))),bi(Be,U=>_=U,()=>_);var Rt=x(ze,2);y(()=>P(Rt,"value",d(f)));var nt=v(Rt);P(nt,"id","all");var mt=v(nt),j=x(nt,2);P(j,"id","installed");var we=v(j),Ue=x(j,2);P(Ue,"id","updates");var ct=v(Ue),tn=x(Q,2);{var yr=U=>{var ne=uN(),L=v(ne),te=v(L),ue=x(L,2);P(ue,"variant","primary"),y(()=>P(ue,"disabled",d(h)||!d(D)));var Me=v(ue),it=x(ue,2);P(it,"variant","secondary"),y(()=>P(it,"disabled",d(h)||!d(G)));var At=v(it),Ot=x(it,2);P(Ot,"variant","primary"),y(()=>P(Ot,"disabled",d(h)||!d(K)));var Yt=v(Ot),Ft=x(Ot,2);{var Mt=st=>{var Nt=cN(),bn=v(Nt);y(Fn=>S(bn,Fn),[()=>b("packages.selected",{count:d(A)})]),R(st,Nt)};X(Ft,st=>{d(A)>0&&st(Mt)})}y((st,Nt,bn,Fn)=>{S(te,st),S(Me,Nt),S(At,bn),S(Yt,Fn)},[()=>b("packages.with-selected"),()=>b("packages.install"),()=>b("packages.remove"),()=>b("packages.update")]),ge("click",ue,()=>void Ee("install",st=>st.status==="available")),ge("click",it,()=>void Ee("remove",st=>st.status!=="available"&&!q(st.name))),ge("click",Ot,()=>void Ee("upgrade",st=>st.status==="update_available")),R(U,ne)};X(tn,U=>{d(A)>0&&U(yr)})}var Xi=x(tn,2),Qs=v(Xi);{var ve=U=>{var ne=dN(),L=v(ne);y(te=>S(L,te),[()=>b("packages.loading")]),R(U,ne)},Pe=U=>{var ne=fN(),L=v(ne),te=v(L),ue=x(L,2);P(ue,"variant","secondary");var Me=v(ue);y(it=>{S(te,d(g)),S(Me,it)},[()=>b("common.retry")]),ge("click",ue,()=>void ce()),R(U,ne)},rt=U=>{{let ne=V(()=>b(d(o).length===0?"packages.empty":"packages.no-match")),L=V(()=>b(d(o).length===0?"packages.empty-next":"packages.no-match-next")),te=V(()=>d(o).length===0?{label:b("packages.refresh"),onActivate:()=>void ce(),variant:"secondary"}:{label:b("packages.show-all"),onActivate:ye,variant:"secondary"});Fi(U,{mode:"compact",get title(){return d(ne)},get text(){return d(L)},get action(){return d(te)}})}},dt=U=>{var ne=hN();y(()=>P(ne,"columns",d(Xe))),y(()=>P(ne,"rows",d(O))),P(ne,"rowKey","name"),P(ne,"virtual",!0),P(ne,"rowLabel",L=>L.name),P(ne,"selectable",!0),y(()=>P(ne,"selected",d(z))),P(ne,"expandable",!0),P(ne,"toggleAfterColumn","name"),P(ne,"expandOn","row"),y(()=>P(ne,"expanded",[...wt])),y(()=>P(ne,"expandedRenderer",Te)),P(ne,"columnMenu",!1),P(ne,"sortMode","client"),y(()=>P(ne,"sort",d(Et))),y(()=>P(ne,"labels",d(Re))),Ne(ne,1,"svelte-m3c4ux"),bi(ne,L=>k(m,L),()=>d(m)),kt("mndwselectionchange",ne,Je),kt("mndwsortchange",ne,Qe),kt("mndwrowexpand",ne,$t),R(U,ne)};X(Qs,U=>{d(h)?U(ve):d(p)?U(Pe,1):d(O).length===0?U(rt,2):U(dt,-1)})}y((U,ne,L,te,ue)=>{Oe(Ct,"data-locale",ee.locale),S(en,U),vn=Ne(un,1,"freshness svelte-m3c4ux",null,vn,{stale:d(re)}),S(jn,d(oe)),S(ae,ne),S(mt,L),S(we,te),S(ct,ue)},[()=>b("packages.title"),()=>b("packages.refresh"),()=>b("packages.all"),()=>b("packages.installed"),()=>b("packages.updates",{count:d(N)})]),ge("click",fe,()=>void pe()),kt("mndwinput",Be,qe),kt("mndwchange",Rt,De),R(t,Ct),Ge()}ht(["click"]);class Cd extends Sa{constructor(e,n,r,i){super(e,n,i,r),this.name="ServiceError"}}const $s=(t,e,n,r)=>new Cd(t,e,r,n);function Vf(t){if(!En(t)||typeof t.name!="string"||typeof t.label!="string"||t.state!=="running"&&t.state!=="stopped"&&t.state!=="unknown"||typeof t.enabledAtBoot!="boolean"||t.pid!==void 0&&typeof t.pid!="number"||typeof t.autostartPinned!="boolean"||typeof t.protected!="boolean")throw ft($s);return{name:t.name,label:t.label,state:t.state,enabledAtBoot:t.enabledAtBoot,...t.pid===void 0?{}:{pid:t.pid},autostartPinned:t.autostartPinned,protected:t.protected}}function mN(t){if(!En(t)||!Array.isArray(t.services))throw ft($s);return t.services.map(e=>Vf(e))}function eg(t){if(!En(t)||t.ok!==!0||t.service===void 0)throw ft($s);return{ok:!0,service:Vf(t.service)}}function vN(t=globalThis.fetch){const e=Ta(t,$s);async function n(r,i){const s=await e.request(r,{method:"POST",json:{name:i}});return eg(s)}return{async list(){return mN(await e.request(wC,{method:"GET"}))},async status(r,i){const s=new URLSearchParams({name:r}),o=await e.request(`${yC}?${s.toString()}`,{method:"GET",signal:i});if(!En(o)||o.service===void 0)throw ft($s);return Vf(o.service)},start:r=>n(kC,r),stop:r=>n(EC,r),restart:r=>n(SC,r),async setEnabled(r,i){const s=await e.request(TC,{method:"POST",json:{name:r,enabled:i}});return eg(s)}}}const Va=vN();var bN=I('<strong> </strong><small class="svelte-gqtyao"> </small>',1);function _N(t,e){Fe(e,!0);var n=bN(),r=tt(n),i=v(r),s=x(r),o=v(s);y(()=>{S(i,e.row.service.label),S(o,e.row.service.name)}),R(t,n),Ge()}var wN=I('<small class="pid svelte-1ugk9ic"> </small>'),yN=I("<span> </span> <!>",1);function kN(t,e){Fe(e,!0);const n={running:"badge-running",stopped:"badge-stopped",unknown:"badge-unknown"},r=V(()=>n[e.row.service.state]??"badge-unknown"),i=V(()=>e.row.rowError?b("services.probe-failed"):e.row.service.state);var s=yN(),o=tt(s),a=v(o),l=x(o,2);{var c=u=>{var f=wN(),h=v(f);y(p=>S(h,p),[()=>b("services.pid",{pid:e.row.service.pid})]),R(u,f)};X(l,u=>{e.row.service.pid!==void 0&&u(c)})}y(()=>{Ne(o,1,`badge ${d(r)??""}`,"svelte-1ugk9ic"),S(a,d(i))}),R(t,s),Ge()}var EN=I("<mndw-button> </mndw-button>",2),SN=I('<div class="actions svelte-2q4dea"></div>');function TN(t,e){Fe(e,!0);const n=[{action:"start",label:"services.start",guardProtected:!1},{action:"stop",label:"services.stop",guardProtected:!0},{action:"restart",label:"services.restart",guardProtected:!0}];var r=SN();xt(r,21,()=>n,({action:i,label:s,guardProtected:o})=>i,(i,s)=>{let o=()=>d(s).action,a=()=>d(s).label,l=()=>d(s).guardProtected;var c=EN(),u=()=>e.onRun(o());Vy(c,h=>({variant:"secondary",disabled:e.row.busy||l()&&e.row.service.protected,...h,onclick:u}),[()=>l()&&e.row.service.protected?{title:b("services.protected")}:{}],void 0,void 0,"svelte-2q4dea");var f=v(c);y(h=>S(f,h),[()=>b(a())]),R(i,c)}),R(t,r),Ge()}function xN(t){return Ea(TN,e=>({onRun:n=>t(n,e.row.service.name)}))}var PN=I("<mndw-switch></mndw-switch>",2);function CN(t,e){Fe(e,!0);const n=V(()=>e.row.busy||e.row.service.protected||e.row.service.autostartPinned),r=V(()=>e.row.service.enabledAtBoot?b("services.disable-at-boot"):b("services.enable-at-boot")),i=V(()=>e.row.service.protected?b("services.protected"):e.row.service.autostartPinned?b("services.autostart-pinned"):d(r)),s=a=>{const l=a.currentTarget;l.checked=e.row.service.enabledAtBoot,e.onToggle(!e.row.service.enabledAtBoot)};var o=PN();y(()=>P(o,"checked",e.row.service.enabledAtBoot)),y(()=>P(o,"disabled",d(n))),y(()=>P(o,"aria-label",d(r))),y(()=>P(o,"title",d(i))),kt("mndwchange",o,s),R(t,o),Ge()}function RN(t){return Ea(CN,e=>({onToggle:n=>t(e.row.service,n)}))}var AN=I('<div class="capability svelte-3v3gj2" role="status"><strong class="svelte-3v3gj2"> </strong><span> </span></div>'),ON=I('<div class="mndw-alert mndw-alert--danger services-load-error svelte-3v3gj2" role="alert"><p class="svelte-3v3gj2"> </p> <mndw-button> </mndw-button></div>',2),MN=I('<p role="status"> </p>'),NN=I('<div class="table-wrap svelte-3v3gj2"><mndw-table></mndw-table></div>',2),IN=I('<section class="services-panel svelte-3v3gj2"><div class="header-row mndw-table-controls svelte-3v3gj2"><div><h1 class="svelte-3v3gj2"> </h1> <p class="svelte-3v3gj2"> </p></div> <mndw-button> </mndw-button></div> <!></section>',2);function LN(t,e){Fe(e,!0);let n=se(lt([])),r=se(lt({})),i=se(!1),s=se(!1),o=se(!1),a=se(!1),l=se(lt({})),c=0,u;const f=3,h=V(()=>d(n).map($=>({service:$,busy:d(a),rowError:d(r)[$.name]??!1}))),p=Do()(_N),g=Do()(kN),m=RN(($,ie)=>void re($,ie)),_=xN(($,ie)=>void oe($,ie)),w=V(()=>[oi()({id:"service",label:b("services.service"),width:"10rem",renderer:p}),oi()({id:"state",label:b("services.state"),width:"7.1rem",renderer:g}),oi()({id:"autostart",label:b("services.autostart"),width:"6.7rem",align:"center",renderer:m}),oi()({id:"actions",label:b("services.actions"),width:"18rem",renderer:_})]);function E($,ie){k(n,d(n).map(le=>le.name===$?ie:le),!0)}function M($){E($.name,$)}async function C($,ie,le){let Te=0;const Ke=async()=>{for(;Te<$.length;){const Xe=$[Te++];Xe!==void 0&&await le(Xe)}};await Promise.all(Array.from({length:Math.min(ie,$.length)},()=>Ke()))}function O($,ie,le,Te){return c===ie&&(d(l)[$]??0)===le&&!Te.aborted}async function A($,ie,le){const Te=d(l)[$.name]??0;try{const Ke=await Va.status($.name,le);O($.name,ie,Te,le)&&M(Ke)}catch{O($.name,ie,Te,le)&&k(r,{...d(r),[$.name]:!0},!0)}}async function N($,ie,le){await C($,f,Te=>A(Te,ie,le))}async function z(){u==null||u.abort(),u=new AbortController;const $=++c;k(i,!0),k(s,!1),k(o,!1),k(r,{},!0),k(l,{},!0);try{const ie=await Va.list();if(c!==$)return;k(n,ie,!0),k(i,!1),await N(ie,$,u.signal)}catch(ie){if(c!==$||u.signal.aborted)return;k(n,[],!0),k(s,ie instanceof Cd&&ie.code==="SERVICE_UNAVAILABLE",!0),k(o,!d(s)),k(i,!1)}finally{c===$&&k(i,!1)}}async function D($,ie){return(await ki(jl,{title:b("services.confirm-title"),props:{message:$,confirmLabel:ie}}).closed).result===!0}async function G($,ie){return D(b("services.confirm",{action:$,name:ie}),b(`services.${$}`))}async function K($,ie){return D(b(ie?"services.confirm-enable-boot":"services.confirm-disable-boot",{name:$}),b(ie?"services.enable-at-boot":"services.disable-at-boot"))}async function oe($,ie){if(!d(a)&&!(($==="stop"||$==="restart")&&!await G($,ie))){k(l,{...d(l),[ie]:(d(l)[ie]??0)+1},!0),k(a,!0);try{const le=await Va[$](ie);M(le.service),k(r,{...d(r),[ie]:!1},!0)}catch{k(r,{...d(r),[ie]:!0},!0)}finally{k(a,!1)}}}async function re($,ie){if(d(a)||$.protected||$.autostartPinned)return;const le=$.name;if(await K(le,ie)){k(l,{...d(l),[le]:(d(l)[le]??0)+1},!0),k(a,!0);try{const Te=await Va.setEnabled(le,ie);E(le,Te.service),k(r,{...d(r),[le]:!1},!0)}catch(Te){Te instanceof Cd&&Te.code==="CONFLICT"?(E(le,{...$,autostartPinned:!0}),k(r,{...d(r),[le]:!1},!0)):k(r,{...d(r),[le]:!0},!0)}finally{k(a,!1)}}}Un(()=>(z(),()=>u==null?void 0:u.abort()));var ye=IN(),q=v(ye),Z=v(q),J=v(Z),me=v(J),ce=x(J,2),Ee=v(ce),xe=x(Z,2);P(xe,"variant","secondary"),y(()=>P(xe,"disabled",d(i)||d(a)));var Ze=v(xe),he=x(q,2);{var pe=$=>{var ie=AN(),le=v(ie),Te=v(le),Ke=x(le),Xe=v(Ke);y((wt,Et)=>{S(Te,wt),S(Xe,Et)},[()=>b("services.unavailable"),()=>b("services.unavailable-description")]),R($,ie)},De=$=>{var ie=ON(),le=v(ie),Te=v(le),Ke=x(le,2);P(Ke,"variant","secondary");var Xe=v(Ke);y((wt,Et)=>{S(Te,wt),S(Xe,Et)},[()=>b("services.load-failed"),()=>b("common.retry")]),ge("click",Ke,()=>void z()),R($,ie)},qe=$=>{var ie=MN(),le=v(ie);y(Te=>S(le,Te),[()=>b("packages.loading")]),R($,ie)},Y=$=>{{let ie=V(()=>b("services.empty")),le=V(()=>b("services.empty-next")),Te=V(()=>({label:b("services.refresh"),onActivate:()=>void z(),variant:"secondary"}));Fi($,{mode:"compact",get title(){return d(ie)},get text(){return d(le)},get action(){return d(Te)}})}},ke=$=>{var ie=NN(),le=v(ie);y(()=>P(le,"columns",d(w))),y(()=>P(le,"rows",d(h))),P(le,"rowKey",Te=>Te.service.name),P(le,"min-width","42rem"),P(le,"columnMenu",!1),P(le,"rowLabel",Te=>Te.service.label),y(()=>P(le,"emptyLabel",b("services.empty"))),Ne(le,1,"svelte-3v3gj2"),R($,ie)};X(he,$=>{d(s)?$(pe):d(o)?$(De,1):d(i)&&d(n).length===0?$(qe,2):!d(i)&&d(n).length===0?$(Y,3):$(ke,-1)})}y(($,ie,le)=>{Oe(ye,"data-locale",ee.locale),S(me,$),S(Ee,ie),S(Ze,le)},[()=>b("services.title"),()=>b("services.description"),()=>b("services.refresh")]),ge("click",xe,()=>void z()),R(t,ye),Ge()}ht(["click"]);function Rd(t){return t==="services"?ut.packageServices:ut.packages}function zN(t){const e=t.replace(/\/+$/,"")||"/";return e===ut.packages?"packages":e===ut.packageServices?"services":null}const tg=[{id:"packages",path:Rd("packages"),labelKey:"packages.tab"},{id:"services",path:Rd("services"),labelKey:"services.tab"}];var DN=I("<mndw-tab> </mndw-tab>",2),HN=I('<div class="package-manager svelte-1qomr7d"><mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function BN(t,e){Fe(e,!0);const n=V(()=>{const p=(It==null?void 0:It.route.pathname)??globalThis.location.pathname;return zN(p)??"packages"});function r(p){const g=tg.find(m=>m.id===p.detail.value);g!==void 0&&It!==void 0&&It.navigate(Rd(g.id))}var i=HN(),s=v(i);Ne(s,1,"mndw-table-controls"),y(()=>P(s,"value",d(n)));var o=v(s);xt(o,17,()=>tg,p=>p.id,(p,g)=>{var m=DN();y(()=>P(m,"id",d(g).id));var _=v(m);y(w=>S(_,w),[()=>b(d(g).labelKey)]),R(p,m)});var a=x(o,2);P(a,"for","packages");var l=v(a);{var c=p=>{gN(p,{})};X(l,p=>{d(n)==="packages"&&p(c)})}var u=x(a,2);P(u,"for","services");var f=v(u);{var h=p=>{LN(p,{})};X(f,p=>{d(n)==="services"&&p(h)})}y(()=>Oe(i,"data-locale",ee.locale)),kt("mndwchange",s,r),R(t,i),Ge()}function ng(t){BN(t,{})}const rg=4096,ig=[{title:"mndwd diagnostics",path:"/api/mndw/diagnostics/export",method:"POST"},{title:"persistent rci-session capability",path:"/api/mndw/rci-session/capability"}],UN=[/(["']?(?:password|passwd|token|secret|authorization|cookie|x-ndma-tkn)["']?\s*:\s*)("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^,\s}\]]+)/gi,/(\b(?:password|passwd|token|secret|authorization|cookie|x-ndma-tkn)\s*[=:]\s*)("[^"\r\n]*"|'[^'\r\n]*'|[^\s,;&]+)/gi],$N={createObjectURL:t=>globalThis.URL.createObjectURL(t),revokeObjectURL:t=>{globalThis.URL.revokeObjectURL(t)},createAnchor:()=>document.createElement("a"),appendAnchor:t=>{document.body.appendChild(t)},removeAnchor:t=>{t.remove()}},jN={request:yo,now:()=>new Date,browser:$N};async function FN(t=jN){const n=(await Promise.allSettled(ig.map(async c=>{const u={};return"method"in c?u.method=c.method:u.csrf=!0,await Ta(t.request,(h,p,g,m)=>new Sa(h,p,g,m)).request(c.path,u)}))).map((c,u)=>{const f=ig[u];return c.status==="fulfilled"?{title:f.title,value:c.value}:{title:f.title,error:VN(c.reason)}}),r=t.now(),i=GN(n,r),s=new Blob([i],{type:"text/plain;charset=utf-8"}),o=t.browser.createObjectURL(s);let a,l=!1;try{a=t.browser.createAnchor(),a.href=o,a.download=`mndw-diagnostics-${WN(r)}.txt`,a.hidden=!0,t.browser.appendAnchor(a),l=!0,a.click()}finally{a!==void 0&&l&&t.browser.removeAnchor(a),t.browser.revokeObjectURL(o)}}function GN(t,e){const n=["MNDW diagnostics",`Generated at: ${e.toISOString()}`,""];for(const r of t){if(n.push(`## ${r.title}`),r.error!==void 0)n.push(`request failed: ${Ad(r.error)}`);else{const i=JSON.stringify(r.value,null,2);n.push(i===void 0?"undefined":i)}n.push("")}return ZN(n.join(`
|
|
89
|
-
`))}function VN(t){return t instanceof Error?Ad(t.message):Ad(String(t))}function Ad(t){return t.length>rg?`${t.slice(0,rg)}…`:t}function ZN(t){let e=t;for(const n of UN)e=e.replace(n,"$1[REDACTED]");return e}function WN(t){const e=n=>String(n).padStart(2,"0");return`${t.getUTCFullYear()}${e(t.getUTCMonth()+1)}${e(t.getUTCDate())}-${e(t.getUTCHours())}${e(t.getUTCMinutes())}${e(t.getUTCSeconds())}`}var qN=I('<section class="mndw-diagnostics-settings svelte-np0xnl"><h3 class="svelte-np0xnl"> </h3> <p class="svelte-np0xnl"> </p> <mndw-button> </mndw-button></section>',2);function KN(t,e){Fe(e,!0);const n="settings.diagnostics.download";let r=se(!1),i=!1;Si(()=>{i=!0});async function s(){k(r,!0);try{if(await FN(),i)return;Ve.dismissKey(n)}catch{if(i)return;Ve.error(b("settings.diagnostics-failed"),{key:n})}finally{i||k(r,!1)}}var o=qN(),a=v(o),l=v(a),c=x(a,2),u=v(c),f=x(c,2);P(f,"variant","secondary"),y(()=>P(f,"disabled",d(r)));var h=v(f);y((p,g,m,_)=>{Oe(o,"data-locale",ee.locale),Oe(o,"aria-label",p),S(l,g),S(u,m),S(h,_)},[()=>b("settings.diagnostics-tab"),()=>b("settings.diagnostics-tab"),()=>b("settings.diagnostics-description"),()=>d(r)?b("settings.downloading"):b("settings.download-diagnostics")]),ge("click",f,()=>void s()),R(t,o),Ge()}ht(["click"]);const YN=Ye({id:be(),label:be(),index:pn().finite().int().nonnegative(),type:be(),group:be(),color:be(),interfaceId:be()}),XN=Ye({list:zt(YN),layout:zt(zt(be())),hasPortStats:Mr()}),JN=Ye({switchports:XN,usbPortCount:pn().finite().int().nonnegative()});function p_(){return{list:[],layout:[],hasPortStats:!1}}function QN(t){return JN.parse(t)}function g_(){return`${pb/1048576} ${sn("settings.plugin-manager.upload-limit-unit")}`}class vs extends Sa{constructor(e,n,r,i){super(e,n,r,i),this.name="MgmtError"}}const m_=(t,e,n,r)=>new vs(t,e,n,r);function eI(t){switch(t){case"read":return hb;case"mutation":return QP;case"install":return eC}}function rs(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function tI(t){if(!En(t)||!rs(t.maxConcurrentExecTotal)||!rs(t.maxConcurrentExecPerPlugin)||!rs(t.maxSupervisedServices)||!rs(t.currentExec)||!rs(t.reservedServices)||!Array.isArray(t.supportedServiceProtocols)||!t.supportedServiceProtocols.every(rs))throw ft(m_);return{maxConcurrentExecTotal:t.maxConcurrentExecTotal,maxConcurrentExecPerPlugin:t.maxConcurrentExecPerPlugin,maxSupervisedServices:t.maxSupervisedServices,currentExec:t.currentExec,reservedServices:t.reservedServices,supportedServiceProtocols:t.supportedServiceProtocols}}function nI(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof vs&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function rI(t=globalThis.fetch,e=n=>AbortSignal.timeout(eI(n))){const n=Ta(t,m_);function r(a){return e(a)}async function i(a){if(a.status!==204)throw a.ok?new vs("The device returned an unexpected response.","UNKNOWN"):await n.errorFromResponse(a)}async function s(a,l,c){return await n.request(a,{method:"POST",json:{name:l},signal:r(c),response:"raw"})}async function o(a,l){const c=await s(a,l,a===Pp?"install":"mutation");return Eu(await n.parseJson(c))}return{async listPlugins(){return Ub(await n.request(gb,{method:"GET",signal:r("read")}))},async uploadPlugin(a){const l=await n.request(nC,{method:"POST",headers:{"Content-Type":"application/zip"},body:a,response:"raw"});if(l.status===201||l.status===202){const c=Eu(await n.parseJson(l));return{status:l.status===201?"installed":"pending",entry:c}}throw await n.errorFromResponse(l)},approvePlugin:a=>o(Pp,a),enablePlugin:a=>o(iC,a),disablePlugin:a=>o(sC,a),async setPluginPermission(a,l,c){const u=await n.request(tC,{method:"POST",json:{name:a,permission:l,enabled:c},signal:r("mutation")});return Eu(u)},async denyPlugin(a){await s(rC,a,"mutation")},async deletePlugin(a){await s(oC,a,"mutation")},async restartPlugin(a){await s(aC,a,"mutation")},async getRuntime(){const a=await n.request(lC,{method:"GET",signal:r("read")});return tI(a)},async getDeviceHardware(){try{const a=await n.request(cC,{method:"GET",signal:r("read")});return QN(a)}catch{return{switchports:p_(),usbPortCount:0}}},async getPalette(){const a=await n.request(wu,{method:"GET",cache:"no-store",signal:r("read")});if(a===null||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,"palette"))throw new vs("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(a){const l=await n.request(wu,{method:"PUT",json:a,signal:r("mutation"),response:"raw"});await i(l)},async deletePalette(){const a=await n.request(wu,{method:"DELETE",signal:r("mutation"),response:"raw"});await i(a)},async getTelemetry(){const a=await n.request(Cp,{method:"GET",signal:r("read")});if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new vs("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(a){const l=await n.request(Cp,{method:"PUT",json:{enabled:a},signal:r("mutation"),response:"raw"});await i(l)}}}const Fl=rI(),sg={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 ni(t){return t instanceof DOMException&&t.name==="TimeoutError"?sn("errors.device-timeout"):t instanceof vs?t.code==="MANIFEST_INVALID"?Zr(t.detail)?`${sn("errors.invalid-manifest")}: ${t.detail}`:sn("errors.invalid-manifest"):(sg[t.code]===void 0?t.message:sn(sg[t.code],t.code==="UPLOAD_TOO_LARGE"?{limit:g_()}:void 0))||sn("app.error"):t instanceof Error?t.message:sn("app.error")}var iI=I("<mndw-button> </mndw-button>",2);function sI(t,e){Fe(e,!0);function n(){const s=new Blob([JSON.stringify(e.read(),null,2)],{type:"application/json"}),o=URL.createObjectURL(s),a=document.createElement("a");a.href=o,a.download="mndw-palette.json",a.click(),URL.revokeObjectURL(o)}var r=iI();P(r,"variant","secondary"),y(()=>P(r,"disabled",e.disabled));var i=v(r);y(s=>S(i,s),[()=>b("settings.palette.export")]),ge("click",r,n),R(t,r),Ge()}ht(["click"]);var oI=I('<label class="mndw-palette-import svelte-q9ugi0"><input accept=".json,application/json" type="file" class="svelte-q9ugi0"/> <span> </span></label>');function aI(t,e){Fe(e,!0);async function n(u){let f;try{f=await u.text()}catch(g){console.error("[mndw] Could not read palette file:",g),e.onErrors([b("settings.palette.read-failed")]);return}let h;try{h=JSON.parse(f)}catch(g){console.error("[mndw] Could not parse palette JSON:",g),e.onErrors([b("settings.palette.invalid-json")]);return}const p=ob(h);if(p.palette===null){console.error("[mndw] Imported palette is invalid:",p.structuralErrors),e.onErrors([b("settings.palette.invalid-structure")]);return}e.onPreview(p.palette,p.contrastWarnings)}function r(u){e.disabled||(e.onImportStart(),n(u))}function i(u){var p;const f=u.currentTarget,h=(p=f.files)==null?void 0:p[0];h&&r(h),f.value=""}function s(u){var h;u.preventDefault();const f=(h=u.dataTransfer)==null?void 0:h.files[0];f&&r(f)}var o=oI(),a=v(o),l=x(a,2),c=v(l);y((u,f)=>{Oe(a,"aria-label",u),a.disabled=e.disabled,S(c,f)},[()=>b("settings.palette-import-aria-label"),()=>b("settings.palette.drop")]),kt("dragover",o,u=>u.preventDefault()),kt("drop",o,s),ge("change",a,i),R(t,o),Ge()}ht(["change"]);var lI=I('<li class="svelte-1cguif5"><span class="mndw-palette-preview__chip svelte-1cguif5"></span> </li>'),cI=I('<div><h4> </h4> <ul class="mndw-palette-preview__swatches svelte-1cguif5"></ul></div>'),uI=I("<li> </li>"),dI=I('<div class="mndw-palette-preview__warnings svelte-1cguif5"><h4> </h4> <ul></ul></div>'),fI=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),hI=I('<div class="mndw-palette-preview svelte-1cguif5"><p> </p> <!> <!> <!> <div class="mndw-palette-preview__actions svelte-1cguif5"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function pI(t,e){Fe(e,!0);const n=["dark","light"];let r=V(()=>n.map(w=>({theme:w,entries:e.warnings.filter(E=>E.theme===w)})));function i(w){return b(w==="dark"?"settings.palette.theme-dark":"settings.palette.theme-light")}var s=hI(),o=v(s),a=v(o),l=x(o,2);xt(l,16,()=>n,w=>w,(w,E)=>{var M=cI(),C=v(M),O=v(C),A=x(C,2);xt(A,21,()=>hf,N=>N.token,(N,z)=>{var D=lI(),G=v(D),K=x(G);y(()=>{Uo(G,`background: ${e.palette[E][d(z).token]??""}`),S(K,` ${d(z).token??""}`)}),R(N,D)}),y(N=>S(O,N),[()=>i(E)]),R(w,M)});var c=x(l,2);xt(c,17,()=>d(r),w=>w.theme,(w,E)=>{var M=Bn(),C=tt(M);{var O=A=>{var N=dI(),z=v(N),D=v(z),G=x(z,2);xt(G,21,()=>d(E).entries,K=>K.pair,(K,oe)=>{var re=uI(),ye=v(re);y(q=>S(ye,q),[()=>b("settings.palette.warning-item",{pair:d(oe).pair,ratio:d(oe).ratio,min:d(oe).min})]),R(K,re)}),y(K=>S(D,K),[()=>b("settings.palette.contrast-warnings",{theme:i(d(E).theme)})]),R(A,N)};X(C,A=>{d(E).entries.length>0&&A(O)})}R(w,M)});var u=x(c,2);{var f=w=>{var E=fI(),M=v(E);y(()=>S(M,e.error)),R(w,E)};X(u,w=>{e.error&&w(f)})}var h=x(u,2),p=v(h);P(p,"variant","primary"),y(()=>P(p,"disabled",e.busy));var g=v(p),m=x(p,2);P(m,"variant","ghost"),y(()=>P(m,"disabled",e.busy));var _=v(m);y((w,E,M)=>{S(a,w),S(g,E),S(_,M)},[()=>b("settings.palette.preview-note"),()=>b("settings.palette.confirm"),()=>b("settings.palette.discard")]),ge("click",p,function(...w){var E;(E=e.onConfirm)==null||E.apply(this,w)}),ge("click",m,function(...w){var E;(E=e.onDiscard)==null||E.apply(this,w)}),R(t,s),Ge()}ht(["click"]);var gI=I("<p> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),mI=I("<mndw-button> </mndw-button>",2),vI=I('<div class="mndw-palette-reset svelte-16mndpw"><!></div>');function bI(t,e){Fe(e,!0);let n=se(!1);function r(){e.busy||e.disabled||k(n,!0)}function i(){k(n,!1),e.onReset()}var s=vI(),o=v(s);{var a=c=>{var u=gI(),f=tt(u),h=v(f),p=x(f,2);P(p,"variant","danger"),y(()=>P(p,"disabled",e.busy||e.disabled));var g=v(p),m=x(p,2);P(m,"variant","secondary"),y(()=>P(m,"disabled",e.busy||e.disabled));var _=v(m);y((w,E,M)=>{S(h,w),S(g,E),S(_,M)},[()=>b("settings.palette.reset-confirmation"),()=>b("settings.palette.reset-confirm"),()=>b("common.cancel")]),ge("click",p,i),ge("click",m,()=>k(n,!1)),R(c,u)},l=c=>{var u=mI();P(u,"variant","danger"),y(()=>P(u,"disabled",e.busy||e.disabled));var f=v(u);y(h=>S(f,`${h??""}${e.busy?"…":""}`),[()=>b("settings.palette.reset")]),ge("click",u,r),R(c,u)};X(o,c=>{d(n)?c(a):c(l,-1)})}R(t,s),Ge()}ht(["click"]);var _I=I('<div class="mndw-alert mndw-alert--danger" role="alert"> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),og=I('<p role="status"> </p>'),wI=I("<li> </li>"),yI=I('<div class="mndw-alert mndw-alert--danger" role="alert"><ul></ul> <mndw-button> </mndw-button></div>',2),kI=I('<!> <!> <!> <div class="mndw-palette-manager__actions svelte-1adkxr0"><!> <!></div>',1),EI=I('<section class="mndw-palette-manager svelte-1adkxr0"><h3> </h3> <!> <!> <!></section>');function SI(t,e){Fe(e,!0);const n="settings.palette.commit",r="settings.palette.reset";let i=se("loading");const s=Lr().palette;let o=se(""),a=se(lt([])),l=se(""),c=se(null),u=se(lt([])),f=!1;Si(()=>{f=!0});let h=V(()=>d(i)==="loading"||d(i)==="importing"||d(i)==="previewing"||d(i)==="committing"||d(i)==="resetting"),p=V(()=>d(i)!=="idle"),g=V(()=>d(i)!=="idle");function m(ce,Ee){const xe=ni(ce);return ce instanceof Error&&xe===ce.message?(console.error("[mndw] Palette operation failed:",ce),b(Ee)):xe}async function _(){if(!(d(i)!=="loading"&&d(i)!=="idle")){k(i,"loading");try{if(await s.refreshPalette(),f)return;k(o,"")}catch(ce){if(f)return;k(o,m(ce,"settings.palette.load-failed"),!0)}finally{f||k(i,"idle")}}}function w(){k(o,"")}Un(()=>{_()});function E(){k(a,[],!0),k(l,""),k(i,"importing")}function M(ce,Ee){k(a,[],!0),k(l,""),k(c,ce,!0),k(u,Ee,!0),s.previewOverride(ce),k(i,"previewing")}function C(ce){k(a,ce,!0),k(i,"importError")}function O(){k(a,[],!0),k(i,"idle")}async function A(){if(d(c)!==null){k(i,"committing"),k(l,"");try{if(await s.commitOverride(d(c)),f)return;k(c,null),k(u,[],!0),Ve.success(b("settings.palette.saved"),{key:n}),k(i,"idle")}catch(ce){if(f)return;k(l,m(ce,"settings.palette.operation-failed"),!0),k(i,"previewing")}}}function N(){s.discardPreview(),k(c,null),k(u,[],!0),k(l,""),k(i,"idle")}async function z(){k(i,"resetting");try{if(await s.resetToDefault(),f)return;Ve.dismissKey(r)}catch(ce){if(f)return;Ve.error(m(ce,"settings.palette.operation-failed"),{key:r})}finally{f||k(i,"idle")}}var D=EI(),G=v(D),K=v(G),oe=x(G,2);{var re=ce=>{var Ee=_I(),xe=v(Ee),Ze=x(xe);P(Ze,"variant","secondary"),y(()=>P(Ze,"disabled",d(i)!=="idle"));var he=v(Ze),pe=x(Ze,2);P(pe,"variant","ghost");var De=v(pe);y((qe,Y)=>{S(xe,`${d(o)??""} `),S(he,qe),S(De,Y)},[()=>b("common.retry"),()=>b("settings.plugin-manager.dismiss")]),ge("click",Ze,()=>void _()),ge("click",pe,w),R(ce,Ee)};X(oe,ce=>{d(o)&&ce(re)})}var ye=x(oe,2);{var q=ce=>{var Ee=og(),xe=v(Ee);y(Ze=>S(xe,Ze),[()=>b("settings.palette.loading")]),R(ce,Ee)};X(ye,ce=>{d(i)==="loading"&&ce(q)})}var Z=x(ye,2);{var J=ce=>{var Ee=Bn(),xe=tt(Ee);{var Ze=he=>{{let pe=V(()=>d(i)==="committing");pI(he,{get busy(){return d(pe)},get error(){return d(l)},onConfirm:()=>void A(),onDiscard:N,get palette(){return d(c)},get warnings(){return d(u)}})}};X(xe,he=>{d(c)&&he(Ze)})}R(ce,Ee)},me=ce=>{var Ee=kI(),xe=tt(Ee);{var Ze=$=>{var ie=og(),le=v(ie);y(Te=>S(le,Te),[()=>b("settings.palette.reading")]),R($,ie)};X(xe,$=>{d(i)==="importing"&&$(Ze)})}var he=x(xe,2);aI(he,{get disabled(){return d(h)},onErrors:C,onImportStart:E,onPreview:M});var pe=x(he,2);{var De=$=>{var ie=yI(),le=v(ie);xt(le,20,()=>d(a),Xe=>Xe,(Xe,wt)=>{var Et=wI(),Re=v(Et);y(()=>S(Re,wt)),R(Xe,Et)});var Te=x(le,2);P(Te,"variant","ghost");var Ke=v(Te);y(Xe=>S(Ke,Xe),[()=>b("settings.plugin-manager.dismiss")]),ge("click",Te,O),R($,ie)};X(pe,$=>{d(i)==="importError"&&$(De)})}var qe=x(pe,2),Y=v(qe);sI(Y,{get disabled(){return d(p)},get read(){return s.getExportable}});var ke=x(Y,2);{let $=V(()=>d(i)==="resetting");bI(ke,{get busy(){return d($)},get disabled(){return d(g)},onReset:()=>void z()})}R(ce,Ee)};X(Z,ce=>{d(i)==="previewing"||d(i)==="committing"?ce(J):ce(me,-1)})}y(ce=>S(K,ce),[()=>b("settings.palette.title")]),R(t,D),Ge()}ht(["click"]);const TI=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"];class Er extends Error{constructor(n,r){super(n);W(this,"code");W(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const Za="/api/mndw/rci-session",xI=["offline","establishing","live","dead"],PI=["certificate-invalid","no-auth-token","missing-fqdn"],CI=["token","none","unknown"],RI=["supported","invalid","unsupported","unknown","needs-token"],AI=["ok","empty","disabled","decrypt-failed"];class OI{async getCapability(){const e=await this.read(await yo(`${Za}/capability`,{headers:{...To}}));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 yo(`${Za}/controller`,{method:"DELETE",headers:{...To}}))}async setEnabled(e){await this.read(await yo(`${Za}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...To},body:JSON.stringify({enabled:e})}))}async post(e,n){return await yo(`${Za}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...To},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 Er("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Er(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 Er("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 Er("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 Er("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Er("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 Er("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 Er("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 Er("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"&&AI.includes(e)}isSupport(e){return typeof e=="string"&&RI.includes(e)}isAuthMode(e){return typeof e=="string"&&CI.includes(e)}isSessionState(e){return typeof e=="string"&&xI.includes(e)}isEligibilityReason(e){return typeof e=="string"&&PI.includes(e)}isFailureCategory(e){return typeof e=="string"&&TI.includes(e)}}function MI(){return new OI}const NI=MI();var II=I("<mndw-option>Pseudo (en-XA)</mndw-option>",2),LI=I('<span role="status"> </span>'),zI=I("<ul><li><strong> </strong> </li> <li><strong> </strong> </li> <li><strong> </strong> </li></ul>"),DI=I("<p> </p>"),Wa=I('<p role="status"> </p>'),ag=I('<div class="mndw-alert mndw-alert--danger" role="alert"><p> </p> <mndw-button> </mndw-button></div>',2),HI=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p>",3),BI=I('<p role="alert"> </p>'),UI=I("<mndw-button> </mndw-button>",2),$I=I('<p class="unsupported-banner svelte-1vnn4f1" role="alert"> </p>'),jI=I('<mndw-field><mndw-input></mndw-input></mndw-field> <p id="mndw-controller-token-hint" class="persistent-rci-hint svelte-1vnn4f1"> </p> <div class="persistent-rci-actions svelte-1vnn4f1"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <!></div> <!>',3),FI=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <!> <!> <!>",3),GI=I("<span> </span>"),VI=I("<li> <!></li>"),ZI=I("<ul></ul>"),WI=I('<details class="persistent-rci-extenders svelte-1vnn4f1"><summary class="svelte-1vnn4f1"><!> <!></summary> <!></details>'),qI=I("<!> <!>",1),KI=I('<p> <a href="#mndw-background-router-access"> </a></p>'),YI=I('<div class="mndw-general-settings svelte-1vnn4f1"><section><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <mndw-field><mndw-select><mndw-option> </mndw-option> <mndw-option> </mndw-option> <!></mndw-select> <!></mndw-field></section> <!> <section><h3> </h3> <!></section> <section id="mndw-background-router-access" tabindex="-1"><h3> </h3> <p> </p> <!></section> <section id="mndw-telemetry"><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <!> <p> </p> <!></section></div>',2);function XI(t,e){Fe(e,!0);const n="settings.telemetry.save",r="settings.router-access.toggle",i="settings.controller.test",s="settings.controller.save",o="settings.controller.clear",a=Lr(),l=a.locale,c=a.persistentRci;let u=se(null),f=V(()=>{var L;return((L=d(u))==null?void 0:L.controller.auth)??"unknown"}),h=V(()=>{var te;const L=(te=d(u))==null?void 0:te.controller.support;return L==="supported"||L==="invalid"}),p=V(()=>d(h)?b("settings.controller-token-set-placeholder"):""),g=se(!1),m=se(!0),_=se(!1),w=se(""),E=se(null),M=null,C=!1,O=se(!1),A=se(!0),N=se(""),z=V(()=>{var te,ue;const L=(te=d(u))==null?void 0:te.controller.support;return((ue=d(u))==null?void 0:ue.controller.enabled)===!0&&(L==="supported"||L==="invalid")}),D=V(()=>{var L;return((L=d(u))==null?void 0:L.controller.support)==="supported"?d(u).extenders:[]}),G=V(()=>d(D).filter(L=>!L.eligible||L.state!=="live").length);Kn(()=>{var L;e.onPermissionStateChange({visible:d(f)!=="unknown",available:((L=d(u))==null?void 0:L.controller.support)==="supported"})}),Un(()=>{K(),oe()}),Si(()=>{C=!0,k(w,""),M==null||M.abort(),M=null});async function K(){k(m,!0);try{const L=await c.getCapability();if(C)return;k(u,L,!0),k(g,d(u).controller.enabled||d(u).controller.support==="needs-token",!0),pe()}catch{if(C)return;k(u,null),k(g,!1)}finally{C||k(m,!1)}}async function oe(){k(A,!0),k(N,"");try{const L=await a.mgmtClient.getTelemetry();if(C)return;k(O,L.enabled,!0)}catch{if(C)return;k(N,b("settings.telemetry-error"),!0)}finally{C||k(A,!1)}}function re(L){const te=L.detail.checked??L.detail.value??!1,ue=d(O);k(O,te,!0),k(N,""),k(A,!0),a.mgmtClient.setTelemetry(te).then(()=>{C||(a.telemetryGathering.report(te),Ve.dismissKey(n))}).catch(()=>{C||(k(O,ue,!0),Ve.error(b("settings.telemetry-error"),{key:n}))}).finally(()=>{C||k(A,!1)})}function ye(L){k(g,L.detail.checked??L.detail.value??!1,!0),k(E,null),d(g)||(k(w,""),M==null||M.abort(),M=null)}async function q(L){var Me;const te=L.detail.checked??L.detail.value??!1,ue=((Me=d(u))==null?void 0:Me.controller.enabled)??!1;k(_,!0),d(u)&&k(u,{...d(u),controller:{...d(u).controller,enabled:te}},!0);try{if(await c.setEnabled(te),C||(await K(),C))return;Ve.dismissKey(r)}catch(it){if(C||(d(u)&&k(u,{...d(u),controller:{...d(u).controller,enabled:ue}},!0),await K(),C))return;Ve.error(J(it),{key:r})}finally{C||k(_,!1)}}function Z(L){k(w,L.detail.value,!0)}function J(L){if(L instanceof Er){if(L.code==="RCI_TOKEN_INVALID")return b("settings.controller-token-rejected");if(L.code==="RCI_FIRMWARE_UNSUPPORTED")return b("settings.firmware-unsupported");if(L.code==="RCI_DEVICE_UNREACHABLE")return b("settings.device-unreachable")}return b("settings.persistent-request-failed")}async function me(){k(_,!0),k(E,null);try{const L=await c.testController(d(w));if(C)return;xe(L,i)}catch(L){C||Ve.error(J(L),{key:i})}finally{C||k(_,!1)}}async function ce(){k(_,!0),k(E,null);try{const L=await c.saveController(d(w));if(C)return;xe(L,s),k(w,""),await K()}catch(L){C||Ve.error(J(L),{key:s})}finally{C||(k(w,""),k(_,!1))}}async function Ee(){k(_,!0);try{if(await c.clearController(),C||(k(g,!1),k(w,""),k(E,null),await K(),C))return;Ve.dismissKey(o)}catch(L){C||Ve.error(J(L),{key:o})}finally{C||k(_,!1)}}function xe(L,te){k(E,L,!0),L.result==="valid"?Ve.success(b("settings.controller-token-valid"),{key:te}):L.result==="unreachable"?Ve.error(b("settings.device-unreachable"),{key:te}):Ve.dismissKey(te)}function Ze(L){ee.localeSwitchPending||l.setLocale(L.detail.value).catch(()=>{})}function he(L){L.preventDefault();const te=document.getElementById("mndw-background-router-access");te&&(te.scrollIntoView({behavior:"smooth",block:"start"}),te.focus({preventScroll:!0}))}function pe(){if(M==null||M.abort(),!d(u)||!De(d(u))){M=null;return}const L=new AbortController;M=L,qe(L.signal)}function De(L){return L.controller.support==="invalid"||L.extenders.some(te=>te.state==="establishing"||te.state==="dead")}async function qe(L){let te=null;for(;!L.aborted&&d(u)&&De(d(u));){if(d(u).extenders.some(ue=>ue.state==="establishing"))te=null;else if(te===null)te=Date.now();else if(Date.now()-te>=6e4)return;if(await new Promise(ue=>{const Me=window.setTimeout(ue,2e3);L.addEventListener("abort",()=>{window.clearTimeout(Me),ue()},{once:!0})}),L.aborted)return;try{k(u,await c.getCapability(),!0)}catch{}}}var Y=YI(),ke=v(Y),$=v(ke),ie=v($),le=x($,2);y(()=>P(le,"label",b("settings.dark-theme"))),Ne(le,1,"svelte-1vnn4f1");var Te=v(le);P(Te,"id","mndw-theme-switch"),y(()=>P(Te,"checked",ee.theme==="dark"));var Ke=x(le,2);y(()=>P(Ke,"label",b("settings.language.label"))),Ne(Ke,1,"svelte-1vnn4f1");var Xe=v(Ke);y(()=>P(Xe,"value",ee.locale)),y(()=>P(Xe,"aria-busy",String(ee.localeSwitchPending)));var wt=v(Xe);P(wt,"value","en");var Et=v(wt),Re=x(wt,2);P(Re,"value","ru");var Je=v(Re),Qe=x(Re,2);{var $t=L=>{var te=II();P(te,"value","en-XA"),R(L,te)},Ct=V(()=>l.getAvailableLocales().includes("en-XA"));X(Qe,L=>{d(Ct)&&L($t)})}var ln=x(Xe,2);{var jt=L=>{var te=LI(),ue=v(te);y(Me=>S(ue,Me),[()=>b("settings.language.pending")]),R(L,te)};X(ln,L=>{ee.localeSwitchPending&&L(jt)})}var cn=x(ke,2);SI(cn,{});var en=x(cn,2),un=v(en),vn=v(un),jn=x(un,2);{var B=L=>{var te=zI(),ue=v(te),Me=v(ue),it=v(Me),At=x(Me),Ot=x(ue,2),Yt=v(Ot),Ft=v(Yt),Mt=x(Yt),st=x(Ot,2),Nt=v(st),bn=v(Nt),Fn=x(Nt);y((On,Qr,eo)=>{S(it,On),S(At,` ${ee.deviceInfo.deviceName??""}`),S(Ft,Qr),S(Mt,` ${ee.deviceInfo.vendor??""}`),S(bn,eo),S(Fn,` ${ee.deviceInfo.firmwareVersion??""}`)},[()=>b("settings.name"),()=>b("settings.vendor"),()=>b("settings.firmware")]),R(L,te)},fe=L=>{var te=DI(),ue=v(te);y(Me=>S(ue,Me),[()=>b("settings.device-unavailable")]),R(L,te)};X(jn,L=>{ee.deviceInfo?L(B):L(fe,-1)})}var ae=x(en,2),Q=v(ae),ze=v(Q),Be=x(Q,2),Rt=v(Be),nt=x(Be,2);{var mt=L=>{var te=Wa(),ue=v(te);y(Me=>S(ue,Me),[()=>b("settings.persistent-loading")]),R(L,te)},j=L=>{var te=qI(),ue=tt(te);{var Me=Ft=>{var Mt=ag(),st=v(Mt),Nt=v(st),bn=x(st,2);P(bn,"variant","secondary");var Fn=v(bn);y((On,Qr)=>{S(Nt,On),S(Fn,Qr)},[()=>b("settings.persistent-state-unavailable"),()=>b("common.retry")]),ge("click",bn,()=>void K()),R(Ft,Mt)},it=Ft=>{var Mt=HI(),st=tt(Mt);y(()=>P(st,"label",b("settings.persistent-tokenless-toggle"))),Ne(st,1,"svelte-1vnn4f1");var Nt=v(st);P(Nt,"id","mndw-persistent-rci-enabled"),y(()=>{var On;return P(Nt,"checked",((On=d(u))==null?void 0:On.controller.enabled)??!1)}),y(()=>P(Nt,"disabled",d(_)));var bn=x(st,2),Fn=v(bn);y(On=>S(Fn,On),[()=>b("settings.persistent-tokenless-description")]),kt("mndwchange",Nt,On=>void q(On)),R(Ft,Mt)},At=Ft=>{var Mt=FI(),st=tt(Mt);y(()=>P(st,"label",b("settings.configure-persistent"))),Ne(st,1,"svelte-1vnn4f1");var Nt=v(st);P(Nt,"id","mndw-persistent-rci-enabled"),y(()=>P(Nt,"checked",d(g))),y(()=>P(Nt,"disabled",d(m)||d(_)));var bn=x(st,2);{var Fn=St=>{var pt=Wa(),Gt=v(pt);y(wn=>S(Gt,wn),[()=>b("settings.persistent-storage-disabled")]),R(St,pt)},On=St=>{var pt=BI(),Gt=v(pt);y(wn=>S(Gt,wn),[()=>b("settings.persistent-storage-decrypt-failed")]),R(St,pt)};X(bn,St=>{var pt,Gt;((pt=d(u))==null?void 0:pt.store.state)==="disabled"?St(Fn):((Gt=d(u))==null?void 0:Gt.store.state)==="decrypt-failed"&&St(On,1)})}var Qr=x(bn,2);{var eo=St=>{var pt=Wa(),Gt=v(pt);y(wn=>S(Gt,wn),[()=>b("settings.persistent-needs-token")]),R(St,pt)};X(Qr,St=>{var pt;((pt=d(u))==null?void 0:pt.controller.support)==="needs-token"&&St(eo)})}var Ac=x(Qr,2);{var _n=St=>{var pt=jI(),Gt=tt(pt);y(()=>P(Gt,"label",b("settings.controller-token"))),Ne(Gt,1,"svelte-1vnn4f1");var wn=v(Gt);P(wn,"type","password"),P(wn,"autocomplete","off"),P(wn,"aria-describedby","mndw-controller-token-hint"),y(()=>P(wn,"placeholder",d(p))),y(()=>P(wn,"value",d(w))),y(()=>P(wn,"disabled",d(_)));var to=x(Gt,2),Oc=v(to),Pa=x(to,2),Pi=v(Pa);P(Pi,"variant","secondary"),y(()=>P(Pi,"disabled",d(_)||d(w)===""));var ei=v(Pi),or=x(Pi,2);P(or,"variant","primary"),y(()=>P(or,"disabled",d(_)||d(w)===""));var no=v(or),x_=x(or,2);{var P_=zr=>{var kr=UI();P(kr,"variant","danger"),y(()=>P(kr,"disabled",d(_)));var ro=v(kr);y(Mc=>S(ro,Mc),[()=>b("settings.clear-controller-session")]),ge("click",kr,()=>void Ee()),R(zr,kr)};X(x_,zr=>{d(h)&&zr(P_)})}var C_=x(Pa,2);{var R_=zr=>{var kr=Bn(),ro=tt(kr);{var Mc=Ji=>{var io=Wa(),Nc=v(io);y(Ic=>S(Nc,Ic),[()=>b("settings.update-firmware-persistent")]),R(Ji,io)},A_=Ji=>{var io=$I(),Nc=v(io);y(Ic=>S(Nc,Ic),[()=>b("settings.controller-token-rejected")]),R(Ji,io)};X(ro,Ji=>{d(E).result==="unsupported-firmware"?Ji(Mc):d(E).result==="invalid-token"&&Ji(A_,1)})}R(zr,kr)};X(C_,zr=>{d(E)&&zr(R_)})}y((zr,kr,ro)=>{S(Oc,zr),S(ei,kr),S(no,ro)},[()=>b("settings.controller-token-hint"),()=>b("settings.test"),()=>b("settings.save")]),kt("mndwinput",wn,Z),ge("click",Pi,()=>void me()),ge("click",or,()=>void ce()),R(St,pt)};X(Ac,St=>{var pt;(d(g)||((pt=d(u))==null?void 0:pt.controller.support)==="needs-token")&&St(_n)})}kt("mndwchange",Nt,ye),R(Ft,Mt)};X(ue,Ft=>{d(f)==="unknown"?Ft(Me):d(f)==="none"?Ft(it,1):Ft(At,-1)})}var Ot=x(ue,2);{var Yt=Ft=>{var Mt=WI(),st=v(Mt),Nt=v(st);{var bn=_n=>{var St=Ra();y(pt=>S(St,pt),[()=>b("settings.persistent-extenders-summary-problems",{count:d(D).length,problems:d(G)})]),R(_n,St)},Fn=_n=>{var St=Ra();y(pt=>S(St,pt),[()=>b("settings.persistent-extenders-summary",{count:d(D).length})]),R(_n,St)};X(Nt,_n=>{d(G)>0?_n(bn):_n(Fn,-1)})}var On=x(Nt,2);{var Qr=_n=>{var St=GI(),pt=v(St);y(Gt=>S(pt,`— ${Gt??""}`),[()=>b("settings.persistent-enumeration-stale")]),R(_n,St)};X(On,_n=>{d(u).stale&&_n(Qr)})}var eo=x(st,2);{var Ac=_n=>{var St=ZI();xt(St,21,()=>d(D),pt=>pt.identity,(pt,Gt)=>{var wn=VI(),to=v(wn),Oc=x(to);{var Pa=ei=>{var or=Ra();y(no=>S(or,no),[()=>b(`settings.extender-reason-${d(Gt).reason}`)]),R(ei,or)},Pi=ei=>{var or=Ra();y(no=>S(or,no),[()=>b(`settings.extender-state-${d(Gt).state??"establishing"}`)]),R(ei,or)};X(Oc,ei=>{d(Gt).eligible?ei(Pi,-1):ei(Pa)})}y(()=>S(to,`${(d(Gt).name||d(Gt).identity)??""}: `)),R(pt,wn)}),R(_n,St)};X(eo,_n=>{d(D).length>0&&_n(Ac)})}R(Ft,Mt)};X(Ot,Ft=>{var Mt;((Mt=d(u))==null?void 0:Mt.controller.support)==="supported"&&Ft(Yt)})}R(L,te)};X(nt,L=>{d(m)?L(mt):L(j,-1)})}var we=x(ae,2),Ue=v(we),ct=v(Ue),tn=x(Ue,2);y(()=>P(tn,"label",b("settings.telemetry-toggle"))),Ne(tn,1,"svelte-1vnn4f1");var yr=v(tn);P(yr,"id","mndw-telemetry-enabled"),y(()=>P(yr,"checked",d(O))),y(()=>P(yr,"disabled",d(A)||!d(z)));var Xi=x(tn,2),Qs=v(Xi),ve=x(Xi,2);{var Pe=L=>{var te=KI(),ue=v(te),Me=x(ue),it=v(Me);y((At,Ot)=>{S(ue,`${At??""} `),S(it,Ot)},[()=>b("settings.telemetry-session-note"),()=>b("settings.telemetry-session-link")]),ge("click",Me,he),R(L,te)};X(ve,L=>{d(z)||L(Pe)})}var rt=x(ve,2),dt=v(rt),U=x(rt,2);{var ne=L=>{var te=ag(),ue=v(te),Me=v(ue),it=x(ue,2);P(it,"variant","secondary");var At=v(it);y(Ot=>{S(Me,d(N)),S(At,Ot)},[()=>b("common.retry")]),ge("click",it,()=>void oe()),R(L,te)};X(U,L=>{d(N)&&L(ne)})}y((L,te,ue,Me,it,At,Ot,Yt,Ft,Mt,st)=>{Oe(Y,"data-locale",ee.locale),S(ie,L),S(Et,te),S(Je,ue),S(vn,Me),Oe(ae,"aria-label",it),S(ze,At),S(Rt,Ot),Oe(we,"aria-label",Yt),S(ct,Ft),S(Qs,Mt),S(dt,st)},[()=>b("settings.appearance"),()=>b("settings.language.english"),()=>b("settings.language.russian"),()=>b("settings.device"),()=>b("settings.persistent-rci-title"),()=>b("settings.persistent-rci-title"),()=>b("settings.persistent-rci-description"),()=>b("settings.telemetry-label"),()=>b("settings.telemetry-label"),()=>b("settings.telemetry-description"),()=>b("settings.telemetry-wear-note")]),kt("mndwchange",Te,function(...L){hs==null||hs.apply(this,L)}),kt("mndwchange",Xe,Ze),kt("mndwchange",yr,re),R(t,Y),Ge()}ht(["click"]);var JI=I('<span class="mndw-installed__builtin svelte-egoe9l"> </span>'),QI=I('<span class="mndw-installed__deps-badge svelte-egoe9l"> </span>'),eL=I('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed svelte-egoe9l"> </span>'),tL=I('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed mndw-installed__load-failed-badge svelte-egoe9l"> </span>'),lg=I('<span class="mndw-installed__version-badge svelte-egoe9l"> </span>'),nL=I('<p class="mndw-installed__load-failed-reason svelte-egoe9l"> </p>'),rL=I('<!> <div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button></div>',3),cg=I('<p class="mndw-installed__version-warning svelte-egoe9l"> </p>'),iL=I('<p class="mndw-installed__backend svelte-egoe9l"> </p>'),sL=I("<mndw-field><mndw-switch></mndw-switch></mndw-field>",2),oL=I("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),aL=I('<div><span class="svelte-egoe9l"> </span> <!></div>'),ug=I("<mndw-button> </mndw-button>",2),lL=I('<div class="mndw-installed__confirmation svelte-egoe9l"><p class="svelte-egoe9l"> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),cL=I("<!> <!>",1),uL=I('<p class="mndw-installed__runtime svelte-egoe9l"> </p>'),dL=I('<li class="mndw-installed__item svelte-egoe9l"><div class="mndw-installed__identity svelte-egoe9l"><strong class="svelte-egoe9l"> </strong> <span class="svelte-egoe9l"> </span></div> <div class="mndw-installed__metadata svelte-egoe9l"><span> </span> <span> </span> <!> <!> <!> <!> <!></div> <!> <!> <!> <!> <!> <!> <div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button> <!></div> <!></li>',2),fL=I('<ul class="mndw-installed__list svelte-egoe9l"></ul>'),hL=I('<section class="mndw-installed svelte-egoe9l" aria-labelledby="mndw-installed-title"><h3 id="mndw-installed-title" class="svelte-egoe9l"> </h3> <!></section>');function pL(t,e){Fe(e,!0);function n(A){const N=[],z=Object.values(A.routes??{}),D=z.filter(K=>K.transport==="http").length,G=z.filter(K=>K.transport==="websocket").length;return D>0&&N.push(b("settings.plugin-manager.endpoint",{count:D})),G>0&&N.push(b("settings.plugin-manager.websocket",{count:G})),N}function r(A){switch(A){case"timeout":return b("settings.plugin-manager.plugin-load-timeout",{seconds:qb/1e3});case"error":return b("settings.plugin-manager.plugin-load-error")}}function i(A,N){var z;return((z=A.permissionGrants)==null?void 0:z[N])??!1}function s(A){return A.endsWith(":write")?b("settings.plugin-manager.persistent-rci-write"):b("settings.plugin-manager.persistent-rci-read")}function o(A){if(A===void 0)return;const N=Fb(A).find(z=>z.kind==="sdk-major");if(N!==void 0)return b("settings.plugin-manager.version-warning.sdk-major",{pluginVersion:N.pluginVersion,hostVersion:N.hostVersion})}function a(A){switch(A){case"stopped":return b("settings.plugin-manager.runtime-state-stopped");case"capacity_blocked":return b("settings.plugin-manager.runtime-state-capacity-blocked");case"starting":return b("settings.plugin-manager.runtime-state-starting");case"ready":return b("settings.plugin-manager.runtime-state-ready");case"backoff":return b("settings.plugin-manager.runtime-state-backoff");case"failed":return b("settings.plugin-manager.runtime-state-failed")}}let l=Xt(e,"rowStateFor",3,()=>{}),c=Xt(e,"permissionVisible",3,!1),u=Xt(e,"permissionAvailable",3,!1),f=Xt(e,"onRestart",3,()=>{}),h=Xt(e,"onRefresh",3,()=>{}),p=Xt(e,"onKeepNotice",3,()=>{}),g=lt({});function m(A){var z;const N=(z=yn(A))==null?void 0:z.failureKind;N===void 0||g[A]!==void 0||(g[A]=N,Us(A).catch(()=>!1).finally(()=>{delete g[A]}))}var _=hL(),w=v(_),E=v(w),M=x(w,2);{var C=A=>{{let N=V(()=>b("settings.plugin-manager.no-installed")),z=V(()=>b("settings.plugin-manager.no-installed-next")),D=V(()=>({label:b("settings.upload-plugin-zip"),href:"#mndw-plugin-upload"}));Fi(A,{mode:"compact",get title(){return d(N)},get text(){return d(z)},get action(){return d(D)}})}},O=A=>{var N=fL();xt(N,21,()=>e.items,z=>z.name,(z,D)=>{const G=V(()=>n(d(D).backend)),K=V(()=>IA(d(D).name)),oe=V(()=>o(d(D).lock)),re=V(()=>Sc(d(D).name)),ye=V(()=>l()(d(D).name)),q=V(()=>{var ve,Pe;return((ve=d(ye))==null?void 0:ve.state)==="error"?"danger":((Pe=d(ye))==null?void 0:Pe.state)==="notice-rejected"?"warning":"info"}),Z=V(()=>{var ve;return((ve=d(ye))==null?void 0:ve.state)==="error"?"alert":"status"}),J=V(()=>{var ve,Pe;return((ve=d(ye))==null?void 0:ve.state)==="working"||((Pe=d(ye))==null?void 0:Pe.state)==="reconciling"}),me=V(()=>yn(d(D).name)),ce=V(()=>{var ve;return d(D).enabled&&d(D).approval==="approved"&&((ve=d(me))==null?void 0:ve.runnable)===!0}),Ee=V(()=>{var ve;return d(ce)&&((ve=d(me))==null?void 0:ve.status)==="failed"}),xe=V(()=>g[d(D).name]!==void 0),Ze=V(()=>d(ce)&&(d(Ee)||d(xe))),he=V(()=>{var ve;return d(Ee)?(ve=d(me))==null?void 0:ve.failureKind:g[d(D).name]}),pe=V(()=>d(he)===void 0?void 0:r(d(he)));var De=dL(),qe=v(De),Y=v(qe),ke=v(Y),$=x(Y,2),ie=v($),le=x(qe,2),Te=v(le),Ke=v(Te),Xe=x(Te,2),wt=v(Xe),Et=x(Xe,2);{var Re=ve=>{var Pe=JI(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b(d(D).source==="builtin"?"settings.plugin-manager.builtin":"settings.plugin-manager.uploaded")]),R(ve,Pe)};X(Et,ve=>{(d(D).source==="builtin"||d(D).source==="upload")&&ve(Re)})}var Je=x(Et,2);{var Qe=ve=>{var Pe=QI(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.installing-dependencies")]),R(ve,Pe)},$t=ve=>{var Pe=eL(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.dependency-install-failed")]),R(ve,Pe)};X(Je,ve=>{d(re)==="installing"?ve(Qe):d(re)==="failed"&&ve($t,1)})}var Ct=x(Je,2);{var ln=ve=>{var Pe=tL(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.plugin-load-failed")]),R(ve,Pe)};X(Ct,ve=>{d(Ze)&&ve(ln)})}var jt=x(Ct,2);{var cn=ve=>{var Pe=lg(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.version-mismatch")]),R(ve,Pe)};X(jt,ve=>{d(K).length>0&&ve(cn)})}var en=x(jt,2);{var un=ve=>{var Pe=lg(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.sdk-major-badge")]),R(ve,Pe)};X(en,ve=>{d(oe)!==void 0&&ve(un)})}var vn=x(le,2);{var jn=ve=>{var Pe=rL(),rt=tt(Pe);{var dt=te=>{var ue=nL(),Me=v(ue);y(()=>S(Me,d(pe))),R(te,ue)};X(rt,te=>{d(pe)!==void 0&&te(dt)})}var U=x(rt,2),ne=v(U);Ne(ne,1,"mndw-installed__load-retry"),P(ne,"variant","secondary"),y(()=>P(ne,"disabled",d(xe))),y(()=>P(ne,"aria-busy",d(xe)));var L=v(ne);y(te=>S(L,te),[()=>b("settings.plugin-manager.retry")]),ge("click",ne,()=>m(d(D).name)),R(ve,Pe)};X(vn,ve=>{d(Ze)&&ve(jn)})}var B=x(vn,2);{var fe=ve=>{var Pe=cg(),rt=v(Pe);y(dt=>S(rt,dt),[()=>b("settings.plugin-manager.load-version-warning",{versions:d(K).join(", ")})]),R(ve,Pe)};X(B,ve=>{d(K).length>0&&ve(fe)})}var ae=x(B,2);{var Q=ve=>{var Pe=cg(),rt=v(Pe);y(()=>S(rt,d(oe))),R(ve,Pe)};X(ae,ve=>{d(oe)!==void 0&&ve(Q)})}var ze=x(ae,2);{var Be=ve=>{var Pe=iL(),rt=v(Pe);y(dt=>S(rt,dt),[()=>d(G).join(", ")]),R(ve,Pe)};X(ze,ve=>{d(G).length>0&&ve(Be)})}var Rt=x(ze,2);{var nt=ve=>{var Pe=Bn(),rt=tt(Pe);xt(rt,16,()=>ff,dt=>dt,(dt,U)=>{var ne=Bn(),L=tt(ne);{var te=Me=>{var it=sL();Ne(it,1,"mndw-installed__permission-switch"),y(()=>P(it,"label",s(U)));var At=v(it);y(()=>P(At,"checked",i(d(D),U))),y(()=>P(At,"disabled",d(J)||!i(d(D),U)&&!u())),kt("mndwchange",At,Ot=>e.onPermissionChange(d(D).name,U,Ot.detail.checked)),R(Me,it)},ue=V(()=>{var Me;return(Me=d(D).permissions)==null?void 0:Me.includes(U)});X(L,Me=>{d(ue)&&Me(te)})}R(dt,ne)}),R(ve,Pe)};X(Rt,ve=>{c()&&ve(nt)})}var mt=x(Rt,2);{var j=ve=>{var Pe=aL(),rt=v(Pe),dt=v(rt),U=x(rt,2);{var ne=L=>{var te=oL(),ue=tt(te);Ne(ue,1,"mndw-installed__refresh"),P(ue,"variant","ghost");var Me=v(ue),it=x(ue,2);Ne(it,1,"mndw-installed__keep"),P(it,"variant","ghost");var At=v(it);y((Ot,Yt)=>{S(Me,Ot),S(At,Yt)},[()=>b("settings.plugin-manager.refresh"),()=>b("settings.plugin-manager.keep-notice")]),ge("click",ue,function(...Ot){var Yt;(Yt=h())==null||Yt.apply(this,Ot)}),ge("click",it,()=>p()(d(D).name)),R(L,te)};X(U,L=>{(d(ye).state==="notice-finishing"||d(ye).state==="outcome-unknown")&&L(ne)})}y(()=>{Ne(Pe,1,`mndw-alert mndw-alert--${d(q)??""}`,"svelte-egoe9l"),Oe(Pe,"role",d(Z)),S(dt,d(ye).message)}),R(ve,Pe)};X(mt,ve=>{var Pe;d(ye)!==void 0&&((Pe=d(ye))==null?void 0:Pe.message)!==""&&ve(j)})}var we=x(mt,2),Ue=v(we);Ne(Ue,1,"mndw-installed__toggle"),y(()=>P(Ue,"variant",d(D).enabled?"secondary":"primary")),y(()=>P(Ue,"disabled",d(J)));var ct=v(Ue),tn=x(Ue,2);{var yr=ve=>{var Pe=cL(),rt=tt(Pe);{var dt=te=>{var ue=ug();Ne(ue,1,"mndw-installed__restart"),P(ue,"variant","secondary"),y(()=>P(ue,"disabled",d(J)));var Me=v(ue);y(it=>S(Me,it),[()=>b("settings.plugin-manager.restart-backend")]),ge("click",ue,()=>f()(d(D).name)),R(te,ue)};X(rt,te=>{d(D).runtime&&d(D).runtime.state!=="stopped"&&te(dt)})}var U=x(rt,2);{var ne=te=>{var ue=lL(),Me=v(ue),it=v(Me),At=x(Me,2);Ne(At,1,"mndw-installed__cancel"),P(At,"variant","ghost"),y(()=>P(At,"disabled",d(J)));var Ot=v(At),Yt=x(At,2);Ne(Yt,1,"mndw-installed__confirm"),P(Yt,"variant","danger"),y(()=>P(Yt,"disabled",d(J)));var Ft=v(Yt);y((Mt,st,Nt)=>{S(it,Mt),S(Ot,st),S(Ft,Nt)},[()=>b("settings.plugin-manager.delete-confirmation",{label:d(D).label}),()=>b("settings.plugin-manager.cancel"),()=>b("settings.plugin-manager.delete-plugin")]),ge("click",At,function(...Mt){var st;(st=e.onCancelConfirm)==null||st.apply(this,Mt)}),ge("click",Yt,()=>e.onDelete(d(D).name)),R(te,ue)},L=te=>{var ue=ug();Ne(ue,1,"mndw-installed__delete"),P(ue,"variant","danger"),y(()=>P(ue,"disabled",d(J)));var Me=v(ue);y(it=>S(Me,it),[()=>b("settings.plugin-manager.delete")]),ge("click",ue,()=>e.onRequestConfirm(d(D).name)),R(te,ue)};X(U,te=>{e.confirmingName===d(D).name?te(ne):te(L,-1)})}R(ve,Pe)};X(tn,ve=>{d(D).source!=="builtin"&&ve(yr)})}var Xi=x(we,2);{var Qs=ve=>{var Pe=uL(),rt=v(Pe);y((dt,U)=>S(rt,`${dt??""}: ${U??""}`),[()=>b("settings.plugin-manager.backend"),()=>a(d(D).runtime.state)]),R(ve,Pe)};X(Xi,ve=>{d(D).runtime&&ve(Qs)})}y((ve,Pe,rt)=>{S(ke,d(D).label),S(ie,d(D).name),S(Ke,`${ve??""}: ${d(D).version??""}`),S(wt,Pe),S(ct,rt)},[()=>b("settings.plugin-manager.version"),()=>b(d(D).type==="widget"?"settings.plugin-manager.type-widget":"settings.plugin-manager.type-page"),()=>d(D).enabled?b("settings.plugin-manager.disable"):b("settings.plugin-manager.enable")]),ge("click",Ue,()=>d(D).enabled?e.onDisable(d(D).name):e.onEnable(d(D).name)),R(z,De)}),R(A,N)};X(M,A=>{e.items.length===0?A(C):A(O,-1)})}y(A=>S(E,A),[()=>b("settings.plugin-manager.installed-title")]),R(t,_),Ge()}ht(["click"]);var gL=I("<li> </li>"),mL=I('<section class="mndw-version-warning svelte-fld8qa" role="note"><h4 class="svelte-fld8qa"> </h4> <ul class="svelte-fld8qa"></ul> <p class="svelte-fld8qa"> </p></section>');function v_(t,e){Fe(e,!0);let n=V(()=>e.lock===void 0?[]:Fb(e.lock));function r(a){return a.kind==="sdk-major"?b("settings.plugin-manager.version-warning.sdk-major",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):a.kind==="sdk-newer-minor"?b("settings.plugin-manager.version-warning.sdk-newer-minor",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):b("settings.plugin-manager.version-warning.shared-major",{name:a.name,pluginVersion:a.pluginVersion,hostVersion:a.hostVersion})}var i=Bn(),s=tt(i);{var o=a=>{var l=mL(),c=v(l),u=v(c),f=x(c,2);xt(f,21,()=>d(n),g=>`${g.kind}:${g.name}`,(g,m)=>{var _=gL(),w=v(_);y(E=>S(w,E),[()=>r(d(m))]),R(g,_)});var h=x(f,2),p=v(h);y((g,m)=>{S(u,g),S(p,m)},[()=>b("settings.plugin-manager.version-warning.title"),()=>b("settings.plugin-manager.version-warning.install-anyway")]),R(a,l)};X(s,a=>{d(n).length>0&&a(o)})}R(t,i),Ge()}var vL=I('<p class="mndw-cap__kind svelte-14iyjl4"> </p>'),lo=I("<li> </li>"),co=I('<section class="mndw-cap__section svelte-14iyjl4"><h4 class="svelte-14iyjl4"> </h4> <ul class="svelte-14iyjl4"></ul></section>'),bL=I('<div class="mndw-cap svelte-14iyjl4"><!> <!> <!> <!> <!> <!> <!></div>');function b_(t,e){Fe(e,!0);let n=V(()=>Object.entries(e.entry.backend.routes??{})),r=V(()=>{var O;return((O=e.entry.review)==null?void 0:O.packages)??[]}),i=V(()=>{var O;return((O=e.entry.review)==null?void 0:O.args)??[]}),s=V(()=>{var O;return((O=e.entry.review)==null?void 0:O.publicRoutes)??[]}),o=V(()=>e.entry.permissions??[]);var a=bL(),l=v(a);v_(l,{get lock(){return e.entry.lock}});var c=x(l,2);{var u=O=>{var A=vL(),N=v(A);y(z=>S(N,z),[()=>b(e.entry.review.kind==="service"?"settings.plugin-manager.backend-kind-service":"settings.plugin-manager.backend-kind-exec")]),R(O,A)};X(c,O=>{e.entry.review!==void 0&&O(u)})}var f=x(c,2);{var h=O=>{var A=co(),N=v(A),z=v(N),D=x(N,2);xt(D,20,()=>d(r),G=>G,(G,K)=>{var oe=lo(),re=v(oe);y(()=>S(re,K)),R(G,oe)}),y(G=>S(z,G),[()=>b("settings.plugin-manager.packages")]),R(O,A)};X(f,O=>{d(r).length>0&&O(h)})}var p=x(f,2);{var g=O=>{var A=co(),N=v(A),z=v(N),D=x(N,2);xt(D,23,()=>d(i),(G,K)=>`${K}:${G}`,(G,K)=>{var oe=lo(),re=v(oe);y(()=>S(re,d(K))),R(G,oe)}),y(G=>S(z,G),[()=>b("settings.plugin-manager.service-args")]),R(O,A)};X(p,O=>{d(i).length>0&&O(g)})}var m=x(p,2);{var _=O=>{var A=co(),N=v(A),z=v(N),D=x(N,2);xt(D,21,()=>d(n),([G,K])=>G,(G,K)=>{var oe=V(()=>aw(d(K),2));let re=()=>d(oe)[0],ye=()=>d(oe)[1];var q=lo(),Z=v(q);y(J=>S(Z,`${re()??""}: ${ye().transport==="http"?`${ye().method??"GET"} `:""}${ye().path??""}${J??""}`),[()=>{var J;return(J=ye().protocols)!=null&&J.length?` (${ye().protocols.join(", ")})`:""}]),R(G,q)}),y(G=>S(z,G),[()=>b("settings.plugin-manager.routes")]),R(O,A)};X(m,O=>{d(n).length>0&&O(_)})}var w=x(m,2);{var E=O=>{var A=co(),N=v(A),z=v(N),D=x(N,2);xt(D,20,()=>d(s),G=>G,(G,K)=>{var oe=lo(),re=v(oe);y(()=>S(re,K)),R(G,oe)}),y(G=>S(z,G),[()=>b("settings.plugin-manager.public-routes")]),R(O,A)};X(w,O=>{d(s).length>0&&O(E)})}var M=x(w,2);{var C=O=>{var A=co(),N=v(A),z=v(N),D=x(N,2);xt(D,20,()=>d(o),G=>G,(G,K)=>{var oe=lo(),re=v(oe);y(()=>S(re,K)),R(G,oe)}),y(G=>S(z,G),[()=>b("settings.plugin-manager.permissions")]),R(O,A)};X(M,O=>{d(o).length>0&&O(C)})}R(t,a),Ge()}var _L=I("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),wL=I('<div><span class="svelte-1mbpuk3"> </span> <!></div>'),yL=I('<div class="mndw-pending__confirmation svelte-1mbpuk3"><p class="svelte-1mbpuk3"> </p> <div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2),kL=I('<div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),EL=I('<li class="mndw-pending__item svelte-1mbpuk3"><div class="mndw-pending__identity svelte-1mbpuk3"><strong class="svelte-1mbpuk3"> </strong> <span class="svelte-1mbpuk3"> </span></div> <!> <!> <!></li>'),SL=I('<section class="mndw-pending svelte-1mbpuk3" aria-labelledby="mndw-pending-title"><h3 id="mndw-pending-title" class="svelte-1mbpuk3"> </h3> <ul class="mndw-pending__list svelte-1mbpuk3"></ul></section>');function TL(t,e){Fe(e,!0);let n=Xt(e,"rowStateFor",3,()=>{}),r=Xt(e,"onRefresh",3,()=>{}),i=Xt(e,"onKeepNotice",3,()=>{});var s=SL(),o=v(s),a=v(o),l=x(o,2);xt(l,21,()=>e.items,c=>c.name,(c,u)=>{const f=V(()=>n()(d(u).name)),h=V(()=>{var K,oe;return((K=d(f))==null?void 0:K.state)==="error"?"danger":((oe=d(f))==null?void 0:oe.state)==="notice-rejected"?"warning":"info"}),p=V(()=>{var K;return((K=d(f))==null?void 0:K.state)==="error"?"alert":"status"}),g=V(()=>{var K,oe;return((K=d(f))==null?void 0:K.state)==="working"||((oe=d(f))==null?void 0:oe.state)==="reconciling"});var m=EL(),_=v(m),w=v(_),E=v(w),M=x(w,2),C=v(M),O=x(_,2);b_(O,{get entry(){return d(u)}});var A=x(O,2);{var N=K=>{var oe=wL(),re=v(oe),ye=v(re),q=x(re,2);{var Z=J=>{var me=_L(),ce=tt(me);Ne(ce,1,"mndw-pending__refresh"),P(ce,"variant","ghost");var Ee=v(ce),xe=x(ce,2);Ne(xe,1,"mndw-pending__keep"),P(xe,"variant","ghost");var Ze=v(xe);y((he,pe)=>{S(Ee,he),S(Ze,pe)},[()=>b("settings.plugin-manager.refresh"),()=>b("settings.plugin-manager.keep-notice")]),ge("click",ce,function(...he){var pe;(pe=r())==null||pe.apply(this,he)}),ge("click",xe,()=>i()(d(u).name)),R(J,me)};X(q,J=>{(d(f).state==="notice-finishing"||d(f).state==="outcome-unknown")&&J(Z)})}y(()=>{Ne(oe,1,`mndw-alert mndw-alert--${d(h)??""}`,"svelte-1mbpuk3"),Oe(oe,"role",d(p)),S(ye,d(f).message)}),R(K,oe)};X(A,K=>{d(f)!==void 0&&d(f).message!==""&&K(N)})}var z=x(A,2);{var D=K=>{var oe=yL(),re=v(oe),ye=v(re),q=x(re,2),Z=v(q);Ne(Z,1,"mndw-pending__cancel"),P(Z,"variant","ghost");var J=v(Z),me=x(Z,2);Ne(me,1,"mndw-pending__confirm"),P(me,"variant","danger"),y(()=>P(me,"disabled",d(g)));var ce=v(me);y((Ee,xe,Ze)=>{S(ye,Ee),S(J,xe),S(ce,Ze)},[()=>b("settings.plugin-manager.deny-confirmation",{label:d(u).label}),()=>b("settings.plugin-manager.cancel"),()=>b("settings.plugin-manager.deny-plugin")]),ge("click",Z,function(...Ee){var xe;(xe=e.onCancelConfirm)==null||xe.apply(this,Ee)}),ge("click",me,()=>e.onDeny(d(u).name)),R(K,oe)},G=K=>{var oe=kL(),re=v(oe);Ne(re,1,"mndw-pending__deny"),P(re,"variant","danger"),y(()=>P(re,"disabled",d(g)));var ye=v(re),q=x(re,2);Ne(q,1,"mndw-pending__approve"),P(q,"variant","primary"),y(()=>P(q,"disabled",d(g)));var Z=v(q);y((J,me)=>{S(ye,J),S(Z,me)},[()=>b("settings.plugin-manager.deny"),()=>b("settings.plugin-manager.approve")]),ge("click",re,()=>e.onRequestConfirm(d(u).name)),ge("click",q,()=>e.onApprove(d(u).name)),R(K,oe)};X(z,K=>{e.confirmingName===d(u).name?K(D):K(G,-1)})}y(()=>{S(E,d(u).label),S(C,d(u).name)}),R(c,m)}),y(c=>S(a,c),[()=>b("settings.plugin-manager.pending-title")]),R(t,s),Ge()}ht(["click"]);var xL=I('<div class="mndw-approval svelte-s4a91i"><p class="mndw-approval__declaration svelte-s4a91i"><strong> </strong> </p> <p class="mndw-alert mndw-alert--warning" role="note"> </p> <!> <div class="mndw-approval__actions svelte-s4a91i"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function PL(t,e){Fe(e,!0);var n=xL(),r=v(n),i=v(r),s=v(i),o=x(i),a=x(r,2),l=v(a),c=x(a,2);b_(c,{get entry(){return e.entry}});var u=x(c,2),f=v(u);Ne(f,1,"mndw-approval__deny"),P(f,"variant","danger");var h=v(f),p=x(f,2);Ne(p,1,"mndw-approval__approve"),P(p,"variant","primary");var g=v(p);y((m,_,w,E)=>{S(s,e.entry.label),S(o,` (${e.entry.name??""}) ${m??""}`),S(l,_),S(h,w),S(g,E)},[()=>b("settings.backend-approval-declaration"),()=>b("settings.plugin-risk-warning"),()=>b("settings.backend-approval-deny"),()=>b("settings.backend-approval-approve")]),ge("click",f,()=>e.close("deny")),ge("click",p,()=>e.close("approve")),R(t,n),Ge()}ht(["click"]);async function CL(t,e){if(e!=null&&e.aborted)return;const n=ki(PL,{title:b("settings.backend-approval-title",{label:t.label}),props:{entry:t}}),r=()=>n.close(void 0);e==null||e.addEventListener("abort",r,{once:!0});try{return(await n.closed).result}finally{e==null||e.removeEventListener("abort",r)}}const RL={"ping-widget-aarch64.zip":"aarch64","ping-widget-mips.zip":"mips","ping-widget-mipsel.zip":"mipsel"};function AL(t){switch(t){case"aarch64":return"aarch64";case"mips":return"mips";case"mipsel":return"mipsel";default:return}}function OL(t,e){const n=AL(e),r=RL[t];if(!(n===void 0||r===void 0||n===r))return{filename:t,archiveTarget:r,deviceTarget:n}}var dg=I('<p class="mndw-upload__status svelte-1mqre4o" role="status"> </p>'),ML=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),NL=I('<div class="mndw-upload svelte-1mqre4o"><div class="mndw-alert mndw-alert--warning" role="note"> </div> <label id="mndw-plugin-upload" class="mndw-upload__zone svelte-1mqre4o"><input accept=".zip" type="file" class="svelte-1mqre4o"/> <span> </span></label> <!></div>');function IL(t,e){Fe(e,!0);const n="settings.plugin-manager.install",r="settings.plugin-manager.approval";let i=Xt(e,"openApproval",3,CL),s=se("idle"),o=se(""),a=se(null),l,c=!1;Si(()=>{c=!0,l==null||l.abort()});function u(Z){if(!Z.name.toLowerCase().endsWith(".zip"))return b("settings.plugin-manager.choose-zip");if(Z.size===0)return b("settings.plugin-manager.empty-zip");if(Z.size>pb)return b("settings.plugin-manager.zip-too-large",{limit:g_()})}function f(Z){return b("settings.plugin-manager.upload-target-mismatch",{filename:Z.filename,archiveTarget:Z.archiveTarget,deviceTarget:Z.deviceTarget})}function h(Z){const J=u(Z);if(J)return J;const me=OL(Z.name,e.architecture);if(me!==void 0)return f(me)}function p(Z){k(o,Z,!0),k(s,"error")}function g(Z){k(a,Z,!0),Ve.success(b("settings.plugin-manager.installed-success",{label:Z.label}),{key:n}),k(s,"success"),e.onInstalled()}async function m(Z){const J=new AbortController;l=J;try{return{decision:await i()(Z,J.signal),aborted:J.signal.aborted}}finally{l===J&&(l=void 0)}}async function _(Z,J){if(!c)if(J==="approve"){const me=await e.onApprove(Z.name);if(c)return;if(!me){k(s,"idle");return}Ve.success(b("settings.plugin-manager.approved-success",{label:Z.label}),{key:r}),k(s,"success")}else if(J==="deny"){if(await e.onDeny(Z.name),c)return;k(s,"idle")}else{if(c)return;e.onDismiss(),k(s,"idle")}}async function w(Z){if(d(s)==="uploading"||d(s)==="busy")return;const J=h(Z);if(J){p(J);return}k(o,""),k(s,"uploading");let me;try{me=await e.uploadFile(Z)}catch(Ee){if(c)return;p(ni(Ee));return}if(c)return;if(me.status==="installed"){g(me.entry);return}k(s,"busy");let ce;try{ce=await m(me.entry)}catch(Ee){if(c)return;p(ni(Ee));return}c||ce.aborted||await _(me.entry,ce.decision)}function E(Z){var ce;const J=Z.currentTarget,me=(ce=J.files)==null?void 0:ce[0];J.value="",me&&w(me)}function M(Z){var me;Z.preventDefault();const J=(me=Z.dataTransfer)==null?void 0:me.files[0];J&&w(J)}var C=NL(),O=v(C),A=v(O),N=x(O,2),z=v(N),D=x(z,2),G=v(D),K=x(N,2);{var oe=Z=>{var J=dg(),me=v(J);y(ce=>S(me,ce),[()=>b("settings.plugin-manager.uploading")]),R(Z,J)},re=Z=>{var J=dg(),me=v(J);y(ce=>S(me,ce),[()=>b("settings.plugin-manager.waiting-approval")]),R(Z,J)},ye=Z=>{var J=Bn(),me=tt(J);{var ce=Ee=>{v_(Ee,{get lock(){return d(a).lock}})};X(me,Ee=>{d(a)&&Ee(ce)})}R(Z,J)},q=Z=>{var J=ML(),me=v(J);y(()=>S(me,d(o))),R(Z,J)};X(K,Z=>{d(s)==="uploading"?Z(oe):d(s)==="busy"?Z(re,1):d(s)==="success"?Z(ye,2):d(s)==="error"&&Z(q,3)})}y((Z,J,me)=>{S(A,Z),Oe(z,"aria-label",J),z.disabled=d(s)==="uploading"||d(s)==="busy",S(G,me)},[()=>b("settings.plugin-risk-warning"),()=>b("settings.upload-plugin-zip"),()=>b("settings.plugin-manager.upload-drop")]),kt("dragover",N,Z=>Z.preventDefault()),kt("drop",N,M),ge("change",z,E),R(t,C),Ge()}ht(["change"]);function __(t,e,n){var i;const r=n.find(s=>s.name===e);switch(t.kind){case"delete":case"deny":return r===void 0;case"enable":return(r==null?void 0:r.enabled)===!0;case"disable":return(r==null?void 0:r.enabled)===!1;case"approve":return(r==null?void 0:r.approval)==="approved";case"restart":return!1;case"permission":return((i=r==null?void 0:r.permissionGrants)==null?void 0:i[t.permission])===t.enabled}}async function LL(t,e,n,r){if(t.kind==="restart")return"outcome-unknown";for(let i=0;i<r.polls;i+=1){const s=await n();if(__(t,e,s))return"ok";i+1<r.polls&&r.intervalMs>0&&await new Promise(o=>window.setTimeout(o,r.intervalMs))}return"notice-finishing"}var zL=I('<div class="mndw-reload svelte-1hlmyjs" role="status"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),DL=I('<p class="mndw-plugin-manager__loading svelte-1hlmyjs" role="status"> </p>'),HL=I('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><p class="svelte-1hlmyjs"> </p> <mndw-button> </mndw-button></div>',2),BL=I('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),UL=I('<section class="svelte-1hlmyjs"><strong> </strong> <span> </span> <span> </span> <span> </span> <span> </span></section>'),$L=I('<p class="svelte-1hlmyjs"> </p>'),qa=I("<span> </span>"),jL=I('<section class="mndw-plugin-diagnostics__item svelte-1hlmyjs"><strong> </strong> <!> <!> <!> <!></section>'),FL=I('<!> <details class="mndw-plugin-diagnostics svelte-1hlmyjs"><summary class="svelte-1hlmyjs"> </summary> <!> <!></details> <!> <!>',1),GL=I('<section class="mndw-plugin-manager svelte-1hlmyjs"><h3 class="svelte-1hlmyjs"> </h3> <!> <!> <!></section>');function VL(t,e){Fe(e,!0);let n=Xt(e,"client",3,Fl),r=Xt(e,"permissionVisible",3,!1),i=Xt(e,"permissionAvailable",3,!1),s=se(lt([])),o=se(null),a=se(""),l=se(!0),c=se(""),u=se(""),f=se(null),h=se(!1),p=0;const g=new Zi,m={polls:3,intervalMs:1e3};let _=V(()=>d(s).filter(he=>he.approval==="approved")),w=V(()=>d(s).filter(he=>he.approval==="pending"));function E(he){return g.get(he)}function M(he){return he.some(pe=>{if(!pe.enabled||pe.approval!=="approved")return!1;const De=Yi.get(pe.name);return De!==void 0&&De.entry.version!==pe.version})}function C(he){for(const[pe,De]of g)De.state==="notice-finishing"&&De.operation!==void 0&&__(De.operation,pe,he)&&g.delete(pe)}async function O(){const he=++p;k(l,!0),k(c,"");try{const pe=await n().listPlugins();he===p&&(k(s,pe,!0),k(h,d(h)||M(pe),!0),k(u,""),C(pe))}catch(pe){he===p&&k(c,ni(pe),!0)}finally{he===p&&k(l,!1)}}async function A(){const he=++p;let pe=!1;try{const De=await n().listPlugins();if(he===p){k(s,De,!0),k(c,""),k(u,""),k(l,!1),C(De);const qe=WA(De);bg(),pe=await qe,k(h,d(h)||pe||M(De),!0),bg()}}catch(De){he===p&&(k(u,ni(De),!0),k(l,!1))}return z(),pe}async function N(){await A()&&k(h,!0)}async function z(){try{k(o,await n().getRuntime(),!0),k(a,"")}catch(he){k(a,ni(he),!0)}}async function D(he,pe,De){const qe=g.get(he);if((qe==null?void 0:qe.state)==="working"||(qe==null?void 0:qe.state)==="reconciling")return!1;g.set(he,{state:"working",message:"",operation:pe});let Y=!1;try{await De(),Y=!0,g.delete(he),await N()}catch(ke){const $=nI(ke);if($==="rejected-maintenance")g.set(he,{state:"notice-rejected",message:b("settings.plugin-manager.maintenance-busy"),operation:pe});else if($==="ambiguous"){g.set(he,{state:"reconciling",message:b("settings.plugin-manager.confirming-state"),operation:pe});try{const ie=await LL(pe,he,()=>n().listPlugins(),m);ie==="ok"?(g.delete(he),Y=!0,await N()):ie==="notice-finishing"?g.set(he,{state:"notice-finishing",message:b("settings.plugin-manager.operation-finishing"),operation:pe}):g.set(he,{state:"outcome-unknown",message:b("settings.plugin-manager.outcome-unknown"),operation:pe})}catch(ie){g.set(he,{state:"outcome-unknown",message:ni(ie),operation:pe})}}else g.set(he,{state:"error",message:ni(ke),operation:pe}),await A()}finally{k(f,null)}return Y}function G(){N()}function K(){N()}function oe(he){g.delete(he)}Un(()=>{O(),z()});var re=GL(),ye=v(re),q=v(ye),Z=x(ye,2);{var J=he=>{var pe=zL(),De=v(pe),qe=v(De),Y=x(De,2);P(Y,"variant","primary");var ke=v(Y),$=x(Y,2);P($,"variant","ghost");var ie=v($);y((le,Te,Ke)=>{S(qe,le),S(ke,Te),S(ie,Ke)},[()=>b("settings.plugin-manager.plugin-updated-notice"),()=>b("settings.plugin-manager.reload-now"),()=>b("settings.plugin-manager.later")]),ge("click",Y,()=>window.location.reload()),ge("click",$,()=>k(h,!1)),R(he,pe)};X(Z,he=>{d(h)&&he(J)})}var me=x(Z,2);{let he=V(()=>{var pe;return(pe=ee.deviceInfo)==null?void 0:pe.architecture});IL(me,{get architecture(){return d(he)},uploadFile:pe=>n().uploadPlugin(pe),onInstalled:G,onApprove:pe=>D(pe,{kind:"approve"},()=>n().approvePlugin(pe)),onDeny:pe=>D(pe,{kind:"deny"},()=>n().denyPlugin(pe)),onDismiss:K})}var ce=x(me,2);{var Ee=he=>{var pe=DL(),De=v(pe);y(qe=>S(De,qe),[()=>b("settings.plugin-manager.loading")]),R(he,pe)},xe=he=>{var pe=HL(),De=v(pe),qe=v(De),Y=x(De,2);P(Y,"variant","secondary");var ke=v(Y);y($=>{S(qe,d(c)),S(ke,$)},[()=>b("settings.plugin-manager.retry")]),ge("click",Y,()=>void O()),R(he,pe)},Ze=he=>{var pe=FL(),De=tt(pe);{var qe=Re=>{var Je=BL(),Qe=v(Je),$t=v(Qe),Ct=x(Qe,2);P(Ct,"variant","secondary");var ln=v(Ct),jt=x(Ct,2);P(jt,"variant","ghost");var cn=v(jt);y((en,un)=>{S($t,d(u)),S(ln,en),S(cn,un)},[()=>b("settings.plugin-manager.retry"),()=>b("settings.plugin-manager.dismiss")]),ge("click",Ct,()=>void A()),ge("click",jt,()=>k(u,"")),R(Re,Je)};X(De,Re=>{d(u)&&Re(qe)})}var Y=x(De,2),ke=v(Y),$=v(ke),ie=x(ke,2);{var le=Re=>{var Je=UL(),Qe=v(Je),$t=v(Qe),Ct=x(Qe,2),ln=v(Ct),jt=x(Ct,2),cn=v(jt),en=x(jt,2),un=v(en),vn=x(en,2),jn=v(vn);y((B,fe,ae,Q,ze,Be,Rt)=>{Oe(Je,"aria-label",B),S($t,fe),S(ln,`${ae??""}:
|
|
90
|
-
${d(o).currentExec??""}/${d(o).maxConcurrentExecTotal??""}`),S(cn,`${Q??""}:
|
|
91
|
-
${d(o).reservedServices??""}/${d(o).maxSupervisedServices??""}`),S(un,`${ze??""}:
|
|
92
|
-
${d(o).maxConcurrentExecPerPlugin??""}`),S(jn,`${Be??""}:
|
|
93
|
-
${Rt??""}`)},[()=>b("settings.backend-capacity"),()=>b("settings.backend-capacity"),()=>b("settings.plugin-manager.exec"),()=>b("settings.plugin-manager.services"),()=>b("settings.plugin-manager.per-plugin-exec-limit"),()=>b("settings.plugin-manager.service-protocols"),()=>d(o).supportedServiceProtocols.join(", ")]),R(Re,Je)},Te=Re=>{var Je=$L(),Qe=v(Je);y($t=>S(Qe,$t),[()=>b("settings.plugin-manager.runtime-status-unavailable",{error:d(a)})]),R(Re,Je)};X(ie,Re=>{d(o)?Re(le):d(a)&&Re(Te,1)})}var Ke=x(ie,2);xt(Ke,17,()=>d(_).filter(Re=>Re.runtime!==void 0),Re=>Re.name,(Re,Je)=>{const Qe=V(()=>d(Je).runtime);var $t=jL(),Ct=v($t),ln=v(Ct),jt=x(Ct,2);{var cn=ae=>{var Q=qa(),ze=v(Q);y(Be=>S(ze,`${Be??""}: ${d(Qe).requiredProtocol??""}`),[()=>b("settings.plugin-manager.protocol")]),R(ae,Q)};X(jt,ae=>{var Q;((Q=d(Qe))==null?void 0:Q.requiredProtocol)!==void 0&&ae(cn)})}var en=x(jt,2);{var un=ae=>{var Q=qa(),ze=v(Q);y(Be=>S(ze,Be),[()=>b("settings.plugin-manager.incompatible")]),R(ae,Q)};X(en,ae=>{var Q;((Q=d(Qe))==null?void 0:Q.compatible)===!1&&ae(un)})}var vn=x(en,2);{var jn=ae=>{var Q=qa(),ze=v(Q);y(Be=>S(ze,`${Be??""}: ${d(Qe).lastError??""}`),[()=>b("settings.plugin-manager.last-error")]),R(ae,Q)};X(vn,ae=>{var Q;(Q=d(Qe))!=null&&Q.lastError&&ae(jn)})}var B=x(vn,2);{var fe=ae=>{var Q=qa(),ze=v(Q);y((Be,Rt)=>S(ze,`${Be??""}:
|
|
94
|
-
${Rt??""}`),[()=>b("settings.plugin-manager.supported-service-protocols"),()=>d(Qe).supportedProtocols.join(", ")]),R(ae,Q)};X(B,ae=>{var Q;((Q=d(Qe))==null?void 0:Q.compatible)===!1&&d(Qe).supportedProtocols&&ae(fe)})}y(()=>S(ln,d(Je).name)),R(Re,$t)});var Xe=x(Y,2);{var wt=Re=>{TL(Re,{get items(){return d(w)},get confirmingName(){return d(f)},rowStateFor:E,onApprove:Je=>D(Je,{kind:"approve"},()=>n().approvePlugin(Je)),onDeny:Je=>D(Je,{kind:"deny"},()=>n().denyPlugin(Je)),onRequestConfirm:Je=>k(f,Je,!0),onCancelConfirm:()=>k(f,null),onRefresh:()=>void A(),onKeepNotice:oe})};X(Xe,Re=>{d(w).length>0&&Re(wt)})}var Et=x(Xe,2);pL(Et,{get items(){return d(_)},get confirmingName(){return d(f)},rowStateFor:E,get permissionVisible(){return r()},get permissionAvailable(){return i()},onEnable:Re=>D(Re,{kind:"enable"},()=>n().enablePlugin(Re)),onDisable:Re=>D(Re,{kind:"disable"},()=>n().disablePlugin(Re)),onPermissionChange:(Re,Je,Qe)=>D(Re,{kind:"permission",permission:Je,enabled:Qe},()=>n().setPluginPermission(Re,Je,Qe)),onRestart:Re=>D(Re,{kind:"restart"},()=>n().restartPlugin(Re)),onDelete:Re=>D(Re,{kind:"delete"},()=>n().deletePlugin(Re)),onRequestConfirm:Re=>k(f,Re,!0),onCancelConfirm:()=>k(f,null),onRefresh:()=>void A(),onKeepNotice:oe}),y(Re=>S($,Re),[()=>b("settings.plugin-manager.diagnostics")]),R(he,pe)};X(ce,he=>{d(l)?he(Ee):d(c)?he(xe,1):he(Ze,-1)})}y(he=>S(q,he),[()=>b("settings.plugin-manager.title")]),R(t,re),Ge()}ht(["click"]);var ZL=I('<section class="mndw-plugin-settings"><!></section>');function WL(t,e){var n=ZL(),r=v(n);VL(r,{get permissionVisible(){return e.permissionVisible},get permissionAvailable(){return e.permissionAvailable}}),R(t,n)}class w_ extends Sa{constructor(e,n,r,i){super(e,n,i,r),this.name="SelfUpdateError"}}const hr=(t,e,n,r)=>new w_(t,e,r,n),y_=t=>t==="update"||t==="revert";function qL(t){if(!En(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!Zr(t.version)||t.operation!==void 0&&!y_(t.operation))throw ft(hr);for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!Zr(t[i]))throw ft(hr);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 KL(t){if(!En(t)||!Zr(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!Zr(t.targetVersion)||t.rollbackVersion!==void 0&&!Zr(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw ft(hr);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 fg(t){if(!En(t)||!y_(t.operation)||!Zr(t.targetVersion))throw ft(hr);return{operation:t.operation,targetVersion:t.targetVersion}}function YL(t=globalThis.fetch){const e=Ta(t,hr);async function n(r){return e.request(r,{method:"POST",json:{}})}return{async status(){return qL(await e.request(mC,{method:"GET"}))},async check(){return KL(await n(vC))},async apply(){return fg(await n(bC))},async revert(){return fg(await n(_C))}}}const XL=YL();var JL=I("<mndw-button> </mndw-button>",2),QL=I('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p role="status" class="svelte-1khkewm"> </p> <!></div>');function e3(t,e){Fe(e,!0);const n=V(()=>e.progress.phase==="preparing"?b("settings.self-update-preparing"):e.progress.phase==="unconfirmed"?b("settings.self-update-unconfirmed-modal"):e.progress.operation==="revert"?b("settings.self-update-reverting",{version:e.progress.targetVersion}):b("settings.self-update-updating",{version:e.progress.targetVersion}));var r=QL(),i=v(r),s=v(i),o=x(i,2);{var a=l=>{var c=JL();P(c,"variant","secondary"),Ne(c,1,"svelte-1khkewm");var u=v(c);y(f=>S(u,f),[()=>b("common.close")]),ge("click",c,()=>e.close("close")),R(l,c)};X(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>S(s,d(n))),R(t,r),Ge()}ht(["click"]);var Ru=I('<p class="svelte-1ffuaq9"> </p>'),Ka=I('<p role="status" class="svelte-1ffuaq9"> </p>'),hg=I('<p role="alert" class="svelte-1ffuaq9"> </p>'),t3=I('<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 n3(t,e){Fe(e,!0);let n=Xt(e,"pollIntervalMs",3,2e3),r=Xt(e,"pollAttempts",3,90);const i="settings.self-update.check",s="settings.self-update.apply",o="settings.self-update.revert",a="settings.self-update.status";let l=V(()=>e.client??XL),c=se(null),u=se(null),f=se(""),h=se(""),p=se("idle"),g=se(""),m=se(!1),_=null,w=0,E=0,M=!1,C=!1,O=se(null),A=null;Un(()=>{D()}),Si(()=>{M=!0,N(),me()});function N(){w+=1,_!==null&&(window.clearTimeout(_),_=null)}function z(j){k(c,j,!0),j.state==="failed"?(k(g,j.failureCode??"unknown",!0),k(p,"failure"),C=!1,me()):j.state==="idle"&&C?(C=!1,k(p,"idle"),Ve.success(b("settings.self-update-success",{version:j.version}),{key:q(d(h))}),me()):j.state==="in-progress"&&(k(p,"idle"),d(O)!==null&&(d(O).phase="running",d(O).targetVersion=j.targetVersion??d(O).targetVersion,j.operation!==void 0&&(d(O).operation=j.operation)))}async function D(){k(m,!0);try{const j=await d(l).status();if(M)return;z(j),j.state==="in-progress"&&(C=!0,G())}catch{k(p,"error")}finally{k(m,!1)}}function G(){if(N(),E=Math.max(0,r()),E===0){oe();return}K(w)}function K(j){M||j!==w||E<=0||(_=window.setTimeout(()=>{_=null,re(j)},n()))}function oe(){N(),k(p,"unconfirmed"),d(O)!==null&&(d(O).phase="unconfirmed")}async function re(j){if(!(M||j!==w)){E-=1;try{const we=await d(l).status();if(M||j!==w)return;z(we),we.state==="in-progress"?E<=0?oe():K(j):N()}catch{if(E<=0){oe();return}K(j)}}}function ye(j){return j instanceof w_?j.code:"UNKNOWN"}function q(j){return j==="update"?s:j==="revert"?o:a}async function Z(j,we){const Ue=j==="update";return(await ki(jl,{title:b(Ue?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:b(Ue?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:we}),confirmLabel:b(Ue?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function J(j){k(O,{operation:j,phase:"preparing",targetVersion:""},!0);const Ue=d(O);if(Ue===null)return;const ct=ki(e3,{title:b("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:Ue}});A=ct,ct.closed.then(()=>{A===ct&&(A=null,k(O,null))})}function me(){A==null||A.close(void 0,"api")}async function ce(j){try{const we=await d(l).status();if(M)return;z(we),we.state==="in-progress"?(C=!0,G()):(k(p,"idle"),Ve.info(b("settings.self-update-busy"),{key:j}))}catch{if(M)return;k(p,"idle"),Ve.info(b("settings.self-update-busy"),{key:j})}}async function Ee(){N(),C=!1,k(m,!0),k(p,"checking"),k(g,"");try{const j=await d(l).check();if(M)return;k(u,j,!0),k(p,"idle"),j.updateAvailable?Ve.dismissKey(i):Ve.info(b("settings.self-update-no-update"),{key:i})}catch(j){if(M)return;k(u,null),ye(j)==="OPKG_BUSY"?await ce(i):(k(p,"idle"),Ve.error(b("settings.self-update-failure-generic"),{key:i}))}finally{M||k(m,!1)}}async function xe(){const j=d(u);j===null||!j.updateAvailable||j.targetVersion===void 0||await Z("update",j.targetVersion)&&(M||await qe("update",()=>d(l).apply()))}async function Ze(){d(ie)!==""&&await Z("revert",d(ie))&&(M||await qe("revert",()=>d(l).revert()))}function he(j){N(),k(u,null),k(f,""),k(h,j,!0),k(g,""),k(m,!0),k(p,"preparing"),C=!1}async function pe(j){const we=await j();M||(k(f,we.targetVersion,!0),k(h,we.operation,!0),d(O)!==null&&(d(O).phase="running",d(O).targetVersion=we.targetVersion),k(p,"idle"),C=!0,G())}async function De(j,we){if(M)return;const Ue=q(we);switch(me(),ye(j)){case"OPKG_BUSY":await ce(Ue);return;case"SELF_UPDATE_NOT_AVAILABLE":Ve.info(b("settings.self-update-no-update"),{key:Ue});break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":Ve.info(b("settings.self-update-rollback-unavailable"),{key:Ue});break;default:Ve.error(b("settings.self-update-failure-generic"),{key:Ue})}k(g,""),k(p,"idle")}async function qe(j,we){he(j),J(j);try{await pe(we)}catch(Ue){await De(Ue,j)}finally{M||k(m,!1)}}function Y(j){return b({"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"}[j]??"settings.self-update-failure-generic")}const ke=V(()=>{var j;return((j=d(c))==null?void 0:j.version)??""}),$=V(()=>{var j,we;return((j=d(c))==null?void 0:j.state)==="in-progress"?d(f)||d(c).targetVersion||"":((we=d(u))==null?void 0:we.targetVersion)||""}),ie=V(()=>{var j,we;return((j=d(u))==null?void 0:j.rollbackVersion)||((we=d(c))==null?void 0:we.rollbackVersion)||""}),le=V(()=>{var j;return((j=d(u))==null?void 0:j.updateAvailable)===!0&&!d(m)}),Te=V(()=>{var j,we;return(((j=d(u))==null?void 0:j.rollbackAvailable)===!0||!!((we=d(c))!=null&&we.rollbackVersion))&&!d(m)});var Ke=t3(),Xe=v(Ke),wt=v(Xe),Et=x(Xe,2),Re=v(Et),Je=x(Et,2);{var Qe=j=>{var we=Ru(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-current",{version:d(ke)})]),R(j,we)};X(Je,j=>{d(ke)&&j(Qe)})}var $t=x(Je,2);{var Ct=j=>{var we=Ru(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-rollback",{version:d(ie)})]),R(j,we)};X($t,j=>{d(ie)&&j(Ct)})}var ln=x($t,2);{var jt=j=>{var we=Ka(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-checking")]),R(j,we)},cn=j=>{var we=Ka(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-preparing")]),R(j,we)},en=j=>{var we=Ka(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b(d(h)==="revert"||d(c).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:d($)})]),R(j,we)},un=j=>{var we=hg(),Ue=v(we);y(ct=>S(Ue,ct),[()=>Y(d(g))]),R(j,we)},vn=j=>{var we=Ka(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-unconfirmed")]),R(j,we)},jn=j=>{var we=hg(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-failure-generic")]),R(j,we)};X(ln,j=>{var we;d(p)==="checking"?j(jt):d(p)==="preparing"?j(cn,1):((we=d(c))==null?void 0:we.state)==="in-progress"&&d(p)!=="unconfirmed"?j(en,2):d(p)==="failure"?j(un,3):d(p)==="unconfirmed"&&d(O)===null?j(vn,4):d(p)==="error"&&j(jn,5)})}var B=x(ln,2);{var fe=j=>{var we=Ru(),Ue=v(we);y(ct=>S(Ue,ct),[()=>b("settings.self-update-available",{version:d(u).targetVersion})]),R(j,we)};X(B,j=>{d(u)!==null&&d(u).updateAvailable&&d(u).targetVersion!==void 0&&j(fe)})}var ae=x(B,2),Q=v(ae);P(Q,"variant","secondary"),y(()=>P(Q,"disabled",d(m)));var ze=v(Q),Be=x(Q,2);P(Be,"variant","primary"),y(()=>P(Be,"disabled",!d(le)));var Rt=v(Be),nt=x(Be,2);P(nt,"variant","secondary"),y(()=>P(nt,"disabled",!d(Te)));var mt=v(nt);y((j,we,Ue,ct,tn,yr)=>{Oe(Ke,"data-locale",ee.locale),Oe(Ke,"aria-label",j),S(wt,we),S(Re,Ue),S(ze,ct),S(Rt,tn),S(mt,yr)},[()=>b("settings.self-update-tab"),()=>b("settings.self-update-tab"),()=>b("settings.self-update-description"),()=>d(p)==="checking"?b("settings.self-update-checking"):b("settings.self-update-check"),()=>b("settings.self-update-apply"),()=>b("settings.self-update-revert")]),ge("click",Q,()=>void Ee()),ge("click",Be,()=>void xe()),ge("click",nt,()=>void Ze()),R(t,Ke),Ge()}ht(["click"]);const Gl=[{id:"general",route:ut.settingsTab.general,labelKey:"settings.general-tab",icon:"settings"},{id:"diagnostics",route:ut.settingsTab.diagnostics,labelKey:"settings.diagnostics-tab",icon:"diagnostics"},{id:"plugins",route:ut.settingsTab.plugins,labelKey:"settings.plugins-tab",icon:"plugins"},{id:"self-update",route:ut.settingsTab["self-update"],labelKey:"settings.self-update-tab",icon:"refresh"}],pg="general";function gg(t){var e;return((e=Gl.find(n=>n.id===t))==null?void 0:e.route)??ut.settingsTab[t]}function r3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of Gl)if(e===n.route)return n.id;return null}var i3=I("<mndw-tab> </mndw-tab>",2),s3=I('<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 mg(t,e){Fe(e,!0);let n=se(!1),r=se(!1);const i=V(()=>{const C=(It==null?void 0:It.route.pathname)??globalThis.location.pathname;return r3(C)??pg});Un(()=>{const C=It;(C==null?void 0:C.route.pathname)===ut.settings&&C.navigate(gg(pg),{replace:!0})});function s(C){const O=Gl.find(N=>N.id===C.detail.value),A=It;O===void 0||A===void 0||A.navigate(gg(O.id))}function o(C){k(n,C.visible,!0),k(r,C.available,!0)}var a=s3(),l=v(a),c=v(l),u=x(l,2);y(()=>P(u,"value",d(i)));var f=v(u);xt(f,17,()=>Gl,C=>C.id,(C,O)=>{var A=i3();y(()=>P(A,"id",d(O).id)),y(()=>P(A,"data-icon",d(O).icon));var N=v(A);y(z=>S(N,z),[()=>b(d(O).labelKey)]),R(C,A)});var h=x(f,2);P(h,"for","general");var p=v(h);XI(p,{onPermissionStateChange:o});var g=x(h,2);P(g,"for","diagnostics");var m=v(g);KN(m,{});var _=x(g,2);P(_,"for","plugins");var w=v(_);WL(w,{get permissionVisible(){return d(n)},get permissionAvailable(){return d(r)}});var E=x(_,2);P(E,"for","self-update");var M=v(E);n3(M,{}),y(C=>{Oe(a,"data-locale",ee.locale),S(c,C)},[()=>b("settings.title")]),kt("mndwchange",u,s),R(t,a),Ge()}let It,Vl,k_=Yi,Po;function bs(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function o3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||bs(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function a3(t,e){if(Cb(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function E_(t=Yi){const e=Gf(t),n={},r=new Map;for(const o of e){const{name:a,route:l}=o;o3(l,a),a3(bs(l),a);const c=bs(l),u=`${c}/*child`,f=r.get(c);if(f!==void 0)throw new Error(`Page route collision: plugin "${a}" route "${l}" conflicts with plugin "${f}" route "${c}"`);n[c]=Yp,n[u]=Yp,r.set(c,a)}const i=new Map;for(const[o,a]of r)i.set(a,o);return{routes:n,pageTable:{baseRouteOf(o){return i.get(o)},pluginNameOf(o){return r.get(bs(o))}}}}function vg(){return Gf(Yi).flatMap(t=>{const e=It.pluginPages.baseRouteOf(t.name);return e===void 0?[]:[{route:e,name:t.name}]})}function S_(t){return{[ut.dashboard]:Pu,[ut.login]:Pu,[ut.packages]:ng,[ut.packageServices]:ng,[ut.settings]:mg,...Object.fromEntries(Object.values(ut.settingsTab).map(e=>[e,mg])),...t,"*":Pu}}function l3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Zf(t,e){var a;const n=l3(t),r=n.indexOf("/",1),i=r===-1?n:n.slice(0,r);let s;if("pluginNameOf"in e?s=e.pluginNameOf(i):s=(a=e.find(l=>bs(l.route)===bs(i)))==null?void 0:a.name,s===void 0)return null;const o=n.slice(i.length);return{name:s,childPath:o==="/"?"":o}}function c3(){const t=globalThis.location.pathname,e=Zf(t,It.pluginPages);if(e!==null)try{decodeURIComponent(t)}catch{const r=It.pluginPages.baseRouteOf(e.name);if(r===void 0)return;globalThis.history.replaceState(globalThis.history.state,"",`${r}${globalThis.location.search}${globalThis.location.hash}`)}}function u3(t=Yi){const{routes:e,pageTable:n}=E_(t),r=S_(e),i={layout:TM,...r},s={[ut.dashboard]:i};k_=t,Vl=n,Po=i;const o=f0(s);return It=Object.defineProperty(o,"pluginPages",{configurable:!0,enumerable:!0,get:()=>Vl}),c3(),It}function bg(){if(Po===void 0||It===void 0)return;const t=Vl,e=Zf(It.route.pathname,t),{routes:n,pageTable:r}=E_(k_),i=S_(n);for(const s of Object.keys(Po))s!=="layout"&&delete Po[s];Object.assign(Po,i),Vl=r,e!==null&&r.baseRouteOf(e.name)===void 0&&It.navigate(ut.dashboard)}function xa(){const t=It;if(t!==void 0)return{pageTable:t.pluginPages,navigate:e=>t.navigate(e)}}const T_={importPluginModule:()=>vl(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>vl(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function Ya(){return{received:!1,value:void 0}}function d3(t,e,n=()=>!0){let r=Ya(),i=Ya(),s=!1,o=Promise.resolve();const a=()=>{s||(s=!0,queueMicrotask(()=>{s=!1;const l=r,c=i;r=Ya(),i=Ya();const u={importPluginModule:l.received?()=>Promise.resolve(l.value):e.importPluginModule,importManifestModule:c.received?()=>Promise.resolve(c.value):e.importManifestModule};o=o.then(()=>QA({...u,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale(),isCurrent:n,pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,telemetryGathering:t.telemetryGathering,eventStream:t.eventStream,navigation:xa}})).then(()=>{}).catch(f=>{console.error("[mndw] Sandbox HMR transaction failed:",f)})}))};return{plugin:l=>{r={received:!0,value:l},a()},manifest:l=>{i={received:!0,value:l},a()}}}function f3(t,e=void 0,n=T_,r=()=>!0){if(e===void 0)return;const i=d3(t,n,r);e.accept("virtual:sandbox-plugin",s=>{i.plugin(s)}),e.accept("virtual:sandbox-manifest",s=>{i.manifest(s)})}function h3(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 _g=Ye({exact:be(),cdate:be()}),wg=Ye({version:be()}),p3=Ye({release:be(),sandbox:be().optional(),title:be().optional(),arch:be(),ndm:_g,bsp:_g,ndw:Ye({version:be().optional(),features:be(),components:be()}),ndw3:wg.optional(),ndw4:wg.optional(),manufacturer:be(),vendor:be(),series:be(),model:be(),hw_version:be(),hw_type:be().optional(),hw_id:be(),device:be(),region:be(),description:be()}),g3=()=>{const t={path:"show.version"};return Bf.driver.queue(t).pipe(X_(e=>p3.parse(e)))};function m3(){return Promise.resolve({theme:Ls(),locale:Pf()})}function v3(){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 b3(){try{const t=await Tg(g3().pipe(xg(hb)));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:Np(t.ndw.features),components:Np(t.ndw.components)}}catch{return v3()}}async function _3(t){const e=b3(),n=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:p_(),usbPortCount:0})),[r,i]=await Promise.all([e,n]),s=new Set(r.features.map(a=>a.toLowerCase())),o=h3(i.usbPortCount,a=>s.has(a.toLowerCase()));return{...r,switchports:i.switchports,usb:o}}function w3(){return!0}async function Wf(t,e={}){const n=JR(e.preservePluginLoadError),r=()=>n===Nr(),i=e.loadPlugins??qA,s=e.loadSandboxPlugin??XA,o=e.createRouter??u3;try{try{const a=await m3();r()&&(ee.hostInfo=a)}catch(a){r()&&console.error("[mndw] Failed to fetch host info:",a)}if(!r())return;try{const a=await _3(t.mgmtClient);r()&&(ee.deviceInfo=a)}catch(a){r()&&console.error("[mndw] Failed to fetch device info:",a)}if(!r())return;if(w3()){let a=T_,l=e.setupHmr??((c,u)=>f3(c,void 0,void 0,u));{const c=await vl(()=>import("./sandbox-url-D8HO7UBF.js"),[]);if(!r())return;a=c.sandboxUrlImports(),l=e.setupHmr??((u,f)=>c.setupSandboxUrlHmr(u,void 0,f))}if(await s({...a,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale(),isCurrent:r,pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,telemetryGathering:t.telemetryGathering,eventStream:t.eventStream,navigation:xa}}),!r())return;l(t,r)}if(!r()||(o(t.registry),!r()))return;ee.ready=!0}finally{eA(n)}return n}var y3=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),k3=I('<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> <p class="mndw-login__hint"> </p> <!> <mndw-button> </mndw-button></form></div>',2);function E3(t,e){Fe(e,!0);const n=Lr();let r=se(lt(ee.loginUsername)),i=se(""),s=se(lt(ee.loginError??"")),o=se(!1),a=se(!1);ee.loginUsername="",ee.loginError=null;let l;Un(()=>{let q=!0;return(async()=>{await customElements.whenDefined("mndw-input");const J=l;if(!q||!J||(await J.updateComplete,!q))return;const me=U_();(me===null||me===document.body)&&J.focus()})(),()=>{q=!1}});function c(){return d(r).trim()!==""&&d(i)!==""}function u(){return c()&&!d(o)&&!d(a)}function f(q){ee.localeSwitchPending||n.locale.setLocale(q.detail.value).catch(()=>{})}function h(q){k(r,q.detail.value,!0),k(a,!1)}function p(q){k(i,q.detail.value,!0),k(a,!1)}function g(q){const Z=q.target,J=q.composedPath()[0];q.key!=="Enter"||!(Z instanceof HTMLElement)||Z.localName!=="mndw-input"||J instanceof HTMLButtonElement||(q.preventDefault(),u()&&m(q))}function m(q){q.preventDefault(),u()&&(k(o,!0),k(s,""),n.rci.login(d(r),d(i)).subscribe({next(Z){if(Z){const J=d(r);ee.authenticated=!0;const me=Wf(n),ce=Nr();me.catch(()=>{ce===Nr()&&(Tc(),ee.loginError=b("login.connection-failed"),ee.loginUsername=J)})}else k(s,b("login.invalid-credentials"),!0),k(o,!1),k(a,!0)},error(){k(s,b("login.connection-failed"),!0),k(o,!1),k(a,!1)}}))}var _=k3(),w=v(_),E=v(w);Ne(E,1,"mndw-login__locale-select"),y(()=>P(E,"label",b("nav.language"))),y(()=>P(E,"value",ee.locale)),y(()=>P(E,"aria-busy",String(ee.localeSwitchPending)));var M=v(E);P(M,"value","en");var C=x(M,2);P(C,"value","ru");var O=x(E,4);y(()=>P(O,"label",b("login.username")));var A=v(O);P(A,"name","username"),P(A,"autocomplete","username"),y(()=>P(A,"value",d(r))),y(()=>P(A,"disabled",d(o))),bi(A,q=>l=q,()=>l);var N=x(O,2);y(()=>P(N,"label",b("login.password")));var z=v(N);P(z,"type","password"),P(z,"name","password"),P(z,"autocomplete","current-password"),y(()=>P(z,"value",d(i))),y(()=>P(z,"disabled",d(o)));var D=x(N,2),G=v(D),K=x(D,2);{var oe=q=>{var Z=y3(),J=v(Z);y(()=>S(J,d(s))),R(q,Z)};X(K,q=>{d(s)&&q(oe)})}var re=x(K,2);Ne(re,1,"mndw-login__submit"),P(re,"variant","primary"),P(re,"type","submit"),y(()=>P(re,"disabled",!u()));var ye=v(re);y((q,Z)=>{Oe(_,"data-locale",ee.locale),S(G,q),S(ye,Z)},[()=>b("login.hint"),()=>d(o)?b("login.logging-in"):b("login.submit")]),kt("submit",w,m),kt("mndwchange",E,f),kt("mndwinput",A,h),ge("keydown",A,g),kt("mndwinput",z,p),ge("keydown",z,g),R(t,_),Ge()}ht(["keydown"]);var S3=I('<div class="mndw-loading" role="status" aria-busy="true"> </div>'),T3=I("<!> <!> <!>",1);function x3(t,e){Fe(e,!0),wO(e.services);var n=T3(),r=tt(n);pA(r,{});var i=x(r,2);SA(i,{});var s=x(i,2);{var o=c=>{E3(c,{})},a=c=>{var u=Bn(),f=tt(u);gm(f,()=>ee.pluginLoadRevision,h=>{m0(h,{})}),R(c,u)},l=c=>{var u=S3(),f=v(u);y(h=>{Oe(u,"data-locale",ee.locale),S(f,h)},[()=>b("app.loading")]),R(c,u)};X(s,c=>{ee.authenticated?ee.ready?c(a,1):c(l,-1):c(o)})}R(t,n),Ge()}async function P3(t){const e=t.initLocale();t.defineUi(e),t.initTheme();try{await t.initPalette()}catch(i){console.warn("[mndw] Palette startup load failed; continuing to login.",i)}let n=!1;try{n=await t.checkAuthenticated()}catch{n=!1}t.setAuthenticated(n);let r=!1;if(t.subscribeAuthErrors(()=>{r=!0,t.resetToLogin()}),t.mountApp(),n&&!r){let i;try{const s=t.initAuthenticated();i=t.getAuthRunGeneration(),await s}catch{(i===void 0||i===t.getAuthRunGeneration())&&t.resetToLogin()}}}const Od="mndw-palette-override",C3=":root:root";function R3(t){const e=t.getElementById(Od);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=Od,t.head.appendChild(n),n}function uo(t,e){var n;if(e===null){(n=t.getElementById(Od))==null||n.remove();return}R3(t).textContent=YT(e,{selector:C3})}function is(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function A3(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function O3(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>is(n??xA),s=()=>{const a=i();for(const l of r)l(is(a))},o=async a=>{const l=await t.mgmtClient.getPalette();let c=null;if(l!==null){const f=ob(l);if(f.palette===null)throw new Error("The device returned an invalid palette.");c=f.palette}const u=A3(n,c);n=c,uo(e,c),a&&u&&s()};return{getApplied:()=>n===null?null:is(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=is(a);uo(e,l);for(const c of r)c(is(l))},discardPreview:()=>{uo(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=is(a),uo(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,uo(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}const M3=O3({mgmtClient:Fl}),{service:N3}=Af("@mndw/ui","@mndw/ui"),I3=N3;function L3(t=globalThis.fetch){return RP(t)}const z3=L3(),D3=500,H3=5e3,yg=.2,B3=100,U3=1024,$3=2048,j3=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),F3=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),G3=(t,e)=>{if(t==="*")return e;if(e==="*"||t===e||t.startsWith(`${e}.`))return t;if(e.startsWith(`${t}.`))return e},V3=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=G3(r,i);s!==void 0&&n.add(s)}return[...n]},Z3=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]},W3=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0,Md=t=>{if(Array.isArray(t)){for(const n of t)Md(n);Object.freeze(t);return}if(t===null||typeof t!="object")return;const e=Object.getPrototypeOf(t);if(!(e!==Object.prototype&&e!==null)){for(const n of Object.values(t))Md(n);Object.freeze(t)}};class q3{constructor(e={}){W(this,"socketFactory");W(this,"schedule");W(this,"cancelSchedule");W(this,"random");W(this,"diagnostic");W(this,"registrations",new Map);W(this,"deliveredIds",new Set);W(this,"deliveredOrder",[]);W(this,"liveBuffer",[]);W(this,"socket");W(this,"lastSentWireFilters");W(this,"reconnectTimer");W(this,"reconnectAttempt",0);W(this,"nextHandlerId",1);W(this,"lastSeenId","");W(this,"replayCursor","");W(this,"catchingUp",!1);W(this,"replaying",!1);W(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=Z3(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 ll(a=>{const l=this.registrations.get(e);if(l===void 0){a.complete();return}const c=V3(j3(o),l.grants);if(c.length===0){a.complete();return}const u=this.nextHandlerId++;return l.subscriptions.set(u,{filters:c,handler:f=>a.next(f)}),this.updateWireSubscription(),()=>{l.subscriptions.delete(u)&&this.updateWireSubscription()}}).pipe(Qf(i.ended$)),resync$:new ll(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(Qf(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.lastSentWireFilters=void 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.lastSentWireFilters=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=W3(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=Fh.safeParse(e);if(!n.success){this.diagnostic("event stream returned invalid event",n.error);return}if(this.catchingUp){if(this.liveBuffer.length>=U3){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=>Fh.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>$3;){const n=this.deliveredOrder.shift();n!==void 0&&this.deliveredIds.delete(n)}Md(e);for(const n of this.registrations.values())for(const r of n.subscriptions.values())if(r.filters.some(i=>F3(i,e.topic)))try{r.handler(e)}catch(i){this.diagnostic(`event handler failed for ${n.pluginName}`,i)}}}sendSubscribe(e=this.effectiveWireFilters()){const n=this.lastSentWireFilters;n!==void 0&&n.length===e.length&&n.every((r,i)=>r===e[i])||(this.send({type:"subscribe",topics:[...e]}),this.lastSentWireFilters=[...e])}updateWireSubscription(){const e=this.effectiveWireFilters();if(e.length===0){this.closeSocket();return}const n=this.socket;(n==null?void 0:n.readyState)===1&&this.sendSubscribe(e),this.ensureSocket()}requestReplay(e){this.replaying||(this.replaying=!0,this.send({type:"replay",after:e,limit:B3}))}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(H3,D3*2**this.reconnectAttempt++),n=1-yg+this.random()*2*yg;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,this.lastSentWireFilters=void 0;const e=this.socket;this.socket=void 0,e!==void 0&&e.close(1e3,"no event subscribers")}}function K3(t={}){return new q3(t)}let Y3=0;function X3(t){const e=new Map,n=`host-telemetry-gathering:${++Y3}`;let r=1,i=null,s=0,o,a=!1;const l=()=>{for(const p of[...e.values()])p()},c=p=>{(i==null?void 0:i.enabled)!==p&&(i=Object.freeze({enabled:p}),l())},u=()=>{const p=++s;t.getTelemetry().then(({enabled:g})=>{p===s&&c(g)}).catch(()=>{})},f=()=>{if(o===void 0)return;const p=o;o=void 0,p.end(),a&&(a=!1,t.eventStream.disposeFacade(n))},h=()=>{o=vb();const p=t.eventStream.createFacade(n,"host",["events:telemetry"],o);p!==void 0&&(a=!0,p.select$("telemetry.gathering_changed").subscribe(g=>{g.topic==="telemetry.gathering_changed"&&(s+=1,c(g.payload.enabled))}),p.resync$.subscribe(u)),u()};return{get:()=>i,subscribe:p=>{const g=r++;return e.set(g,p),e.size===1&&h(),()=>{e.delete(g)&&e.size===0&&f()}},report:p=>{s+=1,c(p)}}}let Au;function J3(){if(Au===void 0){const t=K3();Au=Object.freeze({mgmtClient:Fl,palette:M3,catalog:kc,locale:QC,registry:Yi,persistentRci:NI,rci:Bf,telemetry:z3,telemetryGathering:X3({getTelemetry:()=>Fl.getTelemetry(),eventStream:t}),eventStream:t,overlay:I3})}return Au}const Mi=J3();function Xa(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function Q3(){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:"";(Xa(n)||Xa(r)||Xa(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);Xa(n)&&(console.error("[mndw] Plugin unhandled rejection:",e),t.preventDefault())})}function ez(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");rc(x3,{target:t,props:{services:Mi}})}async function tz(){const t=Mi.rci.isAuthenticated().pipe(xg(5e3));return Tg(t)}function nz(t){Mi.rci.authError$.subscribe(t)}async function rz(){Q3(),await P3({initLocale:()=>Mi.locale.initLocale(),defineUi:t=>$_({overlay:Mi.overlay,initialLocale:t,iconSpriteUrl:tw}),initTheme:rR,initPalette:()=>Mi.palette.initPalette(),checkAuthenticated:tz,setAuthenticated:t=>{ee.authenticated=t},initAuthenticated:()=>Wf(Mi),getAuthRunGeneration:Nr,subscribeAuthErrors:nz,resetToLogin:Tc,mountApp:ez})}rz();export{d3 as s};
|