@mndw/cli 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/meta.json +80 -24
  2. package/dist/mndw.js +382 -69
  3. package/host-dev/assets/index-BqQCCILo.css +1 -0
  4. package/host-dev/assets/index-DFVRx7na.js +94 -0
  5. package/host-dev/assets/sandbox-url-D8HO7UBF.js +1 -0
  6. package/host-dev/index.html +3 -3
  7. package/host-dev/shared/{mndw-ui@0.1.6.js → mndw-ui@0.2.0.js} +171 -156
  8. package/package.json +18 -14
  9. package/templates/angular/i18n/en.json +4 -9
  10. package/templates/angular/i18n/ru.json +4 -9
  11. package/templates/angular/src/app.component.ts +39 -39
  12. package/templates/angular/src/index.ts +14 -1
  13. package/templates/angular/src/l10n.test.ts +50 -17
  14. package/templates/go/i18n/en.json +1 -1
  15. package/templates/go/i18n/ru.json +1 -1
  16. package/templates/go/src/index.css +4 -20
  17. package/templates/go/src/index.test.ts +12 -24
  18. package/templates/go/src/index.ts +18 -15
  19. package/templates/go/src/l10n.test.ts +37 -23
  20. package/templates/svelte/i18n/en.json +4 -9
  21. package/templates/svelte/i18n/ru.json +4 -9
  22. package/templates/svelte/src/App.svelte +46 -72
  23. package/templates/svelte/src/index.ts +7 -0
  24. package/templates/svelte/src/l10n.test.ts +64 -17
  25. package/templates/svelte/svelte.config.js +7 -0
  26. package/templates/svelte/vitest.config.ts +2 -1
  27. package/templates/vanilla/i18n/en.json +4 -3
  28. package/templates/vanilla/i18n/ru.json +4 -3
  29. package/templates/vanilla/src/index.css +4 -20
  30. package/templates/vanilla/src/index.ts +47 -17
  31. package/templates/vanilla/src/l10n.test.ts +50 -17
  32. package/templates/vue/i18n/en.json +4 -9
  33. package/templates/vue/i18n/ru.json +4 -9
  34. package/templates/vue/src/App.vue +36 -54
  35. package/templates/vue/src/index.ts +7 -0
  36. package/templates/vue/src/l10n.test.ts +50 -17
  37. package/host-dev/assets/index-B_LYyF1e.css +0 -1
  38. package/host-dev/assets/index-MuieOssk.js +0 -94
  39. package/host-dev/assets/sandbox-url-CsfwrS11.js +0 -1
  40. package/templates/angular/src/table.test.ts +0 -59
  41. package/templates/svelte/src/TableNameCell.svelte +0 -10
  42. package/templates/svelte/src/table.test.ts +0 -53
  43. package/templates/vue/src/TableNameCell.vue +0 -12
  44. package/templates/vue/src/table.test.ts +0 -53
@@ -1,94 +0,0 @@
1
- var db=Object.defineProperty;var fb=Object.getPrototypeOf;var hb=Reflect.get;var Vd=t=>{throw TypeError(t)};var pb=(t,e,n)=>e in t?db(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var F=(t,e,n)=>pb(t,typeof e!="symbol"?e+"":e,n),Ul=(t,e,n)=>e.has(t)||Vd("Cannot "+n);var k=(t,e,n)=>(Ul(t,e,"read from private field"),n?n.call(t):e.get(t)),be=(t,e,n)=>e.has(t)?Vd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Me=(t,e,n,r)=>(Ul(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ne=(t,e,n)=>(Ul(t,e,"access private method"),n);var Zd=(t,e,n)=>hb(fb(t),n,e);import{setMndwUiLocale as gb,coercePlacement as Wd,isMobileSheet as mb,resolveSizing as qd,computePopoverCoords as vb,createFocusTrap as Dc,composedContains as bb,tabbableElements as _b,column as Hr,deepActiveElement as wb,defineMndwUi as yb}from"/shared/mndw-ui@0.1.6.js";import{ReplaySubject as Eb,Observable as Ta,tap as jl,timer as kb,exhaustMap as Sb,catchError as xb,EMPTY as Tb,takeUntil as Xd,Subject as Cb,Subscription as Pb,BehaviorSubject as Rb,map as Ab,firstValueFrom as wp,timeout as yp}from"/shared/rxjs@7.8.2.js";import{FetchTransport as Mb,SessionManager as Nb,RciManager as Ob}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 zb="/assets/sprite-XQfBvd_1.svg",Ep=!1;var hl=Array.isArray,Ib=Array.prototype.indexOf,Ca=Array.prototype.includes,pl=Array.from,Lb=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,kp=Object.getOwnPropertyDescriptors,Sp=Object.prototype,Db=Array.prototype,gl=Object.getPrototypeOf,Yd=Object.isExtensible;const Hb=()=>{};function Bb(t){return t()}function Hc(t){for(var e=0;e<t.length;e++)t[e]()}function xp(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function $b(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 Ut=2,Qi=4,Ao=8,Lu=1<<24,Un=16,On=32,Er=64,Bc=128,Mn=512,It=1024,At=2048,Vn=4096,sn=8192,Nn=16384,fs=32768,$c=1<<25,Wr=65536,Pa=1<<17,Ub=1<<18,hs=1<<19,Tp=1<<20,ar=1<<25,yi=65536,Ra=1<<21,$i=1<<22,Fr=1<<23,Gr=Symbol("$state"),jb=Symbol(""),ga=Symbol("attributes"),Uc=Symbol("class"),jc=Symbol("style"),zs=Symbol("text"),ma=Symbol("form reset"),Mo=new class extends Error{constructor(){super(...arguments);F(this,"name","StaleReactionError");F(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var vp;const Du=!!((vp=globalThis.document)!=null&&vp.contentType)&&globalThis.document.contentType.includes("xml");function Hu(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Fb(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Gb(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Vb(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Zb(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Wb(t){throw new Error("https://svelte.dev/e/effect_orphan")}function qb(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Xb(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Yb(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Kb(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Jb(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Qb=1,e_=2,Cp=4,t_=8,n_=16,r_=1,i_=2,Pt=Symbol("uninitialized"),s_="http://www.w3.org/1999/xhtml",o_="@attach";function a_(){console.warn("https://svelte.dev/e/derived_inert")}function l_(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function c_(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Pp(t){return t===this.v}function Rp(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Ap(t){return!Rp(t,this.v)}let No=!1,u_=!1;function d_(){No=!0}const f_=[];function Xo(t,e=!1,n=!1){return va(t,new Map,"",f_,null,n)}function va(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(hl(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]=va(c,e,n,r,null,s))}return a}if(gl(t)===Sp){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=va(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return va(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let tt=null;function es(t){tt=t}function h_(t){return Bu().get(t)}function p_(t,e){return Bu().set(t,e),e}function g_(t){return Bu().has(t)}function Ie(t,e=!1,n){tt={p:tt,i:!1,c:null,e:null,s:t,x:null,r:Ve,l:No&&!e?{s:null,u:null,$:[]}:null}}function Le(t){var e=tt,n=e.e;if(n!==null){e.e=null;for(var r of n)Jp(r)}return e.i=!0,tt=e.p,{}}function Oo(){return!No||tt!==null&&tt.l===null}function Bu(t){return tt===null&&Hu(),tt.c??(tt.c=new Map(m_(tt)||void 0))}function m_(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let ai=[];function Mp(){var t=ai;ai=[],Hc(t)}function lr(t){if(ai.length===0&&!Ys){var e=ai;queueMicrotask(()=>{e===ai&&Mp()})}ai.push(t)}function v_(){for(;ai.length>0;)Mp()}function Np(t){var e=Ve;if(e===null)return Fe.f|=Fr,t;if((e.f&fs)===0&&(e.f&Qi)===0)throw t;Br(t,e)}function Br(t,e){if(!(e!==null&&(e.f&Nn)!==0)){for(;e!==null;){if((e.f&Bc)!==0){if((e.f&fs)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const b_=-7169;function xt(t,e){t.f=t.f&b_|e}function $u(t){(t.f&Mn)!==0||t.deps===null?xt(t,It):xt(t,Vn)}function Op(t){if(t!==null)for(const e of t)(e.f&Ut)===0||(e.f&yi)===0||(e.f^=yi,Op(e.deps))}function zp(t,e,n){(t.f&At)!==0?e.add(t):(t.f&Vn)!==0&&n.add(t),Op(t.deps),xt(t,It)}function __(t,e){if(e){const n=document.body;t.autofocus=!0,lr(()=>{document.activeElement===n&&t.focus()})}}let Kd=!1;function w_(){Kd||(Kd=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n[ma])==null||e.call(n)})},{capture:!0}))}function ps(t){var e=Fe,n=Ve;pn(null),zn(null);try{return t()}finally{pn(e),zn(n)}}function y_(t,e,n,r=n){t.addEventListener(e,()=>ps(n));const i=t[ma];i?t[ma]=()=>{i(),r(!0)}:t[ma]=()=>r(!0),w_()}function E_(t){let e=0,n=kr(0),r;return()=>{Gu()&&(f(n),bl(()=>(e===0&&(r=Jr(()=>t(()=>$t(n)))),e+=1,()=>{lr(()=>{e-=1,e===0&&(r==null||r(),r=void 0,$t(n))})})))}}var k_=Wr|hs;function S_(t,e,n,r){new x_(t,e,n,r)}var Cn,Iu,Pn,di,ln,Rn,nn,_n,fr,fi,Ir,Vi,mo,vo,hr,al,pt,T_,C_,Fc,P_,Gc,ba,_a,Vc,Zc;class x_{constructor(e,n,r,i){be(this,pt);F(this,"parent");F(this,"is_pending",!1);F(this,"transform_error");be(this,Cn);be(this,Iu,null);be(this,Pn);be(this,di);be(this,ln);be(this,Rn,null);be(this,nn,null);be(this,_n,null);be(this,fr,null);be(this,fi,0);be(this,Ir,0);be(this,Vi,!1);be(this,mo,new Set);be(this,vo,new Set);be(this,hr,null);be(this,al,E_(()=>(Me(this,hr,kr(k(this,fi))),()=>{Me(this,hr,null)})));var s;Me(this,Cn,e),Me(this,Pn,n),Me(this,di,o=>{var a=Ve;a.b=this,a.f|=Bc,r(o)}),this.parent=Ve.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Me(this,ln,Io(()=>{Ne(this,pt,Gc).call(this)},k_))}defer_effect(e){zp(e,k(this,mo),k(this,vo))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!k(this,Pn).pending}update_pending_count(e,n){Ne(this,pt,Vc).call(this,e,n),Me(this,fi,k(this,fi)+e),!(!k(this,hr)||k(this,Vi))&&(Me(this,Vi,!0),lr(()=>{Me(this,Vi,!1),k(this,hr)&&ts(k(this,hr),k(this,fi))}))}get_effect_pending(){return k(this,al).call(this),f(k(this,hr))}error(e){if(!k(this,Pn).onerror&&!k(this,Pn).failed)throw e;Te!=null&&Te.is_fork?(k(this,Rn)&&Te.skip_effect(k(this,Rn)),k(this,nn)&&Te.skip_effect(k(this,nn)),k(this,_n)&&Te.skip_effect(k(this,_n)),Te.oncommit(()=>{Ne(this,pt,Zc).call(this,e)})):Ne(this,pt,Zc).call(this,e)}}Cn=new WeakMap,Iu=new WeakMap,Pn=new WeakMap,di=new WeakMap,ln=new WeakMap,Rn=new WeakMap,nn=new WeakMap,_n=new WeakMap,fr=new WeakMap,fi=new WeakMap,Ir=new WeakMap,Vi=new WeakMap,mo=new WeakMap,vo=new WeakMap,hr=new WeakMap,al=new WeakMap,pt=new WeakSet,T_=function(){try{Me(this,Rn,dn(()=>k(this,di).call(this,k(this,Cn))))}catch(e){this.error(e)}},C_=function(e){const n=k(this,Pn).failed,{reset:r,invoke_onerror:i}=Ne(this,pt,Fc).call(this,e);lr(i),n&&Me(this,_n,dn(()=>{n(k(this,Cn),()=>e,()=>r)}))},Fc=function(e){var n=!1,r=!1;const i=()=>{if(n){c_();return}n=!0,r&&Jb(),k(this,_n)!==null&&bi(k(this,_n),()=>{Me(this,_n,null)}),Ne(this,pt,_a).call(this,()=>{Ne(this,pt,Gc).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=k(this,Pn)).onerror)==null||a.call(o,e,i),r=!1}catch(l){Br(l,k(this,ln)&&k(this,ln).parent)}}}},P_=function(){const e=k(this,Pn).pending;e&&(this.is_pending=!0,Me(this,nn,dn(()=>e(k(this,Cn)))),lr(()=>{var n=Me(this,fr,document.createDocumentFragment()),r=_r();n.append(r),Me(this,Rn,Ne(this,pt,_a).call(this,()=>dn(()=>k(this,di).call(this,r)))),k(this,Ir)===0&&(k(this,Cn).before(n),Me(this,fr,null),bi(k(this,nn),()=>{Me(this,nn,null)}),Ne(this,pt,ba).call(this,Te))}))},Gc=function(){try{if(this.is_pending=this.has_pending_snippet(),Me(this,Ir,0),Me(this,fi,0),Me(this,Rn,dn(()=>{k(this,di).call(this,k(this,Cn))})),k(this,Ir)>0){var e=Me(this,fr,document.createDocumentFragment());Wu(k(this,Rn),e);const n=k(this,Pn).pending;Me(this,nn,dn(()=>n(k(this,Cn))))}else Ne(this,pt,ba).call(this,Te)}catch(n){this.error(n)}},ba=function(e){this.is_pending=!1,e.transfer_effects(k(this,mo),k(this,vo))},_a=function(e){var n=Ve,r=Fe,i=tt;zn(k(this,ln)),pn(k(this,ln)),es(k(this,ln).ctx);try{return Ei.ensure(),e()}catch(s){return Np(s),null}finally{zn(n),pn(r),es(i)}},Vc=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Ne(r=this.parent,pt,Vc).call(r,e,n);return}Me(this,Ir,k(this,Ir)+e),k(this,Ir)===0&&(Ne(this,pt,ba).call(this,n),k(this,nn)&&bi(k(this,nn),()=>{Me(this,nn,null)}),k(this,fr)&&(k(this,Cn).before(k(this,fr)),Me(this,fr,null)))},Zc=function(e){k(this,Rn)&&(Wt(k(this,Rn)),Me(this,Rn,null)),k(this,nn)&&(Wt(k(this,nn)),Me(this,nn,null)),k(this,_n)&&(Wt(k(this,_n)),Me(this,_n,null));let n=k(this,Pn).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Ne(this,pt,Fc).call(this,i);o(),n&&Me(this,_n,Ne(this,pt,_a).call(this,()=>{try{return dn(()=>{var a=Ve;a.b=this,a.f|=Bc,n(k(this,Cn),()=>i,()=>s)})}catch(a){return Br(a,k(this,ln).parent),null}}))};lr(()=>{var i;try{i=this.transform_error(e)}catch(s){Br(s,k(this,ln)&&k(this,ln).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>Br(s,k(this,ln)&&k(this,ln).parent)):r(i)})};function Ip(t,e,n,r){const i=Oo()?ml:Dp;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=Ve,l=R_(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&Nn)===0){l();try{r([...o,...p])}catch(g){Br(g,a)}Aa()}}var d=Lp();if(n.length===0){c.then(()=>u([])).finally(d);return}function h(){Promise.all(n.map(p=>A_(p))).then(u).catch(p=>Br(p,a)).finally(d)}c?c.then(()=>{l(),h(),Aa()}):h()}function R_(){var t=Ve,e=Fe,n=tt,r=Te;return function(s=!0){zn(t),pn(e),es(n),s&&(t.f&Nn)===0&&(r==null||r.activate(),r==null||r.apply())}}function Aa(t=!0){zn(null),pn(null),es(null),t&&(Te==null||Te.deactivate())}function Lp(){var t=Ve,e=t.b,n=Te,r=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,n),n.increment(r,t),()=>{e==null||e.update_pending_count(-1,n),n.decrement(r,t)}}function ml(t){var e=Ut|At;return Ve!==null&&(Ve.f|=hs),{ctx:tt,deps:null,effects:null,equals:Pp,f:e,fn:t,reactions:null,rv:0,v:Pt,wv:0,parent:Ve,ac:null}}const Is=Symbol("obsolete");function A_(t,e,n){let r=Ve;r===null&&Fb();var i=void 0,s=kr(Pt),o=!Fe,a=new Set;return Z_(()=>{var p,g;var l=Ve,c=xp();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==Mo&&c.reject(m)}).finally(Aa)}catch(m){c.reject(m),Aa()}var u=Te;if(o){if((l.f&fs)!==0)var d=Lp();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(Is);else for(const m of a.values())m.reject(Is);a.add(c),u.async_deriveds.set(l,c)}const h=(m,b=void 0)=>{d==null||d(),a.delete(c),b!==Is&&(u.activate(),b?(s.f|=Fr,ts(s,b)):((s.f&Fr)!==0&&(s.f^=Fr),ts(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Vu(()=>{for(const l of a)l.reject(Is)}),new Promise(l=>{function c(u){function d(){u===i?l(s):c(i)}u.then(d,d)}c(i)})}function fe(t){const e=ml(t);return ig(e),e}function Dp(t){const e=ml(t);return e.equals=Ap,e}function M_(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Wt(e[n])}}function Uu(t){var e,n=Ve,r=t.parent;if(!qr&&r!==null&&t.v!==Pt&&(r.f&(Nn|sn))!==0)return a_(),t.v;zn(r);try{t.f&=~yi,M_(t),e=lg(t)}finally{zn(n)}return e}function Hp(t){var e=Uu(t);if(!t.equals(e)&&(t.wv=og(),(!(Te!=null&&Te.is_fork)||t.deps===null)&&(Te!==null?(Te.capture(t,e,!0),Xs==null||Xs.capture(t,e,!0)):t.v=e,t.deps===null))){xt(t,It);return}qr||(Vt!==null?(Gu()||Te!=null&&Te.is_fork)&&Vt.set(t,e):$u(t))}function N_(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&&ps(()=>{n.ac.abort(Mo),n.ac=null}),n.fn!==null&&(n.teardown=Hb),ro(n,0),Zu(n))}function Bp(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&ns(e)}let Fl=null,Ai=null,Te=null,Xs=null,Vt=null,Wc=null,Ys=!1,Gl=!1,Di=null,wa=null;var Jd=0;let O_=1;var Zi,Lr,hi,Wi,qi,Xi,pr,Yi,cn,bo,gr,Dn,tr,Ki,pi,it,qc,Ls,Xc,$p,Up,Li,z_,Ds;const ll=class ll{constructor(){be(this,it);F(this,"id",O_++);be(this,Zi,!1);F(this,"linked",!0);be(this,Lr,null);be(this,hi,null);F(this,"async_deriveds",new Map);F(this,"current",new Map);F(this,"previous",new Map);be(this,Wi,new Set);be(this,qi,new Set);be(this,Xi,0);be(this,pr,new Map);be(this,Yi,null);be(this,cn,[]);be(this,bo,[]);be(this,gr,new Set);be(this,Dn,new Set);be(this,tr,new Map);be(this,Ki,new Set);F(this,"is_fork",!1);be(this,pi,!1);Ai===null?Fl=Ai=this:(Me(Ai,hi,this),Me(this,Lr,Ai)),Ai=this}skip_effect(e){k(this,tr).has(e)||k(this,tr).set(e,{d:[],m:[]}),k(this,Ki).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=k(this,tr).get(e);if(r){k(this,tr).delete(e);for(var i of r.d)xt(i,At),n(i);for(i of r.m)xt(i,Vn),n(i)}k(this,Ki).add(e)}capture(e,n,r=!1){e.v!==Pt&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Fr)===0&&(this.current.set(e,[n,r]),Vt==null||Vt.set(e,n)),this.is_fork||(e.v=n)}activate(){Te=this}deactivate(){Te=null,Vt=null}flush(){try{Gl=!0,Te=this,Ne(this,it,Ls).call(this)}finally{Jd=0,Wc=null,Di=null,wa=null,Gl=!1,Te=null,Vt=null,vi.clear()}}discard(){var e;for(const n of k(this,qi))n(this);k(this,qi).clear();for(const n of this.async_deriveds.values())n.reject(Is);Ne(this,it,Ds).call(this),(e=k(this,Yi))==null||e.resolve()}register_created_effect(e){k(this,bo).push(e)}increment(e,n){if(Me(this,Xi,k(this,Xi)+1),e){let r=k(this,pr).get(n)??0;k(this,pr).set(n,r+1)}}decrement(e,n){if(Me(this,Xi,k(this,Xi)-1),e){let r=k(this,pr).get(n)??0;r===1?k(this,pr).delete(n):k(this,pr).set(n,r-1)}k(this,pi)||(Me(this,pi,!0),lr(()=>{Me(this,pi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)k(this,gr).add(r);for(const r of n)k(this,Dn).add(r);e.clear(),n.clear()}oncommit(e){k(this,Wi).add(e)}ondiscard(e){k(this,qi).add(e)}settled(){return(k(this,Yi)??Me(this,Yi,xp())).promise}static ensure(){if(Te===null){const e=Te=new ll;!Gl&&!Ys&&lr(()=>{k(e,Zi)||e.flush()})}return Te}apply(){{Vt=null;return}}schedule(e){var i;if(Wc=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Qi|Ao|Lu))!==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(Di!==null&&n===Ve&&(Fe===null||(Fe.f&Ut)===0))return;if((r&(Er|On))!==0){if((r&It)===0)return;n.f^=It}}k(this,cn).push(n)}};Zi=new WeakMap,Lr=new WeakMap,hi=new WeakMap,Wi=new WeakMap,qi=new WeakMap,Xi=new WeakMap,pr=new WeakMap,Yi=new WeakMap,cn=new WeakMap,bo=new WeakMap,gr=new WeakMap,Dn=new WeakMap,tr=new WeakMap,Ki=new WeakMap,pi=new WeakMap,it=new WeakSet,qc=function(){if(this.is_fork)return!0;for(const r of k(this,pr).keys()){for(var e=r,n=!1;e.parent!==null;){if(k(this,tr).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},Ls=function(){var l,c,u,d;Me(this,Zi,!0),Jd++>1e3&&(Ne(this,it,Ds).call(this),L_());for(const h of k(this,gr))k(this,Dn).delete(h),xt(h,At),this.schedule(h);for(const h of k(this,Dn))xt(h,Vn),this.schedule(h);const e=k(this,cn);Me(this,cn,[]),this.apply();var n=Di=[],r=[],i=wa=[];for(const h of e)try{Ne(this,it,Xc).call(this,h,n,r)}catch(p){throw Gp(h),Ne(this,it,qc).call(this)||this.discard(),p}if(Te=null,i.length>0){var s=ll.ensure();for(const h of i)s.schedule(h)}if(Di=null,wa=null,Ne(this,it,qc).call(this)){Ne(this,it,Li).call(this,r),Ne(this,it,Li).call(this,n);for(const[h,p]of k(this,tr))Fp(h,p);i.length>0&&Ne(l=Te,it,Ls).call(l);return}const o=Ne(this,it,$p).call(this);if(o){Ne(this,it,Li).call(this,r),Ne(this,it,Li).call(this,n),Ne(c=o,it,Up).call(c,this);return}k(this,gr).clear(),k(this,Dn).clear();for(const h of k(this,Wi))h(this);k(this,Wi).clear(),Xs=this,Qd(r),Qd(n),Xs=null,(u=k(this,Yi))==null||u.resolve();var a=Te;if(k(this,Xi)===0&&(k(this,cn).length===0||a!==null)&&Ne(this,it,Ds).call(this),k(this,cn).length>0)if(a!==null){const h=a;k(h,cn).push(...k(this,cn).filter(p=>!k(h,cn).includes(p)))}else a=this;a!==null&&Ne(d=a,it,Ls).call(d)},Xc=function(e,n,r){e.f^=It;for(var i=e.first;i!==null;){var s=i.f,o=(s&(On|Er))!==0,a=o&&(s&It)!==0,l=a||(s&sn)!==0||k(this,tr).has(i);if(!l&&i.fn!==null){o?i.f^=It:(s&Qi)!==0?n.push(i):Lo(i)&&((s&Un)!==0&&k(this,Dn).add(i),ns(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}}},$p=function(){for(var e=k(this,Lr);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=k(e,Lr)}return null},Up=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(k(e,gr),k(e,Dn));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&Ut)!==0&&(i.f&(At|Vn))===0))for(const l of s){var o=l.f;if((o&Ut)!==0)n(l);else{var a=l;o&($i|Un)&&!this.async_deriveds.has(a)&&(k(this,Dn).delete(a),xt(a,At),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Ne(r=e,it,Ds).call(r),Te=this,Ne(this,it,Ls).call(this)},Li=function(e){for(var n=0;n<e.length;n+=1)zp(e[n],k(this,gr),k(this,Dn))},z_=function(){var d;for(let h=Fl;h!==null;h=k(h,hi)){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(!(!k(h,Zi)||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 k(this,Ki))h.unskip_effect(p,g=>{var m;(g.f&(Un|$i))!==0?h.schedule(g):Ne(m=h,it,Li).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)jp(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 k(this,bo))(p.f&(Nn|sn|Pa))===0&&ju(p,c,a)&&((p.f&($i|Un))!==0?(xt(p,At),h.schedule(p)):k(h,gr).add(p));if(k(h,cn).length>0&&!k(h,pi)){h.apply();for(var u of k(h,cn))Ne(d=h,it,Xc).call(d,u,[],[]);Me(h,cn,[])}h.deactivate()}}}},Ds=function(){if(this.linked){var e=k(this,Lr),n=k(this,hi);e===null?Fl=n:Me(e,hi,n),n===null?Ai=e:Me(n,Lr,e),this.linked=!1}};let Ei=ll;function I_(t){var e=Ys;Ys=!0;try{for(var n;;){if(v_(),Te===null)return n;Te.flush()}}finally{Ys=e}}function L_(){try{qb()}catch(t){Br(t,Wc)}}let Ln=null;function Qd(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(Nn|sn))===0&&Lo(r)&&(Ln=new Set,ns(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&tg(r),(Ln==null?void 0:Ln.size)>0)){vi.clear();for(const i of Ln){if((i.f&(Nn|sn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ln.has(o)&&(Ln.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Nn|sn))===0&&ns(l)}}Ln.clear()}}Ln=null}}function jp(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&Ut)!==0?jp(i,e,n,r):(s&($i|Un))!==0&&(s&At)===0&&ju(i,e,r)&&(xt(i,At),Fu(i))}}function ju(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(Ca.call(e,i))return!0;if((i.f&Ut)!==0&&ju(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Fu(t){Te.schedule(t)}function Fp(t,e){if(!((t.f&On)!==0&&(t.f&It)!==0)){(t.f&At)!==0?e.d.push(t):(t.f&Vn)!==0&&e.m.push(t),xt(t,It);for(var n=t.first;n!==null;)Fp(n,e),n=n.next}}function Gp(t){xt(t,It);for(var e=t.first;e!==null;)Gp(e),e=e.next}let Ma=new Set;const vi=new Map;let Vp=!1;function kr(t,e){var n={f:0,v:t,reactions:null,equals:Pp,rv:0,wv:0};return n}function Y(t,e){const n=kr(t);return ig(n),n}function D_(t,e=!1,n=!0){var i;const r=kr(t);return e||(r.equals=Ap),No&&n&&tt!==null&&tt.l!==null&&((i=tt.l).s??(i.s=[])).push(r),r}function _(t,e,n=!1){Fe!==null&&(!jn||(Fe.f&Pa)!==0)&&Oo()&&(Fe.f&(Ut|Un|$i|Pa))!==0&&(cr===null||!cr.has(t))&&Kb();let r=n?st(e):e;return ts(t,r,wa)}function ts(t,e,n=null){if(!t.equals(e)){vi.set(t,qr?e:t.v);var r=Ei.ensure();if(r.capture(t,e),(t.f&Ut)!==0){const i=t;(t.f&At)!==0&&Uu(i),Vt===null&&$u(i)}t.wv=og(),Zp(t,At,n),Oo()&&Ve!==null&&(Ve.f&It)!==0&&(Ve.f&(On|Er))===0&&(Tn===null?X_([t]):Tn.push(t)),!r.is_fork&&Ma.size>0&&!Vp&&H_()}return e}function H_(){Vp=!1;for(const t of Ma){(t.f&It)!==0&&xt(t,Vn);let e;try{e=Lo(t)}catch{e=!0}e&&ns(t)}Ma.clear()}function $t(t){_(t,t.v+1)}function Zp(t,e,n){var r=t.reactions;if(r!==null)for(var i=Oo(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===Ve)){var c=(l&At)===0;if(c&&xt(a,e),(l&Pa)!==0)Ma.add(a);else if((l&Ut)!==0){var u=a;Vt==null||Vt.delete(u),(l&yi)===0&&(l&Mn&&(Ve===null||(Ve.f&Ra)===0)&&(a.f|=yi),Zp(u,Vn,n))}else if(c){var d=a;(l&Un)!==0&&Ln!==null&&Ln.add(d),n!==null?n.push(d):Fu(d)}}}}function st(t){if(typeof t!="object"||t===null||Gr in t)return t;const e=gl(t);if(e!==Sp&&e!==Db)return t;var n=new Map,r=hl(t),i=Y(0),s=Zn,o=a=>{if(Zn===s)return a();var l=Fe,c=Zn;pn(null),nf(s);var u=a();return pn(l),nf(c),u};return r&&n.set("length",Y(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Xb();var u=n.get(l);return u===void 0?o(()=>{var d=Y(c.value);return n.set(l,d),d}):_(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Y(Pt));n.set(l,u),$t(i)}}else _(c,Pt),$t(i);return!0},get(a,l,c){var p;if(l===Gr)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||(p=qs(a,l))!=null&&p.writable)&&(u=o(()=>{var g=st(d?a[l]:Pt),m=Y(g);return m}),n.set(l,u)),u!==void 0){var h=f(u);return h===Pt?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=f(u))}else if(c===void 0){var d=n.get(l),h=d==null?void 0:d.v;if(d!==void 0&&h!==Pt)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===Gr)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Pt||Reflect.has(a,l);if(c!==void 0||Ve!==null&&(!u||(h=qs(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?st(a[l]):Pt,g=Y(p);return g}),n.set(l,c));var d=f(c);if(d===Pt)return!1}return u},set(a,l,c,u){var z;var d=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<d.v;p+=1){var g=n.get(p+"");g!==void 0?_(g,Pt):p in a&&(g=o(()=>Y(Pt)),n.set(p+"",g))}if(d===void 0)(!h||(z=qs(a,l))!=null&&z.writable)&&(d=o(()=>Y(void 0)),_(d,st(c)),n.set(l,d));else{h=d.v!==Pt;var m=o(()=>st(c));_(d,m)}var b=Reflect.getOwnPropertyDescriptor(a,l);if(b!=null&&b.set&&b.set.call(u,c),!h){if(r&&typeof l=="string"){var E=n.get("length"),M=Number(l);Number.isInteger(M)&&M>=E.v&&_(E,M+1)}$t(i)}return!0},ownKeys(a){f(i);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==Pt});for(var[c,u]of n)u.v!==Pt&&!(c in a)&&l.push(c);return l},setPrototypeOf(){Yb()}})}function ef(t){try{if(t!==null&&typeof t=="object"&&Gr in t)return t[Gr]}catch{}return t}function B_(t,e){return Object.is(ef(t),ef(e))}var no,Wp,qp,Xp;function $_(){if(no===void 0){no=window,Wp=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;qp=qs(e,"firstChild").get,Xp=qs(e,"nextSibling").get,Yd(t)&&(t[Uc]=void 0,t[ga]=null,t[jc]=void 0,t.__e=void 0),Yd(n)&&(n[zs]=void 0)}}function _r(t=""){return document.createTextNode(t)}function Na(t){return qp.call(t)}function zo(t){return Xp.call(t)}function v(t,e){return Na(t)}function Xe(t,e=!1){{var n=Na(t);return n instanceof Comment&&n.data===""?zo(n):n}}function T(t,e=1,n=!1){let r=t;for(;e--;)r=zo(r);return r}function U_(t){t.textContent=""}function Yp(){return!1}function j_(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Kp(t){Ve===null&&(Fe===null&&Wb(),Zb()),qr&&Vb()}function F_(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Wn(t,e){var n=Ve;n!==null&&(n.f&sn)!==0&&(t|=sn);var r={ctx:tt,deps:null,nodes:null,f:t|At|Mn,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Te==null||Te.register_created_effect(r);var i=r;if((t&Qi)!==0)Di!==null?Di.push(r):Ei.ensure().schedule(r);else if(e!==null){try{ns(r)}catch(o){throw Wt(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&hs)===0&&(i=i.first,(t&Un)!==0&&(t&Wr)!==0&&i!==null&&(i.f|=Wr))}if(i!==null&&(i.parent=n,n!==null&&F_(i,n),Fe!==null&&(Fe.f&Ut)!==0&&(t&Er)===0)){var s=Fe;(s.effects??(s.effects=[])).push(i)}return r}function Gu(){return Fe!==null&&!jn}function Vu(t){const e=Wn(Ao,null);return xt(e,It),e.teardown=t,e}function hn(t){Kp();var e=Ve.f,n=!Fe&&(e&On)!==0&&tt!==null&&!tt.i;if(n){var r=tt;(r.e??(r.e=[])).push(t)}else return Jp(t)}function Jp(t){return Wn(Qi|Tp,t)}function G_(t){return Kp(),Wn(Ao|Tp,t)}function V_(t){Ei.ensure();const e=Wn(Er|hs,t);return(n={})=>new Promise(r=>{n.outro?bi(e,()=>{Wt(e),r(void 0)}):(Wt(e),r(void 0))})}function vl(t){return Wn(Qi,t)}function Z_(t){return Wn($i|hs,t)}function bl(t,e=0){return Wn(Ao|e,t)}function y(t,e=[],n=[],r=[]){Ip(r,e,n,i=>{Wn(Ao,()=>{t(...i.map(f))})})}function Io(t,e=0){var n=Wn(Un|e,t);return n}function Qp(t,e=0){var n=Wn(Lu|e,t);return n}function dn(t){return Wn(On|hs,t)}function eg(t){var e=t.teardown;if(e!==null){const n=qr,r=Fe;tf(!0),pn(null);try{e.call(null)}finally{tf(n),pn(r)}}}function Zu(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&ps(()=>{i.abort(Mo)});var r=n.next;(n.f&Er)!==0?n.parent=null:Wt(n,e),n=r}}function W_(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&On)===0&&Wt(e),e=n}}function Wt(t,e=!0){var n=!1;(e||(t.f&Ub)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(q_(t.nodes.start,t.nodes.end),n=!0),t.f|=$c,Zu(t,e&&!n),ro(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();eg(t),t.f^=$c,t.f|=Nn;var i=t.parent;i!==null&&i.first!==null&&tg(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function q_(t,e){for(;t!==null;){var n=t===e?null:zo(t);t.remove(),t=n}}function tg(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 bi(t,e,n=!0){var r=[];ng(t,r,!0);var i=()=>{n&&Wt(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function ng(t,e,n){if((t.f&sn)===0){t.f^=sn;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&Er)===0){var o=(i.f&Wr)!==0||(i.f&On)!==0&&(t.f&Un)!==0;ng(i,e,o?n:!1)}i=s}}}function Oa(t){rg(t,!0)}function rg(t,e){if((t.f&sn)!==0){t.f^=sn,(t.f&It)===0&&(xt(t,At),Ei.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Wr)!==0||(n.f&On)!==0;rg(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 Wu(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:zo(n);e.append(n),n=i}}let ya=!1,qr=!1;function tf(t){qr=t}let Fe=null,jn=!1;function pn(t){Fe=t}let Ve=null;function zn(t){Ve=t}let cr=null;function ig(t){Fe!==null&&(cr??(cr=new Set)).add(t)}let un=null,bn=0,Tn=null;function X_(t){Tn=t}let sg=1,li=0,Zn=li;function nf(t){Zn=t}function og(){return++sg}function Lo(t){var e=t.f;if((e&At)!==0)return!0;if(e&Ut&&(t.f&=~yi),(e&Vn)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(Lo(s)&&Hp(s),s.wv>t.wv)return!0}(e&Mn)!==0&&Vt===null&&xt(t,It)}return!1}function ag(t,e,n=!0){var r=t.reactions;if(r!==null&&!(cr!==null&&cr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&Ut)!==0?ag(s,e,!1):e===s&&(n?xt(s,At):(s.f&It)!==0&&xt(s,Vn),Fu(s))}}function lg(t){var m;var e=un,n=bn,r=Tn,i=Fe,s=cr,o=tt,a=jn,l=Zn,c=t.f;un=null,bn=0,Tn=null,Fe=(c&(On|Er))===0?t:null,cr=null,es(t.ctx),jn=!1,Zn=++li,t.ac!==null&&(ps(()=>{t.ac.abort(Mo)}),t.ac=null);try{t.f|=Ra;var u=t.fn,d=u();t.f|=fs;var h=t.deps,p=Te==null?void 0:Te.is_fork;if(un!==null){var g;if(p||ro(t,bn),h!==null&&bn>0)for(h.length=bn+un.length,g=0;g<un.length;g++)h[bn+g]=un[g];else t.deps=h=un;if(Gu()&&(t.f&Mn)!==0)for(g=bn;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&bn<h.length&&(ro(t,bn),h.length=bn);if(Oo()&&Tn!==null&&!jn&&h!==null&&(t.f&(Ut|Vn|At))===0)for(g=0;g<Tn.length;g++)ag(Tn[g],t);if(i!==null&&i!==t){if(li++,i.deps!==null)for(let b=0;b<n;b+=1)i.deps[b].rv=li;if(e!==null)for(const b of e)b.rv=li;Tn!==null&&(r===null?r=Tn:r.push(...Tn))}return(t.f&Fr)!==0&&(t.f^=Fr),d}catch(b){return Np(b)}finally{t.f^=Ra,un=e,bn=n,Tn=r,Fe=i,cr=s,es(o),jn=a,Zn=l}}function Y_(t,e){let n=e.reactions;if(n!==null){var r=Ib.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&Ut)!==0&&(un===null||!Ca.call(un,e))){var s=e;(s.f&Mn)!==0&&(s.f^=Mn,s.f&=~yi),s.v!==Pt&&$u(s),s.ac!==null&&ps(()=>{s.ac.abort(Mo),s.ac=null,xt(s,At)}),N_(s),ro(s,0)}}function ro(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)Y_(t,n[r])}function ns(t){var e=t.f;if((e&Nn)===0){xt(t,It);var n=Ve,r=ya;Ve=t,ya=(e&(On|Er))===0;try{(e&(Un|Lu))!==0?W_(t):Zu(t),eg(t);var i=lg(t);t.teardown=typeof i=="function"?i:null,t.wv=sg;var s;Ep&&u_&&(t.f&At)!==0&&t.deps}finally{ya=r,Ve=n}}}async function K_(){await Promise.resolve(),I_()}function f(t){var e=t.f,n=(e&Ut)!==0;if(Fe!==null&&!jn){var r=Ve!==null&&(Ve.f&Nn)!==0;if(!r&&(cr===null||!cr.has(t))){var i=Fe.deps;if((Fe.f&Ra)!==0)t.rv<li&&(t.rv=li,un===null&&i!==null&&i[bn]===t?bn++:un===null?un=[t]:un.push(t));else{Fe.deps??(Fe.deps=[]),Ca.call(Fe.deps,t)||Fe.deps.push(t);var s=t.reactions;s===null?t.reactions=[Fe]:Ca.call(s,Fe)||s.push(Fe)}}}if(qr&&vi.has(t))return vi.get(t);if(n){var o=t;if(qr){var a=o.v;return((o.f&It)===0&&o.reactions!==null||ug(o))&&(a=Uu(o)),vi.set(o,a),a}var l=(o.f&Mn)===0&&!jn&&Fe!==null&&(ya||(Fe.f&Mn)!==0),c=(o.f&fs)===0;Lo(o)&&(l&&(o.f|=Mn),Hp(o)),l&&!c&&(Bp(o),cg(o))}if(Vt!=null&&Vt.has(t))return Vt.get(t);if((t.f&Fr)!==0)throw t.v;return t.v}function cg(t){if(t.f|=Mn,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&Ut)!==0&&(e.f&Mn)===0&&(Bp(e),cg(e))}function ug(t){if(t.v===Pt)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(vi.has(e)||(e.f&Ut)!==0&&ug(e))return!0;return!1}function Jr(t){var e=jn;try{return jn=!0,t()}finally{jn=e}}function dg(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Gr in t)Yc(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&Gr in n&&Yc(n)}}}function Yc(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{Yc(t[r],e)}catch{}const n=gl(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=kp(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function J_(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const Q_=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ew(t){return Q_.includes(t)}const tw={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 nw(t){return t=t.toLowerCase(),tw[t]??t}const rw=["touchstart","touchmove"];function iw(t){return rw.includes(t)}const ci=Symbol("events"),fg=new Set,Kc=new Set;function qu(t,e,n,r={}){function i(s){if(r.capture||Jc.call(e,s),!s.cancelBubble)return ps(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?lr(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function rf(t,e,n,r={}){var i=qu(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function dt(t,e,n,r,i){var s={capture:r,passive:i},o=qu(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Vu(()=>{e.removeEventListener(t,o,s)})}function pe(t,e,n){(e[ci]??(e[ci]={}))[t]=n}function lt(t){for(var e=0;e<t.length;e++)fg.add(t[e]);for(var n of Kc)n(t)}let sf=null;function Jc(t){var m,b;var e=this,n=e.ownerDocument,r=t.type,i=((m=t.composedPath)==null?void 0:m.call(t))||[],s=i[0]||t.target;sf=t;var o=0,a=sf===t&&t[ci];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[ci]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){Lb(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=Fe,d=Ve;pn(null),zn(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(b=s[ci])==null?void 0:b[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(E){h?p.push(E):h=E}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let E of p)queueMicrotask(()=>{throw E});throw h}}finally{t[ci]=e,delete t.currentTarget,pn(u),zn(d)}}}var bp;const Vl=((bp=globalThis==null?void 0:globalThis.window)==null?void 0:bp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function sw(t){return(Vl==null?void 0:Vl.createHTML(t))??t}function ow(t){var e=j_("template");return e.innerHTML=sw(t.replaceAll("<!>","<!---->")),e.content}function za(t,e){var n=Ve;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function I(t,e){var n=(e&r_)!==0,r=(e&i_)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=ow(s?t:"<!>"+t),n||(i=Na(i)));var o=r||Wp?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Na(o),l=o.lastChild;za(a,l)}else za(o,o);return o}}function Hs(t=""){{var e=_r(t+"");return za(e,e),e}}function En(){var t=document.createDocumentFragment(),e=document.createComment(""),n=_r();return t.append(e,n),za(e,n),t}function C(t,e){t!==null&&t.before(e)}function S(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[zs]??(t[zs]=t.nodeValue))&&(t[zs]=n,t.nodeValue=`${n}`)}function _l(t,e){return aw(t,e)}const Yo=new Map;function aw(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){$_();var l=void 0,c=V_(()=>{var u=n??e.appendChild(_r());S_(u,{pending:()=>{}},p=>{Ie({});var g=tt;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Le()},a);var d=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!d.has(m)){d.add(m);var b=iw(m);for(const z of[e,document]){var E=Yo.get(z);E===void 0&&(E=new Map,Yo.set(z,E));var M=E.get(m);M===void 0?(z.addEventListener(m,Jc,{passive:b}),E.set(m,1)):E.set(m,M+1)}}}};return h(pl(fg)),Kc.add(h),()=>{var b;for(var p of d)for(const E of[e,document]){var g=Yo.get(E),m=g.get(p);--m==0?(E.removeEventListener(p,Jc),g.delete(p),g.size===0&&Yo.delete(E)):g.set(p,m)}Kc.delete(h),u!==n&&((b=u.parentNode)==null||b.removeChild(u))}});return Qc.set(l,c),l}let Qc=new WeakMap;function Xu(t,e){const n=Qc.get(t);return n?(Qc.delete(t),n(e)):Promise.resolve()}var Hn,nr,wn,gi,_o,wo,cl;class Yu{constructor(e,n=!0){F(this,"anchor");be(this,Hn,new Map);be(this,nr,new Map);be(this,wn,new Map);be(this,gi,new Set);be(this,_o,!0);be(this,wo,e=>{if(k(this,Hn).has(e)){var n=k(this,Hn).get(e),r=k(this,nr).get(n);if(r)Oa(r),k(this,gi).delete(n);else{var i=k(this,wn).get(n);i&&(Oa(i.effect),k(this,nr).set(n,i.effect),k(this,wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of k(this,Hn)){if(k(this,Hn).delete(s),s===e)break;const a=k(this,wn).get(o);a&&(Wt(a.effect),k(this,wn).delete(o))}for(const[s,o]of k(this,nr)){if(s===n||k(this,gi).has(s))continue;const a=()=>{if(Array.from(k(this,Hn).values()).includes(s)){var c=document.createDocumentFragment();Wu(o,c),c.append(_r()),k(this,wn).set(s,{effect:o,fragment:c})}else Wt(o);k(this,gi).delete(s),k(this,nr).delete(s)};k(this,_o)||!r?(k(this,gi).add(s),bi(o,a,!1)):a()}}});be(this,cl,e=>{k(this,Hn).delete(e);const n=Array.from(k(this,Hn).values());for(const[r,i]of k(this,wn))n.includes(r)||(Wt(i.effect),k(this,wn).delete(r))});this.anchor=e,Me(this,_o,n)}ensure(e,n){var r=Te,i=Yp();if(n&&!k(this,nr).has(e)&&!k(this,wn).has(e))if(i){var s=document.createDocumentFragment(),o=_r();s.append(o),k(this,wn).set(e,{effect:dn(()=>n(o)),fragment:s})}else k(this,nr).set(e,dn(()=>n(this.anchor)));if(k(this,Hn).set(r,e),i){for(const[a,l]of k(this,nr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of k(this,wn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(k(this,wo)),r.ondiscard(k(this,cl))}else k(this,wo).call(this,r)}}Hn=new WeakMap,nr=new WeakMap,wn=new WeakMap,gi=new WeakMap,_o=new WeakMap,wo=new WeakMap,cl=new WeakMap;function Z(t,e,n=!1){var r=new Yu(t),i=n?Wr:0;function s(o,a){r.ensure(o,a)}Io(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}function lw(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let d=e[a];bi(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;eu(t,pl(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;U_(u),u.append(c),t.items.clear()}eu(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function eu(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|=ar;const o=document.createDocumentFragment();Wu(s,o)}else Wt(e[i],n)}}var of;function ht(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&Cp)!==0;if(l){var c=t;o=c.appendChild(_r())}var u=null,d=Dp(()=>{var z=n();return hl(z)?z:z==null?[]:pl(z)}),h,p=new Map,g=!0;function m(z){(M.effect.f&Nn)===0&&(M.pending.delete(z),M.fallback=u,cw(M,h,o,e,r),u!==null&&(h.length===0?(u.f&ar)===0?Oa(u):(u.f^=ar,Bs(u,null,o)):bi(u,()=>{u=null})))}function b(z){M.pending.delete(z)}var E=Io(()=>{h=f(d);for(var z=h.length,R=new Set,A=Te,x=Yp(),N=0;N<z;N+=1){var O=h[N],j=r(O,N),B=g?null:a.get(j);B?(B.v&&ts(B.v,O),B.i&&ts(B.i,N),x&&A.unskip_effect(B.e)):(B=uw(a,g?o:of??(of=_r()),O,j,N,i,e,n),g||(B.e.f|=ar),a.set(j,B)),R.add(j)}if(z===0&&s&&!u&&(g?u=dn(()=>s(o)):(u=dn(()=>s(of??(of=_r()))),u.f|=ar)),z>R.size&&Gb(),!g)if(p.set(A,R),x){for(const[J,W]of a)R.has(J)||A.skip_effect(W.e);A.oncommit(m),A.ondiscard(b)}else m(A);f(d)}),M={effect:E,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function Ps(t){for(;t!==null&&(t.f&On)===0;)t=t.next;return t}function cw(t,e,n,r,i){var B,J,W,H,ee,oe,q,K,ne;var s=(r&t_)!==0,o=e.length,a=t.items,l=Ps(t.effect.first),c,u=null,d,h=[],p=[],g,m,b,E;if(s)for(E=0;E<o;E+=1)g=e[E],m=i(g,E),b=a.get(m).e,(b.f&ar)===0&&((J=(B=b.nodes)==null?void 0:B.a)==null||J.measure(),(d??(d=new Set)).add(b));for(E=0;E<o;E+=1){if(g=e[E],m=i(g,E),b=a.get(m).e,t.outrogroups!==null)for(const le of t.outrogroups)le.pending.delete(b),le.done.delete(b);if((b.f&sn)!==0&&(Oa(b),s&&((H=(W=b.nodes)==null?void 0:W.a)==null||H.unfix(),(d??(d=new Set)).delete(b))),(b.f&ar)!==0)if(b.f^=ar,b===l)Bs(b,null,n);else{var M=u?u.next:l;b===t.effect.last&&(t.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),zr(t,u,b),zr(t,b,M),Bs(b,M,n),u=b,h=[],p=[],l=Ps(u.next);continue}if(b!==l){if(c!==void 0&&c.has(b)){if(h.length<p.length){var z=p[0],R;u=z.prev;var A=h[0],x=h[h.length-1];for(R=0;R<h.length;R+=1)Bs(h[R],z,n);for(R=0;R<p.length;R+=1)c.delete(p[R]);zr(t,A.prev,x.next),zr(t,u,A),zr(t,x,z),l=z,u=x,E-=1,h=[],p=[]}else c.delete(b),Bs(b,l,n),zr(t,b.prev,b.next),zr(t,b,u===null?t.effect.first:u.next),zr(t,u,b),u=b;continue}for(h=[],p=[];l!==null&&l!==b;)(c??(c=new Set)).add(l),p.push(l),l=Ps(l.next);if(l===null)continue}(b.f&ar)===0&&h.push(b),u=b,l=Ps(b.next)}if(t.outrogroups!==null){for(const le of t.outrogroups)le.pending.size===0&&(eu(t,pl(le.done)),(ee=t.outrogroups)==null||ee.delete(le));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var N=[];if(c!==void 0)for(b of c)(b.f&sn)===0&&N.push(b);for(;l!==null;)(l.f&sn)===0&&l!==t.fallback&&N.push(l),l=Ps(l.next);var O=N.length;if(O>0){var j=(r&Cp)!==0&&o===0?n:null;if(s){for(E=0;E<O;E+=1)(q=(oe=N[E].nodes)==null?void 0:oe.a)==null||q.measure();for(E=0;E<O;E+=1)(ne=(K=N[E].nodes)==null?void 0:K.a)==null||ne.fix()}lw(t,N,j)}}s&&lr(()=>{var le,se;if(d!==void 0)for(b of d)(se=(le=b.nodes)==null?void 0:le.a)==null||se.apply()})}function uw(t,e,n,r,i,s,o,a){var l=(o&Qb)!==0?(o&n_)===0?D_(n,!1,!1):kr(n):null,c=(o&e_)!==0?kr(i):null;return{v:l,i:c,e:dn(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function Bs(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&ar)===0?e.nodes.start:n;r!==null;){var o=zo(r);if(s.before(r),r===i)return;r=o}}function zr(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function dw(t,e,...n){var r=new Yu(t);Io(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},Wr)}function fw(t,e,n){var r=new Yu(t);Io(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},Wr)}function Qr(t,e,n){vl(()=>{var r=Jr(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};bl(()=>{var o=n();dg(o),i&&Rp(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function hw(t,e){var n=void 0,r;Qp(()=>{n!==(n=e())&&(r&&(Wt(r),r=null),n&&(r=dn(()=>{vl(()=>n(t))})))})}function hg(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=hg(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function pw(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=hg(t))&&(r&&(r+=" "),r+=e);return r}function gw(t){return typeof t=="object"?pw(t):t??""}const af=[...`
2
- \r\f \v\uFEFF`];function mw(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||af.includes(r[o-1]))&&(a===r.length||af.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function lf(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 Zl(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function vw(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(Zl)),i&&l.push(...Object.keys(i).map(Zl));var c=0,u=-1;const m=t.length;for(var d=0;d<m;d++){var h=t[d];if(a?h==="/"&&t[d-1]==="*"&&(a=!1):s?s===h&&(s=!1):h==="/"&&t[d+1]==="*"?a=!0:h==='"'||h==="'"?s=h:h==="("?o++:h===")"&&o--,!a&&s===!1&&o===0){if(h===":"&&u===-1)u=d;else if(h===";"||d===m-1){if(u!==-1){var p=Zl(t.substring(c,u).trim());if(!l.includes(p)){h!==";"&&d++;var g=t.substring(c,d).trim();n+=" "+g+";"}}c=d+1,u=-1}}}}return r&&(n+=lf(r)),i&&(n+=lf(i,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Oe(t,e,n,r,i,s){var o=t[Uc];if(o!==n||o===void 0){var a=mw(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[Uc]=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 Wl(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 io(t,e,n,r){var i=t[jc];if(i!==e){var s=vw(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t[jc]=e}else r&&(Array.isArray(r)?(Wl(t,n==null?void 0:n[0],r[0]),Wl(t,n==null?void 0:n[1],r[1],"important")):Wl(t,n,r));return r}function tu(t,e,n=!1){if(t.multiple){if(e==null)return;if(!hl(e))return l_();for(var r of t.options)r.selected=e.includes(cf(r));return}for(r of t.options){var i=cf(r);if(B_(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function bw(t){var e=new MutationObserver(()=>{"__value"in t&&tu(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Vu(()=>{e.disconnect()})}function cf(t){return"__value"in t?t.__value:t.value}const Ko=Symbol("class"),Rs=Symbol("style"),pg=Symbol("is custom element"),gg=Symbol("is html"),_w=Du?"input":"INPUT",ww=Du?"option":"OPTION",yw=Du?"select":"SELECT";function Ew(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ae(t,e,n,r){var i=mg(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[jb]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Ku(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function P(t,e,n){var r=Fe,i=Ve;pn(null),zn(null);try{e!=="style"&&(nu.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?Ku(t).includes(e):n&&typeof n=="object")?t[e]=n:Ae(t,e,n==null?n:String(n))}finally{pn(r),zn(i)}}function kw(t,e,n,r,i=!1,s=!1){var o=mg(t),a=o[pg],l=!o[gg],c=e||{},u=t.nodeName===ww;for(var d in e)d in n||(n[d]=null);n.class?n.class=gw(n.class):n.class=null,n[Rs]&&(n.style??(n.style=null));var h=Ku(t);if(t.nodeName===_w&&"type"in n&&("value"in n||"__value"in n)){var p=n.type;(p!==c.type||p===void 0&&t.hasAttribute("type"))&&(c.type=p,Ae(t,"type",p))}for(const R in n){let A=n[R];if(u&&R==="value"&&A==null){t.value=t.__value="",c[R]=A;continue}if(R==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Oe(t,g,A,r,e==null?void 0:e[Ko],n[Ko]),c[R]=A,c[Ko]=n[Ko];continue}if(R==="style"){io(t,A,e==null?void 0:e[Rs],n[Rs]),c[R]=A,c[Rs]=n[Rs];continue}var m=c[R];if(!(A===m&&!(A===void 0&&t.hasAttribute(R)))){c[R]=A;var b=R[0]+R[1];if(b!=="$$")if(b==="on"){const x={},N="$$"+R;let O=R.slice(2);var E=ew(O);if(J_(O)&&(O=O.slice(0,-7),x.capture=!0),!E&&m){if(A!=null)continue;t.removeEventListener(O,c[N],x),c[N]=null}if(E)pe(O,t,A),lt([O]);else if(A!=null){let j=function(B){c[R].call(this,B)};c[N]=qu(O,t,j,x)}}else if(R==="style")Ae(t,R,A);else if(R==="autofocus")__(t,!!A);else if(!a&&(R==="__value"||R==="value"&&A!=null))t.value=t.__value=A;else if(R==="selected"&&u)Ew(t,A);else{var M=R;l||(M=nw(M));var z=M==="defaultValue"||M==="defaultChecked";if(A==null&&!a&&!z)if(o[R]=null,M==="value"||M==="checked"){let x=t;const N=e===void 0;if(M==="value"){let O=x.defaultValue;x.removeAttribute(M),x.defaultValue=O,x.value=x.__value=N?O:null}else{let O=x.defaultChecked;x.removeAttribute(M),x.defaultChecked=O,x.checked=N?O:!1}}else t.removeAttribute(R);else z||h.includes(M)&&(a||typeof A!="string")?(t[M]=A,M in o&&(o[M]=Pt)):typeof A!="function"&&Ae(t,M,A)}}}return c}function Sw(t,e,n=[],r=[],i=[],s,o=!1,a=!1){Ip(i,n,r,l=>{var c=void 0,u={},d=t.nodeName===yw,h=!1;if(Qp(()=>{var g=e(...l.map(f)),m=kw(t,c,g,s,o,a);h&&d&&"value"in g&&tu(t,g.value);for(let E of Object.getOwnPropertySymbols(u))g[E]||Wt(u[E]);for(let E of Object.getOwnPropertySymbols(g)){var b=g[E];E.description===o_&&(!c||b!==c[E])&&(u[E]&&Wt(u[E]),u[E]=dn(()=>hw(t,()=>b))),m[E]=b}c=m}),d){var p=t;vl(()=>{tu(p,c.value,!0),bw(p)})}h=!0})}function mg(t){return t[ga]??(t[ga]={[pg]:t.nodeName.includes("-"),[gg]:t.namespaceURI===s_})}var nu=new Map;function Ku(t){var e=t.getAttribute("is")||t.nodeName,n=nu.get(e);if(n)return n;nu.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=kp(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.push(o);i=gl(i)}return n}function xw(t,e,n=e){var r=new WeakSet;y_(t,"input",async i=>{var s=i?t.defaultValue:t.value;if(s=ql(t)?Xl(s):s,n(s),Te!==null&&r.add(Te),await K_(),s!==(s=e())){var o=t.selectionStart,a=t.selectionEnd,l=t.value.length;if(t.value=s??"",a!==null){var c=t.value.length;o===a&&a===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=o,t.selectionEnd=Math.min(a,c))}}}),Jr(e)==null&&t.value&&(n(ql(t)?Xl(t.value):t.value),Te!==null&&r.add(Te)),bl(()=>{var i=e();if(t===document.activeElement){var s=Te;if(r.has(s))return}ql(t)&&i===Xl(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function ql(t){var e=t.type;return e==="number"||e==="range"}function Xl(t){return t===""?null:+t}function Yl(t,e){return t===e||(t==null?void 0:t[Gr])===e}function rs(t={},e,n,r){var i=tt.r,s=Ve;return vl(()=>{var o,a;return bl(()=>{o=a,a=(r==null?void 0:r())||[],Jr(()=>{Yl(n(...a),t)||(e(t,...a),o&&Yl(n(...o),t)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&$c;)l=l.parent;const c=()=>{a&&Yl(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function Tw(t=!1){const e=tt,n=e.l.u;if(!n)return;let r=()=>dg(e.s);if(t){let i=0,s={};const o=ml(()=>{let a=!1;const l=e.s;for(const c in l)l[c]!==s[c]&&(s[c]=l[c],a=!0);return a&&i++,i});r=()=>f(o)}n.b.length&&G_(()=>{uf(e,r),Hc(n.b)}),hn(()=>{const i=Jr(()=>n.m.map(Bb));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&hn(()=>{uf(e,r),Hc(n.a)})}function uf(t,e){if(t.l.s)for(const n of t.l.s)f(n);e()}function Yt(t,e,n,r){var i=r,s=!0,o=()=>(s&&(s=!1,i=r),i),a;a=t[e],a===void 0&&r!==void 0&&(a=o());var l;return l=()=>{var c=t[e];return c===void 0?o():(s=!0,c)},l}function kn(t){tt===null&&Hu(),No&&tt.l!==null?Cw(tt).m.push(t):hn(()=>{const e=Jr(t);if(typeof e=="function")return e})}function Do(t){tt===null&&Hu(),kn(()=>()=>Jr(t))}function Cw(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const Pw="5";var _p;typeof window<"u"&&((_p=window.__svelte??(window.__svelte={})).v??(_p.v=new Set)).add(Pw);const Rw="modulepreload",Aw=function(t){return"/"+t},df={},Ia=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Aw(c),c in df)return;df[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Rw,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 Ks(t,e){if(e)for(const n in e)t=t.replace(`:${n}`,String(e[n]));return ft.name==="#"?t==="/"?"/#/":La("#",t):ft.name?La(ft.name,t):t}function Mw(t,e){let n=Ks(t,e==null?void 0:e.params);return e!=null&&e.search&&(n+=ed(e.search)),e!=null&&e.hash&&!e.hash.startsWith("#")&&(n+="#"+e.hash),n}function vg(t){return Promise.all(t.map(e=>Nw(e)))}function Nw(t){return new Promise(e=>{Ow(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function Ow(t){return typeof t=="function"&&!!/\(\)\s?=>\s?(import|__vite_ssr_dynamic_import__)\(.*\)/.test(String(t))}function La(...t){let e="";for(let n of t)n.startsWith("/")||(e+="/"),n.endsWith("/")&&(n=n.slice(0,-1)),e+=n;return e}function Ju(t){return ft.name&&t.startsWith(ft.name)&&(t=t.slice(ft.name.length)||"/"),t}function Qu(){const t=ft.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=ft.name==="#"?"":globalThis.location.hash;return{pathname:t,search:globalThis.location.search,state:history.state,hash:e}}function ed(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 td(t){if(!t)return{};if(typeof t=="string"){const e=new URLSearchParams(t);return Object.fromEntries([...e.entries()].map(([n,r])=>[n,zw(r)]))}return t}function zw(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 ru(t,e){return bg((n,r)=>n===r,t,e)}ru.startsWith=(t,e)=>bg((n,r)=>n.startsWith(r),t,e);function bg(t,e,n){if(!e.includes(":")){const s=ft.name&&ft.name!=="#"?Ks(e):e;return t(fn.pathname,s)}if(n)return ft.name==="#"?t(fn.pathname,Ks(e,n).replace("/#","")):t(fn.pathname,Ks(e,n));const r=e.split("/").slice(1);let i=fn.pathname.split("/").slice(1);if(r.length>i.length)return!1;for(const[s,o]of r.entries()){const a=i[s];if(!o.startsWith(":")&&o!==a)return!1}return!0}function nd(t,e){t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/").slice(1),r=Iw(Object.keys(e));let i,s=[],o=[],a={},l={};const c=e["/"];c&&typeof c=="object"&&"meta"in c&&c.meta&&(l={...l,...c.meta});let u=!1;e:for(const d of r){const h=d.split("/");h[0]===""&&h.shift();for(let[p,g]of h.entries()){u=g.startsWith("(")&&g.endsWith(")"),u&&(g=g.slice(1,-1));const m=n[p],b=g===""&&typeof e["/"]!="function";if(g.startsWith(":"))a[g.slice(1)]=decodeURIComponent(m);else if(g.startsWith("*")){const R=g.slice(1);R&&(a[R]=n.slice(p).map(decodeURIComponent).join("/")),u?s=[]:"layout"in e&&e.layout&&s.push(e.layout);const A=(p?"/":"")+h.join("/");i=e[A];break e}else if(g.toLowerCase()!==(m==null?void 0:m.toLowerCase())&&!b)break;if(p!==h.length-1)continue;const E=e["/"+h.join("/")];if(typeof E=="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 E=="function"){if(h.length===n.length){i=E;break e}continue}const M=b?t:"/"+n.slice(p+1).join("/"),z=nd(M,E);if(z.match)i=z.match,a={...a,...z.params},o.push(...z.hooks),l={...l,...z.meta},z.breakFromLayouts?(s=[],u=!0):s.push(...z.layouts);else continue;break e}}return{match:i,layouts:s,hooks:o,params:a,meta:l,breakFromLayouts:u}}function Iw(t){return t.toSorted((e,n)=>ff(e)-ff(n))}function ff(t){return t===""||t==="/"?1:t.includes("*")?4:t.includes(":")?3:2}const Lw=200,Dw=Math.PI/6,Hw=50;async function _g(t,e,n){const{match:r,layouts:i,hooks:s,meta:o}=nd(e,t);for(const{onPreload:a}of s)a==null||a({pathname:e,meta:o,...n,search:td(n==null?void 0:n.search)});await vg(r?[...i,r]:i)}const hf=new Set,Mi=new Set;function Bw(t){function e(o){if(!o.getAttribute("href"))return;const l=new URL(o.href),c=Ju(l.pathname),{replace:u,state:d}=o.dataset;_g(t,c,{replace:u===""||u==="true",search:l.search,state:d,hash:l.hash})}let n=null;function r(o){if(!o.getPredictedEvents||n)return;if(n=setTimeout(()=>{n=null},Hw),Mi.size===0){document.removeEventListener("pointermove",r);return}const l=o.getPredictedEvents().at(-1);if(!l)return;const c=o.clientX,u=o.clientY,d=l.clientX-c,h=l.clientY-u,p=Math.hypot(d,h);if(p<2)return;const g=d/p,m=h/p;e:for(const b of Mi){b.isConnected||Mi.delete(b);const E=b.getBoundingClientRect(),M=[{x:E.left,y:E.top},{x:E.right,y:E.top},{x:E.left,y:E.bottom},{x:E.right,y:E.bottom},{x:E.left+E.width/2,y:E.top+E.height/2}];for(const z of M){const R=z.x-c,A=z.y-u,x=Math.hypot(R,A);if(x>Lw||x<.001)continue;const N=R/x,O=A/x,j=g*N+m*O;if(Math.acos(Math.max(-1,Math.min(1,j)))<=Dw){e(b),Mi.delete(b);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(!hf.has(a)){switch(hf.add(a),a.dataset.preload){case"":case"true":case"hover":{a.addEventListener("mouseenter",function l(){a.removeEventListener("mouseenter",l),e(a)});break}case"predict":{Mi.size===0&&document.addEventListener("pointermove",r),Mi.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 pf extends Error{constructor(e){super(`Navigating to: ${e}`),this.name="Redirect"}}var $w=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],Uw=["difference","intersection","symmetricDifference","union"],gf=!1,Ji,Bn,Dr,ul,ds,wg,yg;const dl=class dl extends Set{constructor(n){super();be(this,ds);be(this,Ji,new Map);be(this,Bn,Y(0));be(this,Dr,Y(0));be(this,ul,Zn||-1);if(n){for(var r of n)super.add(r);k(this,Dr).v=super.size}gf||Ne(this,ds,yg).call(this)}has(n){var r=super.has(n),i=k(this,Ji),s=i.get(n);if(s===void 0){if(!r)return f(k(this,Bn)),!1;s=Ne(this,ds,wg).call(this,!0),i.set(n,s)}return f(s),r}add(n){return super.has(n)||(super.add(n),_(k(this,Dr),super.size),$t(k(this,Bn))),this}delete(n){var r=super.delete(n),i=k(this,Ji),s=i.get(n);return s!==void 0&&(i.delete(n),_(s,!1)),r&&(_(k(this,Dr),super.size),$t(k(this,Bn))),r}clear(){if(super.size!==0){super.clear();var n=k(this,Ji);for(var r of n.values())_(r,!1);n.clear(),_(k(this,Dr),0),$t(k(this,Bn))}}keys(){return this.values()}values(){return f(k(this,Bn)),super.values()}entries(){return f(k(this,Bn)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return f(k(this,Dr))}};Ji=new WeakMap,Bn=new WeakMap,Dr=new WeakMap,ul=new WeakMap,ds=new WeakSet,wg=function(n){return Zn===k(this,ul)?Y(n):kr(n)},yg=function(){gf=!0;var n=dl.prototype,r=Set.prototype;for(const i of $w)n[i]=function(...s){return f(k(this,Bn)),r[i].apply(this,s)};for(const i of Uw)n[i]=function(...s){f(k(this,Bn));var o=r[i].apply(this,s);return new dl(o)}};let Da=dl;var rr,ir,mr,fl,Gn,$s,Ea;const jd=class jd extends Map{constructor(n){super();be(this,Gn);be(this,rr,new Map);be(this,ir,Y(0));be(this,mr,Y(0));be(this,fl,Zn||-1);if(n){for(var[r,i]of n)super.set(r,i);k(this,mr).v=super.size}}has(n){var r=k(this,rr),i=r.get(n);if(i===void 0)if(super.has(n))i=Ne(this,Gn,$s).call(this,0),r.set(n,i);else return f(k(this,ir)),!1;return f(i),!0}forEach(n,r){Ne(this,Gn,Ea).call(this),super.forEach(n,r)}get(n){var r=k(this,rr),i=r.get(n);if(i===void 0)if(super.has(n))i=Ne(this,Gn,$s).call(this,0),r.set(n,i);else{f(k(this,ir));return}return f(i),super.get(n)}set(n,r){var d;var i=k(this,rr),s=i.get(n),o=super.get(n),a=super.set(n,r),l=k(this,ir);if(s===void 0)s=Ne(this,Gn,$s).call(this,0),i.set(n,s),_(k(this,mr),super.size),$t(l);else if(o!==r){$t(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((d=s.reactions)!=null&&d.every(h=>c.has(h)));u&&$t(l)}return a}delete(n){var r=k(this,rr),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),_(i,-1)),s&&(_(k(this,mr),super.size),$t(k(this,ir))),s}clear(){if(super.size!==0){super.clear();var n=k(this,rr);_(k(this,mr),0);for(var r of n.values())_(r,-1);$t(k(this,ir)),n.clear()}}keys(){return f(k(this,ir)),super.keys()}values(){return Ne(this,Gn,Ea).call(this),super.values()}entries(){return Ne(this,Gn,Ea).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(k(this,mr)),super.size}};rr=new WeakMap,ir=new WeakMap,mr=new WeakMap,fl=new WeakMap,Gn=new WeakSet,$s=function(n){return Zn===k(this,fl)?Y(n):kr(n)},Ea=function(){f(k(this,ir));var n=k(this,rr);if(k(this,mr).v!==n.size){for(var r of Zd(jd.prototype,this,"keys").call(this))if(!n.has(r)){var i=Ne(this,Gn,$s).call(this,0);n.set(r,i)}}for([,i]of k(this,rr))f(i)};let is=jd;const jw=Symbol("replace");var Ft,yo,vr,mi,Us;class Fw extends URLSearchParams{constructor(){super(...arguments);be(this,mi);be(this,Ft,Y(0));be(this,yo,Vw());be(this,vr,!1)}[jw](n){if(!k(this,vr)&&n.toString()!==super.toString()){Me(this,vr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);$t(k(this,Ft)),Me(this,vr,!1)}}append(n,r){super.append(n,r),Ne(this,mi,Us).call(this),$t(k(this,Ft))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(Ne(this,mi,Us).call(this),$t(k(this,Ft)))}get(n){return f(k(this,Ft)),super.get(n)}getAll(n){return f(k(this,Ft)),super.getAll(n)}has(n,r){return f(k(this,Ft)),super.has(n,r)}keys(){return f(k(this,Ft)),super.keys()}forEach(n,r){f(k(this,Ft)),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]))&&(Ne(this,mi,Us).call(this),$t(k(this,Ft)))}sort(){super.sort(),Ne(this,mi,Us).call(this),$t(k(this,Ft))}toString(){return f(k(this,Ft)),super.toString()}values(){return f(k(this,Ft)),super.values()}entries(){return f(k(this,Ft)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(k(this,Ft)),super.size}}Ft=new WeakMap,yo=new WeakMap,vr=new WeakMap,mi=new WeakSet,Us=function(){if(!k(this,yo)||k(this,vr))return;Me(this,vr,!0);const n=this.toString();k(this,yo).search=n&&`?${n}`,Me(this,vr,!1)};let Gw=null;function Vw(){return Gw}let Jo=new Fw(globalThis.location.search);function mf(t){if(Jo.toString()===t)return;const e=new URLSearchParams(t);for(const[n,r]of e)Jo.set(n,r);for(const n of Jo.keys())e.has(n)||Jo.delete(n)}let Js;const ft={name:void 0};let iu=st({value:[]}),fn=st({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Qu();fn.pathname=t.pathname,fn.search=t.search,fn.state=t.state,fn.hash=t.hash});let su=st({value:{}}),Eg=st({value:{}}),ii=null,Qo=null,ka=null;function Zw(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(ft.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(ft.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(ft.name)||(e.pathname=La(ft.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(fn,Qu())}function Ww(t){return Js=t,Bw(Js),{p:Mw,navigate:qw,isActive:ru,async preload(e){await _g(Js,e)},route:{get params(){return su.value},getParams(e){if(!ru(e))throw new Error(`\`${e}\` does not match the current route`);return su.value},get pathname(){return Ju(fn.pathname)},get search(){return td(fn.search)},get state(){return fn.state},get hash(){return fn.hash},get meta(){return Eg.value}}}}async function qw(t,e={}){if(typeof t=="number")return globalThis.history.go(t),new pf(`History entry: ${t}`);t=Ks(t,e.params),ft.name==="#"?t=t.replace("/#",""):e.hash&&!e.hash.startsWith("#")&&(e.hash="#"+e.hash);const n=Ha(t,e);return ka=n,await n,new pf(`${t}${ed((e==null?void 0:e.search)??"")}${(e==null?void 0:e.hash)??""}`)}async function Ha(t,e={}){if(!Js)throw new Error("Router not initialized: `createRouter` was not called.");if(Qo&&Qo!==ii)return;ii==null||ii.abort(),ii=new AbortController;const{signal:n}=ii,r=Xw(t),{match:i,layouts:s,hooks:o,meta:a,params:l}=nd(r,Js),c=td(e.search),u={pathname:r,meta:a,...e,search:c};let d=[];for(const p of o){if(n.aborted)return ka;try{const{beforeLoad:g}=p;d.push(p),Qo=ii,await(g==null?void 0:g(u))}catch(g){if(n.aborted)return ka;for(const{onError:m}of d)m==null||m(g,u);return}finally{Qo=null}}let h;try{h=await vg(i?[...s,i]:s)}catch(p){for(const{onError:g}of o)g==null||g(p,u);throw p}if(n.aborted)return ka;if(t){const p=ed(e.search),g=new URL(globalThis.location.toString());g.search=p||"",g.hash=e.hash||"",ft.name==="#"?g.hash=t:ft.name&&!t.startsWith(ft.name)?g.pathname=La(ft.name,t):g.pathname=t;const m=e.replace?"replaceState":"pushState";globalThis.history[m](e.state||{},"",g.toString()),mf(p)}else mf(globalThis.location.search);e.viewTransition&&document.startViewTransition!==void 0?document.startViewTransition(()=>{iu.value=h}):iu.value=h,su.value=l,Eg.value=a,Object.assign(fn,Qu()),e.scrollToTop!==!1&&window.scrollTo({top:0,left:0,behavior:e.scrollToTop});for(const{afterLoad:p}of o)p==null||p(u)}function Xw(t){let e;return t?e=t:ft.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,ft.name&&e.startsWith(ft.name)&&(e=e.slice(ft.name.length)||"/"),Ju(e)}function Yw(t){var d;const e=t.target.closest("a");if(!e||e.hasAttribute("target")||e.hasAttribute("download")||!e.hasAttribute("href")||(d=e.getAttribute("href"))!=null&&d.startsWith("#"))return;const n=new URL(e.href),r=globalThis.location.origin;if(n.origin!==r)return;const i=ft.name==="#"?n.hash:n.pathname,s=ft.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}Ha(i,{replace:o===""||o==="true",search:n.search,state:u,hash:s,scrollToTop:l==="false"?!1:l,viewTransition:c===""||c==="true"})}function kg(t,e){Ie(e,!0);const n=fe(()=>e.tree[0]),r=fe(()=>e.tree.slice(1));var i=En(),s=Xe(i);fw(s,()=>f(n),(o,a)=>{a(o,{children:(l,c)=>{var u=En(),d=Xe(u);{var h=p=>{kg(p,{get tree(){return f(r)}})};Z(d,p=>{f(r).length>0&&p(h)})}C(l,u)},$$slots:{default:!0}})}),C(t,i),Le()}function Kw(t,e){Ie(e,!0),Zw(e.base),Ha(),hn(()=>{const n=rf(globalThis,"popstate",()=>Ha()),r=rf(globalThis,"click",Yw);return()=>{n(),r()}}),kg(t,{get tree(){return iu.value}}),Le()}const Jw=720;function wl(){return window.matchMedia("(max-width: "+Jw+"px)")}function Sg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function xg(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(Sg(s))xg(s,e,o,r);else throw new Error(`Plugin catalog ${e} key "${o}" must be a string or object`)}}function Qw(t,e){if(!Sg(t))throw new Error(`Plugin catalog ${e} must be a JSON object`);const n={};return xg(t,e,"",n),Object.freeze(n)}var vf;function $(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=c[h].bind(a))}}const i=(n==null?void 0:n.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class Ui extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Tg extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(vf=globalThis).__zod_globalConfig??(vf.__zod_globalConfig={});const rd=globalThis.__zod_globalConfig;function Sr(t){return rd}function Cg(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 ou(t,e){return typeof e=="bigint"?e.toString():e}function yl(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function id(t){return t==null}function sd(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function e0(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 bf=Symbol("evaluating");function ot(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==bf)return r===void 0&&(r=bf,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function ki(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ei(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function _f(t){return JSON.stringify(t)}function t0(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function so(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const n0=yl(()=>{var t;if(rd.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 ss(t){if(so(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(so(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Rg(t){return ss(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const r0=new Set(["string","number","symbol"]);function os(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ti(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function ye(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function i0(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 o0(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=ei(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return ki(this,"shape",o),o},checks:[]});return ti(t,s)}function a0(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=ei(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return ki(this,"shape",o),o},checks:[]});return ti(t,s)}function l0(t,e){if(!ss(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=ei(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return ki(this,"shape",s),s}});return ti(t,i)}function c0(t,e){if(!ss(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ei(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return ki(this,"shape",r),r}});return ti(t,n)}function u0(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=ei(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return ki(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ti(t,n)}function d0(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=ei(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return ki(this,"shape",l),l},checks:[]});return ti(e,o)}function f0(t,e,n){const r=ei(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(n)for(const o in n){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(s[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new t({type:"nonoptional",innerType:i[o]});return ki(this,"shape",s),s}});return ti(e,r)}function Hi(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 h0(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 Bi(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function ea(t){return typeof t=="string"?t:t==null?void 0:t.message}function xr(t,e,n){var l,c,u,d,h,p;const r=t.message?t.message:ea((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??ea((d=e==null?void 0:e.error)==null?void 0:d.call(e,t))??ea((h=n.customError)==null?void 0:h.call(n,t))??ea((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 od(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function oo(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Ag=(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,ou,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Mg=$("$ZodError",Ag),Ng=$("$ZodError",Ag,{Parent:Error});function p0(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 g0(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 ad=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 Ui;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>xr(l,s,Sr())));throw Pg(a,i==null?void 0:i.callee),a}return o.value},ld=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=>xr(l,s,Sr())));throw Pg(a,i==null?void 0:i.callee),a}return o.value},El=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 Ui;return s.issues.length?{success:!1,error:new(t??Mg)(s.issues.map(o=>xr(o,i,Sr())))}:{success:!0,data:s.value}},m0=El(Ng),kl=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=>xr(o,i,Sr())))}:{success:!0,data:s.value}},v0=kl(Ng),b0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ad(t)(e,n,i)},_0=t=>(e,n,r)=>ad(t)(e,n,r),w0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ld(t)(e,n,i)},y0=t=>async(e,n,r)=>ld(t)(e,n,r),E0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return El(t)(e,n,i)},k0=t=>(e,n,r)=>El(t)(e,n,r),S0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return kl(t)(e,n,i)},x0=t=>async(e,n,r)=>kl(t)(e,n,r),T0=/^[cC][0-9a-z]{6,}$/,C0=/^[0-9a-z]+$/,P0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,R0=/^[0-9a-vA-V]{20}$/,A0=/^[A-Za-z0-9]{27}$/,M0=/^[a-zA-Z0-9_-]{21}$/,N0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,O0=/^([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})$/,wf=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)$/,z0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,I0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function L0(){return new RegExp(I0,"u")}const D0=/^(?:(?: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])$/,H0=/^(([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}|:))$/,B0=/^((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])$/,$0=/^(([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])$/,U0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Og=/^[A-Za-z0-9_-]*$/,j0=/^https?$/,F0=/^\+[1-9]\d{6,14}$/,zg="(?:(?:\\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])))",G0=new RegExp(`^${zg}$`);function Ig(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 V0(t){return new RegExp(`^${Ig(t)}$`)}function Z0(t){const e=Ig({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(`^${zg}T(?:${r})$`)}const W0=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}$`)},q0=/^-?\d+$/,Lg=/^-?\d+(?:\.\d+)?$/,X0=/^(?:true|false)$/i,Y0=/^[^A-Z]*$/,K0=/^[^a-z]*$/,gn=$("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Dg={number:"number",bigint:"bigint",object:"date"},Hg=$("$ZodCheckLessThan",(t,e)=>{gn.init(t,e);const n=Dg[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})}}),Bg=$("$ZodCheckGreaterThan",(t,e)=>{gn.init(t,e);const n=Dg[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})}}),J0=$("$ZodCheckMultipleOf",(t,e)=>{gn.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):e0(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})}}),Q0=$("$ZodCheckNumberFormat",(t,e)=>{var o;gn.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[i,s]=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=q0)}),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})}}),ey=$("$ZodCheckMaxLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!id(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=od(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),ty=$("$ZodCheckMinLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!id(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=od(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),ny=$("$ZodCheckLengthEquals",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!id(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=od(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})}}),Sl=$("$ZodCheckStringFormat",(t,e)=>{var n,r;gn.init(t,e),t._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),ry=$("$ZodCheckRegex",(t,e)=>{Sl.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})}}),iy=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Y0),Sl.init(t,e)}),sy=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=K0),Sl.init(t,e)}),oy=$("$ZodCheckIncludes",(t,e)=>{gn.init(t,e);const n=os(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})}}),ay=$("$ZodCheckStartsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`^${os(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})}}),ly=$("$ZodCheckEndsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`.*${os(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})}}),cy=$("$ZodCheckOverwrite",(t,e)=>{gn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class uy{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 dy={major:4,minor:4,patch:3},_t=$("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=dy;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=Hi(a),d;for(const h of l){if(h._zod.def.when){if(h0(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 Ui;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==p&&(u||(u=Hi(a,p)))});else{if(a.issues.length===p)continue;u||(u=Hi(a,p))}}return d?d.then(()=>a):a},o=(a,l,c)=>{if(Hi(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Ui;return u.then(d=>t._zod.parse(d,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(d=>o(d,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new Ui;return c.then(u=>s(u,r,l))}return s(c,r,l)}}ot(t,"~standard",()=>({validate:s=>{var o;try{const a=m0(t,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return v0(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}))}),cd=$("$ZodString",(t,e)=>{var n;_t.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??W0(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}}),vt=$("$ZodStringFormat",(t,e)=>{Sl.init(t,e),cd.init(t,e)}),fy=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=O0),vt.init(t,e)}),hy=$("$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=wf(r))}else e.pattern??(e.pattern=wf());vt.init(t,e)}),py=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=z0),vt.init(t,e)}),gy=$("$ZodURL",(t,e)=>{vt.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)===j0.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})}}}),my=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=L0()),vt.init(t,e)}),vy=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=M0),vt.init(t,e)}),by=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=T0),vt.init(t,e)}),_y=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=C0),vt.init(t,e)}),wy=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=P0),vt.init(t,e)}),yy=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=R0),vt.init(t,e)}),Ey=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=A0),vt.init(t,e)}),ky=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Z0(e)),vt.init(t,e)}),Sy=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=G0),vt.init(t,e)}),xy=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=V0(e)),vt.init(t,e)}),Ty=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=N0),vt.init(t,e)}),Cy=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=D0),vt.init(t,e),t._zod.bag.format="ipv4"}),Py=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=H0),vt.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})}}}),Ry=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=B0),vt.init(t,e)}),Ay=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=$0),vt.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 $g(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const My=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=U0),vt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{$g(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Ny(t){if(!Og.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return $g(n)}const Oy=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Og),vt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Ny(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),zy=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=F0),vt.init(t,e)});function Iy(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 Ly=$("$ZodJWT",(t,e)=>{vt.init(t,e),t._zod.check=n=>{Iy(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Ug=$("$ZodNumber",(t,e)=>{_t.init(t,e),t._zod.pattern=t._zod.bag.pattern??Lg,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}}),Dy=$("$ZodNumberFormat",(t,e)=>{Q0.init(t,e),Ug.init(t,e)}),Hy=$("$ZodBoolean",(t,e)=>{_t.init(t,e),t._zod.pattern=X0,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}}),By=$("$ZodUnknown",(t,e)=>{_t.init(t,e),t._zod.parse=n=>n}),$y=$("$ZodNever",(t,e)=>{_t.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function yf(t,e,n){t.issues.length&&e.issues.push(...Bi(n,t.issues)),e.value[n]=t.value}const Uy=$("$ZodArray",(t,e)=>{_t.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=>yf(c,n,o))):yf(l,n,o)}return s.length?Promise.all(s).then(()=>n):n}});function Ba(t,e,n,r,i,s){const o=n in r;if(t.issues.length){if(i&&s&&!o)return;e.issues.push(...Bi(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 jg(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=i0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Fg(t,e,n,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u=l.optin==="optional",d=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=>Ba(g,n,h,e,u,d))):Ba(p,n,h,e,u,d)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const jy=$("$ZodObject",(t,e)=>{_t.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=yl(()=>jg(e));ot(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 d of u.values)l[c].add(d)}}return l});const i=so,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=[],d=o.shape;for(const h of o.keys){const p=d[h],g=p._zod.optin==="optional",m=p._zod.optout==="optional",b=p._zod.run({value:c[h],issues:[]},l);b instanceof Promise?u.push(b.then(E=>Ba(E,a,h,c,g,m))):Ba(b,a,h,c,g,m)}return s?Fg(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),Fy=$("$ZodObjectJIT",(t,e)=>{jy.init(t,e);const n=t._zod.parse,r=yl(()=>jg(e)),i=h=>{var z,R;const p=new uy(["shape","payload","ctx"]),g=r.value,m=A=>{const x=_f(A);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};p.write("const input = payload.value;");const b=Object.create(null);let E=0;for(const A of g.keys)b[A]=`key_${E++}`;p.write("const newResult = {};");for(const A of g.keys){const x=b[A],N=_f(A),O=h[A],j=((z=O==null?void 0:O._zod)==null?void 0:z.optin)==="optional",B=((R=O==null?void 0:O._zod)==null?void 0:R.optout)==="optional";p.write(`const ${x} = ${m(A)};`),j&&B?p.write(`
6
- if (${x}.issues.length) {
7
- if (${N} in input) {
8
- payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
9
- ...iss,
10
- path: iss.path ? [${N}, ...iss.path] : [${N}]
11
- })));
12
- }
13
- }
14
-
15
- if (${x}.value === undefined) {
16
- if (${N} in input) {
17
- newResult[${N}] = undefined;
18
- }
19
- } else {
20
- newResult[${N}] = ${x}.value;
21
- }
22
-
23
- `):j?p.write(`
24
- if (${x}.issues.length) {
25
- payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
26
- ...iss,
27
- path: iss.path ? [${N}, ...iss.path] : [${N}]
28
- })));
29
- }
30
-
31
- if (${x}.value === undefined) {
32
- if (${N} in input) {
33
- newResult[${N}] = undefined;
34
- }
35
- } else {
36
- newResult[${N}] = ${x}.value;
37
- }
38
-
39
- `):p.write(`
40
- const ${x}_present = ${N} in input;
41
- if (${x}.issues.length) {
42
- payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
43
- ...iss,
44
- path: iss.path ? [${N}, ...iss.path] : [${N}]
45
- })));
46
- }
47
- if (!${x}_present && !${x}.issues.length) {
48
- payload.issues.push({
49
- code: "invalid_type",
50
- expected: "nonoptional",
51
- input: undefined,
52
- path: [${N}]
53
- });
54
- }
55
-
56
- if (${x}_present) {
57
- if (${x}.value === undefined) {
58
- newResult[${N}] = undefined;
59
- } else {
60
- newResult[${N}] = ${x}.value;
61
- }
62
- }
63
-
64
- `)}p.write("payload.value = newResult;"),p.write("return payload;");const M=p.compile();return(A,x)=>M(h,A,x)};let s;const o=so,a=!rd.jitless,c=a&&n0.value,u=e.catchall;let d;t._zod.parse=(h,p)=>{d??(d=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?Fg([],g,h,p,d,t):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),h)}});function Ef(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=>!Hi(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=>xr(o,r,Sr())))}),e)}const Gg=$("$ZodUnion",(t,e)=>{_t.init(t,e),ot(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ot(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ot(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ot(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=>sd(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=>Ef(a,r,t,i)):Ef(o,r,t,i)}}),Gy=$("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Gg.init(t,e);const n=t._zod.parse;ot(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=yl(()=>{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(!so(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)}}),Vy=$("$ZodIntersection",(t,e)=>{_t.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])=>kf(n,l,c)):kf(n,s,o)}});function au(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(ss(t)&&ss(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=au(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=au(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 kf(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}),Hi(t))return t;const o=au(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 Zy=$("$ZodRecord",(t,e)=>{_t.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!ss(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=>xr(p,r,Sr())),input:c,path:[c],inst:t});continue}const d=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(...Bi(c,p.issues)),n.value[d]=p.value})):(h.issues.length&&n.issues.push(...Bi(c,h.issues)),n.value[d]=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"&&Lg.test(a)&&l.issues.length){const d=e.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){e.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>xr(d,r,Sr())),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(d=>{d.issues.length&&n.issues.push(...Bi(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...Bi(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Wy=$("$ZodEnum",(t,e)=>{_t.init(t,e);const n=Cg(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>r0.has(typeof i)).map(i=>typeof i=="string"?os(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}}),qy=$("$ZodLiteral",(t,e)=>{if(_t.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"?os(r):r?os(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}}),Xy=$("$ZodTransform",(t,e)=>{_t.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Tg(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 Ui;return n.value=i,n.fallback=!0,n}});function Sf(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const Vg=$("$ZodOptional",(t,e)=>{_t.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ot(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ot(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${sd(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=>Sf(o,i)):Sf(s,i)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Yy=$("$ZodExactOptional",(t,e)=>{Vg.init(t,e),ot(t._zod,"values",()=>e.innerType._zod.values),ot(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Ky=$("$ZodNullable",(t,e)=>{_t.init(t,e),ot(t._zod,"optin",()=>e.innerType._zod.optin),ot(t._zod,"optout",()=>e.innerType._zod.optout),ot(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${sd(n.source)}|null)$`):void 0}),ot(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)}),Jy=$("$ZodDefault",(t,e)=>{_t.init(t,e),t._zod.optin="optional",ot(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=>xf(s,e)):xf(i,e)}});function xf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Qy=$("$ZodPrefault",(t,e)=>{_t.init(t,e),t._zod.optin="optional",ot(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))}),e1=$("$ZodNonOptional",(t,e)=>{_t.init(t,e),ot(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=>Tf(s,t)):Tf(i,t)}});function Tf(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 t1=$("$ZodCatch",(t,e)=>{_t.init(t,e),t._zod.optin="optional",ot(t._zod,"optout",()=>e.innerType._zod.optout),ot(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=>xr(o,r,Sr()))},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=>xr(s,r,Sr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Zg=$("$ZodPipe",(t,e)=>{_t.init(t,e),ot(t._zod,"values",()=>e.in._zod.values),ot(t._zod,"optin",()=>e.in._zod.optin),ot(t._zod,"optout",()=>e.out._zod.optout),ot(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=>ta(o,e.in,r)):ta(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>ta(s,e.out,r)):ta(i,e.out,r)}});function ta(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 n1=$("$ZodPreprocess",(t,e)=>{Zg.init(t,e)}),r1=$("$ZodReadonly",(t,e)=>{_t.init(t,e),ot(t._zod,"propValues",()=>e.innerType._zod.propValues),ot(t._zod,"values",()=>e.innerType._zod.values),ot(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ot(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(Cf):Cf(i)}});function Cf(t){return t.value=Object.freeze(t.value),t}const i1=$("$ZodCustom",(t,e)=>{gn.init(t,e),_t.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=>Pf(s,n,r,t));Pf(i,n,r,t)}});function Pf(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(oo(i))}}var Rf;class s1{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 o1(){return new s1}(Rf=globalThis).__zod_globalRegistry??(Rf.__zod_globalRegistry=o1());const js=globalThis.__zod_globalRegistry;function a1(t,e){return new t({type:"string",...ye(e)})}function l1(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ye(e)})}function Af(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ye(e)})}function c1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(e)})}function u1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(e)})}function d1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(e)})}function f1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(e)})}function h1(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ye(e)})}function p1(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(e)})}function g1(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(e)})}function m1(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(e)})}function v1(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(e)})}function b1(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(e)})}function _1(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ye(e)})}function w1(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(e)})}function y1(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(e)})}function E1(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(e)})}function k1(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(e)})}function S1(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(e)})}function x1(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ye(e)})}function T1(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(e)})}function C1(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ye(e)})}function P1(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(e)})}function R1(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(e)})}function A1(t,e){return new t({type:"string",format:"date",check:"string_format",...ye(e)})}function M1(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ye(e)})}function N1(t,e){return new t({type:"string",format:"duration",check:"string_format",...ye(e)})}function O1(t,e){return new t({type:"number",checks:[],...ye(e)})}function z1(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(e)})}function I1(t,e){return new t({type:"boolean",...ye(e)})}function L1(t){return new t({type:"unknown"})}function D1(t,e){return new t({type:"never",...ye(e)})}function Mf(t,e){return new Hg({check:"less_than",...ye(e),value:t,inclusive:!1})}function Kl(t,e){return new Hg({check:"less_than",...ye(e),value:t,inclusive:!0})}function Nf(t,e){return new Bg({check:"greater_than",...ye(e),value:t,inclusive:!1})}function Jl(t,e){return new Bg({check:"greater_than",...ye(e),value:t,inclusive:!0})}function Of(t,e){return new J0({check:"multiple_of",...ye(e),value:t})}function Wg(t,e){return new ey({check:"max_length",...ye(e),maximum:t})}function $a(t,e){return new ty({check:"min_length",...ye(e),minimum:t})}function qg(t,e){return new ny({check:"length_equals",...ye(e),length:t})}function H1(t,e){return new ry({check:"string_format",format:"regex",...ye(e),pattern:t})}function B1(t){return new iy({check:"string_format",format:"lowercase",...ye(t)})}function $1(t){return new sy({check:"string_format",format:"uppercase",...ye(t)})}function U1(t,e){return new oy({check:"string_format",format:"includes",...ye(e),includes:t})}function j1(t,e){return new ay({check:"string_format",format:"starts_with",...ye(e),prefix:t})}function F1(t,e){return new ly({check:"string_format",format:"ends_with",...ye(e),suffix:t})}function gs(t){return new cy({check:"overwrite",tx:t})}function G1(t){return gs(e=>e.normalize(t))}function V1(){return gs(t=>t.trim())}function Z1(){return gs(t=>t.toLowerCase())}function W1(){return gs(t=>t.toUpperCase())}function q1(){return gs(t=>t0(t))}function X1(t,e,n){return new t({type:"array",element:e,...ye(n)})}function Y1(t,e,n){return new t({type:"custom",check:"custom",fn:e,...ye(n)})}function K1(t,e){const n=J1(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(oo(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(oo(s))}},t(r.value,r)),e);return n}function J1(t,e){const n=new gn({check:"custom",...ye(e)});return n._zod.check=t,n}function Xg(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)??js,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 Mt(t,e,n={path:[],schemaPath:[]}){var u,d;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=(d=(u=t._zod).toJSONSchema)==null?void 0:d.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),Mt(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 Yg(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 d=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(d){const h=r.get(d);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(d,u[0])}}const i=u=>{var m;const d=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const b=(m=t.external.registry.get(u[0]))==null?void 0:m.id,E=t.external.uri??(z=>z);if(b)return{ref:E(b)};const M=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=M,{defId:M,ref:`${E("__shared")}#/${d}/${M}`}}if(u[1]===n)return{ref:"#"};const p=`#/${d}/`,g=u[1].schema.id??`__schema${t.counter++}`;return{defId:g,ref:p+g}},s=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:h,defId:p}=i(u);d.def={...d.schema},p&&(d.defId=p);const g=d.schema;for(const m in g)delete g[m];g.$ref=h};if(t.cycles==="throw")for(const u of t.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${(a=d.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 d=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(d.cycle){s(u);continue}if(d.count>1&&t.reused==="ref"){s(u);continue}}}function Kg(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=d=>{const h=t.seen.get(d);if(h.ref===null)return;const p=h.def??h.schema,g={...p},m=h.ref;if(h.ref=null,m){r(m);const E=t.seen.get(m),M=E.schema;if(M.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(M)):Object.assign(p,M),Object.assign(p,g),d._zod.parent===m)for(const R in p)R==="$ref"||R==="allOf"||R in g||delete p[R];if(M.$ref&&E.def)for(const R in p)R==="$ref"||R==="allOf"||R in E.def&&JSON.stringify(p[R])===JSON.stringify(E.def[R])&&delete p[R]}const b=d._zod.parent;if(b&&b!==m){r(b);const E=t.seen.get(b);if(E!=null&&E.schema.$ref&&(p.$ref=E.schema.$ref,E.def))for(const M in p)M==="$ref"||M==="allOf"||M in E.def&&JSON.stringify(p[M])===JSON.stringify(E.def[M])&&delete p[M]}t.override({zodSchema:d,jsonSchema:p,path:h.path??[]})};for(const d of[...t.seen.entries()].reverse())r(d[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 d=(l=t.external.registry.get(e))==null?void 0:l.id;if(!d)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(d)}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 d of t.seen.entries()){const h=d[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 d=JSON.parse(JSON.stringify(i));return Object.defineProperty(d,"~standard",{value:{...e["~standard"],jsonSchema:{input:Ua(e,"input",t.processors),output:Ua(e,"output",t.processors)}},enumerable:!1,writable:!1}),d}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 Q1=(t,e={})=>n=>{const r=Xg({...n,processors:e});return Mt(t,r),Yg(r,t),Kg(r,t)},Ua=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Xg({...i??{},target:s,io:e,processors:n});return Mt(t,o),Yg(o,t),Kg(o,t)},eE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tE=(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=eE[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(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},nE=(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 d=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";d?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)},rE=(t,e,n,r)=>{n.type="boolean"},iE=(t,e,n,r)=>{n.not={}},sE=(t,e,n,r)=>{},oE=(t,e,n,r)=>{const i=t._zod.def,s=Cg(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},aE=(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},lE=(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")},uE=(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=Mt(s.element,e,{...r,path:[...r.path,"items"]})},dE=(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]=Mt(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const d=s.shape[u]._zod;return e.io==="input"?d.optin===void 0:d.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=Mt(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},fE=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>Mt(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},hE=(t,e,n,r)=>{const i=t._zod.def,s=Mt(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Mt(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},pE=(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=Mt(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const d of l)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Mt(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Mt(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},gE=(t,e,n,r)=>{const i=t._zod.def,s=Mt(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"}]},mE=(t,e,n,r)=>{const i=t._zod.def;Mt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},vE=(t,e,n,r)=>{const i=t._zod.def;Mt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},bE=(t,e,n,r)=>{const i=t._zod.def;Mt(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)))},_E=(t,e,n,r)=>{const i=t._zod.def;Mt(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},wE=(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;Mt(o,e,r);const a=e.seen.get(t);a.ref=o},yE=(t,e,n,r)=>{const i=t._zod.def;Mt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},Jg=(t,e,n,r)=>{const i=t._zod.def;Mt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},EE=$("ZodISODateTime",(t,e)=>{ky.init(t,e),yt.init(t,e)});function kE(t){return R1(EE,t)}const SE=$("ZodISODate",(t,e)=>{Sy.init(t,e),yt.init(t,e)});function xE(t){return A1(SE,t)}const TE=$("ZodISOTime",(t,e)=>{xy.init(t,e),yt.init(t,e)});function CE(t){return M1(TE,t)}const PE=$("ZodISODuration",(t,e)=>{Ty.init(t,e),yt.init(t,e)});function RE(t){return N1(PE,t)}const AE=(t,e)=>{Mg.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>g0(t,n)},flatten:{value:n=>p0(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,ou,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,ou,2)}},isEmpty:{get(){return t.issues.length===0}}})},In=$("ZodError",AE,{Parent:Error}),ME=ad(In),NE=ld(In),OE=El(In),zE=kl(In),IE=b0(In),LE=_0(In),DE=w0(In),HE=y0(In),BE=E0(In),$E=k0(In),UE=S0(In),jE=x0(In),zf=new WeakMap;function Ho(t,e,n){const r=Object.getPrototypeOf(t);let i=zf.get(r);if(i||(i=new Set,zf.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 wt=$("ZodType",(t,e)=>(_t.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Ua(t,"input"),output:Ua(t,"output")}}),t.toJSONSchema=Q1(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>ME(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>OE(t,n,r),t.parseAsync=async(n,r)=>NE(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>zE(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>IE(t,n,r),t.decode=(n,r)=>LE(t,n,r),t.encodeAsync=async(n,r)=>DE(t,n,r),t.decodeAsync=async(n,r)=>HE(t,n,r),t.safeEncode=(n,r)=>BE(t,n,r),t.safeDecode=(n,r)=>$E(t,n,r),t.safeEncodeAsync=async(n,r)=>UE(t,n,r),t.safeDecodeAsync=async(n,r)=>jE(t,n,r),Ho(t,"ZodType",{check(...n){const r=this.def;return this.clone(ei(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 ti(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Ok(n,r))},superRefine(n,r){return this.check(zk(n,r))},overwrite(n){return this.check(gs(n))},optional(){return Hf(this)},exactOptional(){return wk(this)},nullable(){return Bf(this)},nullish(){return Hf(Bf(this))},nonoptional(n){return Tk(this,n)},array(){return bt(this)},or(n){return $r([this,n])},and(n){return mk(this,n)},transform(n){return $f(this,nm(n))},default(n){return kk(this,n)},prefault(n){return xk(this,n)},catch(n){return Pk(this,n)},pipe(n){return $f(this,n)},readonly(){return Mk(this)},describe(n){const r=this.clone();return js.add(r,{description:n}),r},meta(...n){if(n.length===0)return js.get(this);const r=this.clone();return js.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=js.get(t))==null?void 0:n.description},configurable:!0}),t)),Qg=$("_ZodString",(t,e)=>{cd.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>tE(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Ho(t,"_ZodString",{regex(...r){return this.check(H1(...r))},includes(...r){return this.check(U1(...r))},startsWith(...r){return this.check(j1(...r))},endsWith(...r){return this.check(F1(...r))},min(...r){return this.check($a(...r))},max(...r){return this.check(Wg(...r))},length(...r){return this.check(qg(...r))},nonempty(...r){return this.check($a(1,...r))},lowercase(r){return this.check(B1(r))},uppercase(r){return this.check($1(r))},trim(){return this.check(V1())},normalize(...r){return this.check(G1(...r))},toLowerCase(){return this.check(Z1())},toUpperCase(){return this.check(W1())},slugify(){return this.check(q1())}})}),FE=$("ZodString",(t,e)=>{cd.init(t,e),Qg.init(t,e),t.email=n=>t.check(l1(GE,n)),t.url=n=>t.check(h1(VE,n)),t.jwt=n=>t.check(P1(ok,n)),t.emoji=n=>t.check(p1(ZE,n)),t.guid=n=>t.check(Af(If,n)),t.uuid=n=>t.check(c1(na,n)),t.uuidv4=n=>t.check(u1(na,n)),t.uuidv6=n=>t.check(d1(na,n)),t.uuidv7=n=>t.check(f1(na,n)),t.nanoid=n=>t.check(g1(WE,n)),t.guid=n=>t.check(Af(If,n)),t.cuid=n=>t.check(m1(qE,n)),t.cuid2=n=>t.check(v1(XE,n)),t.ulid=n=>t.check(b1(YE,n)),t.base64=n=>t.check(x1(rk,n)),t.base64url=n=>t.check(T1(ik,n)),t.xid=n=>t.check(_1(KE,n)),t.ksuid=n=>t.check(w1(JE,n)),t.ipv4=n=>t.check(y1(QE,n)),t.ipv6=n=>t.check(E1(ek,n)),t.cidrv4=n=>t.check(k1(tk,n)),t.cidrv6=n=>t.check(S1(nk,n)),t.e164=n=>t.check(C1(sk,n)),t.datetime=n=>t.check(kE(n)),t.date=n=>t.check(xE(n)),t.time=n=>t.check(CE(n)),t.duration=n=>t.check(RE(n))});function de(t){return a1(FE,t)}const yt=$("ZodStringFormat",(t,e)=>{vt.init(t,e),Qg.init(t,e)}),GE=$("ZodEmail",(t,e)=>{py.init(t,e),yt.init(t,e)}),If=$("ZodGUID",(t,e)=>{fy.init(t,e),yt.init(t,e)}),na=$("ZodUUID",(t,e)=>{hy.init(t,e),yt.init(t,e)}),VE=$("ZodURL",(t,e)=>{gy.init(t,e),yt.init(t,e)}),ZE=$("ZodEmoji",(t,e)=>{my.init(t,e),yt.init(t,e)}),WE=$("ZodNanoID",(t,e)=>{vy.init(t,e),yt.init(t,e)}),qE=$("ZodCUID",(t,e)=>{by.init(t,e),yt.init(t,e)}),XE=$("ZodCUID2",(t,e)=>{_y.init(t,e),yt.init(t,e)}),YE=$("ZodULID",(t,e)=>{wy.init(t,e),yt.init(t,e)}),KE=$("ZodXID",(t,e)=>{yy.init(t,e),yt.init(t,e)}),JE=$("ZodKSUID",(t,e)=>{Ey.init(t,e),yt.init(t,e)}),QE=$("ZodIPv4",(t,e)=>{Cy.init(t,e),yt.init(t,e)}),ek=$("ZodIPv6",(t,e)=>{Py.init(t,e),yt.init(t,e)}),tk=$("ZodCIDRv4",(t,e)=>{Ry.init(t,e),yt.init(t,e)}),nk=$("ZodCIDRv6",(t,e)=>{Ay.init(t,e),yt.init(t,e)}),rk=$("ZodBase64",(t,e)=>{My.init(t,e),yt.init(t,e)}),ik=$("ZodBase64URL",(t,e)=>{Oy.init(t,e),yt.init(t,e)}),sk=$("ZodE164",(t,e)=>{zy.init(t,e),yt.init(t,e)}),ok=$("ZodJWT",(t,e)=>{Ly.init(t,e),yt.init(t,e)}),em=$("ZodNumber",(t,e)=>{Ug.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>nE(t,r,i),Ho(t,"ZodNumber",{gt(r,i){return this.check(Nf(r,i))},gte(r,i){return this.check(Jl(r,i))},min(r,i){return this.check(Jl(r,i))},lt(r,i){return this.check(Mf(r,i))},lte(r,i){return this.check(Kl(r,i))},max(r,i){return this.check(Kl(r,i))},int(r){return this.check(Lf(r))},safe(r){return this.check(Lf(r))},positive(r){return this.check(Nf(0,r))},nonnegative(r){return this.check(Jl(0,r))},negative(r){return this.check(Mf(0,r))},nonpositive(r){return this.check(Kl(0,r))},multipleOf(r,i){return this.check(Of(r,i))},step(r,i){return this.check(Of(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 Zt(t){return O1(em,t)}const ak=$("ZodNumberFormat",(t,e)=>{Dy.init(t,e),em.init(t,e)});function Lf(t){return z1(ak,t)}const lk=$("ZodBoolean",(t,e)=>{Hy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>rE(t,n,r)});function Tr(t){return I1(lk,t)}const ck=$("ZodUnknown",(t,e)=>{By.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>sE()});function lu(){return L1(ck)}const uk=$("ZodNever",(t,e)=>{$y.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>iE(t,n,r)});function dk(t){return D1(uk,t)}const fk=$("ZodArray",(t,e)=>{Uy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>uE(t,n,r,i),t.element=e.element,Ho(t,"ZodArray",{min(n,r){return this.check($a(n,r))},nonempty(n){return this.check($a(1,n))},max(n,r){return this.check(Wg(n,r))},length(n,r){return this.check(qg(n,r))},unwrap(){return this.element}})});function bt(t,e){return X1(fk,t,e)}const hk=$("ZodObject",(t,e)=>{Fy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>dE(t,n,r,i),ot(t,"shape",()=>e.shape),Ho(t,"ZodObject",{keyof(){return Jt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:lu()})},loose(){return this.clone({...this._zod.def,catchall:lu()})},strict(){return this.clone({...this._zod.def,catchall:dk()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return l0(this,n)},safeExtend(n){return c0(this,n)},merge(n){return u0(this,n)},pick(n){return o0(this,n)},omit(n){return a0(this,n)},partial(...n){return d0(rm,this,n[0])},required(...n){return f0(im,this,n[0])}})});function Ue(t,e){const n={type:"object",shape:t??{},...ye(e)};return new hk(n)}const tm=$("ZodUnion",(t,e)=>{Gg.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>fE(t,n,r,i),t.options=e.options});function $r(t,e){return new tm({type:"union",options:t,...ye(e)})}const pk=$("ZodDiscriminatedUnion",(t,e)=>{tm.init(t,e),Gy.init(t,e)});function ud(t,e,n){return new pk({type:"union",options:e,discriminator:t,...ye(n)})}const gk=$("ZodIntersection",(t,e)=>{Vy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>hE(t,n,r,i)});function mk(t,e){return new gk({type:"intersection",left:t,right:e})}const Df=$("ZodRecord",(t,e)=>{Zy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>pE(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function ms(t,e,n){return!e||!e._zod?new Df({type:"record",keyType:de(),valueType:t,...ye(e)}):new Df({type:"record",keyType:t,valueType:e,...ye(n)})}const cu=$("ZodEnum",(t,e)=>{Wy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>oE(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 cu({...e,checks:[],...ye(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 cu({...e,checks:[],...ye(i),entries:s})}});function Jt(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new cu({type:"enum",entries:n,...ye(e)})}const vk=$("ZodLiteral",(t,e)=>{qy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>aE(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 Rt(t,e){return new vk({type:"literal",values:Array.isArray(t)?t:[t],...ye(e)})}const bk=$("ZodTransform",(t,e)=>{Xy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>cE(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Tg(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(oo(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(oo(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 nm(t){return new bk({type:"transform",transform:t})}const rm=$("ZodOptional",(t,e)=>{Vg.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Jg(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Hf(t){return new rm({type:"optional",innerType:t})}const _k=$("ZodExactOptional",(t,e)=>{Yy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Jg(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function wk(t){return new _k({type:"optional",innerType:t})}const yk=$("ZodNullable",(t,e)=>{Ky.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>gE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Bf(t){return new yk({type:"nullable",innerType:t})}const Ek=$("ZodDefault",(t,e)=>{Jy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>vE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function kk(t,e){return new Ek({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Rg(e)}})}const Sk=$("ZodPrefault",(t,e)=>{Qy.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>bE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function xk(t,e){return new Sk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Rg(e)}})}const im=$("ZodNonOptional",(t,e)=>{e1.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>mE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Tk(t,e){return new im({type:"nonoptional",innerType:t,...ye(e)})}const Ck=$("ZodCatch",(t,e)=>{t1.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>_E(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Pk(t,e){return new Ck({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const sm=$("ZodPipe",(t,e)=>{Zg.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>wE(t,n,r,i),t.in=e.in,t.out=e.out});function $f(t,e){return new sm({type:"pipe",in:t,out:e})}const Rk=$("ZodPreprocess",(t,e)=>{sm.init(t,e),n1.init(t,e)}),Ak=$("ZodReadonly",(t,e)=>{r1.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>yE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Mk(t){return new Ak({type:"readonly",innerType:t})}const Nk=$("ZodCustom",(t,e)=>{i1.init(t,e),wt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>lE(t,n)});function Ok(t,e={}){return Y1(Nk,t,e)}function zk(t,e){return K1(t,e)}function Ik(t,e){return new Rk({type:"pipe",in:nm(t),out:e})}const Lk=de().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/),Se=de().min(1),dd=Zt().int(),ra=dd.nonnegative(),Uf=4*1024;Jt(["hook","log","internal"]);const Dk=/^events:(\*|[a-z][a-z0-9]*(?:,[a-z][a-z0-9]*)*)$/,Hk=de().regex(Dk),ut=(t,e,n)=>{const r=typeof e=="string"?Rt(e):e;return Ue({id:Lk,ts:dd,topic:Rt(t),source:r,payload:n}).strict()},Ht=t=>Ue(t).strict(),jf=$r([ut("wan.connected",$r([Rt("hook"),Rt("log")]),Ht({interface:Se,address:Se,mask:Se,gateway:Se})),ut("wan.disconnected",$r([Rt("hook"),Rt("log")]),Ht({interface:Se})),ut("net.ip_changed",$r([Rt("hook"),Rt("log")]),Ue({address:Se,mask:Se,link:Se,connected:Tr()}).strict()),ut("net.dhcp_lease","log",Ht({mac:Se,ip:Se,hostname:Se,action:Se})),ut("net.dns_changed","log",Ue({resolvers:bt(Se)}).strict()),ut("wifi.client_join","log",Ht({mac:Se,band:Se,ssid:Se,iface:Se})),ut("wifi.client_leave","log",Ht({mac:Se,band:Se,ssid:Se,iface:Se})),ut("firewall.rebuilt","hook",Ht({table_type:Se,table:Se})),ut("usb.attached","hook",Ht({device:Se,model:Se,vendor:Se,port:Se})),ut("usb.detached","hook",Ht({device:Se,port:Se})),ut("fs.mounted","hook",Ht({fs_type:Se,label:Se,directory:Se})),ut("fs.unmounted","hook",Ht({label:Se,directory:Se})),ut("clock.synced","hook",Ue({offset_ms:dd.optional()}).strict()),ut("schedule.fired","hook",Ue({name:Se,action:Se,elapsed:ra}).strict()),ut("button.pressed","hook",Ht({button:Se,gesture:Se})),ut("auth.login","log",Ue({user:Se,ip:Se,success:Tr()}).strict()),ut("firmware.available","log",Ht({version:Se})),ut("plugin.installed","internal",Ht({name:Se,version:Se})),ut("plugin.removed","internal",Ht({name:Se})),ut("plugin.approved","internal",Ht({name:Se,version:Se})),ut("plugin.started","internal",Ht({name:Se})),ut("plugin.stopped","internal",Ue({name:Se,reason:Se}).strict()),ut("daemon.started","internal",Ue({version:Se,uptime_ms:ra}).strict()),ut("daemon.stopping","internal",Ht({reason:Se})),ut("daemon.updated","internal",Ht({version:Se})),ut("storage.low","internal",Ue({path:Rt("/opt"),available_bytes:ra,threshold_bytes:ra}).strict())]).superRefine((t,e)=>{new TextEncoder().encode(JSON.stringify(t.payload)).length>Uf&&e.addIssue({code:"custom",message:`payload exceeds ${Uf} bytes`})});function Ql(t,e){const n=e&&e.cache?e.cache:Vk,r=e&&e.serializer?e.serializer:Fk;return(e&&e.strategy?e.strategy:Uk)(t,{cache:n,serializer:r})}function Bk(t){return t==null||typeof t=="number"||typeof t=="boolean"}function $k(t,e,n,r){const i=Bk(r)?r:n(r);let s=e.get(i);return typeof s>"u"&&(s=t.call(this,r),e.set(i,s)),s}function om(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 am(t,e,n,r,i){return n.bind(e,t,r,i)}function Uk(t,e){const n=t.length===1?$k:om;return am(t,this,n,e.cache.create(),e.serializer)}function jk(t,e){return am(t,this,om,e.cache.create(),e.serializer)}const Fk=function(){return JSON.stringify(arguments)};var Gk=class{constructor(){this.cache=Object.create(null)}get(t){return this.cache[t]}set(t,e){this.cache[t]=e}};const Vk={create:function(){return new Gk}},ec={variadic:jk},Zk=/(?:[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 Wk(t){const e={};return t.replace(Zk,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 qk=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function Xk(t){if(t.length===0)throw new Error("Number skeleton cannot be empty");const e=t.split(qk).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 Yk(t){return t.replace(/^(.*?)-/,"")}const Ff=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,lm=/^(@+)?(\+|#+)?[rs]?$/g,Kk=/(\*)(0+)|(#+)(0+)|(0+)/g,cm=/^(0+)$/;function Gf(t){const e={};return t[t.length-1]==="r"?e.roundingPriority="morePrecision":t[t.length-1]==="s"&&(e.roundingPriority="lessPrecision"),t.replace(lm,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 um(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 Jk(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)),!cm.test(t))throw new Error("Malformed concise eng/scientific notation");e.minimumIntegerDigits=t.length}return e}function Vf(t){const e={},n=um(t);return n||e}function Qk(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=Yk(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,...Vf(o)}),{})};continue;case"engineering":e={...e,notation:"engineering",...n.options.reduce((s,o)=>({...s,...Vf(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(Kk,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(cm.test(n.stem)){e.minimumIntegerDigits=n.stem.length;continue}if(Ff.test(n.stem)){if(n.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");n.stem.replace(Ff,function(o,a,l,c,u,d){return l==="*"?e.minimumFractionDigits=a.length:c&&c[0]==="#"?e.maximumFractionDigits=c.length:u&&d?(e.minimumFractionDigits=u.length,e.maximumFractionDigits=u.length+d.length):(e.minimumFractionDigits=a.length,e.maximumFractionDigits=a.length),""});const s=n.options[0];s==="w"?e={...e,trailingZeroDisplay:"stripIfInteger"}:s&&(e={...e,...Gf(s)});continue}if(lm.test(n.stem)){e={...e,...Gf(n.stem)};continue}const r=um(n.stem);r&&(e={...e,...r});const i=Jk(n.stem);i&&(e={...e,...i})}return e}let eS=(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 Zf(t){return t.type===0}function tS(t){return t.type===1}function dm(t){return t.type===2}function fm(t){return t.type===3}function hm(t){return t.type===4}function pm(t){return t.type===5}function gm(t){return t.type===6}function nS(t){return t.type===7}function mm(t){return t.type===8}function vm(t){return!!(t&&typeof t=="object"&&t.type===0)}function uu(t){return!!(t&&typeof t=="object"&&t.type===1)}const bm=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,ia={"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 rS(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=iS(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 iS(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),(ia[r||""]||ia[n||""]||ia[`${n}-001`]||ia["001"])[0]}const sS=new RegExp(`^${bm.source}*`),oS=new RegExp(`${bm.source}*$`);function qe(t,e){return{start:t,end:e}}const aS=!!Object.fromEntries,lS=!!String.prototype.trimStart,cS=!!String.prototype.trimEnd,Wf=aS?Object.fromEntries:function(e){const n={};for(const[r,i]of e)n[r]=i;return n},uS=lS?function(e){return e.trimStart()}:function(e){return e.replace(sS,"")},dS=cS?function(e){return e.trimEnd()}:function(e){return e.replace(oS,"")},qf=new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");function fS(t,e){return qf.lastIndex=e,qf.exec(t)[1]??""}function hS(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 pS=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=hS(this.message);if(e){const n=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:qe(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:qe(s,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,qe(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&du(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:qe(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()||!du(this.char()))return this.error(23,qe(o,this.clonePosition()));const a=this.clonePosition();return r!==this.parseTagName()?this.error(26,qe(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:8,value:r,children:s,location:qe(n,this.clonePosition())},err:null}:this.error(23,qe(o,this.clonePosition())))}else return this.error(27,qe(n,this.clonePosition()))}else return this.error(23,qe(n,this.clonePosition()))}parseTagName(){const t=this.offset();for(this.bump();!this.isEOF()&&mS(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=qe(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!gS(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,qe(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,qe(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,qe(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,qe(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:qe(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,qe(n,this.clonePosition())):this.parseArgumentOptions(t,e,r,n);default:return this.error(3,qe(n,this.clonePosition()))}}parseIdentifierIfPossible(){const t=this.clonePosition(),e=this.offset(),n=fS(this.message,e),r=e+n.length;return this.bumpTo(r),{value:n,location:qe(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,qe(i,o));case"number":case"date":case"time":{this.bumpSpace();let a=null;if(this.bumpIf(",")){this.bumpSpace();const u=this.clonePosition(),d=this.parseSimpleArgStyleIfPossible();if(d.err)return d;const h=dS(d.val);if(h.length===0)return this.error(6,qe(this.clonePosition(),this.clonePosition()));a={style:h,styleLocation:qe(u,this.clonePosition())}}const l=this.tryParseArgumentClose(r);if(l.err)return l;const c=qe(r,this.clonePosition());if(a&&a.style.startsWith("::")){let u=uS(a.style.slice(2));if(s==="number"){const d=this.parseNumberSkeletonFromString(u,a.styleLocation);return d.err?d:{val:{type:2,value:n,location:c,style:d.val},err:null}}else{if(u.length===0)return this.error(10,c);let d=u;this.locale&&(d=rS(u,this.locale));const h={type:1,pattern:d,location:a.styleLocation,parsedOptions:this.shouldParseSkeletons?Wk(d):{}};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,qe(a,{...a}));this.bumpSpace();let l=this.parseIdentifierIfPossible(),c=0;if(s!=="select"&&l.value==="offset"){if(!this.bumpIf(":"))return this.error(13,qe(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 d=this.tryParseArgumentClose(r);if(d.err)return d;const h=qe(r,this.clonePosition());return s==="select"?{val:{type:5,value:n,options:Wf(u.val),location:h},err:null}:{val:{type:6,value:n,options:Wf(u.val),offset:c,pluralType:s==="plural"?"cardinal":"ordinal",location:h},err:null}}default:return this.error(5,qe(i,o))}}tryParseArgumentClose(t){return this.isEOF()||this.char()!==125?this.error(1,qe(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,qe(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=Xk(t)}catch{return this.error(7,e)}return{val:{type:0,tokens:n,location:e,parsedOptions:this.shouldParseSkeletons?Qk(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=qe(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,qe(this.clonePosition(),this.clonePosition()));const u=this.parseMessage(t+1,e,n);if(u.err)return u;const d=this.tryParseArgumentClose(c);if(d.err)return d;s.push([a,{value:u.val,location:qe(c,this.clonePosition())}]),o.add(a),this.bumpSpace(),{value:a,location:l}=this.parseIdentifierIfPossible()}return s.length===0?this.error(e==="select"?15:16,qe(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,qe(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=qe(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()&&vS(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 du(t){return t>=97&&t<=122||t>=65&&t<=90}function gS(t){return du(t)||t===47}function mS(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 vS(t){return t>=9&&t<=13||t===32||t===133||t>=8206&&t<=8207||t===8232||t===8233}function fu(t){t.forEach(e=>{if(delete e.location,pm(e)||gm(e))for(const n in e.options)delete e.options[n].location,fu(e.options[n].value);else dm(e)&&vm(e.style)||(fm(e)||hm(e))&&uu(e.style)?delete e.style.location:mm(e)&&fu(e.children)})}function bS(t,e={}){e={shouldParseSkeletons:!0,requiresOtherClause:!0,...e};const n=new pS(t,e).parse();if(n.err){const r=SyntaxError(eS[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return e!=null&&e.captureLocation||fu(n.val),n.val}var xl=class extends Error{constructor(t,e,n){super(t),this.code=e,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},Xf=class extends xl{constructor(t,e,n,r){super(`Invalid values for "${t}": "${e}". Options are "${Object.keys(n).join('", "')}"`,"INVALID_VALUE",r)}},_S=class extends xl{constructor(t,e,n){super(`Value for "${t}" must be of type ${e}`,"INVALID_VALUE",n)}},wS=class extends xl{constructor(t,e){super(`The intl string context variable "${t}" was not provided to the string "${e}"`,"MISSING_VALUE",e)}};function yS(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 ES(t){return typeof t=="function"}function Sa(t,e,n,r,i,s,o){if(t.length===1&&Zf(t[0]))return[{type:0,value:t[0].value}];const a=[];for(const l of t){if(Zf(l)){a.push({type:0,value:l.value});continue}if(nS(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 wS(c,o);let u=i[c];if(tS(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(fm(l)){const d=typeof l.style=="string"?r.date[l.style]:uu(l.style)?l.style.parsedOptions:void 0;a.push({type:0,value:n.getDateTimeFormat(e,d).format(u)});continue}if(hm(l)){const d=typeof l.style=="string"?r.time[l.style]:uu(l.style)?l.style.parsedOptions:r.time.medium;a.push({type:0,value:n.getDateTimeFormat(e,d).format(u)});continue}if(dm(l)){const d=typeof l.style=="string"?r.number[l.style]:vm(l.style)?l.style.parsedOptions:void 0;if(d&&d.scale){const h=d.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,d).format(u)});continue}if(mm(l)){const{children:d,value:h}=l,p=i[h];if(!ES(p))throw new _S(h,"function",o);let g=p(Sa(d,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(pm(l)){const d=u,h=(Object.prototype.hasOwnProperty.call(l.options,d)?l.options[d]:void 0)||l.options.other;if(!h)throw new Xf(l.value,u,Object.keys(l.options),o);a.push(...Sa(h.value,e,n,r,i));continue}if(gm(l)){const d=`=${u}`;let h=Object.prototype.hasOwnProperty.call(l.options,d)?l.options[d]:void 0;if(!h){if(!Intl.PluralRules)throw new xl(`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 Xf(l.value,u,Object.keys(l.options),o);const p=typeof u=="bigint"?Number(u):u;a.push(...Sa(h.value,e,n,r,i,p-(l.offset||0)));continue}}return yS(a)}function kS(t,e){return e?{...t,...e,...Object.keys(t).reduce((n,r)=>(n[r]={...t[r],...e[r]},n),{})}:t}function SS(t,e){return e?Object.keys(t).reduce((n,r)=>(n[r]=kS(t[r],e[r]),n),{...t}):t}function tc(t){return{create(){return{get(e){return t[e]},set(e,n){t[e]=n}}}}}function xS(t={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:Ql((...e)=>new Intl.NumberFormat(...e),{cache:tc(t.number),strategy:ec.variadic}),getDateTimeFormat:Ql((...e)=>new Intl.DateTimeFormat(...e),{cache:tc(t.dateTime),strategy:ec.variadic}),getPluralRules:Ql((...e)=>new Intl.PluralRules(...e),{cache:tc(t.pluralRules),strategy:ec.variadic})}}var Gt,TS=(Gt=class{constructor(e,n=Gt.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=>Sa(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=Gt.resolveLocale(n),typeof e=="string"){if(this.message=e,!Gt.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");const{...s}=i||{};this.ast=Gt.__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=SS(Gt.formats,r),this.formatters=i&&i.formatters||xS(this.formatterCache)}static get defaultLocale(){return Gt.memoizedDefaultLocale||(Gt.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),Gt.memoizedDefaultLocale}},Gt.memoizedDefaultLocale=null,Gt.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])},Gt.__parse=bS,Gt.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"}}},Gt),CS=TS;function ao(t){return t==="en-XA"?"en":t}function _m(t,e,n){if(e===void 0)return t;try{const r=new CS(t,ao(n)).format(e);return typeof r=="string"?r:String(r)}catch{return t}}const fd=["persistent-rci-session:read","persistent-rci-session:write"],wm=Jt(fd),ym=$r([wm,Hk]),PS=t=>fd.includes(t);function RS(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 nc(t){const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Yf(t){const[e,n,r]=RS(t);return .2126*nc(e)+.7152*nc(n)+.0722*nc(r)}function Qs(t,e){const n=Yf(t),r=Yf(e),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}const hd=[{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"}],AS=[{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 MS(t,e={}){const n=e.selector??":root",r=i=>hd.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 Em=(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}}},NS={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},OS=t=>Em(NS[t.toLowerCase()],6),zS=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,IS=t=>{let e;return(e=t.match(zS))?Em(parseInt(e[1],16),e[1].length):void 0},Vr="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",eo=`${Vr}%`,pd=`(?:${Vr}%|${Vr})`,LS=`(?:${Vr}(deg|grad|rad|turn)|${Vr})`,as="\\s*,\\s*",DS=new RegExp(`^rgba?\\(\\s*${Vr}${as}${Vr}${as}${Vr}\\s*(?:,\\s*${pd}\\s*)?\\)$`),HS=new RegExp(`^rgba?\\(\\s*${eo}${as}${eo}${as}${eo}\\s*(?:,\\s*${pd}\\s*)?\\)$`),BS=t=>{let e={mode:"rgb"},n;if(n=t.match(DS))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(HS))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},ja=(t,e)=>t===void 0?void 0:typeof t!="object"?qS(t):t.mode!==void 0?t:e?{...t,mode:e}:void 0,Xr=(t="rgb")=>e=>(e=ja(e,t))!==void 0?e.mode===t?e:sr[e.mode][t]?sr[e.mode][t](e):t==="rgb"?sr[e.mode].rgb(e):sr.rgb[t](sr[e.mode].rgb(e)):void 0,sr={},km={},Fa=[],Sm={},$S=t=>t,nt=t=>(sr[t.mode]={...sr[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{sr[e]||(sr[e]={}),sr[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=$S)}),km[t.mode]=t,(t.parse||[]).forEach(e=>{US(e,t.mode)}),Xr(t.mode)),Tl=t=>km[t],US=(t,e)=>{if(typeof t=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");Sm[t]=e}else typeof t=="function"&&Fa.indexOf(t)<0&&Fa.push(t)},hu=/[^\x00-\x7F]|[a-zA-Z_]/,jS=/[^\x00-\x7F]|[-\w]/,te={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let Pe=0;function sa(t){let e=t[Pe],n=t[Pe+1];return e==="-"||e==="+"?/\d/.test(n)||n==="."&&/\d/.test(t[Pe+2]):e==="."?/\d/.test(n):/\d/.test(e)}function pu(t){if(Pe>=t.length)return!1;let e=t[Pe];if(hu.test(e))return!0;if(e==="-"){if(t.length-Pe<2)return!1;let n=t[Pe+1];return!!(n==="-"||hu.test(n))}return!1}const FS={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function As(t){let e="";if((t[Pe]==="-"||t[Pe]==="+")&&(e+=t[Pe++]),e+=oa(t),t[Pe]==="."&&/\d/.test(t[Pe+1])&&(e+=t[Pe++]+oa(t)),(t[Pe]==="e"||t[Pe]==="E")&&((t[Pe+1]==="-"||t[Pe+1]==="+")&&/\d/.test(t[Pe+2])?e+=t[Pe++]+t[Pe++]+oa(t):/\d/.test(t[Pe+1])&&(e+=t[Pe++]+oa(t))),pu(t)){let n=Ga(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:te.Hue,value:e*FS[n]}:void 0}return t[Pe]==="%"?(Pe++,{type:te.Percentage,value:+e}):{type:te.Number,value:+e}}function oa(t){let e="";for(;/\d/.test(t[Pe]);)e+=t[Pe++];return e}function Ga(t){let e="";for(;Pe<t.length&&jS.test(t[Pe]);)e+=t[Pe++];return e}function GS(t){let e=Ga(t);return t[Pe]==="("?(Pe++,{type:te.Function,value:e}):e==="none"?{type:te.None,value:void 0}:{type:te.Ident,value:e}}function VS(t=""){let e=t.trim(),n=[],r;for(Pe=0;Pe<e.length;){if(r=e[Pe++],r===`
78
- `||r===" "||r===" "){for(;Pe<e.length&&(e[Pe]===`
79
- `||e[Pe]===" "||e[Pe]===" ");)Pe++;continue}if(r===",")return;if(r===")"){n.push({type:te.ParenClose});continue}if(r==="+"){if(Pe--,sa(e)){n.push(As(e));continue}return}if(r==="-"){if(Pe--,sa(e)){n.push(As(e));continue}if(pu(e)){n.push({type:te.Ident,value:Ga(e)});continue}return}if(r==="."){if(Pe--,sa(e)){n.push(As(e));continue}return}if(r==="/"){for(;Pe<e.length&&(e[Pe]===`
80
- `||e[Pe]===" "||e[Pe]===" ");)Pe++;let i;if(sa(e)&&(i=As(e),i.type!==te.Hue)){n.push({type:te.Alpha,value:i});continue}if(pu(e)&&Ga(e)==="none"){n.push({type:te.Alpha,value:{type:te.None,value:void 0}});continue}return}if(/\d/.test(r)){Pe--,n.push(As(e));continue}if(hu.test(r)){Pe--,n.push(GS(e));continue}return}return n}function ZS(t){t._i=0;let e=t[t._i++];if(!e||e.type!==te.Function||e.value!=="color"||(e=t[t._i++],e.type!==te.Ident))return;const n=Sm[e.value];if(!n)return;const r={mode:n},i=xm(t,!1);if(!i)return;const s=Tl(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==te.None&&(r[l]=a.type===te.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function xm(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===te.None||r.type===te.Number||r.type===te.Alpha||r.type===te.Percentage||e&&r.type===te.Hue){n.push(r);continue}if(r.type===te.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==te.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:te.None,value:void 0}),n.every(i=>i.type!==te.Alpha)?n:void 0}}function WS(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==te.Function)return;let r=xm(t,e);if(r)return r.unshift(n.value),r}const qS=t=>{if(typeof t!="string")return;const e=VS(t),n=e?WS(e,!0):void 0;let r,i=0,s=Fa.length;for(;i<s;)if((r=Fa[i++](t,n))!==void 0)return r;return e?ZS(e):void 0};function XS(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===te.Hue||i.type===te.Hue||s.type===te.Hue))return r.type!==te.None&&(n.r=r.type===te.Number?r.value/255:r.value/100),i.type!==te.None&&(n.g=i.type===te.Number?i.value/255:i.value/100),s.type!==te.None&&(n.b=s.type===te.Number?s.value/255:s.value/100),o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const YS=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,KS=(t,e,n)=>t+n*(e-t),JS=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},QS=t=>e=>{let n=JS(e);return r=>{let i=r*n.length,s=r>=1?n.length-1:Math.max(Math.floor(i),0),o=n[s];return o===void 0?void 0:t(o[0],o[1],i-s)}},he=QS(KS),Lt=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},vs={mode:"rgb",channels:["r","g","b","alpha"],parse:[XS,IS,BS,OS,YS,"srgb"],serialize:"srgb",interpolate:{r:he,g:he,b:he,alpha:{use:he,fixup:Lt}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},rc=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Kf=t=>{let e=rc(t.r),n=rc(t.g),r=rc(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},ic=t=>Math.pow(Math.abs(t),256/563)*Math.sign(t),Jf=({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:ic(t*2.0415879038107465-e*.5650069742788597-.3447313507783297*n),g:ic(t*-.9692436362808798+e*1.8759675015077206+.0415550574071756*n),b:ic(t*.0134442806320312-e*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(i.alpha=r),i},sc=(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)},bs=({r:t,g:e,b:n,alpha:r})=>{let i={mode:"lrgb",r:sc(t),g:sc(e),b:sc(n)};return r!==void 0&&(i.alpha=r),i},Si=t=>{let{r:e,g:n,b:r,alpha:i}=bs(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},oc=(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},_s=({r:t,g:e,b:n,alpha:r},i="rgb")=>{let s={mode:i,r:oc(t),g:oc(e),b:oc(n)};return r!==void 0&&(s.alpha=r),s},xi=({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=_s({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},ex={...vs,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Jf(Si(t)),xyz65:Jf},toMode:{rgb:t=>xi(Kf(t)),xyz65:Kf}},qt=t=>(t=t%360)<0?t+360:t,tx=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=qt(n);return r===0||t[r-1]===void 0?s:e(s-qt(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),[]),Pr=t=>tx(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),Bt=[-.14861,1.78277,-.29227,-.90649,1.97294,0],nx=Math.PI/180,rx=180/Math.PI;let Qf=Bt[3]*Bt[4],eh=Bt[1]*Bt[4],th=Bt[1]*Bt[2]-Bt[0]*Bt[3];const ix=({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=(th*n+t*Qf-e*eh)/(th+Qf-eh),s=n-i,o=(Bt[4]*(e-i)-Bt[2]*s)/Bt[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(Bt[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*rx-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)*nx,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*(Bt[0]*o+Bt[1]*a),i.g=n+s*(Bt[2]*o+Bt[3]*a),i.b=n+s*(Bt[4]*o+Bt[5]*a),r!==void 0&&(i.alpha=r),i},Cl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=qt(t.h),r=qt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},ox=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=qt(t.h),r=qt(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},Pl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=qt(t.h),r=qt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},Rr=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},ax={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:ix},toMode:{rgb:sx},interpolate:{h:{use:he,fixup:Pr},s:he,l:he,alpha:{use:he,fixup:Lt}},difference:{h:Cl},average:{h:Rr}},Yr=({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=qt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Kr=({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},Tm=Math.pow(29,3)/Math.pow(3,3),Cm=Math.pow(6,3)/Math.pow(29,3),Nt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},ji={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let ac=t=>Math.pow(t,3)>Cm?Math.pow(t,3):(116*t-16)/Tm;const Pm=({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:ac(s)*ji.X,y:ac(i)*ji.Y,z:ac(o)*ji.Z};return r!==void 0&&(a.alpha=r),a},Rl=t=>xi(Pm(t)),lc=t=>t>Cm?Math.cbrt(t):(Tm*t+16)/116,Rm=({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=lc(t/ji.X),s=lc(e/ji.Y),o=lc(n/ji.Z),a={mode:"lab65",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Al=t=>{let e=Rm(Si(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Va=1,Am=1,lo=26/180*Math.PI,Za=Math.cos(lo),Wa=Math.sin(lo),Mm=100/Math.log(139/100),gu=({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*Va/Mm)-1)/.0039},s=(Math.exp(.0435*e*Am*Va)-1)/.075,o=s*Math.cos(n/180*Math.PI-lo),a=s*Math.sin(n/180*Math.PI-lo);return i.a=o*Za-a/.83*Wa,i.b=o*Wa+a/.83*Za,r!==void 0&&(i.alpha=r),i},mu=({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*Za+n*Wa,s=.83*(n*Za-e*Wa),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Mm/Va*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Am*Va)};return a.c&&(a.h=qt((Math.atan2(s,i)+lo)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},nh=t=>gu(Yr(t,"dlch")),rh=t=>Kr(mu(t),"dlab"),lx={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:nh,rgb:t=>Rl(nh(t))},fromMode:{lab65:rh,rgb:t=>rh(Al(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:Lt}}},cx={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:gu,dlab:t=>Kr(t,"dlab"),rgb:t=>Rl(gu(t))},fromMode:{lab65:mu,dlab:t=>Yr(t,"dlch"),rgb:t=>mu(Al(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:he,c:he,h:{use:he,fixup:Pr},alpha:{use:he,fixup:Lt}},difference:{h:Pl},average:{h:Rr}};function ux({h:t,s:e,i:n,alpha:r}){t=qt(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 dx({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 fx={mode:"hsi",toMode:{rgb:ux},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:dx},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Pr},s:he,i:he,alpha:{use:he,fixup:Lt}},difference:{h:Cl},average:{h:Rr}};function hx({h:t,s:e,l:n,alpha:r}){t=qt(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 px({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 gx=(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}},mx=new RegExp(`^hsla?\\(\\s*${LS}${as}${eo}${as}${eo}\\s*(?:,\\s*${pd}\\s*)?\\)$`),vx=t=>{let e=t.match(mx);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=gx(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 bx(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==te.None){if(r.type===te.Percentage)return;n.h=r.value}if(i.type!==te.None){if(i.type===te.Hue)return;n.s=i.value/100}if(s.type!==te.None){if(s.type===te.Hue)return;n.l=s.value/100}return o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const Nm={mode:"hsl",toMode:{rgb:hx},fromMode:{rgb:px},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[bx,vx],serialize:t=>`hsl(${t.h!==void 0?t.h:"none"} ${t.s!==void 0?t.s*100+"%":"none"} ${t.l!==void 0?t.l*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Pr},s:he,l:he,alpha:{use:he,fixup:Lt}},difference:{h:Cl},average:{h:Rr}};function Om({h:t,s:e,v:n,alpha:r}){t=qt(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 zm({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 Im={mode:"hsv",toMode:{rgb:Om},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:zm},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Pr},s:he,v:he,alpha:{use:he,fixup:Lt}},difference:{h:Cl},average:{h:Rr}};function _x({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 Om({h:t,s:n===1?1:1-e/(1-n),v:1-n,alpha:r})}function wx(t){let e=zm(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 yx(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==te.None){if(r.type===te.Percentage)return;n.h=r.value}if(i.type!==te.None){if(i.type===te.Hue)return;n.w=i.value/100}if(s.type!==te.None){if(s.type===te.Hue)return;n.b=s.value/100}return o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const Ex={mode:"hwb",toMode:{rgb:_x},fromMode:{rgb:wx},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[yx],serialize:t=>`hwb(${t.h!==void 0?t.h:"none"} ${t.w!==void 0?t.w*100+"%":"none"} ${t.b!==void 0?t.b*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Pr},w:he,b:he,alpha:{use:he,fixup:Lt}},difference:{h:ox},average:{h:Rr}},Lm=203,Ml=.1593017578125,Dm=78.84375,Nl=.8359375,Ol=18.8515625,zl=18.6875;function cc(t){if(t<0)return 0;const e=Math.pow(t,1/Dm);return 1e4*Math.pow(Math.max(0,e-Nl)/(Ol-zl*e),1/Ml)}function uc(t){if(t<0)return 0;const e=Math.pow(t/1e4,Ml);return Math.pow((Nl+Ol*e)/(1+zl*e),Dm)}const dc=t=>Math.max(t/Lm,0),ih=({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=cc(t+.008609037037932761*e+.11102962500302593*n),s=cc(t-.00860903703793275*e-.11102962500302599*n),o=cc(t+.5600313357106791*e-.32062717498731885*n),a={mode:"xyz65",x:dc(2.070152218389422*i-1.3263473389671556*s+.2066510476294051*o),y:dc(.3647385209748074*i+.680566024947227*s-.0453045459220346*o),z:dc(-.049747207535812*i-.0492609666966138*s+1.1880659249923042*o)};return r!==void 0&&(a.alpha=r),a},fc=(t=0)=>Math.max(t*Lm,0),sh=({x:t,y:e,z:n,alpha:r})=>{const i=fc(t),s=fc(e),o=fc(n),a=uc(.3592832590121217*i+.6976051147779502*s-.0358915932320289*o),l=uc(-.1920808463704995*i+1.1004767970374323*s+.0753748658519118*o),c=uc(.0070797844607477*i+.0748396662186366*s+.8433265453898765*o),u=.5*a+.5*l,d=1.61376953125*a-3.323486328125*l+1.709716796875*c,h=4.378173828125*a-4.24560546875*l-.132568359375*c,p={mode:"itp",i:u,t:d,p:h};return r!==void 0&&(p.alpha=r),p},kx={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:ih,rgb:t=>xi(ih(t))},fromMode:{xyz65:sh,rgb:t=>sh(Si(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:he,t:he,p:he,alpha:{use:he,fixup:Lt}}},Sx=134.03437499999998,xx=16295499532821565e-27,hc=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,Ml);return Math.pow((Nl+Ol*e)/(1+zl*e),Sx)},pc=(t=0)=>Math.max(t*203,0),Hm=({x:t,y:e,z:n,alpha:r})=>{t=pc(t),e=pc(e),n=pc(n);let i=1.15*t-.15*n,s=.66*e+.34*t,o=hc(.41478972*i+.579999*s+.014648*n),a=hc(-.20151*i+1.120649*s+.0531008*n),l=hc(-.0166008*i+.2648*s+.6684799*n),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-xx,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},Tx=134.03437499999998,oh=16295499532821565e-27,gc=t=>{if(t<0)return 0;let e=Math.pow(t,1/Tx);return 1e4*Math.pow((Nl-e)/(zl*e-Ol),1/Ml)},mc=t=>t/203,Bm=({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+oh)/(.44+.56*(t+oh)),s=gc(i+.13860504*e+.058047316*n),o=gc(i-.13860504*e-.058047316*n),a=gc(i-.096019242*e-.8118919*n),l={mode:"xyz65",x:mc(1.661373024652174*s-.914523081304348*o+.23136208173913045*a),y:mc(-.3250758611844533*s+1.571847026732543*o-.21825383453227928*a),z:mc(-.090982811*s-.31272829*o+1.5227666*a)};return r!==void 0&&(l.alpha=r),l},$m=t=>{let e=Hm(Si(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Um=t=>xi(Bm(t)),Cx={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:$m,xyz65:Hm},toMode:{rgb:Um,xyz65:Bm},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:he,a:he,b:he,alpha:{use:he,fixup:Lt}}},ah=({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=qt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},lh=({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},Px={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:lh,rgb:t=>Um(lh(t))},fromMode:{rgb:t=>ah($m(t)),jab:ah},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:he,fixup:Pr},c:he,j:he,alpha:{use:he,fixup:Lt}},difference:{h:Pl},average:{h:Rr}},Il=Math.pow(29,3)/Math.pow(3,3),gd=Math.pow(6,3)/Math.pow(29,3);let vc=t=>Math.pow(t,3)>gd?Math.pow(t,3):(116*t-16)/Il;const md=({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:vc(s)*Nt.X,y:vc(i)*Nt.Y,z:vc(o)*Nt.Z};return r!==void 0&&(a.alpha=r),a},Bo=({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=_s({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},jm=t=>Bo(md(t)),$o=t=>{let{r:e,g:n,b:r,alpha:i}=bs(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},bc=t=>t>gd?Math.cbrt(t):(Il*t+16)/116,vd=({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=bc(t/Nt.X),s=bc(e/Nt.Y),o=bc(n/Nt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Fm=t=>{let e=vd($o(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function Rx(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===te.Hue||i.type===te.Hue||s.type===te.Hue))return r.type!==te.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==te.None&&(n.a=i.type===te.Number?i.value:i.value*125/100),s.type!==te.None&&(n.b=s.type===te.Number?s.value:s.value*125/100),o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const bd={mode:"lab",toMode:{xyz50:md,rgb:jm},fromMode:{xyz50:vd,rgb:Fm},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[Rx],serialize:t=>`lab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:Lt}}},Ax={...bd,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Pm,rgb:Rl},fromMode:{xyz65:Rm,rgb:Al},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function Mx(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==te.None){if(r.type===te.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==te.None&&(n.c=Math.max(0,i.type===te.Number?i.value:i.value*150/100)),s.type!==te.None){if(s.type===te.Percentage)return;n.h=s.value}return o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const _d={mode:"lch",toMode:{lab:Kr,rgb:t=>jm(Kr(t))},fromMode:{rgb:t=>Yr(Fm(t)),lab:Yr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Mx],serialize:t=>`lch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Pr},c:he,l:he,alpha:{use:he,fixup:Lt}},difference:{h:Pl},average:{h:Rr}},Nx={..._d,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Kr(t,"lab65"),rgb:t=>Rl(Kr(t,"lab65"))},fromMode:{rgb:t=>Yr(Al(t),"lch65"),lab65:t=>Yr(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Gm=({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=qt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Vm=({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},Zm=(t,e,n)=>4*t/(t+15*e+3*n),Wm=(t,e,n)=>9*e/(t+15*e+3*n),Ox=Zm(Nt.X,Nt.Y,Nt.Z),zx=Wm(Nt.X,Nt.Y,Nt.Z),Ix=t=>t<=gd?Il*t:116*Math.cbrt(t)-16,vu=({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=Ix(e/Nt.Y),s=Zm(t,e,n),o=Wm(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-Ox),o=13*i*(o-zx));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},Lx=(t,e,n)=>4*t/(t+15*e+3*n),Dx=(t,e,n)=>9*e/(t+15*e+3*n),Hx=Lx(Nt.X,Nt.Y,Nt.Z),Bx=Dx(Nt.X,Nt.Y,Nt.Z),bu=({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)+Hx,s=n/(13*t)+Bx,o=Nt.Y*(t<=8?t/Il: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},$x=t=>Gm(vu($o(t))),Ux=t=>Bo(bu(Vm(t))),jx={mode:"lchuv",toMode:{luv:Vm,rgb:Ux},fromMode:{rgb:$x,luv:Gm},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:he,fixup:Pr},c:he,l:he,alpha:{use:he,fixup:Lt}},difference:{h:Pl},average:{h:Rr}},Fx={...vs,mode:"lrgb",toMode:{rgb:_s},fromMode:{rgb:bs},parse:["srgb-linear"],serialize:"srgb-linear"},Gx={mode:"luv",toMode:{xyz50:bu,rgb:t=>Bo(bu(t))},fromMode:{xyz50:vu,rgb:t=>vu($o(t))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:he,u:he,v:he,alpha:{use:he,fixup:Lt}}},qm=({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},Ll=t=>{let e=qm(bs(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Uo=({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},Dl=t=>_s(Uo(t));function _u(t){const r=1.170873786407767;return .5*(r*t-.206+Math.sqrt((r*t-.206)*(r*t-.206)+4*.03*r*t))}function qa(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function Vx(t,e){let n,r,i,s,o,a,l,c;-1.88170328*t-.80936493*e>1?(n=1.19086277,r=1.76576728,i=.59662641,s=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*t-1.19445276*e>1?(n=.73956515,r=-.45954404,i=.08285427,s=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(n=1.35733652,r=-.00915799,i=-1.1513021,s=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=n+r*t+i*e+s*t*t+o*t*e,d=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let g=1+u*d,m=1+u*h,b=1+u*p,E=g*g*g,M=m*m*m,z=b*b*b,R=3*d*g*g,A=3*h*m*m,x=3*p*b*b,N=6*d*d*g,O=6*h*h*m,j=6*p*p*b,B=a*E+l*M+c*z,J=a*R+l*A+c*x,W=a*N+l*O+c*j;u=u-B*J/(J*J-.5*B*W)}return u}function wd(t,e){let n=Vx(t,e),r=Uo({l:1,a:n*t,b:n*e}),i=Math.cbrt(1/Math.max(r.r,r.g,r.b)),s=i*n;return[i,s]}function Zx(t,e,n,r,i,s=null){s||(s=wd(t,e));let o;if((n-i)*s[1]-(s[0]-i)*r<=0)o=s[1]*i/(r*s[0]+s[1]*(i-n));else{o=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));{let a=n-i,l=r,c=.3963377774*t+.2158037573*e,u=-.1055613458*t-.0638541728*e,d=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,g=a+l*d;{let m=i*(1-o)+o*n,b=o*r,E=m+b*c,M=m+b*u,z=m+b*d,R=E*E*E,A=M*M*M,x=z*z*z,N=3*h*E*E,O=3*p*M*M,j=3*g*z*z,B=6*h*h*E,J=6*p*p*M,W=6*g*g*z,H=4.0767416621*R-3.3077115913*A+.2309699292*x-1,ee=4.0767416621*N-3.3077115913*O+.2309699292*j,oe=4.0767416621*B-3.3077115913*J+.2309699292*W,q=ee/(ee*ee-.5*H*oe),K=-H*q,ne=-1.2684380046*R+2.6097574011*A-.3413193965*x-1,le=-1.2684380046*N+2.6097574011*O-.3413193965*j,se=-1.2684380046*B+2.6097574011*J-.3413193965*W,ue=le/(le*le-.5*ne*se),De=-ne*ue,Ye=-.0041960863*R-.7034186147*A+1.707614701*x-1,je=-.0041960863*N-.7034186147*O+1.707614701*j,Je=-.0041960863*B-.7034186147*J+1.707614701*W,ce=je/(je*je-.5*Ye*Je),ae=-Ye*ce;K=q>=0?K:1e6,De=ue>=0?De:1e6,ae=ce>=0?ae:1e6,o+=Math.min(K,Math.min(De,ae))}}}return o}function yd(t,e,n=null){n||(n=wd(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function Xm(t,e,n){let r=wd(e,n),i=Zx(e,n,t,1,t,r),s=yd(e,n,r),o=.11516993+1/(7.4477897+4.1590124*n+e*(-2.19557347+1.75198401*n+e*(-2.13704948-10.02301043*n+e*(-4.24894561+5.38770819*n+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*n+e*(.40370612+.90148123*n+e*(-.27087943+.6122399*n+e*(.00299215-.45399568*n-.14661872*e)))),l=i/Math.min(t*s[0],(1-t)*s[1]),c=t*o,u=(1-t)*a,d=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=t*.4,u=(1-t)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),d,i]}function ch(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:_u(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]=Xm(e,n/s,r/s),c;if(s<a){let u=0,d=.8*o,h=1-d/a;c=(s-u)/(d+h*(s-u))*.8}else{let u=a,d=.2*a*a*1.25*1.25/o,h=1-d/(l-a);c=.8+.2*((s-u)/(d+h*(s-u)))}return c&&(i.s=c,i.h=qt(Math.atan2(r,n)*180/Math.PI)),i}function uh(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:qa(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]=Xm(i.l,s,o),u,d,h,p;n<.8?(u=1.25*n,d=0,h=.8*a,p=1-h/l):(u=5*(n-.8),d=l,h=.2*l*l*1.25*1.25/a,p=1-h/(c-l));let g=d+u*h/(1-p*u);return i.a=g*s,i.b=g*o,i}const Wx={...Nm,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:ch,rgb:t=>ch(Ll(t))},toMode:{oklab:uh,rgb:t=>Dl(uh(t))}};function dh(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]=yd(s,o),c=.5,u=1-c/a,d=l/(i+e*l),h=d*e,p=d*i,g=qa(h),m=p*g/h,b=Uo({l:g,a:s*m,b:o*m}),E=Math.cbrt(1/Math.max(b.r,b.g,b.b,0));e=e/E,i=i/E*_u(e)/e,e=_u(e);const M={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return M.s&&(M.h=qt(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(M.alpha=t.alpha),M}function fh(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]=yd(s,o),c=.5,u=1-c/a,d=1-r*c/(c+l-l*u*r),h=r*l*c/(c+l-l*u*r),p=qa(d),g=h*p/d,m=Uo({l:p,a:s*g,b:o*g}),b=Math.cbrt(1/Math.max(m.r,m.g,m.b,0)),E=qa(i*d),M=h*E/d;return e.l=E*b,e.a=M*s*b,e.b=M*o*b,e}const qx={...Im,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:dh,rgb:t=>dh(Ll(t))},toMode:{oklab:fh,rgb:t=>Dl(fh(t))}};function Xx(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===te.Hue||i.type===te.Hue||s.type===te.Hue))return r.type!==te.None&&(n.l=Math.min(Math.max(0,r.type===te.Number?r.value:r.value/100),1)),i.type!==te.None&&(n.a=i.type===te.Number?i.value:i.value*.4/100),s.type!==te.None&&(n.b=s.type===te.Number?s.value:s.value*.4/100),o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const Yx={...bd,mode:"oklab",toMode:{lrgb:Uo,rgb:Dl},fromMode:{lrgb:qm,rgb:Ll},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Xx],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 Kx(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==te.None){if(r.type===te.Hue)return;n.l=Math.min(Math.max(0,r.type===te.Number?r.value:r.value/100),1)}if(i.type!==te.None&&(n.c=Math.max(0,i.type===te.Number?i.value:i.value*.4/100)),s.type!==te.None){if(s.type===te.Percentage)return;n.h=s.value}return o.type!==te.None&&(n.alpha=Math.min(1,Math.max(0,o.type===te.Number?o.value:o.value/100))),n}const Jx={..._d,mode:"oklch",toMode:{oklab:t=>Kr(t,"oklab"),rgb:t=>Dl(Kr(t,"oklab"))},fromMode:{rgb:t=>Yr(Ll(t),"oklch"),oklab:t=>Yr(t,"oklch")},parse:[Kx],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]}},hh=t=>{let{r:e,g:n,b:r,alpha:i}=bs(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},ph=({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=_s({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},Qx={...vs,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>ph(Si(t)),xyz65:ph},toMode:{rgb:t=>xi(hh(t)),xyz65:hh}},_c=t=>{let e=Math.abs(t);return e>=1/512?Math.sign(t)*Math.pow(e,1/1.8):16*t},gh=({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:_c(t*1.3457868816471585-e*.2555720873797946-.0511018649755453*n),g:_c(t*-.5446307051249019+e*1.5082477428451466+.0205274474364214*n),b:_c(t*0+e*0+1.2119675456389452*n)};return r!==void 0&&(i.alpha=r),i},wc=(t=0)=>{let e=Math.abs(t);return e>=16/512?Math.sign(t)*Math.pow(e,1.8):t/16},mh=t=>{let e=wc(t.r),n=wc(t.g),r=wc(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},e2={...vs,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:gh,rgb:t=>gh($o(t))},toMode:{xyz50:mh,rgb:t=>Bo(mh(t))}},vh=1.09929682680944,t2=.018053968510807,yc=t=>{const e=Math.abs(t);return e>t2?(Math.sign(t)||1)*(vh*Math.pow(e,.45)-(vh-1)):4.5*t},bh=({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:yc(t*1.7166511879712683-e*.3556707837763925-.2533662813736599*n),g:yc(t*-.6666843518324893+e*1.6164812366349395+.0157685458139111*n),b:yc(t*.0176398574453108-e*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(i.alpha=r),i},_h=1.09929682680944,n2=.018053968510807,Ec=(t=0)=>{let e=Math.abs(t);return e<n2*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+_h-1)/_h,1/.45)},wh=t=>{let e=Ec(t.r),n=Ec(t.g),r=Ec(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},r2={...vs,mode:"rec2020",fromMode:{xyz65:bh,rgb:t=>bh(Si(t))},toMode:{xyz65:wh,rgb:t=>xi(wh(t))},parse:["rec2020"],serialize:"rec2020"},_i=.0037930732552754493,Ym=Math.cbrt(_i),kc=t=>Math.cbrt(t)-Ym,i2=t=>{const{r:e,g:n,b:r,alpha:i}=bs(t),s=kc(.3*e+.622*n+.078*r+_i),o=kc(.23*e+.692*n+.078*r+_i),a=kc(.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},Sc=t=>Math.pow(t+Ym,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=Sc(t+e)-_i,s=Sc(e-t)-_i,o=Sc(n+e)-_i,a=_s({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},o2={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:s2},fromMode:{rgb:i2},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:he,y:he,b:he,alpha:{use:he,fixup:Lt}}},a2={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:Bo,lab:vd},fromMode:{rgb:$o,lab:md},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:Lt}}},l2=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},u2={mode:"xyz65",toMode:{rgb:xi,xyz50:l2},fromMode:{rgb:Si,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:he,y:he,z:he,alpha:{use:he,fixup:Lt}}},d2=({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},f2=({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},h2={mode:"yiq",toMode:{rgb:f2},fromMode:{rgb:d2},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:he,i:he,q:he,alpha:{use:he,fixup:Lt}}},p2=t=>Math.max(0,Math.min(1,t||0)),xc=t=>Math.round(p2(t)*255),g2=Xr("rgb"),m2=t=>{if(t===void 0)return;let e=xc(t.r),n=xc(t.g),r=xc(t.b);return"#"+(1<<24|e<<16|n<<8|r).toString(16).slice(1)},v2=t=>m2(g2(t)),Km=Xr("rgb"),Jm=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},b2=t=>Jm(Km(t)),Qm=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 _2(t){return Qm(Km(t))}function ev(t="rgb"){const{gamut:e}=Tl(t);if(!e)return r=>!0;const n=Xr(typeof e=="string"?e:t);return r=>Qm(n(r))}function w2(t="rgb"){const{gamut:e}=Tl(t);if(!e)return s=>ja(s);const n=typeof e=="string"?e:t,r=Xr(n),i=ev(n);return s=>{const o=ja(s);if(!o)return;const a=r(o);if(i(a))return o;const l=Jm(a);return o.mode===l.mode?l:Xr(o.mode)(l)}}function y2(t,e="lch",n="rgb"){t=ja(t);let r=n==="rgb"?_2:ev(n),i=n==="rgb"?b2:w2(n);if(t===void 0||r(t))return t;let s=Xr(t.mode);t=Xr(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=Tl(e).ranges.c,u=(c[1]-c[0])/Math.pow(2,13),d=o.c;for(;l-a>u;)o.c=a+(l-a)*.5,r(o)?(d=o.c,a=o.c):l=o.c;return s(r(o)?o:{...o,c:d})}nt(ex);nt(ax);nt(lx);nt(cx);nt(fx);nt(Nm);nt(Im);nt(Ex);nt(kx);nt(Cx);nt(Px);nt(bd);nt(Ax);nt(_d);nt(Nx);nt(jx);nt(Fx);nt(Gx);nt(Wx);nt(qx);nt(Yx);const E2=nt(Jx);nt(Qx);nt(e2);nt(r2);nt(vs);nt(o2);nt(a2);nt(u2);nt(h2);function Fs(t,e,n){const r=y2({mode:"oklch",l:t,c:e,h:n},"oklch");return v2(r??{mode:"oklch",l:t,c:0,h:n})}function tv(t){const e=E2(t);return e?{l:e.l,c:e.c,h:e.h??0}:{l:0,c:0,h:0}}function k2(t,e){const{l:n,c:r,h:i}=tv(t);return Fs(Math.min(1,Math.max(0,n+e)),r,i)}function S2(t){const{hue:e,chroma:n,bgHex:r,target:i}=t,s=.01;let o=t.l;const a=Qs(Fs(1,0,e),r),l=Qs(Fs(0,0,e),r),c=a>=l?s:-s;let u=Fs(o,n,e);for(;Qs(u,r)<i&&o>0&&o<1;)o=Math.min(1,Math.max(0,o+c)),u=Fs(o,n,e);return u}function x2(t,e,n){const{l:r,c:i,h:s}=tv(t);return S2({hue:s,chroma:i,l:r,bgHex:e,target:n})}const T2={dark:.12,light:-.12};function C2(t,e,n){const r=k2(t,T2[n]);return Qs(r,e)>=4.5?r:x2(r,e,4.5)}const xa=["dark","light"],wu=hd.map(t=>t.token),P2=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function nv(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R2(t,e,n){if(!nv(t))return n.push(`"${e}" must be an object of palette colour tokens.`),!1;let r=!0;for(const i of wu){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}P2.test(s)||(n.push(`"${e}.${i}" must be a hex colour like #1a2b3c, got "${s}".`),r=!1)}for(const i of Object.keys(t))wu.includes(i)||(n.push(`"${e}" has an unknown token "${i}".`),r=!1);return r}function A2(t){const e=[];for(const n of xa)for(const r of AS){const i=Qs(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 rv(t){const e=[];if(!nv(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 xa){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}R2(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))xa.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 xa){const s=t[i];for(const o of wu)o==="controlHover"&&s[o]===void 0?r[i].controlHover=C2(s.surface,s.text,i):r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:A2(r)}}const M2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),iv=Ue({permission:wm,reason:de().min(1),prerequisite:de().min(1).optional()}),Ed=Zt().int().nonnegative().nullable(),N2=Ue({kind:Jt(["exec","service"]),state:Rt("blocked"),retryAfterSeconds:Ed,blockers:bt(iv).min(1)}),O2=Ue({kind:Jt(["exec","service"]),state:Rt("incompatible"),retryAfterSeconds:Ed,requiredProtocol:Zt().int(),supportedProtocols:bt(Zt().int())}),z2=Ue({kind:Jt(["exec","service"]),state:Jt(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:Ed}),I2=t=>{if(!M2(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},L2=Ik(I2,ud("state",[N2,O2,z2]));class qn extends Error{constructor(n,r,i){super(n);F(this,"id");F(this,"code");this.name="BackendError",this.code=r,this.id=i}}class yu extends qn{constructor(n){super(`Unknown backend binding id: "${n}"`,"UNKNOWN_ID",n);F(this,"code","UNKNOWN_ID");this.name="BackendUnknownId"}}class sv extends qn{constructor(n){super(`Backend "${n}" is not approved`,"NOT_APPROVED",n);F(this,"code","NOT_APPROVED");this.name="BackendNotApproved"}}class ov extends qn{constructor(n){super(`Backend "${n}" is disabled`,"DISABLED",n);F(this,"code","DISABLED");this.name="BackendDisabled"}}class yh extends qn{constructor(n,r){super(`Backend route "${n}" is not an ${r} route`,"TRANSPORT_MISMATCH",n);F(this,"code","TRANSPORT_MISMATCH");this.expected=r,this.name="BackendTransportMismatch"}}class D2 extends qn{constructor(n,r){super(`Backend "${n}" is starting`,"BACKEND_STARTING",n);F(this,"code","BACKEND_STARTING");F(this,"daemonCode","BACKEND_STARTING");this.retryAfterSeconds=r,this.name="BackendStarting"}}class H2 extends qn{constructor(n){super(`Backend "${n}" is unavailable`,"BACKEND_UNAVAILABLE",n);F(this,"code","BACKEND_UNAVAILABLE");F(this,"daemonCode","BACKEND_UNAVAILABLE");this.name="BackendUnavailable"}}class B2 extends qn{constructor(n){super(`Backend "${n}" is incompatible`,"BACKEND_INCOMPATIBLE",n);F(this,"code","BACKEND_INCOMPATIBLE");F(this,"daemonCode","BACKEND_INCOMPATIBLE");this.name="BackendIncompatible"}}class $2 extends qn{constructor(n,r){super(`Backend "${n}" is under maintenance`,"BACKEND_MAINTENANCE",n);F(this,"code","BACKEND_MAINTENANCE");F(this,"daemonCode","BACKEND_MAINTENANCE");this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class U2 extends qn{constructor(n,r,i){super(`Backend "${n}" is blocked on an unmet activation prerequisite`,"BACKEND_BLOCKED",n);F(this,"code","BACKEND_BLOCKED");F(this,"daemonCode","BACKEND_BLOCKED");this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class j2 extends qn{constructor(n){super(`Backend "${n}" returned a bad gateway response`,"BAD_GATEWAY",n);F(this,"code","BAD_GATEWAY");F(this,"daemonCode","BAD_GATEWAY");this.name="BackendBadGateway"}}class Tc extends qn{constructor(n,r){super(r,"STATUS_QUERY_FAILED");F(this,"code","STATUS_QUERY_FAILED");this.httpStatus=n,this.name="BackendStatusQueryError"}}const Cc=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},F2=t=>{const e=bt(iv).safeParse(t);return e.success?e.data:[]},G2={DISABLED:t=>new ov(t),NOT_APPROVED:t=>new sv(t),ROUTE_NOT_FOUND:t=>new yu(t),BACKEND_STARTING:(t,e)=>new D2(t,Cc(e)),BACKEND_UNAVAILABLE:t=>new H2(t),BACKEND_INCOMPATIBLE:t=>new B2(t),BACKEND_MAINTENANCE:(t,e)=>new $2(t,Cc(e)),BACKEND_BLOCKED:(t,e,n)=>new U2(t,F2(n.detail),Cc(e)),BAD_GATEWAY:t=>new j2(t)},V2=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}`:""},Z2=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),W2=t=>t.startsWith("https:")?"wss:":"ws:",Eh=(t,e)=>t.enabled?t.approval!=="approved"?new sv(e):null:new ov(e),q2=async(t,e)=>{if(e.ok)return e;let n;try{n=(await e.clone().json()).error}catch{return e}const r=n!=null&&n.code?G2[n.code]:void 0;if(!r||!n)return e;throw r(t,e,n)},X2=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${V2(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&&(Z2(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 q2(n,a)};function Y2(t,e,n={}){const r={pluginName:t,descriptor:e,fetchImpl:n.fetch??globalThis.fetch.bind(globalThis),WebSocketCtor:n.WebSocketCtor??globalThis.WebSocket,origin:n.origin??(typeof location<"u"?location.origin:"http://localhost")};return{fetch(i,s={}){const o=e.routes[i];if(!o)throw new yu(i);if(o.transport!=="http"||!o.method)throw new yh(i,"http");const a=Eh(e,i);return a?Promise.reject(a):X2(r,o,i,s)},socket(i,s={}){const o=e.routes[i];if(!o)throw new yu(i);if(o.transport!=="websocket")throw new yh(i,"websocket");const a=Eh(e,i);if(a)throw a;const l=`${W2(r.origin)}//${r.origin.replace(/^[a-z]+:\/\//,"")}/ws/plugins/${r.pluginName}/${o.path}`,c=s.protocols??o.protocols;return new r.WebSocketCtor(l,c)},status(i={}){const s=`${r.origin}/api/plugins/${r.pluginName}/_mndw/status`;return r.fetchImpl(s,{method:"GET",signal:i.signal}).then(async o=>{if(!o.ok)throw new Tc(o.status,`Backend status query failed with HTTP ${o.status}`);try{return L2.parse(await o.json())}catch(a){throw a instanceof Tc?a:new Tc(o.status,"Backend status response is invalid")}})}}}class kh extends Error{constructor(n,r){super(r);F(this,"status");this.name="TelemetryError",this.status=n}}const Zr=t=>typeof t=="number"&&Number.isFinite(t),K2=["unanchored","anchored","suspect"],J2=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"||!K2.includes(n))throw new Error("telemetry clock state is invalid");if(r!==null&&(!Zr(r)||!Number.isInteger(r)||r<0))throw new Error("telemetry clock historyEndMs must be a non-negative integer or null");if(typeof i!="boolean"||typeof s!="boolean")throw new Error("telemetry clock flags must be booleans");if(r===null&&i)throw new Error("telemetry clock cannot be current without history");return{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}},Q2=new Set(["accent","success","warning","muted"]),eT=t=>{if(typeof t!="string"||!Q2.has(t))throw new Error(`invalid projected chart color: ${String(t)}`);return t},Sh=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!Zr(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!Zr(n.value))throw new Error(`projected point value in ${e} must be finite or null`);return{time:n.time,value:n.value===null?Number.NaN:n.value}},tT=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected band point in ${e} is invalid`);const n=t;if(!Zr(n.time)||!Zr(n.min)||!Zr(n.max))throw new Error(`projected band point in ${e} is invalid`);return{time:n.time,min:n.min,max:n.max}},nT=(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=>Sh(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=>Sh(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=>tT(c,t)),color:eT(l.color)}});let o;if(n.valueDomain!==void 0&&n.valueDomain!==null){if(typeof n.valueDomain!="object"||Array.isArray(n.valueDomain))throw new Error(`projected series ${t} valueDomain is invalid`);const a=n.valueDomain;if(!Zr(a.min)||!Zr(a.max))throw new Error(`projected series ${t} valueDomain is invalid`);o={min:a.min,max:a.max}}return{label:typeof n.label=="string"?n.label:void 0,supported:n.supported,unit:n.unit,points:r,segments:i,bands:s,valueDomain:o}},rT=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]=nT(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:J2(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},iT=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function sT(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 kh(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw iT(o)?o:new kh(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,rT,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const oT={loading:"Loading…",error:"Something went wrong."},aT={"toggle-menu":"Toggle menu",close:"Close navigation",dashboard:"Dashboard","package-manager":"Entware",plugins:"Plugins",settings:"Settings","light-theme":"Switch to light theme","dark-theme":"Switch to dark theme","color-theme":"Toggle color theme",language:"Language","language-english":"Switch to English","language-russian":"Switch to Russian",logout:"Logout"},lT={"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"},cT={title:"Settings","general-tab":"General","diagnostics-tab":"Diagnostics","plugins-tab":"Plugins","self-update-tab":"System update","self-update-description":"Check for and safely install a new mndw package, or restore the previous package.","self-update-current":"Running version: {version}","self-update-rollback":"Rollback version: {version}","self-update-available":"Update available: {version}","self-update-check":"Check for updates","self-update-apply":"Apply update","self-update-revert":"Revert","self-update-confirm-update-title":"Confirm update","self-update-confirm-revert-title":"Confirm revert","self-update-confirm-update":"Install update to {version}? mndw will restart.","self-update-confirm-revert":"Revert to {version}? mndw will restart.","self-update-progress-title":"System update","self-update-checking":"Checking…","self-update-preparing":"Preparing update…","self-update-updating":"Updating to {version}…","self-update-reverting":"Reverting to {version}…","self-update-success":"Update complete. Running version: {version}","self-update-busy":"Package manager is busy. Try again shortly.","self-update-no-update":"No update is available. Check again later.","self-update-rollback-unavailable":"No rollback is available.","self-update-unconfirmed":"Update started, but its final state could not be confirmed. Check again.","self-update-unconfirmed-modal":"Unable to confirm self-update completion. Check status again after closing this dialog.","self-update-failure-generic":"Self-update failed. Check again or retry later.","self-update-failure-update-missing":"Update package was not found.","self-update-failure-opkg-install-failed":"Update package installation failed.","self-update-failure-opkg-revert-failed":"Rollback package installation failed.","self-update-failure-rollback-missing":"Rollback package was not found.","self-update-failure-helper-exited":"Update helper stopped before completion.","self-update-failure-unexpected-version":"Device version changed unexpectedly during update.","self-update-failure-state-corrupt":"Self-update state is corrupted. Check again.",general:"General",language:{label:"Language",english:"English",russian:"Русский",pending:"Applying language…"},appearance:"Appearance","dark-theme":"Dark theme",device:"Device","telemetry-label":"Background telemetry","telemetry-toggle":"Enable telemetry","telemetry-description":"Store CPU, memory, and temperature history for 30 days.","telemetry-session-note":"A configured persistent RCI session is required for CPU and memory telemetry.","telemetry-wear-note":"Telemetry collection will increase the load on the storage device where Entware is installed and may accelerate its wear.","telemetry-error":"Could not update background telemetry.",name:"Name:",vendor:"Vendor:",firmware:"Firmware:","device-unavailable":"Device info unavailable.","persistent-rci-title":"Persistent RCI session","persistent-rci-description":"Keep RCI access in mndwd for permitted plugins. Tokens never leave mndwd.","configure-persistent":"Configure persistent controller session","persistent-tokenless-toggle":"Persistent session with controller and extenders","persistent-tokenless-description":"mndwd keeps RCI sessions to this controller and eligible extenders for permitted plugins. No token is required on this firmware.","persistent-needs-token":"Firmware was updated and now requires a controller token. Enter a token to resume the persistent session.","persistent-storage-disabled":"Persistent session storage is disabled.","persistent-storage-decrypt-failed":"Persistent session storage could not be decrypted.","controller-token":"Controller token",test:"Test",save:"Save","clear-controller-session":"Clear controller session","update-firmware-persistent":"Update device firmware to enable persistent RCI sessions.","controller-result":"Controller: {result}","persistent-extenders-title":"Persistent extenders session","persistent-enumeration-stale":"Mesh membership is temporarily stale; live sessions are still monitored.","extender-reason-certificate-invalid":"certificate is invalid","extender-reason-no-auth-token":"auth-token capability unavailable","extender-reason-missing-fqdn":"secure relay name unavailable","extender-state-offline":"offline","extender-state-establishing":"coming online","extender-state-live":"connected","extender-state-dead":"reconnecting","persistent-state-unavailable":"Persistent RCI session state unavailable","persistent-request-failed":"Persistent RCI session request failed","controller-token-rejected":"Controller token rejected","firmware-unsupported":"Device firmware does not support persistent RCI sessions","device-unreachable":"Device unreachable","palette-import-aria-label":"Import palette JSON","backend-capacity":"Backend capacity","backend-approval-title":"Approve backend for {label}","backend-approval-declaration":"declares a backend. Review its capabilities before approving.","backend-approval-deny":"Deny","backend-approval-approve":"Approve","upload-plugin-zip":"Upload plugin ZIP","diagnostics-description":"Download recent daemon and plugin runtime state for troubleshooting.","download-diagnostics":"Download diagnostics",downloading:"Downloading…","diagnostics-failed":"Diagnostics download failed","plugin-manager":{title:"Plugin manager","reload-notice":"Reload to apply plugin changes.","reload-now":"Reload now",later:"Later",loading:"Loading plugins...",retry:"Retry",dismiss:"Dismiss",exec:"Exec",services:"Services","per-plugin-exec-limit":"Per-plugin exec limit","service-protocols":"Service protocols","runtime-status-unavailable":"Runtime status unavailable: {error}","maintenance-busy":"Plugin is busy with another maintenance operation. Try again shortly.","confirming-state":"Confirming plugin state…","operation-finishing":"Plugin operation is still finishing. Refresh to check again.","outcome-unknown":"Could not confirm restart outcome. Refresh to check plugin status.","installed-title":"Installed plugins","no-installed":"No plugins installed.",version:"Version",type:"Type",source:"Source",builtin:"Built-in","installing-dependencies":"Installing dependencies…","dependency-install-failed":"Dependency install failed","version-mismatch":"Version mismatch","load-version-warning":"Built against {versions}. Plugin still loads, but may misbehave with this host.","version-warning":{title:"Version compatibility","sdk-major":"Built for @mndw/sdk {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","sdk-newer-minor":"Built for a newer @mndw/sdk ({pluginVersion}) than this dashboard provides ({hostVersion}). Some features may not work.","shared-major":"Built for {name} {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","install-anyway":"You can still install it."},"endpoint-one":"{count} endpoint","endpoint-many":"{count} endpoints","websocket-one":"{count} websocket","websocket-many":"{count} websockets","persistent-rci-read":"Persistent RCI read","persistent-rci-write":"Persistent RCI write",refresh:"Refresh",enable:"Enable",disable:"Disable","restart-backend":"Restart backend","delete-confirmation":"Delete {label}? This cannot be undone.",cancel:"Cancel","delete-plugin":"Delete plugin",delete:"Delete",backend:"Backend",protocol:"Protocol",incompatible:"incompatible","supported-service-protocols":"Supported service protocols","runtime-state-stopped":"stopped","runtime-state-capacity-blocked":"capacity blocked","runtime-state-starting":"starting","runtime-state-ready":"ready","runtime-state-backoff":"backing off","runtime-state-failed":"failed","pending-title":"Pending approvals","deny-confirmation":"Deny {label}? This cannot be undone.","deny-plugin":"Deny plugin",deny:"Deny",approve:"Approve",routes:"Routes","backend-kind-service":"Runs a resident background process as root","backend-kind-exec":"Runs commands as root on each request",packages:"Installs packages","service-args":"Service arguments","public-routes":"Public routes (reachable from the LAN without sign-in)",permissions:"Permissions","upload-trust-warning":"A plugin gets full administrator access to this router. Install plugins only from authors you trust.","upload-drop":"Drop a plugin ZIP here or choose a file.",uploading:"Uploading plugin...","waiting-approval":"Waiting for approval...","installed-success":'Installed "{label}".',"approved-success":'Approved "{label}".',"choose-zip":"Choose a ZIP file.","empty-zip":"The ZIP file is empty.","zip-too-large":"The ZIP file exceeds the 10 MB upload limit.","upload-target-mismatch":"{filename} targets {archiveTarget}, but this device reports {deviceTarget}. Choose the matching archive."}},uT={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry"},dT={username:"Username",password:"Password",submit:"Login","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},fT={region:"Notifications",dismiss:"Dismiss"},hT={tab:"Packages",title:"Package Manager",refresh:"Refresh Metadata",reload:"Reload",search:"Search packages…",all:"All",installed:"Installed",updates:"Updates ({count})",selected:"({count} selected)","with-selected":"With selected:",install:"Install",remove:"Remove",update:"Update",installing:"Installing…",removing:"Removing…",updating:"Updating…","action-failed":"{action} failed","update-available":"Update available",available:"Available","select-package":"Select {name}","select-all":"Select all filtered packages",loading:"Loading…","load-failed":"Failed to load packages",empty:"No packages found","no-match":"No packages match your filter",package:"Package",version:"Version",status:"Status",description:"Description",expand:"Expand {name}",collapse:"Collapse {name}",loaded:"{count} packages loaded","never-refreshed":"Metadata never refreshed","refreshed-ago":"Metadata refreshed {minutes} min ago","detail-failed":"Failed to load package details",size:"Feed size","installed-size":"Installed size","installed-time":"Installed time",dependencies:"Dependencies","confirm-remove-title":"Confirm package removal","confirm-remove":"Remove {names}?",protected:"Protected package","dependency-conflict":"Can't remove {package}: it is required by {dependents}.","dependency-conflict-generic":"Can't remove {package}: it is required by other installed packages."},pT={tab:"Services",title:"Services",description:"Inspect and control device init services.",refresh:"Refresh states",service:"Service",state:"State",autostart:"Autostart",actions:"Actions",start:"Start",stop:"Stop",restart:"Restart",enabled:"Enabled",disabled:"Disabled","enable-at-boot":"Enable at boot","disable-at-boot":"Disable at boot",pid:"PID {pid}","autostart-pinned":"Autostart is fixed by ENABLED= in the script","probe-failed":"Unknown",empty:"No services found","load-failed":"Failed to load services",unavailable:"No service manager available","unavailable-description":"This device does not expose an init service directory.",protected:"Protected service","confirm-title":"Confirm service action",confirm:"{action} service {name}?","confirm-enable-boot":"Enable {name} at boot? The running service is unchanged until reboot.","confirm-disable-boot":"Disable {name} at boot? The running service is unchanged until reboot."},gT={"device-timeout":"The device did not respond.","invalid-manifest":"The plugin manifest is invalid.","invalid-zip":"The file is not a valid ZIP archive.","manifest-missing":"The archive has no manifest.json at its root.","unsupported-manifest-version":"This plugin manifest version is no longer supported.",conflict:"A plugin with that name already exists.","upload-too-large":"The plugin exceeds the 10 MB upload limit.","opkg-failed":"Installing the plugin's system packages failed.","daemon-failed":"Starting the plugin's backend failed.",unauthorized:"Your session has expired. Please log in again.","service-capacity":"No service capacity is available. Stop another backend and try again.","backend-busy":"The backend is busy. Try again shortly.","backend-unavailable":"The backend is unavailable.","backend-incompatible":"This backend requires an unsupported protocol version.","backend-maintenance":"The backend is being updated. Try again shortly.","controller-session-unavailable":"Controller token session is unavailable.","rci-socket-start-failed":"Persistent RCI session socket could not start. Try again."},av={app:oT,nav:aT,dashboard:lT,settings:cT,common:uT,login:dT,toast:fT,packages:hT,services:pT,errors:gT},mT={loading:"Загрузка…",error:"Произошла ошибка."},vT={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Панель управления","package-manager":"Entware",plugins:"Плагины",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},bT={"add-widget":"+ Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости"},_T={title:"Настройки","general-tab":"Общие","diagnostics-tab":"Диагностика","plugins-tab":"Плагины","self-update-tab":"Обновление системы","self-update-description":"Проверяйте и безопасно устанавливайте новую версию mndw или восстанавливайте предыдущую.","self-update-current":"Текущая версия: {version}","self-update-rollback":"Версия для отката: {version}","self-update-available":"Доступно обновление: {version}","self-update-check":"Проверить обновления","self-update-apply":"Установить обновление","self-update-revert":"Откатить","self-update-confirm-update-title":"Подтвердите обновление","self-update-confirm-revert-title":"Подтвердите откат","self-update-confirm-update":"Установить обновление до версии {version}? mndw будет перезапущен.","self-update-confirm-revert":"Откатить до версии {version}? mndw будет перезапущен.","self-update-progress-title":"Обновление системы","self-update-checking":"Проверка…","self-update-preparing":"Подготовка обновления…","self-update-updating":"Обновление до {version}…","self-update-reverting":"Откат до {version}…","self-update-success":"Обновление завершено. Текущая версия: {version}","self-update-busy":"Менеджер пакетов занят. Повторите попытку позже.","self-update-no-update":"Обновление недоступно. Повторите проверку позже.","self-update-rollback-unavailable":"Откат недоступен.","self-update-unconfirmed":"Обновление запущено, но результат не подтверждён. Проверьте состояние ещё раз.","self-update-unconfirmed-modal":"Не удалось подтвердить завершение обновления. Закройте диалог и проверьте состояние ещё раз.","self-update-failure-generic":"Не удалось обновить систему. Повторите попытку позже.","self-update-failure-update-missing":"Пакет обновления не найден.","self-update-failure-opkg-install-failed":"Не удалось установить пакет обновления.","self-update-failure-opkg-revert-failed":"Не удалось установить пакет отката.","self-update-failure-rollback-missing":"Пакет отката не найден.","self-update-failure-helper-exited":"Помощник обновления завершился раньше времени.","self-update-failure-unexpected-version":"Версия устройства неожиданно изменилась во время обновления.","self-update-failure-state-corrupt":"Состояние обновления повреждено. Выполните проверку снова.",general:"Общие",language:{label:"Язык",english:"English",russian:"Русский",pending:"Применение языка…"},appearance:"Внешний вид","dark-theme":"Тёмная тема",device:"Устройство","telemetry-label":"Фоновая телеметрия","telemetry-toggle":"Включить телеметрию","telemetry-description":"Хранить историю CPU, памяти и температуры в течение 30 дней.","telemetry-session-note":"Для телеметрии CPU и памяти требуется настроенная постоянная сессия RCI.","telemetry-wear-note":"Сбор телеметрии увеличит нагрузку на накопитель, на котором установлен Entware, и может ускорить его износ.","telemetry-error":"Не удалось обновить фоновую телеметрию.",name:"Имя:",vendor:"Производитель:",firmware:"Прошивка:","device-unavailable":"Информация об устройстве недоступна.","persistent-rci-title":"Постоянная сессия rci/","persistent-rci-description":"Сохранить доступ rci/ в mndwd для разрешённых плагинов. Токены не покидают mndwd.","configure-persistent":"Настроить постоянный сеанс контроллера","persistent-tokenless-toggle":"Постоянная сессия с контроллером и экстендерами","persistent-tokenless-description":"mndwd поддерживает RCI-сессии с контроллером и подходящими экстендерами для разрешённых плагинов. На этой прошивке токен не требуется.","persistent-needs-token":"Прошивка обновлена и теперь требует токен контроллера. Введите токен, чтобы возобновить постоянную сессию.","persistent-storage-disabled":"Хранилище постоянных сеансов отключено.","persistent-storage-decrypt-failed":"Не удалось расшифровать хранилище постоянных сеансов.","controller-token":"Токен контроллера",test:"Проверить",save:"Сохранить","clear-controller-session":"Очистить сеанс контроллера","update-firmware-persistent":"Обновите прошивку устройства для включения постоянных сеансов rci/.","controller-result":"Контроллер: {result}","persistent-extenders-title":"Постоянный сеанс расширителей","persistent-enumeration-stale":"Список mesh временно устарел; активные сеансы всё ещё проверяются.","extender-reason-certificate-invalid":"сертификат недействителен","extender-reason-no-auth-token":"возможность auth-token недоступна","extender-reason-missing-fqdn":"имя защищённого реле недоступно","extender-state-offline":"не в сети","extender-state-establishing":"подключается","extender-state-live":"подключён","extender-state-dead":"переподключается","persistent-state-unavailable":"Состояние постоянного сеанса rci/ недоступно","persistent-request-failed":"Не удалось выполнить запрос постоянного сеанса rci/","controller-token-rejected":"Токен контроллера отклонён","firmware-unsupported":"Прошивка устройства не поддерживает постоянные сеансы rci/","device-unreachable":"Устройство недоступно","palette-import-aria-label":"Импорт JSON-палитры","backend-capacity":"Ёмкость серверной части","backend-approval-title":"Подтвердить серверную часть для {label}","backend-approval-declaration":"объявляет серверную часть. Проверьте её возможности перед подтверждением.","backend-approval-deny":"Отклонить","backend-approval-approve":"Подтвердить","upload-plugin-zip":"Загрузить ZIP плагина","diagnostics-description":"Скачать состояние демона и плагинов для диагностики.","download-diagnostics":"Скачать диагностику",downloading:"Скачивание…","diagnostics-failed":"Не удалось скачать диагностику","plugin-manager":{title:"Менеджер плагинов","reload-notice":"Перезагрузите страницу, чтобы применить изменения плагинов.","reload-now":"Перезагрузить сейчас",later:"Позже",loading:"Загрузка плагинов…",retry:"Повторить",dismiss:"Скрыть",exec:"Exec",services:"Сервисы","per-plugin-exec-limit":"Лимит Exec для плагина","service-protocols":"Протоколы сервисов","runtime-status-unavailable":"Состояние серверной части недоступно: {error}","maintenance-busy":"Плагин занят другой операцией обслуживания. Повторите попытку позже.","confirming-state":"Проверка состояния плагина…","operation-finishing":"Операция с плагином ещё выполняется. Обновите страницу, чтобы проверить результат.","outcome-unknown":"Не удалось подтвердить результат перезапуска. Обновите страницу, чтобы проверить состояние плагина.","installed-title":"Установленные плагины","no-installed":"Плагины не установлены.",version:"Версия",type:"Тип",source:"Источник",builtin:"Встроенный","installing-dependencies":"Установка зависимостей…","dependency-install-failed":"Не удалось установить зависимости","version-mismatch":"Несоответствие версии","load-version-warning":"Собрано для версий {versions}. Плагин всё ещё загружается, но может работать неправильно с этим хостом.","version-warning":{title:"Совместимость версий","sdk-major":"Собрано для @mndw/sdk {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","sdk-newer-minor":"Собрано для более новой версии @mndw/sdk ({pluginVersion}), чем предоставляет эта панель ({hostVersion}). Некоторые функции могут не работать.","shared-major":"Собрано для {name} {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","install-anyway":"Плагин всё равно можно установить."},"endpoint-one":"{count} конечная точка","endpoint-many":"{count} конечных точек","websocket-one":"{count} веб-сокет","websocket-many":"{count} веб-сокетов","persistent-rci-read":"Чтение через постоянный RCI","persistent-rci-write":"Запись через постоянный RCI",refresh:"Обновить",enable:"Включить",disable:"Отключить","restart-backend":"Перезапустить серверную часть","delete-confirmation":"Удалить {label}? Это действие нельзя отменить.",cancel:"Отмена","delete-plugin":"Удалить плагин",delete:"Удалить",backend:"Серверная часть",protocol:"Протокол",incompatible:"несовместима","supported-service-protocols":"Поддерживаемые протоколы сервисов","runtime-state-stopped":"остановлена","runtime-state-capacity-blocked":"заблокирована из-за нехватки ресурсов","runtime-state-starting":"запускается","runtime-state-ready":"готова","runtime-state-backoff":"ожидает перезапуска","runtime-state-failed":"ошибка","pending-title":"Ожидающие подтверждения","deny-confirmation":"Отклонить {label}? Это действие нельзя отменить.","deny-plugin":"Отклонить плагин",deny:"Отклонить",approve:"Подтвердить",routes:"Маршруты","backend-kind-service":"Запускает постоянный фоновый процесс от root","backend-kind-exec":"Запускает команды от root на каждый запрос",packages:"Устанавливает пакеты","service-args":"Аргументы сервиса","public-routes":"Публичные маршруты (доступны из локальной сети без входа)",permissions:"Разрешения","upload-trust-warning":"Плагин получает полный административный доступ к роутеру. Устанавливайте плагины только от авторов, которым доверяете.","upload-drop":"Перетащите ZIP плагина сюда или выберите файл.",uploading:"Загрузка плагина…","waiting-approval":"Ожидание подтверждения…","installed-success":"Плагин «{label}» установлен.","approved-success":"Плагин «{label}» подтверждён.","choose-zip":"Выберите ZIP-файл.","empty-zip":"ZIP-файл пуст.","zip-too-large":"Размер ZIP-файла превышает лимит загрузки 10 МБ.","upload-target-mismatch":"Файл {filename} предназначен для {archiveTarget}, но устройство сообщает {deviceTarget}. Выберите подходящий архив."}},wT={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить"},yT={username:"Имя пользователя",password:"Пароль",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},ET={region:"Уведомления",dismiss:"Закрыть"},kT={tab:"Пакеты",title:"Менеджер пакетов",refresh:"Обновить метаданные",reload:"Перезагрузить",search:"Поиск пакетов…",all:"Все",installed:"Установленные",updates:"Обновления ({count})",selected:"(выбрано: {count})","with-selected":"С выбранными:",install:"Установить",remove:"Удалить",update:"Обновить",installing:"Установка…",removing:"Удаление…",updating:"Обновление…","action-failed":"Не удалось выполнить: {action}","update-available":"Доступно обновление",available:"Доступен","select-package":"Выбрать {name}","select-all":"Выбрать все отфильтрованные пакеты",loading:"Загрузка…","load-failed":"Не удалось загрузить пакеты",empty:"Пакеты не найдены","no-match":"Нет пакетов, соответствующих фильтру",package:"Пакет",version:"Версия",status:"Состояние",description:"Описание",expand:"Развернуть {name}",collapse:"Свернуть {name}",loaded:"Загружено пакетов: {count}","never-refreshed":"Метаданные ещё не обновлялись","refreshed-ago":"Метаданные обновлены {minutes} мин назад","detail-failed":"Не удалось загрузить сведения о пакете",size:"Размер в репозитории","installed-size":"Установленный размер","installed-time":"Время установки",dependencies:"Зависимости","confirm-remove-title":"Подтвердите удаление пакета","confirm-remove":"Удалить {names}?",protected:"Защищённый пакет","dependency-conflict":"Невозможно удалить {package}: от него зависит {dependents}.","dependency-conflict-generic":"Невозможно удалить {package}: от него зависят другие установленные пакеты."},ST={tab:"Сервисы",title:"Сервисы",description:"Просмотр и управление сервисами устройства.",refresh:"Обновить состояния",service:"Сервис",state:"Состояние",autostart:"Автозапуск",actions:"Действия",start:"Запустить",stop:"Остановить",restart:"Перезапустить",enabled:"Включён",disabled:"Выключен","enable-at-boot":"Включать при загрузке","disable-at-boot":"Не включать при загрузке",pid:"PID {pid}","autostart-pinned":"Автозапуск задан строкой ENABLED= в скрипте","probe-failed":"Неизвестно",empty:"Сервисы не найдены","load-failed":"Не удалось загрузить сервисы",unavailable:"Менеджер сервисов недоступен","unavailable-description":"На устройстве нет доступного каталога init-сервисов.",protected:"Защищённый сервис","confirm-title":"Подтвердите действие с сервисом",confirm:"{action} сервис {name}?","confirm-enable-boot":"Включать {name} при загрузке? Работающий сервис не изменится до перезагрузки.","confirm-disable-boot":"Не включать {name} при загрузке? Работающий сервис не изменится до перезагрузки."},xT={"device-timeout":"Устройство не отвечает.","invalid-manifest":"Манифест плагина недействителен.","invalid-zip":"Файл не является ZIP-архивом.","manifest-missing":"В архиве нет manifest.json в корне.","unsupported-manifest-version":"Версия манифеста плагина больше не поддерживается.",conflict:"Плагин с таким именем уже существует.","upload-too-large":"Плагин превышает лимит загрузки 10 МБ.","opkg-failed":"Не удалось установить системные пакеты плагина.","daemon-failed":"Не удалось запустить серверную часть плагина.",unauthorized:"Сеанс истёк. Войдите снова.","service-capacity":"Нет свободных сервисных ресурсов.","backend-busy":"Серверная часть занята. Повторите позже.","backend-unavailable":"Серверная часть недоступна.","backend-incompatible":"Протокол серверной части не поддерживается.","backend-maintenance":"Серверная часть обновляется. Повторите позже.","controller-session-unavailable":"Сеанс токена контроллера недоступен.","rci-socket-start-failed":"Не удалось запустить сокет сеанса RCI. Повторите попытку."},TT={app:mT,nav:vT,dashboard:bT,settings:_T,common:wT,login:yT,toast:ET,packages:kT,services:ST,errors:xT},kd="mndw",Xa=`${kd}:plugin`,lv=["en","ru"],cv=5e3,CT=6e4,PT=24e4,Sd=Object.freeze({theme:"dark",locale:"en"}),xd=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([])})}),uv="/api/mgmt/list",RT="/api/mgmt/permission",AT="/api/mgmt/upload",xh="/api/mgmt/approve",MT="/api/mgmt/deny",NT="/api/mgmt/enable",OT="/api/mgmt/disable",zT="/api/mgmt/delete",IT="/api/mgmt/restart",LT="/api/mgmt/runtime",Pc="/api/mgmt/palette",DT="/api/mgmt/device-hardware",Th="/api/mgmt/telemetry",HT="/api/mgmt/opkg/list",BT="/api/mgmt/opkg/install",$T="/api/mgmt/opkg/remove",UT="/api/mgmt/opkg/update",jT="/api/mgmt/opkg/upgrade",FT="/api/mgmt/opkg/info",GT="/api/mgmt/self-update/status",VT="/api/mgmt/self-update/check",ZT="/api/mgmt/self-update/apply",WT="/api/mgmt/self-update/revert",qT="/api/mgmt/service/list",XT="/api/mgmt/service/status",YT="/api/mgmt/service/start",KT="/api/mgmt/service/stop",JT="/api/mgmt/service/restart",QT="/api/mgmt/service/set-enabled",Ch={builtin:"/plugins/",user:"/user-plugins/"},eC={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 tC(t){return[...t].map(e=>eC[e]??e).join("")}function nC(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`[${tC(e)}]`}function dv(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?nC(n):dv(n)]))}function rC(){const t=new Eb(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 Rc(t,e,n){return new Ta(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 iC(t,e){return new Ta(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 Eu=3e3;function sC(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??lC,now:t.now??Date.now,setTimeout:t.setTimeout??globalThis.setTimeout.bind(globalThis),queueMicrotask:t.queueMicrotask??globalThis.queueMicrotask.bind(globalThis)}}function Ac(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 aC(t){return t.split("-")[0]}function fv(t,e){if(t.locales[e]!==void 0)return e;const n=aC(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function lC(t){const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return Qw(await e.json(),t)}async function Ph(t,e,n,r){const i=t.catalogSuccessCache.get(Ac(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(Ac(e,n),o),o}catch(o){throw t.catalogSuccessCache.delete(Ac(e,n)),o}}function cC(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 hv(t,e,n,r){var d,h;const i=fv(e,n),s=e.defaultLocale,o=Ph(t,e,i,r),a=i===s?o:Ph(t,e,s,r),l=await Promise.race([Promise.allSettled([o,a]),cC(t,r)]).catch(()=>{}),c=Array.isArray(l)&&((d=l[0])==null?void 0:d.status)==="fulfilled"?l[0].value:void 0,u=Array.isArray(l)&&((h=l[1])==null?void 0:h.status)==="fulfilled"?l[1].value:void 0;return{hostLocale:n,resolvedCatalogLocale:i,...c===void 0?{}:{primaryCatalog:c},...u===void 0?{}:{defaultCatalog:u},fallbackStatus:c!==void 0?"primary":u!==void 0?"default":"key"}}function pv(t,e){return{hostLocale:e,resolvedCatalogLocale:fv(t,e),fallbackStatus:"key"}}class uC{constructor(e,n){F(this,"source");F(this,"state");F(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=pv(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 dC(t,e,n){const r=new uC(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function fC(t,e){t.catalogCells.add(e)}function hC(t,e){t.catalogCells.delete(e)}function pC(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function gv(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function gC(t,e,n,r=Eu){e.commit(await hv(t,e.source,n,t.now()+r))}class mC{constructor(e,n){F(this,"runtime");F(this,"token");F(this,"targetLocale");F(this,"deadline");F(this,"promise");F(this,"pending",0);F(this,"initialEnrollmentDone",!1);F(this,"settled",!1);F(this,"cells",new Map);F(this,"resolvedStates",new Map);F(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+Eu,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),Eu)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=hv(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>pv(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 vC(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new mC(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function bC(t,e){t.commit(e)}function _C(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function wC(t){return t.activeGeneration}function yC(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 _m(s,n,r)}function EC(t,e,n,r){const i={get locale(){return e()},direction:"ltr",t:(s,o)=>yC(t,s,o,e()),formatNumber:(s,o)=>new Intl.NumberFormat(ao(e()),o).format(s),formatDate:(s,o)=>new Intl.DateTimeFormat(ao(e()),o).format(s),change$:iC((t==null?void 0:t.subscribe.bind(t))??n,r)};return Object.freeze(i)}function kC(t={}){const e=sC(t);return{createPluginCatalogCell:(n,r)=>dC(e,n,r),registerPluginCatalogCell:n=>fC(e,n),unregisterPluginCatalogCell:n=>hC(e,n),clearPluginCatalogCells:()=>pC(e),loadInitialPluginCatalog:(n,r,i)=>gC(e,n,r,i),preparePluginCatalogGeneration:n=>vC(e,n),commitPluginCatalogGeneration:(n,r)=>bC(n,r),discardPluginCatalogGeneration:n=>_C(e,n),getActivePluginCatalogGeneration:()=>wC(e)}}const jo=kC(),mv=`${kd}:locale`,Mc={en:av,ru:TT};dv(av);function vv(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 SC(){return!1}function Td(){return lv}function bv(t){const e=vv(t);return Td().find(n=>n===e)}function Rh(t){const e=vv(t);if(e!==void 0)return bv(e)??Td().find(n=>n===e.split("-")[0])}function xC(t){try{return(t==null?void 0:t.getItem(mv))??void 0}catch{return}}function TC(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function CC(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??gb;let s=lv[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 b of a)b(m)};return Object.freeze({initLocale:()=>{const m=xC(n),E=(m===void 0?void 0:bv(m))??TC().map(Rh).find(M=>M!==void 0)??"en";return u(E),E},getLocale:()=>s,setLocale:async m=>{const b=Rh(m)??"en";if(b===s)return;o=!0;for(const M of l)M(!0);const E=e.preparePluginCatalogGeneration(b);await E.promise,e.commitPluginCatalogGeneration(E,()=>{u(b);try{n==null||n.setItem(mv,b)}catch{}}),o=!1;for(const M of l)M(!1)},subscribeLocale:m=>(a.add(m),()=>{a.delete(m)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:m=>(l.add(m),()=>{l.delete(m)}),hostT:(m,b,E=s)=>{const M=Mc[E]??Mc.en,z=Ah(M,m)??Ah(Mc.en,m)??m;return b===void 0?z:_m(z,b,E)},hostFormatNumber:(m,b)=>new Intl.NumberFormat(ao(s),b).format(m),hostFormatDate:(m,b)=>new Intl.DateTimeFormat(ao(s),b).format(m),getAvailableLocales:Td,isPseudoLocaleEnabled:SC})}const Fo=CC({catalog:jo}),PC=Fo,ls=()=>Fo.getLocale(),ku=t=>Fo.subscribeLocale(t),RC=t=>Fo.subscribeLocalePending(t),An=(t,e,n)=>Fo.hostT(t,e,n);function Ah(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 _v=`${kd}:theme`,Su="dark";let Ur=Su;const xu=new Set;function AC(){try{const t=localStorage.getItem(_v);return t==="light"||t==="dark"?t:Su}catch{return Su}}function wv(t){document.documentElement.dataset.theme=t}function yv(t){for(const e of xu)e(t)}function MC(){return Ur=AC(),wv(Ur),yv(Ur),Ur}function Ya(){return Ur}function NC(t){if(t!==Ur){Ur=t,wv(t);try{localStorage.setItem(_v,t)}catch{}yv(t)}}function Fi(){NC(Ur==="dark"?"light":"dark")}function Ev(t){return xu.add(t),()=>{xu.delete(t)}}function Mh(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}const OC=["/","/login","/packages","/packages/services","/settings"],zC=new Set(OC);function kv(t){return zC.has(t)}const IC=de().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),LC=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),Sv=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},Cd=de().min(1).refine(LC,{message:"must be a safe relative path"}),DC=Cd.refine(Sv,{message:"entry must include a file name"}),Tu=t=>{try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}},HC=de().min(1).superRefine((t,e)=>{const n=Tu(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})`})}),BC=Cd.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),$C=Ue({defaultLocale:HC,locales:ms(de(),BC)}).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=Tu(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=Tu(t.defaultLocale);i!==void 0&&!r.has(i)&&e.addIssue({code:"custom",path:["defaultLocale"],message:"defaultLocale must be present in locales"})}),xv=de().regex(/^[a-z0-9][a-z0-9+_.-]*$/),Tv=Jt(["session","public"]).default("session"),UC=de().transform(t=>t.toUpperCase()).pipe(Jt(["GET","HEAD","POST","PUT","PATCH","DELETE"])),Cv=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"},Pv=Cd.refine(Sv,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),jC=de().min(1).refine(t=>[...t].every(e=>{const n=e.codePointAt(0)??0;return n>31&&n!==127}),{message:"args must not contain control characters"}),Rv=Ue({id:de().min(1),transport:Rt("http"),method:UC,path:de().refine(Cv,{message:"path must be canonical and safe"}),access:Tv}),FC=Ue({id:de().min(1),transport:Rt("websocket"),path:de().refine(Cv,{message:"path must be canonical and safe"}),access:Tv,protocols:bt(de().min(1)).optional()}),GC=Rv.extend({command:Pv}),Av=(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"})},VC=Ue({kind:Rt("exec"),packages:bt(xv).optional(),routes:bt(GC).min(1)}).strict().superRefine((t,e)=>{Av(t.routes,e)}),ZC=Ue({kind:Rt("service"),protocolVersion:Zt().int().positive(),command:Pv,args:bt(jC).optional(),packages:bt(xv).optional(),routes:bt($r([Rv,FC])).min(1)}).strict().superRefine((t,e)=>{Av(t.routes,e)}),WC=$r([VC,ZC]),Nh=Zt().int().positive().max(12),Oh=Zt().int().positive(),qC=Rt(1).describe("Manifest format version. Must be 1."),XC=IC.describe("Unique plugin id used as the on-disk folder and URL segment."),YC=de().min(1).describe("Semver-ish version string."),KC=de().min(1).describe("Human-readable name shown in the dashboard or navigation."),JC=DC.describe("Relative path to the bundled entry module."),QC=de().optional().describe("Optional icon name."),eP=ym,tP=bt(eP).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"permissions contains duplicate permission"})}),nP=Ue({w:Nh,h:Oh,minW:Nh.optional(),minH:Oh.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"]}),rP=de().regex(/^\/[^/?#*]+$/).refine(t=>!kv(t),{message:"route is reserved by the host"}),Mv={manifestVersion:qC,name:XC,version:YC,label:KC,entry:JC,icon:QC,permissions:tP.optional(),i18n:$C.optional(),backend:WC.optional()},iP=Ue({...Mv,type:Rt("widget"),size:nP,fixedHeight:Tr().optional()}),sP=Ue({...Mv,type:Rt("page"),route:rP}),oP=ud("type",[iP,sP]);class aP 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}`);F(this,"issues");this.issues=i}}function lP(t){const e=oP.safeParse(t);if(!e.success){const n=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new aP(n,e.error.issues)}return e.data}Ue({cid:de().optional(),mac:de().optional(),ip:de().optional(),fqdn:de().optional(),"fqdn-certificate-valid":Tr().optional(),capabilities:ms(de(),lu()).optional()}).passthrough();const cP=[{specifiers:["@rci-tools/core"],bundle:"rci-tools-core",version:"0.6.0",entryPoint:"@rci-tools/core",external:["rxjs","hash-wasm"],framework:"base"},{specifiers:["rxjs"],bundle:"rxjs",version:"7.8.2",entryPoint:"rxjs",framework:"base"},{specifiers:["rxjs/operators"],bundle:"rxjs-operators",version:"7.8.2",entryPoint:"rxjs/operators",framework:"base"},{specifiers:["hash-wasm"],bundle:"hash-wasm",version:"4.12.0",entryPoint:"hash-wasm",framework:"base"},{specifiers:["d3"],bundle:"d3",version:"7.9.0",entryPoint:"d3",framework:"base"},{specifiers:["@mndw/ui"],bundle:"mndw-ui",version:"0.1.6",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"}],Pd=()=>Object.fromEntries(cP.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),uP=Jt(["builtin","registry","upload"]),dP=Jt(["pending","approved"]),fP=Jt(["ready","installing","failed"]),hP=Jt(["stopped","capacity_blocked","starting","ready","backoff","failed"]),pP=Ue({kind:Jt(["exec","service"]),packages:bt(de()).optional(),args:bt(de()).optional(),publicRoutes:bt(de()).optional()}),gP=ms(de(),Tr()).superRefine((t,e)=>{for(const n of Object.keys(t))PS(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI permissions may be granted"})}),mP=Ue({transport:Jt(["http","websocket"]),path:de(),method:Jt(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:bt(de()).optional()}),vP=Ue({routes:ms(de(),mP)}),bP=Ue({w:Zt(),h:Zt(),minW:Zt().optional(),minH:Zt().optional()}),_P=Ue({defaultLocale:de(),locales:ms(de(),de())}),wP=Ue({state:hP,restartCount:Zt(),consecutiveFailures:Zt(),startedAt:de().optional(),nextAttemptAt:de().optional(),lastExit:de().optional(),lastError:de().optional(),recentStderr:bt(de()).optional(),requiredProtocol:Zt().optional(),compatible:Tr().optional(),supportedProtocols:bt(Zt()).optional()}),yP=Ue({sdkVersion:de(),sharedDependencies:ms(de(),de())}),Nv={name:de(),version:de(),label:de(),entry:de(),icon:de().optional(),source:uP,approval:dP,enabled:Tr(),permissions:bt(ym).optional(),permissionGrants:gP.optional(),depsStatus:fP,backend:vP,review:pP.optional(),i18n:_P.optional(),catalogBaseUrl:de().optional(),runtime:wP.optional(),lock:yP.optional()},EP=Ue({...Nv,type:Rt("widget"),size:bP,fixedHeight:Tr().optional()}),kP=Ue({...Nv,type:Rt("page"),route:de()}),Ov=ud("type",[EP,kP]),SP=Ue({plugins:bt(Ov)}),zv=t=>SP.parse(t).plugins,Nc=t=>Ov.parse(t),Ka=new is;function Go(t){return Ka.get(t)??"ready"}function zh(t){Ka.clear();for(const e of t)Ka.set(e.name,e.depsStatus)}let aa=null,Ih;function xP(){clearTimeout(Ih),Ih=void 0,aa==null||aa.abort(),aa=null}const me=st({authenticated:!1,ready:!1,hostInfo:null,deviceInfo:null,pluginLoadError:null,mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:Ya(),locale:ls(),localeSwitchPending:!1});function Oc(){wl().matches?me.mobileSidebarOpen=!me.mobileSidebarOpen:me.desktopSidebarCollapsed=!me.desktopSidebarCollapsed}function Rd(){xP(),me.authenticated=!1,me.ready=!1,me.hostInfo=null,me.deviceInfo=null}Ev(t=>{me.theme=t});ku(t=>{me.locale=t});RC(t=>{me.localeSwitchPending=t});function w(t,e){return An(t,e,me.locale)}var TP=I('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),CP=I('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">&times;</button>'),PP=I('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),RP=I('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),AP=I('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function MP(t,e){Ie(e,!0);const n=Math.random().toString(36).slice(2),r=`mndw-overlay-title-${n}`,i=`mndw-overlay-desc-${n}`;function s(p,g){return p.appendChild(g),{destroy(){g.parentNode===p&&p.removeChild(g)}}}const o=fe(()=>e.layer.mobileSheet?"width:100%;height:auto;max-height:100dvh":[e.layer.sizing.width?`width:${e.layer.sizing.width}`:"",e.layer.sizing.height?`height:${e.layer.sizing.height}`:"",e.layer.sizing.maxWidth?`max-width:${e.layer.sizing.maxWidth}`:"",e.layer.sizing.maxHeight?`max-height:${e.layer.sizing.maxHeight}`:""].filter(Boolean).join(";"));var a=AP(),l=v(a);{var c=p=>{var g=PP(),m=v(g);{var b=z=>{var R=TP(),A=v(R);y(()=>{Ae(R,"id",r),S(A,e.layer.shell.title)}),C(z,R)};Z(m,z=>{var R;(R=e.layer.shell)!=null&&R.title&&z(b)})}var E=T(m,2);{var M=z=>{var R=CP();y(A=>Ae(R,"aria-label",A),[()=>w("common.close")]),pe("click",R,()=>e.layer.close(void 0,"action")),C(z,R)};Z(E,z=>{var R;(R=e.layer.shell)!=null&&R.showCloseButton&&z(M)})}C(p,g)};Z(l,p=>{var g,m;((g=e.layer.shell)!=null&&g.title||(m=e.layer.shell)!=null&&m.showCloseButton)&&p(c)})}var u=T(l,2);{var d=p=>{var g=RP(),m=v(g);y(()=>{Ae(g,"id",i),S(m,e.layer.shell.description)}),C(p,g)};Z(u,p=>{var g;(g=e.layer.shell)!=null&&g.description&&p(d)})}var h=T(u,2);Qr(h,(p,g)=>s==null?void 0:s(p,g),()=>e.layer.contentElement),y(()=>{var p,g;Oe(a,1,`mndw-overlay-dialog mndw-overlay-dialog--${e.layer.kind??""} mndw-overlay-dialog--${e.layer.placement??""} ${e.layer.mobileSheet?"mndw-overlay-dialog--sheet":""} ${e.layer.className??""??""}`,"svelte-1ervcvh"),Ae(a,"data-locale",me.locale),Ae(a,"aria-modal",e.layer.kind==="modal"||e.layer.kind==="drawer"?"true":void 0),Ae(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Ae(a,"aria-describedby",(g=e.layer.shell)!=null&&g.description?i:void 0),io(a,f(o))}),C(t,a),Le()}lt(["click"]);const NP=1e4;function OP(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 Eo,ko,So,xo,To,Co;class Lh{constructor(e,n,r,i,s){F(this,"id");F(this,"pluginName");F(this,"instanceId");F(this,"kind");F(this,"hostElement");F(this,"contentElement");be(this,Eo,Y("opening"));be(this,ko,Y(null));be(this,So,Y("center"));F(this,"mobileSheet");be(this,xo,Y(void 0));be(this,To,Y(st({})));be(this,Co,Y(null));F(this,"behavior");F(this,"closeOnEscape");F(this,"closeOnOutsideClick");F(this,"trapFocus");F(this,"restoreFocus");F(this,"lockScroll");F(this,"backdrop");F(this,"closed");F(this,"abortController",new AbortController);F(this,"anchorElement");F(this,"cleanup",null);F(this,"onCloseListeners",new Set);F(this,"previousFocus");F(this,"closedResolve");F(this,"openTimeout");F(this,"focusTrap",null);F(this,"repositionHandler",null);F(this,"anchorObserver",null);F(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=OP(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=Wd(i.kind,i.placement),this.mobileSheet=mb(i.kind),this.className=i.className,this.sizing=qd(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")},NP),this.attachAnchorObservers()}get state(){return f(k(this,Eo))}set state(e){_(k(this,Eo),e,!0)}get shell(){return f(k(this,ko))}set shell(e){_(k(this,ko),e,!0)}get placement(){return f(k(this,So))}set placement(e){_(k(this,So),e,!0)}get className(){return f(k(this,xo))}set className(e){_(k(this,xo),e,!0)}get sizing(){return f(k(this,To))}set sizing(e){_(k(this,To),e,!0)}get position(){return f(k(this,Co))}set position(e){_(k(this,Co),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=Wd(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=qd(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=vb({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=Dc(this.hostElement,{initialFocus:()=>_b(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&bb(n.hostElement,e))}))}}Eo=new WeakMap,ko=new WeakMap,So=new WeakMap,xo=new WeakMap,To=new WeakMap,Co=new WeakMap;var Po;class zP{constructor(){be(this,Po,Y(st([])))}get layers(){return f(k(this,Po))}set layers(e){_(k(this,Po),e,!0)}}Po=new WeakMap;function IP(){const t=new zP;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 Iv=IP(),LP=Iv;function Ad(t,e,n=Iv){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 Lh(n,t,e,l,null);return n.addLayer(c),c},open(l){i();const{title:c,description:u,showCloseButton:d,mount:h,kind:p,...g}=l,m=new Lh(n,t,e,{kind:p,...g},{title:c,description:u,showCloseButton:d??!0});n.addLayer(m);try{const b=h(m.contentElement,m,m.signal);b instanceof Promise?b.then(()=>m.markReady()).catch(E=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,E),m.closeWithReason("mount-failed")}):m.markReady()}catch(b){console.error(`[mndw] Overlay mount for "${t}" failed:`,b),m.closeWithReason("mount-failed")}return m},closeAll(){for(const l of s())l.close(void 0,"api")}};function a(l="plugin-unmount"){if(!r){r=!0;for(const c of s())c.closeWithReason(l)}}return{service:o,dispose:a}}var DP=I('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),HP=I("<div><!> <div></div></div>");function BP(t,e){Ie(e,!0);let n=Yt(e,"runtime",3,LP);const r=1e3,i=fe(()=>n().store.layers);function s(p){return r+p}function o(p){return p.kind==="modal"||p.kind==="drawer"}function a(p){return p.kind==="popover"?p.position?`position:absolute;top:${p.position.top}px;left:${p.position.left}px`:"position:absolute;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=_l(MP,{target:g.hostElement,props:{layer:g}})),requestAnimationFrame(()=>{g.state!=="closed"&&g.reposition()}),{destroy(){m&&Xu(m),g.hostElement.remove()}}}function c(p){if(p.key==="Escape"){for(let g=f(i).length-1;g>=0;g--)if(f(i)[g].closeOnEscape){f(i)[g].closeWithReason("escape"),p.stopPropagation();return}}}function u(p){const g=p.composedPath();for(let m=f(i).length-1;m>=0;m--){const b=f(i)[m];if(g.includes(b.hostElement)||b.anchorElement&&g.includes(b.anchorElement))return;if(b.closeOnOutsideClick){b.closeWithReason("outside-click");return}if(o(b))return}}hn(()=>{const p=f(i).some(m=>m.lockScroll),g=document.body.style.overflow;return p&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=g}});var d=En();dt("keydown",no,c),dt("pointerdown",no,u);var h=Xe(d);ht(h,19,()=>f(i),p=>p.id,(p,g,m)=>{var b=HP();let E;var M=v(b);{var z=x=>{var N=DP();C(x,N)},R=fe(()=>o(f(g))&&f(g).backdrop);Z(M,x=>{f(R)&&x(z)})}var A=T(M,2);Qr(A,(x,N)=>l==null?void 0:l(x,N),()=>f(g)),y((x,N)=>{Oe(b,1,`mndw-overlay-layer mndw-overlay-layer--${f(g).kind??""}`,"svelte-11o3k6p"),E=io(b,"",E,x),Oe(A,1,`mndw-overlay-positioner mndw-overlay-positioner--${f(g).kind??""} mndw-overlay-positioner--${f(g).placement??""} ${f(g).mobileSheet?"mndw-overlay-positioner--sheet":""} ${f(g).kind==="popover"&&!f(g).position?"mndw-overlay-positioner--unpositioned":""}`,"svelte-11o3k6p"),io(A,N)},[()=>({"z-index":s(f(m))}),()=>a(f(g))]),C(p,b)}),C(t,d),Le()}const $P={success:4e3,info:4e3,error:0},UP=4,jP=.35,FP=.5;function GP(t,e,n){return e<=0?!1:Math.abs(t)>=e*jP||Math.abs(n)>=FP}var Ro;class VP{constructor(){be(this,Ro,Y(st([])));F(this,"nextId",1);F(this,"maxToasts",UP);F(this,"timers",new is)}get toasts(){return f(k(this,Ro))}set toasts(e){_(k(this,Ro),e,!0)}show(e){const n=e.variant??"info",r=e.duration??$P[n],i=this.nextId++;return this.toasts.push({id:i,message:e.message,variant:n,duration:r}),this.enforceCap(),r>0&&this.timers.set(i,setTimeout(()=>this.dismiss(i),r)),i}success(e,n){return this.show({...n,message:e,variant:"success"})}info(e,n){return this.show({...n,message:e,variant:"info"})}error(e,n){return this.show({...n,message:e,variant:"error"})}dismiss(e){this.clearTimer(e);const n=this.toasts.findIndex(r=>r.id===e);n!==-1&&this.toasts.splice(n,1)}setMaxToasts(e){this.maxToasts=Math.max(1,Math.trunc(e)),this.enforceCap()}clear(){for(const e of this.timers.keys())this.clearTimer(e);this.toasts=[]}enforceCap(){for(;this.toasts.length>this.maxToasts;){const e=this.toasts.shift();e!==void 0&&this.clearTimer(e.id)}}clearTimer(e){const n=this.timers.get(e);n!==void 0&&(clearTimeout(n),this.timers.delete(e))}}Ro=new WeakMap;const oi=new VP;var ZP=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),WP=I('<div role="region"></div>');function qP(t,e){Ie(e,!0);let n=Yt(e,"store",3,oi);const r=wl();let i=Y(st(r.matches));const s=d=>{_(i,d.matches,!0),n().setMaxToasts(d.matches?3:4)};function o(d){return d==="error"?"danger":d}function a(d,h){let p=h,g=null,m=0,b=0,E=!1;const M=x=>{d.style.transition="transform 0.15s ease, opacity 0.15s ease",d.style.transform="",d.style.opacity=""},z=x=>{!p.enabled||x.pointerType==="mouse"||g!==null||(g=x.pointerId,m=x.clientX,b=x.timeStamp,E=!0,d.style.transition="",d.setPointerCapture(x.pointerId))},R=x=>{if(!E||x.pointerId!==g)return;const N=x.clientX-m;d.style.transform=`translateX(${N}px)`,d.style.opacity=String(Math.max(.3,1-Math.abs(N)/d.offsetWidth))},A=x=>{if(!E||x.pointerId!==g)return;const N=x.clientX-m,O=Math.max(1,x.timeStamp-b),j=N/O;E=!1,g=null,GP(N,d.offsetWidth,j)?p.onDismiss():M()};return d.style.touchAction="pan-y",d.addEventListener("pointerdown",z),d.addEventListener("pointermove",R),d.addEventListener("pointerup",A),d.addEventListener("pointercancel",A),{update(x){p=x},destroy(){d.removeEventListener("pointerdown",z),d.removeEventListener("pointermove",R),d.removeEventListener("pointerup",A),d.removeEventListener("pointercancel",A)}}}kn(()=>(n().setMaxToasts(f(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var l=En(),c=Xe(l);{var u=d=>{var h=WP();let p;ht(h,21,()=>n().toasts,g=>g.id,(g,m)=>{var b=ZP(),E=v(b),M=v(E),z=T(E,2),R=v(z);P(R,"name","x"),Qr(b,(A,x)=>a==null?void 0:a(A,x),()=>({enabled:f(i),onDismiss:()=>n().dismiss(f(m).id)})),y((A,x)=>{Oe(b,1,`mndw-toast mndw-alert mndw-alert--${A??""}`,"svelte-1g105wt"),Ae(b,"role",f(m).variant==="error"?"alert":"status"),Ae(b,"aria-live",f(m).variant==="error"?"assertive":"polite"),S(M,f(m).message),Ae(z,"aria-label",x)},[()=>o(f(m).variant),()=>w("toast.dismiss")]),pe("click",z,()=>n().dismiss(f(m).id)),C(g,b)}),y(g=>{p=Oe(h,1,"mndw-toast-host svelte-1g105wt",null,p,{"mndw-toast-host--mobile":f(i)}),Ae(h,"aria-label",g)},[()=>w("toast.region")]),C(d,h)};Z(c,d=>{n().toasts.length>0&&d(u)})}C(t,l),Le()}lt(["click"]);class Cu extends Error{constructor(n,r,i){super(r,i);F(this,"code");this.name="PageRouteError",this.code=n}}const XP=["execute","queue","initBackgroundProcess","queueBackgroundProcess"],YP={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"}},Md="0.1.6",KP=1;function JP(t){return typeof t!="object"||t===null||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string")}async function QP(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!==KP)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!JP(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function Gs(t){if(typeof t!="string")return null;const e=/^(\d+)(?:\.(\d+))?(?:[.+-]|$)/.exec(t.trim());return e===null?null:{major:Number(e[1]),minor:e[2]===void 0?null:Number(e[2])}}function jr(t){const e=Gs(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function eR(t,e=Pd(),n=Md){const r=[],i=Gs(t.sdkVersion),s=Gs(n),o=jr(t.sdkVersion),a=jr(n);i!==null&&s!==null&&o!==null&&a!==null&&(o!==a?r.push({kind:"sdk-major",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}):i.major>0&&i.minor!==null&&s.minor!==null&&i.minor>s.minor&&r.push({kind:"sdk-newer-minor",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}));for(const[l,c]of Object.entries(t.sharedDependencies)){const u=e[l];if(u===void 0)continue;const d=Gs(c),h=Gs(u),p=jr(c),g=jr(u);d!==null&&h!==null&&p!==null&&g!==null&&p!==g&&r.push({kind:"shared-major",name:l,pluginVersion:c,hostVersion:u})}return r}function tR(t,e=Pd(),n=Md){const r=[];for(const[o,a]of Object.entries(t.sharedDependencies)){const l=e[o];if(l===void 0)continue;const c=jr(a),u=jr(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=jr(t.sdkVersion),s=jr(n);return i!==null&&s!==null&&i!==s&&r.push(`@mndw/sdk @${i} (host provides @${s})`),r}function nR(t,e,n=Pd(),r=Md){const i=tR(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 rR{constructor(e={catalog:jo}){F(this,"plugins",new Map);F(this,"catalog");this.catalog=e.catalog}register(e){if(this.plugins.has(e.entry.name))throw new Error(`Duplicate plugin name "${e.entry.name}"`);this.plugins.set(e.entry.name,e),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog)}replace(e){const n=this.plugins.get(e.entry.name);if(n===void 0)throw new Error(`Cannot replace unknown plugin "${e.entry.name}"`);if(n.entry.type!==e.entry.type)throw new Error(`Cannot change plugin "${e.entry.name}" type from ${n.entry.type} to ${e.entry.type}`);if(n.entry.type==="page"&&e.entry.type==="page"&&n.entry.route!==e.entry.route)throw new Error(`Cannot change page "${e.entry.name}" route from ${n.entry.route} to ${e.entry.route}`);return this.plugins.set(e.entry.name,e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog),n}get(e){return this.plugins.get(e)}getWidgets(){return[...this.plugins.values()].filter(e=>e.entry.type==="widget")}getPages(){return[...this.plugins.values()].filter(e=>e.entry.type==="page")}getAll(){return[...this.plugins.values()]}clear(){for(const e of this.plugins.values())e.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(e.catalog);this.plugins.clear(),this.catalog.clearPluginCatalogCells()}}const ws=new rR,co=st({});function iR(){for(const t of Object.keys(co))delete co[t]}function sR(t,e){if(e.length===0){delete co[t];return}co[t]=[...e]}function oR(t){return co[t]??[]}const aR=15e3,zc=new Set;function lR(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}async function cR(t,e){zc.has(t)||await new Promise(n=>{if(document.querySelector(`link[data-plugin-style="${e}"][href="${t}"]`)){zc.add(t),n();return}const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.dataset.pluginStyle=e,i.onload=()=>{zc.add(t),n()},i.onerror=()=>{console.warn(`[mndw] No stylesheet for plugin "${e}" at ${t}`),n()},document.head.appendChild(i)})}function uR(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function dR(){const t=await fetch(uv);if(!t.ok)throw new Error(`HTTP ${t.status}`);return zv(await t.json())}async function fR(t,e){const n=await QP(e);return n?nR(t.name,n):[]}function hR(t){const e=new Set,n=new Set;return t.filter(r=>{if(e.has(r.name))return console.error(`[mndw] Skipping duplicate plugin "${r.name}"`),!1;if(e.add(r.name),r.type==="page"){if(n.has(r.route))return console.error(`[mndw] Skipping duplicate page route "${r.route}"`),!1;n.add(r.route)}return!0})}async function pR(t,e,n){const i=`${t.source==="builtin"?Ch.builtin:Ch.user}${t.name}`,s=o=>lR(i,o,t.version);await e.loadStylesheet(s("index.css"),t.name);try{const o=await e.importModule(s(t.entry)),a=uR(o,t.name),l=gv(t.name,t.version,t.catalogBaseUrl??i,t.i18n),c=l===void 0?void 0:e.catalogService.createPluginCatalogCell(l,e.getLocale());if(c!==void 0&&await e.catalogService.loadInitialPluginCatalog(c,e.getLocale()),n.aborted)return;e.registry.register({entry:t,module:a,...c===void 0?{}:{catalog:c}}),console.log(`[mndw] Loaded plugin: ${t.name} (${t.source})`),Promise.resolve().then(()=>e.checkVersions(t,i)).then(u=>{sR(t.name,u)}).catch(u=>{console.error(`[mndw] Version check failed for "${t.name}":`,u)})}catch(o){console.error(`[mndw] Failed to load plugin "${t.name}":`,o)}}async function gR(t,e){const n=new AbortController,r=new Promise(s=>{n.signal.addEventListener("abort",()=>{console.error(`[mndw] Plugin "${t.name}" did not load within ${e.loadTimeoutMs} ms; skipping it`),s()},{once:!0})}),i=setTimeout(()=>n.abort(),e.loadTimeoutMs);try{await Promise.race([pR(t,e,n.signal),r])}finally{clearTimeout(i)}}async function mR(t={}){const e=t.fetchList??dR,n={importModule:t.importModule??(s=>import(s)),loadStylesheet:t.loadStylesheet??cR,checkVersions:t.checkVersions??fR,catalogService:t.catalogService??jo,registry:t.registry??ws,getLocale:t.getLocale??ls,loadTimeoutMs:t.loadTimeoutMs??aR};n.registry.clear(),zh([]),me.pluginLoadError=null,iR();let r;try{r=await e()}catch(s){console.error("[mndw] Failed to load plugin list:",s),me.pluginLoadError="Failed to load plugins. Check the console for details.";return}zh(r);const i=hR(r.filter(s=>s.enabled&&s.approval==="approved"));await Promise.all(i.map(s=>gR(s,n)))}const vR=Ue({id:de(),label:de(),index:Zt().finite().int().nonnegative(),type:de(),group:de(),color:de(),interfaceId:de()}),bR=Ue({list:bt(vR),layout:bt(bt(de())),hasPortStats:Tr()}),_R=Ue({switchports:bR,usbPortCount:Zt().finite().int().nonnegative()});function Lv(){return{list:[],layout:[],hasPortStats:!1}}function wR(t){return _R.parse(t)}const Qt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),wr=t=>typeof t=="string"&&t.length>0,Vs=Object.freeze({"X-Mndw-Csrf":"1"}),yR=async t=>{try{return await t.json()}catch{return}};function ER(t,e){const n=Qt(t)?t:void 0,r=n==null?void 0:n.error,i=Qt(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:wr(s)?s:"UNKNOWN",message:wr(o)?o:e,detail:i==null?void 0:i.detail}}class Vo extends Error{constructor(n,r,i,s){super(n);F(this,"code");F(this,"detail");F(this,"status");this.name="HostApiError",this.code=r,this.detail=i,this.status=s}}function kR(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 Dh(t,e,n){const r=Object.keys(t).find(i=>i.toLowerCase()===e.toLowerCase());t[r??e]=n}function Qe(t){return t("Malformed response","UNKNOWN")}function Zo(t,e){const n=()=>Qe(e);async function r(o){try{return await o.json()}catch{throw n()}}async function i(o){const a=ER(await yR(o),o.statusText);return e(a.message,a.code,a.detail,o.status)}return{request:(async(o,a={})=>{var E;const{csrf:l,json:c,response:u,...d}=a,h=((E=d.method)==null?void 0:E.toUpperCase())??"GET",p=h!=="GET"&&h!=="HEAD"||l===!0,g=Object.prototype.hasOwnProperty.call(a,"json"),m={...d};if(g&&(m.body=JSON.stringify(c)),p||g){const M=kR(d.headers);if(g&&Dh(M,"Content-Type","application/json"),p)for(const[z,R]of Object.entries(Vs))Dh(M,z,R);m.headers=M}const b=await t(o,m);if(!b.ok)throw await i(b);return u==="raw"?b:await r(b)}),parseJson:r,malformed:n,errorFromResponse:i}}class Gi extends Vo{constructor(e,n,r,i){super(e,n,r,i),this.name="MgmtError"}}const Dv=(t,e,n,r)=>new Gi(t,e,n,r);function SR(t){switch(t){case"read":return cv;case"mutation":return CT;case"install":return PT}}function Ni(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function xR(t){if(!Qt(t)||!Ni(t.maxConcurrentExecTotal)||!Ni(t.maxConcurrentExecPerPlugin)||!Ni(t.maxSupervisedServices)||!Ni(t.currentExec)||!Ni(t.reservedServices)||!Array.isArray(t.supportedServiceProtocols)||!t.supportedServiceProtocols.every(Ni))throw Qe(Dv);return{maxConcurrentExecTotal:t.maxConcurrentExecTotal,maxConcurrentExecPerPlugin:t.maxConcurrentExecPerPlugin,maxSupervisedServices:t.maxSupervisedServices,currentExec:t.currentExec,reservedServices:t.reservedServices,supportedServiceProtocols:t.supportedServiceProtocols}}function TR(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof Gi&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function CR(t=globalThis.fetch,e=n=>AbortSignal.timeout(SR(n))){const n=Zo(t,Dv);function r(a){return e(a)}async function i(a){if(a.status!==204)throw a.ok?new Gi("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===xh?"install":"mutation");return Nc(await n.parseJson(c))}return{async listPlugins(){return zv(await n.request(uv,{method:"GET",signal:r("read")}))},async uploadPlugin(a){const l=await n.request(AT,{method:"POST",headers:{"Content-Type":"application/zip"},body:a,response:"raw"});if(l.status===201||l.status===202){const c=Nc(await n.parseJson(l));return{status:l.status===201?"installed":"pending",entry:c}}throw await n.errorFromResponse(l)},approvePlugin:a=>o(xh,a),enablePlugin:a=>o(NT,a),disablePlugin:a=>o(OT,a),async setPluginPermission(a,l,c){const u=await n.request(RT,{method:"POST",json:{name:a,permission:l,enabled:c},signal:r("mutation")});return Nc(u)},async denyPlugin(a){await s(MT,a,"mutation")},async deletePlugin(a){await s(zT,a,"mutation")},async restartPlugin(a){await s(IT,a,"mutation")},async getRuntime(){const a=await n.request(LT,{method:"GET",signal:r("read")});return xR(a)},async getDeviceHardware(){try{const a=await n.request(DT,{method:"GET",signal:r("read")});return wR(a)}catch{return{switchports:Lv(),usbPortCount:0}}},async getPalette(){const a=await n.request(Pc,{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 Gi("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(a){const l=await n.request(Pc,{method:"PUT",json:a,signal:r("mutation"),response:"raw"});await i(l)},async deletePalette(){const a=await n.request(Pc,{method:"DELETE",signal:r("mutation"),response:"raw"});await i(a)},async getTelemetry(){const a=await n.request(Th,{method:"GET",signal:r("read")});if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new Gi("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(a){const l=await n.request(Th,{method:"PUT",json:{enabled:a},signal:r("mutation"),response:"raw"});await i(l)}}}const Nd=CR(),Hh={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 or(t){return t instanceof DOMException&&t.name==="TimeoutError"?An("errors.device-timeout"):t instanceof Gi?t.code==="MANIFEST_INVALID"?wr(t.detail)?`${An("errors.invalid-manifest")}: ${t.detail}`:An("errors.invalid-manifest"):(Hh[t.code]===void 0?t.message:An(Hh[t.code]))||An("app.error"):t instanceof Error?t.message:An("app.error")}const Pu="mndw-palette-override",PR=":root:root";function RR(t){const e=t.getElementById(Pu);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=Pu,t.head.appendChild(n),n}function Ms(t,e){var n;if(e===null){(n=t.getElementById(Pu))==null||n.remove();return}RR(t).textContent=MS(e,{selector:PR})}function Oi(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function AR(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function MR(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>Oi(n??YP),s=()=>{const a=i();for(const l of r)l(Oi(a))},o=async a=>{const l=await t.mgmtClient.getPalette();let c=null;if(l!==null){const d=rv(l);if(d.palette===null)throw new Error("The device returned an invalid palette.");c=d.palette}const u=AR(n,c);n=c,Ms(e,c),a&&u&&s()};return{getApplied:()=>n===null?null:Oi(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=Oi(a);Ms(e,l);for(const c of r)c(Oi(l))},discardPreview:()=>{Ms(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=Oi(a),Ms(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,Ms(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}const Od=MR({mgmtClient:Nd}),Bh=()=>Od.getTokens(),NR=t=>Od.subscribePalette(t),OR=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"],zR=globalThis.fetch.bind(globalThis);async function Zs(t,e={},n=2e4){const r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),n);try{return await zR(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(i)}}class er extends Error{constructor(n,r){super(n);F(this,"code");F(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const la="/api/mndw/rci-session",IR=["offline","establishing","live","dead"],LR=["certificate-invalid","no-auth-token","missing-fqdn"],DR=["token","none","unknown"],HR=["supported","invalid","unsupported","unknown","needs-token"],BR=["ok","empty","disabled","decrypt-failed"];class $R{async getCapability(){const e=await this.read(await Zs(`${la}/capability`,{headers:{...Vs}}));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 Zs(`${la}/controller`,{method:"DELETE",headers:{...Vs}}))}async setEnabled(e){await this.read(await Zs(`${la}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...Vs},body:JSON.stringify({enabled:e})}))}async post(e,n){return await Zs(`${la}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Vs},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"&&BR.includes(e)}isSupport(e){return typeof e=="string"&&HR.includes(e)}isAuthMode(e){return typeof e=="string"&&DR.includes(e)}isSessionState(e){return typeof e=="string"&&IR.includes(e)}isEligibilityReason(e){return typeof e=="string"&&LR.includes(e)}isFailureCategory(e){return typeof e=="string"&&OR.includes(e)}}function UR(){return new $R}const jR=UR(),FR=3e4,GR={path:"show.system"};class VR{constructor(){F(this,"transport");F(this,"heartbeatSubscription",null);F(this,"driver");F(this,"auth");const e=window.location.origin;this.transport=new Mb,this.auth=new Nb(e,this.transport),this.driver=new Ob(e,this.transport)}login(e,n){return this.auth.login(e,n).pipe(jl(r=>{r?this.startHeartbeat():this.stopHeartbeat()}))}logout(){return this.stopHeartbeat(),this.auth.logout()}isAuthenticated(){return this.auth.isAuthenticated().pipe(jl(e=>{e?this.startHeartbeat():this.stopHeartbeat()}))}get authError$(){return this.transport.authError$.pipe(jl(()=>this.stopHeartbeat()))}startHeartbeat(){this.heartbeatSubscription===null&&(this.heartbeatSubscription=kb(0,FR).pipe(Sb(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(GR).pipe(xb(()=>Tb))}}const zd=new VR,{service:ZR}=Ad("@mndw/ui","@mndw/ui"),WR=ZR;function qR(t=globalThis.fetch){return sT(t)}const XR=qR(),YR=500,KR=5e3,$h=.2,JR=100,QR=1024,eA=2048,tA=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),nA=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),rA=(t,e)=>{if(t==="*"||t===e||t.startsWith(`${e}.`))return t;if(e==="*"||e.startsWith(`${t}.`))return e},iA=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=rA(r,i);s!==void 0&&n.add(s)}return[...n]},sA=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]},oA=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0;class aA{constructor(e={}){F(this,"socketFactory");F(this,"schedule");F(this,"cancelSchedule");F(this,"random");F(this,"diagnostic");F(this,"registrations",new Map);F(this,"deliveredIds",new Set);F(this,"deliveredOrder",[]);F(this,"liveBuffer",[]);F(this,"socket");F(this,"reconnectTimer");F(this,"reconnectAttempt",0);F(this,"nextHandlerId",1);F(this,"lastSeenId","");F(this,"replayCursor","");F(this,"catchingUp",!1);F(this,"replaying",!1);F(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=sA(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 Ta(a=>{const l=this.registrations.get(e);if(l===void 0){a.complete();return}const c=iA(tA(o),l.grants);if(c.length===0){a.complete();return}const u=this.nextHandlerId++;return l.subscriptions.set(u,{filters:c,handler:d=>a.next(d)}),this.updateWireSubscription(),()=>{l.subscriptions.delete(u)&&this.updateWireSubscription()}}).pipe(Xd(i.ended$)),resync$:new Ta(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(Xd(i.ended$))}}disposeFacade(e){this.registrations.delete(e)&&(this.updateWireSubscription(),this.registrations.size===0&&this.closeSocket())}effectiveWireFilters(){const e=new Set;for(const n of this.registrations.values())for(const r of n.subscriptions.values())for(const i of r.filters)e.add(i);return[...e].sort()}ensureSocket(){if(this.socket!==void 0||this.reconnectTimer!==void 0||this.closing||this.effectiveWireFilters().length===0)return;if(this.socketFactory===void 0){this.diagnostic("event stream WebSocket is unavailable");return}const e=new this.socketFactory("/ws/events");this.socket=e,e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("message",n=>this.handleMessage(e,n.data)),e.addEventListener("close",()=>this.handleClose(e)),e.addEventListener("error",n=>this.diagnostic("event stream socket error",n))}handleOpen(e){this.socket===e&&(this.reconnectAttempt=0,this.sendSubscribe(),this.catchingUp=!0,this.replaying=!1,this.replayCursor=this.lastSeenId,this.requestReplay(this.lastSeenId))}handleClose(e){this.socket===e&&(this.socket=void 0,this.registrations.size>0&&!this.closing&&this.scheduleReconnect())}handleMessage(e,n){if(this.socket!==e||typeof n!="string")return;let r;try{r=JSON.parse(n)}catch(s){this.diagnostic("event stream returned invalid JSON",s);return}const i=oA(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=jf.safeParse(e);if(!n.success){this.diagnostic("event stream returned invalid event",n.error);return}if(this.catchingUp){if(this.liveBuffer.length>=QR){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=>jf.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>eA;){const n=this.deliveredOrder.shift();n!==void 0&&this.deliveredIds.delete(n)}for(const n of this.registrations.values())for(const r of n.subscriptions.values())if(r.filters.some(i=>nA(i,e.topic)))try{r.handler(e)}catch(i){this.diagnostic(`event handler failed for ${n.pluginName}`,i)}}}sendSubscribe(){this.send({type:"subscribe",topics:this.effectiveWireFilters()})}updateWireSubscription(){const e=this.effectiveWireFilters();if(e.length===0){this.closeSocket();return}const n=this.socket;(n==null?void 0:n.readyState)===1&&!this.catchingUp&&this.send({type:"subscribe",topics:e}),this.ensureSocket()}requestReplay(e){this.replaying||(this.replaying=!0,this.send({type:"replay",after:e,limit:JR}))}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(KR,YR*2**this.reconnectAttempt++),n=1-$h+this.random()*2*$h;this.reconnectTimer=this.schedule(()=>{this.reconnectTimer=void 0,this.ensureSocket()},Math.round(e*n))}closeActiveSocket(){const e=this.socket;e!==void 0&&(this.catchingUp=!1,this.replaying=!1,e.close(1008,"event stream catch-up overflow"))}closeSocket(){this.reconnectTimer!==void 0&&(this.cancelSchedule(this.reconnectTimer),this.reconnectTimer=void 0),this.catchingUp=!1,this.replaying=!1,this.liveBuffer.length=0;const e=this.socket;this.socket=void 0,e!==void 0&&e.close(1e3,"no event subscribers")}}function lA(t={}){return new aA(t)}const cA=Object.freeze({mgmtClient:Nd,palette:Od,catalog:jo,locale:PC,registry:ws,persistentRci:jR,rci:zd,telemetry:XR,eventStream:lA(),overlay:WR});function uo(){return cA}const Ru="mndw:sandbox-reloaded";function uA(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function dA(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 fA(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:dA(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 Hv(t){if(t.importPluginModule===void 0||t.importManifestModule===void 0)throw new Error("Sandbox imports were not provided");const e=uA(await t.importPluginModule()),n=await t.importManifestModule();if(n.default===void 0||n.default===null)throw new Error("Sandbox manifest module has no default export");const r=lP(n.default),i=t.catalogBaseUrl??n.__catalogBaseUrl,s=fA(r,i),o=t.catalogService??jo,a=t.getLocale??ls,l=gv(s.name,s.version,i??`/plugins/${s.name}`,s.i18n),c=l===void 0?void 0:o.createPluginCatalogCell(l,a());return c!==void 0&&await o.loadInitialPluginCatalog(c,a()),{entry:s,module:e,...c===void 0?{}:{catalog:c}}}async function hA(t={}){const e=t.registry??ws;try{const n=await Hv(t);e.register(n),console.log(`[mndw] Sandbox plugin loaded: ${n.entry.name}`)}catch(n){console.error("[mndw] Failed to load sandbox plugin:",n)}}async function pA(t={}){const e=t.registry??ws,n=t.remountWidgets??gA,r=t.reloadPage??mA,i=t.pluginContextServices??(()=>{const c=uo();return{locale:c.locale,palette:c.palette,telemetry:c.telemetry,eventStream:c.eventStream}})();let s;try{s=await Hv(t)}catch(c){return console.error("[mndw] Sandbox reload rejected (invalid update kept previous plugin):",c),"failed"}const o=s.entry.name,a=e.get(o);if(a===void 0)return e.register(s),"reloaded";let l;try{l=e.replace(s)}catch(c){return console.error(`[mndw] Sandbox reload needs a restart of \`mndw dev\`: ${c.message}`),"restart-required"}try{const c=await n(o,s,a,e,i),u=await r(o,s,a);if(!c||!u)throw new Error("a widget or page remount reported failure");return console.log(`[mndw] Sandbox plugin reloaded: ${o}`),"reloaded"}catch(c){return e.replace(l),console.error(`[mndw] Sandbox reload failed, kept previous plugin "${o}":`,c),"failed"}}async function gA(t,e,n,r,i){const{remountWidgetTiles:s}=await Ia(async()=>{const{remountWidgetTiles:o}=await Promise.resolve().then(()=>tM);return{remountWidgetTiles:o}},[]);return s(i,r,t,e,n)}async function mA(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(Ru,{detail:i})),(await Promise.all(r)).every(Boolean)}const Bv={importPluginModule:()=>Ia(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>Ia(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function ca(){return{received:!1,value:void 0}}function vA(t,e){let n=ca(),r=ca(),i=!1,s=Promise.resolve();const o=()=>{i||(i=!0,queueMicrotask(()=>{i=!1;const a=n,l=r;n=ca(),r=ca();const c={importPluginModule:a.received?()=>Promise.resolve(a.value):e.importPluginModule,importManifestModule:l.received?()=>Promise.resolve(l.value):e.importManifestModule};s=s.then(()=>pA({...c,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale(),pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,eventStream:t.eventStream}})).then(()=>{}).catch(u=>{console.error("[mndw] Sandbox HMR transaction failed:",u)})}))};return{plugin:a=>{n={received:!0,value:a},o()},manifest:a=>{r={received:!0,value:a},o()}}}function bA(t,e=void 0,n=Bv){if(e===void 0)return;const r=vA(t,n);e.accept("virtual:sandbox-plugin",i=>{r.plugin(i)}),e.accept("virtual:sandbox-manifest",i=>{r.manifest(i)})}class D{static getElements(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(r&&!isNaN(+e[0])){const s=r.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(!e.length)return null;if(r&&e[0]==="#")return r.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(r&&!isNaN(+e[0]))return r.getElementById(e);let i=n.querySelector(e);return r&&!i&&(i=r.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){var n,r;return e.lazyLoad||((r=(n=e.grid)==null?void 0:n.opts)==null?void 0:r.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,n){const r=document.createElement("div");return e.forEach(i=>{i&&r.classList.add(i)}),n==null||n.appendChild(r),r}static shouldSizeToContent(e,n=!1){return(e==null?void 0:e.grid)&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return D.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const r=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=r)return 0;const s=e.y>n.y?e.y:n.y,o=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return o<=s?0:(i-r)*(o-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const o=n*((i.y??1e4)-(s.y??1e4));return o===0?n*((i.x??1e4)-(s.x??1e4)):o})}static find(e,n){return n?e.find(r=>r.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,r="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);r=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:r}}static defaults(e,...n){return n.forEach(r=>{for(const i in r){if(!r.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=r[i]:typeof r[i]=="object"&&typeof e[i]=="object"&&D.defaults(e[i],r[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static copyPos(e,n,r=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),r&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let r in e){const i=e[r],s=n[r];r[0]==="_"||i===s?delete e[r]:i&&typeof i=="object"&&s!==void 0&&(D.removeInternalAndSame(i,s),Object.keys(i).length||delete e[r])}}static removeInternalForSave(e,n=!0){for(let r in e)(r[0]==="_"||e[r]===null||e[r]===void 0)&&delete e[r];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let r=!1;return(...i)=>{r||(r=!0,setTimeout(()=>{e(...i),r=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e).overflowY;return(n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight?e:D.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=D.getScrollElement(n),s=i.clientHeight,o=i===D.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-o,l=a<r,c=a>s-r;l?i.scrollBy({behavior:"smooth",top:a-r}):c&&i.scrollBy({behavior:"smooth",top:r-(s-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],r=D.clone(e);for(const i in r)r.hasOwnProperty(i)&&typeof r[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(r[i]=D.cloneDeep(e[i]));return r}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let r;typeof n=="string"?r=D.getElement(n):r=n,r&&r.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const r in n)n.hasOwnProperty(r)&&(Array.isArray(n[r])?n[r].forEach(i=>{e.style[r]=i}):e.style[r]=n[r])}static initEvent(e,n){const r={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>r[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>r[s]=e[s]),{...r,...i}}static simulateMouseEvent(e,n,r){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(r||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");D.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const r=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/r.width,yScale:1/r.height,xOffset:r.left,yOffset:r.top}}static swap(e,n,r){if(!e)return;const i=e[n];e[n]=e[r],e[r]=i}static canBeRotated(e){var n;return!(!e||e.w===e.h||e.locked||e.noResize||(n=e.grid)!=null&&n.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class br{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,r,i={}){if(this.sortNodes(-1),r=r||this.collide(e,n),!r)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,r))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},r=this.collide(e,s,i.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;r=r||this.collide(e,s,i.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(r.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(r,{...r,y:e.y},e)||!this.collide(r,{...r,y:n.y-r.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:r.y+r.h,...a};c=this._loading&&D.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?D.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,D.copyPos(e,n)),o=o||c}else c=this.moveNode(r,{...r,y:n.y+n.h,skip:e,...a});if(!c)return o;r=void 0}return o}collide(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.find(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}collideAll(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.filter(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}directionCollideCoverage(e,n,r){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let o,a=.5;for(let l of r){if(l.locked||!l._rect)break;const c=l._rect;let u=Number.MAX_VALUE,d=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?d=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(d=(c.x+c.w-s.x)/c.w);const h=Math.min(d,u);h>a&&(a=h,o=l)}return n.collide=o,o}cacheRects(e,n,r,i,s,o){return this.nodes.forEach(a=>a._rect={y:a.y*n+r,x:a.x*e+o,w:a.w*e-o-i,h:a.h*n-r-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function r(){const s=n.x,o=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=o):(e.x=s,e.y=o),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=D.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=D.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return r()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=D.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return r()}return!1}}}isAreaEmpty(e,n,r,i){const s={x:e||0,y:n||0,w:r||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const r=this.batchMode;r||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),i||delete this._inColumnResize,r||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=D.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const r=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:r,w:e.w,h:e.h})))break;e._dirty=e.y!==r,e.y=r}}),this)}prepareNode(e,n){e._id=e._id??br._idSeq++;const r=e.id;if(r){let s=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=r+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return D.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,D.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const r=e._orig||D.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),D.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!D.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=D.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||D.samePos(e,e._orig)||(D.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,r=this.column,i){const s=i?i.y*r+(i.x+i.w):0;let o=!1;for(let a=s;!o;++a){const l=a%r,c=Math.floor(a/r);if(l+e.w>r)continue;const u={x:l,y:c,w:e.w,h:e.h};n.find(d=>D.isIntercepted(u,d))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,n=!1,r){const i=this.nodes.find(o=>o._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,r)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,r=!1){return this.nodes.find(i=>i._id===e._id)?(r&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const r=this.nodes;return this.removedNodes=n?r:[],this.nodes=[],this._notify(r)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let r;const i=new br({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(r={...o},r):{...o})});if(!r)return!1;const s=i.moveNode(r,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const o=n.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return s?(i.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(D.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new br({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),r={...e};return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,n.addNode(r),n.getRow()<=this.maxRow?(e._willFitPos=D.copyPos({},r),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){var c,u;if(!e||!n)return!1;let r;n.pack===void 0&&!this.batchMode&&(r=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=D.copyPos({},e,!0);if(D.copyPos(s,n),this.nodeBoundFix(s,i),D.copyPos(n,s),!n.forceCollide&&D.samePos(e,n))return!1;const o=D.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const d=e._moving&&!n.nested;let h=d?this.directionCollideCoverage(e,n,a):a[0];if(d&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=D.areaIntercept(n.rect,h._rect),g=D.area(n.rect),m=D.area(h._rect);p/(g<m?g:m)>.8&&(h.grid.makeSubGrid(h.el,void 0,e),h=void 0)}h?l=!this._fixCollisions(e,s,h,n):(l=!1,r&&delete n.pack)}return l&&!D.samePos(e,s)&&(e._dirty=!0,D.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!D.samePos(e,o)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,r){var a;const i=((a=this._layouts)==null?void 0:a.length)||0;let s;i&&(r?r!==this.column&&(s=this._layouts[r]):this.column!==i-1&&(s=this._layouts[i-1]));const o=[];return this.sortNodes(),this.nodes.forEach(l=>{const c=s==null?void 0:s.find(d=>d._id===l._id),u={...l,...c||{}};D.removeInternalForSave(u,!e),n&&n(l,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,r)=>{if(!n||r===this.column)return this;if(r<this.column)this._layouts[r]=void 0;else{const i=r/this.column;e.forEach(s=>{if(!s._orig)return;const o=n.find(a=>a._id===s._id);o&&(o.y>=0&&s.y!==s._orig.y&&(o.y+=s.y-s._orig.y,o.y<0&&(o.y=0)),s.x!==s._orig.x&&(o.x=Math.round(s.x*i),o.x<0&&(o.x=0)),s.w!==s._orig.w&&(o.w=Math.round(s.w*i),o.w<1&&(o.w=1)))})}}),this)}columnChanged(e,n,r="moveScale"){var a;if(!this.nodes.length||!n||e===n)return this;const i=r==="compact"||r==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],o=i?this.nodes:D.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{const d=o.find(h=>h._id===u._id);d&&(!i&&!u.autoPosition&&(d.x=u.x??d.x,d.y=u.y??d.y),d.w=u.w??d.w,(u.x==null||u.y===void 0)&&(d.autoPosition=!0))})),l.forEach(u=>{const d=o.findIndex(h=>h._id===u._id);if(d!==-1){const h=o[d];if(i){h.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,s),u.autoPosition||(h.x=u.x??h.x,h.y=u.y??h.y,h.w=u.w??h.w,s.push(h)),o.splice(d,1)}})}if(i)this.compact(r,!1);else{if(o.length)if(typeof r=="function")r(n,e,s,o);else{const l=i||r==="none"?1:n/e,c=r==="move"||r==="moveScale",u=r==="scale"||r==="moveScale";o.forEach(d=>{d.x=n===1?0:c?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:u?Math.round(d.w*l)||1:Math.min(d.w,n),s.push(d)}),o=[]}s=D.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,r=!1){const i=[];return e.forEach((s,o)=>{if(s._id===void 0){const a=s.id?this.nodes.find(l=>l.id===s.id):void 0;s._id=(a==null?void 0:a._id)??br._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??br._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}}br._idSeq=0;const vn={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class xe{}const Fn=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class yn{}function Ja(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t.changedTouches[0],e))}function $v(t,e){t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t,e)}function Qa(t){yn.touchHandled||(yn.touchHandled=!0,Ja(t,"mousedown"))}function el(t){yn.touchHandled&&Ja(t,"mousemove")}function tl(t){if(!yn.touchHandled)return;yn.pointerLeaveTimeout&&(window.clearTimeout(yn.pointerLeaveTimeout),delete yn.pointerLeaveTimeout);const e=!!xe.dragElement;Ja(t,"mouseup"),e||Ja(t,"click"),yn.touchHandled=!1}function nl(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function Uh(t){xe.dragElement&&t.pointerType!=="mouse"&&$v(t,"mouseenter")}function jh(t){xe.dragElement&&t.pointerType!=="mouse"&&(yn.pointerLeaveTimeout=window.setTimeout(()=>{delete yn.pointerLeaveTimeout,$v(t,"mouseleave")},10))}class Hl{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(`${Hl.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Fn&&(this.el.addEventListener("touchstart",Qa),this.el.addEventListener("pointerdown",nl)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Fn&&(this.el.removeEventListener("touchstart",Qa),this.el.removeEventListener("pointerdown",nl)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.addEventListener("touchmove",el),this.el.addEventListener("touchend",tl)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.removeEventListener("touchmove",el),this.el.removeEventListener("touchend",tl)),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}}Hl.prefix="ui-resizable-";class Id{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 fo extends Id{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},o=this.temporalRect||s;return{position:{left:this.option.rtl?(i.right-o.right)*this.rectScale.x:(o.left-i.left)*this.rectScale.x,top:(o.top-i.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,r=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),r&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),xe.overResizeElement===this&&delete xe.overResizeElement),this}_mouseOver(e){xe.overResizeElement||xe.dragElement||(xe.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){xe.overResizeElement===this&&(delete xe.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Hl(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=D.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=D.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=D.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const r=D.initEvent(e,{type:"resize",target:this.el});return r.resizeDir=n,r.hasMovedX=this.option.rtl?n.includes("e"):n.includes("w"),r.hasMovedY=n.includes("n"),this.option.resize&&this.option.resize(r,this._ui()),this.triggerEvent("resize",r),this}_resizeStop(e){const n=D.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=fo._originStyleProp.map(r=>this.el.style[r]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=D.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return fo._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const r=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},s=e.clientX-r.clientX,o=this.sizeToContent?0:e.clientY-r.clientY;let a,l;const c=this.option.rtl;!c&&n.indexOf("e")>-1?i.width+=s:c&&n.indexOf("w")>-1?i.width-=s:!c&&n.indexOf("w")>-1?(i.width-=s,i.left+=s,a=!0):c&&n.indexOf("e")>-1&&(i.width+=s,i.right+=s,a=!0),n.indexOf("s")>-1?i.height+=o:n.indexOf("n")>-1&&(i.height-=o,i.top+=o,l=!0);const u=this._constrainSize(i.width,i.height,a,l);return Math.round(i.width)!==Math.round(u.width)&&(!c&&n.indexOf("w")>-1?i.left+=i.width-u.width:c&&n.indexOf("e")>-1&&(i.right-=i.width-u.width),i.width=u.width),Math.round(i.height)!==Math.round(u.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-u.height),i.height=u.height),i}_constrainSize(e,n,r,i){const s=this.option,o=(r?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,a=s.minWidth/this.rectScale.x||e,l=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n,u=Math.min(o,Math.max(a,e)),d=Math.min(l,Math.max(c,n));return{width:u,height:d}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:r,right:i,top:s}=n.getBoundingClientRect();e={left:r,right:i,top:s,width:0,height:0}}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([n,r])=>{if(this.option.rtl?n==="left":n==="right")return;const i=n==="width"||n==="left"||n==="right"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;let s;n==="right"?s=(e.right-r)*this.rectScale.x+"px":s=(r-e[n])*i+"px",this.el.style[n]=s}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}fo._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const _A='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ho extends Id{constructor(e,n={}){var s;super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{const o=this.helper,a=this._autoScrollContainer;if(!o||!a){this._stopScrolling();return}const l=this._getClipping(o,a);if(l===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){const p=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(p/150,4)}const c=Math.abs(l),u=Math.min(c*.5,this._autoScrollMaxSpeed),d=l>0?u:-u,h=a.scrollTop;if(a.scrollTop+=d,a.scrollTop===h){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick)};const r=(s=n==null?void 0:n.handle)==null?void 0:s.substring(1),i=e.gridstackNode;this.dragEls=!r||e.classList.contains(r)?[e]:i!=null&&i.subGrid?[e.querySelector(n.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return!1;const n=e.closest(".grid-stack-item");return n===this.el||!n})}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Fn&&(e.addEventListener("touchstart",Qa),e.addEventListener("pointerdown",nl))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),Fn&&(n.removeEventListener("touchstart",Qa),n.removeEventListener("pointerdown",nl))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(yn.touchHandled&&e.isTrusted&&(yn.touchHandled=!1),!xe.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(_A)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete xe.dragElement,delete xe.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(e.currentTarget.addEventListener("touchmove",el),e.currentTarget.addEventListener("touchend",tl)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),xe.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=D.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){var r;const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),xe.pauseDrag){const i=Number.isInteger(xe.pauseDrag)?xe.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,xe.dragElement=this;const i=(r=this.el.gridstackNode)==null?void 0:r.grid;i?xe.dropElement=i.el.ddElement.ddDroppable:delete xe.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=D.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=D.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var n,r;if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",el,!0),e.currentTarget.removeEventListener("touchend",tl,!0)),this.dragging){delete this.dragging,(n=this.el.gridstackNode)==null||delete n._origRotate,document.removeEventListener("keydown",this._keyEvent),((r=xe.dropElement)==null?void 0:r.el)===this.el.parentElement&&delete xe.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const i=D.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),xe.dropElement&&xe.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete xe.dragElement,delete xe.dropElement,delete xe.mouseHandled,e.preventDefault()}_keyEvent(e){var i,s;const n=this.el.gridstackNode,r=(n==null?void 0:n.grid)||((s=(i=xe.dropElement)==null?void 0:i.el)==null?void 0:s.gridstack);if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),r==null||r.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&r&&(e.key==="r"||e.key==="R")){if(!D.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,r.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",D.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=D.cloneNode(this.el)),e.parentElement||D.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ho.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",ho.originStyleProp.forEach(a=>s.style[a]=this.dragElementOriginStyle[a]||null),setTimeout(()=>s.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n=this.helper.style,r=this.dragOffset;this.option.rtl?(n.right=(window.innerWidth-e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.left&&(n.left="")):(n.left=(e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.right&&(n.right="")),n.top=(e.clientY+r.offsetTop)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,r){let i=0,s=0;r&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const o=n.getBoundingClientRect();let a=this.option.rtl?o.right:o.left,l=this.option.rtl?e.clientX-o.right+i:-e.clientX+o.left-i;return{x:a,top:o.top,offsetX:l,offsetTop:-e.clientY+o.top-s,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=D.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick))}_getClipping(e,n){const r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight;if(r.bottom<i.top||r.top>i.bottom)return 0;const o=r.bottom-Math.min(i.bottom,s),a=r.top-Math.max(i.top,0);return a<0?a:o>0?o:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId)}ui(){const n=this.el.parentElement.getBoundingClientRect(),r=this.helper.getBoundingClientRect(),i=this.option.rtl?(n.right-r.right)*this.dragTransform.xScale:(r.left-n.left)*this.dragTransform.xScale;return{position:{top:(r.top-n.top)*this.dragTransform.yScale,left:i}}}}ho.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class wA extends Id{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.addEventListener("pointerenter",Uh),this.el.addEventListener("pointerleave",jh)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.removeEventListener("pointerenter",Uh),this.el.removeEventListener("pointerleave",jh)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!xe.dragElement||yn.touchHandled&&e.isTrusted||!this._canDrop(xe.dragElement.el))return;e.preventDefault(),e.stopPropagation(),xe.dragElement._stopScrolling(),xe.dropElement&&xe.dropElement!==this&&xe.dropElement._mouseLeave(e,!0),xe.dropElement=this;const n=D.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(xe.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){var i;if(!xe.dragElement||xe.dropElement!==this)return;e.preventDefault(),e.stopPropagation(),n&&xe.dragElement._stopScrolling();const r=D.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(r,this._ui(xe.dragElement)),this.triggerEvent("dropout",r),xe.dropElement===this&&(delete xe.dropElement,!n)){let s,o=this.el.parentElement;for(;!s&&o;)s=(i=o.ddElement)==null?void 0:i.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const n=D.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(xe.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Ld{static init(e){return e.ddElement||(e.ddElement=new Ld(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 ho(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 fo(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 wA(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class yA{resizable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddResizable&&s.ddResizable[n]();else if(n==="destroy")s.ddResizable&&s.cleanResizable();else if(n==="option")s.setupResizable({[r]:i});else{const a=s.el.gridstackNode.grid;let l=s.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;s.setupResizable({...a.opts.resizable,handles:l,autoHide:c,start:n.start,stop:n.stop,resize:n.resize,rtl:n.rtl})}}),this}draggable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddDraggable&&s.ddDraggable[n]();else if(n==="destroy")s.ddDraggable&&s.cleanDraggable();else if(n==="option")s.setupDraggable({[r]:i});else{const o=s.el.gridstackNode.grid;s.setupDraggable({...o.opts.draggable,start:n.start,stop:n.stop,drag:n.drag,rtl:n.rtl})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(r=>r.setupDraggable(n)),this}droppable(e,n,r,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=s=>n._accept(s)),this._getDDElements(e,n).forEach(s=>{n==="disable"||n==="enable"?s.ddDroppable&&s.ddDroppable[n]():n==="destroy"?s.ddDroppable&&s.cleanDroppable():n==="option"?s.setupDroppable({[r]:i}):s.setupDroppable(n)}),this}isDroppable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,r){return this._getDDElements(e).forEach(i=>i.on(n,s=>{r(s,xe.dragElement?xe.dragElement.el:s.target,xe.dragElement?xe.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(r=>r.off(n)),this}_getDDElements(e,n){const r=e.gridstack||n!=="destroy"&&n!=="disable",i=D.getElements(e);return i.length?i.map(o=>o.ddElement||(r?Ld.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 en=new yA;class Ee{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const r=Ee.getGridElement(n);return r?(r.gridstack||(r.gridstack=new Ee(r,D.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"||(Ee.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new Ee(i,D.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")||Ee.addRemoveCB)&&(Ee.addRemoveCB?r=Ee.addRemoveCB(e,n,!0,!0):r=D.createDiv(["grid-stack",n.class],e)),Ee.init(n,r)}static registerEngine(e){Ee.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=D.createDiv([this.opts.placeholderClass,vn.itemClass,this.opts.itemClass]);const e=D.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=D.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((d,h)=>(h.w||0)-(d.w||0)))}const s={...D.cloneDeep(vn),column:D.toNumber(e.getAttribute("gs-column"))||vn.column,minRow:r||D.toNumber(e.getAttribute("gs-min-row"))||vn.minRow,maxRow:r||D.toNumber(e.getAttribute("gs-max-row"))||vn.maxRow,staticGrid:D.toBool(e.getAttribute("gs-static"))||vn.staticGrid,sizeToContent:D.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||vn.draggable.handle},removableOptions:{accept:n.itemClass||vn.removableOptions.accept,decline:vn.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=D.toBool(e.getAttribute("gs-animate"))),n=D.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("."+vn.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!==vn.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=Fn),this._setStaticClass();const l=n.engineClass||Ee.engineClass||br;if(this.engine=new l({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:u=>{u.forEach(d=>{const h=d.el;h&&(d._removeDOM?(h&&h.remove(),delete d._removeDOM):this._writePosAttr(h,d))}),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&&!xe.pauseDrag&&(xe.pauseDrag=!0),((c=n.draggable)==null?void 0:c.pause)!==void 0&&(xe.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:Ee.addRemoveCB?n=Ee.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 D.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=D.createDiv(["grid-stack-item",this.opts.itemClass]),r=D.createDiv(["grid-stack-item-content"],n);return D.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{var s,o;i.isIntersecting&&((s=e.visibleObservable)==null||s.disconnect(),delete e.visibleObservable,Ee.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)})):Ee.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=D.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,d;if(i&&(this._removeDD(s.el),d={...s,x:0,y:0},D.removeInternalForSave(d),delete d.subGridOpts,s.content&&(d.content=s.content,delete s.content),Ee.addRemoveCB?u=Ee.addRemoveCB(this.el,d,!0,!1):(u=D.createDiv(["grid-stack-item"]),u.appendChild(c),c=D.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),r){const b=l?n.column:s.w,E=s.h+r.h,M=s.el.style;M.transition="none",this.update(s.el,{w:b,h:E}),setTimeout(()=>M.transition=null)}const h=s.subGrid=Ee.addGrid(c,n);return r!=null&&r._moving&&(h._isTemp=!0),l&&(h._autoColumn=!0),i&&h.makeWidget(u,d),r&&(r._moving?window.setTimeout(()=>D.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(()=>D.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,r=Ee.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=D.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,D.removeInternalAndSame(o,vn),o.children=s,o}return s}load(e,n=Ee.addRemoveCB||!0){e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=D.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=Ee.addRemoveCB;typeof n=="function"&&(Ee.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(d=>{if(!d.id)return;D.find(e,d.id)||(Ee.addRemoveCB&&Ee.addRemoveCB(this.el,d,!1,!1),o.push(d),this.removeWidget(d.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>D.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{var h;const d=D.find(c,u.id);if(d){if(D.shouldSizeToContent(d)&&(u.h=d.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||d.w,u.h=u.h||d.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(d),D.samePos(d,u)&&this.engine.nodes.length>1&&(this.moveNode(d,{...u,forceCollide:!0}),D.copyPos(u,d)),this.update(d.el,u),(h=u.subGridOpts)!=null&&h.children){const p=d.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?Ee.addRemoveCB=s:delete Ee.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=D.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=D.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=Ee.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?(Ee.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&&Ee.addRemoveCB&&Ee.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&&Ee.addRemoveCB&&Ee.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 Ee.getElements(e).forEach(r=>{var u;const i=r==null?void 0:r.gridstackNode;if(!i)return;const s={...D.copyPos({},i),...D.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const o=["x","y","w","h"];let a;if(o.some(d=>s[d]!==void 0&&s[d]!==i[d])&&(a={},o.forEach(d=>{a[d]=s[d]!==void 0?s[d]:i[d],delete s[d]})),!a&&(s.minW||s.minH||s.maxW||s.maxH)&&(a={}),s.content!==void 0){const d=r.querySelector(".grid-stack-item-content");d&&d.textContent!==s.content&&(i.content=s.content,Ee.renderCB(d,s),(u=i.subGrid)!=null&&u.el&&(d.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete s.content}let l=!1,c=!1;for(const d in s)d[0]!=="_"&&i[d]!==s[d]&&(i[d]=s[d],l=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(D.sanitizeMinMax(i),a){const d=a.w!==void 0&&a.w!==i.w;this.moveNode(i,a),d&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(d,i),delete i._orig}(a||l)&&this._writeAttr(r,i),c&&this.prepareDragDrop(i.el),Ee.updateCB&&Ee.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(Ee.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} '${Ee.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 d=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;d&&u>d&&(u=d,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){Ee.resizeToContentCB?Ee.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return Ee.getElements(e).forEach(r=>{const i=r.gridstackNode;if(!D.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=D.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=D.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&&D.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(vn.itemClass,this.opts.itemClass);const i=D.shouldSizeToContent(r);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,r),D.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=D.toNumber(e.getAttribute("gs-x")),r.y=D.toNumber(e.getAttribute("gs-y")),r.w=D.toNumber(e.getAttribute("gs-w")),r.h=D.toNumber(e.getAttribute("gs-h")),r.autoPosition=D.toBool(e.getAttribute("gs-auto-position")),r.noResize=D.toBool(e.getAttribute("gs-no-resize")),r.noMove=D.toBool(e.getAttribute("gs-no-move")),r.locked=D.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?r.sizeToContent=D.toBool(i):r.sizeToContent=parseInt(i,10)),r.id=e.getAttribute("gs-id"),r.maxW=D.toNumber(e.getAttribute("gs-max-w")),r.minW=D.toNumber(e.getAttribute("gs-min-w")),r.maxH=D.toNumber(e.getAttribute("gs-max-h")),r.minH=D.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)D.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(r=>D.shouldSizeToContent(r))){const r=[...this.engine.nodes];this.batchUpdate(),r.forEach(i=>{D.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=D.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 D.getElement(e)}static getElements(e=".grid-stack-item"){return D.getElements(e)}static getGridElement(e){return Ee.getElement(e)}static getGridElements(e){return D.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=D.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=D.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 en}static setupDragIn(e,n,r,i=document){(n==null?void 0:n.pause)!==void 0&&(xe.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?D.getElements(e,i):e).forEach((o,a)=>{en.isDraggable(o)||en.dragIn(o,n),r!=null&&r[a]&&(o.gridstackNode=r[a])})}movable(e,n){return this.opts.staticGrid?this:(Ee.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:(Ee.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&&Ee._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return en.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 en.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 d={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)){en.off(s,"drag");return}a._willFitPos&&(D.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(o,i,d,a,n,e)}else this._dragOrResize(o,i,d,a,n,e)};return en.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),Ee._itemRemoving(a.el,!1),en.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,en.off(s,"drag"),o!==s?(o.remove(),s=o):s.remove(),this._removeDD(s),!l))return!1;const d=(g=(p=a.subGrid)==null?void 0:p.el)==null?void 0:g.gridstack;return D.copyPos(a,this._readAttr(this.placeholder)),D.removePositioningStyles(s),c&&(a.content||a.subGridOpts||Ee.addRemoveCB)?(delete a.el,s=this.addWidget(a)):(this._prepareElement(s,!0,a),this.el.appendChild(s),this.resizeToContentCheck(!1,a),d&&(d.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&&!en.isDroppable(e)&&en.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,r)=>Ee._itemRemoving(r,!0)).on(e,"dropout",(n,r)=>Ee._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)},d=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 D.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))}};en.draggable(e,{start:c,stop:d,drag:u,rtl:this.opts.rtl}).resizable(e,{start:c,stop:d,resize:u,rtl:this.opts.rtl}),r._initDD=!0}return en.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=D.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=D.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;en.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 b;const a={...i._orig};let l,c=this.opts.marginLeft,u=this.opts.marginRight,d=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),d=Math.min(d,p),h=Math.min(h,p),n.type==="drag"){if(i._temporaryRemoved)return;i._prevYPix=r.position.top,this.opts.draggable.scroll!==!1&&((b=xe.dragElement)==null||b.updateScrollPosition(this.el));const E=r.position.left+(r.position.left>i._lastUiPosition.left?-u:c),M=r.position.top+(r.position.top>i._lastUiPosition.top?-h:d);a.x=Math.round(E/s),a.y=Math.round(M/o);const z=this._extraDragRow;if(this.engine.collide(i,a)){const R=this.getRow();let A=Math.max(0,a.y+i.h-R);this.opts.maxRow&&R+A>this.opts.maxRow&&(A=Math.max(0,this.opts.maxRow-R)),this._extraDragRow=A}else this._extraDragRow=0;if(this._extraDragRow!==z&&this._updateContainerHeight(),i.x===a.x&&i.y===a.y)return}else if(n.type==="resize"){if(a.x<0||(D.updateScrollResize(n,e,o),a.w=Math.round((r.size.width-c)/s),a.h=Math.round((r.size.height-d)/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 E=r.position.left+c;a.x=Math.round(E/s)}if(n.hasMovedY){const E=r.position.top+d;a.y=Math.round(E/o)}l=!0}i._event=n,i._lastTried=a;const m={x:r.position.left+c,y:r.position.top+d,w:(r.size?r.size.width:i.w*s)-c-u,h:(r.size?r.size.height:i.h*o)-d-h};if(this.engine.moveNodeCheck(i,{...a,cellWidth:s,cellHeight:o,rect:m,resizing:l})){i._lastUiPosition=r.position,this.engine.cacheRects(s,o,d,u,h,c),delete i._skipDown,l&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const E=n.target;i._sidebarOrig||this._writePosAttr(E,i),this.triggerEvent(n,E)}}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,en.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&&Ee._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):r._isExternal&&this.engine.restoreInitial()}}Ee.renderCB=(t,e)=>{t&&(e!=null&&e.content)&&(t.textContent=e.content)};Ee.resizeToContentParent=".grid-stack-item-content";Ee.Utils=D;Ee.Engine=br;Ee.GDRev="12.6.0";function Uv(t){return{...t,w:Math.max(t.w,t.minW??t.w),h:Math.max(t.h,t.minH??t.h)}}const Dd="mndw:dashboard:grid-layout",EA=/^widget-(.+):([1-9]\d*)$/;function wi(t){const e=EA.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 jv(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 kA(t){return jv(t)?{id:t.id,x:t.x,y:t.y,w:t.w,h:t.h}:null}function Fh(){try{localStorage.removeItem(Dd)}catch(t){console.error("[mndw] Failed to clear dashboard layout:",t)}}function SA(t,e){const n=wi(t),r=wi(e);return n===null||r===null?t.localeCompare(e):n.pluginName.localeCompare(r.pluginName)||n.counter-r.counter}function xA(t){return[...t].sort((e,n)=>e.y-n.y||e.x-n.x||SA(e.id,n.id)).map(e=>e.id)}function TA(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 xA(e))r.has(s)||(r.add(s),i.push(s));return i}function CA(t,e){const n=Uv(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 PA(t,e){const n=new Set,r=[];for(const i of t){if(!jv(i)||n.has(i.id))continue;const s=wi(i.id);if(s===null)continue;const o=e(s.pluginName);if(o===void 0)continue;const a=Math.min(Math.max(i.w,o.minW??1),12),l=Math.max(i.h,o.minH??1);n.add(i.id),r.push({id:i.id,x:Math.min(i.x,12-a),y:i.y,w:a,h:l})}return r}function RA(t){return typeof t=="object"&&t!==null&&!("version"in t)&&Array.isArray(t.tiles)}function AA(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(Dd,JSON.stringify(e))}catch(n){console.error("[mndw] Failed to save dashboard layout:",n)}}function MA(t){let e;try{e=localStorage.getItem(Dd)}catch(i){return console.error("[mndw] Failed to load dashboard layout:",i),null}if(e===null)return null;let n;try{n=JSON.parse(e)}catch(i){return console.warn("[mndw] Failed to parse dashboard layout, discarding:",i),Fh(),null}if(!RA(n))return console.warn("[mndw] Malformed dashboard layout, discarding"),Fh(),null;const r=PA(n.tiles,t);return{tiles:r,mobileOrder:TA(n.mobileOrder,r)}}var NA=I('<div class="mndw-grid-scroll mndw-scrollbar"><div class="grid-stack"></div></div>');function OA(t,e){Ie(e,!0);let n;const r=12,i="mndw-grid-resize-indicator",s=`.${i}`;function o(d){const h=d.gridstackNode;return h===void 0||!Number.isInteger(h.w)||!Number.isInteger(h.h)?null:{w:h.w,h:h.h}}function a(d){var h;(h=d.querySelector(s))==null||h.remove()}function l(d){const h=o(d);if(h===null){a(d);return}let p=d.querySelector(s);p===null&&(p=document.createElement("div"),p.className=i,p.setAttribute("aria-hidden","true"),d.appendChild(p)),p.textContent=`${h.w} × ${h.h}`}kn(()=>{const d=Ee.init({column:r,animate:!0,float:!1,cellHeight:60,margin:10,draggable:{handle:".mndw-grid-tile__title"},resizable:{handles:"se"}},n);d.on("removed",(p,g)=>{for(const m of g)typeof m.id=="string"&&e.onWidgetRemoved(m.id)});const h=()=>{const p=d.save(!1,!1,(m,b)=>{b.x??(b.x=m.x),b.y??(b.y=m.y),b.w??(b.w=m.w),b.h??(b.h=m.h)}),g=Array.isArray(p)?p.map(kA).filter(m=>m!==null):[];e.onLayoutChanged(g)};return d.on("added",h),d.on("change",h),d.on("resizestart",(p,g)=>{l(g)}),d.on("resize",(p,g)=>{l(g)}),d.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(d),()=>{d.off("removed"),d.off("added"),d.off("change"),d.off("resizestart"),d.off("resize"),d.off("resizestop"),n.querySelectorAll(s).forEach(p=>{p.remove()}),d.destroy(!1),e.onGridDestroyed()}});var c=NA(),u=v(c);rs(u,d=>n=d,()=>n),C(t,c),Le()}const yr=(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=Dc(t,s))}):n=Dc(t,s):!r&&n&&(n.deactivate(),n=null)};return o(e),{update:o,destroy(){i=!0,n==null||n.deactivate(),n=null}}},Au=Symbol("mndw.host-services");function zA(t){p_(Au,t)}function Ar(){if(!g_(Au))throw new Error("Host services context was not set");return h_(Au)}var IA=I('<p class="mndw-floating-panel__empty"> </p>'),LA=I('<span class="mndw-floating-panel__deps"> </span>'),DA=I('<span class="mndw-floating-panel__deps mndw-floating-panel__deps--failed"> </span>'),HA=I("<mndw-button> <!></mndw-button>",2),BA=I('<div class="mndw-floating-panel-backdrop" role="presentation"><div class="mndw-floating-panel" role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="add-widget-title"><div class="mndw-floating-panel__header"><h3 id="add-widget-title"> </h3> <mndw-button><mndw-icon></mndw-icon></mndw-button></div> <!></div></div>',2);function $A(t,e){Ie(e,!0);const r=Ar().registry;let i=fe(()=>[...r.getWidgets()].sort((d,h)=>d.entry.label.localeCompare(h.entry.label)||d.entry.name.localeCompare(h.entry.name))),s=[],o=Y(void 0);function a(d){d.key==="Escape"&&e.onClose()}var l=En(),c=Xe(l);{var u=d=>{var h=BA(),p=v(h),g=v(p),m=v(g),b=v(m),E=T(m,2);P(E,"variant","ghost"),Oe(E,1,"mndw-floating-panel__close"),y(()=>P(E,"aria-label",w("common.close")));var M=v(E);P(M,"name","x");var z=T(g,2);{var R=x=>{var N=IA(),O=v(N);y(j=>S(O,j),[()=>w("dashboard.no-widgets")]),C(x,N)},A=x=>{var N=En(),O=Xe(N);ht(O,19,()=>f(i),j=>j.entry.name,(j,B,J)=>{const W=fe(()=>Go(f(B).entry.name));var H=HA();P(H,"variant","secondary");var ee=v(H),oe=T(ee);{var q=ne=>{var le=LA(),se=v(le);y(ue=>S(se,ue),[()=>w("dashboard.preparing")]),C(ne,le)},K=ne=>{var le=DA(),se=v(le);y(ue=>S(se,ue),[()=>w("dashboard.unavailable")]),C(ne,le)};Z(oe,ne=>{f(W)==="installing"?ne(q):f(W)==="failed"&&ne(K,1)})}rs(H,(ne,le)=>s[le]=ne,ne=>s==null?void 0:s[ne],()=>[f(J)]),y(()=>S(ee,`${f(B).entry.label??""} `)),pe("click",H,()=>e.onAddWidget(f(B).entry.name)),C(j,H)}),C(x,N)};Z(z,x=>{f(i).length===0?x(R):x(A,-1)})}rs(p,x=>_(o,x),()=>f(o)),Qr(p,(x,N)=>yr==null?void 0:yr(x,N),()=>({initialFocus:()=>{var x;return s[0]??((x=f(o))==null?void 0:x.querySelector(".mndw-floating-panel__close"))??null}})),y(x=>{Ae(p,"data-locale",me.locale),S(b,x)},[()=>w("dashboard.add-widget")]),pe("click",h,function(...x){var N;(N=e.onClose)==null||N.apply(this,x)}),pe("click",p,x=>x.stopPropagation()),pe("keydown",p,a),pe("click",E,function(...x){var N;(N=e.onClose)==null||N.apply(this,x)}),C(d,h)};Z(c,d=>{e.open&&d(u)})}C(t,l),Le()}lt(["click","keydown"]);class Gh{constructor(e){F(this,"prefix");this.prefix=e}async get(e){return Promise.resolve(localStorage.getItem(this.prefix+e))}async set(e,n){return localStorage.setItem(this.prefix+e,n),Promise.resolve()}async delete(e){return 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)}}function UA(t,e){const n=`${Xa}:${t}:instance:${e}:`,r=[];for(let i=0;i<localStorage.length;i++){const s=localStorage.key(i);s!=null&&s.startsWith(n)&&r.push(s)}for(const i of r)localStorage.removeItem(i)}function jA(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 Fv(t){if(t===null||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(const e of Object.values(t))Fv(e);return Object.freeze(t)}function FA(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 Fv(a)}const GA=()=>new Worker(new URL("/assets/ticker-pool.worker-DJA1ERT2.js",import.meta.url),{type:"module"});function VA(t=GA){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 Cb,running:!1,destroyed:!1,interval:1e3};e.set(c.id,c);const u=new Pb,d=()=>{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(d)),{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:d}}})}const ZA=VA();let WA=0;const qA=()=>{const t=globalThis.crypto;return(t==null?void 0:t.randomUUID)!==void 0?t.randomUUID():`event-context-${++WA}`};function XA(t){const{routes:e}=t.backend;if(Object.keys(e??{}).length===0)return;const n={routes:e??{},approval:t.approval,enabled:t.enabled};return Y2(t.name,n)}function Hd(t){var O,j,B,J,W;const{entry:e,instanceId:n,deviceInfo:r,setTileTitle:i,pageRoute:s,catalogCell:o}=t,a=((O=t.services)==null?void 0:O.locale)===void 0?ls:()=>{var H,ee;return((ee=(H=t.services)==null?void 0:H.locale)==null?void 0:ee.getLocale())??ls()},l=((j=t.services)==null?void 0:j.locale)===void 0?H=>ku(()=>H()):H=>{var ee,oe;return((oe=(ee=t.services)==null?void 0:ee.locale)==null?void 0:oe.subscribeLocale(()=>H()))??(()=>{})},c=((B=t.services)==null?void 0:B.palette)===void 0?Bh:()=>{var H,ee;return((ee=(H=t.services)==null?void 0:H.palette)==null?void 0:ee.getTokens())??Bh()},u=((J=t.services)==null?void 0:J.telemetry)??uo().telemetry,d=((W=t.services)==null?void 0:W.eventStream)??uo().eventStream;if(e.type==="page"&&s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);const h=rC(),p=Rc(Ya,Ev,h),g=Rc(a,H=>{var ee;return((ee=t.services)==null?void 0:ee.locale)===void 0?ku(H):t.services.locale.subscribeLocale(H)},h),m=Rc(c,H=>{var ee;return((ee=t.services)==null?void 0:ee.palette)===void 0?NR(H):t.services.palette.subscribePalette(H)},h),{service:b,dispose:E}=Ad(e.name,n),M=qA(),z=d.createFacade(M,e.name,e.permissions??[],h);let R=!1;const A=H=>{R||(R=!0,h.end(),z!==void 0&&d.disposeFacade(M),E(H))},x=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},N={telemetry:u,events:z,rciManager:jA(zd.driver,XP),storage:new Gh(`${Xa}:${e.name}:instance:${n}:`),sharedStorage:new Gh(`${Xa}:${e.name}:shared:`),deviceInfo:FA(r),i18n:EC(o,a,l,h),instanceId:n,createTicker:()=>ZA.create(h),backend:XA(e),overlay:b,...x,get theme(){return Ya()},theme$:p,get locale(){return a()},locale$:g,get palette(){return c()},palette$:m};return Object.setPrototypeOf(N,null),{context:Object.freeze(N),dispose:A}}function Gv(t,e,n,r,i,s){me.hostInfo;const o=me.deviceInfo??xd,a=e.get(n);if(!a)throw new Error(`No loaded plugin "${n}"`);return Hd({entry:a.entry,instanceId:r,deviceInfo:o,setTileTitle:s,catalogCell:a.catalog,services:t})}function YA(t){return t===null||typeof t!="object"&&typeof t!="function"?!1:typeof t.then=="function"}function Vv(t,e,n,r,i){const s=e.entry.name;try{const o=e.module.createInstance(t,n);return YA(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 rl(t,e,n){var r,i;if(!t){e.innerHTML="";return}try{(r=t.disposeOverlayService)==null||r.call(t,(n==null?void 0:n.closeReason)??"plugin-unmount")}catch(s){console.error(`[mndw] Plugin "${t.pluginName}" overlay teardown failed:`,s)}try{(i=t.instance.unmount())==null||i.catch(s=>{console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,s)})}catch(s){console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,s)}(n==null?void 0:n.clearStorage)!==!1&&UA(t.pluginName,t.instanceId),e.innerHTML=""}function Bd(t,e,n){let r=null,i=!1,s;const o=Vv(t,e,n.context,n.dispose,{errorText:"Error loading widget"});let a;return o instanceof Promise?a=o.then(l=>(r=l,i&&(rl(r,t,s),r=null),l!==null)):(r=o,a=Promise.resolve(o!==null)),{getMounted:()=>r,whenReady:()=>a,dispose(l){i||(i=!0,s=l,r&&(rl(r,t,l),r=null))}}}const Cr=new Map;function KA(){return{getMounted:()=>null,whenReady:()=>Promise.resolve(!1),dispose:()=>{}}}function Zv(t,e){t.textContent="";const n=document.createElement("div");n.className=`mndw-grid-tile__notice mndw-grid-tile__notice--${e}`,n.textContent=An(e==="installing"?"dashboard.preparing-dependencies":"dashboard.dependency-install-failed"),t.appendChild(n)}function JA(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",An("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 d=r.getAttribute("data-manifest-label")??t,h=u||d;i=h,r.textContent=h,s.setAttribute("aria-label",An("dashboard.remove-widget",{label:d}))},c=()=>i;return n.append(r,s,a),{frame:n,body:a,setTileTitle:l,getTileTitle:c}}function Bl(t,e,n,r,i){const s=`widget-${r}`,o=Cr.get(s);if(o!==void 0)return o;const a=e.get(n);if((a==null?void 0:a.entry.type)!=="widget")return null;const{frame:l,body:c,setTileTitle:u,getTileTitle:d}=JA(a.entry.label,()=>i(s)),h=Go(n);let p;h==="ready"?p=Bd(c,a,Gv(t,e,n,r,void 0,u)):(Zv(c,h),p=KA());const g={id:s,pluginName:n,instanceId:r,frame:l,body:c,handle:p,setTileTitle:u,getTileTitle:d,pending:h==="installing"};return Cr.set(s,g),g}function $d(t){return Cr.get(t)}function Wv(t,e){for(const n of Cr.values()){if(!n.pending)continue;const r=Go(n.pluginName);if(r==="installing")continue;if(r==="failed"){Zv(n.body,"failed"),n.pending=!1;continue}const i=e.get(n.pluginName);if((i==null?void 0:i.entry.type)!=="widget"){n.pending=!1;continue}n.body.textContent="",n.handle=Bd(n.body,i,Gv(t,e,n.pluginName,n.instanceId,void 0,n.setTileTitle)),n.pending=!1}}function qv(t){const e=Cr.get(t);e!==void 0&&(Cr.delete(t),e.frame.remove(),e.handle.dispose({clearStorage:!0,closeReason:"plugin-unmount"}))}function QA(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",An("dashboard.remove-widget",{label:e}))}async function eM(t,e,n,r,i){const s=[...Cr.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(d=>{QA(d.frame,u.entry.label),d.setTileTitle(""),me.hostInfo;const h=me.deviceInfo??xd;return d.handle=Bd(d.body,u,Hd({entry:u.entry,instanceId:d.instanceId,deviceInfo:h,setTileTitle:d.setTileTitle,catalogCell:u.catalog,services:t})),d.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 Xv(t="plugin-unmount"){for(const[e,n]of Cr)try{n.handle.dispose({clearStorage:!1,closeReason:t})}catch(r){console.error(`[mndw] Failed to unmount tile ${e}:`,r)}Cr.clear()}const tM=Object.freeze(Object.defineProperty({__proto__:null,destroyAllTiles:Xv,ensureTileController:Bl,getTileController:$d,hydratePendingTiles:Wv,remountWidgetTiles:eM,removeTileController:qv},Symbol.toStringTag,{value:"Module"}));var nM=I('<div class="mndw-mobile-tile"></div>'),rM=I('<div class="mndw-mobile-dashboard mndw-scrollbar"></div>');function iM(t,e){Ie(e,!0);const n=Ar(),r=n.registry,i={locale:n.locale,palette:n.palette,telemetry:n.telemetry,eventStream:n.eventStream};function s(a,l){const c=wi(l);if(c===null){a.remove();return}const u=Bl(i,r,c.pluginName,`${c.pluginName}:${c.counter}`,e.onRemoveRequest);if(u===null){a.remove();return}a.appendChild(u.frame)}var o=rM();ht(o,20,()=>e.order,a=>a,(a,l)=>{var c=nM();Qr(c,(u,d)=>s==null?void 0:s(u,d),()=>l),C(a,c)}),C(t,o),Le()}var sM=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),oM=I('<div class="mndw-floating-panel-backdrop" role="presentation"><div class="mndw-floating-panel mndw-order-overlay" role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="arrange-widgets-title"><div class="mndw-floating-panel__header"><h3 id="arrange-widgets-title"> </h3> <mndw-button><mndw-icon></mndw-icon></mndw-button></div> <ul class="mndw-order-overlay__list"></ul></div></div>',2);function aM(t,e){Ie(e,!0);let n=Y(st([])),r=Y(null),i=st([]);hn(()=>{e.open&&(_(n,e.cards.map(g=>({...g})),!0),_(r,null))});function s(){e.onCommit(f(n).map(g=>g.id))}function o(g,m){const b=g+m;if(b<0||b>=f(n).length)return;const E=[...f(n)],[M]=E.splice(g,1);M!==void 0&&(E.splice(b,0,M),_(n,E,!0))}function a(g){g.key==="Escape"&&s()}function l(g,m){var b,E;_(r,m,!0),(E=(b=g.currentTarget).setPointerCapture)==null||E.call(b,g.pointerId)}function c(g){var b;const m=f(r);if(m!==null)for(let E=0;E<f(n).length;E+=1){if(E===m)continue;const M=(b=i[E])==null?void 0:b.getBoundingClientRect();if(M!==void 0&&g.clientY>=M.top&&g.clientY<=M.bottom){o(m,E-m),_(r,E,!0);return}}}function u(){_(r,null)}var d=En(),h=Xe(d);{var p=g=>{var m=oM(),b=v(m),E=v(b),M=v(E),z=v(M),R=T(M,2);P(R,"variant","ghost"),Oe(R,1,"mndw-floating-panel__close"),y(()=>P(R,"aria-label",w("common.close")));var A=v(R);P(A,"name","x");var x=T(E,2);ht(x,23,()=>f(n),N=>N.id,(N,O,j)=>{var B=sM();let J;var W=v(B),H=v(W);P(H,"name","menu");var ee=T(W,2),oe=v(ee),q=T(ee,2),K=v(q);P(K,"variant","ghost"),y(()=>P(K,"disabled",f(j)===0)),y(()=>P(K,"aria-label",w("dashboard.move-up",{label:f(O).label})));var ne=v(K);P(ne,"name","arrow-up");var le=T(K,2);P(le,"variant","ghost"),y(()=>P(le,"disabled",f(j)===f(n).length-1)),y(()=>P(le,"aria-label",w("dashboard.move-down",{label:f(O).label})));var se=v(le);P(se,"name","arrow-down"),rs(B,(ue,De)=>i[De]=ue,ue=>i==null?void 0:i[ue],()=>[f(j)]),y(()=>{J=Oe(B,1,"mndw-order-card",null,J,{"mndw-order-card--dragging":f(r)===f(j)}),S(oe,f(O).label)}),pe("pointerdown",W,ue=>l(ue,f(j))),pe("pointermove",W,c),pe("pointerup",W,u),pe("click",K,()=>o(f(j),-1)),pe("click",le,()=>o(f(j),1)),C(N,B)}),Qr(b,N=>yr==null?void 0:yr(N)),y(N=>{Ae(b,"data-locale",me.locale),S(z,N)},[()=>w("dashboard.arrange-widgets")]),pe("click",m,s),pe("click",b,N=>N.stopPropagation()),pe("keydown",b,a),pe("click",R,s),C(g,m)};Z(h,g=>{e.open&&g(p)})}C(t,d),Le()}lt(["click","keydown","pointerdown","pointermove","pointerup"]);const po=new Map;function Yv(t){return`${Xa}:${t}:counter`}function Kv(t){return Number.isSafeInteger(t)&&t>=0}function lM(t){try{const e=localStorage.getItem(Yv(t));if(e===null||e.trim()==="")return 0;const n=Number(e);return Kv(n)?(po.set(t,Math.max(po.get(t)??0,n)),n):0}catch(e){return console.error(`[mndw] Failed to read widget counter for "${t}":`,e),0}}function Jv(t){return Math.max(lM(t),po.get(t)??0)}function Qv(t,e){try{localStorage.setItem(Yv(t),String(e))}catch(n){console.error(`[mndw] Failed to write widget counter for "${t}":`,n)}}function eb(t){const e=Jv(t);if(e===Number.MAX_SAFE_INTEGER)throw new RangeError(`Widget instance counter exhausted for "${t}"`);const n=e+1;return po.set(t,n),Qv(t,n),`${t}:${n}`}function cM(t,e){if(!Kv(e)){console.error(`[mndw] Ignoring invalid restored widget counter for "${t}":`,e);return}e>Jv(t)&&(po.set(t,e),Qv(t,e))}function Vh(t,e,n,r,i,s){const o=e.get(r);if((o==null?void 0:o.entry.type)!=="widget")return null;const a=(s==null?void 0:s.instanceId)??eb(r),l=Bl(t,e,r,a,i);if(l===null)return null;const c=Uv(o.entry.size),u=n.addWidget({id:l.id,x:s==null?void 0:s.x,y:s==null?void 0:s.y,w:(s==null?void 0:s.w)??c.w,h:(s==null?void 0:s.h)??c.h,minW:c.minW,minH:c.minH}),d=u.querySelector(".grid-stack-item-content");return d===null?(n.removeWidget(u,!0),null):(d.appendChild(l.frame),n.prepareDragDrop(u,!0),l.id)}function uM(t,e){var i;const n=$d(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)}}var dM=I("<mndw-button> </mndw-button>",2),fM=I("<mndw-button> </mndw-button> <!>",3),hM=I('<span class="mndw-dashboard__toolbar--empty"> </span>'),pM=I('<div class="mndw-dashboard__grid-wrapper"><!></div>'),gM=I('<div class="mndw-dashboard-page"><div class="mndw-dashboard__toolbar"><!></div> <!></div> <!> <!>',1);function Zh(t,e){Ie(e,!0);const n=500,r=Ar(),i=r.registry,s={locale:r.locale,palette:r.palette,telemetry:r.telemetry,eventStream:r.eventStream};function o(ce){const ae=i.get(ce);return(ae==null?void 0:ae.entry.type)==="widget"?ae.entry.size:void 0}const a=wl();let l=Y(null),c=Y(!1),u=Y(!1),d=Y(st(a.matches)),h=Y(st([])),p=Y(st([])),g=!1,m,b=null;{const ce=MA(o);if(ce!==null){_(h,ce.tiles,!0),_(p,ce.mobileOrder,!0);const ae=new Map;for(const U of ce.tiles){const re=wi(U.id);re!==null&&ae.set(re.pluginName,Math.max(ae.get(re.pluginName)??0,re.counter))}for(const[U,re]of ae)cM(U,re)}}function E(ce={tiles:Xo(f(h)),mobileOrder:Xo(f(p))}){clearTimeout(m),b=null,AA(ce)}function M(){clearTimeout(m),b={tiles:Xo(f(h)),mobileOrder:Xo(f(p))},m=setTimeout(()=>{b!==null&&E(b)},n)}function z(ce){qv(ce),_(h,f(h).filter(ae=>ae.id!==ce),!0),_(p,f(p).filter(ae=>ae!==ce),!0),E()}function R(ce){const ae=f(l);if(!f(d)&&ae!==null){const U=ae.getGridItems().find(re=>{var X;return((X=re.gridstackNode)==null?void 0:X.id)===ce});if(U!==void 0){ae.removeWidget(U,!0);return}}z(ce)}function A(ce){_(l,ce,!0),g=!0;try{for(const ae of f(h)){const U=wi(ae.id);U!==null&&Vh(s,i,ce,U.pluginName,R,{x:ae.x,y:ae.y,w:ae.w,h:ae.h,instanceId:`${U.pluginName}:${U.counter}`})}}finally{g=!1}}function x(){_(l,null)}function N(ce){g||(_(h,ce,!0),M())}function O(ce,ae){uM(ce,ae)}function j(ce){const ae=o(ce);if(ae===void 0)return;const U=eb(ce),re=Bl(s,i,ce,U,R);re!==null&&(_(h,[...f(h),{id:re.id,...CA(f(h),ae)}],!0),_(p,[...f(p),re.id],!0),E())}function B(ce){if(_(c,!1),f(d)){j(ce);return}const ae=f(l);if(ae===null)return;const U=Vh(s,i,ae,ce,R);U!==null&&(_(p,[...f(p),U],!0),E())}const J=ce=>{_(d,ce.matches,!0),ce.matches||_(u,!1)},W=fe(()=>f(u)?f(p).flatMap(ce=>{var X,ve;const ae=wi(ce);if(ae===null)return[];const U=((X=i.get(ae.pluginName))==null?void 0:X.entry.label)??ae.pluginName,re=((ve=$d(ce))==null?void 0:ve.getTileTitle())??"";return[{id:ce,label:re||U}]}):[]);function H(ce){_(p,ce,!0),_(u,!1),E()}hn(()=>{[...Ka.entries()],Wv(s,i)}),kn(()=>(a.addEventListener("change",J),()=>a.removeEventListener("change",J))),Do(()=>{b!==null&&E(b),Xv("host-navigation")});var ee=gM(),oe=Xe(ee),q=v(oe),K=v(q);{var ne=ce=>{var ae=fM(),U=Xe(ae);P(U,"variant","secondary");var re=v(U),X=T(U,2);{var ve=Ze=>{var rt=dM();P(rt,"variant","secondary");var Et=v(rt);y(jt=>S(Et,jt),[()=>w("dashboard.arrange-widgets")]),pe("click",rt,()=>_(u,!0)),C(Ze,rt)};Z(X,Ze=>{f(d)&&f(p).length>1&&Ze(ve)})}y(Ze=>S(re,Ze),[()=>w("dashboard.add-widget")]),pe("click",U,()=>_(c,!0)),C(ce,ae)},le=fe(()=>i.getWidgets().length>0),se=ce=>{var ae=hM(),U=v(ae);y(re=>S(U,re),[()=>w("dashboard.no-widgets")]),C(ce,ae)};Z(K,ce=>{f(le)?ce(ne):ce(se,-1)})}var ue=T(q,2);{var De=ce=>{iM(ce,{get order(){return f(p)},onRemoveRequest:R})},Ye=ce=>{var ae=pM(),U=v(ae);OA(U,{onGridReady:A,onGridDestroyed:x,onWidgetRemoved:z,onLayoutChanged:N,onWidgetResized:O}),C(ce,ae)};Z(ue,ce=>{f(d)?ce(De):ce(Ye,-1)})}var je=T(oe,2);$A(je,{get open(){return f(c)},onAddWidget:B,onClose:()=>_(c,!1)});var Je=T(je,2);{let ce=fe(()=>f(d)&&f(u));aM(Je,{get open(){return f(ce)},get cards(){return f(W)},onCommit:H})}y(()=>Ae(oe,"data-locale",me.locale)),C(t,ee),Le()}lt(["click"]);d_();var mM=I('<span class="mndw-header__device"> </span>'),vM=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 bM(t,e){Ie(e,!1);const n=Ar();function r(R){me.localeSwitchPending||n.locale.setLocale(R.detail.value).catch(()=>{})}async function i(){try{await new Promise(R=>{n.rci.logout().subscribe({next:()=>R(),error:()=>R()})})}finally{Rd()}}Tw();var s=vM(),o=v(s),a=v(o);P(a,"variant","ghost"),Oe(a,1,"mndw-header__menu-toggle"),y(()=>P(a,"aria-label",w("nav.toggle-menu")));var l=v(a);P(l,"name","menu");var c=T(a,4);{var u=R=>{var A=mM(),x=v(A);y(()=>S(x,me.deviceInfo.deviceName)),C(R,A)};Z(c,R=>{me.deviceInfo&&R(u)})}var d=T(o,2),h=v(d);Oe(h,1,"mndw-header__locale-select"),y(()=>P(h,"label",w("nav.language"))),y(()=>P(h,"value",me.locale)),y(()=>P(h,"aria-busy",String(me.localeSwitchPending)));var p=v(h);P(p,"value","en");var g=T(p,2);P(g,"value","ru");var m=T(h,2);P(m,"variant","ghost"),Oe(m,1,"mndw-header__theme-toggle"),y(()=>P(m,"title",me.theme==="dark"?w("nav.light-theme"):w("nav.dark-theme"))),y(()=>P(m,"aria-label",w("nav.color-theme")));var b=v(m);y(()=>P(b,"name",me.theme==="dark"?"sun":"moon"));var E=T(m,2);P(E,"variant","ghost"),Oe(E,1,"mndw-header__logout");var M=v(E);P(M,"name","log-out");var z=T(M);y(R=>{Ae(s,"data-locale",me.locale),S(z,` ${R??""}`)},[()=>w("nav.logout")]),pe("click",a,function(...R){Oc==null||Oc.apply(this,R)}),dt("mndwchange",h,r),pe("click",m,function(...R){Fi==null||Fi.apply(this,R)}),pe("click",E,i),C(t,s),Le()}lt(["click"]);var _M=I('<div class="mndw-sidebar-backdrop" role="presentation"></div>'),wM=I("<a> </a>"),yM=I('<div class="mndw-sidebar__section-label"> </div> <!>',1),EM=I('<!> <nav><a href="/"> </a> <a href="/packages"> </a> <!> <div class="mndw-sidebar__spacer"></div> <a href="/settings"> </a></nav>',1);function kM(t,e){Ie(e,!0);const n=Ar().registry,r=wl();let i=Y(st(r.matches));const s=W=>{_(i,W.matches,!0)},o=n.getPages().slice().sort((W,H)=>W.entry.label.localeCompare(H.entry.label)||W.entry.name.localeCompare(H.entry.name)),a=fe(()=>(Kt==null?void 0:Kt.route.pathname)??globalThis.location.pathname);function l(W){return(W.length>1&&W.endsWith("/")?W.slice(0,-1):W).toLowerCase()}function c(W){const H=l(f(a)),ee=l(W);return ee==="/"?H==="/":H===ee||H.startsWith(`${ee}/`)}function u(){f(i)&&(me.mobileSidebarOpen=!1)}function d(W){W.key==="Escape"&&f(i)&&me.mobileSidebarOpen&&(me.mobileSidebarOpen=!1)}kn(()=>(r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var h=EM();dt("keydown",no,d);var p=Xe(h);{var g=W=>{var H=_M();pe("click",H,u),C(W,H)};Z(p,W=>{f(i)&&me.mobileSidebarOpen&&W(g)})}var m=T(p,2);let b;var E=v(m);let M;var z=v(E),R=T(E,2);let A;var x=v(R),N=T(R,2);{var O=W=>{var H=yM(),ee=Xe(H),oe=v(ee),q=T(ee,2);ht(q,17,()=>o,K=>K.entry.name,(K,ne)=>{var le=wM();let se;var ue=v(le);y((De,Ye)=>{Ae(le,"href",f(ne).entry.route),se=Oe(le,1,"mndw-sidebar__link",null,se,De),Ae(le,"aria-current",Ye),S(ue,f(ne).entry.label)},[()=>({active:c(f(ne).entry.route)}),()=>c(f(ne).entry.route)?"page":void 0]),pe("click",le,u),C(K,le)}),y(K=>S(oe,K),[()=>w("nav.plugins")]),C(W,H)};Z(N,W=>{o.length>0&&W(O)})}var j=T(N,4);let B;var J=v(j);Qr(m,(W,H)=>yr==null?void 0:yr(W,H),()=>({enabled:f(i)&&me.mobileSidebarOpen})),y((W,H,ee,oe,q,K,ne,le,se)=>{b=Oe(m,1,"mndw-sidebar",null,b,{collapsed:!f(i)&&me.desktopSidebarCollapsed,"mobile-collapsed":f(i)&&!me.mobileSidebarOpen}),Ae(m,"data-locale",me.locale),m.inert=f(i)&&!me.mobileSidebarOpen,M=Oe(E,1,"mndw-sidebar__link",null,M,W),Ae(E,"aria-current",H),S(z,ee),A=Oe(R,1,"mndw-sidebar__link",null,A,oe),Ae(R,"aria-current",q),S(x,K),B=Oe(j,1,"mndw-sidebar__link",null,B,ne),Ae(j,"aria-current",le),S(J,se)},[()=>({active:c("/")}),()=>c("/")?"page":void 0,()=>w("nav.dashboard"),()=>({active:c("/packages")}),()=>c("/packages")?"page":void 0,()=>w("nav.package-manager"),()=>({active:c("/settings")}),()=>c("/settings")?"page":void 0,()=>w("nav.settings")]),pe("click",E,u),pe("click",R,u),pe("click",j,u),C(t,h),Le()}lt(["click"]);var SM=I('<div class="mndw-app-shell"><!> <div class="mndw-app-shell__body"><!> <main class="mndw-app-shell__content"><!></main></div></div>');function xM(t,e){var n=SM(),r=v(n);bM(r,{});var i=T(r,2),s=v(i);kM(s,{});var o=T(s,2),a=v(o);dw(a,()=>e.children),C(t,n)}function Mu(t){return t==="/"?"":t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function ua(t,e){return new Cu("INVALID_PATH",`Invalid page child path "${t}"`,{cause:e})}function TM(t){if(t===""||t==="/")return"";if(!t.startsWith("/")||t.startsWith("//")||t.includes("?")||t.includes("#"))throw ua(t);const e=Mu(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 ua(t);continue}let o;try{o=decodeURIComponent(s)}catch(a){throw ua(t,a)}if(o==="."||o===".."||o.includes("/")||o.includes("\\"))throw ua(t)}return e}class CM{constructor(e,n,r){F(this,"baseRoute");F(this,"deps");F(this,"childPathSubject");F(this,"currentChildPath");F(this,"completed",!1);F(this,"navigationSerial",0);F(this,"pageRoute");this.baseRoute=e,this.deps=r,this.currentChildPath=Mu(n),this.childPathSubject=new Rb(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=Mu(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 Cu("COMPLETED","Page route is no longer active");const r=TM(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 Cu("NAVIGATION_FAILED",`Navigation to "${r}" failed`,{cause:o})}!this.completed&&i===this.navigationSerial&&this.setPath(r)}}var PM=I('<div class="mndw-page-plugin__notice" role="status"> </div>'),RM=I('<div class="mndw-page-plugin-wrap"><!> <div class="mndw-page-plugin"></div></div>');function Wh(t,e){Ie(e,!0);const n={clearStorage:!1,closeReason:"host-navigation"};let r,i=null,s=0,o=null;const a=Ar(),l=a.registry,c={locale:a.locale,palette:a.palette,eventStream:a.eventStream};function u(O){return r=O,{destroy(){r=void 0}}}const d=fe(()=>ob(Kt.route.pathname,pp())),h=fe(()=>{var O;return((O=f(d))==null?void 0:O.name)??null}),p=fe(()=>f(h)===null?"ready":Go(f(h))),g=fe(()=>f(p)==="ready"?f(h):null);function m(){s+=1,o!==null&&(o.controller.complete(),rl(o.mounted,o.child,n),o.child.remove(),o=null)}function b(O){var B;if(i=O,O===null)return;const j=l.get(O);r===void 0||j===void 0||j.entry.type!=="page"||E(j,((B=f(d))==null?void 0:B.name)===O?f(d).childPath:"")}function E(O,j){if(r===void 0)return Promise.resolve(!1);s+=1;const B=s,J=document.createElement("div");J.className="mndw-page-plugin__mount",r.appendChild(J);const W=pp().find(le=>le.name===O.entry.name);if(W===void 0)return J.remove(),Promise.resolve(!1);const H=new CM(W.route,j,{navigate:(le,se)=>Kt.navigate(le,se),getLocation:()=>({search:globalThis.location.search,hash:globalThis.location.hash})}),ee={generation:B,pluginName:O.entry.name,child:J,controller:H,mounted:null};o=ee,me.hostInfo;const oe=me.deviceInfo??xd,{context:q,dispose:K}=Hd({entry:O.entry,instanceId:`${O.entry.name}:1`,deviceInfo:oe,pageRoute:H.pageRoute,catalogCell:O.catalog,services:c}),ne=Vv(J,O,q,K);return ne instanceof Promise?ne.then(le=>B!==s?(rl(le,J,n),J.remove(),le!==null):(ee.mounted=le,le!==null)):(ee.mounted=ne,Promise.resolve(ne!==null))}async function M(O,j){var B,J;return m(),await E(O,((B=f(d))==null?void 0:B.childPath)??"")?!0:(m(),await E(j,((J=f(d))==null?void 0:J.childPath)??""),!1)}function z(O){const{detail:j}=O;o===null||j.pluginName!==i||j.register(M(j.next,j.prior))}hn(()=>{f(g)!==i&&(m(),b(f(g)))}),hn(()=>{const O=f(d);O!==null&&(o==null?void 0:o.pluginName)===O.name&&o.controller.setPath(O.childPath)}),hn(()=>(window.addEventListener(Ru,z),()=>window.removeEventListener(Ru,z))),Do(m);var R=RM(),A=v(R);{var x=O=>{var j=PM(),B=v(j);y(()=>S(B,f(p)==="installing"?"Preparing… installing dependencies":"Dependency install failed")),C(O,j)};Z(A,O=>{f(h)!==null&&f(p)!=="ready"&&O(x)})}var N=T(A,2);Qr(N,O=>u==null?void 0:u(O)),C(t,R),Le()}function Wo(t,e){return()=>{let n,r,i;const s=o=>{if(n!==void 0){if(i===void 0){const a=st({row:o.row,value:o.value,colId:o.colId}),l=Object.assign(a,e(a));i=l,r=_l(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&&(Xu(r),r=void 0),n=void 0,i=void 0}}}}function to(){return t=>Wo(t,()=>({}))}class Ws extends Vo{constructor(e,n,r,i){super(e,n,r,i),this.name="OpkgError"}}const rn=(t,e,n,r)=>new Ws(t,e,n,r);function AM(t){if(t.code!=="DEPENDENCY_CONFLICT"||!Qt(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 MM(t){if(!Qt(t))throw Qe(rn);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 Qe(rn);if(i==="update_available"){if(typeof s!="string"||s.length===0)throw Qe(rn)}else if(s!==void 0)throw Qe(rn);return{name:e,version:n,description:r,status:i,...s===void 0?{}:{newVersion:s}}}function NM(t){if(!Qt(t)||!Array.isArray(t.packages))throw Qe(rn);const e=t.metadataUpdatedAt;if(e!==null&&typeof e!="string"||typeof e=="string"&&Number.isNaN(Date.parse(e)))throw Qe(rn);return{packages:t.packages.map(n=>MM(n)),metadataUpdatedAt:e}}function OM(t){if(!Qt(t))throw Qe(rn);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 Qe(rn);const n=["size","installedSize","installedTime"];for(const o of n)if(t[o]!==void 0&&typeof t[o]!="string")throw Qe(rn);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 zM(t){if(!Qt(t)||t.ok!==!0||typeof t.message!="string"||!Array.isArray(t.packages)||!t.packages.every(e=>typeof e=="string"))throw Qe(rn);return{message:t.message,packages:t.packages}}function IM(t){if(!Qt(t)||t.ok!==!0||typeof t.message!="string")throw Qe(rn);return{message:t.message}}function LM(t=globalThis.fetch){const e=Zo(t,rn);async function n(r,i){const s=await e.request(r,{method:"POST",json:{packages:i}});return zM(s)}return{async list(){const r=await e.request(HT,{method:"GET"});return NM(r)},async info(r){const i=new URLSearchParams({name:r}),s=await e.request(`${FT}?${i.toString()}`,{method:"GET"});return OM(s)},install:r=>n(BT,r),remove:r=>n($T,r),upgrade:r=>n(jT,r),async update(){const r=await e.request(UT,{method:"POST",json:{}});return IM(r)}}}const zi=LM(),{service:DM}=Ad("@host","@host");function cs(t,e){return DM.open({kind:"modal",title:e.title,showCloseButton:e.showCloseButton??!0,closeOnEscape:e.closeOnEscape??!0,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 Xu(i)});try{i=_l(t,{target:n,props:a})}finally{s()}}})}var HM=I('<span class="package-name svelte-84q0nr"> </span>');function BM(t,e){var n=HM(),r=v(n);y(()=>{Ae(n,"title",e.value),S(r,e.value)}),C(t,n)}var $M=I('<span class="new-version svelte-sgt4ns"> </span>'),UM=I('<span class="ver-value svelte-sgt4ns"> </span><!>',1);function jM(t,e){Ie(e,!0);var n=UM(),r=Xe(n),i=v(r),s=T(r);{var o=a=>{var l=$M(),c=v(l);y(()=>S(c,`→ ${e.row.newVersion??""}`)),C(a,l)};Z(s,a=>{e.row.newVersion&&a(o)})}y(()=>{Ae(r,"data-col",e.colId),Ae(r,"title",e.value),S(i,e.value)}),C(t,n),Le()}var FM=I("<span> </span>");function GM(t,e){Ie(e,!0);const n=fe(()=>e.value==="update_available"?w("packages.update-available"):e.value==="available"?w("packages.available"):e.value);var r=FM(),i=v(r);y(()=>{Oe(r,1,`badge badge-${e.value??""}`,"svelte-tq54e2"),Ae(r,"data-col",e.colId),S(i,f(n))}),C(t,r),Le()}var VM=I("<mndw-button> </mndw-button>",2);function ZM(t,e){Ie(e,!0);const n=fe(()=>e.row.name==="mndw"||e.row.name==="lighttpd");var r=VM();P(r,"variant","danger"),P(r,"data-no-expand",!0),y(()=>P(r,"disabled",e.row.status==="available"||f(n))),y(()=>P(r,"title",f(n)?w("packages.protected"):void 0));var i=v(r);y(s=>S(i,s),[()=>w("packages.remove")]),pe("click",r,()=>e.onRemove()),C(t,r),Le()}lt(["click"]);function WM(t){return Wo(ZM,e=>({onRemove:()=>t(e.row.name)}))}var qM=I("<p> </p>"),XM=I('<p role="alert"> </p> <mndw-button> </mndw-button>',3),da=I('<dt class="svelte-uhnzp9"> </dt><dd class="svelte-uhnzp9"> </dd>',1),YM=I('<dl class="svelte-uhnzp9"><dt class="svelte-uhnzp9"> </dt> <dd class="svelte-uhnzp9"> </dd> <!> <!> <!> <!></dl>'),KM=I('<div class="detail svelte-uhnzp9"><!></div>');function JM(t,e){Ie(e,!0);let n=fe(()=>e.value.name),r=fe(()=>e.cache.get(f(n)));hn(()=>{e.load(f(n))});var i=KM(),s=v(i);{var o=c=>{var u=qM(),d=v(u);y(h=>S(d,h),[()=>w("packages.loading")]),C(c,u)},a=c=>{var u=XM(),d=Xe(u),h=v(d),p=T(d,2);P(p,"variant","secondary");var g=v(p);y(m=>{S(h,f(r).message),S(g,m)},[()=>w("common.retry")]),pe("click",p,()=>e.retry(f(n))),C(c,u)},l=c=>{var u=YM(),d=v(u),h=v(d),p=T(d,2),g=v(p),m=T(p,2);{var b=N=>{var O=da(),j=Xe(O),B=v(j),J=T(j),W=v(J);y(H=>{S(B,H),S(W,f(r).info.size)},[()=>w("packages.size")]),C(N,O)};Z(m,N=>{f(r).info.size&&N(b)})}var E=T(m,2);{var M=N=>{var O=da(),j=Xe(O),B=v(j),J=T(j),W=v(J);y(H=>{S(B,H),S(W,f(r).info.installedSize)},[()=>w("packages.installed-size")]),C(N,O)};Z(E,N=>{f(r).info.installedSize&&N(M)})}var z=T(E,2);{var R=N=>{var O=da(),j=Xe(O),B=v(j),J=T(j),W=v(J);y(H=>{S(B,H),S(W,f(r).info.installedTime)},[()=>w("packages.installed-time")]),C(N,O)};Z(z,N=>{f(r).info.installedTime&&N(R)})}var A=T(z,2);{var x=N=>{var O=da(),j=Xe(O),B=v(j),J=T(j),W=v(J);y((H,ee)=>{S(B,H),S(W,ee)},[()=>w("packages.dependencies"),()=>f(r).info.dependencies.join(", ")]),C(N,O)};Z(A,N=>{f(r).info.dependencies.length>0&&N(x)})}y(N=>{S(h,N),S(g,f(r).info.description)},[()=>w("packages.description")]),C(c,u)};Z(s,c=>{var u;((u=f(r))==null?void 0:u.status)==="pending"||f(r)===void 0?c(o):f(r).status==="failure"?c(a,1):f(r).status==="success"&&c(l,2)})}y(()=>{Ae(i,"data-col",e.colId),Ae(i,"data-package",f(n))}),C(t,i),Le()}lt(["click"]);function QM(t){return Wo(JM,()=>({cache:t.cache,load:t.load,retry:t.retry}))}const qh=/[.\-+]/,Xh=t=>t.length>0&&/^[0-9]+$/.test(t);function eN(t,e){const n=t.split(qh),r=e.split(qh),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(Xh(o)&&Xh(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 tN=I('<div class="confirm-modal svelte-erapy5"><p class="svelte-erapy5"> </p> <div class="actions svelte-erapy5"><mndw-button>Cancel</mndw-button> <mndw-button> </mndw-button></div></div>',2);function il(t,e){Ie(e,!0);var n=tN(),r=v(n),i=v(r),s=T(r,2),o=v(s);P(o,"variant","secondary");var a=T(o,2);P(a,"variant","danger");var l=v(a);y(()=>{S(i,e.message),S(l,e.confirmLabel)}),pe("click",o,()=>e.close(!1)),pe("click",a,()=>e.close(!0)),C(t,n),Le()}lt(["click"]);var nN=I('<span class="selected-count svelte-m3c4ux"> </span>'),Yh=I('<div class="msg-cell svelte-m3c4ux"> </div>'),rN=I("<mndw-table></mndw-table>",2),iN=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> <mndw-button> </mndw-button></div></div> <div class="filter-row mndw-table-controls svelte-m3c4ux"><input type="search" class="filter-input svelte-m3c4ux"/> <mndw-tabs><mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab></mndw-tabs></div> <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> <div class="table-wrap svelte-m3c4ux"><!></div></section>',2);function sN(t,e){Ie(e,!0);let n=Yt(e,"now",3,()=>new Date),r=Y(st([])),i=Y(null),s=Y(null),o=new Da,a=Y(""),l=Y("installed"),c=Y(!1),u=Y(!1),d=Y(null),h=0;const p=new is;let g=0;const m=fe(()=>f(r).filter(G=>f(l)==="installed"&&G.status==="available"||f(l)==="updates"&&G.status!=="update_available"?!1:G.name.toLowerCase().includes(f(a).toLowerCase()))),b=fe(()=>o.size),E=fe(()=>f(r).filter(G=>G.status==="update_available").length),M=fe(()=>[...o]),z=fe(()=>f(m).some(G=>o.has(G.name)&&G.status==="available")),R=fe(()=>f(m).some(G=>o.has(G.name)&&G.status!=="available"&&!j(G.name))),A=fe(()=>f(m).some(G=>o.has(G.name)&&G.status==="update_available")),x=fe(()=>{if(f(i)===null)return w("packages.never-refreshed");if(f(s)===null)return"";const G=Math.max(0,Math.floor((f(s).getTime()-Date.parse(f(i)))/6e4));return w("packages.refreshed-ago",{minutes:G})}),N=fe(()=>f(i)===null||f(s)===null?!1:f(s).getTime()-Date.parse(f(i))>3600*1e3),O=fe(()=>f(r).length===0?w("packages.empty"):w("packages.no-match"));function j(G){return G==="mndw"||G==="lighttpd"}function B(){g+=1,p.clear()}function J(G){if(p.has(G))return;const ie=g,Be=zi.info(G);p.set(G,{status:"pending",promise:Be}),Be.then(Ke=>{var mt;ie===g&&((mt=p.get(G))==null?void 0:mt.status)==="pending"&&p.set(G,{status:"success",info:Ke})}).catch(Ke=>{var mt;ie===g&&((mt=p.get(G))==null?void 0:mt.status)==="pending"&&p.set(G,{status:"failure",message:Ke instanceof Ws?Ke.message:w("packages.detail-failed")})})}function W(G){var ie;((ie=p.get(G))==null?void 0:ie.status)==="failure"&&(p.delete(G),J(G))}async function H(G=!1){_(c,!0);try{const ie=await zi.list();_(r,ie.packages,!0),_(i,ie.metadataUpdatedAt,!0),_(s,n()(),!0),B(),_(u,!1),o.clear(),G||oi.info(w("packages.loaded",{count:f(r).length}))}catch(ie){_(r,[],!0),o.clear(),_(u,!0),oi.error(ie instanceof Ws?ie.message:w("packages.load-failed"))}finally{_(c,!1)}}async function ee(G,ie){const Be=Array.from(o).filter(Ke=>{const mt=f(r).find(Nr=>Nr.name===Ke);return mt!==void 0&&ie(mt)});if(Be.length!==0){if(G==="remove"){(await cs(il,{title:w("packages.confirm-remove-title"),props:{message:w("packages.confirm-remove",{names:Be.join(", ")}),confirmLabel:w("packages.remove")}}).closed).result&&await oe("remove",Be);return}await oe(G,Be)}}async function oe(G,ie){_(c,!0);const Be=G==="install"?"packages.installing":G==="remove"?"packages.removing":"packages.updating";try{const Ke=G==="install"?await zi.install(ie):G==="remove"?await zi.remove(ie):await zi.upgrade(ie);await H(!0),oi.success(Ke.message)}catch(Ke){oi.error(q(Ke,Be))}finally{_(c,!1)}}function q(G,ie){if(!(G instanceof Ws))return w("packages.action-failed",{action:w(ie)});const Be=AM(G);return Be===void 0?G.message:Be.dependents.length>0?w("packages.dependency-conflict",{package:Be.package,dependents:Be.dependents.join(", ")}):w("packages.dependency-conflict-generic",{package:Be.package})}async function K(){_(c,!0);try{const G=await zi.update();await H(!0),oi.success(G.message)}catch(G){oi.error(G instanceof Ws?G.message:w("app.error"))}finally{_(c,!1)}}function ne(G){const ie=G.detail.value;(ie==="all"||ie==="installed"||ie==="updates")&&_(l,ie,!0)}async function le(G){(await cs(il,{title:w("packages.confirm-remove-title"),props:{message:w("packages.confirm-remove",{names:G}),confirmLabel:w("packages.remove")}}).closed).result&&await oe("remove",[G])}const se={installed:0,update_available:1,available:2},ue=to()(BM),De=to()(jM),Ye=to()(GM),je=QM({cache:p,load:J,retry:W}),Je=WM(le),ce=fe(()=>[Hr()({id:"name",label:w("packages.package"),accessor:G=>G.name,sortable:!0,width:"11.25rem",renderer:ue}),Hr()({id:"version",label:w("packages.version"),accessor:G=>G.version,sortable:!0,comparator:eN,renderer:De}),Hr()({id:"status",label:w("packages.status"),accessor:G=>G.status,sortable:!0,comparator:(G,ie)=>se[G]-se[ie],renderer:Ye}),Hr()({id:"actions",label:"",renderer:Je})]);let ae=new Da,U=Y(null);const re=fe(()=>({expandRow:G=>w("packages.expand",{name:G}),collapseRow:G=>w("packages.collapse",{name:G})}));function X(G){o.clear();for(const ie of G.detail.selected)o.add(ie)}function ve(G){_(U,G.detail.sort,!0)}function Ze(G){ae.clear();for(const ie of G.detail.expanded)ae.add(ie)}hn(()=>{const G=new Set(f(m).map(ie=>ie.name));Jr(()=>{const ie=[...ae].filter(Be=>!G.has(Be));for(const Be of ie)ae.delete(Be)})}),hn(()=>{var Ke;const G=(Ke=f(m)[0])==null?void 0:Ke.name,ie=f(d),Be=++h;G===void 0||ie===null||(async()=>{var mt;await ie.updateComplete,!(Be!==h||((mt=f(m)[0])==null?void 0:mt.name)!==G)&&ie.scrollToRow(G,{align:"start"})})()}),kn(()=>{H()});var rt=iN(),Et=v(rt),jt=v(Et),on=v(jt),Xn=v(on),Sn=T(on,2);let Yn;var Kn=v(Sn),ur=T(jt,2),an=v(ur);P(an,"variant","secondary"),y(()=>P(an,"disabled",f(c)));var dr=v(an),ke=T(an,2);P(ke,"variant","secondary"),y(()=>P(ke,"disabled",f(c)));var ze=v(ke),V=T(Et,2),ge=v(V),Ce=T(ge,2);y(()=>P(Ce,"value",f(l)));var Ge=v(Ce);P(Ge,"id","all");var et=v(Ge),ct=T(Ge,2);P(ct,"id","installed");var Tt=v(ct),$e=T(ct,2);P($e,"id","updates");var He=v($e),We=T(V,2),Re=v(We),L=v(Re),Q=T(Re,2);P(Q,"variant","primary"),y(()=>P(Q,"disabled",f(c)||!f(z)));var we=v(Q),_e=T(Q,2);P(_e,"variant","danger"),y(()=>P(_e,"disabled",f(c)||!f(R)));var kt=v(_e),gt=T(_e,2);P(gt,"variant","primary"),y(()=>P(gt,"disabled",f(c)||!f(A)));var Jn=v(gt),Dt=T(gt,2);{var xn=G=>{var ie=nN(),Be=v(ie);y(Ke=>S(Be,Ke),[()=>w("packages.selected",{count:f(b)})]),C(G,ie)};Z(Dt,G=>{f(b)>0&&G(xn)})}var Mr=T(We,2),St=v(Mr);{var at=G=>{var ie=Yh(),Be=v(ie);y(Ke=>S(Be,Ke),[()=>w("packages.loading")]),C(G,ie)},Ot=G=>{var ie=Yh(),Be=v(ie);y(Ke=>S(Be,Ke),[()=>w("packages.load-failed")]),C(G,ie)},Xt=G=>{var ie=rN();y(()=>P(ie,"columns",f(ce))),y(()=>P(ie,"rows",f(m))),P(ie,"rowKey","name"),P(ie,"virtual",!0),P(ie,"rowLabel",Be=>Be.name),P(ie,"selectable",!0),y(()=>P(ie,"selected",f(M))),P(ie,"expandable",!0),P(ie,"toggleAfterColumn","name"),P(ie,"expandOn","row"),y(()=>P(ie,"expanded",[...ae])),y(()=>P(ie,"expandedRenderer",je)),P(ie,"columnMenu",!1),P(ie,"sortMode","client"),y(()=>P(ie,"sort",f(U))),y(()=>P(ie,"emptyLabel",f(O))),y(()=>P(ie,"labels",f(re))),Oe(ie,1,"svelte-m3c4ux"),rs(ie,Be=>_(d,Be),()=>f(d)),dt("mndwselectionchange",ie,X),dt("mndwsortchange",ie,ve),dt("mndwrowexpand",ie,Ze),C(G,ie)};Z(St,G=>{f(c)?G(at):f(u)?G(Ot,1):G(Xt,-1)})}y((G,ie,Be,Ke,mt,Nr,Ti,Ci,ys,Es,Qn)=>{Ae(rt,"data-locale",me.locale),S(Xn,G),Yn=Oe(Sn,1,"freshness svelte-m3c4ux",null,Yn,{stale:f(N)}),S(Kn,f(x)),S(dr,ie),S(ze,Be),Ae(ge,"placeholder",Ke),S(et,mt),S(Tt,Nr),S(He,Ti),S(L,Ci),S(we,ys),S(kt,Es),S(Jn,Qn)},[()=>w("packages.title"),()=>w("packages.refresh"),()=>w("packages.reload"),()=>w("packages.search"),()=>w("packages.all"),()=>w("packages.installed"),()=>w("packages.updates",{count:f(E)}),()=>w("packages.with-selected"),()=>w("packages.install"),()=>w("packages.remove"),()=>w("packages.update")]),pe("click",an,()=>void K()),pe("click",ke,()=>void H()),xw(ge,()=>f(a),G=>_(a,G)),dt("mndwchange",Ce,ne),pe("click",Q,()=>void ee("install",G=>G.status==="available")),pe("click",_e,()=>void ee("remove",G=>G.status!=="available"&&!j(G.name))),pe("click",gt,()=>void ee("upgrade",G=>G.status==="update_available")),C(t,rt),Le()}lt(["click"]);class Nu extends Vo{constructor(e,n,r,i){super(e,n,i,r),this.name="ServiceError"}}const us=(t,e,n,r)=>new Nu(t,e,r,n);function Ud(t){if(!Qt(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 Qe(us);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 oN(t){if(!Qt(t)||!Array.isArray(t.services))throw Qe(us);return t.services.map(e=>Ud(e))}function Kh(t){if(!Qt(t)||t.ok!==!0||t.service===void 0)throw Qe(us);return{ok:!0,service:Ud(t.service)}}function aN(t=globalThis.fetch){const e=Zo(t,us);async function n(r,i){const s=await e.request(r,{method:"POST",json:{name:i}});return Kh(s)}return{async list(){return oN(await e.request(qT,{method:"GET"}))},async status(r,i){const s=new URLSearchParams({name:r}),o=await e.request(`${XT}?${s.toString()}`,{method:"GET",signal:i});if(!Qt(o)||o.service===void 0)throw Qe(us);return Ud(o.service)},start:r=>n(YT,r),stop:r=>n(KT,r),restart:r=>n(JT,r),async setEnabled(r,i){const s=await e.request(QT,{method:"POST",json:{name:r,enabled:i}});return Kh(s)}}}const fa=aN();var lN=I('<strong> </strong><small class="svelte-gqtyao"> </small>',1);function cN(t,e){Ie(e,!0);var n=lN(),r=Xe(n),i=v(r),s=T(r),o=v(s);y(()=>{S(i,e.row.service.label),S(o,e.row.service.name)}),C(t,n),Le()}var uN=I('<small class="pid svelte-1ugk9ic"> </small>'),dN=I("<span> </span> <!>",1);function fN(t,e){Ie(e,!0);const n={running:"badge-running",stopped:"badge-stopped",unknown:"badge-unknown"},r=fe(()=>n[e.row.service.state]??"badge-unknown"),i=fe(()=>e.row.rowError?w("services.probe-failed"):e.row.service.state);var s=dN(),o=Xe(s),a=v(o),l=T(o,2);{var c=u=>{var d=uN(),h=v(d);y(p=>S(h,p),[()=>w("services.pid",{pid:e.row.service.pid})]),C(u,d)};Z(l,u=>{e.row.service.pid!==void 0&&u(c)})}y(()=>{Oe(o,1,`badge ${f(r)??""}`,"svelte-1ugk9ic"),S(a,f(i))}),C(t,s),Le()}var hN=I("<mndw-button> </mndw-button>",2),pN=I('<div class="actions svelte-2q4dea"></div>');function gN(t,e){Ie(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=pN();ht(r,21,()=>n,({action:i,label:s,guardProtected:o})=>i,(i,s)=>{let o=()=>f(s).action,a=()=>f(s).label,l=()=>f(s).guardProtected;var c=hN(),u=()=>e.onRun(o());Sw(c,h=>({variant:"secondary",disabled:e.row.busy||l()&&e.row.service.protected,...h,onclick:u}),[()=>l()&&e.row.service.protected?{title:w("services.protected")}:{}],void 0,void 0,"svelte-2q4dea");var d=v(c);y(h=>S(d,h),[()=>w(a())]),C(i,c)}),C(t,r),Le()}function mN(t){return Wo(gN,e=>({onRun:n=>t(n,e.row.service.name)}))}var vN=I("<mndw-switch></mndw-switch>",2);function bN(t,e){Ie(e,!0);const n=fe(()=>e.row.busy||e.row.service.protected||e.row.service.autostartPinned),r=fe(()=>e.row.service.enabledAtBoot?w("services.disable-at-boot"):w("services.enable-at-boot")),i=fe(()=>e.row.service.protected?w("services.protected"):e.row.service.autostartPinned?w("services.autostart-pinned"):f(r)),s=a=>{const l=a.currentTarget;l.checked=e.row.service.enabledAtBoot,e.onToggle(!e.row.service.enabledAtBoot)};var o=vN();y(()=>P(o,"checked",e.row.service.enabledAtBoot)),y(()=>P(o,"disabled",f(n))),y(()=>P(o,"aria-label",f(r))),y(()=>P(o,"title",f(i))),dt("mndwchange",o,s),C(t,o),Le()}function _N(t){return Wo(bN,e=>({onToggle:n=>t(e.row.service,n)}))}var wN=I('<div class="empty capability svelte-3v3gj2" role="status"><strong class="svelte-3v3gj2"> </strong><span> </span></div>'),Jh=I('<div class="empty svelte-3v3gj2" role="status"> </div>'),yN=I('<div class="table-wrap svelte-3v3gj2"><mndw-table></mndw-table></div>',2),EN=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 kN(t,e){Ie(e,!0);let n=Y(st([])),r=Y(st({})),i=Y(!1),s=Y(!1),o=Y(!1),a=Y(!1),l=Y(st({})),c=0,u;const d=3,h=fe(()=>f(n).map(U=>({service:U,busy:f(a),rowError:f(r)[U.name]??!1}))),p=to()(cN),g=to()(fN),m=_N((U,re)=>void H(U,re)),b=mN((U,re)=>void W(U,re)),E=fe(()=>[Hr()({id:"service",label:w("services.service"),width:"10rem",renderer:p}),Hr()({id:"state",label:w("services.state"),width:"7.1rem",renderer:g}),Hr()({id:"autostart",label:w("services.autostart"),width:"6.7rem",align:"center",renderer:m}),Hr()({id:"actions",label:w("services.actions"),width:"18rem",renderer:b})]);function M(U,re){_(n,f(n).map(X=>X.name===U?re:X),!0)}function z(U){M(U.name,U)}async function R(U,re,X){let ve=0;const Ze=async()=>{for(;ve<U.length;){const rt=U[ve++];rt!==void 0&&await X(rt)}};await Promise.all(Array.from({length:Math.min(re,U.length)},()=>Ze()))}function A(U,re,X,ve){return c===re&&(f(l)[U]??0)===X&&!ve.aborted}async function x(U,re,X){const ve=f(l)[U.name]??0;try{const Ze=await fa.status(U.name,X);A(U.name,re,ve,X)&&z(Ze)}catch{A(U.name,re,ve,X)&&_(r,{...f(r),[U.name]:!0},!0)}}async function N(U,re,X){await R(U,d,ve=>x(ve,re,X))}async function O(){u==null||u.abort(),u=new AbortController;const U=++c;_(i,!0),_(s,!1),_(o,!1),_(r,{},!0),_(l,{},!0);try{const re=await fa.list();if(c!==U)return;_(n,re,!0),_(i,!1),await N(re,U,u.signal)}catch(re){if(c!==U||u.signal.aborted)return;_(n,[],!0),_(s,re instanceof Nu&&re.code==="SERVICE_UNAVAILABLE",!0),_(o,!f(s)),_(i,!1)}finally{c===U&&_(i,!1)}}async function j(U,re){return(await cs(il,{title:w("services.confirm-title"),props:{message:U,confirmLabel:re}}).closed).result===!0}async function B(U,re){return j(w("services.confirm",{action:U,name:re}),w(`services.${U}`))}async function J(U,re){return j(w(re?"services.confirm-enable-boot":"services.confirm-disable-boot",{name:U}),w(re?"services.enable-at-boot":"services.disable-at-boot"))}async function W(U,re){if(!f(a)&&!((U==="stop"||U==="restart")&&!await B(U,re))){_(l,{...f(l),[re]:(f(l)[re]??0)+1},!0),_(a,!0);try{const X=await fa[U](re);z(X.service),_(r,{...f(r),[re]:!1},!0)}catch{_(r,{...f(r),[re]:!0},!0)}finally{_(a,!1)}}}async function H(U,re){if(f(a)||U.protected||U.autostartPinned)return;const X=U.name;if(await J(X,re)){_(l,{...f(l),[X]:(f(l)[X]??0)+1},!0),_(a,!0);try{const ve=await fa.setEnabled(X,re);M(X,ve.service),_(r,{...f(r),[X]:!1},!0)}catch(ve){ve instanceof Nu&&ve.code==="CONFLICT"?(M(X,{...U,autostartPinned:!0}),_(r,{...f(r),[X]:!1},!0)):_(r,{...f(r),[X]:!0},!0)}finally{_(a,!1)}}}kn(()=>(O(),()=>u==null?void 0:u.abort()));var ee=EN(),oe=v(ee),q=v(oe),K=v(q),ne=v(K),le=T(K,2),se=v(le),ue=T(q,2);P(ue,"variant","secondary"),y(()=>P(ue,"disabled",f(i)||f(a)));var De=v(ue),Ye=T(oe,2);{var je=U=>{var re=wN(),X=v(re),ve=v(X),Ze=T(X),rt=v(Ze);y((Et,jt)=>{S(ve,Et),S(rt,jt)},[()=>w("services.unavailable"),()=>w("services.unavailable-description")]),C(U,re)},Je=U=>{var re=Jh(),X=v(re);y(ve=>S(X,ve),[()=>w("services.load-failed")]),C(U,re)},ce=U=>{var re=Jh(),X=v(re);y(ve=>S(X,ve),[()=>w("services.empty")]),C(U,re)},ae=U=>{var re=yN(),X=v(re);y(()=>P(X,"columns",f(E))),y(()=>P(X,"rows",f(h))),P(X,"rowKey",ve=>ve.service.name),P(X,"min-width","42rem"),P(X,"columnMenu",!1),P(X,"rowLabel",ve=>ve.service.label),y(()=>P(X,"emptyLabel",w("services.empty"))),Oe(X,1,"svelte-3v3gj2"),C(U,re)};Z(Ye,U=>{f(s)?U(je):f(o)?U(Je,1):!f(i)&&f(n).length===0?U(ce,2):U(ae,-1)})}y((U,re,X)=>{Ae(ee,"data-locale",me.locale),S(ne,U),S(se,re),S(De,X)},[()=>w("services.title"),()=>w("services.description"),()=>w("services.refresh")]),pe("click",ue,()=>void O()),C(t,ee),Le()}lt(["click"]);function Ou(t){return t==="services"?"/packages/services":"/packages"}function SN(t){const e=t.replace(/\/+$/,"")||"/";return e==="/packages"?"packages":e==="/packages/services"?"services":null}const Qh=[{id:"packages",path:Ou("packages"),labelKey:"packages.tab"},{id:"services",path:Ou("services"),labelKey:"services.tab"}];var xN=I("<mndw-tab> </mndw-tab>",2),TN=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 CN(t,e){Ie(e,!0);const n=fe(()=>{const p=(Kt==null?void 0:Kt.route.pathname)??globalThis.location.pathname;return SN(p)??"packages"});function r(p){const g=Qh.find(m=>m.id===p.detail.value);g!==void 0&&Kt!==void 0&&Kt.navigate(Ou(g.id))}var i=TN(),s=v(i);Oe(s,1,"mndw-table-controls"),y(()=>P(s,"value",f(n)));var o=v(s);ht(o,17,()=>Qh,p=>p.id,(p,g)=>{var m=xN();y(()=>P(m,"id",f(g).id));var b=v(m);y(E=>S(b,E),[()=>w(f(g).labelKey)]),C(p,m)});var a=T(o,2);P(a,"for","packages");var l=v(a);{var c=p=>{sN(p,{})};Z(l,p=>{f(n)==="packages"&&p(c)})}var u=T(a,2);P(u,"for","services");var d=v(u);{var h=p=>{kN(p,{})};Z(d,p=>{f(n)==="services"&&p(h)})}y(()=>Ae(i,"data-locale",me.locale)),dt("mndwchange",s,r),C(t,i),Le()}function ep(t){CN(t,{})}const tp=4096,np=[{title:"mndwd diagnostics",path:"/api/mndw/diagnostics/export",method:"POST"},{title:"persistent rci-session capability",path:"/api/mndw/rci-session/capability"}],PN=[/(["']?(?: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],RN={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()}},AN={request:Zs,now:()=>new Date,browser:RN};async function MN(t=AN){const n=(await Promise.allSettled(np.map(async c=>{const u={};return"method"in c?u.method=c.method:u.csrf=!0,await Zo(t.request,(h,p,g,m)=>new Vo(h,p,g,m)).request(c.path,u)}))).map((c,u)=>{const d=np[u];return c.status==="fulfilled"?{title:d.title,value:c.value}:{title:d.title,error:ON(c.reason)}}),r=t.now(),i=NN(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-${IN(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 NN(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: ${zu(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 ON(t){return t instanceof Error?zu(t.message):zu(String(t))}function zu(t){return t.length>tp?`${t.slice(0,tp)}…`:t}function zN(t){let e=t;for(const n of PN)e=e.replace(n,"$1[REDACTED]");return e}function IN(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 LN=I('<p role="alert" class="svelte-np0xnl"> </p>'),DN=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 HN(t,e){Ie(e,!0);let n=Y(!1),r=Y("");async function i(){_(n,!0),_(r,"");try{await MN()}catch{_(r,w("settings.diagnostics-failed"),!0)}finally{_(n,!1)}}var s=DN(),o=v(s),a=v(o),l=T(o,2),c=v(l),u=T(l,2);P(u,"variant","secondary"),y(()=>P(u,"disabled",f(n)));var d=v(u),h=T(u,2);{var p=g=>{var m=LN(),b=v(m);y(()=>S(b,f(r))),C(g,m)};Z(h,g=>{f(r)&&g(p)})}y((g,m,b,E)=>{Ae(s,"data-locale",me.locale),Ae(s,"aria-label",g),S(a,m),S(c,b),S(d,E)},[()=>w("settings.diagnostics-tab"),()=>w("settings.diagnostics-tab"),()=>w("settings.diagnostics-description"),()=>f(n)?w("settings.downloading"):w("settings.download-diagnostics")]),pe("click",u,()=>void i()),C(t,s),Le()}lt(["click"]);var BN=I("<mndw-button>Export palette</mndw-button>",2);function $N(t,e){Ie(e,!0);function n(){const i=new Blob([JSON.stringify(e.read(),null,2)],{type:"application/json"}),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download="mndw-palette.json",o.click(),URL.revokeObjectURL(s)}var r=BN();P(r,"variant","secondary"),y(()=>P(r,"disabled",e.disabled)),pe("click",r,n),C(t,r),Le()}lt(["click"]);var UN=I('<label class="mndw-palette-import svelte-q9ugi0"><input accept=".json,application/json" type="file" class="svelte-q9ugi0"/> <span>Drop a palette JSON file here or choose one.</span></label>');function jN(t,e){Ie(e,!0);async function n(l){let c;try{c=await l.text()}catch{e.onErrors(["Could not read palette file."]);return}let u;try{u=JSON.parse(c)}catch{e.onErrors(["Invalid JSON file."]);return}const d=rv(u);if(d.palette===null){e.onErrors(d.structuralErrors);return}e.onPreview(d.palette,d.contrastWarnings)}function r(l){e.disabled||(e.onImportStart(),n(l))}function i(l){var d;const c=l.currentTarget,u=(d=c.files)==null?void 0:d[0];u&&r(u),c.value=""}function s(l){var u;l.preventDefault();const c=(u=l.dataTransfer)==null?void 0:u.files[0];c&&r(c)}var o=UN(),a=v(o);y(l=>{Ae(a,"aria-label",l),a.disabled=e.disabled},[()=>w("settings.palette-import-aria-label")]),dt("dragover",o,l=>l.preventDefault()),dt("drop",o,s),pe("change",a,i),C(t,o),Le()}lt(["change"]);var FN=I('<li class="svelte-1cguif5"><span class="mndw-palette-preview__chip svelte-1cguif5"></span> </li>'),GN=I('<div><h4> </h4> <ul class="mndw-palette-preview__swatches svelte-1cguif5"></ul></div>'),VN=I("<li> </li>"),ZN=I('<div class="mndw-palette-preview__warnings svelte-1cguif5"><h4> </h4> <ul></ul></div>'),WN=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),qN=I(`<div class="mndw-palette-preview svelte-1cguif5"><p>Previewing the imported palette. Nothing is saved to the device until you
90
- confirm.</p> <!> <!> <!> <div class="mndw-palette-preview__actions svelte-1cguif5"><mndw-button>Confirm</mndw-button> <mndw-button>Discard</mndw-button></div></div>`,2);function XN(t,e){Ie(e,!0);const n=["dark","light"];let r=fe(()=>n.map(h=>({theme:h,entries:e.warnings.filter(p=>p.theme===h)})));var i=qN(),s=T(v(i),2);ht(s,16,()=>n,h=>h,(h,p)=>{var g=GN(),m=v(g),b=v(m),E=T(m,2);ht(E,21,()=>hd,M=>M.token,(M,z)=>{var R=FN(),A=v(R),x=T(A);y(()=>{io(A,`background: ${e.palette[p][f(z).token]??""}`),S(x,` ${f(z).token??""}`)}),C(M,R)}),y(()=>S(b,p)),C(h,g)});var o=T(s,2);ht(o,17,()=>f(r),h=>h.theme,(h,p)=>{var g=En(),m=Xe(g);{var b=E=>{var M=ZN(),z=v(M),R=v(z),A=T(z,2);ht(A,21,()=>f(p).entries,x=>x.pair,(x,N)=>{var O=VN(),j=v(O);y(()=>S(j,`${f(N).pair??""}: ${f(N).ratio??""} (needs ${f(N).min??""})`)),C(x,O)}),y(()=>S(R,`Contrast warnings (${f(p).theme??""})`)),C(E,M)};Z(m,E=>{f(p).entries.length>0&&E(b)})}C(h,g)});var a=T(o,2);{var l=h=>{var p=WN(),g=v(p);y(()=>S(g,e.error)),C(h,p)};Z(a,h=>{e.error&&h(l)})}var c=T(a,2),u=v(c);P(u,"variant","primary"),y(()=>P(u,"disabled",e.busy));var d=T(u,2);P(d,"variant","ghost"),y(()=>P(d,"disabled",e.busy)),pe("click",u,function(...h){var p;(p=e.onConfirm)==null||p.apply(this,h)}),pe("click",d,function(...h){var p;(p=e.onDiscard)==null||p.apply(this,h)}),C(t,i),Le()}lt(["click"]);var YN=I("<p>Discard the imported palette and return to the built-in colours?</p> <mndw-button>Yes, reset</mndw-button> <mndw-button>Cancel</mndw-button>",3),KN=I("<mndw-button> </mndw-button>",2),JN=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),QN=I('<div class="mndw-palette-reset svelte-16mndpw"><!> <!></div>');function eO(t,e){Ie(e,!0);let n=Y(!1);function r(){e.busy||e.disabled||_(n,!0)}function i(){_(n,!1),e.onReset()}var s=QN(),o=v(s);{var a=d=>{var h=YN(),p=T(Xe(h),2);P(p,"variant","danger"),y(()=>P(p,"disabled",e.busy||e.disabled));var g=T(p,2);P(g,"variant","secondary"),y(()=>P(g,"disabled",e.busy||e.disabled)),pe("click",p,i),pe("click",g,()=>_(n,!1)),C(d,h)},l=d=>{var h=KN();P(h,"variant","danger"),y(()=>P(h,"disabled",e.busy||e.disabled));var p=v(h);y(()=>S(p,`Reset to default${e.busy?"...":""}`)),pe("click",h,r),C(d,h)};Z(o,d=>{f(n)?d(a):d(l,-1)})}var c=T(o,2);{var u=d=>{var h=JN(),p=v(h);y(()=>S(p,e.error)),C(d,h)};Z(c,d=>{e.error&&d(u)})}C(t,s),Le()}lt(["click"]);var tO=I('<div class="mndw-alert mndw-alert--danger" role="alert"> <mndw-button>Retry</mndw-button> <mndw-button>Dismiss</mndw-button></div>',2),nO=I('<p role="status">Loading palette...</p>'),rO=I('<p role="status">Reading palette...</p>'),iO=I("<li> </li>"),sO=I('<div class="mndw-alert mndw-alert--danger" role="alert"><ul></ul> <mndw-button>Dismiss</mndw-button></div>',2),oO=I('<p role="status">Saved.</p>'),aO=I('<!> <!> <!> <!> <div class="mndw-palette-manager__actions svelte-1adkxr0"><!> <!></div>',1),lO=I('<section class="mndw-palette-manager svelte-1adkxr0"><h3>Palette</h3> <!> <!> <!></section>');function cO(t,e){Ie(e,!0);let n=Y("loading");const r=Ar().palette;let i=Y(""),s=Y(st([])),o=Y(""),a=Y(""),l=Y(!1),c=Y(null),u=Y(st([])),d=fe(()=>f(n)==="loading"||f(n)==="importing"||f(n)==="previewing"||f(n)==="committing"||f(n)==="resetting"),h=fe(()=>f(n)!=="idle"),p=fe(()=>f(n)!=="idle");async function g(){if(!(f(n)!=="loading"&&f(n)!=="idle")){_(n,"loading");try{await r.refreshPalette(),_(i,"")}catch(oe){_(i,or(oe),!0)}finally{_(n,"idle")}}}function m(){_(i,"")}kn(()=>{g()});function b(){_(s,[],!0),_(o,""),_(l,!1),_(n,"importing")}function E(oe,q){_(s,[],!0),_(o,""),_(l,!1),_(c,oe,!0),_(u,q,!0),r.previewOverride(oe),_(n,"previewing")}function M(oe){_(s,oe,!0),_(n,"importError")}function z(){_(s,[],!0),_(n,"idle")}async function R(){if(f(c)!==null){_(n,"committing"),_(o,"");try{await r.commitOverride(f(c)),_(c,null),_(u,[],!0),_(l,!0),_(n,"idle")}catch(oe){_(o,or(oe),!0),_(n,"previewing")}}}function A(){r.discardPreview(),_(c,null),_(u,[],!0),_(o,""),_(n,"idle")}async function x(){_(n,"resetting"),_(a,"");try{await r.resetToDefault(),_(l,!1)}catch(oe){_(a,or(oe),!0)}finally{_(n,"idle")}}var N=lO(),O=T(v(N),2);{var j=oe=>{var q=tO(),K=v(q),ne=T(K);P(ne,"variant","secondary"),y(()=>P(ne,"disabled",f(n)!=="idle"));var le=T(ne,2);P(le,"variant","ghost"),y(()=>S(K,`${f(i)??""} `)),pe("click",ne,()=>void g()),pe("click",le,m),C(oe,q)};Z(O,oe=>{f(i)&&oe(j)})}var B=T(O,2);{var J=oe=>{var q=nO();C(oe,q)};Z(B,oe=>{f(n)==="loading"&&oe(J)})}var W=T(B,2);{var H=oe=>{var q=En(),K=Xe(q);{var ne=le=>{{let se=fe(()=>f(n)==="committing");XN(le,{get busy(){return f(se)},get error(){return f(o)},onConfirm:()=>void R(),onDiscard:A,get palette(){return f(c)},get warnings(){return f(u)}})}};Z(K,le=>{f(c)&&le(ne)})}C(oe,q)},ee=oe=>{var q=aO(),K=Xe(q);{var ne=ae=>{var U=rO();C(ae,U)};Z(K,ae=>{f(n)==="importing"&&ae(ne)})}var le=T(K,2);jN(le,{get disabled(){return f(d)},onErrors:M,onImportStart:b,onPreview:E});var se=T(le,2);{var ue=ae=>{var U=sO(),re=v(U);ht(re,20,()=>f(s),ve=>ve,(ve,Ze)=>{var rt=iO(),Et=v(rt);y(()=>S(Et,Ze)),C(ve,rt)});var X=T(re,2);P(X,"variant","ghost"),pe("click",X,z),C(ae,U)};Z(se,ae=>{f(n)==="importError"&&ae(ue)})}var De=T(se,2);{var Ye=ae=>{var U=oO();C(ae,U)};Z(De,ae=>{f(l)&&ae(Ye)})}var je=T(De,2),Je=v(je);$N(Je,{get disabled(){return f(h)},get read(){return r.getExportable}});var ce=T(Je,2);{let ae=fe(()=>f(n)==="resetting");eO(ce,{get busy(){return f(ae)},get disabled(){return f(p)},get error(){return f(a)},onReset:()=>void x()})}C(oe,q)};Z(W,oe=>{f(n)==="previewing"||f(n)==="committing"?oe(H):oe(ee,-1)})}C(t,N),Le()}lt(["click"]);var uO=I("<mndw-option>Pseudo (en-XA)</mndw-option>",2),dO=I('<span role="status"> </span>'),fO=I("<ul><li><strong> </strong> </li> <li><strong> </strong> </li> <li><strong> </strong> </li></ul>"),rp=I("<p> </p>"),si=I('<p role="alert"> </p>'),hO=I('<p role="alert"> </p> <!>',1),ip=I('<p role="status"> </p>'),sp=I("<li> <!></li>"),op=I("<ul></ul>"),ap=I('<div class="persistent-rci-extenders svelte-1vnn4f1"><h4> </h4> <!> <!></div>'),pO=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <!> <!>",3),gO=I("<mndw-button> </mndw-button>",2),mO=I('<p class="unsupported-banner svelte-1vnn4f1" role="alert"> </p>'),vO=I('<mndw-field><mndw-input></mndw-input></mndw-field> <div class="persistent-rci-actions svelte-1vnn4f1"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <!></div> <!> <!>',3),bO=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <!> <!> <!> <!>",3),_O=I("<section><h3> </h3> <!></section>"),wO=I("<section><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <p> </p> <p> </p> <!></section>",2),yO=I('<div class="mndw-general-settings svelte-1vnn4f1"><section><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field></section> <!> <section><h3> </h3> <mndw-field><mndw-select><mndw-option> </mndw-option> <mndw-option> </mndw-option> <!></mndw-select> <!></mndw-field> <!></section> <!> <!></div>',2);function EO(t,e){Ie(e,!0);const n=Ar(),r=n.locale,i=n.persistentRci;let s=Y(null),o=fe(()=>{var V;return((V=f(s))==null?void 0:V.controller.auth)??"unknown"}),a=fe(()=>{var ge;const V=(ge=f(s))==null?void 0:ge.controller.support;return V==="supported"||V==="invalid"}),l=fe(()=>f(a)?"<TOKEN SET>":""),c=Y(!1),u=Y(!0),d=Y(!1),h=Y(""),p=Y(""),g=Y(null),m=null,b=Y(!1),E=Y(!0),M=Y(""),z=fe(()=>{var ge,Ce;const V=(ge=f(s))==null?void 0:ge.controller.support;return((Ce=f(s))==null?void 0:Ce.controller.enabled)===!0&&(V==="supported"||V==="invalid")});hn(()=>{var V;e.onPermissionStateChange({visible:f(o)!=="unknown",available:((V=f(s))==null?void 0:V.controller.support)==="supported"})}),kn(()=>{R(),A()}),Do(()=>{_(p,""),m==null||m.abort(),m=null});async function R(){_(u,!0),_(h,"");try{_(s,await i.getCapability(),!0),_(c,f(s).controller.enabled||f(s).controller.support==="needs-token",!0),oe()}catch{_(s,null),_(c,!1)}finally{_(u,!1)}}async function A(){_(E,!0),_(M,"");try{_(b,(await n.mgmtClient.getTelemetry()).enabled,!0)}catch{_(M,w("settings.telemetry-error"),!0)}finally{_(E,!1)}}function x(V){const ge=V.detail.checked??V.detail.value??!1,Ce=f(b);_(b,ge,!0),_(M,""),_(E,!0),n.mgmtClient.setTelemetry(ge).catch(()=>{_(b,Ce,!0),_(M,w("settings.telemetry-error"),!0)}).finally(()=>{_(E,!1)})}function N(V){_(c,V.detail.checked??V.detail.value??!1,!0),_(g,null),_(h,""),f(c)||(_(p,""),m==null||m.abort(),m=null)}async function O(V){var Ge;const ge=V.detail.checked??V.detail.value??!1,Ce=((Ge=f(s))==null?void 0:Ge.controller.enabled)??!1;_(d,!0),f(s)&&_(s,{...f(s),controller:{...f(s).controller,enabled:ge}},!0),_(h,"");try{await i.setEnabled(ge),await R()}catch(et){f(s)&&_(s,{...f(s),controller:{...f(s).controller,enabled:Ce}},!0),await R(),_(h,B(et),!0)}finally{_(d,!1)}}function j(V){_(p,V.detail.value,!0)}function B(V){if(V instanceof er){if(V.code==="RCI_TOKEN_INVALID")return w("settings.controller-token-rejected");if(V.code==="RCI_FIRMWARE_UNSUPPORTED")return w("settings.firmware-unsupported");if(V.code==="RCI_DEVICE_UNREACHABLE")return w("settings.device-unreachable")}return w("settings.persistent-request-failed")}async function J(){_(d,!0),_(h,""),_(g,null);try{_(g,await i.testController(f(p)),!0)}catch(V){_(h,B(V),!0)}finally{_(d,!1)}}async function W(){_(d,!0),_(h,""),_(g,null);try{_(g,await i.saveController(f(p)),!0),_(p,""),await R()}catch(V){_(h,B(V),!0)}finally{_(p,""),_(d,!1)}}async function H(){_(d,!0),_(h,"");try{await i.clearController(),_(c,!1),_(p,""),_(g,null),await R()}catch(V){_(h,B(V),!0)}finally{_(d,!1)}}function ee(V){me.localeSwitchPending||r.setLocale(V.detail.value).catch(()=>{})}function oe(){if(m==null||m.abort(),!f(s)||!q(f(s))){m=null;return}const V=new AbortController;m=V,K(V.signal)}function q(V){return V.controller.support==="invalid"||V.extenders.some(ge=>ge.state==="establishing"||ge.state==="dead")}async function K(V){let ge=null;for(;!V.aborted&&f(s)&&q(f(s));){if(f(s).extenders.some(Ce=>Ce.state==="establishing"))ge=null;else if(ge===null)ge=Date.now();else if(Date.now()-ge>=6e4)return;if(await new Promise(Ce=>{const Ge=window.setTimeout(Ce,2e3);V.addEventListener("abort",()=>{window.clearTimeout(Ge),Ce()},{once:!0})}),V.aborted)return;try{_(s,await i.getCapability(),!0)}catch{}}}var ne=yO(),le=v(ne),se=v(le),ue=v(se),De=T(se,2);y(()=>P(De,"label",w("settings.dark-theme"))),Oe(De,1,"svelte-1vnn4f1");var Ye=v(De);P(Ye,"id","mndw-theme-switch"),y(()=>P(Ye,"checked",me.theme==="dark"));var je=T(le,2);cO(je,{});var Je=T(je,2),ce=v(Je),ae=v(ce),U=T(ce,2);y(()=>P(U,"label",w("settings.language.label"))),Oe(U,1,"svelte-1vnn4f1");var re=v(U);y(()=>P(re,"value",me.locale)),y(()=>P(re,"aria-busy",String(me.localeSwitchPending)));var X=v(re);P(X,"value","en");var ve=v(X),Ze=T(X,2);P(Ze,"value","ru");var rt=v(Ze),Et=T(Ze,2);{var jt=V=>{var ge=uO();P(ge,"value","en-XA"),C(V,ge)},on=fe(()=>r.getAvailableLocales().includes("en-XA"));Z(Et,V=>{f(on)&&V(jt)})}var Xn=T(re,2);{var Sn=V=>{var ge=dO(),Ce=v(ge);y(Ge=>S(Ce,Ge),[()=>w("settings.language.pending")]),C(V,ge)};Z(Xn,V=>{me.localeSwitchPending&&V(Sn)})}var Yn=T(U,2);{var Kn=V=>{var ge=fO(),Ce=v(ge),Ge=v(Ce),et=v(Ge),ct=T(Ge),Tt=T(Ce,2),$e=v(Tt),He=v($e),We=T($e),Re=T(Tt,2),L=v(Re),Q=v(L),we=T(L);y((_e,kt,gt)=>{S(et,_e),S(ct,` ${me.deviceInfo.deviceName??""}`),S(He,kt),S(We,` ${me.deviceInfo.vendor??""}`),S(Q,gt),S(we,` ${me.deviceInfo.firmwareVersion??""}`)},[()=>w("settings.name"),()=>w("settings.vendor"),()=>w("settings.firmware")]),C(V,ge)},ur=V=>{var ge=rp(),Ce=v(ge);y(Ge=>S(Ce,Ge),[()=>w("settings.device-unavailable")]),C(V,ge)};Z(Yn,V=>{me.deviceInfo?V(Kn):V(ur,-1)})}var an=T(Je,2);{var dr=V=>{var ge=_O(),Ce=v(ge),Ge=v(Ce),et=T(Ce,2);{var ct=He=>{var We=hO(),Re=Xe(We),L=v(Re),Q=T(Re,2);{var we=_e=>{var kt=si(),gt=v(kt);y(()=>S(gt,f(h))),C(_e,kt)};Z(Q,_e=>{f(h)&&_e(we)})}y(_e=>S(L,_e),[()=>w("settings.persistent-state-unavailable")]),C(He,We)},Tt=He=>{var We=pO(),Re=Xe(We);y(()=>P(Re,"label",w("settings.persistent-tokenless-toggle"))),Oe(Re,1,"svelte-1vnn4f1");var L=v(Re);P(L,"id","mndw-persistent-rci-enabled"),y(()=>{var Dt;return P(L,"checked",((Dt=f(s))==null?void 0:Dt.controller.enabled)??!1)}),y(()=>P(L,"disabled",f(d)));var Q=T(Re,2),we=v(Q),_e=T(Q,2);{var kt=Dt=>{var xn=si(),Mr=v(xn);y(()=>S(Mr,f(h))),C(Dt,xn)};Z(_e,Dt=>{f(h)&&Dt(kt)})}var gt=T(_e,2);{var Jn=Dt=>{var xn=ap(),Mr=v(xn),St=v(Mr),at=T(Mr,2);{var Ot=ie=>{var Be=ip(),Ke=v(Be);y(mt=>S(Ke,mt),[()=>w("settings.persistent-enumeration-stale")]),C(ie,Be)};Z(at,ie=>{f(s).stale&&ie(Ot)})}var Xt=T(at,2);{var G=ie=>{var Be=op();ht(Be,21,()=>f(s).extenders,Ke=>Ke.identity,(Ke,mt)=>{var Nr=sp(),Ti=v(Nr),Ci=T(Ti);{var ys=Qn=>{var zt=Hs();y(Ct=>S(zt,Ct),[()=>w(`settings.extender-reason-${f(mt).reason}`)]),C(Qn,zt)},Es=Qn=>{var zt=Hs();y(Ct=>S(zt,Ct),[()=>w(`settings.extender-state-${f(mt).state??"establishing"}`)]),C(Qn,zt)};Z(Ci,Qn=>{f(mt).eligible?Qn(Es,-1):Qn(ys)})}y(()=>S(Ti,`${(f(mt).name||f(mt).identity)??""}: `)),C(Ke,Nr)}),C(ie,Be)};Z(Xt,ie=>{f(s).extenders.length>0&&ie(G)})}y(ie=>S(St,ie),[()=>w("settings.persistent-extenders-title")]),C(Dt,xn)};Z(gt,Dt=>{var xn;((xn=f(s))==null?void 0:xn.controller.support)==="supported"&&Dt(Jn)})}y(Dt=>S(we,Dt),[()=>w("settings.persistent-tokenless-description")]),dt("mndwchange",L,Dt=>void O(Dt)),C(He,We)},$e=He=>{var We=bO(),Re=Xe(We);y(()=>P(Re,"label",w("settings.configure-persistent"))),Oe(Re,1,"svelte-1vnn4f1");var L=v(Re);P(L,"id","mndw-persistent-rci-enabled"),y(()=>P(L,"checked",f(c))),y(()=>P(L,"disabled",f(u)||f(d)));var Q=T(Re,2);{var we=St=>{var at=si(),Ot=v(at);y(()=>S(Ot,f(h))),C(St,at)};Z(Q,St=>{f(h)&&St(we)})}var _e=T(Q,2);{var kt=St=>{var at=si(),Ot=v(at);y(Xt=>S(Ot,Xt),[()=>w("settings.persistent-storage-disabled")]),C(St,at)},gt=St=>{var at=si(),Ot=v(at);y(Xt=>S(Ot,Xt),[()=>w("settings.persistent-storage-decrypt-failed")]),C(St,at)};Z(_e,St=>{var at,Ot;((at=f(s))==null?void 0:at.store.state)==="disabled"?St(kt):((Ot=f(s))==null?void 0:Ot.store.state)==="decrypt-failed"&&St(gt,1)})}var Jn=T(_e,2);{var Dt=St=>{var at=si(),Ot=v(at);y(Xt=>S(Ot,Xt),[()=>w("settings.persistent-needs-token")]),C(St,at)};Z(Jn,St=>{var at;((at=f(s))==null?void 0:at.controller.support)==="needs-token"&&St(Dt)})}var xn=T(Jn,2);{var Mr=St=>{var at=vO(),Ot=Xe(at);y(()=>P(Ot,"label",w("settings.controller-token"))),Oe(Ot,1,"svelte-1vnn4f1");var Xt=v(Ot);P(Xt,"type","password"),P(Xt,"autocomplete","off"),y(()=>P(Xt,"placeholder",f(l))),y(()=>P(Xt,"value",f(p))),y(()=>P(Xt,"disabled",f(d)));var G=T(Ot,2),ie=v(G);P(ie,"variant","secondary"),y(()=>P(ie,"disabled",f(d)||f(p)===""));var Be=v(ie),Ke=T(ie,2);P(Ke,"variant","primary"),y(()=>P(Ke,"disabled",f(d)||f(p)===""));var mt=v(Ke),Nr=T(Ke,2);{var Ti=zt=>{var Ct=gO();P(Ct,"variant","danger"),y(()=>P(Ct,"disabled",f(d)));var Pi=v(Ct);y(ks=>S(Pi,ks),[()=>w("settings.clear-controller-session")]),pe("click",Ct,()=>void H()),C(zt,Ct)};Z(Nr,zt=>{f(a)&&zt(Ti)})}var Ci=T(G,2);{var ys=zt=>{var Ct=En(),Pi=Xe(Ct);{var ks=Or=>{var ni=mO(),Ss=v(ni);y(mn=>S(Ss,mn),[()=>w("settings.update-firmware-persistent")]),C(Or,ni)},qo=Or=>{var ni=rp(),Ss=v(ni);y(mn=>S(Ss,mn),[()=>w("settings.controller-result",{result:f(g).result})]),C(Or,ni)};Z(Pi,Or=>{f(g).result==="unsupported-firmware"?Or(ks):Or(qo,-1)})}C(zt,Ct)};Z(Ci,zt=>{f(g)&&zt(ys)})}var Es=T(Ci,2);{var Qn=zt=>{var Ct=ap(),Pi=v(Ct),ks=v(Pi),qo=T(Pi,2);{var Or=mn=>{var xs=ip(),Ts=v(xs);y(ri=>S(Ts,ri),[()=>w("settings.persistent-enumeration-stale")]),C(mn,xs)};Z(qo,mn=>{f(s).stale&&mn(Or)})}var ni=T(qo,2);{var Ss=mn=>{var xs=op();ht(xs,21,()=>f(s).extenders,Ts=>Ts.identity,(Ts,ri)=>{var Fd=sp(),Gd=v(Fd),lb=T(Gd);{var cb=Ri=>{var Cs=Hs();y($l=>S(Cs,$l),[()=>w(`settings.extender-reason-${f(ri).reason}`)]),C(Ri,Cs)},ub=Ri=>{var Cs=Hs();y($l=>S(Cs,$l),[()=>w(`settings.extender-state-${f(ri).state??"establishing"}`)]),C(Ri,Cs)};Z(lb,Ri=>{f(ri).eligible?Ri(ub,-1):Ri(cb)})}y(()=>S(Gd,`${(f(ri).name||f(ri).identity)??""}: `)),C(Ts,Fd)}),C(mn,xs)};Z(ni,mn=>{f(s).extenders.length>0&&mn(Ss)})}y(mn=>S(ks,mn),[()=>w("settings.persistent-extenders-title")]),C(zt,Ct)};Z(Es,zt=>{var Ct;((Ct=f(s))==null?void 0:Ct.controller.support)==="supported"&&zt(Qn)})}y((zt,Ct)=>{S(Be,zt),S(mt,Ct)},[()=>w("settings.test"),()=>w("settings.save")]),dt("mndwinput",Xt,j),pe("click",ie,()=>void J()),pe("click",Ke,()=>void W()),C(St,at)};Z(xn,St=>{var at;(f(c)||((at=f(s))==null?void 0:at.controller.support)==="needs-token")&&St(Mr)})}dt("mndwchange",L,N),C(He,We)};Z(et,He=>{f(o)==="unknown"?He(ct):f(o)==="none"?He(Tt,1):He($e,-1)})}y((He,We)=>{Ae(ge,"aria-label",He),S(Ge,We)},[()=>w("settings.persistent-rci-title"),()=>w("settings.persistent-rci-title")]),C(V,ge)};Z(an,V=>{f(u)||V(dr)})}var ke=T(an,2);{var ze=V=>{var ge=wO(),Ce=v(ge),Ge=v(Ce),et=T(Ce,2);y(()=>P(et,"label",w("settings.telemetry-toggle"))),Oe(et,1,"svelte-1vnn4f1");var ct=v(et);P(ct,"id","mndw-telemetry-enabled"),y(()=>P(ct,"checked",f(b))),y(()=>P(ct,"disabled",f(E)));var Tt=T(et,2),$e=v(Tt),He=T(Tt,2),We=v(He),Re=T(He,2),L=v(Re),Q=T(Re,2);{var we=_e=>{var kt=si(),gt=v(kt);y(()=>S(gt,f(M))),C(_e,kt)};Z(Q,_e=>{f(M)&&_e(we)})}y((_e,kt,gt,Jn)=>{S(Ge,_e),S($e,kt),S(We,gt),S(L,Jn)},[()=>w("settings.telemetry-label"),()=>w("settings.telemetry-description"),()=>w("settings.telemetry-session-note"),()=>w("settings.telemetry-wear-note")]),dt("mndwchange",ct,x),C(V,ge)};Z(ke,V=>{f(z)&&V(ze)})}y((V,ge,Ce,Ge)=>{Ae(ne,"data-locale",me.locale),S(ue,V),S(ae,ge),S(ve,Ce),S(rt,Ge)},[()=>w("settings.appearance"),()=>w("settings.device"),()=>w("settings.language.english"),()=>w("settings.language.russian")]),dt("mndwchange",Ye,function(...V){Fi==null||Fi.apply(this,V)}),dt("mndwchange",re,ee),C(t,ne),Le()}lt(["click"]);var kO=I('<p class="mndw-installed__empty svelte-egoe9l"> </p>'),SO=I('<span class="mndw-installed__builtin svelte-egoe9l"> </span>'),xO=I('<span class="mndw-installed__deps-badge svelte-egoe9l"> </span>'),TO=I('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed svelte-egoe9l"> </span>'),CO=I('<span class="mndw-installed__version-badge svelte-egoe9l"> </span>'),PO=I('<p class="mndw-installed__version-warning svelte-egoe9l"> </p>'),RO=I('<p class="mndw-installed__backend svelte-egoe9l"> </p>'),AO=I("<mndw-field><mndw-switch></mndw-switch></mndw-field>",2),Ic=I("<mndw-button> </mndw-button>",2),MO=I('<div class="mndw-alert mndw-alert--danger" role="alert"> <!></div>'),NO=I('<div class="mndw-installed__confirmation svelte-egoe9l"><p class="svelte-egoe9l"> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),OO=I('<div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button> <!> <!></div>',2),zO=I("<span> </span>"),IO=I('<span class="mndw-installed__runtime-warning svelte-egoe9l"> </span>'),LO=I('<p class="mndw-installed__runtime-warning svelte-egoe9l"> </p>'),DO=I('<p class="mndw-installed__runtime svelte-egoe9l"> <!> <!> <!></p> <!>',1),HO=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> <span> </span> <!> <!> <!></div> <!> <!> <!> <!> <!> <!></li>'),BO=I('<ul class="mndw-installed__list svelte-egoe9l"></ul>'),$O=I('<section class="mndw-installed svelte-egoe9l" aria-labelledby="mndw-installed-title"><h3 id="mndw-installed-title" class="svelte-egoe9l"> </h3> <!></section>');function UO(t,e){Ie(e,!0);function n(z,R,A){return w(z===1?R:A,{count:z})}function r(z){const R=[],A=Object.values(z.routes??{}),x=A.filter(O=>O.transport==="http").length,N=A.filter(O=>O.transport==="websocket").length;return x>0&&R.push(n(x,"settings.plugin-manager.endpoint-one","settings.plugin-manager.endpoint-many")),N>0&&R.push(n(N,"settings.plugin-manager.websocket-one","settings.plugin-manager.websocket-many")),R}function i(z){return z.length>240?`${z.slice(0,240)}…`:z}function s(z,R){var A;return((A=z.permissionGrants)==null?void 0:A[R])??!1}function o(z){return z.endsWith(":write")?w("settings.plugin-manager.persistent-rci-write"):w("settings.plugin-manager.persistent-rci-read")}function a(z){switch(z){case"stopped":return w("settings.plugin-manager.runtime-state-stopped");case"capacity_blocked":return w("settings.plugin-manager.runtime-state-capacity-blocked");case"starting":return w("settings.plugin-manager.runtime-state-starting");case"ready":return w("settings.plugin-manager.runtime-state-ready");case"backoff":return w("settings.plugin-manager.runtime-state-backoff");case"failed":return w("settings.plugin-manager.runtime-state-failed")}}let l=Yt(e,"rowStateFor",3,()=>{}),c=Yt(e,"permissionVisible",3,!1),u=Yt(e,"permissionAvailable",3,!1),d=Yt(e,"onRestart",3,()=>{}),h=Yt(e,"onRefresh",3,()=>{});var p=$O(),g=v(p),m=v(g),b=T(g,2);{var E=z=>{var R=kO(),A=v(R);y(x=>S(A,x),[()=>w("settings.plugin-manager.no-installed")]),C(z,R)},M=z=>{var R=BO();ht(R,21,()=>e.items,A=>A.name,(A,x)=>{const N=fe(()=>r(f(x).backend)),O=fe(()=>oR(f(x).name)),j=fe(()=>Go(f(x).name)),B=fe(()=>l()(f(x).name)),J=fe(()=>{var ke,ze;return((ke=f(B))==null?void 0:ke.state)==="working"||((ze=f(B))==null?void 0:ze.state)==="reconciling"});var W=HO(),H=v(W),ee=v(H),oe=v(ee),q=T(ee,2),K=v(q),ne=T(H,2),le=v(ne),se=v(le),ue=T(le,2),De=v(ue),Ye=T(ue,2),je=v(Ye),Je=T(Ye,2);{var ce=ke=>{var ze=SO(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.builtin")]),C(ke,ze)};Z(Je,ke=>{f(x).source==="builtin"&&ke(ce)})}var ae=T(Je,2);{var U=ke=>{var ze=xO(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.installing-dependencies")]),C(ke,ze)},re=ke=>{var ze=TO(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.dependency-install-failed")]),C(ke,ze)};Z(ae,ke=>{f(j)==="installing"?ke(U):f(j)==="failed"&&ke(re,1)})}var X=T(ae,2);{var ve=ke=>{var ze=CO(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.version-mismatch")]),C(ke,ze)};Z(X,ke=>{f(O).length>0&&ke(ve)})}var Ze=T(ne,2);{var rt=ke=>{var ze=PO(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.load-version-warning",{versions:f(O).join(", ")})]),C(ke,ze)};Z(Ze,ke=>{f(O).length>0&&ke(rt)})}var Et=T(Ze,2);{var jt=ke=>{var ze=RO(),V=v(ze);y(ge=>S(V,ge),[()=>f(N).join(", ")]),C(ke,ze)};Z(Et,ke=>{f(N).length>0&&ke(jt)})}var on=T(Et,2);{var Xn=ke=>{var ze=En(),V=Xe(ze);ht(V,16,()=>fd,ge=>ge,(ge,Ce)=>{var Ge=En(),et=Xe(Ge);{var ct=$e=>{var He=AO();Oe(He,1,"mndw-installed__permission-switch"),y(()=>P(He,"label",o(Ce)));var We=v(He);y(()=>P(We,"checked",s(f(x),Ce))),y(()=>P(We,"disabled",f(J)||!s(f(x),Ce)&&!u())),dt("mndwchange",We,Re=>e.onPermissionChange(f(x).name,Ce,Re.detail.checked)),C($e,He)},Tt=fe(()=>{var $e;return($e=f(x).permissions)==null?void 0:$e.includes(Ce)});Z(et,$e=>{f(Tt)&&$e(ct)})}C(ge,Ge)}),C(ke,ze)};Z(on,ke=>{c()&&ke(Xn)})}var Sn=T(on,2);{var Yn=ke=>{var ze=MO(),V=v(ze),ge=T(V);{var Ce=Ge=>{var et=Ic();Oe(et,1,"mndw-installed__refresh"),P(et,"variant","ghost");var ct=v(et);y(Tt=>S(ct,Tt),[()=>w("settings.plugin-manager.refresh")]),pe("click",et,function(...Tt){var $e;($e=h())==null||$e.apply(this,Tt)}),C(Ge,et)};Z(ge,Ge=>{var et;((et=f(B))==null?void 0:et.state)==="notice-finishing"&&Ge(Ce)})}y(()=>{var Ge;return S(V,`${((Ge=f(B))==null?void 0:Ge.message)??""} `)}),C(ke,ze)};Z(Sn,ke=>{var ze;f(B)!==void 0&&((ze=f(B))==null?void 0:ze.message)!==""&&ke(Yn)})}var Kn=T(Sn,2);{var ur=ke=>{var ze=OO(),V=v(ze);Oe(V,1,"mndw-installed__toggle"),P(V,"variant","primary"),y(()=>P(V,"disabled",f(J)));var ge=v(V),Ce=T(V,2);{var Ge=$e=>{var He=Ic();Oe(He,1,"mndw-installed__restart"),P(He,"variant","secondary"),y(()=>P(He,"disabled",f(J)));var We=v(He);y(Re=>S(We,Re),[()=>w("settings.plugin-manager.restart-backend")]),pe("click",He,()=>d()(f(x).name)),C($e,He)};Z(Ce,$e=>{f(x).runtime&&f(x).runtime.state!=="stopped"&&$e(Ge)})}var et=T(Ce,2);{var ct=$e=>{var He=NO(),We=v(He),Re=v(We),L=T(We,2);Oe(L,1,"mndw-installed__cancel"),P(L,"variant","ghost"),y(()=>P(L,"disabled",f(J)));var Q=v(L),we=T(L,2);Oe(we,1,"mndw-installed__confirm"),P(we,"variant","danger"),y(()=>P(we,"disabled",f(J)));var _e=v(we);y((kt,gt,Jn)=>{S(Re,kt),S(Q,gt),S(_e,Jn)},[()=>w("settings.plugin-manager.delete-confirmation",{label:f(x).label}),()=>w("settings.plugin-manager.cancel"),()=>w("settings.plugin-manager.delete-plugin")]),pe("click",L,function(...kt){var gt;(gt=e.onCancelConfirm)==null||gt.apply(this,kt)}),pe("click",we,()=>e.onDelete(f(x).name)),C($e,He)},Tt=$e=>{var He=Ic();Oe(He,1,"mndw-installed__delete"),P(He,"variant","danger"),y(()=>P(He,"disabled",f(J)));var We=v(He);y(Re=>S(We,Re),[()=>w("settings.plugin-manager.delete")]),pe("click",He,()=>e.onRequestConfirm(f(x).name)),C($e,He)};Z(et,$e=>{e.confirmingName===f(x).name?$e(ct):$e(Tt,-1)})}y($e=>S(ge,$e),[()=>f(x).enabled?w("settings.plugin-manager.disable"):w("settings.plugin-manager.enable")]),pe("click",V,()=>f(x).enabled?e.onDisable(f(x).name):e.onEnable(f(x).name)),C(ke,ze)};Z(Kn,ke=>{f(x).source!=="builtin"&&ke(ur)})}var an=T(Kn,2);{var dr=ke=>{var ze=DO(),V=Xe(ze),ge=v(V),Ce=T(ge);{var Ge=Re=>{var L=zO(),Q=v(L);y(we=>S(Q,`· ${we??""} ${f(x).runtime.requiredProtocol??""}`),[()=>w("settings.plugin-manager.protocol")]),C(Re,L)};Z(Ce,Re=>{f(x).runtime.requiredProtocol!==void 0&&Re(Ge)})}var et=T(Ce,2);{var ct=Re=>{var L=IO(),Q=v(L);y(we=>S(Q,`· ${we??""}`),[()=>w("settings.plugin-manager.incompatible")]),C(Re,L)};Z(et,Re=>{f(x).runtime.compatible===!1&&Re(ct)})}var Tt=T(et,2);{var $e=Re=>{var L=Hs();y(Q=>S(L,`— ${Q??""}`),[()=>i(f(x).runtime.lastError)]),C(Re,L)};Z(Tt,Re=>{f(x).runtime.lastError&&Re($e)})}var He=T(V,2);{var We=Re=>{var L=LO(),Q=v(L);y((we,_e)=>S(Q,`${we??""}: ${_e??""}`),[()=>w("settings.plugin-manager.supported-service-protocols"),()=>f(x).runtime.supportedProtocols.join(", ")]),C(Re,L)};Z(He,Re=>{f(x).runtime.compatible===!1&&f(x).runtime.supportedProtocols&&Re(We)})}y((Re,L)=>S(ge,`${Re??""}: ${L??""} `),[()=>w("settings.plugin-manager.backend"),()=>a(f(x).runtime.state)]),C(ke,ze)};Z(an,ke=>{f(x).runtime&&ke(dr)})}y((ke,ze,V)=>{S(oe,f(x).label),S(K,f(x).name),S(se,`${ke??""}: ${f(x).version??""}`),S(De,`${ze??""}: ${f(x).type??""}`),S(je,`${V??""}: ${f(x).source??""}`)},[()=>w("settings.plugin-manager.version"),()=>w("settings.plugin-manager.type"),()=>w("settings.plugin-manager.source")]),C(A,W)}),C(z,R)};Z(b,z=>{e.items.length===0?z(E):z(M,-1)})}y(z=>S(m,z),[()=>w("settings.plugin-manager.installed-title")]),C(t,p),Le()}lt(["click"]);var jO=I("<li> </li>"),FO=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 tb(t,e){Ie(e,!0);let n=fe(()=>e.lock===void 0?[]:eR(e.lock));function r(a){return a.kind==="sdk-major"?w("settings.plugin-manager.version-warning.sdk-major",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):a.kind==="sdk-newer-minor"?w("settings.plugin-manager.version-warning.sdk-newer-minor",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):w("settings.plugin-manager.version-warning.shared-major",{name:a.name,pluginVersion:a.pluginVersion,hostVersion:a.hostVersion})}var i=En(),s=Xe(i);{var o=a=>{var l=FO(),c=v(l),u=v(c),d=T(c,2);ht(d,21,()=>f(n),g=>`${g.kind}:${g.name}`,(g,m)=>{var b=jO(),E=v(b);y(M=>S(E,M),[()=>r(f(m))]),C(g,b)});var h=T(d,2),p=v(h);y((g,m)=>{S(u,g),S(p,m)},[()=>w("settings.plugin-manager.version-warning.title"),()=>w("settings.plugin-manager.version-warning.install-anyway")]),C(a,l)};Z(s,a=>{f(n).length>0&&a(o)})}C(t,i),Le()}var GO=I('<p class="mndw-cap__kind svelte-14iyjl4"> </p>'),Ns=I("<li> </li>"),Os=I('<section class="mndw-cap__section svelte-14iyjl4"><h4 class="svelte-14iyjl4"> </h4> <ul class="svelte-14iyjl4"></ul></section>'),VO=I('<div class="mndw-cap svelte-14iyjl4"><!> <!> <!> <!> <!> <!> <!></div>');function nb(t,e){Ie(e,!0);let n=fe(()=>Object.entries(e.entry.backend.routes??{})),r=fe(()=>{var A;return((A=e.entry.review)==null?void 0:A.packages)??[]}),i=fe(()=>{var A;return((A=e.entry.review)==null?void 0:A.args)??[]}),s=fe(()=>{var A;return((A=e.entry.review)==null?void 0:A.publicRoutes)??[]}),o=fe(()=>e.entry.permissions??[]);var a=VO(),l=v(a);tb(l,{get lock(){return e.entry.lock}});var c=T(l,2);{var u=A=>{var x=GO(),N=v(x);y(O=>S(N,O),[()=>w(e.entry.review.kind==="service"?"settings.plugin-manager.backend-kind-service":"settings.plugin-manager.backend-kind-exec")]),C(A,x)};Z(c,A=>{e.entry.review!==void 0&&A(u)})}var d=T(c,2);{var h=A=>{var x=Os(),N=v(x),O=v(N),j=T(N,2);ht(j,20,()=>f(r),B=>B,(B,J)=>{var W=Ns(),H=v(W);y(()=>S(H,J)),C(B,W)}),y(B=>S(O,B),[()=>w("settings.plugin-manager.packages")]),C(A,x)};Z(d,A=>{f(r).length>0&&A(h)})}var p=T(d,2);{var g=A=>{var x=Os(),N=v(x),O=v(N),j=T(N,2);ht(j,23,()=>f(i),(B,J)=>`${J}:${B}`,(B,J)=>{var W=Ns(),H=v(W);y(()=>S(H,f(J))),C(B,W)}),y(B=>S(O,B),[()=>w("settings.plugin-manager.service-args")]),C(A,x)};Z(p,A=>{f(i).length>0&&A(g)})}var m=T(p,2);{var b=A=>{var x=Os(),N=v(x),O=v(N),j=T(N,2);ht(j,21,()=>f(n),([B,J])=>B,(B,J)=>{var W=fe(()=>$b(f(J),2));let H=()=>f(W)[0],ee=()=>f(W)[1];var oe=Ns(),q=v(oe);y(K=>S(q,`${H()??""}: ${ee().transport==="http"?`${ee().method??"GET"} `:""}${ee().path??""}${K??""}`),[()=>{var K;return(K=ee().protocols)!=null&&K.length?` (${ee().protocols.join(", ")})`:""}]),C(B,oe)}),y(B=>S(O,B),[()=>w("settings.plugin-manager.routes")]),C(A,x)};Z(m,A=>{f(n).length>0&&A(b)})}var E=T(m,2);{var M=A=>{var x=Os(),N=v(x),O=v(N),j=T(N,2);ht(j,20,()=>f(s),B=>B,(B,J)=>{var W=Ns(),H=v(W);y(()=>S(H,J)),C(B,W)}),y(B=>S(O,B),[()=>w("settings.plugin-manager.public-routes")]),C(A,x)};Z(E,A=>{f(s).length>0&&A(M)})}var z=T(E,2);{var R=A=>{var x=Os(),N=v(x),O=v(N),j=T(N,2);ht(j,20,()=>f(o),B=>B,(B,J)=>{var W=Ns(),H=v(W);y(()=>S(H,J)),C(B,W)}),y(B=>S(O,B),[()=>w("settings.plugin-manager.permissions")]),C(A,x)};Z(z,A=>{f(o).length>0&&A(R)})}C(t,a),Le()}var ZO=I("<mndw-button> </mndw-button>",2),WO=I('<div class="mndw-alert mndw-alert--danger" role="alert"> <!></div>'),qO=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),XO=I('<div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),YO=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>'),KO=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 JO(t,e){Ie(e,!0);let n=Yt(e,"rowStateFor",3,()=>{}),r=Yt(e,"onRefresh",3,()=>{});var i=KO(),s=v(i),o=v(s),a=T(s,2);ht(a,21,()=>e.items,l=>l.name,(l,c)=>{const u=fe(()=>n()(f(c).name)),d=fe(()=>{var O,j;return((O=f(u))==null?void 0:O.state)==="working"||((j=f(u))==null?void 0:j.state)==="reconciling"});var h=YO(),p=v(h),g=v(p),m=v(g),b=T(g,2),E=v(b),M=T(p,2);nb(M,{get entry(){return f(c)}});var z=T(M,2);{var R=O=>{var j=WO(),B=v(j),J=T(B);{var W=H=>{var ee=ZO();Oe(ee,1,"mndw-pending__refresh"),P(ee,"variant","ghost");var oe=v(ee);y(q=>S(oe,q),[()=>w("settings.plugin-manager.refresh")]),pe("click",ee,function(...q){var K;(K=r())==null||K.apply(this,q)}),C(H,ee)};Z(J,H=>{f(u).state==="notice-finishing"&&H(W)})}y(()=>S(B,`${f(u).message??""} `)),C(O,j)};Z(z,O=>{f(u)!==void 0&&f(u).message!==""&&O(R)})}var A=T(z,2);{var x=O=>{var j=qO(),B=v(j),J=v(B),W=T(B,2),H=v(W);Oe(H,1,"mndw-pending__cancel"),P(H,"variant","ghost");var ee=v(H),oe=T(H,2);Oe(oe,1,"mndw-pending__confirm"),P(oe,"variant","danger"),y(()=>P(oe,"disabled",f(d)));var q=v(oe);y((K,ne,le)=>{S(J,K),S(ee,ne),S(q,le)},[()=>w("settings.plugin-manager.deny-confirmation",{label:f(c).label}),()=>w("settings.plugin-manager.cancel"),()=>w("settings.plugin-manager.deny-plugin")]),pe("click",H,function(...K){var ne;(ne=e.onCancelConfirm)==null||ne.apply(this,K)}),pe("click",oe,()=>e.onDeny(f(c).name)),C(O,j)},N=O=>{var j=XO(),B=v(j);Oe(B,1,"mndw-pending__deny"),P(B,"variant","danger"),y(()=>P(B,"disabled",f(d)));var J=v(B),W=T(B,2);Oe(W,1,"mndw-pending__approve"),P(W,"variant","primary"),y(()=>P(W,"disabled",f(d)));var H=v(W);y((ee,oe)=>{S(J,ee),S(H,oe)},[()=>w("settings.plugin-manager.deny"),()=>w("settings.plugin-manager.approve")]),pe("click",B,()=>e.onRequestConfirm(f(c).name)),pe("click",W,()=>e.onApprove(f(c).name)),C(O,j)};Z(A,O=>{e.confirmingName===f(c).name?O(x):O(N,-1)})}y(()=>{S(m,f(c).label),S(E,f(c).name)}),C(l,h)}),y(l=>S(o,l),[()=>w("settings.plugin-manager.pending-title")]),C(t,i),Le()}lt(["click"]);var QO=I('<div class="mndw-approval svelte-s4a91i"><p class="mndw-approval__declaration svelte-s4a91i"><strong> </strong> </p> <!> <div class="mndw-approval__actions svelte-s4a91i"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function e3(t,e){Ie(e,!0);var n=QO(),r=v(n),i=v(r),s=v(i),o=T(i),a=T(r,2);nb(a,{get entry(){return e.entry}});var l=T(a,2),c=v(l);Oe(c,1,"mndw-approval__deny"),P(c,"variant","danger");var u=v(c),d=T(c,2);Oe(d,1,"mndw-approval__approve"),P(d,"variant","primary");var h=v(d);y((p,g,m)=>{S(s,e.entry.label),S(o,` (${e.entry.name??""}) ${p??""}`),S(u,g),S(h,m)},[()=>w("settings.backend-approval-declaration"),()=>w("settings.backend-approval-deny"),()=>w("settings.backend-approval-approve")]),pe("click",c,()=>e.close("deny")),pe("click",d,()=>e.close("approve")),C(t,n),Le()}lt(["click"]);async function t3(t,e){if(e!=null&&e.aborted)return;const n=cs(e3,{title:w("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 n3={"ping-widget-aarch64.zip":"aarch64","ping-widget-mips.zip":"mips","ping-widget-mipsel.zip":"mipsel"};function r3(t){switch(t){case"aarch64":return"aarch64";case"mips":return"mips";case"mipsel":return"mipsel";default:return}}function i3(t,e){const n=r3(e),r=n3[t];if(!(n===void 0||r===void 0||n===r))return{filename:t,archiveTarget:r,deviceTarget:n}}var lp=I('<p class="mndw-upload__status svelte-1mqre4o" role="status"> </p>'),s3=I('<p class="mndw-upload__success svelte-1mqre4o" role="status"> </p> <!>',1),o3=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),a3=I('<div class="mndw-upload svelte-1mqre4o"><div class="mndw-alert mndw-alert--warning" role="note"> </div> <label class="mndw-upload__zone svelte-1mqre4o"><input accept=".zip" type="file" class="svelte-1mqre4o"/> <span> </span></label> <!></div>');function l3(t,e){Ie(e,!0);const n=10*1024*1024;let r=Yt(e,"openApproval",3,t3),i=Y("idle"),s=Y(""),o=Y(""),a=Y(null),l,c=!1;Do(()=>{c=!0,l==null||l.abort()});function u(q){if(!q.name.toLowerCase().endsWith(".zip"))return w("settings.plugin-manager.choose-zip");if(q.size===0)return w("settings.plugin-manager.empty-zip");if(q.size>n)return w("settings.plugin-manager.zip-too-large")}function d(q){return w("settings.plugin-manager.upload-target-mismatch",{filename:q.filename,archiveTarget:q.archiveTarget,deviceTarget:q.deviceTarget})}function h(q){const K=u(q);if(K)return K;const ne=i3(q.name,e.architecture);if(ne!==void 0)return d(ne)}function p(q){_(s,q,!0),_(i,"error")}function g(q){_(a,q,!0),_(o,w("settings.plugin-manager.installed-success",{label:q.label}),!0),_(i,"success"),e.onInstalled()}async function m(q){const K=new AbortController;l=K;try{return{decision:await r()(q,K.signal),aborted:K.signal.aborted}}finally{l===K&&(l=void 0)}}async function b(q,K){if(!c)if(K==="approve"){const ne=await e.onApprove(q.name);if(c)return;if(!ne){_(i,"idle");return}_(o,w("settings.plugin-manager.approved-success",{label:q.label}),!0),_(i,"success")}else if(K==="deny"){if(await e.onDeny(q.name),c)return;_(i,"idle")}else{if(c)return;e.onDismiss(),_(i,"idle")}}async function E(q){if(f(i)==="uploading"||f(i)==="busy")return;const K=h(q);if(K){p(K);return}_(s,""),_(i,"uploading");let ne;try{ne=await e.uploadFile(q)}catch(se){if(c)return;p(or(se));return}if(c)return;if(ne.status==="installed"){g(ne.entry);return}_(i,"busy");let le;try{le=await m(ne.entry)}catch(se){if(c)return;p(or(se));return}c||le.aborted||await b(ne.entry,le.decision)}function M(q){var ne;const K=(ne=q.currentTarget.files)==null?void 0:ne[0];K&&E(K)}function z(q){var ne;q.preventDefault();const K=(ne=q.dataTransfer)==null?void 0:ne.files[0];K&&E(K)}var R=a3(),A=v(R),x=v(A),N=T(A,2),O=v(N),j=T(O,2),B=v(j),J=T(N,2);{var W=q=>{var K=lp(),ne=v(K);y(le=>S(ne,le),[()=>w("settings.plugin-manager.uploading")]),C(q,K)},H=q=>{var K=lp(),ne=v(K);y(le=>S(ne,le),[()=>w("settings.plugin-manager.waiting-approval")]),C(q,K)},ee=q=>{var K=s3(),ne=Xe(K),le=v(ne),se=T(ne,2);{let ue=fe(()=>{var De;return(De=f(a))==null?void 0:De.lock});tb(se,{get lock(){return f(ue)}})}y(()=>S(le,f(o))),C(q,K)},oe=q=>{var K=o3(),ne=v(K);y(()=>S(ne,f(s))),C(q,K)};Z(J,q=>{f(i)==="uploading"?q(W):f(i)==="busy"?q(H,1):f(i)==="success"?q(ee,2):f(i)==="error"&&q(oe,3)})}y((q,K,ne)=>{S(x,q),Ae(O,"aria-label",K),O.disabled=f(i)==="uploading"||f(i)==="busy",S(B,ne)},[()=>w("settings.plugin-manager.upload-trust-warning"),()=>w("settings.upload-plugin-zip"),()=>w("settings.plugin-manager.upload-drop")]),dt("dragover",N,q=>q.preventDefault()),dt("drop",N,z),pe("change",O,M),C(t,R),Le()}lt(["change"]);function rb(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 c3(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(rb(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 u3=I('<div class="mndw-reload svelte-1hlmyjs" role="status"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),d3=I('<p class="mndw-plugin-manager__loading svelte-1hlmyjs" role="status"> </p>'),f3=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),h3=I('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),p3=I('<section class="mndw-runtime-capacity svelte-1hlmyjs"><strong class="svelte-1hlmyjs"> </strong> <span> </span> <span> </span> <span> </span> <span> </span></section>'),g3=I('<p class="mndw-plugin-manager__runtime-error svelte-1hlmyjs"> </p>'),m3=I("<!> <!> <!> <!>",1),v3=I('<section class="mndw-plugin-manager svelte-1hlmyjs"><h3 class="svelte-1hlmyjs"> </h3> <!> <!> <!></section>');function b3(t,e){Ie(e,!0);let n=Yt(e,"client",3,Nd),r=Yt(e,"permissionVisible",3,!1),i=Yt(e,"permissionAvailable",3,!1),s=Y(st([])),o=Y(null),a=Y(""),l=Y(!0),c=Y(""),u=Y(""),d=Y(null),h=Y(!1),p=0;const g=new is,m={polls:3,intervalMs:1e3};let b=fe(()=>f(s).filter(se=>se.approval==="approved")),E=fe(()=>f(s).filter(se=>se.approval==="pending"));function M(se){return g.get(se)}function z(se){for(const[ue,De]of g)De.state==="notice-finishing"&&De.operation!==void 0&&rb(De.operation,ue,se)&&g.delete(ue)}async function R(){const se=++p;_(l,!0),_(c,"");try{const ue=await n().listPlugins();se===p&&(_(s,ue,!0),_(u,""),z(ue))}catch(ue){se===p&&_(c,or(ue),!0)}finally{se===p&&_(l,!1)}}async function A(){const se=++p;try{const ue=await n().listPlugins();se===p&&(_(s,ue,!0),_(c,""),_(u,""),_(l,!1),z(ue))}catch(ue){se===p&&(_(u,or(ue),!0),_(l,!1))}x()}async function x(){try{_(o,await n().getRuntime(),!0),_(a,"")}catch(se){_(a,or(se),!0)}}async function N(se,ue,De,Ye){const je=g.get(se);if((je==null?void 0:je.state)==="working"||(je==null?void 0:je.state)==="reconciling")return!1;g.set(se,{state:"working",message:"",operation:ue});let Je=!1;try{await De(),Je=!0,g.delete(se),Ye&&_(h,!0),await A()}catch(ce){const ae=TR(ce);if(ae==="rejected-maintenance")g.set(se,{state:"notice-rejected",message:w("settings.plugin-manager.maintenance-busy"),operation:ue});else if(ae==="ambiguous"){g.set(se,{state:"reconciling",message:w("settings.plugin-manager.confirming-state"),operation:ue});try{const U=await c3(ue,se,()=>n().listPlugins(),m);U==="ok"?(g.delete(se),Je=!0,Ye&&_(h,!0),await A()):U==="notice-finishing"?g.set(se,{state:"notice-finishing",message:w("settings.plugin-manager.operation-finishing"),operation:ue}):g.set(se,{state:"outcome-unknown",message:w("settings.plugin-manager.outcome-unknown"),operation:ue})}catch(U){g.set(se,{state:"outcome-unknown",message:or(U),operation:ue})}}else g.set(se,{state:"error",message:or(ce),operation:ue}),await A()}finally{_(d,null)}return Je}function O(){_(h,!0),A()}function j(){A()}kn(()=>{R(),x()});var B=v3(),J=v(B),W=v(J),H=T(J,2);{var ee=se=>{var ue=u3(),De=v(ue),Ye=v(De),je=T(De,2);P(je,"variant","primary");var Je=v(je),ce=T(je,2);P(ce,"variant","ghost");var ae=v(ce);y((U,re,X)=>{S(Ye,U),S(Je,re),S(ae,X)},[()=>w("settings.plugin-manager.reload-notice"),()=>w("settings.plugin-manager.reload-now"),()=>w("settings.plugin-manager.later")]),pe("click",je,()=>window.location.reload()),pe("click",ce,()=>_(h,!1)),C(se,ue)};Z(H,se=>{f(h)&&se(ee)})}var oe=T(H,2);{let se=fe(()=>{var ue;return(ue=me.deviceInfo)==null?void 0:ue.architecture});l3(oe,{get architecture(){return f(se)},uploadFile:ue=>n().uploadPlugin(ue),onInstalled:O,onApprove:ue=>N(ue,{kind:"approve"},()=>n().approvePlugin(ue),!0),onDeny:ue=>N(ue,{kind:"deny"},()=>n().denyPlugin(ue),!1),onDismiss:j})}var q=T(oe,2);{var K=se=>{var ue=d3(),De=v(ue);y(Ye=>S(De,Ye),[()=>w("settings.plugin-manager.loading")]),C(se,ue)},ne=se=>{var ue=f3(),De=v(ue),Ye=v(De),je=T(De,2);P(je,"variant","secondary");var Je=v(je);y(ce=>{S(Ye,f(c)),S(Je,ce)},[()=>w("settings.plugin-manager.retry")]),pe("click",je,()=>void R()),C(se,ue)},le=se=>{var ue=m3(),De=Xe(ue);{var Ye=X=>{var ve=h3(),Ze=v(ve),rt=v(Ze),Et=T(Ze,2);P(Et,"variant","ghost");var jt=v(Et);y(on=>{S(rt,f(u)),S(jt,on)},[()=>w("settings.plugin-manager.dismiss")]),pe("click",Et,()=>_(u,"")),C(X,ve)};Z(De,X=>{f(u)&&X(Ye)})}var je=T(De,2);{var Je=X=>{var ve=p3(),Ze=v(ve),rt=v(Ze),Et=T(Ze,2),jt=v(Et),on=T(Et,2),Xn=v(on),Sn=T(on,2),Yn=v(Sn),Kn=T(Sn,2),ur=v(Kn);y((an,dr,ke,ze,V,ge,Ce)=>{Ae(ve,"aria-label",an),S(rt,dr),S(jt,`${ke??""}:
91
- ${f(o).currentExec??""}/${f(o).maxConcurrentExecTotal??""}`),S(Xn,`${ze??""}:
92
- ${f(o).reservedServices??""}/${f(o).maxSupervisedServices??""}`),S(Yn,`${V??""}:
93
- ${f(o).maxConcurrentExecPerPlugin??""}`),S(ur,`${ge??""}:
94
- ${Ce??""}`)},[()=>w("settings.backend-capacity"),()=>w("settings.backend-capacity"),()=>w("settings.plugin-manager.exec"),()=>w("settings.plugin-manager.services"),()=>w("settings.plugin-manager.per-plugin-exec-limit"),()=>w("settings.plugin-manager.service-protocols"),()=>f(o).supportedServiceProtocols.join(", ")]),C(X,ve)},ce=X=>{var ve=g3(),Ze=v(ve);y(rt=>S(Ze,rt),[()=>w("settings.plugin-manager.runtime-status-unavailable",{error:f(a)})]),C(X,ve)};Z(je,X=>{f(o)?X(Je):f(a)&&X(ce,1)})}var ae=T(je,2);{var U=X=>{JO(X,{get items(){return f(E)},get confirmingName(){return f(d)},rowStateFor:M,onApprove:ve=>N(ve,{kind:"approve"},()=>n().approvePlugin(ve),!0),onDeny:ve=>N(ve,{kind:"deny"},()=>n().denyPlugin(ve),!1),onRequestConfirm:ve=>_(d,ve,!0),onCancelConfirm:()=>_(d,null),onRefresh:()=>void A()})};Z(ae,X=>{f(E).length>0&&X(U)})}var re=T(ae,2);UO(re,{get items(){return f(b)},get confirmingName(){return f(d)},rowStateFor:M,get permissionVisible(){return r()},get permissionAvailable(){return i()},onEnable:X=>N(X,{kind:"enable"},()=>n().enablePlugin(X),!0),onDisable:X=>N(X,{kind:"disable"},()=>n().disablePlugin(X),!0),onPermissionChange:(X,ve,Ze)=>N(X,{kind:"permission",permission:ve,enabled:Ze},()=>n().setPluginPermission(X,ve,Ze),!1),onRestart:X=>N(X,{kind:"restart"},()=>n().restartPlugin(X),!1),onDelete:X=>N(X,{kind:"delete"},()=>n().deletePlugin(X),!0),onRequestConfirm:X=>_(d,X,!0),onCancelConfirm:()=>_(d,null),onRefresh:()=>void A()}),C(se,ue)};Z(q,se=>{f(l)?se(K):f(c)?se(ne,1):se(le,-1)})}y(se=>S(W,se),[()=>w("settings.plugin-manager.title")]),C(t,B),Le()}lt(["click"]);var _3=I('<section class="mndw-plugin-settings"><!></section>');function w3(t,e){var n=_3(),r=v(n);b3(r,{get permissionVisible(){return e.permissionVisible},get permissionAvailable(){return e.permissionAvailable}}),C(t,n)}class ib extends Vo{constructor(e,n,r,i){super(e,n,i,r),this.name="SelfUpdateError"}}const $n=(t,e,n,r)=>new ib(t,e,r,n),sb=t=>t==="update"||t==="revert";function y3(t){if(!Qt(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!wr(t.version)||t.operation!==void 0&&!sb(t.operation))throw Qe($n);for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!wr(t[i]))throw Qe($n);const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.failureCode===void 0?void 0:t.failureCode,r=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{state:t.state,version:t.version,...t.operation===void 0?{}:{operation:t.operation},...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{failureCode:n},...r===void 0?{}:{rollbackVersion:r}}}function E3(t){if(!Qt(t)||!wr(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!wr(t.targetVersion)||t.rollbackVersion!==void 0&&!wr(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw Qe($n);const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{currentVersion:t.currentVersion,updateAvailable:t.updateAvailable,rollbackAvailable:t.rollbackAvailable,...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{rollbackVersion:n}}}function cp(t){if(!Qt(t)||!sb(t.operation)||!wr(t.targetVersion))throw Qe($n);return{operation:t.operation,targetVersion:t.targetVersion}}function k3(t=globalThis.fetch){const e=Zo(t,$n);async function n(r){return e.request(r,{method:"POST",json:{}})}return{async status(){return y3(await e.request(GT,{method:"GET"}))},async check(){return E3(await n(VT))},async apply(){return cp(await n(ZT))},async revert(){return cp(await n(WT))}}}const S3=k3();var x3=I("<mndw-button> </mndw-button>",2),T3=I('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p class="svelte-1khkewm"> </p> <!></div>');function C3(t,e){Ie(e,!0);const n=fe(()=>e.progress.phase==="preparing"?w("settings.self-update-preparing"):e.progress.phase==="unconfirmed"?w("settings.self-update-unconfirmed-modal"):e.progress.operation==="revert"?w("settings.self-update-reverting",{version:e.progress.targetVersion}):w("settings.self-update-updating",{version:e.progress.targetVersion}));var r=T3(),i=v(r),s=v(i),o=T(i,2);{var a=l=>{var c=x3();P(c,"variant","secondary"),Oe(c,1,"svelte-1khkewm");var u=v(c);y(d=>S(u,d),[()=>w("common.close")]),pe("click",c,()=>e.close("close")),C(l,c)};Z(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>{Ae(i,"role",e.progress.phase==="unconfirmed"?"alert":"status"),S(s,f(n))}),C(t,r),Le()}lt(["click"]);var Lc=I('<p class="svelte-1ffuaq9"> </p>'),ha=I('<p role="status" class="svelte-1ffuaq9"> </p>'),Ii=I('<p role="alert" class="svelte-1ffuaq9"> </p>'),P3=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 R3(t,e){Ie(e,!0);let n=Yt(e,"pollIntervalMs",3,2e3),r=Yt(e,"pollAttempts",3,90),i=fe(()=>e.client??S3),s=Y(null),o=Y(null),a=Y(""),l=Y(""),c=Y("idle"),u=Y(""),d=Y(!1),h=null,p=0,g=0,m=!1,b=!1,E=Y(null),M=null;kn(()=>{A()}),Do(()=>{m=!0,z(),H()});function z(){p+=1,h!==null&&(window.clearTimeout(h),h=null)}function R(L){_(s,L,!0),L.state==="failed"?(_(u,L.failureCode??"unknown",!0),_(c,"failure"),b=!1,H()):L.state==="idle"&&b?(_(c,"success"),H()):L.state==="in-progress"&&(_(c,"idle"),f(E)!==null&&(f(E).phase="running",f(E).targetVersion=L.targetVersion??f(E).targetVersion,L.operation!==void 0&&(f(E).operation=L.operation)))}async function A(){_(d,!0);try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"&&(b=!0,x())}catch{_(c,"error")}finally{_(d,!1)}}function x(){if(z(),g=Math.max(0,r()),g===0){O();return}N(p)}function N(L){m||L!==p||g<=0||(h=window.setTimeout(()=>{h=null,j(L)},n()))}function O(){z(),_(c,"unconfirmed"),f(E)!==null&&(f(E).phase="unconfirmed")}async function j(L){if(!(m||L!==p)){g-=1;try{const Q=await f(i).status();if(m||L!==p)return;R(Q),Q.state==="in-progress"?g<=0?O():N(L):z()}catch{if(g<=0){O();return}N(L)}}}function B(L){return L instanceof ib?L.code:"UNKNOWN"}async function J(L,Q){const we=L==="update";return(await cs(il,{title:w(we?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:w(we?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:Q}),confirmLabel:w(we?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function W(L){_(E,{operation:L,phase:"preparing",targetVersion:""},!0);const we=f(E);if(we===null)return;const _e=cs(C3,{title:w("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:we}});M=_e,_e.closed.then(()=>{M===_e&&(M=null,_(E,null))})}function H(){M==null||M.close(void 0,"api")}async function ee(){try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"?(b=!0,x()):_(c,"busy")}catch{_(c,"busy")}}async function oe(){z(),b=!1,_(d,!0),_(c,"checking"),_(u,"");try{_(o,await f(i).check(),!0),_(c,"idle")}catch(L){_(o,null),B(L)==="OPKG_BUSY"?await ee():_(c,"error")}finally{_(d,!1)}}async function q(){const L=f(o);L===null||!L.updateAvailable||L.targetVersion===void 0||await J("update",L.targetVersion)&&await ue("update",()=>f(i).apply())}async function K(){f(Je)!==""&&await J("revert",f(Je))&&await ue("revert",()=>f(i).revert())}function ne(L){z(),_(o,null),_(a,""),_(l,L,!0),_(u,""),_(d,!0),_(c,"preparing"),b=!1}async function le(L){const Q=await L();_(a,Q.targetVersion,!0),_(l,Q.operation,!0),f(E)!==null&&(f(E).phase="running",f(E).targetVersion=Q.targetVersion),_(c,"idle"),b=!0,x()}async function se(L){switch(H(),B(L)){case"OPKG_BUSY":await ee();return;case"SELF_UPDATE_NOT_AVAILABLE":_(u,"no-update");break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":_(u,"rollback-unavailable");break;default:_(u,"")}_(c,"error")}async function ue(L,Q){ne(L),W(L);try{await le(Q)}catch(we){await se(we)}finally{_(d,!1)}}function De(L){return w({"update-missing":"settings.self-update-failure-update-missing","opkg-install-failed":"settings.self-update-failure-opkg-install-failed","opkg-revert-failed":"settings.self-update-failure-opkg-revert-failed","rollback-missing":"settings.self-update-failure-rollback-missing","helper-exited":"settings.self-update-failure-helper-exited","unexpected-version":"settings.self-update-failure-unexpected-version","state-corrupt":"settings.self-update-failure-state-corrupt"}[L]??"settings.self-update-failure-generic")}const Ye=fe(()=>{var L;return((L=f(s))==null?void 0:L.version)??""}),je=fe(()=>{var L,Q;return((L=f(s))==null?void 0:L.state)==="in-progress"?f(a)||f(s).targetVersion||"":((Q=f(o))==null?void 0:Q.targetVersion)||""}),Je=fe(()=>{var L,Q;return((L=f(o))==null?void 0:L.rollbackVersion)||((Q=f(s))==null?void 0:Q.rollbackVersion)||""}),ce=fe(()=>{var L;return((L=f(o))==null?void 0:L.updateAvailable)===!0&&!f(d)}),ae=fe(()=>{var L,Q;return(((L=f(o))==null?void 0:L.rollbackAvailable)===!0||!!((Q=f(s))!=null&&Q.rollbackVersion))&&!f(d)});var U=P3(),re=v(U),X=v(re),ve=T(re,2),Ze=v(ve),rt=T(ve,2);{var Et=L=>{var Q=Lc(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-current",{version:f(Ye)})]),C(L,Q)};Z(rt,L=>{f(Ye)&&L(Et)})}var jt=T(rt,2);{var on=L=>{var Q=Lc(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback",{version:f(Je)})]),C(L,Q)};Z(jt,L=>{f(Je)&&L(on)})}var Xn=T(jt,2);{var Sn=L=>{var Q=ha(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-checking")]),C(L,Q)},Yn=L=>{var Q=ha(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-preparing")]),C(L,Q)},Kn=L=>{var Q=ha(),we=v(Q);y(_e=>S(we,_e),[()=>w(f(l)==="revert"||f(s).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:f(je)})]),C(L,Q)},ur=L=>{var Q=ha(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-success",{version:f(Ye)})]),C(L,Q)},an=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>De(f(u))]),C(L,Q)},dr=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-unconfirmed")]),C(L,Q)},ke=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-busy")]),C(L,Q)},ze=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-no-update")]),C(L,Q)},V=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback-unavailable")]),C(L,Q)},ge=L=>{var Q=Ii(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-failure-generic")]),C(L,Q)};Z(Xn,L=>{var Q;f(c)==="checking"?L(Sn):f(c)==="preparing"?L(Yn,1):((Q=f(s))==null?void 0:Q.state)==="in-progress"?L(Kn,2):f(c)==="success"?L(ur,3):f(c)==="failure"?L(an,4):f(c)==="unconfirmed"?L(dr,5):f(c)==="busy"?L(ke,6):f(c)==="error"&&f(u)==="no-update"?L(ze,7):f(c)==="error"&&f(u)==="rollback-unavailable"?L(V,8):f(c)==="error"&&L(ge,9)})}var Ce=T(Xn,2);{var Ge=L=>{var Q=Lc(),we=v(Q);y(_e=>S(we,_e),[()=>w("settings.self-update-available",{version:f(o).targetVersion})]),C(L,Q)};Z(Ce,L=>{f(o)!==null&&f(o).updateAvailable&&f(o).targetVersion!==void 0&&L(Ge)})}var et=T(Ce,2),ct=v(et);P(ct,"variant","secondary"),y(()=>P(ct,"disabled",f(d)));var Tt=v(ct),$e=T(ct,2);P($e,"variant","primary"),y(()=>P($e,"disabled",!f(ce)));var He=v($e),We=T($e,2);P(We,"variant","secondary"),y(()=>P(We,"disabled",!f(ae)));var Re=v(We);y((L,Q,we,_e,kt,gt)=>{Ae(U,"data-locale",me.locale),Ae(U,"aria-label",L),S(X,Q),S(Ze,we),S(Tt,_e),S(He,kt),S(Re,gt)},[()=>w("settings.self-update-tab"),()=>w("settings.self-update-tab"),()=>w("settings.self-update-description"),()=>f(c)==="checking"?w("settings.self-update-checking"):w("settings.self-update-check"),()=>w("settings.self-update-apply"),()=>w("settings.self-update-revert")]),pe("click",ct,()=>void oe()),pe("click",$e,()=>void q()),pe("click",We,()=>void K()),C(t,U),Le()}lt(["click"]);const go=[{id:"general",route:"/settings/general",labelKey:"settings.general-tab",icon:"settings"},{id:"diagnostics",route:"/settings/diagnostics",labelKey:"settings.diagnostics-tab",icon:"diagnostics"},{id:"plugins",route:"/settings/plugins",labelKey:"settings.plugins-tab",icon:"plugins"},{id:"self-update",route:"/settings/self-update",labelKey:"settings.self-update-tab",icon:"refresh"}],up="general";function dp(t){var e;return((e=go.find(n=>n.id===t))==null?void 0:e.route)??`/settings/${t}`}function A3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of go)if(e===n.route)return n.id;return null}var M3=I("<mndw-tab> </mndw-tab>",2),N3=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 fp(t,e){Ie(e,!0);let n=Y(!1),r=Y(!1);const i=fe(()=>{const R=(Kt==null?void 0:Kt.route.pathname)??globalThis.location.pathname;return A3(R)??up});kn(()=>{const R=Kt;(R==null?void 0:R.route.pathname)==="/settings"&&R.navigate(dp(up),{replace:!0})});function s(R){const A=go.find(N=>N.id===R.detail.value),x=Kt;A===void 0||x===void 0||x.navigate(dp(A.id))}function o(R){_(n,R.visible,!0),_(r,R.available,!0)}var a=N3(),l=v(a),c=v(l),u=T(l,2);y(()=>P(u,"value",f(i)));var d=v(u);ht(d,17,()=>go,R=>R.id,(R,A)=>{var x=M3();y(()=>P(x,"id",f(A).id)),y(()=>P(x,"data-icon",f(A).icon));var N=v(x);y(O=>S(N,O),[()=>w(f(A).labelKey)]),C(R,x)});var h=T(d,2);P(h,"for","general");var p=v(h);EO(p,{onPermissionStateChange:o});var g=T(h,2);P(g,"for","diagnostics");var m=v(g);HN(m,{});var b=T(g,2);P(b,"for","plugins");var E=v(b);w3(E,{get permissionVisible(){return f(n)},get permissionAvailable(){return f(r)}});var M=T(b,2);P(M,"for","self-update");var z=v(M);R3(z,{}),y(R=>{Ae(a,"data-locale",me.locale),S(c,R)},[()=>w("settings.title")]),dt("mndwchange",u,s),C(t,a),Le()}const hp=new Map;let sl=[],Kt;function ol(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function O3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||ol(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function z3(t,e){if(kv(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function I3(t=ws){const e=t.getPages().slice().sort((s,o)=>s.entry.label.localeCompare(o.entry.label)||s.entry.name.localeCompare(o.entry.name)),n={},r=new Map,i=[];for(const s of e){const{name:o,route:a}=s.entry;O3(a,o),z3(ol(a),o);const l=ol(a),c=`${l}/*child`,u=r.get(l);if(u!==void 0)throw new Error(`Page route collision: plugin "${o}" route "${a}" conflicts with plugin "${u}" route "${l}"`);n[l]=Wh,n[c]=Wh,r.set(l,o),i.push({route:l,name:o})}hp.clear();for(const[s,o]of r)hp.set(s,o);return sl=i,n}function pp(){return sl}function L3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function ob(t,e){const n=L3(t),r=n.toLowerCase();for(const i of e){const s=ol(i.route),o=s.toLowerCase();if(r===o)return{name:i.name,childPath:""};const a=`${o}/`;if(r.startsWith(a)){const l=n.slice(s.length);return{name:i.name,childPath:l==="/"?"":l}}}return null}function D3(){const t=globalThis.location.pathname,e=ob(t,sl);if(e!==null)try{decodeURIComponent(t)}catch{const r=sl.find(i=>i.name===e.name);if(r===void 0)return;globalThis.history.replaceState(globalThis.history.state,"",`${r.route}${globalThis.location.search}${globalThis.location.hash}`)}}function H3(t=ws){const e=I3(t),n=Ww({"/":{layout:xM,"/":Zh,"/packages":ep,"/packages/services":ep,"/settings":fp,...Object.fromEntries(go.map(r=>[r.route,fp])),...e,"*":Zh}});return Kt=n,D3(),n}function B3(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 gp=Ue({exact:de(),cdate:de()}),mp=Ue({version:de()}),$3=Ue({release:de(),sandbox:de().optional(),title:de().optional(),arch:de(),ndm:gp,bsp:gp,ndw:Ue({version:de().optional(),features:de(),components:de()}),ndw3:mp.optional(),ndw4:mp.optional(),manufacturer:de(),vendor:de(),series:de(),model:de(),hw_version:de(),hw_type:de().optional(),hw_id:de(),device:de(),region:de(),description:de()}),U3=()=>{const t={path:"show.version"};return zd.driver.queue(t).pipe(Ab(e=>$3.parse(e)))};function j3(){return Promise.resolve({theme:Ya(),locale:ls()})}function F3(){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 G3(){try{const t=await wp(U3().pipe(yp(cv)));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:Mh(t.ndw.features),components:Mh(t.ndw.components)}}catch{return F3()}}async function V3(t){const e=G3(),n=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:Lv(),usbPortCount:0})),[r,i]=await Promise.all([e,n]),s=new Set(r.features.map(a=>a.toLowerCase())),o=B3(i.usbPortCount,a=>s.has(a.toLowerCase()));return{...r,switchports:i.switchports,usb:o}}async function ab(t=uo(),e={}){e.loadPlugins;const n=e.loadSandboxPlugin??hA,r=e.createRouter??H3;try{me.hostInfo=await j3()}catch(i){console.error("[mndw] Failed to fetch host info:",i)}try{me.deviceInfo=await V3(t.mgmtClient)}catch(i){console.error("[mndw] Failed to fetch device info:",i)}{let i=Bv,s=e.setupHmr??bA;{const o=await Ia(()=>import("./sandbox-url-CsfwrS11.js"),[]);i=o.sandboxUrlImports(),s=e.setupHmr??o.setupSandboxUrlHmr}await n({...i,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale()}),s(t)}r(t.registry),me.ready=!0}var Z3=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),W3=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> <!> <mndw-button> </mndw-button></form></div>',2);function q3(t,e){Ie(e,!0);const n=Ar();let r=Y(""),i=Y(""),s=Y(""),o=Y(!1),a=Y(!1),l;kn(()=>{let H=!0;return(async()=>{await customElements.whenDefined("mndw-input");const oe=l;if(!H||!oe||(await oe.updateComplete,!H))return;const q=wb();(q===null||q===document.body)&&oe.focus()})(),()=>{H=!1}});function c(){return f(r).trim()!==""&&f(i)!==""}function u(){return c()&&!f(o)&&!f(a)}function d(H){me.localeSwitchPending||n.locale.setLocale(H.detail.value).catch(()=>{})}function h(H){_(r,H.detail.value,!0),_(a,!1)}function p(H){_(i,H.detail.value,!0),_(a,!1)}function g(H){const ee=H.target,oe=H.composedPath()[0];H.key!=="Enter"||!(ee instanceof HTMLElement)||ee.localName!=="mndw-input"||oe instanceof HTMLButtonElement||(H.preventDefault(),u()&&m(H))}function m(H){H.preventDefault(),u()&&(_(o,!0),_(s,""),n.rci.login(f(r),f(i)).subscribe({next(ee){ee?(me.authenticated=!0,ab(n).catch(()=>{Rd(),_(s,w("login.connection-failed"),!0),_(o,!1)}).finally(()=>{_(r,""),_(i,"")})):(_(s,w("login.invalid-credentials"),!0),_(o,!1),_(a,!0))},error(){_(s,w("login.connection-failed"),!0),_(o,!1),_(a,!0)}}))}var b=W3(),E=v(b),M=v(E);Oe(M,1,"mndw-login__locale-select"),y(()=>P(M,"label",w("nav.language"))),y(()=>P(M,"value",me.locale)),y(()=>P(M,"aria-busy",String(me.localeSwitchPending)));var z=v(M);P(z,"value","en");var R=T(z,2);P(R,"value","ru");var A=T(M,4);y(()=>P(A,"label",w("login.username")));var x=v(A);P(x,"name","username"),P(x,"autocomplete","username"),y(()=>P(x,"value",f(r))),y(()=>P(x,"disabled",f(o))),rs(x,H=>l=H,()=>l);var N=T(A,2);y(()=>P(N,"label",w("login.password")));var O=v(N);P(O,"type","password"),P(O,"name","password"),P(O,"autocomplete","current-password"),y(()=>P(O,"value",f(i))),y(()=>P(O,"disabled",f(o)));var j=T(N,2);{var B=H=>{var ee=Z3(),oe=v(ee);y(()=>S(oe,f(s))),C(H,ee)};Z(j,H=>{f(s)&&H(B)})}var J=T(j,2);Oe(J,1,"mndw-login__submit"),P(J,"variant","primary"),P(J,"type","submit"),y(()=>P(J,"disabled",!u()));var W=v(J);y(H=>{Ae(b,"data-locale",me.locale),S(W,H)},[()=>f(o)?w("login.logging-in"):w("login.submit")]),dt("submit",E,m),dt("mndwchange",M,d),dt("mndwinput",x,h),pe("keydown",x,g),dt("mndwinput",O,p),pe("keydown",O,g),C(t,b),Le()}lt(["keydown"]);var X3=I('<div class="mndw-loading"> </div>'),Y3=I("<!> <!> <!>",1);function K3(t,e){Ie(e,!0),zA(e.services);var n=Y3(),r=Xe(n);BP(r,{});var i=T(r,2);qP(i,{});var s=T(i,2);{var o=c=>{q3(c,{})},a=c=>{Kw(c,{})},l=c=>{var u=X3(),d=v(u);y(h=>{Ae(u,"data-locale",me.locale),S(d,h)},[()=>w("app.loading")]),C(c,u)};Z(s,c=>{me.authenticated?me.ready?c(a,1):c(l,-1):c(o)})}C(t,n),Le()}async function J3(t){const e=t.initLocale();t.defineUi(e),t.initTheme();try{await t.initPalette()}catch(r){console.warn("[mndw] Palette startup load failed; continuing to login.",r)}let n=!1;try{n=await t.checkAuthenticated()}catch{n=!1}if(t.setAuthenticated(n),n)try{await t.initAuthenticated()}catch{t.resetToLogin()}t.subscribeAuthErrors(()=>{t.resetToLogin()}),t.mountApp()}const ui=uo();function pa(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:"";(pa(n)||pa(r)||pa(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);pa(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");_l(K3,{target:t,props:{services:ui}})}async function tz(){const t=ui.rci.isAuthenticated().pipe(yp(5e3));return wp(t)}function nz(t){ui.rci.authError$.subscribe(t)}async function rz(){Q3(),await J3({initLocale:()=>ui.locale.initLocale(),defineUi:t=>yb({overlay:ui.overlay,initialLocale:t,iconSpriteUrl:zb}),initTheme:MC,initPalette:()=>ui.palette.initPalette(),checkAuthenticated:tz,setAuthenticated:t=>{me.authenticated=t},initAuthenticated:()=>ab(ui),subscribeAuthErrors:nz,resetToLogin:Rd,mountApp:ez})}rz();export{vA as s};