@mndw/cli 0.1.5 → 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 (45) hide show
  1. package/dist/meta.json +83 -27
  2. package/dist/mndw.js +391 -101
  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.2.0.js +1805 -0
  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-CJ80zEWN.js +0 -94
  38. package/host-dev/assets/index-DNxACGUr.css +0 -1
  39. package/host-dev/assets/sandbox-url-Dk7HpxDp.js +0 -1
  40. package/host-dev/shared/mndw-ui@0.1.5.js +0 -1782
  41. package/templates/angular/src/table.test.ts +0 -59
  42. package/templates/svelte/src/TableNameCell.svelte +0 -10
  43. package/templates/svelte/src/table.test.ts +0 -53
  44. package/templates/vue/src/TableNameCell.vue +0 -12
  45. package/templates/vue/src/table.test.ts +0 -53
@@ -1,94 +0,0 @@
1
- var ab=Object.defineProperty;var lb=Object.getPrototypeOf;var cb=Reflect.get;var Vd=t=>{throw TypeError(t)};var ub=(t,e,n)=>e in t?ab(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>ub(t,typeof e!="symbol"?e+"":e,n),Ul=(t,e,n)=>e.has(t)||Vd("Cannot "+n);var E=(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),Oe=(t,e,n)=>(Ul(t,e,"access private method"),n);var Zd=(t,e,n)=>cb(lb(t),n,e);import{setMndwUiLocale as db,coercePlacement as Wd,isMobileSheet as fb,resolveSizing as qd,computePopoverCoords as hb,createFocusTrap as Dc,composedContains as pb,tabbableElements as gb,column as Hr,defineMndwUi as mb}from"/shared/mndw-ui@0.1.5.js";import{ReplaySubject as vb,Observable as ka,tap as jl,timer as bb,exhaustMap as _b,catchError as wb,EMPTY as yb,takeUntil as Xd,Subject as kb,Subscription as Eb,BehaviorSubject as Sb,map as xb,firstValueFrom as _p,timeout as wp}from"/shared/rxjs@7.8.2.js";import{FetchTransport as Tb,SessionManager as Cb,RciManager as Pb}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 Rb="/assets/sprite-XQfBvd_1.svg",yp=!1;var dl=Array.isArray,Ab=Array.prototype.indexOf,Ea=Array.prototype.includes,fl=Array.from,Mb=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,kp=Object.getOwnPropertyDescriptors,Ep=Object.prototype,Ob=Array.prototype,hl=Object.getPrototypeOf,Yd=Object.isExtensible;const Nb=()=>{};function zb(t){return t()}function Hc(t){for(var e=0;e<t.length;e++)t[e]()}function Sp(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function Ib(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const $t=2,Qi=4,Po=8,Iu=1<<24,Un=16,On=32,yr=64,Bc=128,An=512,zt=1024,Rt=2048,Vn=4096,rn=8192,Mn=16384,ds=32768,$c=1<<25,Wr=65536,Sa=1<<17,Lb=1<<18,fs=1<<19,xp=1<<20,or=1<<25,yi=65536,xa=1<<21,$i=1<<22,Fr=1<<23,Gr=Symbol("$state"),Db=Symbol(""),da=Symbol("attributes"),Uc=Symbol("class"),jc=Symbol("style"),Ns=Symbol("text"),fa=Symbol("form reset"),Ro=new class extends Error{constructor(){super(...arguments);G(this,"name","StaleReactionError");G(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var mp;const Lu=!!((mp=globalThis.document)!=null&&mp.contentType)&&globalThis.document.contentType.includes("xml");function Du(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Hb(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Bb(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function $b(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ub(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function jb(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Fb(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Gb(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Vb(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Zb(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Wb(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const qb=1,Xb=2,Tp=4,Yb=8,Jb=16,Kb=1,Qb=2,Ct=Symbol("uninitialized"),e_="http://www.w3.org/1999/xhtml",t_="@attach";function n_(){console.warn("https://svelte.dev/e/derived_inert")}function r_(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function i_(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Cp(t){return t===this.v}function Pp(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Rp(t){return!Pp(t,this.v)}let Ao=!1,s_=!1;function o_(){Ao=!0}const a_=[];function Vo(t,e=!1,n=!1){return ha(t,new Map,"",a_,null,n)}function ha(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(dl(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]=ha(c,e,n,r,null,s))}return a}if(hl(t)===Ep){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=ha(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return ha(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let et=null;function es(t){et=t}function l_(t){return Hu().get(t)}function c_(t,e){return Hu().set(t,e),e}function u_(t){return Hu().has(t)}function Ie(t,e=!1,n){et={p:et,i:!1,c:null,e:null,s:t,x:null,r:Ve,l:Ao&&!e?{s:null,u:null,$:[]}:null}}function Le(t){var e=et,n=e.e;if(n!==null){e.e=null;for(var r of n)Jp(r)}return e.i=!0,et=e.p,{}}function Mo(){return!Ao||et!==null&&et.l===null}function Hu(t){return et===null&&Du(),et.c??(et.c=new Map(d_(et)||void 0))}function d_(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 Ap(){var t=ai;ai=[],Hc(t)}function ar(t){if(ai.length===0&&!Ws){var e=ai;queueMicrotask(()=>{e===ai&&Ap()})}ai.push(t)}function f_(){for(;ai.length>0;)Ap()}function Mp(t){var e=Ve;if(e===null)return Fe.f|=Fr,t;if((e.f&ds)===0&&(e.f&Qi)===0)throw t;Br(t,e)}function Br(t,e){if(!(e!==null&&(e.f&Mn)!==0)){for(;e!==null;){if((e.f&Bc)!==0){if((e.f&ds)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const h_=-7169;function St(t,e){t.f=t.f&h_|e}function Bu(t){(t.f&An)!==0||t.deps===null?St(t,zt):St(t,Vn)}function Op(t){if(t!==null)for(const e of t)(e.f&$t)===0||(e.f&yi)===0||(e.f^=yi,Op(e.deps))}function Np(t,e,n){(t.f&Rt)!==0?e.add(t):(t.f&Vn)!==0&&n.add(t),Op(t.deps),St(t,zt)}function p_(t,e){if(e){const n=document.body;t.autofocus=!0,ar(()=>{document.activeElement===n&&t.focus()})}}let Jd=!1;function g_(){Jd||(Jd=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n[fa])==null||e.call(n)})},{capture:!0}))}function hs(t){var e=Fe,n=Ve;pn(null),Nn(null);try{return t()}finally{pn(e),Nn(n)}}function m_(t,e,n,r=n){t.addEventListener(e,()=>hs(n));const i=t[fa];i?t[fa]=()=>{i(),r(!0)}:t[fa]=()=>r(!0),g_()}function v_(t){let e=0,n=kr(0),r;return()=>{Fu()&&(f(n),ml(()=>(e===0&&(r=Kr(()=>t(()=>Bt(n)))),e+=1,()=>{ar(()=>{e-=1,e===0&&(r==null||r(),r=void 0,Bt(n))})})))}}var b_=Wr|fs;function __(t,e,n,r){new w_(t,e,n,r)}var Tn,zu,Cn,di,ln,Pn,tn,_n,dr,fi,Ir,Vi,po,go,fr,sl,ht,y_,k_,Fc,E_,Gc,pa,ga,Vc,Zc;class w_{constructor(e,n,r,i){be(this,ht);G(this,"parent");G(this,"is_pending",!1);G(this,"transform_error");be(this,Tn);be(this,zu,null);be(this,Cn);be(this,di);be(this,ln);be(this,Pn,null);be(this,tn,null);be(this,_n,null);be(this,dr,null);be(this,fi,0);be(this,Ir,0);be(this,Vi,!1);be(this,po,new Set);be(this,go,new Set);be(this,fr,null);be(this,sl,v_(()=>(Me(this,fr,kr(E(this,fi))),()=>{Me(this,fr,null)})));var s;Me(this,Tn,e),Me(this,Cn,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,No(()=>{Oe(this,ht,Gc).call(this)},b_))}defer_effect(e){Np(e,E(this,po),E(this,go))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!E(this,Cn).pending}update_pending_count(e,n){Oe(this,ht,Vc).call(this,e,n),Me(this,fi,E(this,fi)+e),!(!E(this,fr)||E(this,Vi))&&(Me(this,Vi,!0),ar(()=>{Me(this,Vi,!1),E(this,fr)&&ts(E(this,fr),E(this,fi))}))}get_effect_pending(){return E(this,sl).call(this),f(E(this,fr))}error(e){if(!E(this,Cn).onerror&&!E(this,Cn).failed)throw e;Te!=null&&Te.is_fork?(E(this,Pn)&&Te.skip_effect(E(this,Pn)),E(this,tn)&&Te.skip_effect(E(this,tn)),E(this,_n)&&Te.skip_effect(E(this,_n)),Te.oncommit(()=>{Oe(this,ht,Zc).call(this,e)})):Oe(this,ht,Zc).call(this,e)}}Tn=new WeakMap,zu=new WeakMap,Cn=new WeakMap,di=new WeakMap,ln=new WeakMap,Pn=new WeakMap,tn=new WeakMap,_n=new WeakMap,dr=new WeakMap,fi=new WeakMap,Ir=new WeakMap,Vi=new WeakMap,po=new WeakMap,go=new WeakMap,fr=new WeakMap,sl=new WeakMap,ht=new WeakSet,y_=function(){try{Me(this,Pn,dn(()=>E(this,di).call(this,E(this,Tn))))}catch(e){this.error(e)}},k_=function(e){const n=E(this,Cn).failed,{reset:r,invoke_onerror:i}=Oe(this,ht,Fc).call(this,e);ar(i),n&&Me(this,_n,dn(()=>{n(E(this,Tn),()=>e,()=>r)}))},Fc=function(e){var n=!1,r=!1;const i=()=>{if(n){i_();return}n=!0,r&&Wb(),E(this,_n)!==null&&bi(E(this,_n),()=>{Me(this,_n,null)}),Oe(this,ht,ga).call(this,()=>{Oe(this,ht,Gc).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=E(this,Cn)).onerror)==null||a.call(o,e,i),r=!1}catch(l){Br(l,E(this,ln)&&E(this,ln).parent)}}}},E_=function(){const e=E(this,Cn).pending;e&&(this.is_pending=!0,Me(this,tn,dn(()=>e(E(this,Tn)))),ar(()=>{var n=Me(this,dr,document.createDocumentFragment()),r=br();n.append(r),Me(this,Pn,Oe(this,ht,ga).call(this,()=>dn(()=>E(this,di).call(this,r)))),E(this,Ir)===0&&(E(this,Tn).before(n),Me(this,dr,null),bi(E(this,tn),()=>{Me(this,tn,null)}),Oe(this,ht,pa).call(this,Te))}))},Gc=function(){try{if(this.is_pending=this.has_pending_snippet(),Me(this,Ir,0),Me(this,fi,0),Me(this,Pn,dn(()=>{E(this,di).call(this,E(this,Tn))})),E(this,Ir)>0){var e=Me(this,dr,document.createDocumentFragment());Zu(E(this,Pn),e);const n=E(this,Cn).pending;Me(this,tn,dn(()=>n(E(this,Tn))))}else Oe(this,ht,pa).call(this,Te)}catch(n){this.error(n)}},pa=function(e){this.is_pending=!1,e.transfer_effects(E(this,po),E(this,go))},ga=function(e){var n=Ve,r=Fe,i=et;Nn(E(this,ln)),pn(E(this,ln)),es(E(this,ln).ctx);try{return ki.ensure(),e()}catch(s){return Mp(s),null}finally{Nn(n),pn(r),es(i)}},Vc=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Oe(r=this.parent,ht,Vc).call(r,e,n);return}Me(this,Ir,E(this,Ir)+e),E(this,Ir)===0&&(Oe(this,ht,pa).call(this,n),E(this,tn)&&bi(E(this,tn),()=>{Me(this,tn,null)}),E(this,dr)&&(E(this,Tn).before(E(this,dr)),Me(this,dr,null)))},Zc=function(e){E(this,Pn)&&(Zt(E(this,Pn)),Me(this,Pn,null)),E(this,tn)&&(Zt(E(this,tn)),Me(this,tn,null)),E(this,_n)&&(Zt(E(this,_n)),Me(this,_n,null));let n=E(this,Cn).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Oe(this,ht,Fc).call(this,i);o(),n&&Me(this,_n,Oe(this,ht,ga).call(this,()=>{try{return dn(()=>{var a=Ve;a.b=this,a.f|=Bc,n(E(this,Tn),()=>i,()=>s)})}catch(a){return Br(a,E(this,ln).parent),null}}))};ar(()=>{var i;try{i=this.transform_error(e)}catch(s){Br(s,E(this,ln)&&E(this,ln).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>Br(s,E(this,ln)&&E(this,ln).parent)):r(i)})};function zp(t,e,n,r){const i=Mo()?pl:Lp;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=S_(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&Mn)===0){l();try{r([...o,...p])}catch(g){Br(g,a)}Ta()}}var d=Ip();if(n.length===0){c.then(()=>u([])).finally(d);return}function h(){Promise.all(n.map(p=>x_(p))).then(u).catch(p=>Br(p,a)).finally(d)}c?c.then(()=>{l(),h(),Ta()}):h()}function S_(){var t=Ve,e=Fe,n=et,r=Te;return function(s=!0){Nn(t),pn(e),es(n),s&&(t.f&Mn)===0&&(r==null||r.activate(),r==null||r.apply())}}function Ta(t=!0){Nn(null),pn(null),es(null),t&&(Te==null||Te.deactivate())}function Ip(){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 pl(t){var e=$t|Rt;return Ve!==null&&(Ve.f|=fs),{ctx:et,deps:null,effects:null,equals:Cp,f:e,fn:t,reactions:null,rv:0,v:Ct,wv:0,parent:Ve,ac:null}}const zs=Symbol("obsolete");function x_(t,e,n){let r=Ve;r===null&&Hb();var i=void 0,s=kr(Ct),o=!Fe,a=new Set;return U_(()=>{var p,g;var l=Ve,c=Sp();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==Ro&&c.reject(m)}).finally(Ta)}catch(m){c.reject(m),Ta()}var u=Te;if(o){if((l.f&ds)!==0)var d=Ip();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(zs);else for(const m of a.values())m.reject(zs);a.add(c),u.async_deriveds.set(l,c)}const h=(m,_=void 0)=>{d==null||d(),a.delete(c),_!==zs&&(u.activate(),_?(s.f|=Fr,ts(s,_)):((s.f&Fr)!==0&&(s.f^=Fr),ts(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Gu(()=>{for(const l of a)l.reject(zs)}),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=pl(t);return rg(e),e}function Lp(t){const e=pl(t);return e.equals=Rp,e}function T_(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Zt(e[n])}}function $u(t){var e,n=Ve,r=t.parent;if(!qr&&r!==null&&t.v!==Ct&&(r.f&(Mn|rn))!==0)return n_(),t.v;Nn(r);try{t.f&=~yi,T_(t),e=ag(t)}finally{Nn(n)}return e}function Dp(t){var e=$u(t);if(!t.equals(e)&&(t.wv=sg(),(!(Te!=null&&Te.is_fork)||t.deps===null)&&(Te!==null?(Te.capture(t,e,!0),Zs==null||Zs.capture(t,e,!0)):t.v=e,t.deps===null))){St(t,zt);return}qr||(Gt!==null?(Fu()||Te!=null&&Te.is_fork)&&Gt.set(t,e):Bu(t))}function C_(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&&hs(()=>{n.ac.abort(Ro),n.ac=null}),n.fn!==null&&(n.teardown=Nb),eo(n,0),Vu(n))}function Hp(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,Zs=null,Gt=null,Wc=null,Ws=!1,Gl=!1,Li=null,ma=null;var Kd=0;let P_=1;var Zi,Lr,hi,Wi,qi,Xi,hr,Yi,cn,mo,pr,Dn,er,Ji,pi,rt,qc,Is,Xc,Bp,$p,Ii,R_,Ls;const ol=class ol{constructor(){be(this,rt);G(this,"id",P_++);be(this,Zi,!1);G(this,"linked",!0);be(this,Lr,null);be(this,hi,null);G(this,"async_deriveds",new Map);G(this,"current",new Map);G(this,"previous",new Map);be(this,Wi,new Set);be(this,qi,new Set);be(this,Xi,0);be(this,hr,new Map);be(this,Yi,null);be(this,cn,[]);be(this,mo,[]);be(this,pr,new Set);be(this,Dn,new Set);be(this,er,new Map);be(this,Ji,new Set);G(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){E(this,er).has(e)||E(this,er).set(e,{d:[],m:[]}),E(this,Ji).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=E(this,er).get(e);if(r){E(this,er).delete(e);for(var i of r.d)St(i,Rt),n(i);for(i of r.m)St(i,Vn),n(i)}E(this,Ji).add(e)}capture(e,n,r=!1){e.v!==Ct&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Fr)===0&&(this.current.set(e,[n,r]),Gt==null||Gt.set(e,n)),this.is_fork||(e.v=n)}activate(){Te=this}deactivate(){Te=null,Gt=null}flush(){try{Gl=!0,Te=this,Oe(this,rt,Is).call(this)}finally{Kd=0,Wc=null,Li=null,ma=null,Gl=!1,Te=null,Gt=null,vi.clear()}}discard(){var e;for(const n of E(this,qi))n(this);E(this,qi).clear();for(const n of this.async_deriveds.values())n.reject(zs);Oe(this,rt,Ls).call(this),(e=E(this,Yi))==null||e.resolve()}register_created_effect(e){E(this,mo).push(e)}increment(e,n){if(Me(this,Xi,E(this,Xi)+1),e){let r=E(this,hr).get(n)??0;E(this,hr).set(n,r+1)}}decrement(e,n){if(Me(this,Xi,E(this,Xi)-1),e){let r=E(this,hr).get(n)??0;r===1?E(this,hr).delete(n):E(this,hr).set(n,r-1)}E(this,pi)||(Me(this,pi,!0),ar(()=>{Me(this,pi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)E(this,pr).add(r);for(const r of n)E(this,Dn).add(r);e.clear(),n.clear()}oncommit(e){E(this,Wi).add(e)}ondiscard(e){E(this,qi).add(e)}settled(){return(E(this,Yi)??Me(this,Yi,Sp())).promise}static ensure(){if(Te===null){const e=Te=new ol;!Gl&&!Ws&&ar(()=>{E(e,Zi)||e.flush()})}return Te}apply(){{Gt=null;return}}schedule(e){var i;if(Wc=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Qi|Po|Iu))!==0&&(e.f&ds)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(Li!==null&&n===Ve&&(Fe===null||(Fe.f&$t)===0))return;if((r&(yr|On))!==0){if((r&zt)===0)return;n.f^=zt}}E(this,cn).push(n)}};Zi=new WeakMap,Lr=new WeakMap,hi=new WeakMap,Wi=new WeakMap,qi=new WeakMap,Xi=new WeakMap,hr=new WeakMap,Yi=new WeakMap,cn=new WeakMap,mo=new WeakMap,pr=new WeakMap,Dn=new WeakMap,er=new WeakMap,Ji=new WeakMap,pi=new WeakMap,rt=new WeakSet,qc=function(){if(this.is_fork)return!0;for(const r of E(this,hr).keys()){for(var e=r,n=!1;e.parent!==null;){if(E(this,er).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},Is=function(){var l,c,u,d;Me(this,Zi,!0),Kd++>1e3&&(Oe(this,rt,Ls).call(this),M_());for(const h of E(this,pr))E(this,Dn).delete(h),St(h,Rt),this.schedule(h);for(const h of E(this,Dn))St(h,Vn),this.schedule(h);const e=E(this,cn);Me(this,cn,[]),this.apply();var n=Li=[],r=[],i=ma=[];for(const h of e)try{Oe(this,rt,Xc).call(this,h,n,r)}catch(p){throw Fp(h),Oe(this,rt,qc).call(this)||this.discard(),p}if(Te=null,i.length>0){var s=ol.ensure();for(const h of i)s.schedule(h)}if(Li=null,ma=null,Oe(this,rt,qc).call(this)){Oe(this,rt,Ii).call(this,r),Oe(this,rt,Ii).call(this,n);for(const[h,p]of E(this,er))jp(h,p);i.length>0&&Oe(l=Te,rt,Is).call(l);return}const o=Oe(this,rt,Bp).call(this);if(o){Oe(this,rt,Ii).call(this,r),Oe(this,rt,Ii).call(this,n),Oe(c=o,rt,$p).call(c,this);return}E(this,pr).clear(),E(this,Dn).clear();for(const h of E(this,Wi))h(this);E(this,Wi).clear(),Zs=this,Qd(r),Qd(n),Zs=null,(u=E(this,Yi))==null||u.resolve();var a=Te;if(E(this,Xi)===0&&(E(this,cn).length===0||a!==null)&&Oe(this,rt,Ls).call(this),E(this,cn).length>0)if(a!==null){const h=a;E(h,cn).push(...E(this,cn).filter(p=>!E(h,cn).includes(p)))}else a=this;a!==null&&Oe(d=a,rt,Is).call(d)},Xc=function(e,n,r){e.f^=zt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(On|yr))!==0,a=o&&(s&zt)!==0,l=a||(s&rn)!==0||E(this,er).has(i);if(!l&&i.fn!==null){o?i.f^=zt:(s&Qi)!==0?n.push(i):zo(i)&&((s&Un)!==0&&E(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}}},Bp=function(){for(var e=E(this,Lr);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=E(e,Lr)}return null},$p=function(e){var r;for(const[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(const[i,s]of e.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_effects(E(e,pr),E(e,Dn));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&$t)!==0&&(i.f&(Rt|Vn))===0))for(const l of s){var o=l.f;if((o&$t)!==0)n(l);else{var a=l;o&($i|Un)&&!this.async_deriveds.has(a)&&(E(this,Dn).delete(a),St(a,Rt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Oe(r=e,rt,Ls).call(r),Te=this,Oe(this,rt,Is).call(this)},Ii=function(e){for(var n=0;n<e.length;n+=1)Np(e[n],E(this,pr),E(this,Dn))},R_=function(){var d;for(let h=Fl;h!==null;h=E(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(!(!E(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 E(this,Ji))h.unskip_effect(p,g=>{var m;(g.f&(Un|$i))!==0?h.schedule(g):Oe(m=h,rt,Ii).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)Up(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,g])=>{const m=this.current.get(p);return m?m[0]!==g[0]||m[1]!==g[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of E(this,mo))(p.f&(Mn|rn|Sa))===0&&Uu(p,c,a)&&((p.f&($i|Un))!==0?(St(p,Rt),h.schedule(p)):E(h,pr).add(p));if(E(h,cn).length>0&&!E(h,pi)){h.apply();for(var u of E(h,cn))Oe(d=h,rt,Xc).call(d,u,[],[]);Me(h,cn,[])}h.deactivate()}}}},Ls=function(){if(this.linked){var e=E(this,Lr),n=E(this,hi);e===null?Fl=n:Me(e,hi,n),n===null?Ai=e:Me(n,Lr,e),this.linked=!1}};let ki=ol;function A_(t){var e=Ws;Ws=!0;try{for(var n;;){if(f_(),Te===null)return n;Te.flush()}}finally{Ws=e}}function M_(){try{Fb()}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&(Mn|rn))===0&&zo(r)&&(Ln=new Set,ns(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&eg(r),(Ln==null?void 0:Ln.size)>0)){vi.clear();for(const i of Ln){if((i.f&(Mn|rn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ln.has(o)&&(Ln.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Mn|rn))===0&&ns(l)}}Ln.clear()}}Ln=null}}function Up(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&$t)!==0?Up(i,e,n,r):(s&($i|Un))!==0&&(s&Rt)===0&&Uu(i,e,r)&&(St(i,Rt),ju(i))}}function Uu(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(Ea.call(e,i))return!0;if((i.f&$t)!==0&&Uu(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function ju(t){Te.schedule(t)}function jp(t,e){if(!((t.f&On)!==0&&(t.f&zt)!==0)){(t.f&Rt)!==0?e.d.push(t):(t.f&Vn)!==0&&e.m.push(t),St(t,zt);for(var n=t.first;n!==null;)jp(n,e),n=n.next}}function Fp(t){St(t,zt);for(var e=t.first;e!==null;)Fp(e),e=e.next}let Ca=new Set;const vi=new Map;let Gp=!1;function kr(t,e){var n={f:0,v:t,reactions:null,equals:Cp,rv:0,wv:0};return n}function Y(t,e){const n=kr(t);return rg(n),n}function O_(t,e=!1,n=!0){var i;const r=kr(t);return e||(r.equals=Rp),Ao&&n&&et!==null&&et.l!==null&&((i=et.l).s??(i.s=[])).push(r),r}function b(t,e,n=!1){Fe!==null&&(!jn||(Fe.f&Sa)!==0)&&Mo()&&(Fe.f&($t|Un|$i|Sa))!==0&&(lr===null||!lr.has(t))&&Zb();let r=n?it(e):e;return ts(t,r,ma)}function ts(t,e,n=null){if(!t.equals(e)){vi.set(t,qr?e:t.v);var r=ki.ensure();if(r.capture(t,e),(t.f&$t)!==0){const i=t;(t.f&Rt)!==0&&$u(i),Gt===null&&Bu(i)}t.wv=sg(),Vp(t,Rt,n),Mo()&&Ve!==null&&(Ve.f&zt)!==0&&(Ve.f&(On|yr))===0&&(xn===null?G_([t]):xn.push(t)),!r.is_fork&&Ca.size>0&&!Gp&&N_()}return e}function N_(){Gp=!1;for(const t of Ca){(t.f&zt)!==0&&St(t,Vn);let e;try{e=zo(t)}catch{e=!0}e&&ns(t)}Ca.clear()}function Bt(t){b(t,t.v+1)}function Vp(t,e,n){var r=t.reactions;if(r!==null)for(var i=Mo(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===Ve)){var c=(l&Rt)===0;if(c&&St(a,e),(l&Sa)!==0)Ca.add(a);else if((l&$t)!==0){var u=a;Gt==null||Gt.delete(u),(l&yi)===0&&(l&An&&(Ve===null||(Ve.f&xa)===0)&&(a.f|=yi),Vp(u,Vn,n))}else if(c){var d=a;(l&Un)!==0&&Ln!==null&&Ln.add(d),n!==null?n.push(d):ju(d)}}}}function it(t){if(typeof t!="object"||t===null||Gr in t)return t;const e=hl(t);if(e!==Ep&&e!==Ob)return t;var n=new Map,r=dl(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)&&Gb();var u=n.get(l);return u===void 0?o(()=>{var d=Y(c.value);return n.set(l,d),d}):b(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Y(Ct));n.set(l,u),Bt(i)}}else b(c,Ct),Bt(i);return!0},get(a,l,c){var p;if(l===Gr)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||(p=Vs(a,l))!=null&&p.writable)&&(u=o(()=>{var g=it(d?a[l]:Ct),m=Y(g);return m}),n.set(l,u)),u!==void 0){var h=f(u);return h===Ct?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=f(u))}else if(c===void 0){var d=n.get(l),h=d==null?void 0:d.v;if(d!==void 0&&h!==Ct)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===Gr)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Ct||Reflect.has(a,l);if(c!==void 0||Ve!==null&&(!u||(h=Vs(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?it(a[l]):Ct,g=Y(p);return g}),n.set(l,c));var d=f(c);if(d===Ct)return!1}return u},set(a,l,c,u){var I;var d=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<d.v;p+=1){var g=n.get(p+"");g!==void 0?b(g,Ct):p in a&&(g=o(()=>Y(Ct)),n.set(p+"",g))}if(d===void 0)(!h||(I=Vs(a,l))!=null&&I.writable)&&(d=o(()=>Y(void 0)),b(d,it(c)),n.set(l,d));else{h=d.v!==Ct;var m=o(()=>it(c));b(d,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_!=null&&_.set&&_.set.call(u,c),!h){if(r&&typeof l=="string"){var k=n.get("length"),O=Number(l);Number.isInteger(O)&&O>=k.v&&b(k,O+1)}Bt(i)}return!0},ownKeys(a){f(i);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==Ct});for(var[c,u]of n)u.v!==Ct&&!(c in a)&&l.push(c);return l},setPrototypeOf(){Vb()}})}function ef(t){try{if(t!==null&&typeof t=="object"&&Gr in t)return t[Gr]}catch{}return t}function z_(t,e){return Object.is(ef(t),ef(e))}var Qs,Zp,Wp,qp;function I_(){if(Qs===void 0){Qs=window,Zp=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Wp=Vs(e,"firstChild").get,qp=Vs(e,"nextSibling").get,Yd(t)&&(t[Uc]=void 0,t[da]=null,t[jc]=void 0,t.__e=void 0),Yd(n)&&(n[Ns]=void 0)}}function br(t=""){return document.createTextNode(t)}function Pa(t){return Wp.call(t)}function Oo(t){return qp.call(t)}function v(t,e){return Pa(t)}function Xe(t,e=!1){{var n=Pa(t);return n instanceof Comment&&n.data===""?Oo(n):n}}function x(t,e=1,n=!1){let r=t;for(;e--;)r=Oo(r);return r}function L_(t){t.textContent=""}function Xp(){return!1}function D_(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Yp(t){Ve===null&&(Fe===null&&jb(),Ub()),qr&&$b()}function H_(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Wn(t,e){var n=Ve;n!==null&&(n.f&rn)!==0&&(t|=rn);var r={ctx:et,deps:null,nodes:null,f:t|Rt|An,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Te==null||Te.register_created_effect(r);var i=r;if((t&Qi)!==0)Li!==null?Li.push(r):ki.ensure().schedule(r);else if(e!==null){try{ns(r)}catch(o){throw Zt(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&fs)===0&&(i=i.first,(t&Un)!==0&&(t&Wr)!==0&&i!==null&&(i.f|=Wr))}if(i!==null&&(i.parent=n,n!==null&&H_(i,n),Fe!==null&&(Fe.f&$t)!==0&&(t&yr)===0)){var s=Fe;(s.effects??(s.effects=[])).push(i)}return r}function Fu(){return Fe!==null&&!jn}function Gu(t){const e=Wn(Po,null);return St(e,zt),e.teardown=t,e}function hn(t){Yp();var e=Ve.f,n=!Fe&&(e&On)!==0&&et!==null&&!et.i;if(n){var r=et;(r.e??(r.e=[])).push(t)}else return Jp(t)}function Jp(t){return Wn(Qi|xp,t)}function B_(t){return Yp(),Wn(Po|xp,t)}function $_(t){ki.ensure();const e=Wn(yr|fs,t);return(n={})=>new Promise(r=>{n.outro?bi(e,()=>{Zt(e),r(void 0)}):(Zt(e),r(void 0))})}function gl(t){return Wn(Qi,t)}function U_(t){return Wn($i|fs,t)}function ml(t,e=0){return Wn(Po|e,t)}function y(t,e=[],n=[],r=[]){zp(r,e,n,i=>{Wn(Po,()=>{t(...i.map(f))})})}function No(t,e=0){var n=Wn(Un|e,t);return n}function Kp(t,e=0){var n=Wn(Iu|e,t);return n}function dn(t){return Wn(On|fs,t)}function Qp(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 Vu(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&hs(()=>{i.abort(Ro)});var r=n.next;(n.f&yr)!==0?n.parent=null:Zt(n,e),n=r}}function j_(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&On)===0&&Zt(e),e=n}}function Zt(t,e=!0){var n=!1;(e||(t.f&Lb)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(F_(t.nodes.start,t.nodes.end),n=!0),t.f|=$c,Vu(t,e&&!n),eo(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();Qp(t),t.f^=$c,t.f|=Mn;var i=t.parent;i!==null&&i.first!==null&&eg(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function F_(t,e){for(;t!==null;){var n=t===e?null:Oo(t);t.remove(),t=n}}function eg(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=[];tg(t,r,!0);var i=()=>{n&&Zt(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function tg(t,e,n){if((t.f&rn)===0){t.f^=rn;var r=t.nodes&&t.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&yr)===0){var o=(i.f&Wr)!==0||(i.f&On)!==0&&(t.f&Un)!==0;tg(i,e,o?n:!1)}i=s}}}function Ra(t){ng(t,!0)}function ng(t,e){if((t.f&rn)!==0){t.f^=rn,(t.f&zt)===0&&(St(t,Rt),ki.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Wr)!==0||(n.f&On)!==0;ng(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 Zu(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:Oo(n);e.append(n),n=i}}let va=!1,qr=!1;function tf(t){qr=t}let Fe=null,jn=!1;function pn(t){Fe=t}let Ve=null;function Nn(t){Ve=t}let lr=null;function rg(t){Fe!==null&&(lr??(lr=new Set)).add(t)}let un=null,bn=0,xn=null;function G_(t){xn=t}let ig=1,li=0,Zn=li;function nf(t){Zn=t}function sg(){return++ig}function zo(t){var e=t.f;if((e&Rt)!==0)return!0;if(e&$t&&(t.f&=~yi),(e&Vn)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(zo(s)&&Dp(s),s.wv>t.wv)return!0}(e&An)!==0&&Gt===null&&St(t,zt)}return!1}function og(t,e,n=!0){var r=t.reactions;if(r!==null&&!(lr!==null&&lr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&$t)!==0?og(s,e,!1):e===s&&(n?St(s,Rt):(s.f&zt)!==0&&St(s,Vn),ju(s))}}function ag(t){var m;var e=un,n=bn,r=xn,i=Fe,s=lr,o=et,a=jn,l=Zn,c=t.f;un=null,bn=0,xn=null,Fe=(c&(On|yr))===0?t:null,lr=null,es(t.ctx),jn=!1,Zn=++li,t.ac!==null&&(hs(()=>{t.ac.abort(Ro)}),t.ac=null);try{t.f|=xa;var u=t.fn,d=u();t.f|=ds;var h=t.deps,p=Te==null?void 0:Te.is_fork;if(un!==null){var g;if(p||eo(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(Fu()&&(t.f&An)!==0)for(g=bn;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&bn<h.length&&(eo(t,bn),h.length=bn);if(Mo()&&xn!==null&&!jn&&h!==null&&(t.f&($t|Vn|Rt))===0)for(g=0;g<xn.length;g++)og(xn[g],t);if(i!==null&&i!==t){if(li++,i.deps!==null)for(let _=0;_<n;_+=1)i.deps[_].rv=li;if(e!==null)for(const _ of e)_.rv=li;xn!==null&&(r===null?r=xn:r.push(...xn))}return(t.f&Fr)!==0&&(t.f^=Fr),d}catch(_){return Mp(_)}finally{t.f^=xa,un=e,bn=n,xn=r,Fe=i,lr=s,es(o),jn=a,Zn=l}}function V_(t,e){let n=e.reactions;if(n!==null){var r=Ab.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(e.f&$t)!==0&&(un===null||!Ea.call(un,e))){var s=e;(s.f&An)!==0&&(s.f^=An,s.f&=~yi),s.v!==Ct&&Bu(s),s.ac!==null&&hs(()=>{s.ac.abort(Ro),s.ac=null,St(s,Rt)}),C_(s),eo(s,0)}}function eo(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)V_(t,n[r])}function ns(t){var e=t.f;if((e&Mn)===0){St(t,zt);var n=Ve,r=va;Ve=t,va=(e&(On|yr))===0;try{(e&(Un|Iu))!==0?j_(t):Vu(t),Qp(t);var i=ag(t);t.teardown=typeof i=="function"?i:null,t.wv=ig;var s;yp&&s_&&(t.f&Rt)!==0&&t.deps}finally{va=r,Ve=n}}}async function Z_(){await Promise.resolve(),A_()}function f(t){var e=t.f,n=(e&$t)!==0;if(Fe!==null&&!jn){var r=Ve!==null&&(Ve.f&Mn)!==0;if(!r&&(lr===null||!lr.has(t))){var i=Fe.deps;if((Fe.f&xa)!==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=[]),Ea.call(Fe.deps,t)||Fe.deps.push(t);var s=t.reactions;s===null?t.reactions=[Fe]:Ea.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&zt)===0&&o.reactions!==null||cg(o))&&(a=$u(o)),vi.set(o,a),a}var l=(o.f&An)===0&&!jn&&Fe!==null&&(va||(Fe.f&An)!==0),c=(o.f&ds)===0;zo(o)&&(l&&(o.f|=An),Dp(o)),l&&!c&&(Hp(o),lg(o))}if(Gt!=null&&Gt.has(t))return Gt.get(t);if((t.f&Fr)!==0)throw t.v;return t.v}function lg(t){if(t.f|=An,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&$t)!==0&&(e.f&An)===0&&(Hp(e),lg(e))}function cg(t){if(t.v===Ct)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(vi.has(e)||(e.f&$t)!==0&&cg(e))return!0;return!1}function Kr(t){var e=jn;try{return jn=!0,t()}finally{jn=e}}function ug(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=hl(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 W_(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 X_(t){return q_.includes(t)}const Y_={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 J_(t){return t=t.toLowerCase(),Y_[t]??t}const K_=["touchstart","touchmove"];function Q_(t){return K_.includes(t)}const ci=Symbol("events"),dg=new Set,Jc=new Set;function Wu(t,e,n,r={}){function i(s){if(r.capture||Kc.call(e,s),!s.cancelBubble)return hs(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?ar(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function rf(t,e,n,r={}){var i=Wu(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function ut(t,e,n,r,i){var s={capture:r,passive:i},o=Wu(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Gu(()=>{e.removeEventListener(t,o,s)})}function pe(t,e,n){(e[ci]??(e[ci]={}))[t]=n}function at(t){for(var e=0;e<t.length;e++)dg.add(t[e]);for(var n of Jc)n(t)}let sf=null;function Kc(t){var m,_;var e=this,n=e.ownerDocument,r=t.type,i=((m=t.composedPath)==null?void 0:m.call(t))||[],s=i[0]||t.target;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){Mb(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=Fe,d=Ve;pn(null),Nn(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(_=s[ci])==null?void 0:_[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(k){h?p.push(k):h=k}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let k of p)queueMicrotask(()=>{throw k});throw h}}finally{t[ci]=e,delete t.currentTarget,pn(u),Nn(d)}}}var vp;const Vl=((vp=globalThis==null?void 0:globalThis.window)==null?void 0:vp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function ew(t){return(Vl==null?void 0:Vl.createHTML(t))??t}function tw(t){var e=D_("template");return e.innerHTML=ew(t.replaceAll("<!>","<!---->")),e.content}function Aa(t,e){var n=Ve;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function z(t,e){var n=(e&Kb)!==0,r=(e&Qb)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=tw(s?t:"<!>"+t),n||(i=Pa(i)));var o=r||Zp?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Pa(o),l=o.lastChild;Aa(a,l)}else Aa(o,o);return o}}function Ds(t=""){{var e=br(t+"");return Aa(e,e),e}}function kn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=br();return t.append(e,n),Aa(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[Ns]??(t[Ns]=t.nodeValue))&&(t[Ns]=n,t.nodeValue=`${n}`)}function vl(t,e){return nw(t,e)}const Zo=new Map;function nw(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){I_();var l=void 0,c=$_(()=>{var u=n??e.appendChild(br());__(u,{pending:()=>{}},p=>{Ie({});var g=et;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Le()},a);var d=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!d.has(m)){d.add(m);var _=Q_(m);for(const I of[e,document]){var k=Zo.get(I);k===void 0&&(k=new Map,Zo.set(I,k));var O=k.get(m);O===void 0?(I.addEventListener(m,Kc,{passive:_}),k.set(m,1)):k.set(m,O+1)}}}};return h(fl(dg)),Jc.add(h),()=>{var _;for(var p of d)for(const k of[e,document]){var g=Zo.get(k),m=g.get(p);--m==0?(k.removeEventListener(p,Kc),g.delete(p),g.size===0&&Zo.delete(k)):g.set(p,m)}Jc.delete(h),u!==n&&((_=u.parentNode)==null||_.removeChild(u))}});return Qc.set(l,c),l}let Qc=new WeakMap;function qu(t,e){const n=Qc.get(t);return n?(Qc.delete(t),n(e)):Promise.resolve()}var Hn,tr,wn,gi,vo,bo,al;class Xu{constructor(e,n=!0){G(this,"anchor");be(this,Hn,new Map);be(this,tr,new Map);be(this,wn,new Map);be(this,gi,new Set);be(this,vo,!0);be(this,bo,e=>{if(E(this,Hn).has(e)){var n=E(this,Hn).get(e),r=E(this,tr).get(n);if(r)Ra(r),E(this,gi).delete(n);else{var i=E(this,wn).get(n);i&&(Ra(i.effect),E(this,tr).set(n,i.effect),E(this,wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of E(this,Hn)){if(E(this,Hn).delete(s),s===e)break;const a=E(this,wn).get(o);a&&(Zt(a.effect),E(this,wn).delete(o))}for(const[s,o]of E(this,tr)){if(s===n||E(this,gi).has(s))continue;const a=()=>{if(Array.from(E(this,Hn).values()).includes(s)){var c=document.createDocumentFragment();Zu(o,c),c.append(br()),E(this,wn).set(s,{effect:o,fragment:c})}else Zt(o);E(this,gi).delete(s),E(this,tr).delete(s)};E(this,vo)||!r?(E(this,gi).add(s),bi(o,a,!1)):a()}}});be(this,al,e=>{E(this,Hn).delete(e);const n=Array.from(E(this,Hn).values());for(const[r,i]of E(this,wn))n.includes(r)||(Zt(i.effect),E(this,wn).delete(r))});this.anchor=e,Me(this,vo,n)}ensure(e,n){var r=Te,i=Xp();if(n&&!E(this,tr).has(e)&&!E(this,wn).has(e))if(i){var s=document.createDocumentFragment(),o=br();s.append(o),E(this,wn).set(e,{effect:dn(()=>n(o)),fragment:s})}else E(this,tr).set(e,dn(()=>n(this.anchor)));if(E(this,Hn).set(r,e),i){for(const[a,l]of E(this,tr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of E(this,wn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(E(this,bo)),r.ondiscard(E(this,al))}else E(this,bo).call(this,r)}}Hn=new WeakMap,tr=new WeakMap,wn=new WeakMap,gi=new WeakMap,vo=new WeakMap,bo=new WeakMap,al=new WeakMap;function Z(t,e,n=!1){var r=new Xu(t),i=n?Wr:0;function s(o,a){r.ensure(o,a)}No(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}function rw(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,fl(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;L_(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|=or;const o=document.createDocumentFragment();Zu(s,o)}else Zt(e[i],n)}}var of;function ft(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&Tp)!==0;if(l){var c=t;o=c.appendChild(br())}var u=null,d=Lp(()=>{var I=n();return dl(I)?I:I==null?[]:fl(I)}),h,p=new Map,g=!0;function m(I){(O.effect.f&Mn)===0&&(O.pending.delete(I),O.fallback=u,iw(O,h,o,e,r),u!==null&&(h.length===0?(u.f&or)===0?Ra(u):(u.f^=or,Hs(u,null,o)):bi(u,()=>{u=null})))}function _(I){O.pending.delete(I)}var k=No(()=>{h=f(d);for(var I=h.length,R=new Set,A=Te,T=Xp(),M=0;M<I;M+=1){var N=h[M],j=r(N,M),H=g?null:a.get(j);H?(H.v&&ts(H.v,N),H.i&&ts(H.i,M),T&&A.unskip_effect(H.e)):(H=sw(a,g?o:of??(of=br()),N,j,M,i,e,n),g||(H.e.f|=or),a.set(j,H)),R.add(j)}if(I===0&&s&&!u&&(g?u=dn(()=>s(o)):(u=dn(()=>s(of??(of=br()))),u.f|=or)),I>R.size&&Bb(),!g)if(p.set(A,R),T){for(const[se,B]of a)R.has(se)||A.skip_effect(B.e);A.oncommit(m),A.ondiscard(_)}else m(A);f(d)}),O={effect:k,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function Cs(t){for(;t!==null&&(t.f&On)===0;)t=t.next;return t}function iw(t,e,n,r,i){var H,se,B,q,ee,te,W,J,ne;var s=(r&Yb)!==0,o=e.length,a=t.items,l=Cs(t.effect.first),c,u=null,d,h=[],p=[],g,m,_,k;if(s)for(k=0;k<o;k+=1)g=e[k],m=i(g,k),_=a.get(m).e,(_.f&or)===0&&((se=(H=_.nodes)==null?void 0:H.a)==null||se.measure(),(d??(d=new Set)).add(_));for(k=0;k<o;k+=1){if(g=e[k],m=i(g,k),_=a.get(m).e,t.outrogroups!==null)for(const le of t.outrogroups)le.pending.delete(_),le.done.delete(_);if((_.f&rn)!==0&&(Ra(_),s&&((q=(B=_.nodes)==null?void 0:B.a)==null||q.unfix(),(d??(d=new Set)).delete(_))),(_.f&or)!==0)if(_.f^=or,_===l)Hs(_,null,n);else{var O=u?u.next:l;_===t.effect.last&&(t.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Nr(t,u,_),Nr(t,_,O),Hs(_,O,n),u=_,h=[],p=[],l=Cs(u.next);continue}if(_!==l){if(c!==void 0&&c.has(_)){if(h.length<p.length){var I=p[0],R;u=I.prev;var A=h[0],T=h[h.length-1];for(R=0;R<h.length;R+=1)Hs(h[R],I,n);for(R=0;R<p.length;R+=1)c.delete(p[R]);Nr(t,A.prev,T.next),Nr(t,u,A),Nr(t,T,I),l=I,u=T,k-=1,h=[],p=[]}else c.delete(_),Hs(_,l,n),Nr(t,_.prev,_.next),Nr(t,_,u===null?t.effect.first:u.next),Nr(t,u,_),u=_;continue}for(h=[],p=[];l!==null&&l!==_;)(c??(c=new Set)).add(l),p.push(l),l=Cs(l.next);if(l===null)continue}(_.f&or)===0&&h.push(_),u=_,l=Cs(_.next)}if(t.outrogroups!==null){for(const le of t.outrogroups)le.pending.size===0&&(eu(t,fl(le.done)),(ee=t.outrogroups)==null||ee.delete(le));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var M=[];if(c!==void 0)for(_ of c)(_.f&rn)===0&&M.push(_);for(;l!==null;)(l.f&rn)===0&&l!==t.fallback&&M.push(l),l=Cs(l.next);var N=M.length;if(N>0){var j=(r&Tp)!==0&&o===0?n:null;if(s){for(k=0;k<N;k+=1)(W=(te=M[k].nodes)==null?void 0:te.a)==null||W.measure();for(k=0;k<N;k+=1)(ne=(J=M[k].nodes)==null?void 0:J.a)==null||ne.fix()}rw(t,M,j)}}s&&ar(()=>{var le,oe;if(d!==void 0)for(_ of d)(oe=(le=_.nodes)==null?void 0:le.a)==null||oe.apply()})}function sw(t,e,n,r,i,s,o,a){var l=(o&qb)!==0?(o&Jb)===0?O_(n,!1,!1):kr(n):null,c=(o&Xb)!==0?kr(i):null;return{v:l,i:c,e:dn(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function Hs(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&or)===0?e.nodes.start:n;r!==null;){var o=Oo(r);if(s.before(r),r===i)return;r=o}}function Nr(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function ow(t,e,...n){var r=new Xu(t);No(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},Wr)}function aw(t,e,n){var r=new Xu(t);No(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},Wr)}function Qr(t,e,n){gl(()=>{var r=Kr(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};ml(()=>{var o=n();ug(o),i&&Pp(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function lw(t,e){var n=void 0,r;Kp(()=>{n!==(n=e())&&(r&&(Zt(r),r=null),n&&(r=dn(()=>{gl(()=>n(t))})))})}function fg(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=fg(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function cw(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=fg(t))&&(r&&(r+=" "),r+=e);return r}function uw(t){return typeof t=="object"?cw(t):t??""}const af=[...`
2
- \r\f \v\uFEFF`];function dw(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 fw(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 Ne(t,e,n,r,i,s){var o=t[Uc];if(o!==n||o===void 0){var a=dw(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 to(t,e,n,r){var i=t[jc];if(i!==e){var s=fw(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(!dl(e))return r_();for(var r of t.options)r.selected=e.includes(cf(r));return}for(r of t.options){var i=cf(r);if(z_(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function hw(t){var e=new MutationObserver(()=>{"__value"in t&&tu(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Gu(()=>{e.disconnect()})}function cf(t){return"__value"in t?t.__value:t.value}const Wo=Symbol("class"),Ps=Symbol("style"),hg=Symbol("is custom element"),pg=Symbol("is html"),pw=Lu?"input":"INPUT",gw=Lu?"option":"OPTION",mw=Lu?"select":"SELECT";function vw(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ae(t,e,n,r){var i=gg(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[Db]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Yu(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function P(t,e,n){var r=Fe,i=Ve;pn(null),Nn(null);try{e!=="style"&&(nu.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?Yu(t).includes(e):n&&typeof n=="object")?t[e]=n:Ae(t,e,n==null?n:String(n))}finally{pn(r),Nn(i)}}function bw(t,e,n,r,i=!1,s=!1){var o=gg(t),a=o[hg],l=!o[pg],c=e||{},u=t.nodeName===gw;for(var d in e)d in n||(n[d]=null);n.class?n.class=uw(n.class):n.class=null,n[Ps]&&(n.style??(n.style=null));var h=Yu(t);if(t.nodeName===pw&&"type"in n&&("value"in n||"__value"in n)){var p=n.type;(p!==c.type||p===void 0&&t.hasAttribute("type"))&&(c.type=p,Ae(t,"type",p))}for(const R in n){let A=n[R];if(u&&R==="value"&&A==null){t.value=t.__value="",c[R]=A;continue}if(R==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Ne(t,g,A,r,e==null?void 0:e[Wo],n[Wo]),c[R]=A,c[Wo]=n[Wo];continue}if(R==="style"){to(t,A,e==null?void 0:e[Ps],n[Ps]),c[R]=A,c[Ps]=n[Ps];continue}var m=c[R];if(!(A===m&&!(A===void 0&&t.hasAttribute(R)))){c[R]=A;var _=R[0]+R[1];if(_!=="$$")if(_==="on"){const T={},M="$$"+R;let N=R.slice(2);var k=X_(N);if(W_(N)&&(N=N.slice(0,-7),T.capture=!0),!k&&m){if(A!=null)continue;t.removeEventListener(N,c[M],T),c[M]=null}if(k)pe(N,t,A),at([N]);else if(A!=null){let j=function(H){c[R].call(this,H)};c[M]=Wu(N,t,j,T)}}else if(R==="style")Ae(t,R,A);else if(R==="autofocus")p_(t,!!A);else if(!a&&(R==="__value"||R==="value"&&A!=null))t.value=t.__value=A;else if(R==="selected"&&u)vw(t,A);else{var O=R;l||(O=J_(O));var I=O==="defaultValue"||O==="defaultChecked";if(A==null&&!a&&!I)if(o[R]=null,O==="value"||O==="checked"){let T=t;const M=e===void 0;if(O==="value"){let N=T.defaultValue;T.removeAttribute(O),T.defaultValue=N,T.value=T.__value=M?N:null}else{let N=T.defaultChecked;T.removeAttribute(O),T.defaultChecked=N,T.checked=M?N:!1}}else t.removeAttribute(R);else I||h.includes(O)&&(a||typeof A!="string")?(t[O]=A,O in o&&(o[O]=Ct)):typeof A!="function"&&Ae(t,O,A)}}}return c}function _w(t,e,n=[],r=[],i=[],s,o=!1,a=!1){zp(i,n,r,l=>{var c=void 0,u={},d=t.nodeName===mw,h=!1;if(Kp(()=>{var g=e(...l.map(f)),m=bw(t,c,g,s,o,a);h&&d&&"value"in g&&tu(t,g.value);for(let k of Object.getOwnPropertySymbols(u))g[k]||Zt(u[k]);for(let k of Object.getOwnPropertySymbols(g)){var _=g[k];k.description===t_&&(!c||_!==c[k])&&(u[k]&&Zt(u[k]),u[k]=dn(()=>lw(t,()=>_))),m[k]=_}c=m}),d){var p=t;gl(()=>{tu(p,c.value,!0),hw(p)})}h=!0})}function gg(t){return t[da]??(t[da]={[hg]:t.nodeName.includes("-"),[pg]:t.namespaceURI===e_})}var nu=new Map;function Yu(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=hl(i)}return n}function ww(t,e,n=e){var r=new WeakSet;m_(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 Z_(),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))}}}),Kr(e)==null&&t.value&&(n(ql(t)?Xl(t.value):t.value),Te!==null&&r.add(Te)),ml(()=>{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 no(t={},e,n,r){var i=et.r,s=Ve;return gl(()=>{var o,a;return ml(()=>{o=a,a=(r==null?void 0:r())||[],Kr(()=>{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 yw(t=!1){const e=et,n=e.l.u;if(!n)return;let r=()=>ug(e.s);if(t){let i=0,s={};const o=pl(()=>{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&&B_(()=>{uf(e,r),Hc(n.b)}),hn(()=>{const i=Kr(()=>n.m.map(zb));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 zn(t){et===null&&Du(),Ao&&et.l!==null?kw(et).m.push(t):hn(()=>{const e=Kr(t);if(typeof e=="function")return e})}function Io(t){et===null&&Du(),zn(()=>()=>Kr(t))}function kw(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const Ew="5";var bp;typeof window<"u"&&((bp=window.__svelte??(window.__svelte={})).v??(bp.v=new Set)).add(Ew);const Sw="modulepreload",xw=function(t){return"/"+t},df={},Ma=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=xw(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":Sw,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 qs(t,e){if(e)for(const n in e)t=t.replace(`:${n}`,String(e[n]));return dt.name==="#"?t==="/"?"/#/":Oa("#",t):dt.name?Oa(dt.name,t):t}function Tw(t,e){let n=qs(t,e==null?void 0:e.params);return e!=null&&e.search&&(n+=Qu(e.search)),e!=null&&e.hash&&!e.hash.startsWith("#")&&(n+="#"+e.hash),n}function mg(t){return Promise.all(t.map(e=>Cw(e)))}function Cw(t){return new Promise(e=>{Pw(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function Pw(t){return typeof t=="function"&&!!/\(\)\s?=>\s?(import|__vite_ssr_dynamic_import__)\(.*\)/.test(String(t))}function Oa(...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 dt.name&&t.startsWith(dt.name)&&(t=t.slice(dt.name.length)||"/"),t}function Ku(){const t=dt.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=dt.name==="#"?"":globalThis.location.hash;return{pathname:t,search:globalThis.location.search,state:history.state,hash:e}}function Qu(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 ed(t){if(!t)return{};if(typeof t=="string"){const e=new URLSearchParams(t);return Object.fromEntries([...e.entries()].map(([n,r])=>[n,Rw(r)]))}return t}function Rw(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 vg((n,r)=>n===r,t,e)}ru.startsWith=(t,e)=>vg((n,r)=>n.startsWith(r),t,e);function vg(t,e,n){if(!e.includes(":")){const s=dt.name&&dt.name!=="#"?qs(e):e;return t(fn.pathname,s)}if(n)return dt.name==="#"?t(fn.pathname,qs(e,n).replace("/#","")):t(fn.pathname,qs(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 td(t,e){t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/").slice(1),r=Aw(Object.keys(e));let i,s=[],o=[],a={},l={};const c=e["/"];c&&typeof c=="object"&&"meta"in c&&c.meta&&(l={...l,...c.meta});let u=!1;e:for(const d of r){const h=d.split("/");h[0]===""&&h.shift();for(let[p,g]of h.entries()){u=g.startsWith("(")&&g.endsWith(")"),u&&(g=g.slice(1,-1));const m=n[p],_=g===""&&typeof e["/"]!="function";if(g.startsWith(":"))a[g.slice(1)]=decodeURIComponent(m);else if(g.startsWith("*")){const R=g.slice(1);R&&(a[R]=n.slice(p).map(decodeURIComponent).join("/")),u?s=[]:"layout"in e&&e.layout&&s.push(e.layout);const A=(p?"/":"")+h.join("/");i=e[A];break e}else if(g.toLowerCase()!==(m==null?void 0:m.toLowerCase())&&!_)break;if(p!==h.length-1)continue;const k=e["/"+h.join("/")];if(typeof k=="function"&&h.length!==n.length)continue;if(!u&&"layout"in e&&e.layout&&s.push(e.layout),"hooks"in e&&e.hooks&&o.push(e.hooks),"meta"in e&&e.meta&&(l={...l,...e.meta}),typeof k=="function"){if(h.length===n.length){i=k;break e}continue}const O=_?t:"/"+n.slice(p+1).join("/"),I=td(O,k);if(I.match)i=I.match,a={...a,...I.params},o.push(...I.hooks),l={...l,...I.meta},I.breakFromLayouts?(s=[],u=!0):s.push(...I.layouts);else continue;break e}}return{match:i,layouts:s,hooks:o,params:a,meta:l,breakFromLayouts:u}}function Aw(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 Mw=200,Ow=Math.PI/6,Nw=50;async function bg(t,e,n){const{match:r,layouts:i,hooks:s,meta:o}=td(e,t);for(const{onPreload:a}of s)a==null||a({pathname:e,meta:o,...n,search:ed(n==null?void 0:n.search)});await mg(r?[...i,r]:i)}const hf=new Set,Mi=new Set;function zw(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;bg(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},Nw),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 _ of Mi){_.isConnected||Mi.delete(_);const k=_.getBoundingClientRect(),O=[{x:k.left,y:k.top},{x:k.right,y:k.top},{x:k.left,y:k.bottom},{x:k.right,y:k.bottom},{x:k.left+k.width/2,y:k.top+k.height/2}];for(const I of O){const R=I.x-c,A=I.y-u,T=Math.hypot(R,A);if(T>Mw||T<.001)continue;const M=R/T,N=A/T,j=g*M+m*N;if(Math.acos(Math.max(-1,Math.min(1,j)))<=Ow){e(_),Mi.delete(_);continue e}}}}const i=new IntersectionObserver(o=>{for(const a of o)a.isIntersecting&&(i.unobserve(a.target),e(a.target))});new MutationObserver(()=>{const o=document.querySelectorAll("a[data-preload]");for(const a of o)if(!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 Iw=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],Lw=["difference","intersection","symmetricDifference","union"],gf=!1,Ki,Bn,Dr,ll,us,_g,wg;const cl=class cl extends Set{constructor(n){super();be(this,us);be(this,Ki,new Map);be(this,Bn,Y(0));be(this,Dr,Y(0));be(this,ll,Zn||-1);if(n){for(var r of n)super.add(r);E(this,Dr).v=super.size}gf||Oe(this,us,wg).call(this)}has(n){var r=super.has(n),i=E(this,Ki),s=i.get(n);if(s===void 0){if(!r)return f(E(this,Bn)),!1;s=Oe(this,us,_g).call(this,!0),i.set(n,s)}return f(s),r}add(n){return super.has(n)||(super.add(n),b(E(this,Dr),super.size),Bt(E(this,Bn))),this}delete(n){var r=super.delete(n),i=E(this,Ki),s=i.get(n);return s!==void 0&&(i.delete(n),b(s,!1)),r&&(b(E(this,Dr),super.size),Bt(E(this,Bn))),r}clear(){if(super.size!==0){super.clear();var n=E(this,Ki);for(var r of n.values())b(r,!1);n.clear(),b(E(this,Dr),0),Bt(E(this,Bn))}}keys(){return this.values()}values(){return f(E(this,Bn)),super.values()}entries(){return f(E(this,Bn)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return f(E(this,Dr))}};Ki=new WeakMap,Bn=new WeakMap,Dr=new WeakMap,ll=new WeakMap,us=new WeakSet,_g=function(n){return Zn===E(this,ll)?Y(n):kr(n)},wg=function(){gf=!0;var n=cl.prototype,r=Set.prototype;for(const i of Iw)n[i]=function(...s){return f(E(this,Bn)),r[i].apply(this,s)};for(const i of Lw)n[i]=function(...s){f(E(this,Bn));var o=r[i].apply(this,s);return new cl(o)}};let Na=cl;var nr,rr,gr,ul,Gn,Bs,ba;const jd=class jd extends Map{constructor(n){super();be(this,Gn);be(this,nr,new Map);be(this,rr,Y(0));be(this,gr,Y(0));be(this,ul,Zn||-1);if(n){for(var[r,i]of n)super.set(r,i);E(this,gr).v=super.size}}has(n){var r=E(this,nr),i=r.get(n);if(i===void 0)if(super.has(n))i=Oe(this,Gn,Bs).call(this,0),r.set(n,i);else return f(E(this,rr)),!1;return f(i),!0}forEach(n,r){Oe(this,Gn,ba).call(this),super.forEach(n,r)}get(n){var r=E(this,nr),i=r.get(n);if(i===void 0)if(super.has(n))i=Oe(this,Gn,Bs).call(this,0),r.set(n,i);else{f(E(this,rr));return}return f(i),super.get(n)}set(n,r){var d;var i=E(this,nr),s=i.get(n),o=super.get(n),a=super.set(n,r),l=E(this,rr);if(s===void 0)s=Oe(this,Gn,Bs).call(this,0),i.set(n,s),b(E(this,gr),super.size),Bt(l);else if(o!==r){Bt(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((d=s.reactions)!=null&&d.every(h=>c.has(h)));u&&Bt(l)}return a}delete(n){var r=E(this,nr),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),b(i,-1)),s&&(b(E(this,gr),super.size),Bt(E(this,rr))),s}clear(){if(super.size!==0){super.clear();var n=E(this,nr);b(E(this,gr),0);for(var r of n.values())b(r,-1);Bt(E(this,rr)),n.clear()}}keys(){return f(E(this,rr)),super.keys()}values(){return Oe(this,Gn,ba).call(this),super.values()}entries(){return Oe(this,Gn,ba).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(E(this,gr)),super.size}};nr=new WeakMap,rr=new WeakMap,gr=new WeakMap,ul=new WeakMap,Gn=new WeakSet,Bs=function(n){return Zn===E(this,ul)?Y(n):kr(n)},ba=function(){f(E(this,rr));var n=E(this,nr);if(E(this,gr).v!==n.size){for(var r of Zd(jd.prototype,this,"keys").call(this))if(!n.has(r)){var i=Oe(this,Gn,Bs).call(this,0);n.set(r,i)}}for([,i]of E(this,nr))f(i)};let rs=jd;const Dw=Symbol("replace");var jt,_o,mr,mi,$s;class Hw extends URLSearchParams{constructor(){super(...arguments);be(this,mi);be(this,jt,Y(0));be(this,_o,$w());be(this,mr,!1)}[Dw](n){if(!E(this,mr)&&n.toString()!==super.toString()){Me(this,mr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);Bt(E(this,jt)),Me(this,mr,!1)}}append(n,r){super.append(n,r),Oe(this,mi,$s).call(this),Bt(E(this,jt))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(Oe(this,mi,$s).call(this),Bt(E(this,jt)))}get(n){return f(E(this,jt)),super.get(n)}getAll(n){return f(E(this,jt)),super.getAll(n)}has(n,r){return f(E(this,jt)),super.has(n,r)}keys(){return f(E(this,jt)),super.keys()}forEach(n,r){f(E(this,jt)),super.forEach(n,r)}set(n,r){var i=super.getAll(n);super.set(n,r);var s=super.getAll(n);(i.length!==s.length||i.some((o,a)=>o!==s[a]))&&(Oe(this,mi,$s).call(this),Bt(E(this,jt)))}sort(){super.sort(),Oe(this,mi,$s).call(this),Bt(E(this,jt))}toString(){return f(E(this,jt)),super.toString()}values(){return f(E(this,jt)),super.values()}entries(){return f(E(this,jt)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(E(this,jt)),super.size}}jt=new WeakMap,_o=new WeakMap,mr=new WeakMap,mi=new WeakSet,$s=function(){if(!E(this,_o)||E(this,mr))return;Me(this,mr,!0);const n=this.toString();E(this,_o).search=n&&`?${n}`,Me(this,mr,!1)};let Bw=null;function $w(){return Bw}let qo=new Hw(globalThis.location.search);function mf(t){if(qo.toString()===t)return;const e=new URLSearchParams(t);for(const[n,r]of e)qo.set(n,r);for(const n of qo.keys())e.has(n)||qo.delete(n)}let Xs;const dt={name:void 0};let iu=it({value:[]}),fn=it({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Ku();fn.pathname=t.pathname,fn.search=t.search,fn.state=t.state,fn.hash=t.hash});let su=it({value:{}}),yg=it({value:{}}),ii=null,Xo=null,_a=null;function Uw(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(dt.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(dt.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(dt.name)||(e.pathname=Oa(dt.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(fn,Ku())}function jw(t){return Xs=t,zw(Xs),{p:Tw,navigate:Fw,isActive:ru,async preload(e){await bg(Xs,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 ed(fn.search)},get state(){return fn.state},get hash(){return fn.hash},get meta(){return yg.value}}}}async function Fw(t,e={}){if(typeof t=="number")return globalThis.history.go(t),new pf(`History entry: ${t}`);t=qs(t,e.params),dt.name==="#"?t=t.replace("/#",""):e.hash&&!e.hash.startsWith("#")&&(e.hash="#"+e.hash);const n=za(t,e);return _a=n,await n,new pf(`${t}${Qu((e==null?void 0:e.search)??"")}${(e==null?void 0:e.hash)??""}`)}async function za(t,e={}){if(!Xs)throw new Error("Router not initialized: `createRouter` was not called.");if(Xo&&Xo!==ii)return;ii==null||ii.abort(),ii=new AbortController;const{signal:n}=ii,r=Gw(t),{match:i,layouts:s,hooks:o,meta:a,params:l}=td(r,Xs),c=ed(e.search),u={pathname:r,meta:a,...e,search:c};let d=[];for(const p of o){if(n.aborted)return _a;try{const{beforeLoad:g}=p;d.push(p),Xo=ii,await(g==null?void 0:g(u))}catch(g){if(n.aborted)return _a;for(const{onError:m}of d)m==null||m(g,u);return}finally{Xo=null}}let h;try{h=await mg(i?[...s,i]:s)}catch(p){for(const{onError:g}of o)g==null||g(p,u);throw p}if(n.aborted)return _a;if(t){const p=Qu(e.search),g=new URL(globalThis.location.toString());g.search=p||"",g.hash=e.hash||"",dt.name==="#"?g.hash=t:dt.name&&!t.startsWith(dt.name)?g.pathname=Oa(dt.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,yg.value=a,Object.assign(fn,Ku()),e.scrollToTop!==!1&&window.scrollTo({top:0,left:0,behavior:e.scrollToTop});for(const{afterLoad:p}of o)p==null||p(u)}function Gw(t){let e;return t?e=t:dt.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,dt.name&&e.startsWith(dt.name)&&(e=e.slice(dt.name.length)||"/"),Ju(e)}function Vw(t){var d;const e=t.target.closest("a");if(!e||e.hasAttribute("target")||e.hasAttribute("download")||!e.hasAttribute("href")||(d=e.getAttribute("href"))!=null&&d.startsWith("#"))return;const n=new URL(e.href),r=globalThis.location.origin;if(n.origin!==r)return;const i=dt.name==="#"?n.hash:n.pathname,s=dt.name==="#"?void 0:n.hash;t.preventDefault();const{replace:o,state:a,scrollToTop:l,viewTransition:c}=e.dataset;let u;if(a)try{u=JSON.parse(a)}catch{u=a}za(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=kn(),s=Xe(i);aw(s,()=>f(n),(o,a)=>{a(o,{children:(l,c)=>{var u=kn(),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 Zw(t,e){Ie(e,!0),Uw(e.base),za(),hn(()=>{const n=rf(globalThis,"popstate",()=>za()),r=rf(globalThis,"click",Vw);return()=>{n(),r()}}),kg(t,{get tree(){return iu.value}}),Le()}const Ww=720;function bl(){return window.matchMedia("(max-width: "+Ww+"px)")}function Eg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Sg(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(Eg(s))Sg(s,e,o,r);else throw new Error(`Plugin catalog ${e} key "${o}" must be a string or object`)}}function qw(t,e){if(!Eg(t))throw new Error(`Plugin catalog ${e} must be a JSON object`);const n={};return Sg(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 xg extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(vf=globalThis).__zod_globalConfig??(vf.__zod_globalConfig={});const nd=globalThis.__zod_globalConfig;function Er(t){return nd}function Tg(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 _l(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function rd(t){return t==null}function id(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Xw(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 st(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 Ei(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 Yw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Cg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ro(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Jw=_l(()=>{var t;if(nd.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 is(t){if(ro(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(ro(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Pg(t){return is(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const Kw=new Set(["string","number","symbol"]);function ss(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 Qw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const e0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function t0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=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 Ei(this,"shape",o),o},checks:[]});return ti(t,s)}function n0(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 Ei(this,"shape",o),o},checks:[]});return ti(t,s)}function r0(t,e){if(!is(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 Ei(this,"shape",s),s}});return ti(t,i)}function i0(t,e){if(!is(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 Ei(this,"shape",r),r}});return ti(t,n)}function s0(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 Ei(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ti(t,n)}function o0(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 Ei(this,"shape",l),l},checks:[]});return ti(e,o)}function a0(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 Ei(this,"shape",s),s}});return ti(e,r)}function Di(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 l0(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 Hi(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Yo(t){return typeof t=="string"?t:t==null?void 0:t.message}function Sr(t,e,n){var l,c,u,d,h,p;const r=t.message?t.message:Yo((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??Yo((d=e==null?void 0:e.error)==null?void 0:d.call(e,t))??Yo((h=n.customError)==null?void 0:h.call(n,t))??Yo((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 sd(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function io(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Rg=(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})},Ag=$("$ZodError",Rg),Mg=$("$ZodError",Rg,{Parent:Error});function c0(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 u0(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 od=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=>Sr(l,s,Er())));throw Cg(a,i==null?void 0:i.callee),a}return o.value},ad=t=>async(e,n,r,i)=>{const s=r?{...r,async:!0}:{async:!0};let o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Sr(l,s,Er())));throw Cg(a,i==null?void 0:i.callee),a}return o.value},wl=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??Ag)(s.issues.map(o=>Sr(o,i,Er())))}:{success:!0,data:s.value}},d0=wl(Mg),yl=t=>async(e,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>Sr(o,i,Er())))}:{success:!0,data:s.value}},f0=yl(Mg),h0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return od(t)(e,n,i)},p0=t=>(e,n,r)=>od(t)(e,n,r),g0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ad(t)(e,n,i)},m0=t=>async(e,n,r)=>ad(t)(e,n,r),v0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return wl(t)(e,n,i)},b0=t=>(e,n,r)=>wl(t)(e,n,r),_0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return yl(t)(e,n,i)},w0=t=>async(e,n,r)=>yl(t)(e,n,r),y0=/^[cC][0-9a-z]{6,}$/,k0=/^[0-9a-z]+$/,E0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S0=/^[0-9a-vA-V]{20}$/,x0=/^[A-Za-z0-9]{27}$/,T0=/^[a-zA-Z0-9_-]{21}$/,C0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,P0=/^([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)$/,R0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,A0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function M0(){return new RegExp(A0,"u")}const O0=/^(?:(?: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])$/,N0=/^(([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}|:))$/,z0=/^((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])$/,I0=/^(([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])$/,L0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Og=/^[A-Za-z0-9_-]*$/,D0=/^https?$/,H0=/^\+[1-9]\d{6,14}$/,Ng="(?:(?:\\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])))",B0=new RegExp(`^${Ng}$`);function zg(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 $0(t){return new RegExp(`^${zg(t)}$`)}function U0(t){const e=zg({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(`^${Ng}T(?:${r})$`)}const j0=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}$`)},F0=/^-?\d+$/,Ig=/^-?\d+(?:\.\d+)?$/,G0=/^(?:true|false)$/i,V0=/^[^A-Z]*$/,Z0=/^[^a-z]*$/,gn=$("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Lg={number:"number",bigint:"bigint",object:"date"},Dg=$("$ZodCheckLessThan",(t,e)=>{gn.init(t,e);const n=Lg[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})}}),Hg=$("$ZodCheckGreaterThan",(t,e)=>{gn.init(t,e);const n=Lg[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})}}),W0=$("$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):Xw(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]=e0[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=F0)}),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})}}),X0=$("$ZodCheckMaxLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rd(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=sd(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Y0=$("$ZodCheckMinLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rd(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=sd(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),J0=$("$ZodCheckLengthEquals",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!rd(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=sd(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})}}),kl=$("$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=()=>{})}),K0=$("$ZodCheckRegex",(t,e)=>{kl.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})}}),Q0=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=V0),kl.init(t,e)}),ey=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Z0),kl.init(t,e)}),ty=$("$ZodCheckIncludes",(t,e)=>{gn.init(t,e);const n=ss(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})}}),ny=$("$ZodCheckStartsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`^${ss(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})}}),ry=$("$ZodCheckEndsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`.*${ss(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})}}),iy=$("$ZodCheckOverwrite",(t,e)=>{gn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class sy{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 oy={major:4,minor:4,patch:3},bt=$("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=oy;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=Di(a),d;for(const h of l){if(h._zod.def.when){if(l0(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=Di(a,p)))});else{if(a.issues.length===p)continue;u||(u=Di(a,p))}}return d?d.then(()=>a):a},o=(a,l,c)=>{if(Di(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)}}st(t,"~standard",()=>({validate:s=>{var o;try{const a=d0(t,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return f0(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}))}),ld=$("$ZodString",(t,e)=>{var n;bt.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??j0(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}}),mt=$("$ZodStringFormat",(t,e)=>{kl.init(t,e),ld.init(t,e)}),ay=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=P0),mt.init(t,e)}),ly=$("$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());mt.init(t,e)}),cy=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=R0),mt.init(t,e)}),uy=$("$ZodURL",(t,e)=>{mt.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)===D0.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})}}}),dy=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=M0()),mt.init(t,e)}),fy=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=T0),mt.init(t,e)}),hy=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=y0),mt.init(t,e)}),py=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=k0),mt.init(t,e)}),gy=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=E0),mt.init(t,e)}),my=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=S0),mt.init(t,e)}),vy=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=x0),mt.init(t,e)}),by=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=U0(e)),mt.init(t,e)}),_y=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=B0),mt.init(t,e)}),wy=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=$0(e)),mt.init(t,e)}),yy=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=C0),mt.init(t,e)}),ky=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=O0),mt.init(t,e),t._zod.bag.format="ipv4"}),Ey=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=N0),mt.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})}}}),Sy=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=z0),mt.init(t,e)}),xy=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=I0),mt.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 Bg(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Ty=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=L0),mt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Bg(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Cy(t){if(!Og.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Bg(n)}const Py=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Og),mt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Cy(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Ry=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=H0),mt.init(t,e)});function Ay(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 My=$("$ZodJWT",(t,e)=>{mt.init(t,e),t._zod.check=n=>{Ay(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),$g=$("$ZodNumber",(t,e)=>{bt.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ig,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}}),Oy=$("$ZodNumberFormat",(t,e)=>{q0.init(t,e),$g.init(t,e)}),Ny=$("$ZodBoolean",(t,e)=>{bt.init(t,e),t._zod.pattern=G0,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}}),zy=$("$ZodUnknown",(t,e)=>{bt.init(t,e),t._zod.parse=n=>n}),Iy=$("$ZodNever",(t,e)=>{bt.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(...Hi(n,t.issues)),e.value[n]=t.value}const Ly=$("$ZodArray",(t,e)=>{bt.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 Ia(t,e,n,r,i,s){const o=n in r;if(t.issues.length){if(i&&s&&!o)return;e.issues.push(...Hi(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 Ug(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=Qw(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function jg(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=>Ia(g,n,h,e,u,d))):Ia(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 Dy=$("$ZodObject",(t,e)=>{bt.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=_l(()=>Ug(e));st(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=ro,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",_=p._zod.run({value:c[h],issues:[]},l);_ instanceof Promise?u.push(_.then(k=>Ia(k,a,h,c,g,m))):Ia(_,a,h,c,g,m)}return s?jg(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),Hy=$("$ZodObjectJIT",(t,e)=>{Dy.init(t,e);const n=t._zod.parse,r=_l(()=>Ug(e)),i=h=>{var I,R;const p=new sy(["shape","payload","ctx"]),g=r.value,m=A=>{const T=_f(A);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};p.write("const input = payload.value;");const _=Object.create(null);let k=0;for(const A of g.keys)_[A]=`key_${k++}`;p.write("const newResult = {};");for(const A of g.keys){const T=_[A],M=_f(A),N=h[A],j=((I=N==null?void 0:N._zod)==null?void 0:I.optin)==="optional",H=((R=N==null?void 0:N._zod)==null?void 0:R.optout)==="optional";p.write(`const ${T} = ${m(A)};`),j&&H?p.write(`
6
- if (${T}.issues.length) {
7
- if (${M} in input) {
8
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
9
- ...iss,
10
- path: iss.path ? [${M}, ...iss.path] : [${M}]
11
- })));
12
- }
13
- }
14
-
15
- if (${T}.value === undefined) {
16
- if (${M} in input) {
17
- newResult[${M}] = undefined;
18
- }
19
- } else {
20
- newResult[${M}] = ${T}.value;
21
- }
22
-
23
- `):j?p.write(`
24
- if (${T}.issues.length) {
25
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
26
- ...iss,
27
- path: iss.path ? [${M}, ...iss.path] : [${M}]
28
- })));
29
- }
30
-
31
- if (${T}.value === undefined) {
32
- if (${M} in input) {
33
- newResult[${M}] = undefined;
34
- }
35
- } else {
36
- newResult[${M}] = ${T}.value;
37
- }
38
-
39
- `):p.write(`
40
- const ${T}_present = ${M} in input;
41
- if (${T}.issues.length) {
42
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
43
- ...iss,
44
- path: iss.path ? [${M}, ...iss.path] : [${M}]
45
- })));
46
- }
47
- if (!${T}_present && !${T}.issues.length) {
48
- payload.issues.push({
49
- code: "invalid_type",
50
- expected: "nonoptional",
51
- input: undefined,
52
- path: [${M}]
53
- });
54
- }
55
-
56
- if (${T}_present) {
57
- if (${T}.value === undefined) {
58
- newResult[${M}] = undefined;
59
- } else {
60
- newResult[${M}] = ${T}.value;
61
- }
62
- }
63
-
64
- `)}p.write("payload.value = newResult;"),p.write("return payload;");const O=p.compile();return(A,T)=>O(h,A,T)};let s;const o=ro,a=!nd.jitless,c=a&&Jw.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?jg([],g,h,p,d,t):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),h)}});function kf(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=>!Di(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=>Sr(o,r,Er())))}),e)}const Fg=$("$ZodUnion",(t,e)=>{bt.init(t,e),st(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),st(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),st(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),st(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=>id(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=>kf(a,r,t,i)):kf(o,r,t,i)}}),By=$("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Fg.init(t,e);const n=t._zod.parse;st(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=_l(()=>{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(!ro(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)}}),$y=$("$ZodIntersection",(t,e)=>{bt.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])=>Ef(n,l,c)):Ef(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(is(t)&&is(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 Ef(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}),Di(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 Uy=$("$ZodRecord",(t,e)=>{bt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!is(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=>Sr(p,r,Er())),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(...Hi(c,p.issues)),n.value[d]=p.value})):(h.issues.length&&n.issues.push(...Hi(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"&&Ig.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=>Sr(d,r,Er())),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(...Hi(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...Hi(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),jy=$("$ZodEnum",(t,e)=>{bt.init(t,e);const n=Tg(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>Kw.has(typeof i)).map(i=>typeof i=="string"?ss(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}}),Fy=$("$ZodLiteral",(t,e)=>{if(bt.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"?ss(r):r?ss(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}}),Gy=$("$ZodTransform",(t,e)=>{bt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xg(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 Gg=$("$ZodOptional",(t,e)=>{bt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),st(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${id(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)}}),Vy=$("$ZodExactOptional",(t,e)=>{Gg.init(t,e),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Zy=$("$ZodNullable",(t,e)=>{bt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${id(n.source)}|null)$`):void 0}),st(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)}),Wy=$("$ZodDefault",(t,e)=>{bt.init(t,e),t._zod.optin="optional",st(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)=>{bt.init(t,e),t._zod.optin="optional",st(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))}),Xy=$("$ZodNonOptional",(t,e)=>{bt.init(t,e),st(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 Yy=$("$ZodCatch",(t,e)=>{bt.init(t,e),t._zod.optin="optional",st(t._zod,"optout",()=>e.innerType._zod.optout),st(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=>Sr(o,r,Er()))},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=>Sr(s,r,Er()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Vg=$("$ZodPipe",(t,e)=>{bt.init(t,e),st(t._zod,"values",()=>e.in._zod.values),st(t._zod,"optin",()=>e.in._zod.optin),st(t._zod,"optout",()=>e.out._zod.optout),st(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=>Jo(o,e.in,r)):Jo(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Jo(s,e.out,r)):Jo(i,e.out,r)}});function Jo(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 Jy=$("$ZodPreprocess",(t,e)=>{Vg.init(t,e)}),Ky=$("$ZodReadonly",(t,e)=>{bt.init(t,e),st(t._zod,"propValues",()=>e.innerType._zod.propValues),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),st(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 Qy=$("$ZodCustom",(t,e)=>{gn.init(t,e),bt.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(io(i))}}var Rf;class e1{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 t1(){return new e1}(Rf=globalThis).__zod_globalRegistry??(Rf.__zod_globalRegistry=t1());const Us=globalThis.__zod_globalRegistry;function n1(t,e){return new t({type:"string",...ye(e)})}function r1(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 i1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(e)})}function s1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(e)})}function o1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(e)})}function a1(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(e)})}function l1(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ye(e)})}function c1(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(e)})}function u1(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(e)})}function d1(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(e)})}function f1(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(e)})}function h1(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(e)})}function p1(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ye(e)})}function g1(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(e)})}function m1(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(e)})}function v1(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(e)})}function b1(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(e)})}function _1(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(e)})}function w1(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ye(e)})}function y1(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(e)})}function k1(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ye(e)})}function E1(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(e)})}function S1(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(e)})}function x1(t,e){return new t({type:"string",format:"date",check:"string_format",...ye(e)})}function T1(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ye(e)})}function C1(t,e){return new t({type:"string",format:"duration",check:"string_format",...ye(e)})}function P1(t,e){return new t({type:"number",checks:[],...ye(e)})}function R1(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(e)})}function A1(t,e){return new t({type:"boolean",...ye(e)})}function M1(t){return new t({type:"unknown"})}function O1(t,e){return new t({type:"never",...ye(e)})}function Mf(t,e){return new Dg({check:"less_than",...ye(e),value:t,inclusive:!1})}function Jl(t,e){return new Dg({check:"less_than",...ye(e),value:t,inclusive:!0})}function Of(t,e){return new Hg({check:"greater_than",...ye(e),value:t,inclusive:!1})}function Kl(t,e){return new Hg({check:"greater_than",...ye(e),value:t,inclusive:!0})}function Nf(t,e){return new W0({check:"multiple_of",...ye(e),value:t})}function Zg(t,e){return new X0({check:"max_length",...ye(e),maximum:t})}function La(t,e){return new Y0({check:"min_length",...ye(e),minimum:t})}function Wg(t,e){return new J0({check:"length_equals",...ye(e),length:t})}function N1(t,e){return new K0({check:"string_format",format:"regex",...ye(e),pattern:t})}function z1(t){return new Q0({check:"string_format",format:"lowercase",...ye(t)})}function I1(t){return new ey({check:"string_format",format:"uppercase",...ye(t)})}function L1(t,e){return new ty({check:"string_format",format:"includes",...ye(e),includes:t})}function D1(t,e){return new ny({check:"string_format",format:"starts_with",...ye(e),prefix:t})}function H1(t,e){return new ry({check:"string_format",format:"ends_with",...ye(e),suffix:t})}function ps(t){return new iy({check:"overwrite",tx:t})}function B1(t){return ps(e=>e.normalize(t))}function $1(){return ps(t=>t.trim())}function U1(){return ps(t=>t.toLowerCase())}function j1(){return ps(t=>t.toUpperCase())}function F1(){return ps(t=>Yw(t))}function G1(t,e,n){return new t({type:"array",element:e,...ye(n)})}function V1(t,e,n){return new t({type:"custom",check:"custom",fn:e,...ye(n)})}function Z1(t,e){const n=W1(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(io(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(io(s))}},t(r.value,r)),e);return n}function W1(t,e){const n=new gn({check:"custom",...ye(e)});return n._zod.check=t,n}function qg(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)??Us,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 At(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),At(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"&&en(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 Xg(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 _=(m=t.external.registry.get(u[0]))==null?void 0:m.id,k=t.external.uri??(I=>I);if(_)return{ref:k(_)};const O=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=O,{defId:O,ref:`${k("__shared")}#/${d}/${O}`}}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 Yg(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 k=t.seen.get(m),O=k.schema;if(O.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(O)):Object.assign(p,O),Object.assign(p,g),d._zod.parent===m)for(const R in p)R==="$ref"||R==="allOf"||R in g||delete p[R];if(O.$ref&&k.def)for(const R in p)R==="$ref"||R==="allOf"||R in k.def&&JSON.stringify(p[R])===JSON.stringify(k.def[R])&&delete p[R]}const _=d._zod.parent;if(_&&_!==m){r(_);const k=t.seen.get(_);if(k!=null&&k.schema.$ref&&(p.$ref=k.schema.$ref,k.def))for(const O in p)O==="$ref"||O==="allOf"||O in k.def&&JSON.stringify(p[O])===JSON.stringify(k.def[O])&&delete p[O]}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:Da(e,"input",t.processors),output:Da(e,"output",t.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function en(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 en(r.element,n);if(r.type==="set")return en(r.valueType,n);if(r.type==="lazy")return en(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 en(r.innerType,n);if(r.type==="intersection")return en(r.left,n)||en(r.right,n);if(r.type==="record"||r.type==="map")return en(r.keyType,n)||en(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:en(r.in,n)||en(r.out,n);if(r.type==="object"){for(const i in r.shape)if(en(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(en(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(en(i,n))return!0;return!!(r.rest&&en(r.rest,n))}return!1}const q1=(t,e={})=>n=>{const r=qg({...n,processors:e});return At(t,r),Xg(r,t),Yg(r,t)},Da=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=qg({...i??{},target:s,io:e,processors:n});return At(t,o),Xg(o,t),Yg(o,t)},X1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y1=(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=X1[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}))])}},J1=(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)},K1=(t,e,n,r)=>{n.type="boolean"},Q1=(t,e,n,r)=>{n.not={}},ek=(t,e,n,r)=>{},tk=(t,e,n,r)=>{const i=t._zod.def,s=Tg(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},nk=(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},rk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ik=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},sk=(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=At(s.element,e,{...r,path:[...r.path,"items"]})},ok=(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]=At(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=At(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},ak=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>At(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},lk=(t,e,n,r)=>{const i=t._zod.def,s=At(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=At(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},ck=(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=At(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=At(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=At(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)}},uk=(t,e,n,r)=>{const i=t._zod.def,s=At(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"}]},dk=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},fk=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},hk=(t,e,n,r)=>{const i=t._zod.def;At(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)))},pk=(t,e,n,r)=>{const i=t._zod.def;At(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},gk=(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;At(o,e,r);const a=e.seen.get(t);a.ref=o},mk=(t,e,n,r)=>{const i=t._zod.def;At(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;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},vk=$("ZodISODateTime",(t,e)=>{by.init(t,e),wt.init(t,e)});function bk(t){return S1(vk,t)}const _k=$("ZodISODate",(t,e)=>{_y.init(t,e),wt.init(t,e)});function wk(t){return x1(_k,t)}const yk=$("ZodISOTime",(t,e)=>{wy.init(t,e),wt.init(t,e)});function kk(t){return T1(yk,t)}const Ek=$("ZodISODuration",(t,e)=>{yy.init(t,e),wt.init(t,e)});function Sk(t){return C1(Ek,t)}const xk=(t,e)=>{Ag.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>u0(t,n)},flatten:{value:n=>c0(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",xk,{Parent:Error}),Tk=od(In),Ck=ad(In),Pk=wl(In),Rk=yl(In),Ak=h0(In),Mk=p0(In),Ok=g0(In),Nk=m0(In),zk=v0(In),Ik=b0(In),Lk=_0(In),Dk=w0(In),zf=new WeakMap;function Lo(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 _t=$("ZodType",(t,e)=>(bt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Da(t,"input"),output:Da(t,"output")}}),t.toJSONSchema=q1(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>Tk(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>Pk(t,n,r),t.parseAsync=async(n,r)=>Ck(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Rk(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>Ak(t,n,r),t.decode=(n,r)=>Mk(t,n,r),t.encodeAsync=async(n,r)=>Ok(t,n,r),t.decodeAsync=async(n,r)=>Nk(t,n,r),t.safeEncode=(n,r)=>zk(t,n,r),t.safeDecode=(n,r)=>Ik(t,n,r),t.safeEncodeAsync=async(n,r)=>Lk(t,n,r),t.safeDecodeAsync=async(n,r)=>Dk(t,n,r),Lo(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(PE(n,r))},superRefine(n,r){return this.check(RE(n,r))},overwrite(n){return this.check(ps(n))},optional(){return Hf(this)},exactOptional(){return gE(this)},nullable(){return Bf(this)},nullish(){return Hf(Bf(this))},nonoptional(n){return yE(this,n)},array(){return vt(this)},or(n){return $r([this,n])},and(n){return dE(this,n)},transform(n){return $f(this,tm(n))},default(n){return bE(this,n)},prefault(n){return wE(this,n)},catch(n){return EE(this,n)},pipe(n){return $f(this,n)},readonly(){return TE(this)},describe(n){const r=this.clone();return Us.add(r,{description:n}),r},meta(...n){if(n.length===0)return Us.get(this);const r=this.clone();return Us.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=Us.get(t))==null?void 0:n.description},configurable:!0}),t)),Kg=$("_ZodString",(t,e)=>{ld.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(r,i,s)=>Y1(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Lo(t,"_ZodString",{regex(...r){return this.check(N1(...r))},includes(...r){return this.check(L1(...r))},startsWith(...r){return this.check(D1(...r))},endsWith(...r){return this.check(H1(...r))},min(...r){return this.check(La(...r))},max(...r){return this.check(Zg(...r))},length(...r){return this.check(Wg(...r))},nonempty(...r){return this.check(La(1,...r))},lowercase(r){return this.check(z1(r))},uppercase(r){return this.check(I1(r))},trim(){return this.check($1())},normalize(...r){return this.check(B1(...r))},toLowerCase(){return this.check(U1())},toUpperCase(){return this.check(j1())},slugify(){return this.check(F1())}})}),Hk=$("ZodString",(t,e)=>{ld.init(t,e),Kg.init(t,e),t.email=n=>t.check(r1(Bk,n)),t.url=n=>t.check(l1($k,n)),t.jwt=n=>t.check(E1(tE,n)),t.emoji=n=>t.check(c1(Uk,n)),t.guid=n=>t.check(Af(If,n)),t.uuid=n=>t.check(i1(Ko,n)),t.uuidv4=n=>t.check(s1(Ko,n)),t.uuidv6=n=>t.check(o1(Ko,n)),t.uuidv7=n=>t.check(a1(Ko,n)),t.nanoid=n=>t.check(u1(jk,n)),t.guid=n=>t.check(Af(If,n)),t.cuid=n=>t.check(d1(Fk,n)),t.cuid2=n=>t.check(f1(Gk,n)),t.ulid=n=>t.check(h1(Vk,n)),t.base64=n=>t.check(w1(Kk,n)),t.base64url=n=>t.check(y1(Qk,n)),t.xid=n=>t.check(p1(Zk,n)),t.ksuid=n=>t.check(g1(Wk,n)),t.ipv4=n=>t.check(m1(qk,n)),t.ipv6=n=>t.check(v1(Xk,n)),t.cidrv4=n=>t.check(b1(Yk,n)),t.cidrv6=n=>t.check(_1(Jk,n)),t.e164=n=>t.check(k1(eE,n)),t.datetime=n=>t.check(bk(n)),t.date=n=>t.check(wk(n)),t.time=n=>t.check(kk(n)),t.duration=n=>t.check(Sk(n))});function de(t){return n1(Hk,t)}const wt=$("ZodStringFormat",(t,e)=>{mt.init(t,e),Kg.init(t,e)}),Bk=$("ZodEmail",(t,e)=>{cy.init(t,e),wt.init(t,e)}),If=$("ZodGUID",(t,e)=>{ay.init(t,e),wt.init(t,e)}),Ko=$("ZodUUID",(t,e)=>{ly.init(t,e),wt.init(t,e)}),$k=$("ZodURL",(t,e)=>{uy.init(t,e),wt.init(t,e)}),Uk=$("ZodEmoji",(t,e)=>{dy.init(t,e),wt.init(t,e)}),jk=$("ZodNanoID",(t,e)=>{fy.init(t,e),wt.init(t,e)}),Fk=$("ZodCUID",(t,e)=>{hy.init(t,e),wt.init(t,e)}),Gk=$("ZodCUID2",(t,e)=>{py.init(t,e),wt.init(t,e)}),Vk=$("ZodULID",(t,e)=>{gy.init(t,e),wt.init(t,e)}),Zk=$("ZodXID",(t,e)=>{my.init(t,e),wt.init(t,e)}),Wk=$("ZodKSUID",(t,e)=>{vy.init(t,e),wt.init(t,e)}),qk=$("ZodIPv4",(t,e)=>{ky.init(t,e),wt.init(t,e)}),Xk=$("ZodIPv6",(t,e)=>{Ey.init(t,e),wt.init(t,e)}),Yk=$("ZodCIDRv4",(t,e)=>{Sy.init(t,e),wt.init(t,e)}),Jk=$("ZodCIDRv6",(t,e)=>{xy.init(t,e),wt.init(t,e)}),Kk=$("ZodBase64",(t,e)=>{Ty.init(t,e),wt.init(t,e)}),Qk=$("ZodBase64URL",(t,e)=>{Py.init(t,e),wt.init(t,e)}),eE=$("ZodE164",(t,e)=>{Ry.init(t,e),wt.init(t,e)}),tE=$("ZodJWT",(t,e)=>{My.init(t,e),wt.init(t,e)}),Qg=$("ZodNumber",(t,e)=>{$g.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(r,i,s)=>J1(t,r,i),Lo(t,"ZodNumber",{gt(r,i){return this.check(Of(r,i))},gte(r,i){return this.check(Kl(r,i))},min(r,i){return this.check(Kl(r,i))},lt(r,i){return this.check(Mf(r,i))},lte(r,i){return this.check(Jl(r,i))},max(r,i){return this.check(Jl(r,i))},int(r){return this.check(Lf(r))},safe(r){return this.check(Lf(r))},positive(r){return this.check(Of(0,r))},nonnegative(r){return this.check(Kl(0,r))},negative(r){return this.check(Mf(0,r))},nonpositive(r){return this.check(Jl(0,r))},multipleOf(r,i){return this.check(Nf(r,i))},step(r,i){return this.check(Nf(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 Vt(t){return P1(Qg,t)}const nE=$("ZodNumberFormat",(t,e)=>{Oy.init(t,e),Qg.init(t,e)});function Lf(t){return R1(nE,t)}const rE=$("ZodBoolean",(t,e)=>{Ny.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>K1(t,n,r)});function xr(t){return A1(rE,t)}const iE=$("ZodUnknown",(t,e)=>{zy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ek()});function lu(){return M1(iE)}const sE=$("ZodNever",(t,e)=>{Iy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Q1(t,n,r)});function oE(t){return O1(sE,t)}const aE=$("ZodArray",(t,e)=>{Ly.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>sk(t,n,r,i),t.element=e.element,Lo(t,"ZodArray",{min(n,r){return this.check(La(n,r))},nonempty(n){return this.check(La(1,n))},max(n,r){return this.check(Zg(n,r))},length(n,r){return this.check(Wg(n,r))},unwrap(){return this.element}})});function vt(t,e){return G1(aE,t,e)}const lE=$("ZodObject",(t,e)=>{Hy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ok(t,n,r,i),st(t,"shape",()=>e.shape),Lo(t,"ZodObject",{keyof(){return Kt(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:oE()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return r0(this,n)},safeExtend(n){return i0(this,n)},merge(n){return s0(this,n)},pick(n){return t0(this,n)},omit(n){return n0(this,n)},partial(...n){return o0(nm,this,n[0])},required(...n){return a0(rm,this,n[0])}})});function Ue(t,e){const n={type:"object",shape:t??{},...ye(e)};return new lE(n)}const em=$("ZodUnion",(t,e)=>{Fg.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ak(t,n,r,i),t.options=e.options});function $r(t,e){return new em({type:"union",options:t,...ye(e)})}const cE=$("ZodDiscriminatedUnion",(t,e)=>{em.init(t,e),By.init(t,e)});function cd(t,e,n){return new cE({type:"union",options:e,discriminator:t,...ye(n)})}const uE=$("ZodIntersection",(t,e)=>{$y.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>lk(t,n,r,i)});function dE(t,e){return new uE({type:"intersection",left:t,right:e})}const Df=$("ZodRecord",(t,e)=>{Uy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ck(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function gs(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)=>{jy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(r,i,s)=>tk(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 Kt(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 fE=$("ZodLiteral",(t,e)=>{Fy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>nk(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 Pt(t,e){return new fE({type:"literal",values:Array.isArray(t)?t:[t],...ye(e)})}const hE=$("ZodTransform",(t,e)=>{Gy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ik(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xg(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(io(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(io(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 tm(t){return new hE({type:"transform",transform:t})}const nm=$("ZodOptional",(t,e)=>{Gg.init(t,e),_t.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 nm({type:"optional",innerType:t})}const pE=$("ZodExactOptional",(t,e)=>{Vy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Jg(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function gE(t){return new pE({type:"optional",innerType:t})}const mE=$("ZodNullable",(t,e)=>{Zy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>uk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Bf(t){return new mE({type:"nullable",innerType:t})}const vE=$("ZodDefault",(t,e)=>{Wy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>fk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function bE(t,e){return new vE({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Pg(e)}})}const _E=$("ZodPrefault",(t,e)=>{qy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>hk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function wE(t,e){return new _E({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Pg(e)}})}const rm=$("ZodNonOptional",(t,e)=>{Xy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>dk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function yE(t,e){return new rm({type:"nonoptional",innerType:t,...ye(e)})}const kE=$("ZodCatch",(t,e)=>{Yy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>pk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function EE(t,e){return new kE({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const im=$("ZodPipe",(t,e)=>{Vg.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>gk(t,n,r,i),t.in=e.in,t.out=e.out});function $f(t,e){return new im({type:"pipe",in:t,out:e})}const SE=$("ZodPreprocess",(t,e)=>{im.init(t,e),Jy.init(t,e)}),xE=$("ZodReadonly",(t,e)=>{Ky.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>mk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function TE(t){return new xE({type:"readonly",innerType:t})}const CE=$("ZodCustom",(t,e)=>{Qy.init(t,e),_t.init(t,e),t._zod.processJSONSchema=(n,r,i)=>rk(t,n)});function PE(t,e={}){return V1(CE,t,e)}function RE(t,e){return Z1(t,e)}function AE(t,e){return new SE({type:"pipe",in:tm(t),out:e})}const ME=de().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/),Se=de().min(1),ud=Vt().int(),Qo=ud.nonnegative(),Uf=4*1024;Kt(["hook","log","internal"]);const OE=/^events:(\*|[a-z][a-z0-9]*(?:,[a-z][a-z0-9]*)*)$/,NE=de().regex(OE),ct=(t,e,n)=>{const r=typeof e=="string"?Pt(e):e;return Ue({id:ME,ts:ud,topic:Pt(t),source:r,payload:n}).strict()},Dt=t=>Ue(t).strict(),jf=$r([ct("wan.connected",$r([Pt("hook"),Pt("log")]),Dt({interface:Se,address:Se,mask:Se,gateway:Se})),ct("wan.disconnected",$r([Pt("hook"),Pt("log")]),Dt({interface:Se})),ct("net.ip_changed",$r([Pt("hook"),Pt("log")]),Ue({address:Se,mask:Se,link:Se,connected:xr()}).strict()),ct("net.dhcp_lease","log",Dt({mac:Se,ip:Se,hostname:Se,action:Se})),ct("net.dns_changed","log",Ue({resolvers:vt(Se)}).strict()),ct("wifi.client_join","log",Dt({mac:Se,band:Se,ssid:Se,iface:Se})),ct("wifi.client_leave","log",Dt({mac:Se,band:Se,ssid:Se,iface:Se})),ct("firewall.rebuilt","hook",Dt({table_type:Se,table:Se})),ct("usb.attached","hook",Dt({device:Se,model:Se,vendor:Se,port:Se})),ct("usb.detached","hook",Dt({device:Se,port:Se})),ct("fs.mounted","hook",Dt({fs_type:Se,label:Se,directory:Se})),ct("fs.unmounted","hook",Dt({label:Se,directory:Se})),ct("clock.synced","hook",Ue({offset_ms:ud.optional()}).strict()),ct("schedule.fired","hook",Ue({name:Se,action:Se,elapsed:Qo}).strict()),ct("button.pressed","hook",Dt({button:Se,gesture:Se})),ct("auth.login","log",Ue({user:Se,ip:Se,success:xr()}).strict()),ct("firmware.available","log",Dt({version:Se})),ct("plugin.installed","internal",Dt({name:Se,version:Se})),ct("plugin.removed","internal",Dt({name:Se})),ct("plugin.approved","internal",Dt({name:Se,version:Se})),ct("plugin.started","internal",Dt({name:Se})),ct("plugin.stopped","internal",Ue({name:Se,reason:Se}).strict()),ct("daemon.started","internal",Ue({version:Se,uptime_ms:Qo}).strict()),ct("daemon.stopping","internal",Dt({reason:Se})),ct("daemon.updated","internal",Dt({version:Se})),ct("storage.low","internal",Ue({path:Pt("/opt"),available_bytes:Qo,threshold_bytes:Qo}).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:$E,r=e&&e.serializer?e.serializer:HE;return(e&&e.strategy?e.strategy:LE)(t,{cache:n,serializer:r})}function zE(t){return t==null||typeof t=="number"||typeof t=="boolean"}function IE(t,e,n,r){const i=zE(r)?r:n(r);let s=e.get(i);return typeof s>"u"&&(s=t.call(this,r),e.set(i,s)),s}function sm(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 om(t,e,n,r,i){return n.bind(e,t,r,i)}function LE(t,e){const n=t.length===1?IE:sm;return om(t,this,n,e.cache.create(),e.serializer)}function DE(t,e){return om(t,this,sm,e.cache.create(),e.serializer)}const HE=function(){return JSON.stringify(arguments)};var BE=class{constructor(){this.cache=Object.create(null)}get(t){return this.cache[t]}set(t,e){this.cache[t]=e}};const $E={create:function(){return new BE}},ec={variadic:DE},UE=/(?:[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 jE(t){const e={};return t.replace(UE,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 FE=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function GE(t){if(t.length===0)throw new Error("Number skeleton cannot be empty");const e=t.split(FE).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 VE(t){return t.replace(/^(.*?)-/,"")}const Ff=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,am=/^(@+)?(\+|#+)?[rs]?$/g,ZE=/(\*)(0+)|(#+)(0+)|(0+)/g,lm=/^(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(am,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 cm(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 WE(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)),!lm.test(t))throw new Error("Malformed concise eng/scientific notation");e.minimumIntegerDigits=t.length}return e}function Vf(t){const e={},n=cm(t);return n||e}function qE(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=VE(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(ZE,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(lm.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(am.test(n.stem)){e={...e,...Gf(n.stem)};continue}const r=cm(n.stem);r&&(e={...e,...r});const i=WE(n.stem);i&&(e={...e,...i})}return e}let XE=(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 YE(t){return t.type===1}function um(t){return t.type===2}function dm(t){return t.type===3}function fm(t){return t.type===4}function hm(t){return t.type===5}function pm(t){return t.type===6}function JE(t){return t.type===7}function gm(t){return t.type===8}function mm(t){return!!(t&&typeof t=="object"&&t.type===0)}function uu(t){return!!(t&&typeof t=="object"&&t.type===1)}const vm=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,ea={"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 KE(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=QE(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 QE(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),(ea[r||""]||ea[n||""]||ea[`${n}-001`]||ea["001"])[0]}const eS=new RegExp(`^${vm.source}*`),tS=new RegExp(`${vm.source}*$`);function qe(t,e){return{start:t,end:e}}const nS=!!Object.fromEntries,rS=!!String.prototype.trimStart,iS=!!String.prototype.trimEnd,Wf=nS?Object.fromEntries:function(e){const n={};for(const[r,i]of e)n[r]=i;return n},sS=rS?function(e){return e.trimStart()}:function(e){return e.replace(eS,"")},oS=iS?function(e){return e.trimEnd()}:function(e){return e.replace(tS,"")},qf=new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");function aS(t,e){return qf.lastIndex=e,qf.exec(t)[1]??""}function lS(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 cS=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=lS(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()&&dS(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||!uS(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=aS(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=oS(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=sS(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=KE(u,this.locale));const h={type:1,pattern:d,location:a.styleLocation,parsedOptions:this.shouldParseSkeletons?jE(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=GE(t)}catch{return this.error(7,e)}return{val:{type:0,tokens:n,location:e,parsedOptions:this.shouldParseSkeletons?qE(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()&&fS(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 uS(t){return du(t)||t===47}function dS(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 fS(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,hm(e)||pm(e))for(const n in e.options)delete e.options[n].location,fu(e.options[n].value);else um(e)&&mm(e.style)||(dm(e)||fm(e))&&uu(e.style)?delete e.style.location:gm(e)&&fu(e.children)})}function hS(t,e={}){e={shouldParseSkeletons:!0,requiresOtherClause:!0,...e};const n=new cS(t,e).parse();if(n.err){const r=SyntaxError(XE[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 El=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 El{constructor(t,e,n,r){super(`Invalid values for "${t}": "${e}". Options are "${Object.keys(n).join('", "')}"`,"INVALID_VALUE",r)}},pS=class extends El{constructor(t,e,n){super(`Value for "${t}" must be of type ${e}`,"INVALID_VALUE",n)}},gS=class extends El{constructor(t,e){super(`The intl string context variable "${t}" was not provided to the string "${e}"`,"MISSING_VALUE",e)}};function mS(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 vS(t){return typeof t=="function"}function wa(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(JE(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 gS(c,o);let u=i[c];if(YE(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(dm(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(fm(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(um(l)){const d=typeof l.style=="string"?r.number[l.style]:mm(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(gm(l)){const{children:d,value:h}=l,p=i[h];if(!vS(p))throw new pS(h,"function",o);let g=p(wa(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(hm(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(...wa(h.value,e,n,r,i));continue}if(pm(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 El(`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(...wa(h.value,e,n,r,i,p-(l.offset||0)));continue}}return mS(a)}function bS(t,e){return e?{...t,...e,...Object.keys(t).reduce((n,r)=>(n[r]={...t[r],...e[r]},n),{})}:t}function _S(t,e){return e?Object.keys(t).reduce((n,r)=>(n[r]=bS(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 wS(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 Ft,yS=(Ft=class{constructor(e,n=Ft.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=>wa(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=Ft.resolveLocale(n),typeof e=="string"){if(this.message=e,!Ft.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");const{...s}=i||{};this.ast=Ft.__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=_S(Ft.formats,r),this.formatters=i&&i.formatters||wS(this.formatterCache)}static get defaultLocale(){return Ft.memoizedDefaultLocale||(Ft.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),Ft.memoizedDefaultLocale}},Ft.memoizedDefaultLocale=null,Ft.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])},Ft.__parse=hS,Ft.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"}}},Ft),kS=yS;function so(t){return t==="en-XA"?"en":t}function bm(t,e,n){if(e===void 0)return t;try{const r=new kS(t,so(n)).format(e);return typeof r=="string"?r:String(r)}catch{return t}}const dd=["persistent-rci-session:read","persistent-rci-session:write"],_m=Kt(dd),wm=$r([_m,NE]),ES=t=>dd.includes(t);function SS(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]=SS(t);return .2126*nc(e)+.7152*nc(n)+.0722*nc(r)}function Ys(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 fd=[{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"}],xS=[{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 TS(t,e={}){const n=e.selector??":root",r=i=>fd.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 ym=(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}}},CS={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},PS=t=>ym(CS[t.toLowerCase()],6),RS=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,AS=t=>{let e;return(e=t.match(RS))?ym(parseInt(e[1],16),e[1].length):void 0},Vr="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Js=`${Vr}%`,hd=`(?:${Vr}%|${Vr})`,MS=`(?:${Vr}(deg|grad|rad|turn)|${Vr})`,os="\\s*,\\s*",OS=new RegExp(`^rgba?\\(\\s*${Vr}${os}${Vr}${os}${Vr}\\s*(?:,\\s*${hd}\\s*)?\\)$`),NS=new RegExp(`^rgba?\\(\\s*${Js}${os}${Js}${os}${Js}\\s*(?:,\\s*${hd}\\s*)?\\)$`),zS=t=>{let e={mode:"rgb"},n;if(n=t.match(OS))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(NS))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},Ha=(t,e)=>t===void 0?void 0:typeof t!="object"?FS(t):t.mode!==void 0?t:e?{...t,mode:e}:void 0,Xr=(t="rgb")=>e=>(e=Ha(e,t))!==void 0?e.mode===t?e:ir[e.mode][t]?ir[e.mode][t](e):t==="rgb"?ir[e.mode].rgb(e):ir.rgb[t](ir[e.mode].rgb(e)):void 0,ir={},km={},Ba=[],Em={},IS=t=>t,tt=t=>(ir[t.mode]={...ir[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{ir[e]||(ir[e]={}),ir[e][t.mode]=t.fromMode[e]}),t.ranges||(t.ranges={}),t.difference||(t.difference={}),t.channels.forEach(e=>{if(t.ranges[e]===void 0&&(t.ranges[e]=[0,1]),!t.interpolate[e])throw new Error(`Missing interpolator for: ${e}`);typeof t.interpolate[e]=="function"&&(t.interpolate[e]={use:t.interpolate[e]}),t.interpolate[e].fixup||(t.interpolate[e].fixup=IS)}),km[t.mode]=t,(t.parse||[]).forEach(e=>{LS(e,t.mode)}),Xr(t.mode)),Sl=t=>km[t],LS=(t,e)=>{if(typeof t=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");Em[t]=e}else typeof t=="function"&&Ba.indexOf(t)<0&&Ba.push(t)},hu=/[^\x00-\x7F]|[a-zA-Z_]/,DS=/[^\x00-\x7F]|[-\w]/,Q={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let Pe=0;function ta(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 HS={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Rs(t){let e="";if((t[Pe]==="-"||t[Pe]==="+")&&(e+=t[Pe++]),e+=na(t),t[Pe]==="."&&/\d/.test(t[Pe+1])&&(e+=t[Pe++]+na(t)),(t[Pe]==="e"||t[Pe]==="E")&&((t[Pe+1]==="-"||t[Pe+1]==="+")&&/\d/.test(t[Pe+2])?e+=t[Pe++]+t[Pe++]+na(t):/\d/.test(t[Pe+1])&&(e+=t[Pe++]+na(t))),pu(t)){let n=$a(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:Q.Hue,value:e*HS[n]}:void 0}return t[Pe]==="%"?(Pe++,{type:Q.Percentage,value:+e}):{type:Q.Number,value:+e}}function na(t){let e="";for(;/\d/.test(t[Pe]);)e+=t[Pe++];return e}function $a(t){let e="";for(;Pe<t.length&&DS.test(t[Pe]);)e+=t[Pe++];return e}function BS(t){let e=$a(t);return t[Pe]==="("?(Pe++,{type:Q.Function,value:e}):e==="none"?{type:Q.None,value:void 0}:{type:Q.Ident,value:e}}function $S(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:Q.ParenClose});continue}if(r==="+"){if(Pe--,ta(e)){n.push(Rs(e));continue}return}if(r==="-"){if(Pe--,ta(e)){n.push(Rs(e));continue}if(pu(e)){n.push({type:Q.Ident,value:$a(e)});continue}return}if(r==="."){if(Pe--,ta(e)){n.push(Rs(e));continue}return}if(r==="/"){for(;Pe<e.length&&(e[Pe]===`
80
- `||e[Pe]===" "||e[Pe]===" ");)Pe++;let i;if(ta(e)&&(i=Rs(e),i.type!==Q.Hue)){n.push({type:Q.Alpha,value:i});continue}if(pu(e)&&$a(e)==="none"){n.push({type:Q.Alpha,value:{type:Q.None,value:void 0}});continue}return}if(/\d/.test(r)){Pe--,n.push(Rs(e));continue}if(hu.test(r)){Pe--,n.push(BS(e));continue}return}return n}function US(t){t._i=0;let e=t[t._i++];if(!e||e.type!==Q.Function||e.value!=="color"||(e=t[t._i++],e.type!==Q.Ident))return;const n=Em[e.value];if(!n)return;const r={mode:n},i=Sm(t,!1);if(!i)return;const s=Sl(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==Q.None&&(r[l]=a.type===Q.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function Sm(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===Q.None||r.type===Q.Number||r.type===Q.Alpha||r.type===Q.Percentage||e&&r.type===Q.Hue){n.push(r);continue}if(r.type===Q.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==Q.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:Q.None,value:void 0}),n.every(i=>i.type!==Q.Alpha)?n:void 0}}function jS(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==Q.Function)return;let r=Sm(t,e);if(r)return r.unshift(n.value),r}const FS=t=>{if(typeof t!="string")return;const e=$S(t),n=e?jS(e,!0):void 0;let r,i=0,s=Ba.length;for(;i<s;)if((r=Ba[i++](t,n))!==void 0)return r;return e?US(e):void 0};function GS(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.r=r.type===Q.Number?r.value/255:r.value/100),i.type!==Q.None&&(n.g=i.type===Q.Number?i.value/255:i.value/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value/255:s.value/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const VS=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,ZS=(t,e,n)=>t+n*(e-t),WS=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=WS(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(ZS),It=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},ms={mode:"rgb",channels:["r","g","b","alpha"],parse:[GS,AS,zS,PS,VS,"srgb"],serialize:"srgb",interpolate:{r:he,g:he,b:he,alpha:{use:he,fixup:It}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},rc=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Jf=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),Kf=({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)},vs=({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}=vs(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},bs=({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=bs({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},XS={...ms,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Kf(Si(t)),xyz65:Kf},toMode:{rgb:t=>xi(Jf(t)),xyz65:Jf}},Wt=t=>(t=t%360)<0?t+360:t,YS=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=Wt(n);return r===0||t[r-1]===void 0?s:e(s-Wt(i[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),Cr=t=>YS(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),Ht=[-.14861,1.78277,-.29227,-.90649,1.97294,0],JS=Math.PI/180,KS=180/Math.PI;let Qf=Ht[3]*Ht[4],eh=Ht[1]*Ht[4],th=Ht[1]*Ht[2]-Ht[0]*Ht[3];const QS=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(th*n+t*Qf-e*eh)/(th+Qf-eh),s=n-i,o=(Ht[4]*(e-i)-Ht[2]*s)/Ht[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(Ht[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*KS-120),r!==void 0&&(a.alpha=r),a},ex=({h:t,s:e,l:n,alpha:r})=>{let i={mode:"rgb"};t=(t===void 0?0:t+120)*JS,n===void 0&&(n=0);let s=e===void 0?0:e*n*(1-n),o=Math.cos(t),a=Math.sin(t);return i.r=n+s*(Ht[0]*o+Ht[1]*a),i.g=n+s*(Ht[2]*o+Ht[3]*a),i.b=n+s*(Ht[4]*o+Ht[5]*a),r!==void 0&&(i.alpha=r),i},xl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},tx=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=Wt(t.h),r=Wt(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},Tl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},Pr=t=>{let e=t.reduce((r,i)=>{if(i!==void 0){let s=i*Math.PI/180;r.sin+=Math.sin(s),r.cos+=Math.cos(s)}return r},{sin:0,cos:0}),n=Math.atan2(e.sin,e.cos)*180/Math.PI;return n<0?360+n:n},nx={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:QS},toMode:{rgb:ex},interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:xl},average:{h:Pr}},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=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Jr=({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},xm=Math.pow(29,3)/Math.pow(3,3),Tm=Math.pow(6,3)/Math.pow(29,3),Mt={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)>Tm?Math.pow(t,3):(116*t-16)/xm;const Cm=({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},Cl=t=>xi(Cm(t)),lc=t=>t>Tm?Math.cbrt(t):(xm*t+16)/116,Pm=({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},Pl=t=>{let e=Pm(Si(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Ua=1,Rm=1,oo=26/180*Math.PI,ja=Math.cos(oo),Fa=Math.sin(oo),Am=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*Ua/Am)-1)/.0039},s=(Math.exp(.0435*e*Rm*Ua)-1)/.075,o=s*Math.cos(n/180*Math.PI-oo),a=s*Math.sin(n/180*Math.PI-oo);return i.a=o*ja-a/.83*Fa,i.b=o*Fa+a/.83*ja,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*ja+n*Fa,s=.83*(n*ja-e*Fa),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Am/Ua*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Rm*Ua)};return a.c&&(a.h=Wt((Math.atan2(s,i)+oo)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},nh=t=>gu(Yr(t,"dlch")),rh=t=>Jr(mu(t),"dlab"),rx={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:nh,rgb:t=>Cl(nh(t))},fromMode:{lab65:rh,rgb:t=>rh(Pl(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},ix={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:gu,dlab:t=>Jr(t,"dlab"),rgb:t=>Cl(gu(t))},fromMode:{lab65:mu,dlab:t=>Yr(t,"dlch"),rgb:t=>mu(Pl(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:he,c:he,h:{use:he,fixup:Cr},alpha:{use:he,fixup:It}},difference:{h:Tl},average:{h:Pr}};function sx({h:t,s:e,i:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1-e)};break;case 1:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1+e*(3/(2-i)-1)),b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n*(1+e*(3/(2-i)-1)),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;case 3:s={r:n*(1-e),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1+e*(3/(2-i)-1))};break;case 4:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3/(2-i)-1))};break;case 5:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function ox({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 ax={mode:"hsi",toMode:{rgb:sx},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:ox},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,i:he,alpha:{use:he,fixup:It}},difference:{h:xl},average:{h:Pr}};function lx({h:t,s:e,l:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=n+e*(n<.5?n:1-n),s=i-(i-n)*2*Math.abs(t/60%2-1),o;switch(Math.floor(t/60)){case 0:o={r:i,g:s,b:2*n-i};break;case 1:o={r:s,g:i,b:2*n-i};break;case 2:o={r:2*n-i,g:i,b:s};break;case 3:o={r:2*n-i,g:s,b:i};break;case 4:o={r:s,g:2*n-i,b:i};break;case 5:o={r:i,g:2*n-i,b:s};break;default:o={r:2*n-i,g:2*n-i,b:2*n-i}}return o.mode="rgb",r!==void 0&&(o.alpha=r),o}function cx({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 ux=(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}},dx=new RegExp(`^hsla?\\(\\s*${MS}${os}${Js}${os}${Js}\\s*(?:,\\s*${hd}\\s*)?\\)$`),fx=t=>{let e=t.match(dx);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=ux(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 hx(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.s=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.l=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const Mm={mode:"hsl",toMode:{rgb:lx},fromMode:{rgb:cx},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[hx,fx],serialize:t=>`hsl(${t.h!==void 0?t.h:"none"} ${t.s!==void 0?t.s*100+"%":"none"} ${t.l!==void 0?t.l*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:xl},average:{h:Pr}};function Om({h:t,s:e,v:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n,g:n*(1-e*i),b:n*(1-e)};break;case 1:s={r:n*(1-e*i),g:n,b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n,b:n*(1-e*i)};break;case 3:s={r:n*(1-e),g:n*(1-e*i),b:n};break;case 4:s={r:n*(1-e*i),g:n*(1-e),b:n};break;case 5:s={r:n,g:n*(1-e),b:n*(1-e*i)};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Nm({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 zm={mode:"hsv",toMode:{rgb:Om},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Nm},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,v:he,alpha:{use:he,fixup:It}},difference:{h:xl},average:{h:Pr}};function px({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 gx(t){let e=Nm(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 mx(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.w=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.b=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const vx={mode:"hwb",toMode:{rgb:px},fromMode:{rgb:gx},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[mx],serialize:t=>`hwb(${t.h!==void 0?t.h:"none"} ${t.w!==void 0?t.w*100+"%":"none"} ${t.b!==void 0?t.b*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},w:he,b:he,alpha:{use:he,fixup:It}},difference:{h:tx},average:{h:Pr}},Im=203,Rl=.1593017578125,Lm=78.84375,Al=.8359375,Ml=18.8515625,Ol=18.6875;function cc(t){if(t<0)return 0;const e=Math.pow(t,1/Lm);return 1e4*Math.pow(Math.max(0,e-Al)/(Ml-Ol*e),1/Rl)}function uc(t){if(t<0)return 0;const e=Math.pow(t/1e4,Rl);return Math.pow((Al+Ml*e)/(1+Ol*e),Lm)}const dc=t=>Math.max(t/Im,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*Im,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},bx={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:It}}},_x=134.03437499999998,wx=16295499532821565e-27,hc=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,Rl);return Math.pow((Al+Ml*e)/(1+Ol*e),_x)},pc=(t=0)=>Math.max(t*203,0),Dm=({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)-wx,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},yx=134.03437499999998,oh=16295499532821565e-27,gc=t=>{if(t<0)return 0;let e=Math.pow(t,1/yx);return 1e4*Math.pow((Al-e)/(Ol*e-Ml),1/Rl)},mc=t=>t/203,Hm=({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},Bm=t=>{let e=Dm(Si(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},$m=t=>xi(Hm(t)),kx={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Bm,xyz65:Dm},toMode:{rgb:$m,xyz65:Hm},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:he,a:he,b:he,alpha:{use:he,fixup:It}}},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=Wt(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},Ex={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:lh,rgb:t=>$m(lh(t))},fromMode:{rgb:t=>ah(Bm(t)),jab:ah},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,j:he,alpha:{use:he,fixup:It}},difference:{h:Tl},average:{h:Pr}},Nl=Math.pow(29,3)/Math.pow(3,3),pd=Math.pow(6,3)/Math.pow(29,3);let vc=t=>Math.pow(t,3)>pd?Math.pow(t,3):(116*t-16)/Nl;const gd=({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)*Mt.X,y:vc(i)*Mt.Y,z:vc(o)*Mt.Z};return r!==void 0&&(a.alpha=r),a},Do=({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=bs({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},Um=t=>Do(gd(t)),Ho=t=>{let{r:e,g:n,b:r,alpha:i}=vs(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>pd?Math.cbrt(t):(Nl*t+16)/116,md=({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/Mt.X),s=bc(e/Mt.Y),o=bc(n/Mt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},jm=t=>{let e=md(Ho(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function Sx(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*125/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*125/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const vd={mode:"lab",toMode:{xyz50:gd,rgb:Um},fromMode:{xyz50:md,rgb:jm},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[Sx],serialize:t=>`lab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},xx={...vd,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Cm,rgb:Cl},fromMode:{xyz65:Pm,rgb:Pl},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function Tx(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*150/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const bd={mode:"lch",toMode:{lab:Jr,rgb:t=>Um(Jr(t))},fromMode:{rgb:t=>Yr(jm(t)),lab:Yr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Tx],serialize:t=>`lch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:Tl},average:{h:Pr}},Cx={...bd,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Jr(t,"lab65"),rgb:t=>Cl(Jr(t,"lab65"))},fromMode:{rgb:t=>Yr(Pl(t),"lch65"),lab65:t=>Yr(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Fm=({l:t,u:e,v:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"lchuv",l:t,c:i};return i&&(s.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Gm=({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},Vm=(t,e,n)=>4*t/(t+15*e+3*n),Zm=(t,e,n)=>9*e/(t+15*e+3*n),Px=Vm(Mt.X,Mt.Y,Mt.Z),Rx=Zm(Mt.X,Mt.Y,Mt.Z),Ax=t=>t<=pd?Nl*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=Ax(e/Mt.Y),s=Vm(t,e,n),o=Zm(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-Px),o=13*i*(o-Rx));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},Mx=(t,e,n)=>4*t/(t+15*e+3*n),Ox=(t,e,n)=>9*e/(t+15*e+3*n),Nx=Mx(Mt.X,Mt.Y,Mt.Z),zx=Ox(Mt.X,Mt.Y,Mt.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)+Nx,s=n/(13*t)+zx,o=Mt.Y*(t<=8?t/Nl: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},Ix=t=>Fm(vu(Ho(t))),Lx=t=>Do(bu(Gm(t))),Dx={mode:"lchuv",toMode:{luv:Gm,rgb:Lx},fromMode:{rgb:Ix,luv:Fm},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:Tl},average:{h:Pr}},Hx={...ms,mode:"lrgb",toMode:{rgb:bs},fromMode:{rgb:vs},parse:["srgb-linear"],serialize:"srgb-linear"},Bx={mode:"luv",toMode:{xyz50:bu,rgb:t=>Do(bu(t))},fromMode:{xyz50:vu,rgb:t=>vu(Ho(t))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:he,u:he,v:he,alpha:{use:he,fixup:It}}},Wm=({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},zl=t=>{let e=Wm(vs(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Bo=({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},Il=t=>bs(Bo(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 Ga(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function $x(t,e){let n,r,i,s,o,a,l,c;-1.88170328*t-.80936493*e>1?(n=1.19086277,r=1.76576728,i=.59662641,s=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*t-1.19445276*e>1?(n=.73956515,r=-.45954404,i=.08285427,s=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(n=1.35733652,r=-.00915799,i=-1.1513021,s=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=n+r*t+i*e+s*t*t+o*t*e,d=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let g=1+u*d,m=1+u*h,_=1+u*p,k=g*g*g,O=m*m*m,I=_*_*_,R=3*d*g*g,A=3*h*m*m,T=3*p*_*_,M=6*d*d*g,N=6*h*h*m,j=6*p*p*_,H=a*k+l*O+c*I,se=a*R+l*A+c*T,B=a*M+l*N+c*j;u=u-H*se/(se*se-.5*H*B)}return u}function _d(t,e){let n=$x(t,e),r=Bo({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 Ux(t,e,n,r,i,s=null){s||(s=_d(t,e));let o;if((n-i)*s[1]-(s[0]-i)*r<=0)o=s[1]*i/(r*s[0]+s[1]*(i-n));else{o=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));{let a=n-i,l=r,c=.3963377774*t+.2158037573*e,u=-.1055613458*t-.0638541728*e,d=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,g=a+l*d;{let m=i*(1-o)+o*n,_=o*r,k=m+_*c,O=m+_*u,I=m+_*d,R=k*k*k,A=O*O*O,T=I*I*I,M=3*h*k*k,N=3*p*O*O,j=3*g*I*I,H=6*h*h*k,se=6*p*p*O,B=6*g*g*I,q=4.0767416621*R-3.3077115913*A+.2309699292*T-1,ee=4.0767416621*M-3.3077115913*N+.2309699292*j,te=4.0767416621*H-3.3077115913*se+.2309699292*B,W=ee/(ee*ee-.5*q*te),J=-q*W,ne=-1.2684380046*R+2.6097574011*A-.3413193965*T-1,le=-1.2684380046*M+2.6097574011*N-.3413193965*j,oe=-1.2684380046*H+2.6097574011*se-.3413193965*B,ue=le/(le*le-.5*ne*oe),De=-ne*ue,Ye=-.0041960863*R-.7034186147*A+1.707614701*T-1,je=-.0041960863*M-.7034186147*N+1.707614701*j,Ke=-.0041960863*H-.7034186147*se+1.707614701*B,ce=je/(je*je-.5*Ye*Ke),ae=-Ye*ce;J=W>=0?J:1e6,De=ue>=0?De:1e6,ae=ce>=0?ae:1e6,o+=Math.min(J,Math.min(De,ae))}}}return o}function wd(t,e,n=null){n||(n=_d(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function qm(t,e,n){let r=_d(e,n),i=Ux(e,n,t,1,t,r),s=wd(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]=qm(e,n/s,r/s),c;if(s<a){let u=0,d=.8*o,h=1-d/a;c=(s-u)/(d+h*(s-u))*.8}else{let u=a,d=.2*a*a*1.25*1.25/o,h=1-d/(l-a);c=.8+.2*((s-u)/(d+h*(s-u)))}return c&&(i.s=c,i.h=Wt(Math.atan2(r,n)*180/Math.PI)),i}function 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:Ga(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]=qm(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 jx={...Mm,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:ch,rgb:t=>ch(zl(t))},toMode:{oklab:uh,rgb:t=>Il(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]=wd(s,o),c=.5,u=1-c/a,d=l/(i+e*l),h=d*e,p=d*i,g=Ga(h),m=p*g/h,_=Bo({l:g,a:s*m,b:o*m}),k=Math.cbrt(1/Math.max(_.r,_.g,_.b,0));e=e/k,i=i/k*_u(e)/e,e=_u(e);const O={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return O.s&&(O.h=Wt(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(O.alpha=t.alpha),O}function 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]=wd(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=Ga(d),g=h*p/d,m=Bo({l:p,a:s*g,b:o*g}),_=Math.cbrt(1/Math.max(m.r,m.g,m.b,0)),k=Ga(i*d),O=h*k/d;return e.l=k*_,e.a=O*s*_,e.b=O*o*_,e}const Fx={...zm,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:dh,rgb:t=>dh(zl(t))},toMode:{oklab:fh,rgb:t=>Il(fh(t))}};function Gx(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*.4/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*.4/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const Vx={...vd,mode:"oklab",toMode:{lrgb:Bo,rgb:Il},fromMode:{lrgb:Wm,rgb:zl},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Gx],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 Zx(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*.4/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const Wx={...bd,mode:"oklch",toMode:{oklab:t=>Jr(t,"oklab"),rgb:t=>Il(Jr(t,"oklab"))},fromMode:{rgb:t=>Yr(zl(t),"oklch"),oklab:t=>Yr(t,"oklch")},parse:[Zx],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}=vs(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=bs({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={...ms,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},Xx={...ms,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:gh,rgb:t=>gh(Ho(t))},toMode:{xyz50:mh,rgb:t=>Do(mh(t))}},vh=1.09929682680944,Yx=.018053968510807,yc=t=>{const e=Math.abs(t);return e>Yx?(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,Jx=.018053968510807,kc=(t=0)=>{let e=Math.abs(t);return e<Jx*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+_h-1)/_h,1/.45)},wh=t=>{let e=kc(t.r),n=kc(t.g),r=kc(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},Kx={...ms,mode:"rec2020",fromMode:{xyz65:bh,rgb:t=>bh(Si(t))},toMode:{xyz65:wh,rgb:t=>xi(wh(t))},parse:["rec2020"],serialize:"rec2020"},_i=.0037930732552754493,Xm=Math.cbrt(_i),Ec=t=>Math.cbrt(t)-Xm,Qx=t=>{const{r:e,g:n,b:r,alpha:i}=vs(t),s=Ec(.3*e+.622*n+.078*r+_i),o=Ec(.23*e+.692*n+.078*r+_i),a=Ec(.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+Xm,3),e2=({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=bs({r:11.031566904639861*i-9.866943908131562*s-.16462299650829934*o,g:-3.2541473810744237*i+4.418770377582723*s-.16462299650829934*o,b:-3.6588512867136815*i+2.7129230459360922*s+1.9459282407775895*o});return r!==void 0&&(a.alpha=r),a},t2={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:e2},fromMode:{rgb:Qx},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:he,y:he,b:he,alpha:{use:he,fixup:It}}},n2={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:Do,lab:md},fromMode:{rgb:Ho,lab:gd},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},r2=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},i2=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},s2={mode:"xyz65",toMode:{rgb:xi,xyz50:r2},fromMode:{rgb:Si,xyz50:i2},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},o2=({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},a2=({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},l2={mode:"yiq",toMode:{rgb:a2},fromMode:{rgb:o2},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:he,i:he,q:he,alpha:{use:he,fixup:It}}},c2=t=>Math.max(0,Math.min(1,t||0)),xc=t=>Math.round(c2(t)*255),u2=Xr("rgb"),d2=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)},f2=t=>d2(u2(t)),Ym=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},h2=t=>Jm(Ym(t)),Km=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 p2(t){return Km(Ym(t))}function Qm(t="rgb"){const{gamut:e}=Sl(t);if(!e)return r=>!0;const n=Xr(typeof e=="string"?e:t);return r=>Km(n(r))}function g2(t="rgb"){const{gamut:e}=Sl(t);if(!e)return s=>Ha(s);const n=typeof e=="string"?e:t,r=Xr(n),i=Qm(n);return s=>{const o=Ha(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 m2(t,e="lch",n="rgb"){t=Ha(t);let r=n==="rgb"?p2:Qm(n),i=n==="rgb"?h2:g2(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=Sl(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})}tt(XS);tt(nx);tt(rx);tt(ix);tt(ax);tt(Mm);tt(zm);tt(vx);tt(bx);tt(kx);tt(Ex);tt(vd);tt(xx);tt(bd);tt(Cx);tt(Dx);tt(Hx);tt(Bx);tt(jx);tt(Fx);tt(Vx);const v2=tt(Wx);tt(qx);tt(Xx);tt(Kx);tt(ms);tt(t2);tt(n2);tt(s2);tt(l2);function js(t,e,n){const r=m2({mode:"oklch",l:t,c:e,h:n},"oklch");return f2(r??{mode:"oklch",l:t,c:0,h:n})}function ev(t){const e=v2(t);return e?{l:e.l,c:e.c,h:e.h??0}:{l:0,c:0,h:0}}function b2(t,e){const{l:n,c:r,h:i}=ev(t);return js(Math.min(1,Math.max(0,n+e)),r,i)}function _2(t){const{hue:e,chroma:n,bgHex:r,target:i}=t,s=.01;let o=t.l;const a=Ys(js(1,0,e),r),l=Ys(js(0,0,e),r),c=a>=l?s:-s;let u=js(o,n,e);for(;Ys(u,r)<i&&o>0&&o<1;)o=Math.min(1,Math.max(0,o+c)),u=js(o,n,e);return u}function w2(t,e,n){const{l:r,c:i,h:s}=ev(t);return _2({hue:s,chroma:i,l:r,bgHex:e,target:n})}const y2={dark:.12,light:-.12};function k2(t,e,n){const r=b2(t,y2[n]);return Ys(r,e)>=4.5?r:w2(r,e,4.5)}const ya=["dark","light"],wu=fd.map(t=>t.token),E2=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function tv(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function S2(t,e,n){if(!tv(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}E2.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 x2(t){const e=[];for(const n of ya)for(const r of xS){const i=Ys(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 nv(t){const e=[];if(!tv(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 ya){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}S2(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))ya.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 ya){const s=t[i];for(const o of wu)o==="controlHover"&&s[o]===void 0?r[i].controlHover=k2(s.surface,s.text,i):r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:x2(r)}}const T2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),rv=Ue({permission:_m,reason:de().min(1),prerequisite:de().min(1).optional()}),yd=Vt().int().nonnegative().nullable(),C2=Ue({kind:Kt(["exec","service"]),state:Pt("blocked"),retryAfterSeconds:yd,blockers:vt(rv).min(1)}),P2=Ue({kind:Kt(["exec","service"]),state:Pt("incompatible"),retryAfterSeconds:yd,requiredProtocol:Vt().int(),supportedProtocols:vt(Vt().int())}),R2=Ue({kind:Kt(["exec","service"]),state:Kt(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:yd}),A2=t=>{if(!T2(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},M2=AE(A2,cd("state",[C2,P2,R2]));class yu extends Error{constructor(n){super(`Unknown backend binding id: "${n}"`);G(this,"code","UNKNOWN_ID");this.id=n,this.name="BackendUnknownId"}}class iv extends Error{constructor(n){super(`Backend "${n}" is not approved`);G(this,"code","NOT_APPROVED");this.id=n,this.name="BackendNotApproved"}}class sv extends Error{constructor(n){super(`Backend "${n}" is disabled`);G(this,"code","DISABLED");this.id=n,this.name="BackendDisabled"}}class yh extends Error{constructor(n,r){super(`Backend route "${n}" is not an ${r} route`);G(this,"code","TRANSPORT_MISMATCH");this.id=n,this.expected=r,this.name="BackendTransportMismatch"}}class O2 extends Error{constructor(n,r){super(`Backend "${n}" is starting`);G(this,"daemonCode","BACKEND_STARTING");this.id=n,this.retryAfterSeconds=r,this.name="BackendStarting"}}class N2 extends Error{constructor(n){super(`Backend "${n}" is unavailable`);G(this,"daemonCode","BACKEND_UNAVAILABLE");this.id=n,this.name="BackendUnavailable"}}class z2 extends Error{constructor(n){super(`Backend "${n}" is incompatible`);G(this,"daemonCode","BACKEND_INCOMPATIBLE");this.id=n,this.name="BackendIncompatible"}}class I2 extends Error{constructor(n,r){super(`Backend "${n}" is under maintenance`);G(this,"daemonCode","BACKEND_MAINTENANCE");this.id=n,this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class L2 extends Error{constructor(n,r,i){super(`Backend "${n}" is blocked on an unmet activation prerequisite`);G(this,"daemonCode","BACKEND_BLOCKED");this.id=n,this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class D2 extends Error{constructor(n){super(`Backend "${n}" returned a bad gateway response`);G(this,"daemonCode","BAD_GATEWAY");this.id=n,this.name="BackendBadGateway"}}class Tc extends Error{constructor(n,r){super(r);G(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},H2=t=>{const e=vt(rv).safeParse(t);return e.success?e.data:[]},B2={DISABLED:t=>new sv(t),NOT_APPROVED:t=>new iv(t),ROUTE_NOT_FOUND:t=>new yu(t),BACKEND_STARTING:(t,e)=>new O2(t,Cc(e)),BACKEND_UNAVAILABLE:t=>new N2(t),BACKEND_INCOMPATIBLE:t=>new z2(t),BACKEND_MAINTENANCE:(t,e)=>new I2(t,Cc(e)),BACKEND_BLOCKED:(t,e,n)=>new L2(t,H2(n.detail),Cc(e)),BAD_GATEWAY:t=>new D2(t)},$2=t=>{if(!t)return"";const e=new URLSearchParams;for(const[r,i]of Object.entries(t))e.set(r,String(i));const n=e.toString();return n?`?${n}`:""},U2=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),j2=t=>t.startsWith("https:")?"wss:":"ws:",kh=(t,e)=>t.enabled?t.approval!=="approved"?new iv(e):null:new sv(e),F2=async(t,e)=>{if(e.ok)return e;let n;try{n=(await e.clone().json()).error}catch{return e}const r=n!=null&&n.code?B2[n.code]:void 0;if(!r||!n)return e;throw r(t,e,n)},G2=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${$2(r.query)}`,s=new Headers(r.headers);e.method!=="GET"&&e.method!=="HEAD"&&s.set("X-Mndw-Csrf","1");let o;r.body!==void 0&&r.body!==null&&(U2(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 F2(n,a)};function V2(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=kh(e,i);return a?Promise.reject(a):G2(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=kh(e,i);if(a)throw a;const l=`${j2(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 M2.parse(await o.json())}catch(a){throw a instanceof Tc?a:new Tc(o.status,"Backend status response is invalid")}})}}}class Eh extends Error{constructor(n,r){super(r);G(this,"status");this.name="TelemetryError",this.status=n}}const Zr=t=>typeof t=="number"&&Number.isFinite(t),Z2=["unanchored","anchored","suspect"],W2=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"||!Z2.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"]),X2=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}},Y2=(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}},J2=(t,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`projected series ${t} is invalid`);const n=e;if(typeof n.supported!="boolean")throw new Error(`projected series ${t} supported is invalid`);if(n.unit!=="percent"&&n.unit!=="celsius")throw new Error(`projected series ${t} has invalid unit`);if(n.label!==void 0&&n.label!==null&&typeof n.label!="string")throw new Error(`projected series ${t} label is invalid`);if(!Array.isArray(n.points)||!Array.isArray(n.segments)||!Array.isArray(n.bands))throw new Error(`projected series ${t} arrays are invalid`);const r=n.points.map(a=>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=>Y2(c,t)),color:X2(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}},K2=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]=J2(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:W2(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},Q2=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function eT(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 Eh(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw Q2(o)?o:new Eh(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,K2,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const tT={loading:"Loading…",error:"Something went wrong."},nT={"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"},rT={"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"},iT={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."}},sT={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry"},oT={username:"Username",password:"Password",submit:"Login","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},aT={region:"Notifications",dismiss:"Dismiss"},lT={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."},cT={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."},uT={"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."},ov={app:tT,nav:nT,dashboard:rT,settings:iT,common:sT,login:oT,toast:aT,packages:lT,services:cT,errors:uT},dT={loading:"Загрузка…",error:"Произошла ошибка."},fT={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Панель управления","package-manager":"Entware",plugins:"Плагины",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},hT={"add-widget":"+ Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости"},pT={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}. Выберите подходящий архив."}},gT={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить"},mT={username:"Имя пользователя",password:"Пароль",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},vT={region:"Уведомления",dismiss:"Закрыть"},bT={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}: от него зависят другие установленные пакеты."},_T={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} при загрузке? Работающий сервис не изменится до перезагрузки."},wT={"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. Повторите попытку."},yT={app:dT,nav:fT,dashboard:hT,settings:pT,common:gT,login:mT,toast:vT,packages:bT,services:_T,errors:wT},kd="mndw",Va=`${kd}:plugin`,av=["en","ru"],lv=5e3,kT=6e4,ET=24e4,Ed=Object.freeze({theme:"dark",locale:"en"}),Sd=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([])})}),cv="/api/mgmt/list",ST="/api/mgmt/permission",xT="/api/mgmt/upload",xh="/api/mgmt/approve",TT="/api/mgmt/deny",CT="/api/mgmt/enable",PT="/api/mgmt/disable",RT="/api/mgmt/delete",AT="/api/mgmt/restart",MT="/api/mgmt/runtime",Pc="/api/mgmt/palette",OT="/api/mgmt/device-hardware",Th="/api/mgmt/telemetry",NT="/api/mgmt/opkg/list",zT="/api/mgmt/opkg/install",IT="/api/mgmt/opkg/remove",LT="/api/mgmt/opkg/update",DT="/api/mgmt/opkg/upgrade",HT="/api/mgmt/opkg/info",BT="/api/mgmt/self-update/status",$T="/api/mgmt/self-update/check",UT="/api/mgmt/self-update/apply",jT="/api/mgmt/self-update/revert",FT="/api/mgmt/service/list",GT="/api/mgmt/service/status",VT="/api/mgmt/service/start",ZT="/api/mgmt/service/stop",WT="/api/mgmt/service/restart",qT="/api/mgmt/service/set-enabled",Ch={builtin:"/plugins/",user:"/user-plugins/"},XT={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 YT(t){return[...t].map(e=>XT[e]??e).join("")}function JT(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`[${YT(e)}]`}function uv(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?JT(n):uv(n)]))}function KT(){const t=new vb(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 ka(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 QT(t,e){return new ka(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 ku=3e3;function eC(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??rC,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 tC(t,e){const n=t.locales[e];if(n!==void 0)return`${t.baseUrl.replace(/\/$/,"")}/${n}?v=${encodeURIComponent(t.version)}`}function nC(t){return t.split("-")[0]}function dv(t,e){if(t.locales[e]!==void 0)return e;const n=nC(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function rC(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=tC(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 iC(t,e){const n=Math.max(0,e-t.now());return new Promise((r,i)=>{t.setTimeout(()=>i(new Error("catalog deadline exceeded")),n)})}async function fv(t,e,n,r){var d,h;const i=dv(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]),iC(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 hv(t,e){return{hostLocale:e,resolvedCatalogLocale:dv(t,e),fallbackStatus:"key"}}class sC{constructor(e,n){G(this,"source");G(this,"state");G(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=hv(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 oC(t,e,n){const r=new sC(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function aC(t,e){t.catalogCells.add(e)}function lC(t,e){t.catalogCells.delete(e)}function cC(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function pv(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function uC(t,e,n,r=ku){e.commit(await fv(t,e.source,n,t.now()+r))}class dC{constructor(e,n){G(this,"runtime");G(this,"token");G(this,"targetLocale");G(this,"deadline");G(this,"promise");G(this,"pending",0);G(this,"initialEnrollmentDone",!1);G(this,"settled",!1);G(this,"cells",new Map);G(this,"resolvedStates",new Map);G(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+ku,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),ku)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=fv(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>hv(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 fC(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new dC(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function hC(t,e){t.commit(e)}function pC(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function gC(t){return t.activeGeneration}function mC(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 bm(s,n,r)}function vC(t,e,n,r){const i={get locale(){return e()},direction:"ltr",t:(s,o)=>mC(t,s,o,e()),formatNumber:(s,o)=>new Intl.NumberFormat(so(e()),o).format(s),formatDate:(s,o)=>new Intl.DateTimeFormat(so(e()),o).format(s),change$:QT((t==null?void 0:t.subscribe.bind(t))??n,r)};return Object.freeze(i)}function bC(t={}){const e=eC(t);return{createPluginCatalogCell:(n,r)=>oC(e,n,r),registerPluginCatalogCell:n=>aC(e,n),unregisterPluginCatalogCell:n=>lC(e,n),clearPluginCatalogCells:()=>cC(e),loadInitialPluginCatalog:(n,r,i)=>uC(e,n,r,i),preparePluginCatalogGeneration:n=>fC(e,n),commitPluginCatalogGeneration:(n,r)=>hC(n,r),discardPluginCatalogGeneration:n=>pC(e,n),getActivePluginCatalogGeneration:()=>gC(e)}}const $o=bC(),gv=`${kd}:locale`,Mc={en:ov,ru:yT};uv(ov);function mv(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 _C(){return!1}function xd(){return av}function vv(t){const e=mv(t);return xd().find(n=>n===e)}function Rh(t){const e=mv(t);if(e!==void 0)return vv(e)??xd().find(n=>n===e.split("-")[0])}function wC(t){try{return(t==null?void 0:t.getItem(gv))??void 0}catch{return}}function yC(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function kC(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??db;let s=av[0],o=!1;const a=new Set,l=new Set,c=m=>{r.documentElement.lang=m,r.documentElement.dir="ltr"},u=m=>{s=m,i(m),c(m);for(const _ of a)_(m)};return Object.freeze({initLocale:()=>{const m=wC(n),k=(m===void 0?void 0:vv(m))??yC().map(Rh).find(O=>O!==void 0)??"en";return u(k),k},getLocale:()=>s,setLocale:async m=>{const _=Rh(m)??"en";if(_===s)return;o=!0;for(const O of l)O(!0);const k=e.preparePluginCatalogGeneration(_);await k.promise,e.commitPluginCatalogGeneration(k,()=>{u(_);try{n==null||n.setItem(gv,_)}catch{}}),o=!1;for(const O of l)O(!1)},subscribeLocale:m=>(a.add(m),()=>{a.delete(m)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:m=>(l.add(m),()=>{l.delete(m)}),hostT:(m,_,k=s)=>{const O=Mc[k]??Mc.en,I=Ah(O,m)??Ah(Mc.en,m)??m;return _===void 0?I:bm(I,_,k)},hostFormatNumber:(m,_)=>new Intl.NumberFormat(so(s),_).format(m),hostFormatDate:(m,_)=>new Intl.DateTimeFormat(so(s),_).format(m),getAvailableLocales:xd,isPseudoLocaleEnabled:_C})}const Uo=kC({catalog:$o}),EC=Uo,as=()=>Uo.getLocale(),Eu=t=>Uo.subscribeLocale(t),SC=t=>Uo.subscribeLocalePending(t),Rn=(t,e,n)=>Uo.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 bv=`${kd}:theme`,Su="dark";let Ur=Su;const xu=new Set;function xC(){try{const t=localStorage.getItem(bv);return t==="light"||t==="dark"?t:Su}catch{return Su}}function _v(t){document.documentElement.dataset.theme=t}function wv(t){for(const e of xu)e(t)}function TC(){return Ur=xC(),_v(Ur),wv(Ur),Ur}function Za(){return Ur}function CC(t){if(t!==Ur){Ur=t,_v(t);try{localStorage.setItem(bv,t)}catch{}wv(t)}}function Fi(){CC(Ur==="dark"?"light":"dark")}function yv(t){return xu.add(t),()=>{xu.delete(t)}}function Mh(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}const PC=["/","/login","/packages","/packages/services","/settings"],RC=new Set(PC);function kv(t){return RC.has(t)}const AC=de().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),MC=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),Ev=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},Td=de().min(1).refine(MC,{message:"must be a safe relative path"}),OC=Td.refine(Ev,{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{}},NC=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})`})}),zC=Td.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),IC=Ue({defaultLocale:NC,locales:gs(de(),zC)}).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"})}),Sv=de().regex(/^[a-z0-9][a-z0-9+_.-]*$/),xv=Kt(["session","public"]).default("session"),LC=de().transform(t=>t.toUpperCase()).pipe(Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"])),Tv=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"},Cv=Td.refine(Ev,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),DC=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"}),Pv=Ue({id:de().min(1),transport:Pt("http"),method:LC,path:de().refine(Tv,{message:"path must be canonical and safe"}),access:xv}),HC=Ue({id:de().min(1),transport:Pt("websocket"),path:de().refine(Tv,{message:"path must be canonical and safe"}),access:xv,protocols:vt(de().min(1)).optional()}),BC=Pv.extend({command:Cv}),Rv=(t,e)=>{const n=t.map(i=>i.id);new Set(n).size!==n.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate id"});const r=t.map(i=>i.transport==="http"?`${i.transport}:${i.method}:${i.path}`:`${i.transport}:${i.path}`);new Set(r).size!==r.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate route tuple"});for(const i of t)i.transport==="http"&&i.access==="public"&&!["GET","HEAD"].includes(i.method??"")&&e.addIssue({code:"custom",message:"public HTTP routes may only use GET or HEAD"})},$C=Ue({kind:Pt("exec"),packages:vt(Sv).optional(),routes:vt(BC).min(1)}).strict().superRefine((t,e)=>{Rv(t.routes,e)}),UC=Ue({kind:Pt("service"),protocolVersion:Vt().int().positive(),command:Cv,args:vt(DC).optional(),packages:vt(Sv).optional(),routes:vt($r([Pv,HC])).min(1)}).strict().superRefine((t,e)=>{Rv(t.routes,e)}),jC=$r([$C,UC]),Oh=Vt().int().positive().max(12),Nh=Vt().int().positive(),FC=Pt(1).describe("Manifest format version. Must be 1."),GC=AC.describe("Unique plugin id used as the on-disk folder and URL segment."),VC=de().min(1).describe("Semver-ish version string."),ZC=de().min(1).describe("Human-readable name shown in the dashboard or navigation."),WC=OC.describe("Relative path to the bundled entry module."),qC=de().optional().describe("Optional icon name."),XC=wm,YC=vt(XC).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"permissions contains duplicate permission"})}),JC=Ue({w:Oh,h:Nh,minW:Oh.optional(),minH:Nh.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"]}),KC=de().regex(/^\/[^/?#*]+$/).refine(t=>!kv(t),{message:"route is reserved by the host"}),Av={manifestVersion:FC,name:GC,version:VC,label:ZC,entry:WC,icon:qC,permissions:YC.optional(),i18n:IC.optional(),backend:jC.optional()},QC=Ue({...Av,type:Pt("widget"),size:JC,fixedHeight:xr().optional()}),eP=Ue({...Av,type:Pt("page"),route:KC}),tP=cd("type",[QC,eP]);class nP extends Error{constructor(n,r){const i=r.map(o=>({path:o.path.length===0?"<root>":o.path.join("."),message:o.message})),s=i.map(o=>`${o.path}: ${o.message}`).join("; ");super(`Invalid manifest for "${n}": ${s}`);G(this,"issues");this.issues=i}}function rP(t){const e=tP.safeParse(t);if(!e.success){const n=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new nP(n,e.error.issues)}return e.data}Ue({cid:de().optional(),mac:de().optional(),ip:de().optional(),fqdn:de().optional(),"fqdn-certificate-valid":xr().optional(),capabilities:gs(de(),lu()).optional()}).passthrough();const iP=[{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.5",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"}],Cd=()=>Object.fromEntries(iP.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),sP=Kt(["builtin","registry","upload"]),oP=Kt(["pending","approved"]),aP=Kt(["ready","installing","failed"]),lP=Kt(["stopped","capacity_blocked","starting","ready","backoff","failed"]),cP=Ue({kind:Kt(["exec","service"]),packages:vt(de()).optional(),args:vt(de()).optional(),publicRoutes:vt(de()).optional()}),uP=gs(de(),xr()).superRefine((t,e)=>{for(const n of Object.keys(t))ES(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI permissions may be granted"})}),dP=Ue({transport:Kt(["http","websocket"]),path:de(),method:Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:vt(de()).optional()}),fP=Ue({routes:gs(de(),dP)}),hP=Ue({w:Vt(),h:Vt(),minW:Vt().optional(),minH:Vt().optional()}),pP=Ue({defaultLocale:de(),locales:gs(de(),de())}),gP=Ue({state:lP,restartCount:Vt(),consecutiveFailures:Vt(),startedAt:de().optional(),nextAttemptAt:de().optional(),lastExit:de().optional(),lastError:de().optional(),recentStderr:vt(de()).optional(),requiredProtocol:Vt().optional(),compatible:xr().optional(),supportedProtocols:vt(Vt()).optional()}),mP=Ue({sdkVersion:de(),sharedDependencies:gs(de(),de())}),Mv={name:de(),version:de(),label:de(),entry:de(),icon:de().optional(),source:sP,approval:oP,enabled:xr(),permissions:vt(wm).optional(),permissionGrants:uP.optional(),depsStatus:aP,backend:fP,review:cP.optional(),i18n:pP.optional(),catalogBaseUrl:de().optional(),runtime:gP.optional(),lock:mP.optional()},vP=Ue({...Mv,type:Pt("widget"),size:hP,fixedHeight:xr().optional()}),bP=Ue({...Mv,type:Pt("page"),route:de()}),Ov=cd("type",[vP,bP]),_P=Ue({plugins:vt(Ov)}),Nv=t=>_P.parse(t).plugins,Oc=t=>Ov.parse(t),Wa=new rs;function jo(t){return Wa.get(t)??"ready"}function zh(t){Wa.clear();for(const e of t)Wa.set(e.name,e.depsStatus)}let ra=null,Ih;function wP(){clearTimeout(Ih),Ih=void 0,ra==null||ra.abort(),ra=null}const me=it({authenticated:!1,ready:!1,hostInfo:null,deviceInfo:null,pluginLoadError:null,mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:Za(),locale:as(),localeSwitchPending:!1});function Nc(){bl().matches?me.mobileSidebarOpen=!me.mobileSidebarOpen:me.desktopSidebarCollapsed=!me.desktopSidebarCollapsed}function Pd(){wP(),me.authenticated=!1,me.ready=!1,me.hostInfo=null,me.deviceInfo=null}yv(t=>{me.theme=t});Eu(t=>{me.locale=t});SC(t=>{me.localeSwitchPending=t});function w(t,e){return Rn(t,e,me.locale)}var yP=z('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),kP=z('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">&times;</button>'),EP=z('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),SP=z('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),xP=z('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function TP(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=xP(),l=v(a);{var c=p=>{var g=EP(),m=v(g);{var _=I=>{var R=yP(),A=v(R);y(()=>{Ae(R,"id",r),S(A,e.layer.shell.title)}),C(I,R)};Z(m,I=>{var R;(R=e.layer.shell)!=null&&R.title&&I(_)})}var k=x(m,2);{var O=I=>{var R=kP();y(A=>Ae(R,"aria-label",A),[()=>w("common.close")]),pe("click",R,()=>e.layer.close(void 0,"action")),C(I,R)};Z(k,I=>{var R;(R=e.layer.shell)!=null&&R.showCloseButton&&I(O)})}C(p,g)};Z(l,p=>{var g,m;((g=e.layer.shell)!=null&&g.title||(m=e.layer.shell)!=null&&m.showCloseButton)&&p(c)})}var u=x(l,2);{var d=p=>{var g=SP(),m=v(g);y(()=>{Ae(g,"id",i),S(m,e.layer.shell.description)}),C(p,g)};Z(u,p=>{var g;(g=e.layer.shell)!=null&&g.description&&p(d)})}var h=x(u,2);Qr(h,(p,g)=>s==null?void 0:s(p,g),()=>e.layer.contentElement),y(()=>{var p,g;Ne(a,1,`mndw-overlay-dialog mndw-overlay-dialog--${e.layer.kind??""} mndw-overlay-dialog--${e.layer.placement??""} ${e.layer.mobileSheet?"mndw-overlay-dialog--sheet":""} ${e.layer.className??""??""}`,"svelte-1ervcvh"),Ae(a,"data-locale",me.locale),Ae(a,"aria-modal",e.layer.kind==="modal"?"true":void 0),Ae(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Ae(a,"aria-describedby",(g=e.layer.shell)!=null&&g.description?i:void 0),to(a,f(o))}),C(t,a),Le()}at(["click"]);const CP=1e4;function PP(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 wo,yo,ko,Eo,So,xo;class Lh{constructor(e,n,r,i,s){G(this,"id");G(this,"pluginName");G(this,"instanceId");G(this,"kind");G(this,"hostElement");G(this,"contentElement");be(this,wo,Y("opening"));be(this,yo,Y(null));be(this,ko,Y("center"));G(this,"mobileSheet");be(this,Eo,Y(void 0));be(this,So,Y(it({})));be(this,xo,Y(null));G(this,"behavior");G(this,"closeOnEscape");G(this,"closeOnOutsideClick");G(this,"trapFocus");G(this,"restoreFocus");G(this,"lockScroll");G(this,"backdrop");G(this,"closed");G(this,"abortController",new AbortController);G(this,"anchorElement");G(this,"cleanup",null);G(this,"onCloseListeners",new Set);G(this,"previousFocus");G(this,"closedResolve");G(this,"openTimeout");G(this,"focusTrap",null);G(this,"repositionHandler",null);G(this,"anchorObserver",null);G(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=PP(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=fb(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")},CP),this.attachAnchorObservers()}get state(){return f(E(this,wo))}set state(e){b(E(this,wo),e,!0)}get shell(){return f(E(this,yo))}set shell(e){b(E(this,yo),e,!0)}get placement(){return f(E(this,ko))}set placement(e){b(E(this,ko),e,!0)}get className(){return f(E(this,Eo))}set className(e){b(E(this,Eo),e,!0)}get sizing(){return f(E(this,So))}set sizing(e){b(E(this,So),e,!0)}get position(){return f(E(this,xo))}set position(e){b(E(this,xo),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=hb({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:()=>gb(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&pb(n.hostElement,e))}))}}wo=new WeakMap,yo=new WeakMap,ko=new WeakMap,Eo=new WeakMap,So=new WeakMap,xo=new WeakMap;var To;class RP{constructor(){be(this,To,Y(it([])))}get layers(){return f(E(this,To))}set layers(e){b(E(this,To),e,!0)}}To=new WeakMap;function AP(){const t=new RP;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 zv=AP(),MP=zv;function Rd(t,e,n=zv){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 _=h(m.contentElement,m,m.signal);_ instanceof Promise?_.then(()=>m.markReady()).catch(k=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,k),m.closeWithReason("mount-failed")}):m.markReady()}catch(_){console.error(`[mndw] Overlay mount for "${t}" failed:`,_),m.closeWithReason("mount-failed")}return m},closeAll(){for(const l of s())l.close(void 0,"api")}};function a(l="plugin-unmount"){if(!r){r=!0;for(const c of s())c.closeWithReason(l)}}return{service:o,dispose:a}}var OP=z('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),NP=z("<div><!> <div></div></div>");function zP(t,e){Ie(e,!0);let n=Yt(e,"runtime",3,MP);const r=1e3,i=fe(()=>n().store.layers);function s(p){return r+p}function o(p){return p.kind==="modal"||p.kind==="drawer"}function a(p){return p.kind==="popover"?p.position?`position:absolute;top:${p.position.top}px;left:${p.position.left}px`:"position:absolute;visibility:hidden":""}function l(p,g){p.appendChild(g.hostElement),g.kind==="drawer"&&g.placement==="bottom"&&(g.hostElement.style.display="flex",g.hostElement.style.flexDirection="column",g.hostElement.style.justifyContent="flex-end",g.hostElement.style.width="100%",g.hostElement.style.height="100%",g.hostElement.style.minHeight="0");let m;return g.shell&&(m=vl(TP,{target:g.hostElement,props:{layer:g}})),requestAnimationFrame(()=>{g.state!=="closed"&&g.reposition()}),{destroy(){m&&qu(m),g.hostElement.remove()}}}function c(p){if(p.key==="Escape"){for(let g=f(i).length-1;g>=0;g--)if(f(i)[g].closeOnEscape){f(i)[g].closeWithReason("escape"),p.stopPropagation();return}}}function u(p){const g=p.composedPath();for(let m=f(i).length-1;m>=0;m--){const _=f(i)[m];if(g.includes(_.hostElement)||_.anchorElement&&g.includes(_.anchorElement))return;if(_.closeOnOutsideClick){_.closeWithReason("outside-click");return}if(o(_))return}}hn(()=>{const p=f(i).some(m=>m.lockScroll),g=document.body.style.overflow;return p&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=g}});var d=kn();ut("keydown",Qs,c),ut("pointerdown",Qs,u);var h=Xe(d);ft(h,19,()=>f(i),p=>p.id,(p,g,m)=>{var _=NP();let k;var O=v(_);{var I=T=>{var M=OP();C(T,M)},R=fe(()=>o(f(g))&&f(g).backdrop);Z(O,T=>{f(R)&&T(I)})}var A=x(O,2);Qr(A,(T,M)=>l==null?void 0:l(T,M),()=>f(g)),y((T,M)=>{Ne(_,1,`mndw-overlay-layer mndw-overlay-layer--${f(g).kind??""}`,"svelte-11o3k6p"),k=to(_,"",k,T),Ne(A,1,`mndw-overlay-positioner mndw-overlay-positioner--${f(g).kind??""} mndw-overlay-positioner--${f(g).placement??""} ${f(g).mobileSheet?"mndw-overlay-positioner--sheet":""}`,"svelte-11o3k6p"),to(A,M)},[()=>({"z-index":s(f(m))}),()=>a(f(g))]),C(p,_)}),C(t,d),Le()}const IP={success:4e3,info:4e3,error:0},LP=4,DP=.35,HP=.5;function BP(t,e,n){return e<=0?!1:Math.abs(t)>=e*DP||Math.abs(n)>=HP}var Co;class $P{constructor(){be(this,Co,Y(it([])));G(this,"nextId",1);G(this,"maxToasts",LP);G(this,"timers",new rs)}get toasts(){return f(E(this,Co))}set toasts(e){b(E(this,Co),e,!0)}show(e){const n=e.variant??"info",r=e.duration??IP[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))}}Co=new WeakMap;const oi=new $P;var UP=z('<div><span class="mndw-toast__body svelte-1g105wt"> </span> <button type="button" class="mndw-toast__dismiss svelte-1g105wt"><mndw-icon></mndw-icon></button></div>',2),jP=z('<div role="region"></div>');function FP(t,e){Ie(e,!0);let n=Yt(e,"store",3,oi);const r=bl();let i=Y(it(r.matches));const s=d=>{b(i,d.matches,!0),n().setMaxToasts(d.matches?3:4)};function o(d){return d==="error"?"danger":d}function a(d,h){let p=h,g=null,m=0,_=0,k=!1;const O=T=>{d.style.transition="transform 0.15s ease, opacity 0.15s ease",d.style.transform="",d.style.opacity=""},I=T=>{!p.enabled||T.pointerType==="mouse"||g!==null||(g=T.pointerId,m=T.clientX,_=T.timeStamp,k=!0,d.style.transition="",d.setPointerCapture(T.pointerId))},R=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m;d.style.transform=`translateX(${M}px)`,d.style.opacity=String(Math.max(.3,1-Math.abs(M)/d.offsetWidth))},A=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m,N=Math.max(1,T.timeStamp-_),j=M/N;k=!1,g=null,BP(M,d.offsetWidth,j)?p.onDismiss():O()};return d.style.touchAction="pan-y",d.addEventListener("pointerdown",I),d.addEventListener("pointermove",R),d.addEventListener("pointerup",A),d.addEventListener("pointercancel",A),{update(T){p=T},destroy(){d.removeEventListener("pointerdown",I),d.removeEventListener("pointermove",R),d.removeEventListener("pointerup",A),d.removeEventListener("pointercancel",A)}}}zn(()=>(n().setMaxToasts(f(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var l=kn(),c=Xe(l);{var u=d=>{var h=jP();let p;ft(h,21,()=>n().toasts,g=>g.id,(g,m)=>{var _=UP(),k=v(_),O=v(k),I=x(k,2),R=v(I);P(R,"name","x"),Qr(_,(A,T)=>a==null?void 0:a(A,T),()=>({enabled:f(i),onDismiss:()=>n().dismiss(f(m).id)})),y((A,T)=>{Ne(_,1,`mndw-toast mndw-alert mndw-alert--${A??""}`,"svelte-1g105wt"),Ae(_,"role",f(m).variant==="error"?"alert":"status"),Ae(_,"aria-live",f(m).variant==="error"?"assertive":"polite"),S(O,f(m).message),Ae(I,"aria-label",T)},[()=>o(f(m).variant),()=>w("toast.dismiss")]),pe("click",I,()=>n().dismiss(f(m).id)),C(g,_)}),y(g=>{p=Ne(h,1,"mndw-toast-host svelte-1g105wt",null,p,{"mndw-toast-host--mobile":f(i)}),Ae(h,"aria-label",g)},[()=>w("toast.region")]),C(d,h)};Z(c,d=>{n().toasts.length>0&&d(u)})}C(t,l),Le()}at(["click"]);class Cu extends Error{constructor(n,r,i){super(r,i);G(this,"code");this.name="PageRouteError",this.code=n}}const GP=["execute","queue","initBackgroundProcess","queueBackgroundProcess"],VP={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"}},Ad="0.1.5",ZP=1;function WP(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!==ZP)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!WP(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function Fs(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=Fs(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function XP(t,e=Cd(),n=Ad){const r=[],i=Fs(t.sdkVersion),s=Fs(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=Fs(c),h=Fs(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 YP(t,e=Cd(),n=Ad){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 JP(t,e,n=Cd(),r=Ad){const i=YP(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 KP{constructor(e={catalog:$o}){G(this,"plugins",new Map);G(this,"catalog");this.catalog=e.catalog}register(e){if(this.plugins.has(e.entry.name))throw new Error(`Duplicate plugin name "${e.entry.name}"`);this.plugins.set(e.entry.name,e),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog)}replace(e){const n=this.plugins.get(e.entry.name);if(n===void 0)throw new Error(`Cannot replace unknown plugin "${e.entry.name}"`);if(n.entry.type!==e.entry.type)throw new Error(`Cannot change plugin "${e.entry.name}" type from ${n.entry.type} to ${e.entry.type}`);if(n.entry.type==="page"&&e.entry.type==="page"&&n.entry.route!==e.entry.route)throw new Error(`Cannot change page "${e.entry.name}" route from ${n.entry.route} to ${e.entry.route}`);return this.plugins.set(e.entry.name,e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog),n}get(e){return this.plugins.get(e)}getWidgets(){return[...this.plugins.values()].filter(e=>e.entry.type==="widget")}getPages(){return[...this.plugins.values()].filter(e=>e.entry.type==="page")}getAll(){return[...this.plugins.values()]}clear(){for(const e of this.plugins.values())e.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(e.catalog);this.plugins.clear(),this.catalog.clearPluginCatalogCells()}}const _s=new KP,ao=it({});function QP(){for(const t of Object.keys(ao))delete ao[t]}function eR(t,e){if(e.length===0){delete ao[t];return}ao[t]=[...e]}function tR(t){return ao[t]??[]}const nR=15e3,zc=new Set;function rR(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}async function iR(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 sR(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function oR(){const t=await fetch(cv);if(!t.ok)throw new Error(`HTTP ${t.status}`);return Nv(await t.json())}async function aR(t,e){const n=await qP(e);return n?JP(t.name,n):[]}function lR(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 cR(t,e,n){const i=`${t.source==="builtin"?Ch.builtin:Ch.user}${t.name}`,s=o=>rR(i,o,t.version);await e.loadStylesheet(s("index.css"),t.name);try{const o=await e.importModule(s(t.entry)),a=sR(o,t.name),l=pv(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=>{eR(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 uR(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([cR(t,e,n.signal),r])}finally{clearTimeout(i)}}async function dR(t={}){const e=t.fetchList??oR,n={importModule:t.importModule??(s=>import(s)),loadStylesheet:t.loadStylesheet??iR,checkVersions:t.checkVersions??aR,catalogService:t.catalogService??$o,registry:t.registry??_s,getLocale:t.getLocale??as,loadTimeoutMs:t.loadTimeoutMs??nR};n.registry.clear(),zh([]),me.pluginLoadError=null,QP();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=lR(r.filter(s=>s.enabled&&s.approval==="approved"));await Promise.all(i.map(s=>uR(s,n)))}const fR=Ue({id:de(),label:de(),index:Vt().finite().int().nonnegative(),type:de(),group:de(),color:de(),interfaceId:de()}),hR=Ue({list:vt(fR),layout:vt(vt(de())),hasPortStats:xr()}),pR=Ue({switchports:hR,usbPortCount:Vt().finite().int().nonnegative()});function Pu(){return{list:[],layout:[],hasPortStats:!1}}function gR(t){return pR.parse(t)}const Xt=Object.freeze({"X-Mndw-Csrf":"1"}),sn=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),_r=t=>typeof t=="string"&&t.length>0,Ll=async t=>{try{return await t.json()}catch{return}};function Dl(t,e){const n=sn(t)?t:void 0,r=n==null?void 0:n.error,i=sn(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:_r(s)?s:"UNKNOWN",message:_r(o)?o:e,detail:i==null?void 0:i.detail}}class Gi extends Error{constructor(n,r,i){super(n);G(this,"code");G(this,"detail");this.name="MgmtError",this.code=r,this.detail=i}}function mR(t){switch(t){case"read":return lv;case"mutation":return kT;case"install":return ET}}async function zr(t){const e=Dl(await Ll(t),t.statusText);return new Gi(e.message,e.code,e.detail)}function vR(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof Gi&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function bR(t=globalThis.fetch,e=n=>AbortSignal.timeout(mR(n))){function n(o){return e(o)}async function r(o){if(o.status!==204)throw o.ok?new Gi("The device returned an unexpected response.","UNKNOWN"):await zr(o)}async function i(o,a,l){const c=await t(o,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:a}),signal:n(l)});if(!c.ok)throw await zr(c);return c}async function s(o,a){const l=await i(o,a,o===xh?"install":"mutation");return Oc(await l.json())}return{async listPlugins(){const o=await t(cv,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return Nv(await o.json())},async uploadPlugin(o){const a=await t(xT,{method:"POST",headers:{"Content-Type":"application/zip",...Xt},body:o});if(a.status===201||a.status===202){const l=Oc(await a.json());return{status:a.status===201?"installed":"pending",entry:l}}throw await zr(a)},approvePlugin:o=>s(xh,o),enablePlugin:o=>s(CT,o),disablePlugin:o=>s(PT,o),async setPluginPermission(o,a,l){const c=await t(ST,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:o,permission:a,enabled:l}),signal:n("mutation")});if(!c.ok)throw await zr(c);return Oc(await c.json())},async denyPlugin(o){await i(TT,o,"mutation")},async deletePlugin(o){await i(RT,o,"mutation")},async restartPlugin(o){await i(AT,o,"mutation")},async getRuntime(){const o=await t(MT,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return await o.json()},async getDeviceHardware(){try{const o=await t(OT,{method:"GET",signal:n("read")});return o.ok?gR(await o.json()):{switchports:Pu(),usbPortCount:0}}catch{return{switchports:Pu(),usbPortCount:0}}},async getPalette(){const o=await t(Pc,{method:"GET",cache:"no-store",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json().catch(()=>null);if(a===null||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,"palette"))throw new Gi("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(o){const a=await t(Pc,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(o),signal:n("mutation")});await r(a)},async deletePalette(){const o=await t(Pc,{method:"DELETE",headers:{...Xt},signal:n("mutation")});await r(o)},async getTelemetry(){const o=await t(Th,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json();if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new Gi("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(o){const a=await t(Th,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:o}),signal:n("mutation")});await r(a)}}}const Md=bR(),Dh={INVALID_ZIP:"errors.invalid-zip",MANIFEST_MISSING:"errors.manifest-missing",UNSUPPORTED_MANIFEST_VERSION:"errors.unsupported-manifest-version",CONFLICT:"errors.conflict",UPLOAD_TOO_LARGE:"errors.upload-too-large",OPKG_FAILED:"errors.opkg-failed",DAEMON_FAILED:"errors.daemon-failed",UNAUTHORIZED:"errors.unauthorized",SERVICE_CAPACITY_EXCEEDED:"errors.service-capacity",BACKEND_BUSY:"errors.backend-busy",BACKEND_UNAVAILABLE:"errors.backend-unavailable",BACKEND_INCOMPATIBLE:"errors.backend-incompatible",BACKEND_MAINTENANCE:"errors.backend-maintenance",CONTROLLER_SESSION_UNAVAILABLE:"errors.controller-session-unavailable",RCI_SOCKET_START_FAILED:"errors.rci-socket-start-failed"};function sr(t){return t instanceof DOMException&&t.name==="TimeoutError"?Rn("errors.device-timeout"):t instanceof Gi?t.code==="MANIFEST_INVALID"?_r(t.detail)?`${Rn("errors.invalid-manifest")}: ${t.detail}`:Rn("errors.invalid-manifest"):(Dh[t.code]===void 0?t.message:Rn(Dh[t.code]))||Rn("app.error"):t instanceof Error?t.message:Rn("app.error")}const Ru="mndw-palette-override",_R=":root:root";function wR(t){const e=t.getElementById(Ru);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=Ru,t.head.appendChild(n),n}function As(t,e){var n;if(e===null){(n=t.getElementById(Ru))==null||n.remove();return}wR(t).textContent=TS(e,{selector:_R})}function Oi(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function yR(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function kR(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>Oi(n??VP),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=nv(l);if(d.palette===null)throw new Error("The device returned an invalid palette.");c=d.palette}const u=yR(n,c);n=c,As(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);As(e,l);for(const c of r)c(Oi(l))},discardPreview:()=>{As(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=Oi(a),As(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,As(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}const Od=kR({mgmtClient:Md}),Hh=()=>Od.getTokens(),ER=t=>Od.subscribePalette(t),SR=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"],xR=globalThis.fetch.bind(globalThis);async function Gs(t,e={},n=2e4){const r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),n);try{return await xR(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(i)}}class Qn extends Error{constructor(n,r){super(n);G(this,"code");G(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const ia="/api/mndw/rci-session",TR=["offline","establishing","live","dead"],CR=["certificate-invalid","no-auth-token","missing-fqdn"],PR=["token","none","unknown"],RR=["supported","invalid","unsupported","unknown","needs-token"],AR=["ok","empty","disabled","decrypt-failed"];class MR{async getCapability(){const e=await this.read(await Gs(`${ia}/capability`,{headers:{...Xt}}));return this.parseCapability(e)}async testController(e){return await this.read(await this.post("/controller/test",{token:e}))}async saveController(e){return await this.read(await this.post("/controller",{token:e}))}async clearController(){await this.read(await Gs(`${ia}/controller`,{method:"DELETE",headers:{...Xt}}))}async setEnabled(e){await this.read(await Gs(`${ia}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:e})}))}async post(e,n){return await Gs(`${ia}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(n)})}async read(e){const n=await e.text();let r;try{r=n===""?void 0:JSON.parse(n)}catch{throw new Qn("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Qn(i,e.status)}return r}parseCapability(e){if(!this.isRecord(e)||!this.isRecord(e.store)||!this.isRecord(e.controller)||!Array.isArray(e.extenders)||typeof e.stale!="boolean"||!this.isStoreState(e.store.state)||!this.isSupport(e.controller.support)||!this.isAuthMode(e.controller.auth)||typeof e.controller.enabled!="boolean")throw new Qn("MALFORMED_RESPONSE",200);const n={support:e.controller.support,auth:e.controller.auth,enabled:e.controller.enabled};if(e.controller.lastCheckedAt!==void 0){if(typeof e.controller.lastCheckedAt!="string")throw new Qn("MALFORMED_RESPONSE",200);n.lastCheckedAt=e.controller.lastCheckedAt}const r=e.extenders.map(s=>this.parseExtender(s)),i={store:{state:e.store.state},controller:n,extenders:r,stale:e.stale};if(e.lastEnumerationError!==void 0){if(!this.isFailureCategory(e.lastEnumerationError))throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationErrorAt=e.lastEnumerationErrorAt}return i}parseExtender(e){if(!this.isRecord(e)||typeof e.identity!="string"||typeof e.name!="string"||typeof e.eligible!="boolean")throw new Qn("MALFORMED_RESPONSE",200);if(!e.eligible){if(!this.isEligibilityReason(e.reason)||e.state!==void 0||e.lastError!==void 0||e.lastHeartbeatAt!==void 0)throw new Qn("MALFORMED_RESPONSE",200);return{identity:e.identity,name:e.name,eligible:!1,reason:e.reason}}if(e.reason!==void 0||e.state!==void 0&&!this.isSessionState(e.state)||e.lastError!==void 0&&!this.isFailureCategory(e.lastError)||e.lastHeartbeatAt!==void 0&&typeof e.lastHeartbeatAt!="string")throw new Qn("MALFORMED_RESPONSE",200);const n={identity:e.identity,name:e.name,eligible:!0};return e.state!==void 0&&(n.state=e.state),e.lastError!==void 0&&(n.lastError=e.lastError),e.lastHeartbeatAt!==void 0&&(n.lastHeartbeatAt=e.lastHeartbeatAt),n}errorCode(e){if(this.isRecord(e)&&this.isRecord(e.error)&&typeof e.error.code=="string")return e.error.code}isRecord(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}isStoreState(e){return typeof e=="string"&&AR.includes(e)}isSupport(e){return typeof e=="string"&&RR.includes(e)}isAuthMode(e){return typeof e=="string"&&PR.includes(e)}isSessionState(e){return typeof e=="string"&&TR.includes(e)}isEligibilityReason(e){return typeof e=="string"&&CR.includes(e)}isFailureCategory(e){return typeof e=="string"&&SR.includes(e)}}function OR(){return new MR}const NR=OR(),zR=3e4,IR={path:"show.system"};class LR{constructor(){G(this,"transport");G(this,"heartbeatSubscription",null);G(this,"driver");G(this,"auth");const e=window.location.origin;this.transport=new Tb,this.auth=new Cb(e,this.transport),this.driver=new Pb(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=bb(0,zR).pipe(_b(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(IR).pipe(wb(()=>yb))}}const Nd=new LR,{service:DR}=Rd("@mndw/ui","@mndw/ui"),HR=DR;function BR(t=globalThis.fetch){return eT(t)}const $R=BR(),UR=500,jR=5e3,Bh=.2,FR=100,GR=1024,VR=2048,ZR=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),WR=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),qR=(t,e)=>{if(t==="*"||t===e||t.startsWith(`${e}.`))return t;if(e==="*"||e.startsWith(`${t}.`))return e},XR=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=qR(r,i);s!==void 0&&n.add(s)}return[...n]},YR=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]},JR=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0;class KR{constructor(e={}){G(this,"socketFactory");G(this,"schedule");G(this,"cancelSchedule");G(this,"random");G(this,"diagnostic");G(this,"registrations",new Map);G(this,"deliveredIds",new Set);G(this,"deliveredOrder",[]);G(this,"liveBuffer",[]);G(this,"socket");G(this,"reconnectTimer");G(this,"reconnectAttempt",0);G(this,"nextHandlerId",1);G(this,"lastSeenId","");G(this,"replayCursor","");G(this,"catchingUp",!1);G(this,"replaying",!1);G(this,"closing",!1);this.socketFactory=e.WebSocket??(typeof WebSocket>"u"?void 0:WebSocket),this.schedule=e.setTimeout??globalThis.setTimeout,this.cancelSchedule=e.clearTimeout??globalThis.clearTimeout,this.random=e.random??Math.random,this.diagnostic=e.diagnostic??((n,r)=>console.warn(`[mndw] ${n}`,r))}createFacade(e,n,r,i){const s=YR(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 ka(a=>{const l=this.registrations.get(e);if(l===void 0){a.complete();return}const c=XR(ZR(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 ka(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=JR(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>=GR){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>VR;){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=>WR(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:FR}))}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(jR,UR*2**this.reconnectAttempt++),n=1-Bh+this.random()*2*Bh;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 QR(t={}){return new KR(t)}const eA=Object.freeze({mgmtClient:Md,palette:Od,catalog:$o,locale:EC,registry:_s,persistentRci:NR,rci:Nd,telemetry:$R,eventStream:QR(),overlay:HR});function lo(){return eA}const Au="mndw:sandbox-reloaded";function tA(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function nA(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 rA(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:nA(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 Iv(t){if(t.importPluginModule===void 0||t.importManifestModule===void 0)throw new Error("Sandbox imports were not provided");const e=tA(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=rP(n.default),i=t.catalogBaseUrl??n.__catalogBaseUrl,s=rA(r,i),o=t.catalogService??$o,a=t.getLocale??as,l=pv(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 iA(t={}){const e=t.registry??_s;try{const n=await Iv(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 sA(t={}){const e=t.registry??_s,n=t.remountWidgets??oA,r=t.reloadPage??aA,i=t.pluginContextServices??(()=>{const c=lo();return{locale:c.locale,palette:c.palette,telemetry:c.telemetry,eventStream:c.eventStream}})();let s;try{s=await Iv(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 oA(t,e,n,r,i){const{remountWidgetTiles:s}=await Ma(async()=>{const{remountWidgetTiles:o}=await Promise.resolve().then(()=>ZA);return{remountWidgetTiles:o}},[]);return s(i,r,t,e,n)}async function aA(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(Au,{detail:i})),(await Promise.all(r)).every(Boolean)}const Lv={importPluginModule:()=>Ma(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>Ma(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function sa(){return{received:!1,value:void 0}}function lA(t,e){let n=sa(),r=sa(),i=!1,s=Promise.resolve();const o=()=>{i||(i=!0,queueMicrotask(()=>{i=!1;const a=n,l=r;n=sa(),r=sa();const c={importPluginModule:a.received?()=>Promise.resolve(a.value):e.importPluginModule,importManifestModule:l.received?()=>Promise.resolve(l.value):e.importManifestModule};s=s.then(()=>sA({...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 cA(t,e=void 0,n=Lv){if(e===void 0)return;const r=lA(t,n);e.accept("virtual:sandbox-plugin",i=>{r.plugin(i)}),e.accept("virtual:sandbox-manifest",i=>{r.manifest(i)})}class D{static getElements(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(r&&!isNaN(+e[0])){const s=r.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(!e.length)return null;if(r&&e[0]==="#")return r.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(r&&!isNaN(+e[0]))return r.getElementById(e);let i=n.querySelector(e);return r&&!i&&(i=r.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){var n,r;return e.lazyLoad||((r=(n=e.grid)==null?void 0:n.opts)==null?void 0:r.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,n){const r=document.createElement("div");return e.forEach(i=>{i&&r.classList.add(i)}),n==null||n.appendChild(r),r}static shouldSizeToContent(e,n=!1){return(e==null?void 0:e.grid)&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return D.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const r=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=r)return 0;const s=e.y>n.y?e.y:n.y,o=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return o<=s?0:(i-r)*(o-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const o=n*((i.y??1e4)-(s.y??1e4));return o===0?n*((i.x??1e4)-(s.x??1e4)):o})}static find(e,n){return n?e.find(r=>r.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,r="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);r=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:r}}static defaults(e,...n){return n.forEach(r=>{for(const i in r){if(!r.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=r[i]:typeof r[i]=="object"&&typeof e[i]=="object"&&D.defaults(e[i],r[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static copyPos(e,n,r=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),r&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let r in e){const i=e[r],s=n[r];r[0]==="_"||i===s?delete e[r]:i&&typeof i=="object"&&s!==void 0&&(D.removeInternalAndSame(i,s),Object.keys(i).length||delete e[r])}}static removeInternalForSave(e,n=!0){for(let r in e)(r[0]==="_"||e[r]===null||e[r]===void 0)&&delete e[r];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let r=!1;return(...i)=>{r||(r=!0,setTimeout(()=>{e(...i),r=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e).overflowY;return(n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight?e:D.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=D.getScrollElement(n),s=i.clientHeight,o=i===D.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-o,l=a<r,c=a>s-r;l?i.scrollBy({behavior:"smooth",top:a-r}):c&&i.scrollBy({behavior:"smooth",top:r-(s-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],r=D.clone(e);for(const i in r)r.hasOwnProperty(i)&&typeof r[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(r[i]=D.cloneDeep(e[i]));return r}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let r;typeof n=="string"?r=D.getElement(n):r=n,r&&r.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const r in n)n.hasOwnProperty(r)&&(Array.isArray(n[r])?n[r].forEach(i=>{e.style[r]=i}):e.style[r]=n[r])}static initEvent(e,n){const r={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>r[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>r[s]=e[s]),{...r,...i}}static simulateMouseEvent(e,n,r){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(r||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");D.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const r=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/r.width,yScale:1/r.height,xOffset:r.left,yOffset:r.top}}static swap(e,n,r){if(!e)return;const i=e[n];e[n]=e[r],e[r]=i}static canBeRotated(e){var n;return!(!e||e.w===e.h||e.locked||e.noResize||(n=e.grid)!=null&&n.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class vr{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,r,i={}){if(this.sortNodes(-1),r=r||this.collide(e,n),!r)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,r))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},r=this.collide(e,s,i.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;r=r||this.collide(e,s,i.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(r.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(r,{...r,y:e.y},e)||!this.collide(r,{...r,y:n.y-r.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:r.y+r.h,...a};c=this._loading&&D.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?D.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,D.copyPos(e,n)),o=o||c}else c=this.moveNode(r,{...r,y:n.y+n.h,skip:e,...a});if(!c)return o;r=void 0}return o}collide(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.find(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}collideAll(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.filter(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}directionCollideCoverage(e,n,r){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let o,a=.5;for(let l of r){if(l.locked||!l._rect)break;const c=l._rect;let u=Number.MAX_VALUE,d=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?d=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(d=(c.x+c.w-s.x)/c.w);const h=Math.min(d,u);h>a&&(a=h,o=l)}return n.collide=o,o}cacheRects(e,n,r,i,s,o){return this.nodes.forEach(a=>a._rect={y:a.y*n+r,x:a.x*e+o,w:a.w*e-o-i,h:a.h*n-r-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function r(){const s=n.x,o=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=o):(e.x=s,e.y=o),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=D.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=D.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return r()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=D.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return r()}return!1}}}isAreaEmpty(e,n,r,i){const s={x:e||0,y:n||0,w:r||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const r=this.batchMode;r||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),i||delete this._inColumnResize,r||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=D.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const r=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:r,w:e.w,h:e.h})))break;e._dirty=e.y!==r,e.y=r}}),this)}prepareNode(e,n){e._id=e._id??vr._idSeq++;const r=e.id;if(r){let s=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=r+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return D.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,D.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const r=e._orig||D.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),D.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!D.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=D.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||D.samePos(e,e._orig)||(D.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,r=this.column,i){const s=i?i.y*r+(i.x+i.w):0;let o=!1;for(let a=s;!o;++a){const l=a%r,c=Math.floor(a/r);if(l+e.w>r)continue;const u={x:l,y:c,w:e.w,h:e.h};n.find(d=>D.isIntercepted(u,d))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,n=!1,r){const i=this.nodes.find(o=>o._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,r)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,r=!1){return this.nodes.find(i=>i._id===e._id)?(r&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const r=this.nodes;return this.removedNodes=n?r:[],this.nodes=[],this._notify(r)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let r;const i=new vr({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(r={...o},r):{...o})});if(!r)return!1;const s=i.moveNode(r,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const o=n.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return s?(i.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(D.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vr({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),r={...e};return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,n.addNode(r),n.getRow()<=this.maxRow?(e._willFitPos=D.copyPos({},r),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){var c,u;if(!e||!n)return!1;let r;n.pack===void 0&&!this.batchMode&&(r=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=D.copyPos({},e,!0);if(D.copyPos(s,n),this.nodeBoundFix(s,i),D.copyPos(n,s),!n.forceCollide&&D.samePos(e,n))return!1;const o=D.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const d=e._moving&&!n.nested;let h=d?this.directionCollideCoverage(e,n,a):a[0];if(d&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=D.areaIntercept(n.rect,h._rect),g=D.area(n.rect),m=D.area(h._rect);p/(g<m?g:m)>.8&&(h.grid.makeSubGrid(h.el,void 0,e),h=void 0)}h?l=!this._fixCollisions(e,s,h,n):(l=!1,r&&delete n.pack)}return l&&!D.samePos(e,s)&&(e._dirty=!0,D.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!D.samePos(e,o)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,r){var a;const i=((a=this._layouts)==null?void 0:a.length)||0;let s;i&&(r?r!==this.column&&(s=this._layouts[r]):this.column!==i-1&&(s=this._layouts[i-1]));const o=[];return this.sortNodes(),this.nodes.forEach(l=>{const c=s==null?void 0:s.find(d=>d._id===l._id),u={...l,...c||{}};D.removeInternalForSave(u,!e),n&&n(l,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,r)=>{if(!n||r===this.column)return this;if(r<this.column)this._layouts[r]=void 0;else{const i=r/this.column;e.forEach(s=>{if(!s._orig)return;const o=n.find(a=>a._id===s._id);o&&(o.y>=0&&s.y!==s._orig.y&&(o.y+=s.y-s._orig.y,o.y<0&&(o.y=0)),s.x!==s._orig.x&&(o.x=Math.round(s.x*i),o.x<0&&(o.x=0)),s.w!==s._orig.w&&(o.w=Math.round(s.w*i),o.w<1&&(o.w=1)))})}}),this)}columnChanged(e,n,r="moveScale"){var a;if(!this.nodes.length||!n||e===n)return this;const i=r==="compact"||r==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],o=i?this.nodes:D.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{const d=o.find(h=>h._id===u._id);d&&(!i&&!u.autoPosition&&(d.x=u.x??d.x,d.y=u.y??d.y),d.w=u.w??d.w,(u.x==null||u.y===void 0)&&(d.autoPosition=!0))})),l.forEach(u=>{const d=o.findIndex(h=>h._id===u._id);if(d!==-1){const h=o[d];if(i){h.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,s),u.autoPosition||(h.x=u.x??h.x,h.y=u.y??h.y,h.w=u.w??h.w,s.push(h)),o.splice(d,1)}})}if(i)this.compact(r,!1);else{if(o.length)if(typeof r=="function")r(n,e,s,o);else{const l=i||r==="none"?1:n/e,c=r==="move"||r==="moveScale",u=r==="scale"||r==="moveScale";o.forEach(d=>{d.x=n===1?0:c?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:u?Math.round(d.w*l)||1:Math.min(d.w,n),s.push(d)}),o=[]}s=D.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,r=!1){const i=[];return e.forEach((s,o)=>{if(s._id===void 0){const a=s.id?this.nodes.find(l=>l.id===s.id):void 0;s._id=(a==null?void 0:a._id)??vr._idSeq++}i[o]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=r?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vr._idSeq++;const r={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete r.x,delete r.y,e.autoPosition&&(r.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(r):this._layouts[n][i]=r,this}findCacheLayout(e,n){var r,i;return((i=(r=this._layouts)==null?void 0:r[n])==null?void 0:i.findIndex(s=>s._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const r=this.findCacheLayout(e,n);r!==-1&&this._layouts[n].splice(r,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}vr._idSeq=0;const vn={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class xe{}const Fn=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class yn{}function qa(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t.changedTouches[0],e))}function Dv(t,e){t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t,e)}function Xa(t){yn.touchHandled||(yn.touchHandled=!0,qa(t,"mousedown"))}function Ya(t){yn.touchHandled&&qa(t,"mousemove")}function Ja(t){if(!yn.touchHandled)return;yn.pointerLeaveTimeout&&(window.clearTimeout(yn.pointerLeaveTimeout),delete yn.pointerLeaveTimeout);const e=!!xe.dragElement;qa(t,"mouseup"),e||qa(t,"click"),yn.touchHandled=!1}function Ka(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function $h(t){xe.dragElement&&t.pointerType!=="mouse"&&Dv(t,"mouseenter")}function Uh(t){xe.dragElement&&t.pointerType!=="mouse"&&(yn.pointerLeaveTimeout=window.setTimeout(()=>{delete yn.pointerLeaveTimeout,Dv(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",Xa),this.el.addEventListener("pointerdown",Ka)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Fn&&(this.el.removeEventListener("touchstart",Xa),this.el.removeEventListener("pointerdown",Ka)),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",Ya),this.el.addEventListener("touchend",Ja)),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",Ya),this.el.removeEventListener("touchend",Ja)),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 zd{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 co extends zd{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=co._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 co._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}}co._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const uA='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class uo extends zd{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",Xa),e.addEventListener("pointerdown",Ka))}),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",Xa),n.removeEventListener("pointerdown",Ka))}),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(uA)||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",Ya),e.currentTarget.addEventListener("touchend",Ja)),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",Ya,!0),e.currentTarget.removeEventListener("touchend",Ja,!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=uo.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",uo.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}}}}uo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class dA extends zd{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",$h),this.el.addEventListener("pointerleave",Uh)))}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",$h),this.el.removeEventListener("pointerleave",Uh)))}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 Id{static init(e){return e.ddElement||(e.ddElement=new Id(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 uo(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 co(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 dA(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class fA{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?Id.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 Qt=new fA;class ke{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const r=ke.getGridElement(n);return r?(r.gridstack||(r.gridstack=new ke(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"||(ke.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new ke(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")||ke.addRemoveCB)&&(ke.addRemoveCB?r=ke.addRemoveCB(e,n,!0,!0):r=D.createDiv(["grid-stack",n.class],e)),ke.init(n,r)}static registerEngine(e){ke.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||ke.engineClass||vr;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:ke.addRemoveCB?n=ke.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,ke.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)})):ke.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),ke.addRemoveCB?u=ke.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 _=l?n.column:s.w,k=s.h+r.h,O=s.el.style;O.transition="none",this.update(s.el,{w:_,h:k}),setTimeout(()=>O.transition=null)}const h=s.subGrid=ke.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=ke.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=ke.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=ke.addRemoveCB;typeof n=="function"&&(ke.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)||(ke.addRemoveCB&&ke.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?ke.addRemoveCB=s:delete ke.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=ke.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?(ke.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&&ke.addRemoveCB&&ke.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&&ke.addRemoveCB&&ke.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 ke.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,ke.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),ke.updateCB&&ke.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(ke.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} '${ke.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){ke.resizeToContentCB?ke.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return ke.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 ke.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 Qt}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)=>{Qt.isDraggable(o)||Qt.dragIn(o,n),r!=null&&r[a]&&(o.gridstackNode=r[a])})}movable(e,n){return this.opts.staticGrid?this:(ke.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:(ke.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&&ke._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Qt.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 Qt.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)){Qt.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 Qt.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),ke._itemRemoving(a.el,!1),Qt.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,Qt.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||ke.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&&!Qt.isDroppable(e)&&Qt.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,r)=>ke._itemRemoving(r,!0)).on(e,"dropout",(n,r)=>ke._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))}};Qt.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 Qt.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;Qt.resizable(e,"option","minWidth",s*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",o*Math.min(i.minH||1,c)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxHeightMoveUp",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,r,i,s,o){var _;const a={...i._orig};let l,c=this.opts.marginLeft,u=this.opts.marginRight,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&&((_=xe.dragElement)==null||_.updateScrollPosition(this.el));const k=r.position.left+(r.position.left>i._lastUiPosition.left?-u:c),O=r.position.top+(r.position.top>i._lastUiPosition.top?-h:d);a.x=Math.round(k/s),a.y=Math.round(O/o);const I=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!==I&&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 k=r.position.left+c;a.x=Math.round(k/s)}if(n.hasMovedY){const k=r.position.top+d;a.y=Math.round(k/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 k=n.target;i._sidebarOrig||this._writePosAttr(k,i),this.triggerEvent(n,k)}}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,Qt.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&&ke._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):r._isExternal&&this.engine.restoreInitial()}}ke.renderCB=(t,e)=>{t&&(e!=null&&e.content)&&(t.textContent=e.content)};ke.resizeToContentParent=".grid-stack-item-content";ke.Utils=D;ke.Engine=vr;ke.GDRev="12.6.0";function Hv(t){return{...t,w:Math.max(t.w,t.minW??t.w),h:Math.max(t.h,t.minH??t.h)}}const Ld="mndw:dashboard:grid-layout",hA=/^widget-(.+):([1-9]\d*)$/;function wi(t){const e=hA.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 Bv(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 pA(t){return Bv(t)?{id:t.id,x:t.x,y:t.y,w:t.w,h:t.h}:null}function jh(){try{localStorage.removeItem(Ld)}catch(t){console.error("[mndw] Failed to clear dashboard layout:",t)}}function gA(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 mA(t){return[...t].sort((e,n)=>e.y-n.y||e.x-n.x||gA(e.id,n.id)).map(e=>e.id)}function vA(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 mA(e))r.has(s)||(r.add(s),i.push(s));return i}function bA(t,e){const n=Hv(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 _A(t,e){const n=new Set,r=[];for(const i of t){if(!Bv(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 wA(t){return typeof t=="object"&&t!==null&&!("version"in t)&&Array.isArray(t.tiles)}function yA(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(Ld,JSON.stringify(e))}catch(n){console.error("[mndw] Failed to save dashboard layout:",n)}}function kA(t){let e;try{e=localStorage.getItem(Ld)}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),jh(),null}if(!wA(n))return console.warn("[mndw] Malformed dashboard layout, discarding"),jh(),null;const r=_A(n.tiles,t);return{tiles:r,mobileOrder:vA(n.mobileOrder,r)}}var EA=z('<div class="mndw-grid-scroll mndw-scrollbar"><div class="grid-stack"></div></div>');function SA(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}`}zn(()=>{const d=ke.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,_)=>{_.x??(_.x=m.x),_.y??(_.y=m.y),_.w??(_.w=m.w),_.h??(_.h=m.h)}),g=Array.isArray(p)?p.map(pA).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=EA(),u=v(c);no(u,d=>n=d,()=>n),C(t,c),Le()}const wr=(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}}},Mu=Symbol("mndw.host-services");function xA(t){c_(Mu,t)}function Rr(){if(!u_(Mu))throw new Error("Host services context was not set");return l_(Mu)}var TA=z('<p class="mndw-floating-panel__empty"> </p>'),CA=z('<span class="mndw-floating-panel__deps"> </span>'),PA=z('<span class="mndw-floating-panel__deps mndw-floating-panel__deps--failed"> </span>'),RA=z("<mndw-button> <!></mndw-button>",2),AA=z('<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 MA(t,e){Ie(e,!0);const r=Rr().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=kn(),c=Xe(l);{var u=d=>{var h=AA(),p=v(h),g=v(p),m=v(g),_=v(m),k=x(m,2);P(k,"variant","ghost"),Ne(k,1,"mndw-floating-panel__close"),y(()=>P(k,"aria-label",w("common.close")));var O=v(k);P(O,"name","x");var I=x(g,2);{var R=T=>{var M=TA(),N=v(M);y(j=>S(N,j),[()=>w("dashboard.no-widgets")]),C(T,M)},A=T=>{var M=kn(),N=Xe(M);ft(N,19,()=>f(i),j=>j.entry.name,(j,H,se)=>{const B=fe(()=>jo(f(H).entry.name));var q=RA();P(q,"variant","secondary");var ee=v(q),te=x(ee);{var W=ne=>{var le=CA(),oe=v(le);y(ue=>S(oe,ue),[()=>w("dashboard.preparing")]),C(ne,le)},J=ne=>{var le=PA(),oe=v(le);y(ue=>S(oe,ue),[()=>w("dashboard.unavailable")]),C(ne,le)};Z(te,ne=>{f(B)==="installing"?ne(W):f(B)==="failed"&&ne(J,1)})}no(q,(ne,le)=>s[le]=ne,ne=>s==null?void 0:s[ne],()=>[f(se)]),y(()=>S(ee,`${f(H).entry.label??""} `)),pe("click",q,()=>e.onAddWidget(f(H).entry.name)),C(j,q)}),C(T,M)};Z(I,T=>{f(i).length===0?T(R):T(A,-1)})}no(p,T=>b(o,T),()=>f(o)),Qr(p,(T,M)=>wr==null?void 0:wr(T,M),()=>({initialFocus:()=>{var T;return s[0]??((T=f(o))==null?void 0:T.querySelector(".mndw-floating-panel__close"))??null}})),y(T=>{Ae(p,"data-locale",me.locale),S(_,T)},[()=>w("dashboard.add-widget")]),pe("click",h,function(...T){var M;(M=e.onClose)==null||M.apply(this,T)}),pe("click",p,T=>T.stopPropagation()),pe("keydown",p,a),pe("click",k,function(...T){var M;(M=e.onClose)==null||M.apply(this,T)}),C(d,h)};Z(c,d=>{e.open&&d(u)})}C(t,l),Le()}at(["click","keydown"]);class Fh{constructor(e){G(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 OA(t,e){const n=`${Va}:${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 NA(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 $v(t){if(t===null||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(const e of Object.values(t))$v(e);return Object.freeze(t)}function zA(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 $v(a)}const IA=()=>new Worker(new URL("/assets/ticker-pool.worker-DJA1ERT2.js",import.meta.url),{type:"module"});function LA(t=IA){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 kb,running:!1,destroyed:!1,interval:1e3};e.set(c.id,c);const u=new Eb,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 DA=LA();let HA=0;const BA=()=>{const t=globalThis.crypto;return(t==null?void 0:t.randomUUID)!==void 0?t.randomUUID():`event-context-${++HA}`};function $A(t){const{routes:e}=t.backend;if(Object.keys(e??{}).length===0)return;const n={routes:e??{},approval:t.approval,enabled:t.enabled};return V2(t.name,n)}function Dd(t){var j,H,se,B,q;const{entry:e,instanceId:n,deviceInfo:r,setTileTitle:i,pageRoute:s,catalogCell:o}=t,a=((j=t.services)==null?void 0:j.locale)===void 0?as:()=>{var ee,te;return((te=(ee=t.services)==null?void 0:ee.locale)==null?void 0:te.getLocale())??as()},l=((H=t.services)==null?void 0:H.locale)===void 0?ee=>Eu(()=>ee()):ee=>{var te,W;return((W=(te=t.services)==null?void 0:te.locale)==null?void 0:W.subscribeLocale(()=>ee()))??(()=>{})},c=((se=t.services)==null?void 0:se.palette)===void 0?Hh:()=>{var ee,te;return((te=(ee=t.services)==null?void 0:ee.palette)==null?void 0:te.getTokens())??Hh()},u=((B=t.services)==null?void 0:B.telemetry)??lo().telemetry,d=((q=t.services)==null?void 0:q.eventStream)??lo().eventStream;if(e.type==="page"&&s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);const h=KT(),p=Rc(Za,yv,h),g=Rc(a,ee=>{var te;return((te=t.services)==null?void 0:te.locale)===void 0?Eu(ee):t.services.locale.subscribeLocale(ee)},h),m=Rc(c,ee=>{var te;return((te=t.services)==null?void 0:te.palette)===void 0?ER(ee):t.services.palette.subscribePalette(ee)},h),{service:_,dispose:k}=Rd(e.name,n),O=BA(),I=d.createFacade(O,e.name,e.permissions??[],h);let R=!1;const A=ee=>{R||(R=!0,h.end(),I!==void 0&&d.disposeFacade(O),k(ee))},T=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},M=Object.assign(Object.create(null),{telemetry:u,events:I,rciManager:NA(Nd.driver,GP),storage:new Fh(`${Va}:${e.name}:instance:${n}:`),sharedStorage:new Fh(`${Va}:${e.name}:shared:`),deviceInfo:zA(r),i18n:vC(o,a,l,h),instanceId:n,createTicker:()=>DA.create(h),backend:$A(e),overlay:_,...T});return Object.defineProperties(M,{theme:{enumerable:!0,get:Za},theme$:{enumerable:!0,value:p},locale:{enumerable:!0,get:a},locale$:{enumerable:!0,value:g},palette:{enumerable:!0,get:c},palette$:{enumerable:!0,value:m}}),{context:Object.freeze(M),dispose:A}}function Uv(t,e,n,r,i,s){me.hostInfo;const o=me.deviceInfo??Sd,a=e.get(n);if(!a)throw new Error(`No loaded plugin "${n}"`);return Dd({entry:a.entry,instanceId:r,deviceInfo:o,setTileTitle:s,catalogCell:a.catalog,services:t})}function UA(t){return t===null||typeof t!="object"&&typeof t!="function"?!1:typeof t.then=="function"}function jv(t,e,n,r,i){const s=e.entry.name;try{const o=e.module.createInstance(t,n);return UA(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 Qa(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&&OA(t.pluginName,t.instanceId),e.innerHTML=""}function Hd(t,e,n){let r=null,i=!1,s;const o=jv(t,e,n.context,n.dispose,{errorText:"Error loading widget"});let a;return o instanceof Promise?a=o.then(l=>(r=l,i&&(Qa(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&&(Qa(r,t,l),r=null))}}}const Tr=new Map;function jA(){return{getMounted:()=>null,whenReady:()=>Promise.resolve(!1),dispose:()=>{}}}function Fv(t,e){t.textContent="";const n=document.createElement("div");n.className=`mndw-grid-tile__notice mndw-grid-tile__notice--${e}`,n.textContent=Rn(e==="installing"?"dashboard.preparing-dependencies":"dashboard.dependency-install-failed"),t.appendChild(n)}function FA(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",Rn("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",Rn("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=Tr.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}=FA(a.entry.label,()=>i(s)),h=jo(n);let p;h==="ready"?p=Hd(c,a,Uv(t,e,n,r,void 0,u)):(Fv(c,h),p=jA());const g={id:s,pluginName:n,instanceId:r,frame:l,body:c,handle:p,setTileTitle:u,getTileTitle:d,pending:h==="installing"};return Tr.set(s,g),g}function Bd(t){return Tr.get(t)}function Gv(t,e){for(const n of Tr.values()){if(!n.pending)continue;const r=jo(n.pluginName);if(r==="installing")continue;if(r==="failed"){Fv(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=Hd(n.body,i,Uv(t,e,n.pluginName,n.instanceId,void 0,n.setTileTitle)),n.pending=!1}}function Vv(t){const e=Tr.get(t);e!==void 0&&(Tr.delete(t),e.frame.remove(),e.handle.dispose({clearStorage:!0,closeReason:"plugin-unmount"}))}function GA(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",Rn("dashboard.remove-widget",{label:e}))}async function VA(t,e,n,r,i){const s=[...Tr.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=>{GA(d.frame,u.entry.label),d.setTileTitle(""),me.hostInfo;const h=me.deviceInfo??Sd;return d.handle=Hd(d.body,u,Dd({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 Zv(t="plugin-unmount"){for(const[e,n]of Tr)try{n.handle.dispose({clearStorage:!1,closeReason:t})}catch(r){console.error(`[mndw] Failed to unmount tile ${e}:`,r)}Tr.clear()}const ZA=Object.freeze(Object.defineProperty({__proto__:null,destroyAllTiles:Zv,ensureTileController:Bl,getTileController:Bd,hydratePendingTiles:Gv,remountWidgetTiles:VA,removeTileController:Vv},Symbol.toStringTag,{value:"Module"}));var WA=z('<div class="mndw-mobile-tile"></div>'),qA=z('<div class="mndw-mobile-dashboard mndw-scrollbar"></div>');function XA(t,e){Ie(e,!0);const n=Rr(),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=qA();ft(o,20,()=>e.order,a=>a,(a,l)=>{var c=WA();Qr(c,(u,d)=>s==null?void 0:s(u,d),()=>l),C(a,c)}),C(t,o),Le()}var YA=z('<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),JA=z('<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 KA(t,e){Ie(e,!0);let n=Y(it([])),r=Y(null),i=it([]);hn(()=>{e.open&&(b(n,e.cards.map(g=>({...g})),!0),b(r,null))});function s(){e.onCommit(f(n).map(g=>g.id))}function o(g,m){const _=g+m;if(_<0||_>=f(n).length)return;const k=[...f(n)],[O]=k.splice(g,1);O!==void 0&&(k.splice(_,0,O),b(n,k,!0))}function a(g){g.key==="Escape"&&s()}function l(g,m){var _,k;b(r,m,!0),(k=(_=g.currentTarget).setPointerCapture)==null||k.call(_,g.pointerId)}function c(g){var _;const m=f(r);if(m!==null)for(let k=0;k<f(n).length;k+=1){if(k===m)continue;const O=(_=i[k])==null?void 0:_.getBoundingClientRect();if(O!==void 0&&g.clientY>=O.top&&g.clientY<=O.bottom){o(m,k-m),b(r,k,!0);return}}}function u(){b(r,null)}var d=kn(),h=Xe(d);{var p=g=>{var m=JA(),_=v(m),k=v(_),O=v(k),I=v(O),R=x(O,2);P(R,"variant","ghost"),Ne(R,1,"mndw-floating-panel__close"),y(()=>P(R,"aria-label",w("common.close")));var A=v(R);P(A,"name","x");var T=x(k,2);ft(T,23,()=>f(n),M=>M.id,(M,N,j)=>{var H=YA();let se;var B=v(H),q=v(B);P(q,"name","menu");var ee=x(B,2),te=v(ee),W=x(ee,2),J=v(W);P(J,"variant","ghost"),y(()=>P(J,"disabled",f(j)===0)),y(()=>P(J,"aria-label",w("dashboard.move-up",{label:f(N).label})));var ne=v(J);P(ne,"name","arrow-up");var le=x(J,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(N).label})));var oe=v(le);P(oe,"name","arrow-down"),no(H,(ue,De)=>i[De]=ue,ue=>i==null?void 0:i[ue],()=>[f(j)]),y(()=>{se=Ne(H,1,"mndw-order-card",null,se,{"mndw-order-card--dragging":f(r)===f(j)}),S(te,f(N).label)}),pe("pointerdown",B,ue=>l(ue,f(j))),pe("pointermove",B,c),pe("pointerup",B,u),pe("click",J,()=>o(f(j),-1)),pe("click",le,()=>o(f(j),1)),C(M,H)}),Qr(_,M=>wr==null?void 0:wr(M)),y(M=>{Ae(_,"data-locale",me.locale),S(I,M)},[()=>w("dashboard.arrange-widgets")]),pe("click",m,s),pe("click",_,M=>M.stopPropagation()),pe("keydown",_,a),pe("click",R,s),C(g,m)};Z(h,g=>{e.open&&g(p)})}C(t,d),Le()}at(["click","keydown","pointerdown","pointermove","pointerup"]);const fo=new Map;function Wv(t){return`${Va}:${t}:counter`}function qv(t){return Number.isSafeInteger(t)&&t>=0}function QA(t){try{const e=localStorage.getItem(Wv(t));if(e===null||e.trim()==="")return 0;const n=Number(e);return qv(n)?(fo.set(t,Math.max(fo.get(t)??0,n)),n):0}catch(e){return console.error(`[mndw] Failed to read widget counter for "${t}":`,e),0}}function Xv(t){return Math.max(QA(t),fo.get(t)??0)}function Yv(t,e){try{localStorage.setItem(Wv(t),String(e))}catch(n){console.error(`[mndw] Failed to write widget counter for "${t}":`,n)}}function Jv(t){const e=Xv(t);if(e===Number.MAX_SAFE_INTEGER)throw new RangeError(`Widget instance counter exhausted for "${t}"`);const n=e+1;return fo.set(t,n),Yv(t,n),`${t}:${n}`}function eM(t,e){if(!qv(e)){console.error(`[mndw] Ignoring invalid restored widget counter for "${t}":`,e);return}e>Xv(t)&&(fo.set(t,e),Yv(t,e))}function Gh(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)??Jv(r),l=Bl(t,e,r,a,i);if(l===null)return null;const c=Hv(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 tM(t,e){var i;const n=Bd(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 nM=z("<mndw-button> </mndw-button>",2),rM=z("<mndw-button> </mndw-button> <!>",3),iM=z('<span class="mndw-dashboard__toolbar--empty"> </span>'),sM=z('<div class="mndw-dashboard__grid-wrapper"><!></div>'),oM=z('<div class="mndw-dashboard-page"><div class="mndw-dashboard__toolbar"><!></div> <!></div> <!> <!>',1);function Vh(t,e){Ie(e,!0);const n=500,r=Rr(),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=bl();let l=Y(null),c=Y(!1),u=Y(!1),d=Y(it(a.matches)),h=Y(it([])),p=Y(it([])),g=!1,m,_=null;{const ce=kA(o);if(ce!==null){b(h,ce.tiles,!0),b(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)eM(U,re)}}function k(ce={tiles:Vo(f(h)),mobileOrder:Vo(f(p))}){clearTimeout(m),_=null,yA(ce)}function O(){clearTimeout(m),_={tiles:Vo(f(h)),mobileOrder:Vo(f(p))},m=setTimeout(()=>{_!==null&&k(_)},n)}function I(ce){Vv(ce),b(h,f(h).filter(ae=>ae.id!==ce),!0),b(p,f(p).filter(ae=>ae!==ce),!0),k()}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}}I(ce)}function A(ce){b(l,ce,!0),g=!0;try{for(const ae of f(h)){const U=wi(ae.id);U!==null&&Gh(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 T(){b(l,null)}function M(ce){g||(b(h,ce,!0),O())}function N(ce,ae){tM(ce,ae)}function j(ce){const ae=o(ce);if(ae===void 0)return;const U=Jv(ce),re=Bl(s,i,ce,U,R);re!==null&&(b(h,[...f(h),{id:re.id,...bA(f(h),ae)}],!0),b(p,[...f(p),re.id],!0),k())}function H(ce){if(b(c,!1),f(d)){j(ce);return}const ae=f(l);if(ae===null)return;const U=Gh(s,i,ae,ce,R);U!==null&&(b(p,[...f(p),U],!0),k())}const se=ce=>{b(d,ce.matches,!0),ce.matches||b(u,!1)},B=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=Bd(ce))==null?void 0:ve.getTileTitle())??"";return[{id:ce,label:re||U}]}):[]);function q(ce){b(p,ce,!0),b(u,!1),k()}hn(()=>{[...Wa.entries()],Gv(s,i)}),zn(()=>(a.addEventListener("change",se),()=>a.removeEventListener("change",se))),Io(()=>{_!==null&&k(_),Zv("host-navigation")});var ee=oM(),te=Xe(ee),W=v(te),J=v(W);{var ne=ce=>{var ae=rM(),U=Xe(ae);P(U,"variant","secondary");var re=v(U),X=x(U,2);{var ve=Ze=>{var nt=nM();P(nt,"variant","secondary");var yt=v(nt);y(Ut=>S(yt,Ut),[()=>w("dashboard.arrange-widgets")]),pe("click",nt,()=>b(u,!0)),C(Ze,nt)};Z(X,Ze=>{f(d)&&f(p).length>1&&Ze(ve)})}y(Ze=>S(re,Ze),[()=>w("dashboard.add-widget")]),pe("click",U,()=>b(c,!0)),C(ce,ae)},le=fe(()=>i.getWidgets().length>0),oe=ce=>{var ae=iM(),U=v(ae);y(re=>S(U,re),[()=>w("dashboard.no-widgets")]),C(ce,ae)};Z(J,ce=>{f(le)?ce(ne):ce(oe,-1)})}var ue=x(W,2);{var De=ce=>{XA(ce,{get order(){return f(p)},onRemoveRequest:R})},Ye=ce=>{var ae=sM(),U=v(ae);SA(U,{onGridReady:A,onGridDestroyed:T,onWidgetRemoved:I,onLayoutChanged:M,onWidgetResized:N}),C(ce,ae)};Z(ue,ce=>{f(d)?ce(De):ce(Ye,-1)})}var je=x(te,2);MA(je,{get open(){return f(c)},onAddWidget:H,onClose:()=>b(c,!1)});var Ke=x(je,2);{let ce=fe(()=>f(d)&&f(u));KA(Ke,{get open(){return f(ce)},get cards(){return f(B)},onCommit:q})}y(()=>Ae(te,"data-locale",me.locale)),C(t,ee),Le()}at(["click"]);o_();var aM=z('<span class="mndw-header__device"> </span>'),lM=z('<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 cM(t,e){Ie(e,!1);const n=Rr();function r(R){n.locale.setLocale(R.detail.value).catch(()=>{})}async function i(){try{await new Promise(R=>{n.rci.logout().subscribe({next:()=>R(),error:()=>R()})})}finally{Pd()}}yw();var s=lM(),o=v(s),a=v(o);P(a,"variant","ghost"),Ne(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=x(a,4);{var u=R=>{var A=aM(),T=v(A);y(()=>S(T,me.deviceInfo.deviceName)),C(R,A)};Z(c,R=>{me.deviceInfo&&R(u)})}var d=x(o,2),h=v(d);Ne(h,1,"mndw-header__locale-select"),y(()=>P(h,"label",w("nav.language"))),y(()=>P(h,"value",me.locale)),y(()=>P(h,"disabled",me.localeSwitchPending));var p=v(h);P(p,"value","en");var g=x(p,2);P(g,"value","ru");var m=x(h,2);P(m,"variant","ghost"),Ne(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 _=v(m);y(()=>P(_,"name",me.theme==="dark"?"sun":"moon"));var k=x(m,2);P(k,"variant","ghost"),Ne(k,1,"mndw-header__logout");var O=v(k);P(O,"name","log-out");var I=x(O);y(R=>{Ae(s,"data-locale",me.locale),S(I,` ${R??""}`)},[()=>w("nav.logout")]),pe("click",a,function(...R){Nc==null||Nc.apply(this,R)}),ut("mndwchange",h,r),pe("click",m,function(...R){Fi==null||Fi.apply(this,R)}),pe("click",k,i),C(t,s),Le()}at(["click"]);var uM=z('<div class="mndw-sidebar-backdrop" role="presentation"></div>'),dM=z("<a> </a>"),fM=z('<div class="mndw-sidebar__section-label"> </div> <!>',1),hM=z('<!> <nav><a href="/"> </a> <a href="/packages"> </a> <!> <div class="mndw-sidebar__spacer"></div> <a href="/settings"> </a></nav>',1);function pM(t,e){Ie(e,!0);const n=Rr().registry,r=bl();let i=Y(it(r.matches));const s=B=>{b(i,B.matches,!0)},o=n.getPages().slice().sort((B,q)=>B.entry.label.localeCompare(q.entry.label)||B.entry.name.localeCompare(q.entry.name)),a=fe(()=>(Jt==null?void 0:Jt.route.pathname)??globalThis.location.pathname);function l(B){return(B.length>1&&B.endsWith("/")?B.slice(0,-1):B).toLowerCase()}function c(B){const q=l(f(a)),ee=l(B);return ee==="/"?q==="/":q===ee||q.startsWith(`${ee}/`)}function u(){f(i)&&(me.mobileSidebarOpen=!1)}function d(B){B.key==="Escape"&&f(i)&&me.mobileSidebarOpen&&(me.mobileSidebarOpen=!1)}zn(()=>(r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var h=hM();ut("keydown",Qs,d);var p=Xe(h);{var g=B=>{var q=uM();pe("click",q,u),C(B,q)};Z(p,B=>{f(i)&&me.mobileSidebarOpen&&B(g)})}var m=x(p,2);let _;var k=v(m);let O;var I=v(k),R=x(k,2);let A;var T=v(R),M=x(R,2);{var N=B=>{var q=fM(),ee=Xe(q),te=v(ee),W=x(ee,2);ft(W,17,()=>o,J=>J.entry.name,(J,ne)=>{var le=dM();let oe;var ue=v(le);y((De,Ye)=>{Ae(le,"href",f(ne).entry.route),oe=Ne(le,1,"mndw-sidebar__link",null,oe,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(J,le)}),y(J=>S(te,J),[()=>w("nav.plugins")]),C(B,q)};Z(M,B=>{o.length>0&&B(N)})}var j=x(M,4);let H;var se=v(j);Qr(m,(B,q)=>wr==null?void 0:wr(B,q),()=>({enabled:f(i)&&me.mobileSidebarOpen})),y((B,q,ee,te,W,J,ne,le,oe)=>{_=Ne(m,1,"mndw-sidebar",null,_,{collapsed:!f(i)&&me.desktopSidebarCollapsed,"mobile-collapsed":f(i)&&!me.mobileSidebarOpen}),Ae(m,"data-locale",me.locale),m.inert=f(i)&&!me.mobileSidebarOpen,O=Ne(k,1,"mndw-sidebar__link",null,O,B),Ae(k,"aria-current",q),S(I,ee),A=Ne(R,1,"mndw-sidebar__link",null,A,te),Ae(R,"aria-current",W),S(T,J),H=Ne(j,1,"mndw-sidebar__link",null,H,ne),Ae(j,"aria-current",le),S(se,oe)},[()=>({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",k,u),pe("click",R,u),pe("click",j,u),C(t,h),Le()}at(["click"]);var gM=z('<div class="mndw-app-shell"><!> <div class="mndw-app-shell__body"><!> <main class="mndw-app-shell__content"><!></main></div></div>');function mM(t,e){var n=gM(),r=v(n);cM(r,{});var i=x(r,2),s=v(i);pM(s,{});var o=x(s,2),a=v(o);ow(a,()=>e.children),C(t,n)}function Ou(t){return t==="/"?"":t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function oa(t,e){return new Cu("INVALID_PATH",`Invalid page child path "${t}"`,{cause:e})}function vM(t){if(t===""||t==="/")return"";if(!t.startsWith("/")||t.startsWith("//")||t.includes("?")||t.includes("#"))throw oa(t);const e=Ou(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 oa(t);continue}let o;try{o=decodeURIComponent(s)}catch(a){throw oa(t,a)}if(o==="."||o===".."||o.includes("/")||o.includes("\\"))throw oa(t)}return e}class bM{constructor(e,n,r){G(this,"baseRoute");G(this,"deps");G(this,"childPathSubject");G(this,"currentChildPath");G(this,"completed",!1);G(this,"navigationSerial",0);G(this,"pageRoute");this.baseRoute=e,this.deps=r,this.currentChildPath=Ou(n),this.childPathSubject=new Sb(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=Ou(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=vM(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 _M=z('<div class="mndw-page-plugin__notice" role="status"> </div>'),wM=z('<div class="mndw-page-plugin-wrap"><!> <div class="mndw-page-plugin"></div></div>');function Zh(t,e){Ie(e,!0);const n={clearStorage:!1,closeReason:"host-navigation"};let r,i=null,s=0,o=null;const a=Rr(),l=a.registry,c={locale:a.locale,palette:a.palette,eventStream:a.eventStream};function u(N){return r=N,{destroy(){r=void 0}}}const d=fe(()=>nb(Jt.route.pathname,hp())),h=fe(()=>{var N;return((N=f(d))==null?void 0:N.name)??null}),p=fe(()=>f(h)===null?"ready":jo(f(h))),g=fe(()=>f(p)==="ready"?f(h):null);function m(){s+=1,o!==null&&(o.controller.complete(),Qa(o.mounted,o.child,n),o.child.remove(),o=null)}function _(N){var H;if(i=N,N===null)return;const j=l.get(N);r===void 0||j===void 0||j.entry.type!=="page"||k(j,((H=f(d))==null?void 0:H.name)===N?f(d).childPath:"")}function k(N,j){if(r===void 0)return Promise.resolve(!1);s+=1;const H=s,se=document.createElement("div");se.className="mndw-page-plugin__mount",r.appendChild(se);const B=hp().find(le=>le.name===N.entry.name);if(B===void 0)return se.remove(),Promise.resolve(!1);const q=new bM(B.route,j,{navigate:(le,oe)=>Jt.navigate(le,oe),getLocation:()=>({search:globalThis.location.search,hash:globalThis.location.hash})}),ee={generation:H,pluginName:N.entry.name,child:se,controller:q,mounted:null};o=ee,me.hostInfo;const te=me.deviceInfo??Sd,{context:W,dispose:J}=Dd({entry:N.entry,instanceId:`${N.entry.name}:1`,deviceInfo:te,pageRoute:q.pageRoute,catalogCell:N.catalog,services:c}),ne=jv(se,N,W,J);return ne instanceof Promise?ne.then(le=>H!==s?(Qa(le,se,n),se.remove(),le!==null):(ee.mounted=le,le!==null)):(ee.mounted=ne,Promise.resolve(ne!==null))}async function O(N,j){var H,se;return m(),await k(N,((H=f(d))==null?void 0:H.childPath)??"")?!0:(m(),await k(j,((se=f(d))==null?void 0:se.childPath)??""),!1)}function I(N){const{detail:j}=N;o===null||j.pluginName!==i||j.register(O(j.next,j.prior))}hn(()=>{f(g)!==i&&(m(),_(f(g)))}),hn(()=>{const N=f(d);N!==null&&(o==null?void 0:o.pluginName)===N.name&&o.controller.setPath(N.childPath)}),hn(()=>(window.addEventListener(Au,I),()=>window.removeEventListener(Au,I))),Io(m);var R=wM(),A=v(R);{var T=N=>{var j=_M(),H=v(j);y(()=>S(H,f(p)==="installing"?"Preparing… installing dependencies":"Dependency install failed")),C(N,j)};Z(A,N=>{f(h)!==null&&f(p)!=="ready"&&N(T)})}var M=x(A,2);Qr(M,N=>u==null?void 0:u(N)),C(t,R),Le()}function Fo(t,e){return()=>{let n,r,i;const s=o=>{if(n!==void 0){if(i===void 0){const a=it({row:o.row,value:o.value,colId:o.colId}),l=Object.assign(a,e(a));i=l,r=vl(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&&(qu(r),r=void 0),n=void 0,i=void 0}}}}function Ks(){return t=>Fo(t,()=>({}))}class Bi extends Error{constructor(n,r,i){super(n);G(this,"code");G(this,"detail");this.name="OpkgError",this.code=r,this.detail=i}}function yM(t){if(t.code!=="DEPENDENCY_CONFLICT"||!sn(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 nn(){return new Bi("Malformed response","UNKNOWN")}async function kM(t){try{return await t.json()}catch{throw nn()}}async function EM(t){const e=Dl(await Ll(t),t.statusText);return new Bi(e.message,e.code,e.detail)}function SM(t){if(!sn(t))throw nn();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 nn();if(i==="update_available"){if(typeof s!="string"||s.length===0)throw nn()}else if(s!==void 0)throw nn();return{name:e,version:n,description:r,status:i,...s===void 0?{}:{newVersion:s}}}function xM(t){if(!sn(t)||!Array.isArray(t.packages))throw nn();const e=t.metadataUpdatedAt;if(e!==null&&typeof e!="string"||typeof e=="string"&&Number.isNaN(Date.parse(e)))throw nn();return{packages:t.packages.map(n=>SM(n)),metadataUpdatedAt:e}}function TM(t){if(!sn(t))throw nn();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 nn();const n=["size","installedSize","installedTime"];for(const o of n)if(t[o]!==void 0&&typeof t[o]!="string")throw nn();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 CM(t){if(!sn(t)||t.ok!==!0||typeof t.message!="string"||!Array.isArray(t.packages)||!t.packages.every(e=>typeof e=="string"))throw nn();return{message:t.message,packages:t.packages}}function PM(t){if(!sn(t)||t.ok!==!0||typeof t.message!="string")throw nn();return{message:t.message}}function RM(t=globalThis.fetch){async function e(r,i){const s=await t(r,i);if(!s.ok)throw await EM(s);return kM(s)}async function n(r,i){const s=await e(r,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({packages:i})});return CM(s)}return{async list(){const r=await e(NT,{method:"GET"});return xM(r)},async info(r){const i=new URLSearchParams({name:r}),s=await e(`${HT}?${i.toString()}`,{method:"GET"});return TM(s)},install:r=>n(zT,r),remove:r=>n(IT,r),upgrade:r=>n(DT,r),async update(){const r=await e(LT,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:"{}"});return PM(r)}}}const Ni=RM(),{service:AM}=Rd("@host","@host");function ls(t,e){return AM.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 qu(i)});try{i=vl(t,{target:n,props:a})}finally{s()}}})}var MM=z('<span class="package-name svelte-84q0nr"> </span>');function OM(t,e){var n=MM(),r=v(n);y(()=>{Ae(n,"title",e.value),S(r,e.value)}),C(t,n)}var NM=z('<span class="new-version svelte-sgt4ns"> </span>'),zM=z('<span class="ver-value svelte-sgt4ns"> </span><!>',1);function IM(t,e){Ie(e,!0);var n=zM(),r=Xe(n),i=v(r),s=x(r);{var o=a=>{var l=NM(),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 LM=z("<span> </span>");function DM(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=LM(),i=v(r);y(()=>{Ne(r,1,`badge badge-${e.value??""}`,"svelte-tq54e2"),Ae(r,"data-col",e.colId),S(i,f(n))}),C(t,r),Le()}var HM=z("<mndw-button> </mndw-button>",2);function BM(t,e){Ie(e,!0);const n=fe(()=>e.row.name==="mndw"||e.row.name==="lighttpd");var r=HM();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()}at(["click"]);function $M(t){return Fo(BM,e=>({onRemove:()=>t(e.row.name)}))}var UM=z("<p> </p>"),jM=z('<p role="alert"> </p> <mndw-button> </mndw-button>',3),aa=z('<dt class="svelte-uhnzp9"> </dt><dd class="svelte-uhnzp9"> </dd>',1),FM=z('<dl class="svelte-uhnzp9"><dt class="svelte-uhnzp9"> </dt> <dd class="svelte-uhnzp9"> </dd> <!> <!> <!> <!></dl>'),GM=z('<div class="detail svelte-uhnzp9"><!></div>');function VM(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=GM(),s=v(i);{var o=c=>{var u=UM(),d=v(u);y(h=>S(d,h),[()=>w("packages.loading")]),C(c,u)},a=c=>{var u=jM(),d=Xe(u),h=v(d),p=x(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=FM(),d=v(u),h=v(d),p=x(d,2),g=v(p),m=x(p,2);{var _=M=>{var N=aa(),j=Xe(N),H=v(j),se=x(j),B=v(se);y(q=>{S(H,q),S(B,f(r).info.size)},[()=>w("packages.size")]),C(M,N)};Z(m,M=>{f(r).info.size&&M(_)})}var k=x(m,2);{var O=M=>{var N=aa(),j=Xe(N),H=v(j),se=x(j),B=v(se);y(q=>{S(H,q),S(B,f(r).info.installedSize)},[()=>w("packages.installed-size")]),C(M,N)};Z(k,M=>{f(r).info.installedSize&&M(O)})}var I=x(k,2);{var R=M=>{var N=aa(),j=Xe(N),H=v(j),se=x(j),B=v(se);y(q=>{S(H,q),S(B,f(r).info.installedTime)},[()=>w("packages.installed-time")]),C(M,N)};Z(I,M=>{f(r).info.installedTime&&M(R)})}var A=x(I,2);{var T=M=>{var N=aa(),j=Xe(N),H=v(j),se=x(j),B=v(se);y((q,ee)=>{S(H,q),S(B,ee)},[()=>w("packages.dependencies"),()=>f(r).info.dependencies.join(", ")]),C(M,N)};Z(A,M=>{f(r).info.dependencies.length>0&&M(T)})}y(M=>{S(h,M),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()}at(["click"]);function ZM(t){return Fo(VM,()=>({cache:t.cache,load:t.load,retry:t.retry}))}const Wh=/[.\-+]/,qh=t=>t.length>0&&/^[0-9]+$/.test(t);function WM(t,e){const n=t.split(Wh),r=e.split(Wh),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(qh(o)&&qh(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 qM=z('<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 el(t,e){Ie(e,!0);var n=qM(),r=v(n),i=v(r),s=x(r,2),o=v(s);P(o,"variant","secondary");var a=x(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()}at(["click"]);var XM=z('<span class="selected-count svelte-m3c4ux"> </span>'),Xh=z('<div class="msg-cell svelte-m3c4ux"> </div>'),YM=z("<mndw-table></mndw-table>",2),JM=z('<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 KM(t,e){Ie(e,!0);let n=Yt(e,"now",3,()=>new Date),r=Y(it([])),i=Y(null),s=Y(null),o=new Na,a=Y(""),l=Y("installed"),c=Y(!1),u=Y(!1),d=Y(null),h=0;const p=new rs;let g=0;const m=fe(()=>f(r).filter(F=>f(l)==="installed"&&F.status==="available"||f(l)==="updates"&&F.status!=="update_available"?!1:F.name.toLowerCase().includes(f(a).toLowerCase()))),_=fe(()=>o.size),k=fe(()=>f(r).filter(F=>F.status==="update_available").length),O=fe(()=>[...o]),I=fe(()=>f(m).some(F=>o.has(F.name)&&F.status==="available")),R=fe(()=>f(m).some(F=>o.has(F.name)&&F.status!=="available"&&!j(F.name))),A=fe(()=>f(m).some(F=>o.has(F.name)&&F.status==="update_available")),T=fe(()=>{if(f(i)===null)return w("packages.never-refreshed");if(f(s)===null)return"";const F=Math.max(0,Math.floor((f(s).getTime()-Date.parse(f(i)))/6e4));return w("packages.refreshed-ago",{minutes:F})}),M=fe(()=>f(i)===null||f(s)===null?!1:f(s).getTime()-Date.parse(f(i))>3600*1e3),N=fe(()=>f(r).length===0?w("packages.empty"):w("packages.no-match"));function j(F){return F==="mndw"||F==="lighttpd"}function H(){g+=1,p.clear()}function se(F){if(p.has(F))return;const ie=g,Be=Ni.info(F);p.set(F,{status:"pending",promise:Be}),Be.then(Je=>{var gt;ie===g&&((gt=p.get(F))==null?void 0:gt.status)==="pending"&&p.set(F,{status:"success",info:Je})}).catch(Je=>{var gt;ie===g&&((gt=p.get(F))==null?void 0:gt.status)==="pending"&&p.set(F,{status:"failure",message:Je instanceof Bi?Je.message:w("packages.detail-failed")})})}function B(F){var ie;((ie=p.get(F))==null?void 0:ie.status)==="failure"&&(p.delete(F),se(F))}async function q(F=!1){b(c,!0);try{const ie=await Ni.list();b(r,ie.packages,!0),b(i,ie.metadataUpdatedAt,!0),b(s,n()(),!0),H(),b(u,!1),o.clear(),F||oi.info(w("packages.loaded",{count:f(r).length}))}catch(ie){b(r,[],!0),o.clear(),b(u,!0),oi.error(ie instanceof Bi?ie.message:w("packages.load-failed"))}finally{b(c,!1)}}async function ee(F,ie){const Be=Array.from(o).filter(Je=>{const gt=f(r).find(Mr=>Mr.name===Je);return gt!==void 0&&ie(gt)});if(Be.length!==0){if(F==="remove"){(await ls(el,{title:w("packages.confirm-remove-title"),props:{message:w("packages.confirm-remove",{names:Be.join(", ")}),confirmLabel:w("packages.remove")}}).closed).result&&await te("remove",Be);return}await te(F,Be)}}async function te(F,ie){b(c,!0);const Be=F==="install"?"packages.installing":F==="remove"?"packages.removing":"packages.updating";try{const Je=F==="install"?await Ni.install(ie):F==="remove"?await Ni.remove(ie):await Ni.upgrade(ie);await q(!0),oi.success(Je.message)}catch(Je){oi.error(W(Je,Be))}finally{b(c,!1)}}function W(F,ie){if(!(F instanceof Bi))return w("packages.action-failed",{action:w(ie)});const Be=yM(F);return Be===void 0?F.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 J(){b(c,!0);try{const F=await Ni.update();await q(!0),oi.success(F.message)}catch(F){oi.error(F instanceof Bi?F.message:w("app.error"))}finally{b(c,!1)}}function ne(F){const ie=F.detail.value;(ie==="all"||ie==="installed"||ie==="updates")&&b(l,ie,!0)}async function le(F){(await ls(el,{title:w("packages.confirm-remove-title"),props:{message:w("packages.confirm-remove",{names:F}),confirmLabel:w("packages.remove")}}).closed).result&&await te("remove",[F])}const oe={installed:0,update_available:1,available:2},ue=Ks()(OM),De=Ks()(IM),Ye=Ks()(DM),je=ZM({cache:p,load:se,retry:B}),Ke=$M(le),ce=fe(()=>[Hr()({id:"name",label:w("packages.package"),accessor:F=>F.name,sortable:!0,width:"11.25rem",renderer:ue}),Hr()({id:"version",label:w("packages.version"),accessor:F=>F.version,sortable:!0,comparator:WM,renderer:De}),Hr()({id:"status",label:w("packages.status"),accessor:F=>F.status,sortable:!0,comparator:(F,ie)=>oe[F]-oe[ie],renderer:Ye}),Hr()({id:"actions",label:"",renderer:Ke})]);let ae=new Na,U=Y(null);const re=fe(()=>({expandRow:F=>w("packages.expand",{name:F}),collapseRow:F=>w("packages.collapse",{name:F})}));function X(F){o.clear();for(const ie of F.detail.selected)o.add(ie)}function ve(F){b(U,F.detail.sort,!0)}function Ze(F){ae.clear();for(const ie of F.detail.expanded)ae.add(ie)}hn(()=>{const F=new Set(f(m).map(ie=>ie.name));Kr(()=>{const ie=[...ae].filter(Be=>!F.has(Be));for(const Be of ie)ae.delete(Be)})}),hn(()=>{var Je;const F=(Je=f(m)[0])==null?void 0:Je.name,ie=f(d),Be=++h;F===void 0||ie===null||(async()=>{var gt;await ie.updateComplete,!(Be!==h||((gt=f(m)[0])==null?void 0:gt.name)!==F)&&ie.scrollToRow(F,{align:"start"})})()}),zn(()=>{q()});var nt=JM(),yt=v(nt),Ut=v(yt),on=v(Ut),qn=v(on),En=x(on,2);let Xn;var Yn=v(En),cr=x(Ut,2),an=v(cr);P(an,"variant","secondary"),y(()=>P(an,"disabled",f(c)));var ur=v(an),Ee=x(an,2);P(Ee,"variant","secondary"),y(()=>P(Ee,"disabled",f(c)));var ze=v(Ee),V=x(yt,2),ge=v(V),Ce=x(ge,2);y(()=>P(Ce,"value",f(l)));var Ge=v(Ce);P(Ge,"id","all");var Qe=v(Ge),lt=x(Ge,2);P(lt,"id","installed");var xt=v(lt),$e=x(lt,2);P($e,"id","updates");var He=v($e),We=x(V,2),Re=v(We),L=v(Re),K=x(Re,2);P(K,"variant","primary"),y(()=>P(K,"disabled",f(c)||!f(I)));var we=v(K),_e=x(K,2);P(_e,"variant","danger"),y(()=>P(_e,"disabled",f(c)||!f(R)));var kt=v(_e),pt=x(_e,2);P(pt,"variant","primary"),y(()=>P(pt,"disabled",f(c)||!f(A)));var Jn=v(pt),Lt=x(pt,2);{var Sn=F=>{var ie=XM(),Be=v(ie);y(Je=>S(Be,Je),[()=>w("packages.selected",{count:f(_)})]),C(F,ie)};Z(Lt,F=>{f(_)>0&&F(Sn)})}var Ar=x(We,2),Et=v(Ar);{var ot=F=>{var ie=Xh(),Be=v(ie);y(Je=>S(Be,Je),[()=>w("packages.loading")]),C(F,ie)},Ot=F=>{var ie=Xh(),Be=v(ie);y(Je=>S(Be,Je),[()=>w("packages.load-failed")]),C(F,ie)},qt=F=>{var ie=YM();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(O))),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(N))),y(()=>P(ie,"labels",f(re))),Ne(ie,1,"svelte-m3c4ux"),no(ie,Be=>b(d,Be),()=>f(d)),ut("mndwselectionchange",ie,X),ut("mndwsortchange",ie,ve),ut("mndwrowexpand",ie,Ze),C(F,ie)};Z(Et,F=>{f(c)?F(ot):f(u)?F(Ot,1):F(qt,-1)})}y((F,ie,Be,Je,gt,Mr,Ti,Ci,ws,ys,Kn)=>{Ae(nt,"data-locale",me.locale),S(qn,F),Xn=Ne(En,1,"freshness svelte-m3c4ux",null,Xn,{stale:f(M)}),S(Yn,f(T)),S(ur,ie),S(ze,Be),Ae(ge,"placeholder",Je),S(Qe,gt),S(xt,Mr),S(He,Ti),S(L,Ci),S(we,ws),S(kt,ys),S(Jn,Kn)},[()=>w("packages.title"),()=>w("packages.refresh"),()=>w("packages.reload"),()=>w("packages.search"),()=>w("packages.all"),()=>w("packages.installed"),()=>w("packages.updates",{count:f(k)}),()=>w("packages.with-selected"),()=>w("packages.install"),()=>w("packages.remove"),()=>w("packages.update")]),pe("click",an,()=>void J()),pe("click",Ee,()=>void q()),ww(ge,()=>f(a),F=>b(a,F)),ut("mndwchange",Ce,ne),pe("click",K,()=>void ee("install",F=>F.status==="available")),pe("click",_e,()=>void ee("remove",F=>F.status!=="available"&&!j(F.name))),pe("click",pt,()=>void ee("upgrade",F=>F.status==="update_available")),C(t,nt),Le()}at(["click"]);class tl extends Error{constructor(n,r){super(n);G(this,"code");this.name="ServiceError",this.code=r}}const cs=()=>new tl("Malformed response","UNKNOWN");async function QM(t){try{return await t.json()}catch{throw cs()}}async function eO(t){const e=Dl(await Ll(t),t.statusText);return new tl(e.message,e.code)}function $d(t){if(!sn(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 cs();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 tO(t){if(!sn(t)||!Array.isArray(t.services))throw cs();return t.services.map(e=>$d(e))}function Yh(t){if(!sn(t)||t.ok!==!0||t.service===void 0)throw cs();return{ok:!0,service:$d(t.service)}}function nO(t=globalThis.fetch){async function e(r,i){const s=await t(r,i);if(!s.ok)throw await eO(s);return QM(s)}async function n(r,i){const s=await e(r,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:i})});return Yh(s)}return{async list(){return tO(await e(FT,{method:"GET"}))},async status(r,i){const s=new URLSearchParams({name:r}),o=await e(`${GT}?${s.toString()}`,{method:"GET",signal:i});if(!sn(o)||o.service===void 0)throw cs();return $d(o.service)},start:r=>n(VT,r),stop:r=>n(ZT,r),restart:r=>n(WT,r),async setEnabled(r,i){const s=await e(qT,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:r,enabled:i})});return Yh(s)}}}const la=nO();var rO=z('<strong> </strong><small class="svelte-gqtyao"> </small>',1);function iO(t,e){Ie(e,!0);var n=rO(),r=Xe(n),i=v(r),s=x(r),o=v(s);y(()=>{S(i,e.row.service.label),S(o,e.row.service.name)}),C(t,n),Le()}var sO=z('<small class="pid svelte-1ugk9ic"> </small>'),oO=z("<span> </span> <!>",1);function aO(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=oO(),o=Xe(s),a=v(o),l=x(o,2);{var c=u=>{var d=sO(),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(()=>{Ne(o,1,`badge ${f(r)??""}`,"svelte-1ugk9ic"),S(a,f(i))}),C(t,s),Le()}var lO=z("<mndw-button> </mndw-button>",2),cO=z('<div class="actions svelte-2q4dea"></div>');function uO(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=cO();ft(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=lO(),u=()=>e.onRun(o());_w(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 dO(t){return Fo(uO,e=>({onRun:n=>t(n,e.row.service.name)}))}var fO=z("<mndw-switch></mndw-switch>",2);function hO(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=fO();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))),ut("mndwchange",o,s),C(t,o),Le()}function pO(t){return Fo(hO,e=>({onToggle:n=>t(e.row.service,n)}))}var gO=z('<div class="empty capability svelte-3v3gj2" role="status"><strong class="svelte-3v3gj2"> </strong><span> </span></div>'),Jh=z('<div class="empty svelte-3v3gj2" role="status"> </div>'),mO=z('<div class="table-wrap svelte-3v3gj2"><mndw-table></mndw-table></div>',2),vO=z('<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 bO(t,e){Ie(e,!0);let n=Y(it([])),r=Y(it({})),i=Y(!1),s=Y(!1),o=Y(!1),a=Y(!1),l=Y(it({})),c=0,u;const d=3,h=fe(()=>f(n).map(U=>({service:U,busy:f(a),rowError:f(r)[U.name]??!1}))),p=Ks()(iO),g=Ks()(aO),m=pO((U,re)=>void q(U,re)),_=dO((U,re)=>void B(U,re)),k=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:_})]);function O(U,re){b(n,f(n).map(X=>X.name===U?re:X),!0)}function I(U){O(U.name,U)}async function R(U,re,X){let ve=0;const Ze=async()=>{for(;ve<U.length;){const nt=U[ve++];nt!==void 0&&await X(nt)}};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 T(U,re,X){const ve=f(l)[U.name]??0;try{const Ze=await la.status(U.name,X);A(U.name,re,ve,X)&&I(Ze)}catch{A(U.name,re,ve,X)&&b(r,{...f(r),[U.name]:!0},!0)}}async function M(U,re,X){await R(U,d,ve=>T(ve,re,X))}async function N(){u==null||u.abort(),u=new AbortController;const U=++c;b(i,!0),b(s,!1),b(o,!1),b(r,{},!0),b(l,{},!0);try{const re=await la.list();if(c!==U)return;b(n,re,!0),b(i,!1),await M(re,U,u.signal)}catch(re){if(c!==U||u.signal.aborted)return;b(n,[],!0),b(s,re instanceof tl&&re.code==="SERVICE_UNAVAILABLE",!0),b(o,!f(s)),b(i,!1)}finally{c===U&&b(i,!1)}}async function j(U,re){return(await ls(el,{title:w("services.confirm-title"),props:{message:U,confirmLabel:re}}).closed).result===!0}async function H(U,re){return j(w("services.confirm",{action:U,name:re}),w(`services.${U}`))}async function se(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 B(U,re){if(!f(a)&&!((U==="stop"||U==="restart")&&!await H(U,re))){b(l,{...f(l),[re]:(f(l)[re]??0)+1},!0),b(a,!0);try{const X=await la[U](re);I(X.service),b(r,{...f(r),[re]:!1},!0)}catch{b(r,{...f(r),[re]:!0},!0)}finally{b(a,!1)}}}async function q(U,re){if(f(a)||U.protected||U.autostartPinned)return;const X=U.name;if(await se(X,re)){b(l,{...f(l),[X]:(f(l)[X]??0)+1},!0),b(a,!0);try{const ve=await la.setEnabled(X,re);O(X,ve.service),b(r,{...f(r),[X]:!1},!0)}catch(ve){ve instanceof tl&&ve.code==="CONFLICT"?(O(X,{...U,autostartPinned:!0}),b(r,{...f(r),[X]:!1},!0)):b(r,{...f(r),[X]:!0},!0)}finally{b(a,!1)}}}zn(()=>(N(),()=>u==null?void 0:u.abort()));var ee=vO(),te=v(ee),W=v(te),J=v(W),ne=v(J),le=x(J,2),oe=v(le),ue=x(W,2);P(ue,"variant","secondary"),y(()=>P(ue,"disabled",f(i)||f(a)));var De=v(ue),Ye=x(te,2);{var je=U=>{var re=gO(),X=v(re),ve=v(X),Ze=x(X),nt=v(Ze);y((yt,Ut)=>{S(ve,yt),S(nt,Ut)},[()=>w("services.unavailable"),()=>w("services.unavailable-description")]),C(U,re)},Ke=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=mO(),X=v(re);y(()=>P(X,"columns",f(k))),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"))),Ne(X,1,"svelte-3v3gj2"),C(U,re)};Z(Ye,U=>{f(s)?U(je):f(o)?U(Ke,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(oe,re),S(De,X)},[()=>w("services.title"),()=>w("services.description"),()=>w("services.refresh")]),pe("click",ue,()=>void N()),C(t,ee),Le()}at(["click"]);function Nu(t){return t==="services"?"/packages/services":"/packages"}function _O(t){const e=t.replace(/\/+$/,"")||"/";return e==="/packages"?"packages":e==="/packages/services"?"services":null}const Kh=[{id:"packages",path:Nu("packages"),labelKey:"packages.tab"},{id:"services",path:Nu("services"),labelKey:"services.tab"}];var wO=z("<mndw-tab> </mndw-tab>",2),yO=z('<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 kO(t,e){Ie(e,!0);const n=fe(()=>{const p=(Jt==null?void 0:Jt.route.pathname)??globalThis.location.pathname;return _O(p)??"packages"});function r(p){const g=Kh.find(m=>m.id===p.detail.value);g!==void 0&&Jt!==void 0&&Jt.navigate(Nu(g.id))}var i=yO(),s=v(i);Ne(s,1,"mndw-table-controls"),y(()=>P(s,"value",f(n)));var o=v(s);ft(o,17,()=>Kh,p=>p.id,(p,g)=>{var m=wO();y(()=>P(m,"id",f(g).id));var _=v(m);y(k=>S(_,k),[()=>w(f(g).labelKey)]),C(p,m)});var a=x(o,2);P(a,"for","packages");var l=v(a);{var c=p=>{KM(p,{})};Z(l,p=>{f(n)==="packages"&&p(c)})}var u=x(a,2);P(u,"for","services");var d=v(u);{var h=p=>{bO(p,{})};Z(d,p=>{f(n)==="services"&&p(h)})}y(()=>Ae(i,"data-locale",me.locale)),ut("mndwchange",s,r),C(t,i),Le()}function Qh(t){kO(t,{})}const ep=4096,tp=[{title:"mndwd diagnostics",path:"/api/mndw/diagnostics/export",method:"POST"},{title:"persistent rci-session capability",path:"/api/mndw/rci-session/capability"}],EO=[/(["']?(?: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],SO={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()}},xO={request:Gs,now:()=>new Date,browser:SO};async function TO(t=xO){const n=(await Promise.allSettled(tp.map(async c=>{const u={headers:Xt};return"method"in c&&(u.method=c.method),await PO(await t.request(c.path,u))}))).map((c,u)=>{const d=tp[u];return c.status==="fulfilled"?{title:d.title,value:c.value}:{title:d.title,error:RO(c.reason)}}),r=t.now(),i=CO(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-${MO(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 CO(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: ${nl(r.error)}`);else{const i=JSON.stringify(r.value,null,2);n.push(i===void 0?"undefined":i)}n.push("")}return AO(n.join(`
89
- `))}async function PO(t){if(!t.ok){let e="";try{e=nl(await t.text())}catch{e=""}throw new Error(`HTTP ${t.status}${e===""?"":`: ${e}`}`)}return await t.json()}function RO(t){return t instanceof Error?nl(t.message):nl(String(t))}function nl(t){return t.length>ep?`${t.slice(0,ep)}…`:t}function AO(t){let e=t;for(const n of EO)e=e.replace(n,"$1[REDACTED]");return e}function MO(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 OO=z('<p role="alert" class="svelte-np0xnl"> </p>'),NO=z('<section class="mndw-diagnostics-settings svelte-np0xnl"><h3 class="svelte-np0xnl"> </h3> <p class="svelte-np0xnl"> </p> <mndw-button> </mndw-button> <!></section>',2);function zO(t,e){Ie(e,!0);let n=Y(!1),r=Y("");async function i(){b(n,!0),b(r,"");try{await TO()}catch{b(r,w("settings.diagnostics-failed"),!0)}finally{b(n,!1)}}var s=NO(),o=v(s),a=v(o),l=x(o,2),c=v(l),u=x(l,2);P(u,"variant","secondary"),y(()=>P(u,"disabled",f(n)));var d=v(u),h=x(u,2);{var p=g=>{var m=OO(),_=v(m);y(()=>S(_,f(r))),C(g,m)};Z(h,g=>{f(r)&&g(p)})}y((g,m,_,k)=>{Ae(s,"data-locale",me.locale),Ae(s,"aria-label",g),S(a,m),S(c,_),S(d,k)},[()=>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()}at(["click"]);var IO=z("<mndw-button>Export palette</mndw-button>",2);function LO(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=IO();P(r,"variant","secondary"),y(()=>P(r,"disabled",e.disabled)),pe("click",r,n),C(t,r),Le()}at(["click"]);var DO=z('<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 HO(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=nv(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=DO(),a=v(o);y(l=>{Ae(a,"aria-label",l),a.disabled=e.disabled},[()=>w("settings.palette-import-aria-label")]),ut("dragover",o,l=>l.preventDefault()),ut("drop",o,s),pe("change",a,i),C(t,o),Le()}at(["change"]);var BO=z('<li class="svelte-1cguif5"><span class="mndw-palette-preview__chip svelte-1cguif5"></span> </li>'),$O=z('<div><h4> </h4> <ul class="mndw-palette-preview__swatches svelte-1cguif5"></ul></div>'),UO=z("<li> </li>"),jO=z('<div class="mndw-palette-preview__warnings svelte-1cguif5"><h4> </h4> <ul></ul></div>'),FO=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),GO=z(`<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 VO(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=GO(),s=x(v(i),2);ft(s,16,()=>n,h=>h,(h,p)=>{var g=$O(),m=v(g),_=v(m),k=x(m,2);ft(k,21,()=>fd,O=>O.token,(O,I)=>{var R=BO(),A=v(R),T=x(A);y(()=>{to(A,`background: ${e.palette[p][f(I).token]??""}`),S(T,` ${f(I).token??""}`)}),C(O,R)}),y(()=>S(_,p)),C(h,g)});var o=x(s,2);ft(o,17,()=>f(r),h=>h.theme,(h,p)=>{var g=kn(),m=Xe(g);{var _=k=>{var O=jO(),I=v(O),R=v(I),A=x(I,2);ft(A,21,()=>f(p).entries,T=>T.pair,(T,M)=>{var N=UO(),j=v(N);y(()=>S(j,`${f(M).pair??""}: ${f(M).ratio??""} (needs ${f(M).min??""})`)),C(T,N)}),y(()=>S(R,`Contrast warnings (${f(p).theme??""})`)),C(k,O)};Z(m,k=>{f(p).entries.length>0&&k(_)})}C(h,g)});var a=x(o,2);{var l=h=>{var p=FO(),g=v(p);y(()=>S(g,e.error)),C(h,p)};Z(a,h=>{e.error&&h(l)})}var c=x(a,2),u=v(c);P(u,"variant","primary"),y(()=>P(u,"disabled",e.busy));var d=x(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()}at(["click"]);var ZO=z("<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),WO=z("<mndw-button> </mndw-button>",2),qO=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),XO=z('<div class="mndw-palette-reset svelte-16mndpw"><!> <!></div>');function YO(t,e){Ie(e,!0);let n=Y(!1);function r(){e.busy||e.disabled||b(n,!0)}function i(){b(n,!1),e.onReset()}var s=XO(),o=v(s);{var a=d=>{var h=ZO(),p=x(Xe(h),2);P(p,"variant","danger"),y(()=>P(p,"disabled",e.busy||e.disabled));var g=x(p,2);P(g,"variant","secondary"),y(()=>P(g,"disabled",e.busy||e.disabled)),pe("click",p,i),pe("click",g,()=>b(n,!1)),C(d,h)},l=d=>{var h=WO();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=x(o,2);{var u=d=>{var h=qO(),p=v(h);y(()=>S(p,e.error)),C(d,h)};Z(c,d=>{e.error&&d(u)})}C(t,s),Le()}at(["click"]);var JO=z('<div class="mndw-alert mndw-alert--danger" role="alert"> <mndw-button>Retry</mndw-button> <mndw-button>Dismiss</mndw-button></div>',2),KO=z('<p role="status">Loading palette...</p>'),QO=z('<p role="status">Reading palette...</p>'),eN=z("<li> </li>"),tN=z('<div class="mndw-alert mndw-alert--danger" role="alert"><ul></ul> <mndw-button>Dismiss</mndw-button></div>',2),nN=z('<p role="status">Saved.</p>'),rN=z('<!> <!> <!> <!> <div class="mndw-palette-manager__actions svelte-1adkxr0"><!> <!></div>',1),iN=z('<section class="mndw-palette-manager svelte-1adkxr0"><h3>Palette</h3> <!> <!> <!></section>');function sN(t,e){Ie(e,!0);let n=Y("loading");const r=Rr().palette;let i=Y(""),s=Y(it([])),o=Y(""),a=Y(""),l=Y(!1),c=Y(null),u=Y(it([])),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")){b(n,"loading");try{await r.refreshPalette(),b(i,"")}catch(te){b(i,sr(te),!0)}finally{b(n,"idle")}}}function m(){b(i,"")}zn(()=>{g()});function _(){b(s,[],!0),b(o,""),b(l,!1),b(n,"importing")}function k(te,W){b(s,[],!0),b(o,""),b(l,!1),b(c,te,!0),b(u,W,!0),r.previewOverride(te),b(n,"previewing")}function O(te){b(s,te,!0),b(n,"importError")}function I(){b(s,[],!0),b(n,"idle")}async function R(){if(f(c)!==null){b(n,"committing"),b(o,"");try{await r.commitOverride(f(c)),b(c,null),b(u,[],!0),b(l,!0),b(n,"idle")}catch(te){b(o,sr(te),!0),b(n,"previewing")}}}function A(){r.discardPreview(),b(c,null),b(u,[],!0),b(o,""),b(n,"idle")}async function T(){b(n,"resetting"),b(a,"");try{await r.resetToDefault(),b(l,!1)}catch(te){b(a,sr(te),!0)}finally{b(n,"idle")}}var M=iN(),N=x(v(M),2);{var j=te=>{var W=JO(),J=v(W),ne=x(J);P(ne,"variant","secondary"),y(()=>P(ne,"disabled",f(n)!=="idle"));var le=x(ne,2);P(le,"variant","ghost"),y(()=>S(J,`${f(i)??""} `)),pe("click",ne,()=>void g()),pe("click",le,m),C(te,W)};Z(N,te=>{f(i)&&te(j)})}var H=x(N,2);{var se=te=>{var W=KO();C(te,W)};Z(H,te=>{f(n)==="loading"&&te(se)})}var B=x(H,2);{var q=te=>{var W=kn(),J=Xe(W);{var ne=le=>{{let oe=fe(()=>f(n)==="committing");VO(le,{get busy(){return f(oe)},get error(){return f(o)},onConfirm:()=>void R(),onDiscard:A,get palette(){return f(c)},get warnings(){return f(u)}})}};Z(J,le=>{f(c)&&le(ne)})}C(te,W)},ee=te=>{var W=rN(),J=Xe(W);{var ne=ae=>{var U=QO();C(ae,U)};Z(J,ae=>{f(n)==="importing"&&ae(ne)})}var le=x(J,2);HO(le,{get disabled(){return f(d)},onErrors:O,onImportStart:_,onPreview:k});var oe=x(le,2);{var ue=ae=>{var U=tN(),re=v(U);ft(re,20,()=>f(s),ve=>ve,(ve,Ze)=>{var nt=eN(),yt=v(nt);y(()=>S(yt,Ze)),C(ve,nt)});var X=x(re,2);P(X,"variant","ghost"),pe("click",X,I),C(ae,U)};Z(oe,ae=>{f(n)==="importError"&&ae(ue)})}var De=x(oe,2);{var Ye=ae=>{var U=nN();C(ae,U)};Z(De,ae=>{f(l)&&ae(Ye)})}var je=x(De,2),Ke=v(je);LO(Ke,{get disabled(){return f(h)},get read(){return r.getExportable}});var ce=x(Ke,2);{let ae=fe(()=>f(n)==="resetting");YO(ce,{get busy(){return f(ae)},get disabled(){return f(p)},get error(){return f(a)},onReset:()=>void T()})}C(te,W)};Z(B,te=>{f(n)==="previewing"||f(n)==="committing"?te(q):te(ee,-1)})}C(t,M),Le()}at(["click"]);var oN=z("<mndw-option>Pseudo (en-XA)</mndw-option>",2),aN=z('<span role="status"> </span>'),lN=z("<ul><li><strong> </strong> </li> <li><strong> </strong> </li> <li><strong> </strong> </li></ul>"),np=z("<p> </p>"),si=z('<p role="alert"> </p>'),cN=z('<p role="alert"> </p> <!>',1),rp=z('<p role="status"> </p>'),ip=z("<li> <!></li>"),sp=z("<ul></ul>"),op=z('<div class="persistent-rci-extenders svelte-1vnn4f1"><h4> </h4> <!> <!></div>'),uN=z("<mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <!> <!>",3),dN=z("<mndw-button> </mndw-button>",2),fN=z('<p class="unsupported-banner svelte-1vnn4f1" role="alert"> </p>'),hN=z('<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),pN=z("<mndw-field><mndw-switch></mndw-switch></mndw-field> <!> <!> <!> <!>",3),gN=z("<section><h3> </h3> <!></section>"),mN=z("<section><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <p> </p> <p> </p> <!></section>",2),vN=z('<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 bN(t,e){Ie(e,!0);const n=Rr(),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,_=Y(!1),k=Y(!0),O=Y(""),I=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"})}),zn(()=>{R(),A()}),Io(()=>{b(p,""),m==null||m.abort(),m=null});async function R(){b(u,!0),b(h,"");try{b(s,await i.getCapability(),!0),b(c,f(s).controller.enabled||f(s).controller.support==="needs-token",!0),te()}catch{b(s,null),b(c,!1)}finally{b(u,!1)}}async function A(){b(k,!0),b(O,"");try{b(_,(await n.mgmtClient.getTelemetry()).enabled,!0)}catch{b(O,w("settings.telemetry-error"),!0)}finally{b(k,!1)}}function T(V){const ge=V.detail.checked??V.detail.value??!1,Ce=f(_);b(_,ge,!0),b(O,""),b(k,!0),n.mgmtClient.setTelemetry(ge).catch(()=>{b(_,Ce,!0),b(O,w("settings.telemetry-error"),!0)}).finally(()=>{b(k,!1)})}function M(V){b(c,V.detail.checked??V.detail.value??!1,!0),b(g,null),b(h,""),f(c)||(b(p,""),m==null||m.abort(),m=null)}async function N(V){var Ge;const ge=V.detail.checked??V.detail.value??!1,Ce=((Ge=f(s))==null?void 0:Ge.controller.enabled)??!1;b(d,!0),f(s)&&b(s,{...f(s),controller:{...f(s).controller,enabled:ge}},!0),b(h,"");try{await i.setEnabled(ge),await R()}catch(Qe){f(s)&&b(s,{...f(s),controller:{...f(s).controller,enabled:Ce}},!0),await R(),b(h,H(Qe),!0)}finally{b(d,!1)}}function j(V){b(p,V.detail.value,!0)}function H(V){if(V instanceof Qn){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 se(){b(d,!0),b(h,""),b(g,null);try{b(g,await i.testController(f(p)),!0)}catch(V){b(h,H(V),!0)}finally{b(d,!1)}}async function B(){b(d,!0),b(h,""),b(g,null);try{b(g,await i.saveController(f(p)),!0),b(p,""),await R()}catch(V){b(h,H(V),!0)}finally{b(p,""),b(d,!1)}}async function q(){b(d,!0),b(h,"");try{await i.clearController(),b(c,!1),b(p,""),b(g,null),await R()}catch(V){b(h,H(V),!0)}finally{b(d,!1)}}function ee(V){me.localeSwitchPending||r.setLocale(V.detail.value).catch(()=>{})}function te(){if(m==null||m.abort(),!f(s)||!W(f(s))){m=null;return}const V=new AbortController;m=V,J(V.signal)}function W(V){return V.controller.support==="invalid"||V.extenders.some(ge=>ge.state==="establishing"||ge.state==="dead")}async function J(V){let ge=null;for(;!V.aborted&&f(s)&&W(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{b(s,await i.getCapability(),!0)}catch{}}}var ne=vN(),le=v(ne),oe=v(le),ue=v(oe),De=x(oe,2);y(()=>P(De,"label",w("settings.dark-theme"))),Ne(De,1,"svelte-1vnn4f1");var Ye=v(De);P(Ye,"id","mndw-theme-switch"),y(()=>P(Ye,"checked",me.theme==="dark"));var je=x(le,2);sN(je,{});var Ke=x(je,2),ce=v(Ke),ae=v(ce),U=x(ce,2);y(()=>P(U,"label",w("settings.language.label"))),Ne(U,1,"svelte-1vnn4f1");var re=v(U);y(()=>P(re,"value",me.locale)),y(()=>P(re,"disabled",me.localeSwitchPending));var X=v(re);P(X,"value","en");var ve=v(X),Ze=x(X,2);P(Ze,"value","ru");var nt=v(Ze),yt=x(Ze,2);{var Ut=V=>{var ge=oN();P(ge,"value","en-XA"),C(V,ge)},on=fe(()=>r.getAvailableLocales().includes("en-XA"));Z(yt,V=>{f(on)&&V(Ut)})}var qn=x(re,2);{var En=V=>{var ge=aN(),Ce=v(ge);y(Ge=>S(Ce,Ge),[()=>w("settings.language.pending")]),C(V,ge)};Z(qn,V=>{me.localeSwitchPending&&V(En)})}var Xn=x(U,2);{var Yn=V=>{var ge=lN(),Ce=v(ge),Ge=v(Ce),Qe=v(Ge),lt=x(Ge),xt=x(Ce,2),$e=v(xt),He=v($e),We=x($e),Re=x(xt,2),L=v(Re),K=v(L),we=x(L);y((_e,kt,pt)=>{S(Qe,_e),S(lt,` ${me.deviceInfo.deviceName??""}`),S(He,kt),S(We,` ${me.deviceInfo.vendor??""}`),S(K,pt),S(we,` ${me.deviceInfo.firmwareVersion??""}`)},[()=>w("settings.name"),()=>w("settings.vendor"),()=>w("settings.firmware")]),C(V,ge)},cr=V=>{var ge=np(),Ce=v(ge);y(Ge=>S(Ce,Ge),[()=>w("settings.device-unavailable")]),C(V,ge)};Z(Xn,V=>{me.deviceInfo?V(Yn):V(cr,-1)})}var an=x(Ke,2);{var ur=V=>{var ge=gN(),Ce=v(ge),Ge=v(Ce),Qe=x(Ce,2);{var lt=He=>{var We=cN(),Re=Xe(We),L=v(Re),K=x(Re,2);{var we=_e=>{var kt=si(),pt=v(kt);y(()=>S(pt,f(h))),C(_e,kt)};Z(K,_e=>{f(h)&&_e(we)})}y(_e=>S(L,_e),[()=>w("settings.persistent-state-unavailable")]),C(He,We)},xt=He=>{var We=uN(),Re=Xe(We);y(()=>P(Re,"label",w("settings.persistent-tokenless-toggle"))),Ne(Re,1,"svelte-1vnn4f1");var L=v(Re);P(L,"id","mndw-persistent-rci-enabled"),y(()=>{var Lt;return P(L,"checked",((Lt=f(s))==null?void 0:Lt.controller.enabled)??!1)}),y(()=>P(L,"disabled",f(d)));var K=x(Re,2),we=v(K),_e=x(K,2);{var kt=Lt=>{var Sn=si(),Ar=v(Sn);y(()=>S(Ar,f(h))),C(Lt,Sn)};Z(_e,Lt=>{f(h)&&Lt(kt)})}var pt=x(_e,2);{var Jn=Lt=>{var Sn=op(),Ar=v(Sn),Et=v(Ar),ot=x(Ar,2);{var Ot=ie=>{var Be=rp(),Je=v(Be);y(gt=>S(Je,gt),[()=>w("settings.persistent-enumeration-stale")]),C(ie,Be)};Z(ot,ie=>{f(s).stale&&ie(Ot)})}var qt=x(ot,2);{var F=ie=>{var Be=sp();ft(Be,21,()=>f(s).extenders,Je=>Je.identity,(Je,gt)=>{var Mr=ip(),Ti=v(Mr),Ci=x(Ti);{var ws=Kn=>{var Nt=Ds();y(Tt=>S(Nt,Tt),[()=>w(`settings.extender-reason-${f(gt).reason}`)]),C(Kn,Nt)},ys=Kn=>{var Nt=Ds();y(Tt=>S(Nt,Tt),[()=>w(`settings.extender-state-${f(gt).state??"establishing"}`)]),C(Kn,Nt)};Z(Ci,Kn=>{f(gt).eligible?Kn(ys,-1):Kn(ws)})}y(()=>S(Ti,`${(f(gt).name||f(gt).identity)??""}: `)),C(Je,Mr)}),C(ie,Be)};Z(qt,ie=>{f(s).extenders.length>0&&ie(F)})}y(ie=>S(Et,ie),[()=>w("settings.persistent-extenders-title")]),C(Lt,Sn)};Z(pt,Lt=>{var Sn;((Sn=f(s))==null?void 0:Sn.controller.support)==="supported"&&Lt(Jn)})}y(Lt=>S(we,Lt),[()=>w("settings.persistent-tokenless-description")]),ut("mndwchange",L,Lt=>void N(Lt)),C(He,We)},$e=He=>{var We=pN(),Re=Xe(We);y(()=>P(Re,"label",w("settings.configure-persistent"))),Ne(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 K=x(Re,2);{var we=Et=>{var ot=si(),Ot=v(ot);y(()=>S(Ot,f(h))),C(Et,ot)};Z(K,Et=>{f(h)&&Et(we)})}var _e=x(K,2);{var kt=Et=>{var ot=si(),Ot=v(ot);y(qt=>S(Ot,qt),[()=>w("settings.persistent-storage-disabled")]),C(Et,ot)},pt=Et=>{var ot=si(),Ot=v(ot);y(qt=>S(Ot,qt),[()=>w("settings.persistent-storage-decrypt-failed")]),C(Et,ot)};Z(_e,Et=>{var ot,Ot;((ot=f(s))==null?void 0:ot.store.state)==="disabled"?Et(kt):((Ot=f(s))==null?void 0:Ot.store.state)==="decrypt-failed"&&Et(pt,1)})}var Jn=x(_e,2);{var Lt=Et=>{var ot=si(),Ot=v(ot);y(qt=>S(Ot,qt),[()=>w("settings.persistent-needs-token")]),C(Et,ot)};Z(Jn,Et=>{var ot;((ot=f(s))==null?void 0:ot.controller.support)==="needs-token"&&Et(Lt)})}var Sn=x(Jn,2);{var Ar=Et=>{var ot=hN(),Ot=Xe(ot);y(()=>P(Ot,"label",w("settings.controller-token"))),Ne(Ot,1,"svelte-1vnn4f1");var qt=v(Ot);P(qt,"type","password"),P(qt,"autocomplete","off"),y(()=>P(qt,"placeholder",f(l))),y(()=>P(qt,"value",f(p))),y(()=>P(qt,"disabled",f(d)));var F=x(Ot,2),ie=v(F);P(ie,"variant","secondary"),y(()=>P(ie,"disabled",f(d)||f(p)===""));var Be=v(ie),Je=x(ie,2);P(Je,"variant","primary"),y(()=>P(Je,"disabled",f(d)||f(p)===""));var gt=v(Je),Mr=x(Je,2);{var Ti=Nt=>{var Tt=dN();P(Tt,"variant","danger"),y(()=>P(Tt,"disabled",f(d)));var Pi=v(Tt);y(ks=>S(Pi,ks),[()=>w("settings.clear-controller-session")]),pe("click",Tt,()=>void q()),C(Nt,Tt)};Z(Mr,Nt=>{f(a)&&Nt(Ti)})}var Ci=x(F,2);{var ws=Nt=>{var Tt=kn(),Pi=Xe(Tt);{var ks=Or=>{var ni=fN(),Es=v(ni);y(mn=>S(Es,mn),[()=>w("settings.update-firmware-persistent")]),C(Or,ni)},Go=Or=>{var ni=np(),Es=v(ni);y(mn=>S(Es,mn),[()=>w("settings.controller-result",{result:f(g).result})]),C(Or,ni)};Z(Pi,Or=>{f(g).result==="unsupported-firmware"?Or(ks):Or(Go,-1)})}C(Nt,Tt)};Z(Ci,Nt=>{f(g)&&Nt(ws)})}var ys=x(Ci,2);{var Kn=Nt=>{var Tt=op(),Pi=v(Tt),ks=v(Pi),Go=x(Pi,2);{var Or=mn=>{var Ss=rp(),xs=v(Ss);y(ri=>S(xs,ri),[()=>w("settings.persistent-enumeration-stale")]),C(mn,Ss)};Z(Go,mn=>{f(s).stale&&mn(Or)})}var ni=x(Go,2);{var Es=mn=>{var Ss=sp();ft(Ss,21,()=>f(s).extenders,xs=>xs.identity,(xs,ri)=>{var Fd=ip(),Gd=v(Fd),ib=x(Gd);{var sb=Ri=>{var Ts=Ds();y($l=>S(Ts,$l),[()=>w(`settings.extender-reason-${f(ri).reason}`)]),C(Ri,Ts)},ob=Ri=>{var Ts=Ds();y($l=>S(Ts,$l),[()=>w(`settings.extender-state-${f(ri).state??"establishing"}`)]),C(Ri,Ts)};Z(ib,Ri=>{f(ri).eligible?Ri(ob,-1):Ri(sb)})}y(()=>S(Gd,`${(f(ri).name||f(ri).identity)??""}: `)),C(xs,Fd)}),C(mn,Ss)};Z(ni,mn=>{f(s).extenders.length>0&&mn(Es)})}y(mn=>S(ks,mn),[()=>w("settings.persistent-extenders-title")]),C(Nt,Tt)};Z(ys,Nt=>{var Tt;((Tt=f(s))==null?void 0:Tt.controller.support)==="supported"&&Nt(Kn)})}y((Nt,Tt)=>{S(Be,Nt),S(gt,Tt)},[()=>w("settings.test"),()=>w("settings.save")]),ut("mndwinput",qt,j),pe("click",ie,()=>void se()),pe("click",Je,()=>void B()),C(Et,ot)};Z(Sn,Et=>{var ot;(f(c)||((ot=f(s))==null?void 0:ot.controller.support)==="needs-token")&&Et(Ar)})}ut("mndwchange",L,M),C(He,We)};Z(Qe,He=>{f(o)==="unknown"?He(lt):f(o)==="none"?He(xt,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(ur)})}var Ee=x(an,2);{var ze=V=>{var ge=mN(),Ce=v(ge),Ge=v(Ce),Qe=x(Ce,2);y(()=>P(Qe,"label",w("settings.telemetry-toggle"))),Ne(Qe,1,"svelte-1vnn4f1");var lt=v(Qe);P(lt,"id","mndw-telemetry-enabled"),y(()=>P(lt,"checked",f(_))),y(()=>P(lt,"disabled",f(k)));var xt=x(Qe,2),$e=v(xt),He=x(xt,2),We=v(He),Re=x(He,2),L=v(Re),K=x(Re,2);{var we=_e=>{var kt=si(),pt=v(kt);y(()=>S(pt,f(O))),C(_e,kt)};Z(K,_e=>{f(O)&&_e(we)})}y((_e,kt,pt,Jn)=>{S(Ge,_e),S($e,kt),S(We,pt),S(L,Jn)},[()=>w("settings.telemetry-label"),()=>w("settings.telemetry-description"),()=>w("settings.telemetry-session-note"),()=>w("settings.telemetry-wear-note")]),ut("mndwchange",lt,T),C(V,ge)};Z(Ee,V=>{f(I)&&V(ze)})}y((V,ge,Ce,Ge)=>{Ae(ne,"data-locale",me.locale),S(ue,V),S(ae,ge),S(ve,Ce),S(nt,Ge)},[()=>w("settings.appearance"),()=>w("settings.device"),()=>w("settings.language.english"),()=>w("settings.language.russian")]),ut("mndwchange",Ye,function(...V){Fi==null||Fi.apply(this,V)}),ut("mndwchange",re,ee),C(t,ne),Le()}at(["click"]);var _N=z('<p class="mndw-installed__empty svelte-egoe9l"> </p>'),wN=z('<span class="mndw-installed__builtin svelte-egoe9l"> </span>'),yN=z('<span class="mndw-installed__deps-badge svelte-egoe9l"> </span>'),kN=z('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed svelte-egoe9l"> </span>'),EN=z('<span class="mndw-installed__version-badge svelte-egoe9l"> </span>'),SN=z('<p class="mndw-installed__version-warning svelte-egoe9l"> </p>'),xN=z('<p class="mndw-installed__backend svelte-egoe9l"> </p>'),TN=z("<mndw-field><mndw-switch></mndw-switch></mndw-field>",2),Ic=z("<mndw-button> </mndw-button>",2),CN=z('<div class="mndw-alert mndw-alert--danger" role="alert"> <!></div>'),PN=z('<div class="mndw-installed__confirmation svelte-egoe9l"><p class="svelte-egoe9l"> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),RN=z('<div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button> <!> <!></div>',2),AN=z("<span> </span>"),MN=z('<span class="mndw-installed__runtime-warning svelte-egoe9l"> </span>'),ON=z('<p class="mndw-installed__runtime-warning svelte-egoe9l"> </p>'),NN=z('<p class="mndw-installed__runtime svelte-egoe9l"> <!> <!> <!></p> <!>',1),zN=z('<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>'),IN=z('<ul class="mndw-installed__list svelte-egoe9l"></ul>'),LN=z('<section class="mndw-installed svelte-egoe9l" aria-labelledby="mndw-installed-title"><h3 id="mndw-installed-title" class="svelte-egoe9l"> </h3> <!></section>');function DN(t,e){Ie(e,!0);function n(I,R,A){return w(I===1?R:A,{count:I})}function r(I){const R=[],A=Object.values(I.routes??{}),T=A.filter(N=>N.transport==="http").length,M=A.filter(N=>N.transport==="websocket").length;return T>0&&R.push(n(T,"settings.plugin-manager.endpoint-one","settings.plugin-manager.endpoint-many")),M>0&&R.push(n(M,"settings.plugin-manager.websocket-one","settings.plugin-manager.websocket-many")),R}function i(I){return I.length>240?`${I.slice(0,240)}…`:I}function s(I,R){var A;return((A=I.permissionGrants)==null?void 0:A[R])??!1}function o(I){return I.endsWith(":write")?w("settings.plugin-manager.persistent-rci-write"):w("settings.plugin-manager.persistent-rci-read")}function a(I){switch(I){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=LN(),g=v(p),m=v(g),_=x(g,2);{var k=I=>{var R=_N(),A=v(R);y(T=>S(A,T),[()=>w("settings.plugin-manager.no-installed")]),C(I,R)},O=I=>{var R=IN();ft(R,21,()=>e.items,A=>A.name,(A,T)=>{const M=fe(()=>r(f(T).backend)),N=fe(()=>tR(f(T).name)),j=fe(()=>jo(f(T).name)),H=fe(()=>l()(f(T).name)),se=fe(()=>{var Ee,ze;return((Ee=f(H))==null?void 0:Ee.state)==="working"||((ze=f(H))==null?void 0:ze.state)==="reconciling"});var B=zN(),q=v(B),ee=v(q),te=v(ee),W=x(ee,2),J=v(W),ne=x(q,2),le=v(ne),oe=v(le),ue=x(le,2),De=v(ue),Ye=x(ue,2),je=v(Ye),Ke=x(Ye,2);{var ce=Ee=>{var ze=wN(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.builtin")]),C(Ee,ze)};Z(Ke,Ee=>{f(T).source==="builtin"&&Ee(ce)})}var ae=x(Ke,2);{var U=Ee=>{var ze=yN(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.installing-dependencies")]),C(Ee,ze)},re=Ee=>{var ze=kN(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.dependency-install-failed")]),C(Ee,ze)};Z(ae,Ee=>{f(j)==="installing"?Ee(U):f(j)==="failed"&&Ee(re,1)})}var X=x(ae,2);{var ve=Ee=>{var ze=EN(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.version-mismatch")]),C(Ee,ze)};Z(X,Ee=>{f(N).length>0&&Ee(ve)})}var Ze=x(ne,2);{var nt=Ee=>{var ze=SN(),V=v(ze);y(ge=>S(V,ge),[()=>w("settings.plugin-manager.load-version-warning",{versions:f(N).join(", ")})]),C(Ee,ze)};Z(Ze,Ee=>{f(N).length>0&&Ee(nt)})}var yt=x(Ze,2);{var Ut=Ee=>{var ze=xN(),V=v(ze);y(ge=>S(V,ge),[()=>f(M).join(", ")]),C(Ee,ze)};Z(yt,Ee=>{f(M).length>0&&Ee(Ut)})}var on=x(yt,2);{var qn=Ee=>{var ze=kn(),V=Xe(ze);ft(V,16,()=>dd,ge=>ge,(ge,Ce)=>{var Ge=kn(),Qe=Xe(Ge);{var lt=$e=>{var He=TN();Ne(He,1,"mndw-installed__permission-switch"),y(()=>P(He,"label",o(Ce)));var We=v(He);y(()=>P(We,"checked",s(f(T),Ce))),y(()=>P(We,"disabled",f(se)||!s(f(T),Ce)&&!u())),ut("mndwchange",We,Re=>e.onPermissionChange(f(T).name,Ce,Re.detail.checked)),C($e,He)},xt=fe(()=>{var $e;return($e=f(T).permissions)==null?void 0:$e.includes(Ce)});Z(Qe,$e=>{f(xt)&&$e(lt)})}C(ge,Ge)}),C(Ee,ze)};Z(on,Ee=>{c()&&Ee(qn)})}var En=x(on,2);{var Xn=Ee=>{var ze=CN(),V=v(ze),ge=x(V);{var Ce=Ge=>{var Qe=Ic();Ne(Qe,1,"mndw-installed__refresh"),P(Qe,"variant","ghost");var lt=v(Qe);y(xt=>S(lt,xt),[()=>w("settings.plugin-manager.refresh")]),pe("click",Qe,function(...xt){var $e;($e=h())==null||$e.apply(this,xt)}),C(Ge,Qe)};Z(ge,Ge=>{var Qe;((Qe=f(H))==null?void 0:Qe.state)==="notice-finishing"&&Ge(Ce)})}y(()=>{var Ge;return S(V,`${((Ge=f(H))==null?void 0:Ge.message)??""} `)}),C(Ee,ze)};Z(En,Ee=>{var ze;f(H)!==void 0&&((ze=f(H))==null?void 0:ze.message)!==""&&Ee(Xn)})}var Yn=x(En,2);{var cr=Ee=>{var ze=RN(),V=v(ze);Ne(V,1,"mndw-installed__toggle"),P(V,"variant","primary"),y(()=>P(V,"disabled",f(se)));var ge=v(V),Ce=x(V,2);{var Ge=$e=>{var He=Ic();Ne(He,1,"mndw-installed__restart"),P(He,"variant","secondary"),y(()=>P(He,"disabled",f(se)));var We=v(He);y(Re=>S(We,Re),[()=>w("settings.plugin-manager.restart-backend")]),pe("click",He,()=>d()(f(T).name)),C($e,He)};Z(Ce,$e=>{f(T).runtime&&f(T).runtime.state!=="stopped"&&$e(Ge)})}var Qe=x(Ce,2);{var lt=$e=>{var He=PN(),We=v(He),Re=v(We),L=x(We,2);Ne(L,1,"mndw-installed__cancel"),P(L,"variant","ghost"),y(()=>P(L,"disabled",f(se)));var K=v(L),we=x(L,2);Ne(we,1,"mndw-installed__confirm"),P(we,"variant","danger"),y(()=>P(we,"disabled",f(se)));var _e=v(we);y((kt,pt,Jn)=>{S(Re,kt),S(K,pt),S(_e,Jn)},[()=>w("settings.plugin-manager.delete-confirmation",{label:f(T).label}),()=>w("settings.plugin-manager.cancel"),()=>w("settings.plugin-manager.delete-plugin")]),pe("click",L,function(...kt){var pt;(pt=e.onCancelConfirm)==null||pt.apply(this,kt)}),pe("click",we,()=>e.onDelete(f(T).name)),C($e,He)},xt=$e=>{var He=Ic();Ne(He,1,"mndw-installed__delete"),P(He,"variant","danger"),y(()=>P(He,"disabled",f(se)));var We=v(He);y(Re=>S(We,Re),[()=>w("settings.plugin-manager.delete")]),pe("click",He,()=>e.onRequestConfirm(f(T).name)),C($e,He)};Z(Qe,$e=>{e.confirmingName===f(T).name?$e(lt):$e(xt,-1)})}y($e=>S(ge,$e),[()=>f(T).enabled?w("settings.plugin-manager.disable"):w("settings.plugin-manager.enable")]),pe("click",V,()=>f(T).enabled?e.onDisable(f(T).name):e.onEnable(f(T).name)),C(Ee,ze)};Z(Yn,Ee=>{f(T).source!=="builtin"&&Ee(cr)})}var an=x(Yn,2);{var ur=Ee=>{var ze=NN(),V=Xe(ze),ge=v(V),Ce=x(ge);{var Ge=Re=>{var L=AN(),K=v(L);y(we=>S(K,`· ${we??""} ${f(T).runtime.requiredProtocol??""}`),[()=>w("settings.plugin-manager.protocol")]),C(Re,L)};Z(Ce,Re=>{f(T).runtime.requiredProtocol!==void 0&&Re(Ge)})}var Qe=x(Ce,2);{var lt=Re=>{var L=MN(),K=v(L);y(we=>S(K,`· ${we??""}`),[()=>w("settings.plugin-manager.incompatible")]),C(Re,L)};Z(Qe,Re=>{f(T).runtime.compatible===!1&&Re(lt)})}var xt=x(Qe,2);{var $e=Re=>{var L=Ds();y(K=>S(L,`— ${K??""}`),[()=>i(f(T).runtime.lastError)]),C(Re,L)};Z(xt,Re=>{f(T).runtime.lastError&&Re($e)})}var He=x(V,2);{var We=Re=>{var L=ON(),K=v(L);y((we,_e)=>S(K,`${we??""}: ${_e??""}`),[()=>w("settings.plugin-manager.supported-service-protocols"),()=>f(T).runtime.supportedProtocols.join(", ")]),C(Re,L)};Z(He,Re=>{f(T).runtime.compatible===!1&&f(T).runtime.supportedProtocols&&Re(We)})}y((Re,L)=>S(ge,`${Re??""}: ${L??""} `),[()=>w("settings.plugin-manager.backend"),()=>a(f(T).runtime.state)]),C(Ee,ze)};Z(an,Ee=>{f(T).runtime&&Ee(ur)})}y((Ee,ze,V)=>{S(te,f(T).label),S(J,f(T).name),S(oe,`${Ee??""}: ${f(T).version??""}`),S(De,`${ze??""}: ${f(T).type??""}`),S(je,`${V??""}: ${f(T).source??""}`)},[()=>w("settings.plugin-manager.version"),()=>w("settings.plugin-manager.type"),()=>w("settings.plugin-manager.source")]),C(A,B)}),C(I,R)};Z(_,I=>{e.items.length===0?I(k):I(O,-1)})}y(I=>S(m,I),[()=>w("settings.plugin-manager.installed-title")]),C(t,p),Le()}at(["click"]);var HN=z("<li> </li>"),BN=z('<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 Kv(t,e){Ie(e,!0);let n=fe(()=>e.lock===void 0?[]:XP(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=kn(),s=Xe(i);{var o=a=>{var l=BN(),c=v(l),u=v(c),d=x(c,2);ft(d,21,()=>f(n),g=>`${g.kind}:${g.name}`,(g,m)=>{var _=HN(),k=v(_);y(O=>S(k,O),[()=>r(f(m))]),C(g,_)});var h=x(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 $N=z('<p class="mndw-cap__kind svelte-14iyjl4"> </p>'),Ms=z("<li> </li>"),Os=z('<section class="mndw-cap__section svelte-14iyjl4"><h4 class="svelte-14iyjl4"> </h4> <ul class="svelte-14iyjl4"></ul></section>'),UN=z('<div class="mndw-cap svelte-14iyjl4"><!> <!> <!> <!> <!> <!> <!></div>');function Qv(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=UN(),l=v(a);Kv(l,{get lock(){return e.entry.lock}});var c=x(l,2);{var u=A=>{var T=$N(),M=v(T);y(N=>S(M,N),[()=>w(e.entry.review.kind==="service"?"settings.plugin-manager.backend-kind-service":"settings.plugin-manager.backend-kind-exec")]),C(A,T)};Z(c,A=>{e.entry.review!==void 0&&A(u)})}var d=x(c,2);{var h=A=>{var T=Os(),M=v(T),N=v(M),j=x(M,2);ft(j,20,()=>f(r),H=>H,(H,se)=>{var B=Ms(),q=v(B);y(()=>S(q,se)),C(H,B)}),y(H=>S(N,H),[()=>w("settings.plugin-manager.packages")]),C(A,T)};Z(d,A=>{f(r).length>0&&A(h)})}var p=x(d,2);{var g=A=>{var T=Os(),M=v(T),N=v(M),j=x(M,2);ft(j,23,()=>f(i),(H,se)=>`${se}:${H}`,(H,se)=>{var B=Ms(),q=v(B);y(()=>S(q,f(se))),C(H,B)}),y(H=>S(N,H),[()=>w("settings.plugin-manager.service-args")]),C(A,T)};Z(p,A=>{f(i).length>0&&A(g)})}var m=x(p,2);{var _=A=>{var T=Os(),M=v(T),N=v(M),j=x(M,2);ft(j,21,()=>f(n),([H,se])=>H,(H,se)=>{var B=fe(()=>Ib(f(se),2));let q=()=>f(B)[0],ee=()=>f(B)[1];var te=Ms(),W=v(te);y(J=>S(W,`${q()??""}: ${ee().transport==="http"?`${ee().method??"GET"} `:""}${ee().path??""}${J??""}`),[()=>{var J;return(J=ee().protocols)!=null&&J.length?` (${ee().protocols.join(", ")})`:""}]),C(H,te)}),y(H=>S(N,H),[()=>w("settings.plugin-manager.routes")]),C(A,T)};Z(m,A=>{f(n).length>0&&A(_)})}var k=x(m,2);{var O=A=>{var T=Os(),M=v(T),N=v(M),j=x(M,2);ft(j,20,()=>f(s),H=>H,(H,se)=>{var B=Ms(),q=v(B);y(()=>S(q,se)),C(H,B)}),y(H=>S(N,H),[()=>w("settings.plugin-manager.public-routes")]),C(A,T)};Z(k,A=>{f(s).length>0&&A(O)})}var I=x(k,2);{var R=A=>{var T=Os(),M=v(T),N=v(M),j=x(M,2);ft(j,20,()=>f(o),H=>H,(H,se)=>{var B=Ms(),q=v(B);y(()=>S(q,se)),C(H,B)}),y(H=>S(N,H),[()=>w("settings.plugin-manager.permissions")]),C(A,T)};Z(I,A=>{f(o).length>0&&A(R)})}C(t,a),Le()}var jN=z("<mndw-button> </mndw-button>",2),FN=z('<div class="mndw-alert mndw-alert--danger" role="alert"> <!></div>'),GN=z('<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),VN=z('<div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),ZN=z('<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>'),WN=z('<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 qN(t,e){Ie(e,!0);let n=Yt(e,"rowStateFor",3,()=>{}),r=Yt(e,"onRefresh",3,()=>{});var i=WN(),s=v(i),o=v(s),a=x(s,2);ft(a,21,()=>e.items,l=>l.name,(l,c)=>{const u=fe(()=>n()(f(c).name)),d=fe(()=>{var N,j;return((N=f(u))==null?void 0:N.state)==="working"||((j=f(u))==null?void 0:j.state)==="reconciling"});var h=ZN(),p=v(h),g=v(p),m=v(g),_=x(g,2),k=v(_),O=x(p,2);Qv(O,{get entry(){return f(c)}});var I=x(O,2);{var R=N=>{var j=FN(),H=v(j),se=x(H);{var B=q=>{var ee=jN();Ne(ee,1,"mndw-pending__refresh"),P(ee,"variant","ghost");var te=v(ee);y(W=>S(te,W),[()=>w("settings.plugin-manager.refresh")]),pe("click",ee,function(...W){var J;(J=r())==null||J.apply(this,W)}),C(q,ee)};Z(se,q=>{f(u).state==="notice-finishing"&&q(B)})}y(()=>S(H,`${f(u).message??""} `)),C(N,j)};Z(I,N=>{f(u)!==void 0&&f(u).message!==""&&N(R)})}var A=x(I,2);{var T=N=>{var j=GN(),H=v(j),se=v(H),B=x(H,2),q=v(B);Ne(q,1,"mndw-pending__cancel"),P(q,"variant","ghost");var ee=v(q),te=x(q,2);Ne(te,1,"mndw-pending__confirm"),P(te,"variant","danger"),y(()=>P(te,"disabled",f(d)));var W=v(te);y((J,ne,le)=>{S(se,J),S(ee,ne),S(W,le)},[()=>w("settings.plugin-manager.deny-confirmation",{label:f(c).label}),()=>w("settings.plugin-manager.cancel"),()=>w("settings.plugin-manager.deny-plugin")]),pe("click",q,function(...J){var ne;(ne=e.onCancelConfirm)==null||ne.apply(this,J)}),pe("click",te,()=>e.onDeny(f(c).name)),C(N,j)},M=N=>{var j=VN(),H=v(j);Ne(H,1,"mndw-pending__deny"),P(H,"variant","danger"),y(()=>P(H,"disabled",f(d)));var se=v(H),B=x(H,2);Ne(B,1,"mndw-pending__approve"),P(B,"variant","primary"),y(()=>P(B,"disabled",f(d)));var q=v(B);y((ee,te)=>{S(se,ee),S(q,te)},[()=>w("settings.plugin-manager.deny"),()=>w("settings.plugin-manager.approve")]),pe("click",H,()=>e.onRequestConfirm(f(c).name)),pe("click",B,()=>e.onApprove(f(c).name)),C(N,j)};Z(A,N=>{e.confirmingName===f(c).name?N(T):N(M,-1)})}y(()=>{S(m,f(c).label),S(k,f(c).name)}),C(l,h)}),y(l=>S(o,l),[()=>w("settings.plugin-manager.pending-title")]),C(t,i),Le()}at(["click"]);var XN=z('<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 YN(t,e){Ie(e,!0);var n=XN(),r=v(n),i=v(r),s=v(i),o=x(i),a=x(r,2);Qv(a,{get entry(){return e.entry}});var l=x(a,2),c=v(l);Ne(c,1,"mndw-approval__deny"),P(c,"variant","danger");var u=v(c),d=x(c,2);Ne(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()}at(["click"]);async function JN(t,e){if(e!=null&&e.aborted)return;const n=ls(YN,{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 KN={"ping-widget-aarch64.zip":"aarch64","ping-widget-mips.zip":"mips","ping-widget-mipsel.zip":"mipsel"};function QN(t){switch(t){case"aarch64":return"aarch64";case"mips":return"mips";case"mipsel":return"mipsel";default:return}}function e3(t,e){const n=QN(e),r=KN[t];if(!(n===void 0||r===void 0||n===r))return{filename:t,archiveTarget:r,deviceTarget:n}}var ap=z('<p class="mndw-upload__status svelte-1mqre4o" role="status"> </p>'),t3=z('<p class="mndw-upload__success svelte-1mqre4o" role="status"> </p> <!>',1),n3=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),r3=z('<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 i3(t,e){Ie(e,!0);const n=10*1024*1024;let r=Yt(e,"openApproval",3,JN),i=Y("idle"),s=Y(""),o=Y(""),a=Y(null),l,c=!1;Io(()=>{c=!0,l==null||l.abort()});function u(W){if(!W.name.toLowerCase().endsWith(".zip"))return w("settings.plugin-manager.choose-zip");if(W.size===0)return w("settings.plugin-manager.empty-zip");if(W.size>n)return w("settings.plugin-manager.zip-too-large")}function d(W){return w("settings.plugin-manager.upload-target-mismatch",{filename:W.filename,archiveTarget:W.archiveTarget,deviceTarget:W.deviceTarget})}function h(W){const J=u(W);if(J)return J;const ne=e3(W.name,e.architecture);if(ne!==void 0)return d(ne)}function p(W){b(s,W,!0),b(i,"error")}function g(W){b(a,W,!0),b(o,w("settings.plugin-manager.installed-success",{label:W.label}),!0),b(i,"success"),e.onInstalled()}async function m(W){const J=new AbortController;l=J;try{return{decision:await r()(W,J.signal),aborted:J.signal.aborted}}finally{l===J&&(l=void 0)}}async function _(W,J){if(!c)if(J==="approve"){const ne=await e.onApprove(W.name);if(c)return;if(!ne){b(i,"idle");return}b(o,w("settings.plugin-manager.approved-success",{label:W.label}),!0),b(i,"success")}else if(J==="deny"){if(await e.onDeny(W.name),c)return;b(i,"idle")}else{if(c)return;e.onDismiss(),b(i,"idle")}}async function k(W){if(f(i)==="uploading"||f(i)==="busy")return;const J=h(W);if(J){p(J);return}b(s,""),b(i,"uploading");let ne;try{ne=await e.uploadFile(W)}catch(oe){if(c)return;p(sr(oe));return}if(c)return;if(ne.status==="installed"){g(ne.entry);return}b(i,"busy");let le;try{le=await m(ne.entry)}catch(oe){if(c)return;p(sr(oe));return}c||le.aborted||await _(ne.entry,le.decision)}function O(W){var ne;const J=(ne=W.currentTarget.files)==null?void 0:ne[0];J&&k(J)}function I(W){var ne;W.preventDefault();const J=(ne=W.dataTransfer)==null?void 0:ne.files[0];J&&k(J)}var R=r3(),A=v(R),T=v(A),M=x(A,2),N=v(M),j=x(N,2),H=v(j),se=x(M,2);{var B=W=>{var J=ap(),ne=v(J);y(le=>S(ne,le),[()=>w("settings.plugin-manager.uploading")]),C(W,J)},q=W=>{var J=ap(),ne=v(J);y(le=>S(ne,le),[()=>w("settings.plugin-manager.waiting-approval")]),C(W,J)},ee=W=>{var J=t3(),ne=Xe(J),le=v(ne),oe=x(ne,2);{let ue=fe(()=>{var De;return(De=f(a))==null?void 0:De.lock});Kv(oe,{get lock(){return f(ue)}})}y(()=>S(le,f(o))),C(W,J)},te=W=>{var J=n3(),ne=v(J);y(()=>S(ne,f(s))),C(W,J)};Z(se,W=>{f(i)==="uploading"?W(B):f(i)==="busy"?W(q,1):f(i)==="success"?W(ee,2):f(i)==="error"&&W(te,3)})}y((W,J,ne)=>{S(T,W),Ae(N,"aria-label",J),N.disabled=f(i)==="uploading"||f(i)==="busy",S(H,ne)},[()=>w("settings.plugin-manager.upload-trust-warning"),()=>w("settings.upload-plugin-zip"),()=>w("settings.plugin-manager.upload-drop")]),ut("dragover",M,W=>W.preventDefault()),ut("drop",M,I),pe("change",N,O),C(t,R),Le()}at(["change"]);function eb(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 s3(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(eb(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 o3=z('<div class="mndw-reload svelte-1hlmyjs" role="status"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),a3=z('<p class="mndw-plugin-manager__loading svelte-1hlmyjs" role="status"> </p>'),l3=z('<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),c3=z('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),u3=z('<section class="mndw-runtime-capacity svelte-1hlmyjs"><strong class="svelte-1hlmyjs"> </strong> <span> </span> <span> </span> <span> </span> <span> </span></section>'),d3=z('<p class="mndw-plugin-manager__runtime-error svelte-1hlmyjs"> </p>'),f3=z("<!> <!> <!> <!>",1),h3=z('<section class="mndw-plugin-manager svelte-1hlmyjs"><h3 class="svelte-1hlmyjs"> </h3> <!> <!> <!></section>');function p3(t,e){Ie(e,!0);let n=Yt(e,"client",3,Md),r=Yt(e,"permissionVisible",3,!1),i=Yt(e,"permissionAvailable",3,!1),s=Y(it([])),o=Y(null),a=Y(""),l=Y(!0),c=Y(""),u=Y(""),d=Y(null),h=Y(!1),p=0;const g=new rs,m={polls:3,intervalMs:1e3};let _=fe(()=>f(s).filter(oe=>oe.approval==="approved")),k=fe(()=>f(s).filter(oe=>oe.approval==="pending"));function O(oe){return g.get(oe)}function I(oe){for(const[ue,De]of g)De.state==="notice-finishing"&&De.operation!==void 0&&eb(De.operation,ue,oe)&&g.delete(ue)}async function R(){const oe=++p;b(l,!0),b(c,"");try{const ue=await n().listPlugins();oe===p&&(b(s,ue,!0),b(u,""),I(ue))}catch(ue){oe===p&&b(c,sr(ue),!0)}finally{oe===p&&b(l,!1)}}async function A(){const oe=++p;try{const ue=await n().listPlugins();oe===p&&(b(s,ue,!0),b(c,""),b(u,""),b(l,!1),I(ue))}catch(ue){oe===p&&(b(u,sr(ue),!0),b(l,!1))}T()}async function T(){try{b(o,await n().getRuntime(),!0),b(a,"")}catch(oe){b(a,sr(oe),!0)}}async function M(oe,ue,De,Ye){const je=g.get(oe);if((je==null?void 0:je.state)==="working"||(je==null?void 0:je.state)==="reconciling")return!1;g.set(oe,{state:"working",message:"",operation:ue});let Ke=!1;try{await De(),Ke=!0,g.delete(oe),Ye&&b(h,!0),await A()}catch(ce){const ae=vR(ce);if(ae==="rejected-maintenance")g.set(oe,{state:"notice-rejected",message:w("settings.plugin-manager.maintenance-busy"),operation:ue});else if(ae==="ambiguous"){g.set(oe,{state:"reconciling",message:w("settings.plugin-manager.confirming-state"),operation:ue});try{const U=await s3(ue,oe,()=>n().listPlugins(),m);U==="ok"?(g.delete(oe),Ke=!0,Ye&&b(h,!0),await A()):U==="notice-finishing"?g.set(oe,{state:"notice-finishing",message:w("settings.plugin-manager.operation-finishing"),operation:ue}):g.set(oe,{state:"outcome-unknown",message:w("settings.plugin-manager.outcome-unknown"),operation:ue})}catch(U){g.set(oe,{state:"outcome-unknown",message:sr(U),operation:ue})}}else g.set(oe,{state:"error",message:sr(ce),operation:ue}),await A()}finally{b(d,null)}return Ke}function N(){b(h,!0),A()}function j(){A()}zn(()=>{R(),T()});var H=h3(),se=v(H),B=v(se),q=x(se,2);{var ee=oe=>{var ue=o3(),De=v(ue),Ye=v(De),je=x(De,2);P(je,"variant","primary");var Ke=v(je),ce=x(je,2);P(ce,"variant","ghost");var ae=v(ce);y((U,re,X)=>{S(Ye,U),S(Ke,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,()=>b(h,!1)),C(oe,ue)};Z(q,oe=>{f(h)&&oe(ee)})}var te=x(q,2);{let oe=fe(()=>{var ue;return(ue=me.deviceInfo)==null?void 0:ue.architecture});i3(te,{get architecture(){return f(oe)},uploadFile:ue=>n().uploadPlugin(ue),onInstalled:N,onApprove:ue=>M(ue,{kind:"approve"},()=>n().approvePlugin(ue),!0),onDeny:ue=>M(ue,{kind:"deny"},()=>n().denyPlugin(ue),!1),onDismiss:j})}var W=x(te,2);{var J=oe=>{var ue=a3(),De=v(ue);y(Ye=>S(De,Ye),[()=>w("settings.plugin-manager.loading")]),C(oe,ue)},ne=oe=>{var ue=l3(),De=v(ue),Ye=v(De),je=x(De,2);P(je,"variant","secondary");var Ke=v(je);y(ce=>{S(Ye,f(c)),S(Ke,ce)},[()=>w("settings.plugin-manager.retry")]),pe("click",je,()=>void R()),C(oe,ue)},le=oe=>{var ue=f3(),De=Xe(ue);{var Ye=X=>{var ve=c3(),Ze=v(ve),nt=v(Ze),yt=x(Ze,2);P(yt,"variant","ghost");var Ut=v(yt);y(on=>{S(nt,f(u)),S(Ut,on)},[()=>w("settings.plugin-manager.dismiss")]),pe("click",yt,()=>b(u,"")),C(X,ve)};Z(De,X=>{f(u)&&X(Ye)})}var je=x(De,2);{var Ke=X=>{var ve=u3(),Ze=v(ve),nt=v(Ze),yt=x(Ze,2),Ut=v(yt),on=x(yt,2),qn=v(on),En=x(on,2),Xn=v(En),Yn=x(En,2),cr=v(Yn);y((an,ur,Ee,ze,V,ge,Ce)=>{Ae(ve,"aria-label",an),S(nt,ur),S(Ut,`${Ee??""}:
91
- ${f(o).currentExec??""}/${f(o).maxConcurrentExecTotal??""}`),S(qn,`${ze??""}:
92
- ${f(o).reservedServices??""}/${f(o).maxSupervisedServices??""}`),S(Xn,`${V??""}:
93
- ${f(o).maxConcurrentExecPerPlugin??""}`),S(cr,`${ge??""}:
94
- ${Ce??""}`)},[()=>w("settings.backend-capacity"),()=>w("settings.backend-capacity"),()=>w("settings.plugin-manager.exec"),()=>w("settings.plugin-manager.services"),()=>w("settings.plugin-manager.per-plugin-exec-limit"),()=>w("settings.plugin-manager.service-protocols"),()=>f(o).supportedServiceProtocols.join(", ")]),C(X,ve)},ce=X=>{var ve=d3(),Ze=v(ve);y(nt=>S(Ze,nt),[()=>w("settings.plugin-manager.runtime-status-unavailable",{error:f(a)})]),C(X,ve)};Z(je,X=>{f(o)?X(Ke):f(a)&&X(ce,1)})}var ae=x(je,2);{var U=X=>{qN(X,{get items(){return f(k)},get confirmingName(){return f(d)},rowStateFor:O,onApprove:ve=>M(ve,{kind:"approve"},()=>n().approvePlugin(ve),!0),onDeny:ve=>M(ve,{kind:"deny"},()=>n().denyPlugin(ve),!1),onRequestConfirm:ve=>b(d,ve,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()})};Z(ae,X=>{f(k).length>0&&X(U)})}var re=x(ae,2);DN(re,{get items(){return f(_)},get confirmingName(){return f(d)},rowStateFor:O,get permissionVisible(){return r()},get permissionAvailable(){return i()},onEnable:X=>M(X,{kind:"enable"},()=>n().enablePlugin(X),!0),onDisable:X=>M(X,{kind:"disable"},()=>n().disablePlugin(X),!0),onPermissionChange:(X,ve,Ze)=>M(X,{kind:"permission",permission:ve,enabled:Ze},()=>n().setPluginPermission(X,ve,Ze),!1),onRestart:X=>M(X,{kind:"restart"},()=>n().restartPlugin(X),!1),onDelete:X=>M(X,{kind:"delete"},()=>n().deletePlugin(X),!0),onRequestConfirm:X=>b(d,X,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()}),C(oe,ue)};Z(W,oe=>{f(l)?oe(J):f(c)?oe(ne,1):oe(le,-1)})}y(oe=>S(B,oe),[()=>w("settings.plugin-manager.title")]),C(t,H),Le()}at(["click"]);var g3=z('<section class="mndw-plugin-settings"><!></section>');function m3(t,e){var n=g3(),r=v(n);p3(r,{get permissionVisible(){return e.permissionVisible},get permissionAvailable(){return e.permissionAvailable}}),C(t,n)}class Ud extends Error{constructor(n,r){super(n);G(this,"code");this.name="SelfUpdateError",this.code=r}}const tb=t=>t==="update"||t==="revert",$n=()=>new Ud("Malformed response","UNKNOWN");async function v3(t){try{return await t.json()}catch{throw $n()}}async function b3(t){const e=Dl(await Ll(t),t.statusText);return new Ud(e.message,e.code)}function _3(t){if(!sn(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!_r(t.version)||t.operation!==void 0&&!tb(t.operation))throw $n();for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!_r(t[i]))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.failureCode===void 0?void 0:t.failureCode,r=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{state:t.state,version:t.version,...t.operation===void 0?{}:{operation:t.operation},...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{failureCode:n},...r===void 0?{}:{rollbackVersion:r}}}function w3(t){if(!sn(t)||!_r(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!_r(t.targetVersion)||t.rollbackVersion!==void 0&&!_r(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{currentVersion:t.currentVersion,updateAvailable:t.updateAvailable,rollbackAvailable:t.rollbackAvailable,...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{rollbackVersion:n}}}function lp(t){if(!sn(t)||!tb(t.operation)||!_r(t.targetVersion))throw $n();return{operation:t.operation,targetVersion:t.targetVersion}}function y3(t=globalThis.fetch){async function e(r,i){const s=await t(r,i);if(!s.ok)throw await b3(s);return v3(s)}async function n(r){return e(r,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:"{}"})}return{async status(){return _3(await e(BT,{method:"GET"}))},async check(){return w3(await n($T))},async apply(){return lp(await n(UT))},async revert(){return lp(await n(jT))}}}const k3=y3();var E3=z("<mndw-button> </mndw-button>",2),S3=z('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p class="svelte-1khkewm"> </p> <!></div>');function x3(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=S3(),i=v(r),s=v(i),o=x(i,2);{var a=l=>{var c=E3();P(c,"variant","secondary"),Ne(c,1,"svelte-1khkewm");var u=v(c);y(d=>S(u,d),[()=>w("common.close")]),pe("click",c,()=>e.close("close")),C(l,c)};Z(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>{Ae(i,"role",e.progress.phase==="unconfirmed"?"alert":"status"),S(s,f(n))}),C(t,r),Le()}at(["click"]);var Lc=z('<p class="svelte-1ffuaq9"> </p>'),ca=z('<p role="status" class="svelte-1ffuaq9"> </p>'),zi=z('<p role="alert" class="svelte-1ffuaq9"> </p>'),T3=z('<section class="mndw-self-update-settings svelte-1ffuaq9"><h3 class="svelte-1ffuaq9"> </h3> <p class="svelte-1ffuaq9"> </p> <!> <!> <!> <!> <div class="mndw-self-update-actions svelte-1ffuaq9"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div></section>',2);function C3(t,e){Ie(e,!0);let n=Yt(e,"pollIntervalMs",3,2e3),r=Yt(e,"pollAttempts",3,90),i=fe(()=>e.client??k3),s=Y(null),o=Y(null),a=Y(""),l=Y(""),c=Y("idle"),u=Y(""),d=Y(!1),h=null,p=0,g=0,m=!1,_=!1,k=Y(null),O=null;zn(()=>{A()}),Io(()=>{m=!0,I(),q()});function I(){p+=1,h!==null&&(window.clearTimeout(h),h=null)}function R(L){b(s,L,!0),L.state==="failed"?(b(u,L.failureCode??"unknown",!0),b(c,"failure"),_=!1,q()):L.state==="idle"&&_?(b(c,"success"),q()):L.state==="in-progress"&&(b(c,"idle"),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=L.targetVersion??f(k).targetVersion,L.operation!==void 0&&(f(k).operation=L.operation)))}async function A(){b(d,!0);try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"&&(_=!0,T())}catch{b(c,"error")}finally{b(d,!1)}}function T(){if(I(),g=Math.max(0,r()),g===0){N();return}M(p)}function M(L){m||L!==p||g<=0||(h=window.setTimeout(()=>{h=null,j(L)},n()))}function N(){I(),b(c,"unconfirmed"),f(k)!==null&&(f(k).phase="unconfirmed")}async function j(L){if(!(m||L!==p)){g-=1;try{const K=await f(i).status();if(m||L!==p)return;R(K),K.state==="in-progress"?g<=0?N():M(L):I()}catch{if(g<=0){N();return}M(L)}}}function H(L){return L instanceof Ud?L.code:"UNKNOWN"}async function se(L,K){const we=L==="update";return(await ls(el,{title:w(we?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:w(we?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:K}),confirmLabel:w(we?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function B(L){b(k,{operation:L,phase:"preparing",targetVersion:""},!0);const we=f(k);if(we===null)return;const _e=ls(x3,{title:w("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:we}});O=_e,_e.closed.then(()=>{O===_e&&(O=null,b(k,null))})}function q(){O==null||O.close(void 0,"api")}async function ee(){try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"?(_=!0,T()):b(c,"busy")}catch{b(c,"busy")}}async function te(){I(),_=!1,b(d,!0),b(c,"checking"),b(u,"");try{b(o,await f(i).check(),!0),b(c,"idle")}catch(L){b(o,null),H(L)==="OPKG_BUSY"?await ee():b(c,"error")}finally{b(d,!1)}}async function W(){const L=f(o);L===null||!L.updateAvailable||L.targetVersion===void 0||await se("update",L.targetVersion)&&await ue("update",()=>f(i).apply())}async function J(){f(Ke)!==""&&await se("revert",f(Ke))&&await ue("revert",()=>f(i).revert())}function ne(L){I(),b(o,null),b(a,""),b(l,L,!0),b(u,""),b(d,!0),b(c,"preparing"),_=!1}async function le(L){const K=await L();b(a,K.targetVersion,!0),b(l,K.operation,!0),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=K.targetVersion),b(c,"idle"),_=!0,T()}async function oe(L){switch(q(),H(L)){case"OPKG_BUSY":await ee();return;case"SELF_UPDATE_NOT_AVAILABLE":b(u,"no-update");break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":b(u,"rollback-unavailable");break;default:b(u,"")}b(c,"error")}async function ue(L,K){ne(L),B(L);try{await le(K)}catch(we){await oe(we)}finally{b(d,!1)}}function De(L){return w({"update-missing":"settings.self-update-failure-update-missing","opkg-install-failed":"settings.self-update-failure-opkg-install-failed","opkg-revert-failed":"settings.self-update-failure-opkg-revert-failed","rollback-missing":"settings.self-update-failure-rollback-missing","helper-exited":"settings.self-update-failure-helper-exited","unexpected-version":"settings.self-update-failure-unexpected-version","state-corrupt":"settings.self-update-failure-state-corrupt"}[L]??"settings.self-update-failure-generic")}const Ye=fe(()=>{var L;return((L=f(s))==null?void 0:L.version)??""}),je=fe(()=>{var L,K;return((L=f(s))==null?void 0:L.state)==="in-progress"?f(a)||f(s).targetVersion||"":((K=f(o))==null?void 0:K.targetVersion)||""}),Ke=fe(()=>{var L,K;return((L=f(o))==null?void 0:L.rollbackVersion)||((K=f(s))==null?void 0:K.rollbackVersion)||""}),ce=fe(()=>{var L;return((L=f(o))==null?void 0:L.updateAvailable)===!0&&!f(d)}),ae=fe(()=>{var L,K;return(((L=f(o))==null?void 0:L.rollbackAvailable)===!0||!!((K=f(s))!=null&&K.rollbackVersion))&&!f(d)});var U=T3(),re=v(U),X=v(re),ve=x(re,2),Ze=v(ve),nt=x(ve,2);{var yt=L=>{var K=Lc(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-current",{version:f(Ye)})]),C(L,K)};Z(nt,L=>{f(Ye)&&L(yt)})}var Ut=x(nt,2);{var on=L=>{var K=Lc(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback",{version:f(Ke)})]),C(L,K)};Z(Ut,L=>{f(Ke)&&L(on)})}var qn=x(Ut,2);{var En=L=>{var K=ca(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-checking")]),C(L,K)},Xn=L=>{var K=ca(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-preparing")]),C(L,K)},Yn=L=>{var K=ca(),we=v(K);y(_e=>S(we,_e),[()=>w(f(l)==="revert"||f(s).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:f(je)})]),C(L,K)},cr=L=>{var K=ca(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-success",{version:f(Ye)})]),C(L,K)},an=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>De(f(u))]),C(L,K)},ur=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-unconfirmed")]),C(L,K)},Ee=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-busy")]),C(L,K)},ze=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-no-update")]),C(L,K)},V=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback-unavailable")]),C(L,K)},ge=L=>{var K=zi(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-failure-generic")]),C(L,K)};Z(qn,L=>{var K;f(c)==="checking"?L(En):f(c)==="preparing"?L(Xn,1):((K=f(s))==null?void 0:K.state)==="in-progress"?L(Yn,2):f(c)==="success"?L(cr,3):f(c)==="failure"?L(an,4):f(c)==="unconfirmed"?L(ur,5):f(c)==="busy"?L(Ee,6):f(c)==="error"&&f(u)==="no-update"?L(ze,7):f(c)==="error"&&f(u)==="rollback-unavailable"?L(V,8):f(c)==="error"&&L(ge,9)})}var Ce=x(qn,2);{var Ge=L=>{var K=Lc(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-available",{version:f(o).targetVersion})]),C(L,K)};Z(Ce,L=>{f(o)!==null&&f(o).updateAvailable&&f(o).targetVersion!==void 0&&L(Ge)})}var Qe=x(Ce,2),lt=v(Qe);P(lt,"variant","secondary"),y(()=>P(lt,"disabled",f(d)));var xt=v(lt),$e=x(lt,2);P($e,"variant","primary"),y(()=>P($e,"disabled",!f(ce)));var He=v($e),We=x($e,2);P(We,"variant","secondary"),y(()=>P(We,"disabled",!f(ae)));var Re=v(We);y((L,K,we,_e,kt,pt)=>{Ae(U,"data-locale",me.locale),Ae(U,"aria-label",L),S(X,K),S(Ze,we),S(xt,_e),S(He,kt),S(Re,pt)},[()=>w("settings.self-update-tab"),()=>w("settings.self-update-tab"),()=>w("settings.self-update-description"),()=>f(c)==="checking"?w("settings.self-update-checking"):w("settings.self-update-check"),()=>w("settings.self-update-apply"),()=>w("settings.self-update-revert")]),pe("click",lt,()=>void te()),pe("click",$e,()=>void W()),pe("click",We,()=>void J()),C(t,U),Le()}at(["click"]);const ho=[{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"}],cp="general";function up(t){var e;return((e=ho.find(n=>n.id===t))==null?void 0:e.route)??`/settings/${t}`}function P3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of ho)if(e===n.route)return n.id;return null}var R3=z("<mndw-tab> </mndw-tab>",2),A3=z('<div class="mndw-settings"><h2> </h2> <mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function dp(t,e){Ie(e,!0);let n=Y(!1),r=Y(!1);const i=fe(()=>{const R=(Jt==null?void 0:Jt.route.pathname)??globalThis.location.pathname;return P3(R)??cp});zn(()=>{const R=Jt;(R==null?void 0:R.route.pathname)==="/settings"&&R.navigate(up(cp),{replace:!0})});function s(R){const A=ho.find(M=>M.id===R.detail.value),T=Jt;A===void 0||T===void 0||T.navigate(up(A.id))}function o(R){b(n,R.visible,!0),b(r,R.available,!0)}var a=A3(),l=v(a),c=v(l),u=x(l,2);y(()=>P(u,"value",f(i)));var d=v(u);ft(d,17,()=>ho,R=>R.id,(R,A)=>{var T=R3();y(()=>P(T,"id",f(A).id)),y(()=>P(T,"data-icon",f(A).icon));var M=v(T);y(N=>S(M,N),[()=>w(f(A).labelKey)]),C(R,T)});var h=x(d,2);P(h,"for","general");var p=v(h);bN(p,{onPermissionStateChange:o});var g=x(h,2);P(g,"for","diagnostics");var m=v(g);zO(m,{});var _=x(g,2);P(_,"for","plugins");var k=v(_);m3(k,{get permissionVisible(){return f(n)},get permissionAvailable(){return f(r)}});var O=x(_,2);P(O,"for","self-update");var I=v(O);C3(I,{}),y(R=>{Ae(a,"data-locale",me.locale),S(c,R)},[()=>w("settings.title")]),ut("mndwchange",u,s),C(t,a),Le()}const fp=new Map;let rl=[],Jt;function il(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function M3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||il(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function O3(t,e){if(kv(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function N3(t=_s){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;M3(a,o),O3(il(a),o);const l=il(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]=Zh,n[c]=Zh,r.set(l,o),i.push({route:l,name:o})}fp.clear();for(const[s,o]of r)fp.set(s,o);return rl=i,n}function hp(){return rl}function z3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function nb(t,e){const n=z3(t),r=n.toLowerCase();for(const i of e){const s=il(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 I3(){const t=globalThis.location.pathname,e=nb(t,rl);if(e!==null)try{decodeURIComponent(t)}catch{const r=rl.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 L3(t=_s){const e=N3(t),n=jw({"/":{layout:mM,"/":Vh,"/packages":Qh,"/packages/services":Qh,"/settings":dp,...Object.fromEntries(ho.map(r=>[r.route,dp])),...e,"*":Vh}});return Jt=n,I3(),n}function D3(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 pp=Ue({exact:de(),cdate:de()}),gp=Ue({version:de()}),H3=Ue({release:de(),sandbox:de().optional(),title:de().optional(),arch:de(),ndm:pp,bsp:pp,ndw:Ue({version:de().optional(),features:de(),components:de()}),ndw3:gp.optional(),ndw4:gp.optional(),manufacturer:de(),vendor:de(),series:de(),model:de(),hw_version:de(),hw_type:de().optional(),hw_id:de(),device:de(),region:de(),description:de()}),B3=()=>{const t={path:"show.version"};return Nd.driver.queue(t).pipe(xb(e=>H3.parse(e)))};function $3(){return Promise.resolve({theme:Za(),locale:as()})}function U3(){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 j3(){try{const t=await _p(B3().pipe(wp(lv)));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 U3()}}async function F3(t){const e=j3(),n=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:Pu(),usbPortCount:0})),[r,i]=await Promise.all([e,n]),s=new Set(r.features.map(a=>a.toLowerCase())),o=D3(i.usbPortCount,a=>s.has(a.toLowerCase()));return{...r,switchports:i.switchports,usb:o}}async function rb(t=lo(),e={}){e.loadPlugins;const n=e.loadSandboxPlugin??iA,r=e.createRouter??L3;try{me.hostInfo=await $3()}catch(i){console.error("[mndw] Failed to fetch host info:",i)}try{me.deviceInfo=await F3(t.mgmtClient)}catch(i){console.error("[mndw] Failed to fetch device info:",i)}{let i=Lv,s=e.setupHmr??cA;{const o=await Ma(()=>import("./sandbox-url-Dk7HpxDp.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 G3=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),V3=z('<div class="mndw-login"><form class="mndw-login__form"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <h1 class="mndw-login__title">mndw</h1> <mndw-field><mndw-input></mndw-input></mndw-field> <mndw-field><mndw-input></mndw-input></mndw-field> <!> <mndw-button> </mndw-button></form></div>',2);function Z3(t,e){Ie(e,!0);const n=Rr();let r=Y(""),i=Y(""),s=Y(""),o=Y(!1),a=Y(!1);function l(){return f(r).trim()!==""&&f(i)!==""}function c(){return l()&&!f(o)&&!f(a)}function u(B){n.locale.setLocale(B.detail.value).catch(()=>{})}function d(B){b(r,B.detail.value,!0),b(a,!1)}function h(B){b(i,B.detail.value,!0),b(a,!1)}function p(B){const q=B.target,ee=B.composedPath()[0];B.key!=="Enter"||!(q instanceof HTMLElement)||q.localName!=="mndw-input"||ee instanceof HTMLButtonElement||(B.preventDefault(),c()&&g(B))}function g(B){B.preventDefault(),c()&&(b(o,!0),b(s,""),n.rci.login(f(r),f(i)).subscribe({next(q){q?(me.authenticated=!0,rb(n).catch(()=>{Pd(),b(s,w("login.connection-failed"),!0),b(o,!1)}).finally(()=>{b(r,""),b(i,"")})):(b(s,w("login.invalid-credentials"),!0),b(o,!1),b(a,!0))},error(){b(s,w("login.connection-failed"),!0),b(o,!1),b(a,!0)}}))}var m=V3(),_=v(m),k=v(_);Ne(k,1,"mndw-login__locale-select"),y(()=>P(k,"label",w("nav.language"))),y(()=>P(k,"value",me.locale)),y(()=>P(k,"disabled",me.localeSwitchPending));var O=v(k);P(O,"value","en");var I=x(O,2);P(I,"value","ru");var R=x(k,4);y(()=>P(R,"label",w("login.username")));var A=v(R);P(A,"name","username"),P(A,"autocomplete","username"),y(()=>P(A,"value",f(r))),y(()=>P(A,"disabled",f(o)));var T=x(R,2);y(()=>P(T,"label",w("login.password")));var M=v(T);P(M,"type","password"),P(M,"name","password"),P(M,"autocomplete","current-password"),y(()=>P(M,"value",f(i))),y(()=>P(M,"disabled",f(o)));var N=x(T,2);{var j=B=>{var q=G3(),ee=v(q);y(()=>S(ee,f(s))),C(B,q)};Z(N,B=>{f(s)&&B(j)})}var H=x(N,2);Ne(H,1,"mndw-login__submit"),P(H,"variant","primary"),P(H,"type","submit"),y(()=>P(H,"disabled",!c()));var se=v(H);y(B=>{Ae(m,"data-locale",me.locale),S(se,B)},[()=>f(o)?w("login.logging-in"):w("login.submit")]),ut("submit",_,g),ut("mndwchange",k,u),ut("mndwinput",A,d),pe("keydown",A,p),ut("mndwinput",M,h),pe("keydown",M,p),C(t,m),Le()}at(["keydown"]);var W3=z('<div class="mndw-loading"> </div>'),q3=z("<!> <!> <!>",1);function X3(t,e){Ie(e,!0),xA(e.services);var n=q3(),r=Xe(n);zP(r,{});var i=x(r,2);FP(i,{});var s=x(i,2);{var o=c=>{Z3(c,{})},a=c=>{Zw(c,{})},l=c=>{var u=W3(),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 Y3(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=lo();function ua(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function J3(){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:"";(ua(n)||ua(r)||ua(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);ua(n)&&(console.error("[mndw] Plugin unhandled rejection:",e),t.preventDefault())})}function K3(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");vl(X3,{target:t,props:{services:ui}})}async function Q3(){const t=ui.rci.isAuthenticated().pipe(wp(5e3));return _p(t)}function ez(t){ui.rci.authError$.subscribe(t)}async function tz(){J3(),await Y3({initLocale:()=>ui.locale.initLocale(),defineUi:t=>mb({overlay:ui.overlay,initialLocale:t,iconSpriteUrl:Rb}),initTheme:TC,initPalette:()=>ui.palette.initPalette(),checkAuthenticated:Q3,setAuthenticated:t=>{me.authenticated=t},initAuthenticated:()=>rb(ui),subscribeAuthErrors:ez,resetToLogin:Pd,mountApp:K3})}tz();export{lA as s};