home-hosted 0.7.21 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +130 -157
- package/README.md +14 -5
- package/dist/cli.js +281 -417
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
- package/uis/stock/dist/assets/de-DRY6VVqP.js +1 -0
- package/uis/stock/dist/assets/es-CKPLbx5t.js +1 -0
- package/uis/stock/dist/assets/fr-CQ7_4vtN.js +1 -0
- package/uis/stock/dist/assets/index-DwE9bYyS.css +2 -0
- package/uis/stock/dist/assets/index-HT6jUD-L.js +46 -0
- package/uis/stock/dist/assets/ja-bRUylgOt.js +1 -0
- package/uis/stock/dist/assets/ko-DWqbA99M.js +1 -0
- package/uis/stock/dist/assets/plex-sans-cyrillic-BAAhND-U.woff2 +0 -0
- package/uis/stock/dist/assets/plex-sans-cyrillic-ext-d45eAU9y.woff2 +0 -0
- package/uis/stock/dist/assets/ru-DUFxhVp3.js +1 -0
- package/uis/stock/dist/assets/vi-B0-81iVf.js +1 -0
- package/uis/stock/dist/assets/zh-CN-CeoyD9BM.js +1 -0
- package/uis/stock/dist/index.html +7 -3
- package/uis/stock/dist/ui.json +3 -3
- package/uis/stock/dist/assets/index-3hQv8lsr.js +0 -46
- package/uis/stock/dist/assets/index-Dp4rjHQQ.css +0 -2
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),ee=e=>w(e)===`[object Object]`,E=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,te=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ne=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},re=/-\w/g,ie=ne(e=>e.replace(re,e=>e.slice(1).toUpperCase())),ae=/\B([A-Z])/g,oe=ne(e=>e.replace(ae,`-$1`).toLowerCase()),se=ne(e=>e.charAt(0).toUpperCase()+e.slice(1)),ce=ne(e=>e?`on${se(e)}`:``),D=(e,t)=>!Object.is(e,t),le=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ue=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},de=e=>{let t=parseFloat(e);return isNaN(t)?e:t},fe=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},pe,me=()=>pe||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},he=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function ge(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?be(r):ge(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var _e=/;(?![^(]*\))/g,ve=/:([^]+)/,ye=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function be(e){let t={};return e.replace(ye,e=>e.startsWith(`/*`)?``:e).split(_e).forEach(e=>{if(e){let n=e.split(ve);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function O(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=O(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function xe(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=O(t)),n&&(e.style=ge(n)),e}var Se=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Ce=n(Se);Se+``;function we(e){return!!e||e===``}function Te(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=ke(e[i],t[i],n);return r}function Ee(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&ke(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function De(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ee(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!ke(e[r],t[r],n))return!1}return String(e)===String(t)}function Oe(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function ke(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Oe(e,t,n,Te):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Oe(e,t,n,De):String(e)===String(t))))}function Ae(e,t){return e.findIndex(e=>ke(e,t))}var je=e=>!!(e&&e.__v_isRef===!0),k=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?je(e)?k(e.value):JSON.stringify(e,Me,2):String(e),Me=(e,t)=>je(t)?Me(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ne(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ne(e))}:b(t)?Ne(t):x(t)&&!p(t)&&!ee(t)?String(t):t,Ne=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function Pe(e){return e==null?`initial`:typeof e==`string`?e===``?` `:e:String(e)}var Fe,Ie=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Fe&&(Fe.active?(this.parent=Fe,this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Fe;try{return Fe=this,e()}finally{Fe=t}}}on(){++this._on===1&&(this.prevScope=Fe,Fe=this)}off(){if(this._on>0&&--this._on===0){if(Fe===this)Fe=this.prevScope;else{let e=Fe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Le(e){return new Ie(e)}function Re(){return Fe}function ze(e,t=!1){Fe&&Fe.cleanups.push(e)}var Be,Ve=new WeakSet,He=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fe&&(Fe.active?Fe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ve.has(this)&&(Ve.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ke(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,st(this),Ye(this);let e=Be,t=rt;Be=this,rt=!0;try{return this.fn()}finally{Xe(this),Be=e,rt=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)$e(e);this.deps=this.depsTail=void 0,st(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ve.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ze(this)&&this.run()}get dirty(){return Ze(this)}},Ue=0,We,Ge;function Ke(e,t=!1){if(e.flags|=8,t){e.next=Ge,Ge=e;return}e.next=We,We=e}function qe(){Ue++}function Je(){if(--Ue>0)return;if(Ge){let e=Ge;for(Ge=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;We;){let t=We;for(We=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Ye(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Xe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),$e(r),et(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ze(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Qe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Qe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ct)||(e.globalVersion=ct,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ze(e))))return;e.flags|=2;let t=e.dep,n=Be,r=rt;Be=e,rt=!0;try{Ye(e);let n=e.fn(e._value);(t.version===0||D(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Be=n,rt=r,Xe(e),e.flags&=-3}}function $e(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)$e(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function et(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function tt(e,t){e.effect instanceof He&&(e=e.effect.fn);let n=new He(e);t&&l(n,t);try{n.run()}catch(e){throw n.stop(),e}let r=n.run.bind(n);return r.effect=n,r}function nt(e){e.effect.stop()}var rt=!0,it=[];function at(){it.push(rt),rt=!1}function ot(){let e=it.pop();rt=e===void 0||e}function st(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Be;Be=void 0;try{t()}finally{Be=e}}}var ct=0,lt=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ut=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Be||!rt||Be===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Be)t=this.activeLink=new lt(Be,this),Be.deps?(t.prevDep=Be.depsTail,Be.depsTail.nextDep=t,Be.depsTail=t):Be.deps=Be.depsTail=t,dt(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Be.depsTail,t.nextDep=void 0,Be.depsTail.nextDep=t,Be.depsTail=t,Be.deps===t&&(Be.deps=e)}return t}trigger(e){this.version++,ct++,this.notify(e)}notify(e){qe();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Je()}}};function dt(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)dt(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ft=new WeakMap,pt=Symbol(``),mt=Symbol(``),ht=Symbol(``);function gt(e,t,n){if(rt&&Be){let t=ft.get(e);t||ft.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ut),r.map=t,r.key=n),r.track()}}function _t(e,t,n,r,i,a){let o=ft.get(e);if(!o){ct++;return}let s=e=>{e&&e.trigger()};if(qe(),t===`clear`)o.forEach(s);else{let i=p(e),a=i&&E(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ht||!b(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ht)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(pt)),m(e)&&s(o.get(mt)));break;case`delete`:i||(s(o.get(pt)),m(e)&&s(o.get(mt)));break;case`set`:m(e)&&s(o.get(pt))}}Je()}function vt(e,t){let n=ft.get(e);return n&&n.get(t)}function yt(e){let t=un(e);return t===e||(gt(t,`iterate`,ht),cn(e))?t:sn(e)?on(e)?t.map(e=>pn(fn(e))):t.map(pn):t.map(fn)}function bt(e){return gt(e=un(e),`iterate`,ht),e}function xt(e,t){return sn(e)?pn(on(e)?fn(t):t):fn(t)}var St={__proto__:null,[Symbol.iterator](){return Ct(this,Symbol.iterator,e=>xt(this,e))},concat(...e){return yt(this).concat(...e.map(e=>p(e)?yt(e):e))},entries(){return Ct(this,`entries`,e=>(e[1]=xt(this,e[1]),e))},every(e,t){return Tt(this,`every`,e,t,void 0,arguments)},filter(e,t){return Tt(this,`filter`,e,t,e=>e.map(e=>xt(this,e)),arguments)},find(e,t){return Tt(this,`find`,e,t,e=>xt(this,e),arguments)},findIndex(e,t){return Tt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return Tt(this,`findLast`,e,t,e=>xt(this,e),arguments)},findLastIndex(e,t){return Tt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return Tt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return Dt(this,`includes`,e)},indexOf(...e){return Dt(this,`indexOf`,e)},join(e){return yt(this).join(e)},lastIndexOf(...e){return Dt(this,`lastIndexOf`,e)},map(e,t){return Tt(this,`map`,e,t,void 0,arguments)},pop(){return Ot(this,`pop`)},push(...e){return Ot(this,`push`,e)},reduce(e,...t){return Et(this,`reduce`,e,t)},reduceRight(e,...t){return Et(this,`reduceRight`,e,t)},shift(){return Ot(this,`shift`)},some(e,t){return Tt(this,`some`,e,t,void 0,arguments)},splice(...e){return Ot(this,`splice`,e)},toReversed(){return yt(this).toReversed()},toSorted(e){return yt(this).toSorted(e)},toSpliced(...e){return yt(this).toSpliced(...e)},unshift(...e){return Ot(this,`unshift`,e)},values(){return Ct(this,`values`,e=>xt(this,e))}};function Ct(e,t,n){let r=bt(e),i=r[t]();return r!==e&&!cn(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var wt=Array.prototype;function Tt(e,t,n,r,i,a){let o=bt(e),s=o!==e&&!cn(e),c=o[t];if(c!==wt[t]){let t=c.apply(e,a);return s?fn(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,xt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Et(e,t,n,r){let i=bt(e),a=i!==e&&!cn(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=xt(e,t)),n.call(this,t,xt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?xt(e,c):c}function Dt(e,t,n){let r=un(e);gt(r,`iterate`,ht);let i=r[t](...n);return(i===-1||i===!1)&&ln(n[0])?(n[0]=un(n[0]),r[t](...n)):i}function Ot(e,t,n=[]){at(),qe();let r=un(e)[t].apply(e,n);return Je(),ot(),r}var kt=n(`__proto__,__v_isRef,__isVue`),At=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(b));function jt(e){b(e)||(e=String(e));let t=un(this);return gt(t,`has`,e),t.hasOwnProperty(e)}var Mt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Qt:Zt:i?Xt:Yt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=p(e);if(!r){let e;if(a&&(e=St[t]))return e;if(t===`hasOwnProperty`)return jt}let o=Reflect.get(e,t,mn(e)?e:n);if((b(t)?At.has(t):kt(t))||(r||gt(e,`get`,t),i))return o;if(mn(o)){let e=a&&E(t)?o:o.value;return r&&x(e)?nn(e):e}return x(o)?r?nn(o):en(o):o}},Nt=class extends Mt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=p(e)&&E(t);if(!this._isShallow){let e=sn(i);if(!cn(n)&&!sn(n)&&(i=un(i),n=un(n)),!a&&mn(i)&&!mn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:f(e,t),s=Reflect.set(e,t,n,mn(e)?e:r);return e===un(r)&&s&&(o?D(n,i)&&_t(e,`set`,t,n,i):_t(e,`add`,t,n)),s}deleteProperty(e,t){let n=f(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&_t(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!b(t)||!At.has(t))&>(e,`has`,t),n}ownKeys(e){return gt(e,`iterate`,p(e)?`length`:pt),Reflect.ownKeys(e)}},Pt=class extends Mt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Ft=new Nt,It=new Pt,Lt=new Nt(!0),Rt=new Pt(!0),zt=e=>e,Bt=e=>Reflect.getPrototypeOf(e);function Vt(e,t,n){return function(...r){let i=this.__v_raw,a=un(i),o=m(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,u=i[e](...r),d=n?zt:t?pn:fn;return!t&>(a,`iterate`,c?mt:pt),l(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function Ht(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ut(e,t){let n={get(n){let r=this.__v_raw,i=un(r),a=un(n);e||(D(n,a)&>(i,`get`,n),gt(i,`get`,a));let{has:o}=Bt(i),s=t?zt:e?pn:fn;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&>(un(t),`iterate`,pt),t.size},has(t){let n=this.__v_raw,r=un(n),i=un(t);return e||(D(t,i)&>(r,`has`,t),gt(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=un(a),s=t?zt:e?pn:fn;return!e&>(o,`iterate`,pt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return l(n,e?{add:Ht(`add`),set:Ht(`set`),delete:Ht(`delete`),clear:Ht(`clear`)}:{add(e){let n=un(this),r=Bt(n),i=un(e),a=!t&&!cn(e)&&!sn(e)?i:e;return r.has.call(n,a)||D(e,a)&&r.has.call(n,e)||D(i,a)&&r.has.call(n,i)||(n.add(a),_t(n,`add`,a,a)),this},set(e,n){!t&&!cn(n)&&!sn(n)&&(n=un(n));let r=un(this),{has:i,get:a}=Bt(r),o=i.call(r,e);o||=(e=un(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?D(n,s)&&_t(r,`set`,e,n,s):_t(r,`add`,e,n),this},delete(e){let t=un(this),{has:n,get:r}=Bt(t),i=n.call(t,e);i||=(e=un(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&_t(t,`delete`,e,void 0,a),o},clear(){let e=un(this),t=e.size!==0,n=e.clear();return t&&_t(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Vt(r,e,t)}),n}function Wt(e,t){let n=Ut(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(f(n,r)&&r in t?n:t,r,i)}var Gt={get:Wt(!1,!1)},Kt={get:Wt(!1,!0)},qt={get:Wt(!0,!1)},Jt={get:Wt(!0,!0)},Yt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap;function $t(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function en(e){return sn(e)?e:an(e,!1,Ft,Gt,Yt)}function tn(e){return an(e,!1,Lt,Kt,Xt)}function nn(e){return an(e,!0,It,qt,Zt)}function rn(e){return an(e,!0,Rt,Jt,Qt)}function an(e,t,n,r,i){if(!x(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=$t(T(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function on(e){return sn(e)?on(e.__v_raw):!!(e&&e.__v_isReactive)}function sn(e){return!!(e&&e.__v_isReadonly)}function cn(e){return!!(e&&e.__v_isShallow)}function ln(e){return e?!!e.__v_raw:!1}function un(e){let t=e&&e.__v_raw;return t?un(t):e}function dn(e){return!f(e,`__v_skip`)&&Object.isExtensible(e)&&ue(e,`__v_skip`,!0),e}var fn=e=>x(e)?en(e):e,pn=e=>x(e)?nn(e):e;function mn(e){return e?e.__v_isRef===!0:!1}function A(e){return gn(e,!1)}function hn(e){return gn(e,!0)}function gn(e,t){return mn(e)?e:new _n(e,t)}var _n=class{constructor(e,t){this.dep=new ut,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:un(e),this._value=t?e:fn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||cn(e)||sn(e);e=n?e:un(e),D(e,t)&&(this._rawValue=e,this._value=n?e:fn(e),this.dep.trigger())}};function vn(e){e.dep&&e.dep.trigger()}function j(e){return mn(e)?e.value:e}function yn(e){return v(e)?e():j(e)}var bn={get:(e,t,n)=>t===`__v_raw`?e:j(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return mn(i)&&!mn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function xn(e){return on(e)?e:new Proxy(e,bn)}var Sn=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new ut,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}};function Cn(e){return new Sn(e)}function wn(e){let t=p(e)?Array(e.length):{};for(let n in e)t[n]=On(e,n);return t}var Tn=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=b(t)?t:String(t),this._raw=un(e);let r=!0,i=e;if(!p(e)||b(this._key)||!E(this._key))do r=!ln(i)||cn(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=j(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&mn(this._raw[this._key])){let t=this._object[this._key];if(mn(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return vt(this._raw,this._key)}},En=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}};function Dn(e,t,n){return mn(e)?e:v(e)?new En(e):x(e)&&arguments.length>1?On(e,t,n):A(e)}function On(e,t,n){return new Tn(e,t,n)}var kn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ut(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ct-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Be!==this)return Ke(this,!0),!0}get value(){let e=this.dep.track();return Qe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function An(e,t,n=!1){let r,i;return v(e)?r=e:(r=e.get,i=e.set),new kn(r,i,n)}var jn={GET:`get`,HAS:`has`,ITERATE:`iterate`},Mn={SET:`set`,ADD:`add`,DELETE:`delete`,CLEAR:`clear`},Nn={},Pn=new WeakMap,Fn=void 0;function In(){return Fn}function Ln(e,t=!1,n=Fn){if(n){let t=Pn.get(n);t||Pn.set(n,t=[]),t.push(e)}}function Rn(e,t,n=r){let{immediate:i,deep:o,once:s,scheduler:c,augmentJob:l,call:d}=n,f=e=>o?e:cn(e)||o===!1||o===0?zn(e,1):zn(e),m,h,g,_,y=!1,b=!1;if(mn(e)?(h=()=>e.value,y=cn(e)):on(e)?(h=()=>f(e),y=!0):p(e)?(b=!0,y=e.some(e=>on(e)||cn(e)),h=()=>e.map(e=>{if(mn(e))return e.value;if(on(e))return f(e);if(v(e))return d?d(e,2):e()})):h=v(e)?t?d?()=>d(e,2):e:()=>{if(g){at();try{g()}finally{ot()}}let t=Fn;Fn=m;try{return d?d(e,3,[_]):e(_)}finally{Fn=t}}:a,t&&o){let e=h,t=o===!0?1/0:o;h=()=>zn(e(),t)}let x=Re(),S=()=>{m.stop(),x&&x.active&&u(x.effects,m)};if(s&&t){let e=t;t=(...t)=>{let n=e(...t);return S(),n}}let C=b?Array(e.length).fill(Nn):Nn,w=e=>{if(m.flags&1&&(m.dirty||e)){if(t){let n=m.run();if(e||o||y||(b?n.some((e,t)=>D(e,C[t])):D(n,C))){g&&g();let e=Fn;Fn=m;try{let e=[n,C===Nn?void 0:b&&C[0]===Nn?[]:C,_];C=n,d?d(t,3,e):t(...e)}finally{Fn=e}}}else m.run()}};return l&&l(w),m=new He(h),m.scheduler=c?()=>c(w,!1):w,_=e=>Ln(e,!1,m),g=m.onStop=()=>{let e=Pn.get(m);if(e){if(d)d(e,4);else for(let t of e)t();Pn.delete(m)}},t?i?w(!0):C=m.run():c?c(w.bind(null,!0),!0):m.run(),S.pause=m.pause.bind(m),S.resume=m.resume.bind(m),S.stop=S,S}function zn(e,t=1/0,n){if(t<=0||!x(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,mn(e))zn(e.value,t,n);else if(p(e))for(let r=0;r<e.length;r++)zn(e[r],t,n);else if(h(e)||m(e))e.forEach(e=>{zn(e,t,n)});else if(ee(e)){for(let r in e)zn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&zn(e[r],t,n)}return e}var Bn=[];function Vn(e){Bn.push(e)}function Hn(){Bn.pop()}function Un(e,t){}var Wn={SETUP_FUNCTION:0,0:`SETUP_FUNCTION`,RENDER_FUNCTION:1,1:`RENDER_FUNCTION`,NATIVE_EVENT_HANDLER:5,5:`NATIVE_EVENT_HANDLER`,COMPONENT_EVENT_HANDLER:6,6:`COMPONENT_EVENT_HANDLER`,VNODE_HOOK:7,7:`VNODE_HOOK`,DIRECTIVE_HOOK:8,8:`DIRECTIVE_HOOK`,TRANSITION_HOOK:9,9:`TRANSITION_HOOK`,APP_ERROR_HANDLER:10,10:`APP_ERROR_HANDLER`,APP_WARN_HANDLER:11,11:`APP_WARN_HANDLER`,FUNCTION_REF:12,12:`FUNCTION_REF`,ASYNC_COMPONENT_LOADER:13,13:`ASYNC_COMPONENT_LOADER`,SCHEDULER:14,14:`SCHEDULER`,COMPONENT_UPDATE:15,15:`COMPONENT_UPDATE`,APP_UNMOUNT_CLEANUP:16,16:`APP_UNMOUNT_CLEANUP`},Gn={sp:`serverPrefetch hook`,bc:`beforeCreate hook`,c:`created hook`,bm:`beforeMount hook`,m:`mounted hook`,bu:`beforeUpdate hook`,u:`updated`,bum:`beforeUnmount hook`,um:`unmounted hook`,a:`activated hook`,da:`deactivated hook`,ec:`errorCaptured hook`,rtc:`renderTracked hook`,rtg:`renderTriggered hook`,0:`setup function`,1:`render function`,2:`watcher getter`,3:`watcher callback`,4:`watcher cleanup function`,5:`native event handler`,6:`component event handler`,7:`vnode hook`,8:`directive hook`,9:`transition hook`,10:`app errorHandler`,11:`app warnHandler`,12:`ref function`,13:`async component loader`,14:`scheduler flush`,15:`component update`,16:`app unmount cleanup function`};function Kn(e,t,n,r){try{return r?e(...r):e()}catch(e){Jn(e,t,n)}}function qn(e,t,n,r){if(v(e)){let i=Kn(e,t,n,r);return i&&S(i)&&i.catch(e=>{Jn(e,t,n)}),i}if(p(e)){let i=[];for(let a=0;a<e.length;a++)i.push(qn(e[a],t,n,r));return i}}function Jn(e,t,n,i=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||r;if(t){let r=t.parent,i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,a)===!1)return}r=r.parent}if(o){at(),Kn(o,null,10,[e,i,a]),ot();return}}Yn(e,n,a,i,s)}function Yn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Xn=[],Zn=-1,Qn=[],$n=null,er=0,tr=Promise.resolve(),nr=null;function rr(e){let t=nr||tr;return e?t.then(this?e.bind(this):e):t}function ir(e){let t=Zn+1,n=Xn.length;for(;t<n;){let r=t+n>>>1,i=Xn[r],a=ur(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function ar(e){if(!(e.flags&1)){let t=ur(e),n=Xn[Xn.length-1];!n||!(e.flags&2)&&t>=ur(n)?Xn.push(e):Xn.splice(ir(t),0,e),e.flags|=1,or()}}function or(){nr||=tr.then(dr)}function sr(e){if(!p(e))$n&&e.id===-1?$n.splice(er+1,0,e):e.flags&1||(Qn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Qn.push(e[t]);or()}function cr(e,t,n=Zn+1){for(;n<Xn.length;n++){let t=Xn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;Xn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function lr(e){if(Qn.length){let e=[...new Set(Qn)].sort((e,t)=>ur(e)-ur(t));if(Qn.length=0,$n){for(let t=0;t<e.length;t++)$n.push(e[t]);return}for($n=e,er=0;er<$n.length;er++){let e=$n[er];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}$n=null,er=0}}var ur=e=>e.id==null?e.flags&2?-1:1/0:e.id;function dr(e){try{for(Zn=0;Zn<Xn.length;Zn++){let e=Xn[Zn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Kn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Zn<Xn.length;Zn++){let e=Xn[Zn];e&&(e.flags&=-2)}Zn=-1,Xn.length=0,lr(e),nr=null,(Xn.length||Qn.length)&&dr(e)}}var fr,pr=[];function mr(e,t){fr=e,fr?(fr.enabled=!0,pr.forEach(({event:e,args:t})=>fr.emit(e,...t)),pr=[]):typeof window<`u`&&window.HTMLElement&&!(window.navigator?.userAgent)?.includes(`jsdom`)?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{mr(e,t)}),setTimeout(()=>{fr||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,pr=[])},3e3)):pr=[]}var hr=null,gr=null;function _r(e){let t=hr;return hr=e,gr=e&&e.type.__scopeId||null,t}function vr(e){gr=e}function yr(){gr=null}var br=e=>M;function M(e,t=hr,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&_s(-1);let i=_r(t),a=ps.length,o;try{o=e(...n)}finally{for(let e=ps.length;e>a;e--)hs();_r(i),r._d&&_s(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function xr(e,t){if(hr===null)return e;let n=ec(hr),i=e.dirs||=[];for(let e=0;e<t.length;e++){let[a,o,s,c=r]=t[e];a&&(v(a)&&(a={mounted:a,updated:a}),a.deep&&zn(o),i.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function Sr(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(at(),qn(c,n,8,[e.el,s,e,t]),ot())}}function Cr(e,t){if(Is){let n=Is.provides,r=Is.parent&&Is.parent.provides;r===n&&(n=Is.provides=Object.create(r)),n[e]=t}}function wr(e,t,n=!1){let r=Ls();if(r||ao){let i=ao?ao._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&v(t)?t.call(r&&r.proxy):t}}function Tr(){return!!(Ls()||ao)}var Er=Symbol.for(`v-scx`),Dr=()=>wr(Er);function Or(e,t){return jr(e,null,t)}function kr(e,t){return jr(e,null,{flush:`post`})}function Ar(e,t){return jr(e,null,{flush:`sync`})}function N(e,t,n){return jr(e,t,n)}function jr(e,t,n=r){let{immediate:i,deep:o,flush:s,once:c}=n,u=l({},n),d=t&&i||!t&&s!==`post`,f;if(Us){if(s===`sync`){let e=Dr();f=e.__watcherHandles||=[]}else if(!d){let e=()=>{};return e.stop=a,e.resume=a,e.pause=a,e}}let p=Is;u.call=(e,t,n)=>qn(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{zo(e,p&&p.suspense)}:s!==`sync`&&(m=!0,u.scheduler=(e,t)=>{t?e():ar(e)}),u.augmentJob=e=>{t&&(e.flags|=4),m&&(e.flags|=2,p&&(e.id=p.uid,e.i=p))};let h=Rn(e,t,u);return Us&&(f?f.push(h):d&&h()),h}function Mr(e,t,n){let r=this.proxy,i=y(e)?e.includes(`.`)?Nr(r,e):()=>r[e]:e.bind(r,r),a;v(t)?a=t:(a=t.handler,n=t);let o=Bs(this),s=jr(i,a.bind(r),n);return o(),s}function Nr(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Pr=new WeakMap,Fr=Symbol(`_vte`),Ir=e=>e.__isTeleport,Lr=e=>e&&(e.disabled||e.disabled===``),Rr=e=>e&&(e.defer||e.defer===``),zr=e=>typeof SVGElement<`u`&&e instanceof SVGElement,Br=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,Vr=(e,t)=>{let n=e&&e.to;return y(n)?t?t(n):null:n},Hr={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g,parentNode:_}}=l,v=Lr(t.props),{dynamicChildren:y}=t,b=(e,t,n)=>{e.shapeFlag&16&&u(e.children,t,n,i,a,o,s,c)},x=(e=t)=>{let n=Lr(e.props),r=e.target=Vr(e.props,m),a=qr(r,e,h,p);r&&(o!==`svg`&&zr(r)?o=`svg`:o!==`mathml`&&Br(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),Kr(e,!1)))},S=e=>{let t=()=>{if(Pr.get(e)===t){if(Pr.delete(e),Lr(e.props)){let t=_(e.el)||n;b(e,t,e.anchor),Kr(e,!0)}x(e)}};Pr.set(e,t),zo(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),Rr(t.props)||a&&a.pendingBranch){S(t);return}v&&(b(t,n,i),Kr(t,!0)),x()}else{t.el=e.el;let r=t.anchor=e.anchor,u=Pr.get(e);if(u){u.flags|=8,Pr.delete(e),S(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=Lr(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||zr(p)?o=`svg`:(o===`mathml`||Br(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),Ko(e,t,!0)):c||d(e,t,_,b,i,a,o,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Ur(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=Vr(t.props,m);e&&(t.target=e,Ur(t,e,null,l,0))}else g&&Ur(t,p,h,l,1);Kr(t,v)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e,p=Lr(f),m=a||!p,h=Pr.get(e);if(h&&(h.flags|=8,Pr.delete(e)),d&&(i(l),i(u)),a&&i(c),!h&&(p||d)&&o&16)for(let e=0;e<s.length;e++){let i=s[e];r(i,t,n,m,!!i.dynamicChildren)}},move:Ur,hydrate:Wr};function Ur(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),!Pr.has(e)&&(!d||Lr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function Wr(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=Vr(t.props,c),h=Lr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||qr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||qr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),Kr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var Gr=Hr;function Kr(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function qr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[Fr]=o,e&&(r(a,e,i),r(o,e,i)),o}var Jr=Symbol(`_leaveCb`),Yr=Symbol(`_enterCb`);function Xr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ta(()=>{e.isMounted=!0}),ia(()=>{e.isUnmounting=!0}),e}var Zr=[Function,Array],Qr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Zr,onEnter:Zr,onAfterEnter:Zr,onEnterCancelled:Zr,onBeforeLeave:Zr,onLeave:Zr,onAfterLeave:Zr,onLeaveCancelled:Zr,onBeforeAppear:Zr,onAppear:Zr,onAfterAppear:Zr,onAppearCancelled:Zr},$r=e=>{let t=e.subTree;return t.component?$r(t.component):t},ei={name:`BaseTransition`,props:Qr,setup(e,{slots:t}){let n=Ls(),r=Xr();return()=>{let i=t.default&&ci(t.default(),!0),a=i&&i.length?ti(i):n.subTree?W():void 0;if(!a)return;let o=un(e),{mode:s}=o;if(r.isLeaving)return ai(a);let c=oi(a);if(!c)return ai(a);let l=ii(c,o,r,n,e=>l=e);c.type!==ds&&si(c,l);let u=n.subTree&&oi(n.subTree);if(u&&u.type!==ds&&!bs(u,c)&&$r(n).type!==ds){let e=ii(u,o,r,n);if(si(u,e),s===`out-in`&&c.type!==ds)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},ai(a);s===`in-out`&&c.type!==ds?e.delayLeave=(e,t,n)=>{let i=ri(r,u);i[String(u.key)]=u,e[Jr]=()=>{t(),e[Jr]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function ti(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==ds){t=n;break}}return t}var ni=ei;function ri(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function ii(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:m,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:_,onAppear:v,onAfterAppear:y,onAppearCancelled:b}=t,x=String(e.key),S=ri(n,e),C=(e,t)=>{e&&qn(e,r,9,t)},w=(e,t)=>{let n=t[1];C(e,t),p(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},T={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted){if(a)r=_||c;else return}t[Jr]&&t[Jr](!0);let i=S[x];i&&bs(e,i)&&i.el[Jr]&&i.el[Jr](),C(r,[t])},enter(t){if(S[x]===e)return;let r=l,i=u,o=d;if(!n.isMounted){if(a)r=v||l,i=y||u,o=b||d;else return}let s=!1;t[Yr]=e=>{s||(s=!0,C(e?o:i,[t]),T.delayedLeave&&T.delayedLeave(),t[Yr]=void 0)};let c=t[Yr].bind(null,!1);r?w(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[Yr]&&t[Yr](!0),n.isUnmounting)return r();C(f,[t]);let a=!1;t[Jr]=n=>{a||(a=!0,r(),C(n?g:h,[t]),t[Jr]=void 0,S[i]===e&&delete S[i])};let o=t[Jr].bind(null,!1);S[i]=e,m?w(m,[t,o]):o()},clone(e){let a=ii(e,t,n,r,i);return i&&i(a),a}};return T}function ai(e){if(Ui(e))return e=Es(e),e.children=null,e}function oi(e){if(!Ui(e))return Ir(e.type)&&e.children?ti(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&v(n.default))return n.default()}}function si(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;si(Ir(n.type)&&oi(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ci(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===L?(o.patchFlag&128&&i++,r=r.concat(ci(o.children,t,s))):(t||o.type!==ds)&&r.push(s==null?o:Es(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function P(e,t){return v(e)?l({name:e.name},t,{setup:e}):e}function li(){let e=Ls();return e?(e.appContext.config.idPrefix||`v`)+`-`+e.ids[0]+e.ids[1]++:``}function ui(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function di(e){let t=Ls(),n=hn(null);if(t){let i=t.refs===r?t.refs={}:t.refs;Object.defineProperty(i,e,{enumerable:!0,get:()=>n.value,set:e=>n.value=e})}return n}function fi(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var pi=new WeakMap;function mi(e,t,n,i,a=!1){if(p(e)){e.forEach((e,r)=>mi(e,t&&(p(t)?t[r]:t),n,i,a));return}if(Bi(i)&&!a){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&mi(e,t,n,i.component.subTree);return}let s=i.shapeFlag&4?ec(i.component):i.el,c=a?null:s,{i:l,r:d}=e,m=t&&t.r,h=l.refs===r?l.refs={}:l.refs,g=l.setupState,_=un(g),b=g===r?o:e=>!fi(h,e)&&f(_,e),x=(e,t)=>!(t&&fi(h,t));if(m!=null&&m!==d){if(hi(t),y(m))h[m]=null,b(m)&&(g[m]=null);else if(mn(m)){let e=t;x(m,e.k)&&(m.value=null),e.k&&(h[e.k]=null)}}if(v(d))Kn(d,l,12,[c,h]);else{let t=y(d),r=mn(d);if(t||r){let i=()=>{if(e.f){let n=t?b(d)?g[d]:h[d]:x(d)||!e.k?d.value:h[e.k];if(a)p(n)&&u(n,s);else if(p(n))n.includes(s)||n.push(s);else if(t)h[d]=[s],b(d)&&(g[d]=h[d]);else{let t=[s];x(d,e.k)&&(d.value=t),e.k&&(h[e.k]=t)}}else t?(h[d]=c,b(d)&&(g[d]=c)):r&&(x(d,e.k)&&(d.value=c),e.k&&(h[e.k]=c))};if(c){let t=()=>{i(),pi.delete(e)};t.id=-1,pi.set(e,t),zo(t,n)}else hi(e),i()}}}function hi(e){let t=pi.get(e);t&&(t.flags|=8,pi.delete(e))}var gi=!1,_i=()=>{gi||=(console.error(`Hydration completed but contains mismatches.`),!0)},vi=e=>e.namespaceURI.includes(`svg`)&&e.tagName!==`foreignObject`,yi=e=>e.namespaceURI.includes(`MathML`),bi=e=>{if(e.nodeType===1){if(vi(e))return`svg`;if(yi(e))return`mathml`}},xi=e=>e.nodeType===8;function Si(e){let{mt:t,p:n,o:{patchProp:r,createText:i,nextSibling:a,parentNode:o,remove:c,insert:l,createComment:u}}=e,d=(e,t)=>{if(!t.hasChildNodes()){n(null,e,t),lr(),t._vnode=e;return}f(t.firstChild,e,null,null,null),lr(),t._vnode=e},f=(n,r,s,c,u,d=!1)=>{d||=!!r.dynamicChildren;let b=xi(n)&&n.data===`[`,x=()=>g(n,r,s,c,u,b),{type:S,ref:C,shapeFlag:w,patchFlag:T}=r,ee=n.nodeType;r.el=n,T===-2&&(d=!1,r.dynamicChildren=null);let E=null;switch(S){case us:ee===3?(n.data!==r.children&&(_i(),n.data=r.children),E=a(n)):r.children===``?(l(r.el=i(``),o(n),n),E=n):E=x();break;case ds:y(n)?(E=a(n),v(r.el=n.content.firstChild,n,s)):E=ee!==8||b?x():a(n);break;case fs:if(b&&(n=a(n),ee=n.nodeType),ee===1||ee===3){E=n;let e=!r.children.length;for(let t=0;t<r.staticCount;t++)e&&(r.children+=E.nodeType===1?E.outerHTML:E.data),t===r.staticCount-1&&(r.anchor=E),E=a(E);return b?a(E):E}x();break;case L:E=b?h(n,r,s,c,u,d):x();break;default:if(w&1)E=(ee!==1||r.type.toLowerCase()!==n.tagName.toLowerCase())&&!y(n)?x():p(n,r,s,c,u,d);else if(w&6){r.slotScopeIds=u;let e=o(n);if(E=b?_(n):xi(n)&&n.data===`teleport start`?_(n,n.data,`teleport end`):a(n),t(r,e,null,s,c,bi(e),d),(Bi(r)||r.component.asyncDep)&&!r.component.subTree){let t;b?(t=H(fs),t.anchor=E?E.previousSibling:e.lastChild):t=n.nodeType===3?U(``):H(n.nodeType===8?ds:`div`),t.el=n,r.component.subTree=t}}else w&64?E=ee===8?r.type.hydrate(n,r,s,c,u,d,e,m):x():w&128&&(E=r.type.hydrate(n,r,s,c,bi(o(n)),u,d,e,f))}return C!=null&&mi(C,null,c,r),E},p=(e,t,n,i,a,o)=>{o||=!!t.dynamicChildren;let{type:l,dynamicProps:u,props:d,patchFlag:f,shapeFlag:p,dirs:h,transition:g}=t,_=l===`input`||l===`option`,b=!!u;if(_||b||f!==-1){h&&Sr(t,null,n,`created`);let l=!1;if(y(e)){l=Go(null,g)&&n&&n.vnode.props&&n.vnode.props.appear;let r=e.content.firstChild;if(l){let e=r.getAttribute(`class`);e&&(r.$cls=e),g.beforeEnter(r)}v(r,e,n),t.el=e=r}if(p&16&&!(d&&(d.innerHTML||d.textContent))){let r=m(e.firstChild,t,e,n,i,a,o);for(r&&!Di(e,1)&&_i();r;){let e=r;r=r.nextSibling,c(e)}}else if(p&8){let n=t.children;n[0]===`
|
|
2
|
-
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
|
|
3
|
-
`)&&(Di(e,0)||_i(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!te(a)||a[0]===`.`||t&&!te(a)||u&&u.includes(a)){if(wi(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&on(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&Ms(x,n,t),h&&Sr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&ss(()=>{x&&Ms(x,n,t),l&&g.enter(e),h&&Sr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=Os(d[t]),g=h.type===us;e?(g&&!u&&t+1<p&&Os(d[t+1]).type===us&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,Di(r,1)||_i()),n(null,h,r,null,o,s,bi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&xi(f)&&f.data===`]`?a(t.anchor=f):(_i(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(ki(e,t)||_i(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,bi(d),s),r&&(r.vnode.el=t.el,bo(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&xi(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var Ci=new Set([`src`,`srcset`,`href`,`poster`]);function wi(e,t,n){return Ci.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var Ti=`data-allow-mismatch`,Ei={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function Di(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Ti);)e=e.parentElement;return Oi(e&&e.getAttribute(Ti),t)}function Oi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(Ei[t])}}function ki(e,t){return Di(e.parentElement,1)||Ai(e)||ji(t)}function Ai(e){return e.nodeType===1&&Oi(e.getAttribute(Ti),1)}function ji({props:e}){let t=e&&e[Ti];return typeof t==`string`&&Oi(t,1)}var Mi=me().requestIdleCallback||(e=>setTimeout(e,1)),Ni=me().cancelIdleCallback||(e=>clearTimeout(e)),Pi=(e=1e4)=>t=>{let n=Mi(t,{timeout:e});return()=>Ni(n)};function Fi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Ii=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(Fi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Li=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Ri=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function zi(e,t){if(xi(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(xi(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Bi=e=>!!e.type.__asyncLoader;function Vi(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return P({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>zi(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=Is;if(ui(e),u)return()=>Hi(u,e);let t=t=>{l=null,Jn(t,e,13,!r)};if(s&&e.suspense||Us)return p().then(t=>()=>Hi(t,e)).catch(e=>(t(e),()=>r?H(r,{error:e}):null));let a=A(!1),c=A(),d=A(!!i),f,m;return aa(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&Ui(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Hi(u,e);if(c.value&&r)return H(r,{error:c.value});if(n&&!d.value)return Hi(n,e)}}})}function Hi(e,t){let{ref:n,props:r,children:i,ce:a}=t.vnode,o=H(e,r,i);return o.ref=n,o.ce=a,delete t.vnode.ce,o}var Ui=e=>e.type.__isKeepAlive,Wi={name:`KeepAlive`,__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){let n=Ls(),r=n.ctx;if(!r.renderer)return()=>{let e=t.default&&t.default();return e&&e.length===1?e[0]:e};let i=new Map,a=new Set,o=null,s=n.suspense,{renderer:{p:c,m:l,um:u,o:{createElement:d}}}=r,f=d(`div`);r.activate=(e,t,n,r,i)=>{let a=e.component;l(e,t,n,0,s),c(a.vnode,e,t,n,a,s,r,e.slotScopeIds,i),zo(()=>{a.isDeactivated=!1,a.a&&le(a.a);let t=e.props&&e.props.onVnodeMounted;t&&Ms(t,a.parent,e)},s)},r.deactivate=e=>{let t=e.component;Yo(t.m),Yo(t.a),l(e,f,null,1,s),zo(()=>{t.da&&le(t.da);let n=e.props&&e.props.onVnodeUnmounted;n&&Ms(n,t.parent,e),t.isDeactivated=!0},s)};function p(e){Xi(e),u(e,n,s,!0)}function m(e){i.forEach((t,n)=>{let r=tc(Bi(t)?t.type.__asyncResolved||{}:t.type);r&&!e(r)&&h(n)})}function h(e){let t=i.get(e);t&&(!o||!bs(t,o))?p(t):o&&Xi(o),i.delete(e),a.delete(e)}N(()=>[e.include,e.exclude],([e,t])=>{e&&m(t=>Gi(e,t)),t&&m(e=>!Gi(t,e))},{flush:`post`,deep:!0});let g=null,_=()=>{g!=null&&(Zo(n.subTree.type)?zo(()=>{let e=Zi(n.subTree);e.component&&i.set(g,e)},n.subTree.suspense):i.set(g,Zi(n.subTree)))};return ta(_),ra(_),ia(()=>{i.forEach(e=>{let{subTree:t,suspense:r}=n,i=Zi(t);if(e.type===i.type&&e.key===i.key){Xi(i);let e=i.component.da;e&&zo(e,r);return}p(e)})}),()=>{if(g=null,!t.default)return o=null;let n=t.default(),r=n[0];if(n.length>1)return o=null,n;if(!ys(r)||!(r.shapeFlag&4)&&!(r.shapeFlag&128))return o=null,r;let s=Zi(r);if(s.type===ds)return o=null,s;let c=s.type,l=tc(Bi(s)?s.type.__asyncResolved||{}:c),{include:u,exclude:d,max:f}=e;if(u&&(!l||!Gi(u,l))||d&&l&&Gi(d,l))return s.shapeFlag&=-257,o=s,r;let p=s.key==null?c:s.key,m=i.get(p);return s.el&&(s=Es(s),r.shapeFlag&128&&(r.ssContent=s)),g=p,m?(s.el=m.el,s.component=m.component,s.transition&&si(s,s.transition),s.shapeFlag|=512,a.delete(p),a.add(p)):(a.add(p),f&&a.size>parseInt(f,10)&&h(a.values().next().value)),s.shapeFlag|=256,o=s,Zo(r.type)?r:s}}};function Gi(e,t){return p(e)?e.some(e=>Gi(e,t)):y(e)?e.split(`,`).includes(t):_(e)?(e.lastIndex=0,e.test(t)):!1}function Ki(e,t){Ji(e,`a`,t)}function qi(e,t){Ji(e,`da`,t)}function Ji(e,t,n=Is){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Qi(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Ui(e.parent.vnode)&&Yi(r,t,n,e),e=e.parent}}function Yi(e,t,n,r){let i=Qi(t,e,r,!0);aa(()=>{u(r[t],i)},n)}function Xi(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Zi(e){return e.shapeFlag&128?e.ssContent:e}function Qi(e,t,n=Is,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{at();let i=Bs(n),a=qn(t,n,e,r);return i(),ot(),a};return r?i.unshift(a):i.push(a),a}}var $i=e=>(t,n=Is)=>{(!Us||e===`sp`)&&Qi(e,(...e)=>t(...e),n)},ea=$i(`bm`),ta=$i(`m`),na=$i(`bu`),ra=$i(`u`),ia=$i(`bum`),aa=$i(`um`),oa=$i(`sp`),sa=$i(`rtg`),ca=$i(`rtc`);function la(e,t=Is){Qi(`ec`,e,t)}var ua=`components`,da=`directives`;function fa(e,t){return ga(ua,e,!0,t)||e}var pa=Symbol.for(`v-ndc`);function ma(e){return y(e)?ga(ua,e,!1)||e:e||pa}function ha(e){return ga(da,e)}function ga(e,t,n=!0,r=!1){let i=hr||Is;if(i){let n=i.type;if(e===ua){let e=tc(n,!1);if(e&&(e===t||e===ie(t)||e===se(ie(t))))return n}let a=_a(i[e]||n[e],t)||_a(i.appContext[e],t);return!a&&r?n:a}}function _a(e,t){return e&&(e[t]||e[ie(t)]||e[se(ie(t))])}function F(e,t,n,r){let i,a=n&&n[r],o=p(e);if(o||y(e)){let n=o&&on(e),r=!1,s=!1;n&&(r=!cn(e),s=sn(e),e=bt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?pn(fn(e[n])):fn(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(x(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}function va(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(p(r))for(let t=0;t<r.length;t++)e[r[t].name]=r[t].fn;else r&&(e[r.name]=r.key?(...e)=>{let t=r.fn(...e);return t&&(t.key=r.key),t}:r.fn)}return e}function I(e,t,n,r,i,a){if(n??={},hr.ce||hr.parent&&Bi(hr.parent)&&hr.parent.ce){let e=a!=null&&n.key==null?l({},n,{key:a}):n,i=Object.keys(e).length>0;return t!=="default"&&(e.name=t),R(),B(L,null,[H(`slot`,e,r&&r())],i?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);let s=ps.length;R();let c;try{let i=o&&ya(o(n)),s=n.key||a||i&&i.key;c=B(L,{key:(s&&!b(s)?s:`_${t}`)+(!i&&r?`_fb`:``)},i||(r?r():[]),i&&e._===1?64:-2)}catch(e){for(let e=ps.length;e>s;e--)hs();throw e}finally{o&&o._c&&(o._d=!0)}return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),c}function ya(e){return e.some(e=>!ys(e)||!(e.type===ds||e.type===L&&!ya(e.children)))?e:null}function ba(e,t){let n={};for(let r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:ce(r)]=e[r];return n}var xa=e=>e?Hs(e)?ec(e):xa(e.parent):null,Sa=l(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>xa(e.parent),$root:e=>xa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Ka(e),$forceUpdate:e=>e.f||=()=>{ar(e.update)},$nextTick:e=>e.n||=rr.bind(e.proxy),$watch:e=>Mr.bind(e)}),Ca=(e,t)=>e!==r&&!e.__isScriptSetup&&f(e,t),wa={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:i,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return i[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else if(Ca(i,t))return s[t]=1,i[t];else if(a!==r&&f(a,t))return s[t]=2,a[t];else if(f(o,t))return s[t]=3,o[t];else if(n!==r&&f(n,t))return s[t]=4,n[t];else Va&&(s[t]=0)}let u=Sa[t],d,p;if(u)return t===`$attrs`&>(e.attrs,`get`,``),u(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==r&&f(n,t))return s[t]=4,n[t];if(p=l.config.globalProperties,f(p,t))return p[t]},set({_:e},t,n){let{data:i,setupState:a,ctx:o}=e;return Ca(a,t)?(a[t]=n,!0):i!==r&&f(i,t)?(i[t]=n,!0):f(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:a,props:o,type:s}},c){let l;return!!(n[c]||e!==r&&c[0]!==`$`&&f(e,c)||Ca(t,c)||f(o,c)||f(i,c)||f(Sa,c)||f(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?f(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}},Ta=l({},wa,{get(e,t){if(t!==Symbol.unscopables)return wa.get(e,t,e)},has(e,t){return t[0]!==`_`&&!he(t)}});function Ea(){return null}function Da(){return null}function Oa(e){}function ka(e){}function Aa(){return null}function ja(){}function Ma(e,t){return null}function Na(){return Fa(`useSlots`).slots}function Pa(){return Fa(`useAttrs`).attrs}function Fa(e){let t=Ls();return t.setupContext||=$s(t)}function Ia(e){return p(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function La(e,t){let n=Ia(e);for(let e in t){if(e.startsWith(`__skip`))continue;let r=n[e];r?p(r)||v(r)?r=n[e]={type:r,default:t[e]}:r.default=t[e]:r===null&&(r=n[e]={default:t[e]}),r&&t[`__skip_${e}`]&&(r.skipFactory=!0)}return n}function Ra(e,t){return!e||!t?e||t:p(e)&&p(t)?e.concat(t):l({},Ia(e),Ia(t))}function za(e,t){let n={};for(let r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function Ba(e){let t=Ls(),n=Us,r=e();Vs(),n&&zs(!1);let i=()=>{Bs(t),n&&zs(!0)},a=()=>{Ls()!==t&&t.scope.off(),Vs(),n&&zs(!1)};return S(r)&&(r=r.catch(e=>{throw i(),Promise.resolve().then(()=>Promise.resolve().then(a)),e})),[r,()=>{i(),Promise.resolve().then(a)}]}var Va=!0;function Ha(e){let t=Ka(e),n=e.proxy,r=e.ctx;Va=!1,t.beforeCreate&&Wa(t.beforeCreate,e,`bc`);let{data:i,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:f,mounted:m,beforeUpdate:h,updated:g,activated:_,deactivated:y,beforeDestroy:b,beforeUnmount:S,destroyed:C,unmounted:w,render:T,renderTracked:ee,renderTriggered:E,errorCaptured:te,serverPrefetch:ne,expose:re,inheritAttrs:ie,components:ae,directives:oe,filters:se}=t;if(u&&Ua(u,r,null),s)for(let e in s){let t=s[e];v(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);x(t)&&(e.data=en(t))}if(Va=!0,o)for(let e in o){let t=o[e],i=G({get:v(t)?t.bind(n,n):v(t.get)?t.get.bind(n,n):a,set:!v(t)&&v(t.set)?t.set.bind(n):a});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(c)for(let e in c)Ga(c[e],r,n,e);if(l){let e=v(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Cr(t,e[t])})}d&&Wa(d,e,`c`);function ce(e,t){p(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(ce(ea,f),ce(ta,m),ce(na,h),ce(ra,g),ce(Ki,_),ce(qi,y),ce(la,te),ce(ca,ee),ce(sa,E),ce(ia,S),ce(aa,w),ce(oa,ne),p(re)){if(re.length){let t=e.exposed||={};re.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}T&&e.render===a&&(e.render=T),ie!=null&&(e.inheritAttrs=ie),ae&&(e.components=ae),oe&&(e.directives=oe),ne&&ui(e)}function Ua(e,t,n=a){p(e)&&(e=Za(e));for(let n in e){let r=e[n],i;i=x(r)?`default`in r?wr(r.from||n,r.default,!0):wr(r.from||n):wr(r),mn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Wa(e,t,n){qn(p(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Ga(e,t,n,r){let i=r.includes(`.`)?Nr(n,r):()=>n[r];if(y(e)){let n=t[e];v(n)&&N(i,n)}else if(v(e))N(i,e.bind(n));else if(x(e)){if(p(e))e.forEach(e=>Ga(e,t,n,r));else{let r=v(e.handler)?e.handler.bind(n):t[e.handler];v(r)&&N(i,r,e)}}}function Ka(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>qa(c,e,o,!0)),qa(c,t,o)),x(t)&&a.set(t,c),c}function qa(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&qa(e,a,n,!0),i&&i.forEach(t=>qa(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Ja[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Ja={data:Ya,props:eo,emits:eo,methods:$a,computed:$a,beforeCreate:Qa,created:Qa,beforeMount:Qa,mounted:Qa,beforeUpdate:Qa,updated:Qa,beforeDestroy:Qa,beforeUnmount:Qa,destroyed:Qa,unmounted:Qa,activated:Qa,deactivated:Qa,errorCaptured:Qa,serverPrefetch:Qa,components:$a,directives:$a,watch:to,provide:Ya,inject:Xa};function Ya(e,t){return t?e?function(){return l(v(e)?e.call(this,this):e,v(t)?t.call(this,this):t)}:t:e}function Xa(e,t){return $a(Za(e),Za(t))}function Za(e){if(p(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qa(e,t){return e?[...new Set([].concat(e,t))]:t}function $a(e,t){return e?l(Object.create(null),e,t):t}function eo(e,t){return e?p(e)&&p(t)?[...new Set([...e,...t])]:l(Object.create(null),Ia(e),Ia(t??{})):t}function to(e,t){if(!e)return t;if(!t)return e;let n=l(Object.create(null),e);for(let r in t)n[r]=Qa(e[r],t[r]);return n}function no(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ro=0;function io(e,t){return function(n,r=null){v(n)||(n=l({},n)),r!=null&&!x(r)&&(r=null);let i=no(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ro++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:sc,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&v(e.install)?(a.add(e),e.install(c,...t)):v(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||H(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,ec(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(qn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=ao;ao=c;try{return e()}finally{ao=t}}};return c}}var ao=null;function oo(e,t,n=r){let i=Ls(),a=ie(t),o=oe(t),s=so(e,a),c=Cn((s,c)=>{let l,u=r,d;return Ar(()=>{let t=e[a];D(l,t)&&(l=t,c())}),{get(){return s(),n.get?n.get(l):l},set(e){let s=n.set?n.set(e):e;if(!D(s,l)&&!(u!==r&&D(e,u)))return;let f=i.vnode.props,p=!!(f&&(t in f||a in f||o in f)&&(`onUpdate:${t}`in f||`onUpdate:${a}`in f||`onUpdate:${o}`in f));p||(l=e,c()),i.emit(`update:${t}`,s),D(e,u)&&(D(e,s)&&!D(s,d)||p&&u!==r&&!D(s,l))&&c(),u=e,d=s}}});return c[Symbol.iterator]=()=>{let e=0;return{next(){return e<2?{value:e++?s||r:c,done:!1}:{done:!0}}}},c}var so=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ie(t)}Modifiers`]||e[`${oe(t)}Modifiers`];function co(e,t,...n){if(e.isUnmounted)return;let i=e.vnode.props||r,a=n,o=t.startsWith(`update:`),s=o&&so(i,t.slice(7));s&&(s.trim&&(a=n.map(e=>y(e)?e.trim():e)),s.number&&(a=a.map(de)));let c,l=i[c=ce(t)]||i[c=ce(ie(t))];!l&&o&&(l=i[c=ce(oe(t))]),l&&qn(l,e,6,a);let u=i[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,qn(u,e,6,a)}}var lo=new WeakMap;function uo(e,t,n=!1){let r=n?lo:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!v(e)){let r=e=>{let n=uo(e,t,!0);n&&(s=!0,l(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(x(e)&&r.set(e,null),null):(p(a)?a.forEach(e=>o[e]=null):l(o,a),x(e)&&r.set(e,o),o)}function fo(e,t){return!e||!s(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),f(e,t[0].toLowerCase()+t.slice(1))||f(e,oe(t))||f(e,t))}function po(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:l,render:u,renderCache:d,props:f,data:p,setupState:m,ctx:h,inheritAttrs:g}=e,_=_r(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Os(u.call(t,e,d,f,m,p,h)),y=s}else{let e=t;v=Os(e.length>1?e(f,{attrs:s,slots:o,emit:l}):e(f,null)),y=t.props?s:ho(s)}}catch(t){ps.length=0,Jn(t,e,1),v=H(ds)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(c)&&(y=go(y,a)),b=Es(b,y,!1,!0))}return n.dirs&&(b=Es(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&si(Ir(b.type)&&oi(b)||b,n.transition),v=b,_r(_),v}function mo(e,t=!0){let n;for(let t=0;t<e.length;t++){let r=e[t];if(ys(r)){if(r.type!==ds||r.children===`v-if`){if(n)return;n=r}}else return}return n}var ho=e=>{let t;for(let n in e)(n===`class`||n===`style`||s(n))&&((t||={})[n]=e[n]);return t},go=(e,t)=>{let n={};for(let r in e)(!c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function _o(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?vo(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(yo(o,r,n)&&!fo(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||vo(r,o,l):!!o;return!1}function vo(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(yo(t,e,a)&&!fo(n,a))return!0}return!1}function yo(e,t,n){let r=e[n],i=t[n];return n===`style`&&x(r)&&x(i)?!ke(r,i):r!==i}function bo({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var xo={},So=()=>Object.create(xo),Co=e=>Object.getPrototypeOf(e)===xo;function wo(e,t,n,r=!1){let i={},a=So();e.propsDefaults=Object.create(null),Eo(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:tn(i):e.type.props?i:a,e.attrs=a}function To(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=un(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(fo(e.emitsOptions,o))continue;let u=t[o];if(c){if(f(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=ie(o);i[t]=Do(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Eo(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!f(t,a)&&((r=oe(a))===a||!f(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Do(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!f(t,e))&&(delete a[e],l=!0)}l&&_t(e.attrs,`set`,``)}function Eo(e,t,n,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let r in t){if(te(r))continue;let l=t[r],u;a&&f(a,u=ie(r))?!o||!o.includes(u)?n[u]=l:(c||={})[u]=l:fo(e.emitsOptions,r)||(!(r in i)||l!==i[r])&&(i[r]=l,s=!0)}if(o){let t=un(n),i=c||r;for(let r=0;r<o.length;r++){let s=o[r];n[s]=Do(a,t,s,i[s],e,!f(i,s))}}return s}function Do(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=f(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&v(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Bs(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===oe(n))&&(r=!0))}return r}var Oo=new WeakMap;function ko(e,t,n=!1){let a=n?Oo:t.propsCache,o=a.get(e);if(o)return o;let s=e.props,c={},u=[],d=!1;if(!v(e)){let r=e=>{d=!0;let[n,r]=ko(e,t,!0);l(c,n),r&&u.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!s&&!d)return x(e)&&a.set(e,i),i;if(p(s))for(let e=0;e<s.length;e++){let t=ie(s[e]);Ao(t)&&(c[t]=r)}else if(s)for(let e in s){let t=ie(e);if(Ao(t)){let n=s[e],r=c[t]=p(n)||v(n)?{type:n}:l({},n),i=r.type,a=!1,o=!0;if(p(i))for(let e=0;e<i.length;++e){let t=i[e],n=v(t)&&t.name;if(n===`Boolean`){a=!0;break}n===`String`&&(o=!1)}else a=v(i)&&i.name===`Boolean`;r[0]=a,r[1]=o,(a||f(r,`default`))&&u.push(t)}}let m=[c,u];return x(e)&&a.set(e,m),m}function Ao(e){return e[0]!==`$`&&!te(e)}var jo=e=>e===`_`||e===`_ctx`||e===`$stable`,Mo=e=>p(e)?e.map(Os):[Os(e)],No=(e,t,n)=>{if(t._n)return t;let r=M((...e)=>Mo(t(...e)),n);return r._c=!1,r},Po=(e,t,n)=>{let r=e._ctx;for(let n in e){if(jo(n))continue;let i=e[n];if(v(i))t[n]=No(n,i,r);else if(i!=null){let e=Mo(i);t[n]=()=>e}}},Fo=(e,t)=>{let n=Mo(t);e.slots.default=()=>n},Io=(e,t,n)=>{for(let r in t)(n||!jo(r))&&(e[r]=t[r])},Lo=(e,t,n)=>{let r=e.slots=So();if(e.vnode.shapeFlag&32){let e=t._;e?(Io(r,t,n),n&&ue(r,`_`,e,!0)):Po(t,r)}else t&&Fo(e,t)},Ro=(e,t,n)=>{let{vnode:i,slots:a}=e,o=!0,s=r;if(i.shapeFlag&32){let e=t._;e?n&&e===1?o=!1:Io(a,t,n):(o=!t.$stable,Po(t,a)),s=t}else t&&(Fo(e,t),s={default:1});if(o)for(let e in a)!jo(e)&&s[e]==null&&delete a[e]},zo=ss;function Bo(e){return Ho(e)}function Vo(e){return Ho(e,Si)}function Ho(e,t){let n=me();n.__VUE__=!0;let{insert:o,remove:s,patchProp:c,createElement:l,createText:u,createComment:d,setText:f,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=a,insertStaticContent:_}=e,v=(e,t,n,r=null,a=null,o=null,s=void 0,c=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!bs(e,t)&&(r=O(e),ge(e,a,o,!0),e=null),t.patchFlag===-2&&(l=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===i&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:u,ref:d,shapeFlag:f}=t;switch(u){case us:y(e,t,n,r);break;case ds:b(e,t,n,r);break;case fs:e??x(t,n,r,s);break;case L:ae(e,t,n,r,a,o,s,c,l);break;default:f&1?w(e,t,n,r,a,o,s,c,l):f&6?oe(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,Ce)}d!=null&&a?mi(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&mi(e.ref,null,o,e,!0)},y=(e,t,n,r)=>{if(e==null)o(t.el=u(t.children),n,r);else{let n=t.el=e.el;t.children!==e.children&&f(n,t.children)}},b=(e,t,n,r)=>{e==null?o(t.el=d(t.children||``),n,r):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,r)=>{let i;for(;e&&e!==t;)i=h(e),o(e,n,r),e=i;o(t,n,r)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),s(e),e=n;s(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),ne(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,r,i,a,s,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=l(e.type,a,m&&m.is,m),h&8?p(d,e.children):h&16&&E(e.children,d,null,r,i,Uo(e,a),s,u),_&&Sr(e,null,r,`created`),ee(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!te(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&Ms(f,r,e)}_&&Sr(e,null,r,`beforeMount`);let v=Go(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&zo(()=>{try{f&&Ms(f,r,e),v&&g.enter(d),_&&Sr(e,null,r,`mounted`)}finally{}},i)},ee=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||Zo(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ee(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},E=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?ks(e[l]):Os(e[l]);v(null,c,t,n,r,i,a,o,s)}},ne=(e,t,n,i,a,o,s)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:d,dirs:f}=t;u|=e.patchFlag&16;let m=e.props||r,h=t.props||r,g;if(n&&Wo(n,!1),(g=h.onVnodeBeforeUpdate)&&Ms(g,n,t,e),f&&Sr(t,e,n,`beforeUpdate`),n&&Wo(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(u=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(l,``),d?re(e.dynamicChildren,d,l,n,i,Uo(t,a),o):s||de(e,t,l,null,n,i,Uo(t,a),o,!1),u>0){if(u&16)ie(l,m,h,n,a);else if(u&2&&m.class!==h.class&&c(l,`class`,null,h.class,a),u&4&&c(l,`style`,m.style,h.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],i=m[r],o=h[r];(o!==i||r===`value`)&&c(l,r,i,o,a,n)}}u&1&&e.children!==t.children&&p(l,t.children)}else!s&&d==null&&ie(l,m,h,n,a);((g=h.onVnodeUpdated)||f)&&zo(()=>{g&&Ms(g,n,t,e),f&&Sr(t,e,n,`updated`)},i)},re=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===L||!bs(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},ie=(e,t,n,i,a)=>{if(t!==n){if(t!==r)for(let r in t)!te(r)&&!(r in n)&&c(e,r,t[r],null,a,i);for(let r in n){if(te(r))continue;let o=n[r],s=t[r];o!==s&&r!==`value`&&c(e,r,s,o,a,i)}`value`in n&&c(e,`value`,t.value,n.value,a)}},ae=(e,t,n,r,i,a,s,c,l)=>{let d=t.el=e?e.el:u(``),f=t.anchor=e?e.anchor:u(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(c=c?c.concat(h):h),e==null?(o(d,n,r),o(f,n,r),E(t.children||[],n,f,i,a,s,c,l)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(re(e.dynamicChildren,m,n,i,a,s,c),(t.key!=null||i&&t===i.subTree)&&Ko(e,t,!0)):de(e,t,n,f,i,a,s,c,l)},oe=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):se(t,n,r,i,a,o,c):ce(e,t,c)},se=(e,t,n,r,i,a,o)=>{let s=e.component=Fs(e,r,i);if(Ui(e)&&(s.ctx.renderer=Ce),Ws(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,D,o),!e.el){let r=s.subTree=H(ds);b(null,r,t,n),e.placeholder=r.el}}else D(s,e,t,n,i,a,o)},ce=(e,t,n)=>{let r=t.component=e.component;if(_o(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,ue(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},D=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Jo(e);if(n){t&&(t.el=c.el,ue(e,t,o)),n.asyncDep.then(()=>{zo(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Wo(e,!1),t?(t.el=c.el,ue(e,t,o)):t=c,n&&le(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Ms(d,s,t,c),Wo(e,!0);let f=po(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),O(p),e,i,a),t.el=f.el,u===null&&bo(e,f.el),r&&zo(r,i),(d=t.props&&t.props.onVnodeUpdated)&&zo(()=>Ms(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Bi(t);if(Wo(e,!1),l&&le(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Ms(o,d,t),Wo(e,!0),s&&Te){let t=()=>{e.subTree=po(e),Te(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=po(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&zo(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;zo(()=>Ms(o,d,e),i)}(t.shapeFlag&256||d&&Bi(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&zo(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new He(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>ar(u),Wo(e,!0),l()},ue=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,To(e,t.props,r,n),Ro(e,t.children,n),at(),cr(e),ot()},de=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){pe(l,d,n,r,i,a,o,s,c);return}if(f&256){fe(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&be(l,i,a),d!==l&&p(n,d)):u&16?m&16?pe(l,d,n,r,i,a,o,s,c):be(l,i,a,!0):(u&8&&p(n,``),m&16&&E(d,n,r,i,a,o,s,c))},fe=(e,t,n,r,a,o,s,c,l)=>{e||=i,t||=i;let u=e.length,d=t.length,f=Math.min(u,d),p=0;for(;p<f;p++){let r=t[p]=l?ks(t[p]):Os(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?be(e,a,o,!0,!1,f):E(t,n,r,a,o,s,c,l,f)},pe=(e,t,n,r,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,p=d-1;for(;u<=f&&u<=p;){let r=e[u],i=t[u]=l?ks(t[u]):Os(t[u]);if(bs(r,i))v(r,i,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=p;){let r=e[f],i=t[p]=l?ks(t[p]):Os(t[p]);if(bs(r,i))v(r,i,n,null,a,o,s,c,l);else break;f--,p--}if(u>f){if(u<=p){let e=p+1,i=e<d?t[e].el:r;for(;u<=p;)v(null,t[u]=l?ks(t[u]):Os(t[u]),n,i,a,o,s,c,l),u++}}else if(u>p)for(;u<=f;)ge(e[u],a,o,!0),u++;else{let m=u,h=u,g=new Map;for(u=h;u<=p;u++){let e=t[u]=l?ks(t[u]):Os(t[u]);e.key!=null&&g.set(e.key,u)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(u=0;u<b;u++)C[u]=0;for(u=m;u<=f;u++){let r=e[u];if(y>=b){ge(r,a,o,!0);continue}let i;if(r.key!=null)i=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&bs(r,t[_])){i=_;break}i===void 0?ge(r,a,o,!0):(C[i-h]=u+1,i>=S?S=i:x=!0,v(r,t[i],n,null,a,o,s,c,l),y++)}let w=x?qo(C):i;for(_=w.length-1,u=b-1;u>=0;u--){let e=h+u,i=t[e],f=t[e+1],p=e+1<d?f.el||Xo(f):r;C[u]===0?v(null,i,n,p,a,o,s,c,l):x&&(_<0||u!==w[_]?he(i,n,p,2):_--)}}},he=(e,t,n,r,i=null)=>{let{el:a,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){he(e.component.subTree,t,n,r);return}if(d&128){e.suspense.move(t,n,r);return}if(d&64){c.move(e,t,n,Ce);return}if(c===L){o(a,t,n);for(let e=0;e<u.length;e++)he(u[e],t,n,r);o(e.anchor,t,n);return}if(c===fs){S(e,t,n);return}if(r!==2&&d&1&&l){if(r===0)l.persisted&&!a[Jr]?o(a,t,n):(l.beforeEnter(a),o(a,t,n),zo(()=>l.enter(a),i));else{let{leave:r,delayLeave:i,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?s(a):o(a,t,n)},d=()=>{let e=a._isLeaving||!!a[Jr];a._isLeaving&&a[Jr](!0),l.persisted&&!e?u():r(a,()=>{u(),c&&c()})};i?i(a,u,d):d()}}else o(a,t,n)},ge=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(at(),mi(s,null,n,e,!0),ot()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!Bi(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&Ms(_,t,e),u&6)ye(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Sr(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Ce,r):l&&!l.hasOnce&&(a!==L||d>0&&d&64)?be(l,t,n,!1,!0):(a===L&&d&384||!i&&u&16)&&be(c,t,n),r&&_e(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&zo(()=>{_&&Ms(_,t,e),h&&Sr(e,null,t,`unmounted`),v&&(e.el=null)},n)},_e=e=>{let{type:t,el:n,anchor:r,transition:i}=e;if(t===L){ve(n,r);return}if(t===fs){C(e),i&&!i.persisted&&i.afterLeave&&i.afterLeave();return}let a=()=>{s(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(e.shapeFlag&1&&i&&!i.persisted){let{leave:t,delayLeave:r}=i,o=()=>t(n,a);r?r(e.el,a,o):o()}else a()},ve=(e,t)=>{let n;for(;e!==t;)n=h(e),s(e),e=n;s(t)},ye=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Yo(c),Yo(l),r&&le(r),i.stop(),a?(a.flags|=8,ge(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,ge(o,e,t,n)),s&&zo(s,t),zo(()=>{e.isUnmounted=!0},t)},be=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)ge(e[o],t,n,r,i)},O=e=>{if(e.shapeFlag&6)return O(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[Fr];return n?h(n):t},xe=!1,Se=(e,t,n)=>{let r;e==null?t._vnode&&(ge(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,xe||=(xe=!0,cr(r),lr(),!1)},Ce={p:v,um:ge,m:he,r:_e,mt:se,mc:E,pc:de,pbc:re,n:O,o:e},we,Te;return t&&([we,Te]=t(Ce)),{render:Se,hydrate:we,createApp:io(Se,we)}}function Uo({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Wo({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Go(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ko(e,t,n=!1){let r=e.children,i=t.children;if(p(r)&&p(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=ks(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ko(t,a)),a.type===us&&(a.patchFlag===-1&&(a=i[e]=ks(a)),a.el=t.el),a.type===ds&&!a.el&&(a.el=t.el)}}function qo(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Jo(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Jo(t)}function Yo(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Xo(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?Xo(t.subTree):null}var Zo=e=>e.__isSuspense,Qo=0,$o={name:`Suspense`,__isSuspense:!0,process(e,t,n,r,i,a,o,s,c,l){if(e==null)ts(t,n,r,i,a,o,s,c,l);else{if(a&&a.deps>0&&!e.suspense.isInFallback&&!a.isHydrating){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}ns(e,t,n,r,i,o,s,c,l)}},hydrate:is,normalize:as};function es(e,t){let n=e.props&&e.props[t];v(n)&&n()}function ts(e,t,n,r,i,a,o,s,c){let{p:l,o:{createElement:u}}=c,d=u(`div`),f=e.suspense=rs(e,i,r,t,d,n,a,o,s,c);l(null,f.pendingBranch=e.ssContent,d,null,r,f,a,o),f.deps>0?(es(e,`onPending`),es(e,`onFallback`),l(null,e.ssFallback,t,n,r,null,a,o),cs(f,e.ssFallback)):f.resolve(!1,!0)}function ns(e,t,n,r,i,a,o,s,{p:c,um:l,o:{createElement:u}}){let d=t.suspense=e.suspense;d.vnode=t,t.el=e.el;let f=t.ssContent,p=t.ssFallback,{activeBranch:m,pendingBranch:h,isInFallback:g,isHydrating:_}=d;if(h)d.pendingBranch=f,bs(h,f)?(d.deps++,c(h,f,_?n:d.hiddenContainer,null,i,d,a,o,s),d.deps--,d.deps<=0?d.resolve():g&&!_&&!d.isFallbackMountPending&&(c(m,p,n,r,i,null,a,o,s),cs(d,p))):(d.pendingId=Qo++,_?(d.isHydrating=!1,d.activeBranch=h):l(h,i,d),d.deps=0,d.effects.length=0,d.hiddenContainer=u(`div`),g?(c(null,f,d.hiddenContainer,null,i,d,a,o,s),d.deps<=0?d.resolve():d.isFallbackMountPending||(c(m,p,n,r,i,null,a,o,s),cs(d,p))):m&&bs(m,f)?(c(m,f,n,r,i,d,a,o,s),d.resolve(!0)):(c(null,f,d.hiddenContainer,null,i,d,a,o,s),d.deps<=0&&d.resolve()));else if(m&&bs(m,f))c(m,f,n,r,i,d,a,o,s),cs(d,f);else if(es(t,`onPending`),d.pendingBranch=f,d.pendingId=f.shapeFlag&512?f.component.suspenseId:Qo++,c(null,f,d.hiddenContainer,null,i,d,a,o,s),d.deps<=0)d.resolve();else{let{timeout:e,pendingId:t}=d;e>0?setTimeout(()=>{d.pendingId===t&&d.fallback(p)},e):e===0&&d.fallback(p)}}function rs(e,t,n,r,i,a,o,s,c,l,u=!1){let{p:d,m:f,um:p,n:m,o:{parentNode:h,remove:g}}=l,_,v=ls(e);v&&t&&t.pendingBranch&&(_=t.pendingId,t.deps++);let y=e.props?fe(e.props.timeout):void 0,b=a,x={vnode:e,parent:t,parentComponent:n,namespace:o,container:r,hiddenContainer:i,deps:0,pendingId:Qo++,timeout:typeof y==`number`?y:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!u,isHydrating:u,isUnmounted:!1,effects:[],resolve(e=!1,n=!1){let{vnode:r,activeBranch:i,pendingBranch:o,pendingId:s,effects:c,parentComponent:l,container:u,isInFallback:d}=x,g=!1;if(x.isHydrating)x.isHydrating=!1;else if(!e){g=i&&o.transition&&o.transition.mode===`out-in`;let e=!1;g&&(i.transition.afterLeave=()=>{s===x.pendingId&&(f(o,u,a===b&&!e?m(i):a,0),sr(c),d&&r.ssFallback&&(r.ssFallback.el=null))}),i&&!x.isFallbackMountPending&&(h(i.el)===u&&(a=m(i),e=!0),p(i,l,x,!0),!g&&d&&r.ssFallback&&zo(()=>r.ssFallback.el=null,x)),g||f(o,u,a,0)}x.isFallbackMountPending=!1,cs(x,o),x.pendingBranch=null,x.isInFallback=!1;let y=x.parent,S=!1;for(;y;){if(y.pendingBranch){for(let e=0;e<c.length;e++)y.effects.push(c[e]);S=!0;break}y=y.parent}!S&&!g&&sr(c),x.effects=[],v&&t&&t.pendingBranch&&_===t.pendingId&&(_=void 0,t.deps--,t.deps===0&&!n&&t.resolve()),es(r,`onResolve`)},fallback(e){if(!x.pendingBranch)return;let{vnode:t,activeBranch:n,parentComponent:r,container:i,namespace:a}=x;es(t,`onFallback`);let o=m(n),l=()=>{if(x.isFallbackMountPending=!1,!x.isInFallback)return;let e=x.vnode.ssFallback;d(null,e,i,o,r,null,a,s,c),cs(x,e)},u=e.transition&&e.transition.mode===`out-in`;u&&(x.isFallbackMountPending=!0,n.transition.afterLeave=l),x.isInFallback=!0,p(n,r,null,!0),u||l()},move(e,t,n){x.activeBranch&&f(x.activeBranch,e,t,n),x.container=e},next(){return x.activeBranch&&m(x.activeBranch)},registerDep(e,t,n){let r=!!x.pendingBranch;r&&x.deps++;let i=e.vnode.el;e.asyncDep.catch(t=>{Jn(t,e,0)}).then(a=>{if(e.isUnmounted||x.isUnmounted||x.pendingId!==e.suspenseId)return;if(Vs(),i&&!e.scope.active){r&&--x.deps===0&&x.resolve();return}e.asyncResolved=!0;let{vnode:s}=e;Ks(e,a,!1),i&&(s.el=i);let c=!i&&e.subTree.el;t(e,s,h(i||e.subTree.el),i?null:m(e.subTree),x,o,n),c&&(s.placeholder=null,g(c)),bo(e,s.el),r&&--x.deps===0&&x.resolve()})},unmount(e,t){x.isUnmounted=!0,x.activeBranch&&p(x.activeBranch,n,e,t),x.pendingBranch&&p(x.pendingBranch,n,e,t)}};return x}function is(e,t,n,r,i,a,o,s,c){let l=t.suspense=rs(t,r,n,e.parentNode,document.createElement(`div`),null,i,a,o,s,!0),u=c(e,l.pendingBranch=t.ssContent,n,l,a,o);return l.deps===0&&l.resolve(!1,!0),u}function as(e){let{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=os(r?n.default:n),e.ssFallback=r?os(n.fallback):H(ds)}function os(e){let t;if(v(e)){let n=gs&&e._c;n&&(e._d=!1,R()),e=e(),n&&(e._d=!0,t=ms,hs())}return p(e)&&(e=mo(e)),e=Os(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(t=>t!==e)),e}function ss(e,t){t&&t.pendingBranch?p(e)?t.effects.push(...e):t.effects.push(e):sr(e)}function cs(e,t){e.activeBranch=t;let{vnode:n,parentComponent:r}=e,i=t.el;for(;!i&&t.component;)t=t.component.subTree,i=t.el;n.el=i,r&&r.subTree===n&&(r.vnode.el=i,bo(r,i))}function ls(e){let t=e.props&&e.props.suspensible;return t!=null&&t!==!1}var L=Symbol.for(`v-fgt`),us=Symbol.for(`v-txt`),ds=Symbol.for(`v-cmt`),fs=Symbol.for(`v-stc`),ps=[],ms=null;function R(e=!1){ps.push(ms=e?null:[])}function hs(){ps.pop(),ms=ps[ps.length-1]||null}var gs=1;function _s(e,t=!1){gs+=e,e<0&&ms&&t&&(ms.hasOnce=!0)}function vs(e){return e.dynamicChildren=gs>0?ms||i:null,hs(),gs>0&&ms&&ms.push(e),e}function z(e,t,n,r,i,a){return vs(V(e,t,n,r,i,a,!0))}function B(e,t,n,r,i){return vs(H(e,t,n,r,i,!0))}function ys(e){return e?e.__v_isVNode===!0:!1}function bs(e,t){return e.type===t.type&&e.key===t.key}function xs(e){}var Ss=({key:e})=>e??null,Cs=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:y(e)||mn(e)||v(e)?{i:hr,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===L?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ss(t),ref:t&&Cs(t),scopeId:gr,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:hr};return s?(As(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=y(n)?8:16),gs>0&&!o&&ms&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&ms.push(c),c}var H=ws;function ws(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===pa)&&(e=ds),ys(e)){let r=Es(e,t,!0);return n&&As(r,n),gs>0&&!a&&ms&&(r.shapeFlag&6?ms[ms.indexOf(e)]=r:ms.push(r)),r.patchFlag=-2,r}if(nc(e)&&(e=e.__vccOpts),t){t=Ts(t);let{class:e,style:n}=t;e&&!y(e)&&(t.class=O(e)),x(n)&&(ln(n)&&!p(n)&&(n=l({},n)),t.style=ge(n))}let o=y(e)?1:Zo(e)?128:Ir(e)?64:x(e)?4:v(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function Ts(e){return e?ln(e)||Co(e)?l({},e):e:null}function Es(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?js(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Ss(l),ref:t&&t.ref?n&&a?p(a)?a.concat(Cs(t)):[a,Cs(t)]:Cs(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==L?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Es(e.ssContent),ssFallback:e.ssFallback&&Es(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&si(u,c.clone(u)),u}function U(e=` `,t=0){return H(us,null,e,t)}function Ds(e,t){let n=H(fs,null,e);return n.staticCount=t,n}function W(e=``,t=!1){return t?(R(),B(ds,null,e)):H(ds,null,e)}function Os(e){return e==null||typeof e==`boolean`?H(ds):p(e)?H(L,null,e.slice()):ys(e)?ks(e):H(us,null,String(e))}function ks(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Es(e)}function As(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(p(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),As(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Co(t)?t._ctx=hr:r===3&&hr&&(hr.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(v(t)){if(r&65){As(e,{default:t});return}t={default:t,_ctx:hr},n=32}else t=String(t),r&64?(n=16,t=[U(t)]):n=8;e.children=t,e.shapeFlag|=n}function js(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=O([t.class,r.class]));else if(e===`style`)t.style=ge([t.style,r.style]);else if(s(e)){let n=t[e],i=r[e];i&&n!==i&&!(p(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!c(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function Ms(e,t,n,r=null){qn(e,t,7,[n,r])}var Ns=no(),Ps=0;function Fs(e,t,n){let i=e.type,a=(t?t.appContext:e.appContext)||Ns,o={uid:Ps++,vnode:e,type:i,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ie(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:ko(i,a),emitsOptions:uo(i,a),emit:null,emitted:null,propsDefaults:r,inheritAttrs:i.inheritAttrs,ctx:r,data:r,props:r,attrs:r,slots:r,refs:r,setupState:r,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=co.bind(null,o),e.ce&&e.ce(o),o}var Is=null,Ls=()=>Is||hr,Rs,zs;{let e=me(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Rs=t(`__VUE_INSTANCE_SETTERS__`,e=>Is=e),zs=t(`__VUE_SSR_SETTERS__`,e=>Us=e)}var Bs=e=>{let t=Is;return Rs(e),e.scope.on(),()=>{e.scope.off(),Rs(t)}},Vs=()=>{Is&&Is.scope.off(),Rs(null)};function Hs(e){return e.vnode.shapeFlag&4}var Us=!1;function Ws(e,t=!1,n=!1){t&&zs(t);let{props:r,children:i}=e.vnode,a=Hs(e);wo(e,r,a,t),Lo(e,i,n||t);let o=a?Gs(e,t):void 0;return t&&zs(!1),o}function Gs(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,wa);let{setup:r}=n;if(r){at();let n=e.setupContext=r.length>1?$s(e):null,i=Bs(e),a=Kn(r,e,0,[e.props,n]),o=S(a);if(ot(),i(),(o||e.sp)&&!Bi(e)&&ui(e),o){if(a.then(Vs,Vs),t)return a.then(n=>{zs(!0);try{Ks(e,n,t)}finally{zs(!1)}}).catch(t=>{Jn(t,e,0)});e.asyncDep=a}else Ks(e,a,t)}else Zs(e,t)}function Ks(e,t,n){v(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:x(t)&&(e.setupState=xn(t)),Zs(e,n)}var qs,Js;function Ys(e){qs=e,Js=e=>{e.render._rc&&(e.withProxy=new Proxy(e.ctx,Ta))}}var Xs=()=>!qs;function Zs(e,t,n){let r=e.type;if(!e.render){if(!t&&qs&&!r.render){let t=r.template||Ka(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r,s=l(l({isCustomElement:n,delimiters:a},i),o);r.render=qs(t,s)}}e.render=r.render||a,Js&&Js(e)}{let t=Bs(e);at();try{Ha(e)}finally{ot(),t()}}}var Qs={get(e,t){return gt(e,`get`,``),e[t]}};function $s(e){return{attrs:new Proxy(e.attrs,Qs),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function ec(e){return e.exposed?e.exposeProxy||=new Proxy(xn(dn(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Sa)return Sa[n](e)},has(e,t){return t in e||t in Sa}}):e.proxy}function tc(e,t=!0){return v(e)?e.displayName||e.name:e.name||t&&e.__name}function nc(e){return v(e)&&`__vccOpts`in e}var G=(e,t)=>An(e,t,Us);function rc(e,t,n){try{_s(-1);let r=arguments.length;return r===2?x(t)&&!p(t)?ys(t)?H(e,null,[t]):H(e,t):H(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ys(n)&&(n=[n]),H(e,t,n))}finally{_s(1)}}function ic(){}function ac(e,t,n,r){let i=n[r];if(i&&oc(i,e))return i;let a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function oc(e,t){let n=e.memo;if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(D(n[e],t[e]))return!1;return gs>0&&ms&&ms.push(e),!0}var sc=`3.5.43`,cc=a,lc=Gn,uc=fr,dc=mr,fc={createComponentInstance:Fs,setupComponent:Ws,renderComponentRoot:po,setCurrentRenderingInstance:_r,isVNode:ys,normalizeVNode:Os,getComponentPublicInstance:ec,ensureValidVNode:ya,pushWarningContext:Vn,popWarningContext:Hn},pc=void 0,mc=typeof window<`u`&&window.trustedTypes;if(mc)try{pc=mc.createPolicy(`vue`,{createHTML:e=>e})}catch{}var hc=pc?e=>pc.createHTML(e):e=>e,gc=`http://www.w3.org/2000/svg`,_c=`http://www.w3.org/1998/Math/MathML`,vc=typeof document<`u`?document:null,yc=vc&&vc.createElement(`template`),bc={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?vc.createElementNS(gc,e):t===`mathml`?vc.createElementNS(_c,e):n?vc.createElement(e,{is:n}):vc.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>vc.createTextNode(e),createComment:e=>vc.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>vc.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{yc.innerHTML=hc(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=yc.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},xc=`transition`,Sc=`animation`,Cc=Symbol(`_vtc`),wc={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Tc=l({},Qr,wc),Ec=(e=>(e.displayName=`Transition`,e.props=Tc,e))((e,{slots:t})=>rc(ni,kc(e),t)),Dc=(e,t=[])=>{p(e)?e.forEach(e=>e(...t)):e&&e(...t)},Oc=e=>e?p(e)?e.some(e=>e.length>1):e.length>1:!1;function kc(e){let t={};for(let n in e)n in wc||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:u=o,appearToClass:d=s,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,h=Ac(i),g=h&&h[0],_=h&&h[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:x,onLeaveCancelled:S,onBeforeAppear:C=v,onAppear:w=y,onAppearCancelled:T=b}=t,ee=(e,t,n,r)=>{e._enterCancelled=r,Nc(e,t?d:s),Nc(e,t?u:o),n&&n()},E=(e,t)=>{e._isLeaving=!1,Nc(e,f),Nc(e,m),Nc(e,p),t&&t()},te=e=>(t,n)=>{let i=e?w:y,o=()=>ee(t,e,n);Dc(i,[t,o]),Pc(()=>{Nc(t,e?c:a),Mc(t,e?d:s),Oc(i)||Ic(t,r,g,o)})};return l(t,{onBeforeEnter(e){Dc(v,[e]),Mc(e,a),Mc(e,o)},onBeforeAppear(e){Dc(C,[e]),Mc(e,c),Mc(e,u)},onEnter:te(!1),onAppear:te(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>E(e,t);Mc(e,f),e._enterCancelled?(Mc(e,p),Bc(e)):(Bc(e),Mc(e,p)),Pc(()=>{e._isLeaving&&(Nc(e,f),Mc(e,m),Oc(x)||Ic(e,r,_,n))}),Dc(x,[e,n])},onEnterCancelled(e){ee(e,!1,void 0,!0),Dc(b,[e])},onAppearCancelled(e){ee(e,!0,void 0,!0),Dc(T,[e])},onLeaveCancelled(e){E(e),Dc(S,[e])}})}function Ac(e){if(e==null)return null;if(x(e))return[jc(e.enter),jc(e.leave)];{let t=jc(e);return[t,t]}}function jc(e){return fe(e)}function Mc(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[Cc]||(e[Cc]=new Set)).add(t)}function Nc(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[Cc];n&&(n.delete(t),n.size||(e[Cc]=void 0))}function Pc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Fc=0;function Ic(e,t,n,r){let i=e._endId=++Fc,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=Lc(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function Lc(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${xc}Delay`),a=r(`${xc}Duration`),o=Rc(i,a),s=r(`${Sc}Delay`),c=r(`${Sc}Duration`),l=Rc(s,c),u=null,d=0,f=0;t===xc?o>0&&(u=xc,d=o,f=a.length):t===Sc?l>0&&(u=Sc,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?xc:Sc:null,f=u?u===xc?a.length:c.length:0);let p=u===xc&&/\b(?:transform|all)(?:,|$)/.test(r(`${xc}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function Rc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>zc(t)+zc(e[n])))}function zc(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Bc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Vc(e,t,n){let r=e[Cc];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Hc=Symbol(`_vod`),Uc=Symbol(`_vsh`),Wc={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Hc]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):Gc(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Gc(e,!0),r.enter(e)):r.leave(e,()=>{Gc(e,!1)}):Gc(e,t))},beforeUnmount(e,{value:t}){Gc(e,t)}};function Gc(e,t){e.style.display=t?e[Hc]:`none`,e[Uc]=!t}function Kc(){Wc.getSSRProps=({value:e})=>{if(!e)return{style:{display:`none`}}}}var qc=Symbol(``);function Jc(e){let t=Ls();if(!t)return;let n=t.ut=(n=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(e=>Xc(e,n))},r=()=>{let r=e(t.proxy);t.ce?Xc(t.ce,r):Yc(t.subTree,r),n(r)};na(()=>{sr(r)}),ta(()=>{N(r,a,{flush:`post`});let e=new MutationObserver(r);e.observe(t.subTree.el.parentNode,{childList:!0}),aa(()=>e.disconnect())})}function Yc(e,t){if(e.shapeFlag&128){let n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{Yc(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Xc(e.el,t);else if(e.type===L)e.children.forEach(e=>Yc(e,t));else if(e.type===fs){let{el:n,anchor:r}=e;for(;n&&(Xc(n,t),n!==r);)n=n.nextSibling}}function Xc(e,t){if(e.nodeType===1){let n=e.style,r=``;for(let e in t){let i=Pe(t[e]);n.setProperty(`--${e}`,i),r+=`--${e}: ${i};`}n[qc]=r}}var Zc=/(?:^|;)\s*display\s*:/;function Qc(e,t,n){let r=e.style,i=y(n),a=!1;if(n&&!i){if(t){if(y(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??el(r,t,``)}else for(let e in t)n[e]??el(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?el(r,i,``):il(e,i,!y(t)&&t?t[i]:void 0,o)||el(r,i,o)}}else if(i){if(t!==n){let e=r[qc];e&&(n+=`;`+e),r.cssText=n,a=Zc.test(n)}}else t&&e.removeAttribute(`style`);Hc in e&&(e[Hc]=a?r.display:``,e[Uc]&&(r.display=`none`))}var $c=/\s*!important$/;function el(e,t,n){if(p(n))n.forEach(n=>el(e,t,n));else if(n??=``,t.startsWith(`--`))$c.test(n)?e.setProperty(t,n.replace($c,``),`important`):e.setProperty(t,n);else{let r=rl(e,t);$c.test(n)?e.setProperty(oe(r),n.replace($c,``),`important`):e[r]=n}}var tl=[`Webkit`,`Moz`,`ms`],nl={};function rl(e,t){let n=nl[t];if(n)return n;let r=ie(t);if(r!==`filter`&&r in e)return nl[t]=r;r=se(r);for(let n=0;n<tl.length;n++){let i=tl[n]+r;if(i in e)return nl[t]=i}return t}function il(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&y(r)&&n===r}var al=`http://www.w3.org/1999/xlink`;function ol(e,t,n,r,i,a=Ce(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(al,t.slice(6,t.length)):e.setAttributeNS(al,t,n):n==null||a&&!we(n)?e.removeAttribute(t):e.setAttribute(t,a?``:b(n)?String(n):n)}function sl(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?hc(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=we(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function cl(e,t,n,r){e.addEventListener(t,n,r)}function ll(e,t,n,r){e.removeEventListener(t,n,r)}var ul=Symbol(`_vei`);function dl(e,t,n,r,i=null){let a=e[ul]||(e[ul]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=ml(t);r?cl(e,n,a[t]=vl(r,i),s):o&&(ll(e,n,o,s),a[t]=void 0)}}var fl=/(Once|Passive|Capture)$/,pl=/^on:?(?:Once|Passive|Capture)$/;function ml(e){let t,n;for(;(n=e.match(fl))&&!pl.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):oe(e.slice(2)),t]}var hl=0,gl=Promise.resolve(),_l=()=>hl||=(gl.then(()=>hl=0),Date.now());function vl(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(p(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&qn(e,t,5,a)}}else qn(r,t,5,[e])};return n.value=e,n.attached=_l(),n}var yl=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,bl=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Vc(e,r,o):t===`style`?Qc(e,n,r):s(t)?c(t)||dl(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):xl(e,t,r,o))?(sl(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&ol(e,t,r,o,a,t!==`value`)):e._isVueCE&&(Sl(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!y(r)))?sl(e,ie(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),ol(e,t,r,o))};function xl(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&yl(t)&&v(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return yl(t)&&y(n)?!1:t in e}function Sl(e,t){let n=e._def.props;if(!n)return!1;let r=ie(t);return Array.isArray(n)?n.some(e=>ie(e)===r):Object.keys(n).some(e=>ie(e)===r)}var Cl={};function wl(e,t,n){let r=P(e,t);ee(r)&&(r=l({},r,t));class i extends Dl{constructor(e){super(r,e,n)}}return i.def=r,i}var Tl=((e,t)=>wl(e,t,yu)),El=typeof HTMLElement<`u`?HTMLElement:class{},Dl=class e extends El{constructor(e,t={},n=vu){super(),this._def=e,this._props=t,this._createApp=n,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&n!==vu?this._root=this.shadowRoot:e.shadowRoot===!1?this._root=this:(this.attachShadow(l({},e.shadowRootOptions,{mode:`open`})),this._root=this.shadowRoot)}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t&&=t.assignedSlot||t.parentNode||t.host;)if(t instanceof e){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{if(this._pendingResolve=void 0,this.isConnected)return this._resolveDef()}):this._resolveDef())}_setParent(e=this._parent){e&&(this._instance.parent=e._instance,this._inheritParentContext(e))}_inheritParentContext(e=this._parent){e&&this._app&&Object.setPrototypeOf(this._app._context.provides,e._instance.provides)}disconnectedCallback(){this._connected=!1,rr(()=>{this._connected||(this._ob&&=(this._ob.disconnect(),null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&=(this._teleportTargets.clear(),void 0))})}_processMutations(e){for(let t of e)this._setAttr(t.attributeName)}_resolveDef(){if(this._pendingResolve)return this._pendingResolve;for(let e=0;e<this.attributes.length;e++)this._setAttr(this.attributes[e].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});let e=(e,t=!1)=>{this._resolved=!0,this._pendingResolve=void 0;let{props:n,styles:r}=e,i;if(n&&!p(n))for(let e in n){let t=n[e];(t===Number||t&&t.type===Number)&&(e in this._props&&(this._props[e]=fe(this._props[e])),(i||=Object.create(null))[ie(e)]=!0)}this._numberProps=i,this._resolveProps(e),this.shadowRoot&&this._applyStyles(r),this._mount(e)},t=this._def.__asyncLoader;if(t)return this._pendingResolve=t().then(t=>{t.configureApp=this._def.configureApp,e(this._def=t,!0)}),this._pendingResolve;e(this._def)}_mount(e){this._app=this._createApp(e),this._inheritParentContext(),e.configureApp&&e.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);let t=this._instance&&this._instance.exposed;if(t)for(let e in t)f(this,e)||Object.defineProperty(this,e,{get:()=>j(t[e])})}_resolveProps(e){let{props:t}=e,n=p(t)?t:Object.keys(t||{});for(let e of Object.keys(this))e[0]!==`_`&&n.includes(e)&&this._setProp(e,this[e]);for(let e of n.map(ie))Object.defineProperty(this,e,{get(){return this._getProp(e)},set(t){this._setProp(e,t,!0,!this._patching)}})}_setAttr(e){if(e.startsWith(`data-v-`))return;let t=this.hasAttribute(e),n=t?this.getAttribute(e):Cl,r=ie(e);t&&this._numberProps&&this._numberProps[r]&&(n=fe(n)),this._setProp(r,n,!1,!0)}_getProp(e){return this._props[e]}_setProp(e,t,n=!0,r=!1){if(t!==this._props[e]&&(this._dirty=!0,t===Cl?delete this._props[e]:(this._props[e]=t,e===`key`&&this._app&&(this._app._ceVNode.key=t)),r&&this._instance&&this._update(),n)){let n=this._ob;n&&(this._processMutations(n.takeRecords()),n.disconnect()),t===!0?this.setAttribute(oe(e),``):typeof t==`string`||typeof t==`number`?this.setAttribute(oe(e),t+``):t||this.removeAttribute(oe(e)),n&&n.observe(this,{attributes:!0})}}_update(){let e=this._createVNode();this._app&&(e.appContext=this._app._context),gu(e,this._root)}_createVNode(){let e={};this.shadowRoot||(e.onVnodeMounted=e.onVnodeUpdated=this._renderSlots.bind(this));let t=H(this._def,l(e,this._props));return this._instance||(t.ce=e=>{this._instance=e,e.ce=this,e.isCE=!0;let t=(e,t)=>{this.dispatchEvent(new CustomEvent(e,ee(t[0])?l({detail:t},t[0]):{detail:t}))};e.emit=(e,...n)=>{t(e,n),oe(e)!==e&&t(oe(e),n)},this._setParent()}),t}_applyStyles(e,t,n){if(!e)return;if(t){if(t===this._def||this._styleChildren.has(t))return;this._styleChildren.add(t)}let r=this._nonce,i=this.shadowRoot,a=n?this._getStyleAnchor(n)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i),o=null;for(let s=e.length-1;s>=0;s--){let c=document.createElement(`style`);r&&c.setAttribute(`nonce`,r),c.textContent=e[s],i.insertBefore(c,o||a),o=c,s===0&&(n||this._styleAnchors.set(this._def,c),t&&this._styleAnchors.set(t,c))}}_getStyleAnchor(e){if(!e)return null;let t=this._styleAnchors.get(e);return t&&t.parentNode===this.shadowRoot?t:(t&&this._styleAnchors.delete(e),null)}_getRootStyleInsertionAnchor(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes[t];if(!(n instanceof HTMLStyleElement))return n}return null}_parseSlots(){let e=this._slots={},t;for(;t=this.firstChild;){let n=t.nodeType===1&&t.getAttribute(`slot`)||`default`;(e[n]||(e[n]=[])).push(t),this.removeChild(t)}}_renderSlots(){let e=this._getSlots(),t=this._instance.type.__scopeId;for(let n=0;n<e.length;n++){let r=e[n],i=r.getAttribute(`name`)||`default`,a=this._slots[i],o=r.parentNode;if(a)for(let e of a){if(t&&e.nodeType===1){let n=t+`-s`,r=document.createTreeWalker(e,1);e.setAttribute(n,``);let i;for(;i=r.nextNode();)i.setAttribute(n,``)}o.insertBefore(e,r)}else for(;r.firstChild;)o.insertBefore(r.firstChild,r);o.removeChild(r)}}_getSlots(){let e=[this];this._teleportTargets&&e.push(...this._teleportTargets);let t=new Set;for(let n of e){let e=n.querySelectorAll(`slot`);for(let n=0;n<e.length;n++)t.add(e[n])}return Array.from(t)}_injectChildStyle(e,t){this._applyStyles(e.styles,e,t)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(e){}};function Ol(e){let t=Ls();return t&&t.ce||null}function kl(){let e=Ol();return e&&e.shadowRoot}function Al(e=`$style`){{let t=Ls();if(!t)return r;let n=t.type.__cssModules;return n&&n[e]||r}}var jl=new WeakMap,Ml=new WeakMap,Nl=Symbol(`_moveCb`),Pl=Symbol(`_enterCb`),Fl=(e=>(delete e.props.mode,e))({name:`TransitionGroup`,props:l({},Tc,{tag:String,moveClass:String}),setup(e,{slots:t}){let n=Ls(),r=Xr(),i,a;return ra(()=>{if(!i.length)return;let t=e.moveClass||`${e.name||`v`}-move`;if(!Bl(i[0].el,n.vnode.el,t)){i=[];return}i.forEach(Il),i.forEach(Ll);let r=i.filter(Rl);Bc(n.vnode.el),r.forEach(e=>{let n=e.el,r=n.style;Mc(n,t),r.transform=r.webkitTransform=r.transitionDuration=``;let i=n[Nl]=e=>{e&&e.target!==n||(!e||e.propertyName.endsWith(`transform`))&&(n.removeEventListener(`transitionend`,i),n[Nl]=null,Nc(n,t))};n.addEventListener(`transitionend`,i)}),i=[]}),()=>{let o=un(e),s=kc(o),c=o.tag||L;if(i=[],a)for(let e=0;e<a.length;e++){let t=a[e];t.el&&t.el instanceof Element&&!t.el[Uc]&&(i.push(t),si(t,ii(t,s,r,n)),jl.set(t,zl(t.el)))}a=t.default?ci(t.default()):[];for(let e=0;e<a.length;e++){let t=a[e];t.key!=null&&si(t,ii(t,s,r,n))}return H(c,null,a)}}});function Il(e){let t=e.el;t[Nl]&&t[Nl](),t[Pl]&&t[Pl]()}function Ll(e){Ml.set(e,zl(e.el))}function Rl(e){let t=jl.get(e),n=Ml.get(e),r=t.left-n.left,i=t.top-n.top;if(r||i){let t=e.el,n=t.style,a=t.getBoundingClientRect(),o=1,s=1;return t.offsetWidth&&(o=a.width/t.offsetWidth),t.offsetHeight&&(s=a.height/t.offsetHeight),(!Number.isFinite(o)||o===0)&&(o=1),(!Number.isFinite(s)||s===0)&&(s=1),Math.abs(o-1)<.01&&(o=1),Math.abs(s-1)<.01&&(s=1),n.transform=n.webkitTransform=`translate(${r/o}px,${i/s}px)`,n.transitionDuration=`0s`,e}}function zl(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function Bl(e,t,n){let r=e.cloneNode(),i=e[Cc];i&&i.forEach(e=>{e.split(/\s+/).forEach(e=>e&&r.classList.remove(e))}),n.split(/\s+/).forEach(e=>e&&r.classList.add(e)),r.style.display=`none`;let a=t.nodeType===1?t:t.parentNode;a.appendChild(r);let{hasTransform:o}=Lc(r);return a.removeChild(r),o}var Vl=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return p(t)?e=>le(t,e):t};function Hl(e){e.target.composing=!0}function Ul(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var Wl=Symbol(`_assign`),Gl=Symbol(`_initialValue`);function Kl(e,t,n){return t&&(e=e.trim()),n&&(e=de(e)),e}var ql={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[Gl]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[Gl]=e.defaultValue.replace(/\r\n?/g,`
|
|
4
|
-
`))),e[Wl]=Vl(i);let a=r||i.props&&i.props.type===`number`;cl(e,t?`change`:`input`,t=>{t.target.composing||e[Wl](Kl(e.value,n,a))}),(n||a)&&cl(e,`change`,()=>{e.value=Kl(e.value,n,a)}),t||(cl(e,`compositionstart`,Hl),cl(e,`compositionend`,Ul),cl(e,`change`,Ul))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Gl];delete e[Gl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Wl](Kl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Wl]=Vl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?de(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Jl={deep:!0,created(e,t,n){e[Wl]=Vl(n),cl(e,`change`,()=>{let t=e._modelValue,n=eu(e),r=e.checked,i=e[Wl];if(p(t)){let e=Ae(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(tu(e,r))})},mounted:Yl,beforeUpdate(e,t,n){e[Wl]=Vl(n),Yl(e,t,n)}};function Yl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Ae(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=ke(t,tu(e,!0))}e.checked!==i&&(e.checked=i)}var Xl={created(e,{value:t},n){e.checked=ke(t,n.props.value),e[Wl]=Vl(n),cl(e,`change`,()=>{e[Wl](eu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Wl]=Vl(r),t!==n&&(e.checked=ke(t,r.props.value))}},Zl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,cl(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?de(eu(e)):eu(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Wl](i)}finally{rr(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Wl]=Vl(r)},mounted(e,{value:t}){$l(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Wl]=Vl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Ql(t,n[1],n[0]))&&$l(e,t)}};function Ql(e,t,n){if(!n||p(e))return ke(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function $l(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=eu(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Ae(t,o)>-1}else a.selected=t.has(o)}else if(ke(eu(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function eu(e){return`_value`in e?e._value:e.value}function tu(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var nu={created(e,t,n){iu(e,t,n,null,`created`)},mounted(e,t,n){iu(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){iu(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){iu(e,t,n,r,`updated`)}};function ru(e,t){switch(e){case`SELECT`:return Zl;case`TEXTAREA`:return ql;default:switch(t){case`checkbox`:return Jl;case`radio`:return Xl;default:return ql}}}function iu(e,t,n,r,i){let a=ru(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function au(){ql.getSSRProps=({value:e})=>({value:e}),Xl.getSSRProps=({value:e},t)=>{if(t.props&&ke(t.props.value,e))return{checked:!0}},Jl.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Ae(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},nu.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=ru(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var ou=[`ctrl`,`shift`,`alt`,`meta`],su={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>ou.some(n=>e[`${n}Key`]&&!t.includes(n))},cu=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=su[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},lu={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},uu=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=oe(n.key);if(t.some(e=>e===r||lu[e]===r))return e(n)}))},du=l({patchProp:bl},bc),fu,pu=!1;function mu(){return fu||=Bo(du)}function hu(){return fu=pu?fu:Vo(du),pu=!0,fu}var gu=((...e)=>{mu().render(...e)}),_u=((...e)=>{hu().hydrate(...e)}),vu=((...e)=>{let t=mu().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=xu(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,bu(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),yu=((...e)=>{let t=hu().createApp(...e),{mount:n}=t;return t.mount=e=>{let t=xu(e);if(t)return n(t,!0,bu(t))},t});function bu(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function xu(e){return y(e)?document.querySelector(e):e}var Su=!1,Cu=()=>{Su||(Su=!0,au(),Kc())},wu=t({BaseTransition:()=>ni,BaseTransitionPropsValidators:()=>Qr,Comment:()=>ds,DeprecationTypes:()=>null,EffectScope:()=>Ie,ErrorCodes:()=>Wn,ErrorTypeStrings:()=>lc,Fragment:()=>L,KeepAlive:()=>Wi,ReactiveEffect:()=>He,Static:()=>fs,Suspense:()=>$o,Teleport:()=>Gr,Text:()=>us,TrackOpTypes:()=>jn,Transition:()=>Ec,TransitionGroup:()=>Fl,TriggerOpTypes:()=>Mn,VueElement:()=>Dl,assertNumber:()=>Un,callWithAsyncErrorHandling:()=>qn,callWithErrorHandling:()=>Kn,camelize:()=>ie,capitalize:()=>se,cloneVNode:()=>Es,compatUtils:()=>null,compile:()=>Tu,computed:()=>G,createApp:()=>vu,createBlock:()=>B,createCommentVNode:()=>W,createElementBlock:()=>z,createElementVNode:()=>V,createHydrationRenderer:()=>Vo,createPropsRestProxy:()=>za,createRenderer:()=>Bo,createSSRApp:()=>yu,createSlots:()=>va,createStaticVNode:()=>Ds,createTextVNode:()=>U,createVNode:()=>H,customRef:()=>Cn,defineAsyncComponent:()=>Vi,defineComponent:()=>P,defineCustomElement:()=>wl,defineEmits:()=>Da,defineExpose:()=>Oa,defineModel:()=>ja,defineOptions:()=>ka,defineProps:()=>Ea,defineSSRCustomElement:()=>Tl,defineSlots:()=>Aa,devtools:()=>uc,effect:()=>tt,effectScope:()=>Le,getCurrentInstance:()=>Ls,getCurrentScope:()=>Re,getCurrentWatcher:()=>In,getTransitionRawChildren:()=>ci,guardReactiveProps:()=>Ts,h:()=>rc,handleError:()=>Jn,hasInjectionContext:()=>Tr,hydrate:()=>_u,hydrateOnIdle:()=>Pi,hydrateOnInteraction:()=>Ri,hydrateOnMediaQuery:()=>Li,hydrateOnVisible:()=>Ii,initCustomFormatter:()=>ic,initDirectivesForSSR:()=>Cu,inject:()=>wr,isMemoSame:()=>oc,isProxy:()=>ln,isReactive:()=>on,isReadonly:()=>sn,isRef:()=>mn,isRuntimeOnly:()=>Xs,isShallow:()=>cn,isVNode:()=>ys,markRaw:()=>dn,mergeDefaults:()=>La,mergeModels:()=>Ra,mergeProps:()=>js,nextTick:()=>rr,nodeOps:()=>bc,normalizeClass:()=>O,normalizeProps:()=>xe,normalizeStyle:()=>ge,onActivated:()=>Ki,onBeforeMount:()=>ea,onBeforeUnmount:()=>ia,onBeforeUpdate:()=>na,onDeactivated:()=>qi,onErrorCaptured:()=>la,onMounted:()=>ta,onRenderTracked:()=>ca,onRenderTriggered:()=>sa,onScopeDispose:()=>ze,onServerPrefetch:()=>oa,onUnmounted:()=>aa,onUpdated:()=>ra,onWatcherCleanup:()=>Ln,openBlock:()=>R,patchProp:()=>bl,popScopeId:()=>yr,provide:()=>Cr,proxyRefs:()=>xn,pushScopeId:()=>vr,queuePostFlushCb:()=>sr,reactive:()=>en,readonly:()=>nn,ref:()=>A,registerRuntimeCompiler:()=>Ys,render:()=>gu,renderList:()=>F,renderSlot:()=>I,resolveComponent:()=>fa,resolveDirective:()=>ha,resolveDynamicComponent:()=>ma,resolveFilter:()=>null,resolveTransitionHooks:()=>ii,setBlockTracking:()=>_s,setDevtoolsHook:()=>dc,setTransitionHooks:()=>si,shallowReactive:()=>tn,shallowReadonly:()=>rn,shallowRef:()=>hn,ssrContextKey:()=>Er,ssrUtils:()=>fc,stop:()=>nt,toDisplayString:()=>k,toHandlerKey:()=>ce,toHandlers:()=>ba,toRaw:()=>un,toRef:()=>Dn,toRefs:()=>wn,toValue:()=>yn,transformVNodeArgs:()=>xs,triggerRef:()=>vn,unref:()=>j,useAttrs:()=>Pa,useCssModule:()=>Al,useCssVars:()=>Jc,useHost:()=>Ol,useId:()=>li,useModel:()=>oo,useSSRContext:()=>Dr,useShadowRoot:()=>kl,useSlots:()=>Na,useTemplateRef:()=>di,useTransitionState:()=>Xr,vModelCheckbox:()=>Jl,vModelDynamic:()=>nu,vModelRadio:()=>Xl,vModelSelect:()=>Zl,vModelText:()=>ql,vShow:()=>Wc,version:()=>sc,warn:()=>cc,watch:()=>N,watchEffect:()=>Or,watchPostEffect:()=>kr,watchSyncEffect:()=>Ar,withAsyncContext:()=>Ba,withCtx:()=>M,withDefaults:()=>Ma,withDirectives:()=>xr,withKeys:()=>uu,withMemo:()=>ac,withModifiers:()=>cu,withScopeId:()=>br}),Tu=()=>{};function Eu(e,t){let n=typeof e==`string`&&!t?`${e}Context`:t,r=Symbol(n);return[t=>{let n=wr(r,t);if(n||n===null)return n;throw Error(`Injection \`${r.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(`, `)}`:`\`${e}\``}`)},e=>(Cr(r,e),e)]}function Du(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Ou(e,t,n){let r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),r.dispatchEvent(i)}function ku(e){return e==null}function Au(e,t){return Re()?(ze(e,t),!0):!1}function ju(){let e=new Set,t=t=>{e.delete(t)};return{on:n=>{e.add(n);let r=()=>t(n);return Au(r),{off:r}},off:t,trigger:(...t)=>Promise.all(Array.from(e).map(e=>e(...t))),clear:()=>{e.clear()}}}function Mu(e){let t=!1,n,r=Le(!0);return((...i)=>(t||=(n=r.run(()=>e(...i)),!0),n))}var Nu=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Pu=e=>e!==void 0,Fu=Object.prototype.toString,Iu=e=>Fu.call(e)===`[object Object]`,Lu=Ru();function Ru(){var e,t;return Nu&&!!((e=window)!=null&&(e=e.navigator)!=null&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function zu(e){return Array.isArray(e)?e:[e]}function Bu(e){return e||Ls()}function Vu(e){if(!Nu)return e;let t=0,n,r,i=()=>{--t,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return((...a)=>(t+=1,r||(r=Le(!0),n=r.run(()=>e(...a))),Au(i),n))}function Hu(e){return en(mn(e)?new Proxy({},{get(t,n,r){return j(Reflect.get(e.value,n,r))},set(t,n,r){return mn(e.value[n])&&!mn(r)?e.value[n].value=r:e.value[n]=r,!0},deleteProperty(t,n){return Reflect.deleteProperty(e.value,n)},has(t,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}):e)}function Uu(e){return Hu(G(e))}function Wu(e,...t){let n=t.flat(),r=n[0];return Uu(()=>Object.fromEntries(typeof r==`function`?Object.entries(wn(e)).filter(([e,t])=>!r(yn(t),e)):Object.entries(wn(e)).filter(e=>!n.includes(e[0]))))}function Gu(e,t=1e4){return Cn((n,r)=>{let i=yn(e),a,o=()=>setTimeout(()=>{i=yn(e),r()},yn(t));return Au(()=>{clearTimeout(a)}),{get(){return n(),i},set(e){i=e,r(),clearTimeout(a),a=o()}}})}function Ku(e,t){Bu(t)&&ia(e,t)}function qu(e,t,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,a=hn(!1),o;function s(){o&&=(clearTimeout(o),void 0)}function c(){a.value=!1,s()}function l(...n){i&&e(),s(),a.value=!0,o=setTimeout(()=>{a.value=!1,o=void 0,e(...n)},yn(t))}return r&&(a.value=!0,Nu&&l()),Au(c),{isPending:rn(a),start:l,stop:c}}function Ju(e,t,n){return N(e,t,{...n,immediate:!0})}var Yu=Nu?window:void 0;Nu&&window.document,Nu&&window.navigator,Nu&&window.location;function Xu(e){let t=yn(e);return t?.$el??t}function Zu(...e){let t=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),n=G(()=>{let t=zu(yn(e[0])).filter(e=>e!=null);return t.every(e=>typeof e!=`string`)?t:void 0});return Ju(()=>[n.value?.map(e=>Xu(e))??[Yu].filter(e=>e!=null),zu(yn(n.value?e[1]:e[0])),zu(j(n.value?e[2]:e[1])),yn(n.value?e[3]:e[2])],([e,n,r,i],a,o)=>{if(!e?.length||!n?.length||!r?.length)return;let s=Iu(i)?{...i}:i,c=e.flatMap(e=>n.flatMap(n=>r.map(r=>t(e,n,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function Qu(){let e=hn(!1),t=Ls();return t&&ta(()=>{e.value=!0},t),e}function $u(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function ed(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]==`object`?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);let{target:i=Yu,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=$u(t);return Zu(i,a,e=>{e.repeat&&yn(s)||c(e)&&n(e)},o)}function td(e){return JSON.parse(JSON.stringify(e))}function nd(e,t,n,r={}){var i,a;let{clone:o=!1,passive:s=!1,eventName:c,deep:l=!1,defaultValue:u,shouldEmit:d}=r,f=Ls(),p=n||f?.emit||(f==null||(i=f.$emit)==null?void 0:i.bind(f))||(f==null||(a=f.proxy)==null||(a=a.$emit)==null?void 0:a.bind(f?.proxy)),m=c;t||=`modelValue`,m||=`update:${t.toString()}`;let h=e=>o?typeof o==`function`?o(e):td(e):e,g=()=>Pu(e[t])?h(e[t]):u,_=e=>{d?d(e)&&p(m,e):p(m,e)};if(s){let n=A(g()),r=!1;return N(()=>e[t],e=>{r||(r=!0,n.value=h(e),rr(()=>r=!1))}),N(n,n=>{!r&&(n!==e[t]||l)&&_(n)},{deep:l}),n}return G({get(){return g()},set(e){_(e)}})}function rd(e){return e?e.flatMap(e=>e.type===L?rd(e.children):[e]):[]}var id=[`INPUT`,`TEXTAREA`];function ad(e,t,n,r={}){if(!t||r.enableIgnoredElement&&id.includes(t.nodeName))return null;let{arrowKeyOptions:i=`both`,attributeName:a=`[data-reka-collection-item]`,itemsArray:o=[],loop:s=!0,dir:c=`ltr`,preventScroll:l=!0,focus:u=!1}=r,[d,f,p,m,h,g]=[e.key===`ArrowRight`,e.key===`ArrowLeft`,e.key===`ArrowUp`,e.key===`ArrowDown`,e.key===`Home`,e.key===`End`],_=p||m,v=d||f;if(!h&&!g&&(!_&&!v||i===`vertical`&&v||i===`horizontal`&&_))return null;let y=n?Array.from(n.querySelectorAll(a)):o;if(!y.length)return null;l&&e.preventDefault();let b=null;return v||_?b=od(y,t,{goForward:_?m:c===`ltr`?d:f,loop:s}):h?b=y.at(0)||null:g&&(b=y.at(-1)||null),u&&b?.focus(),b}function od(e,t,n,r=e.includes(t)?e.length:e.length+1){if(--r===0)return null;let i=e.indexOf(t),a;if(a=i===-1?n.goForward?0:e.length-1:n.goForward?i+1:i-1,!n.loop&&(a<0||a>=e.length))return null;let o=e[(a+e.length)%e.length];return o?o.hasAttribute(`disabled`)&&o.getAttribute(`disabled`)!==`false`?od(e,o,n,r):o:null}var[sd,cd]=Eu(`ConfigProvider`),ld=en({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,originalBodyPointerEvents:void 0,branches:new Set});function ud(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function dd(e,t,n=`.`,r){if(!ud(t))return dd(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:ud(a)&&ud(i[t])?dd(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function fd(e){return(...t)=>t.reduce((t,n)=>dd(t,n,``,e),{})}var pd=fd(),md=Vu(()=>{let e=A(new Map),t=A(),n=G(()=>{for(let t of e.value.values())if(t)return!0;return!1}),r=sd({scrollBody:A(!0)}),i=null,a=()=>{document.body.style.paddingRight=``,document.body.style.marginRight=``,ld.layersWithOutsidePointerEventsDisabled.size===0&&(document.body.style.pointerEvents=``),document.documentElement.style.removeProperty(`--scrollbar-width`),document.body.style.overflow=t.value??``,Lu&&i?.(),t.value=void 0};return N(n,(e,o)=>{if(!Nu)return;if(!e){o&&a();return}t.value===void 0&&(t.value=document.body.style.overflow);let s=window.innerWidth-document.documentElement.clientWidth,c={padding:s,margin:0},l=r.scrollBody?.value?typeof r.scrollBody.value==`object`?pd({padding:r.scrollBody.value.padding===!0?s:r.scrollBody.value.padding,margin:r.scrollBody.value.margin===!0?s:r.scrollBody.value.margin},c):c:{padding:0,margin:0};s>0&&(document.body.style.paddingRight=typeof l.padding==`number`?`${l.padding}px`:String(l.padding),document.body.style.marginRight=typeof l.margin==`number`?`${l.margin}px`:String(l.margin),document.documentElement.style.setProperty(`--scrollbar-width`,`${s}px`),document.body.style.overflow=`hidden`),Lu&&(i=Zu(document,`touchmove`,e=>_d(e),{passive:!1})),rr(()=>{n.value&&(document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`)})},{immediate:!0,flush:`sync`}),e});function hd(e){let t=Math.random().toString(36).substring(2,7),n=md();n.value.set(t,e??!1);let r=G({get:()=>n.value.get(t)??!1,set:e=>n.value.set(t,e)});return Ku(()=>{n.value.delete(t)}),r}function gd(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!(t instanceof Element)||t.tagName===`BODY`?!1:gd(t)}}function _d(e){let t=e||window.event,n=t.target;return n instanceof Element&&gd(n)?!1:t.touches.length>1||(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function vd(e){let t=sd({dir:A(`ltr`)});return G(()=>e?.value||t.dir?.value||`ltr`)}function yd(e){let t=Ls(),n=t?.type.emits,r={};return n?.length||console.warn(`No emitted event found. Please check component: ${t?.type.__name}`),n?.forEach(t=>{r[ce(ie(t))]=(...n)=>e(t,...n)}),r}var bd=0;function xd(){Or(e=>{if(!Nu)return;let t=document.querySelectorAll(`[data-reka-focus-guard]`);document.body.insertAdjacentElement(`afterbegin`,t[0]??Sd()),document.body.insertAdjacentElement(`beforeend`,t[1]??Sd()),bd++,e(()=>{bd===1&&document.querySelectorAll(`[data-reka-focus-guard]`).forEach(e=>e.remove()),bd--})})}function Sd(){let e=document.createElement(`span`);return e.setAttribute(`data-reka-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}function Cd(e){return G(()=>!yn(e)||!!Xu(e)?.closest(`form`))}function wd(){let e=Ls(),t=A(),n=G(()=>r());ra(()=>{n.value!==r()&&vn(t)});function r(){return t.value&&`$el`in t.value&&[`#text`,`#comment`].includes(t.value.$el.nodeName)?t.value.$el.nextElementSibling:Xu(t)}let i=Object.assign({},e.exposed),a={};for(let t in e.props)Object.defineProperty(a,t,{enumerable:!0,configurable:!0,get:()=>e.props[t]});if(Object.keys(i).length>0)for(let e in i)Object.defineProperty(a,e,{enumerable:!0,configurable:!0,get:()=>i[e]});Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=a;function o(n){if(t.value=n,n&&(Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>n instanceof Element?n:n.$el}),!(n instanceof Element)&&!Object.hasOwn(n,`$el`))){let t=n.$.exposed,r=Object.assign({},a);for(let e in t)Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>t[e]});e.exposed=r}}return{forwardRef:o,currentRef:t,currentElement:n}}function Td(e){let t=Ls(),n=Object.keys(t?.type.props??{}).reduce((e,n)=>{let r=(t?.type.props[n]).default;return r!==void 0&&(e[n]=r),e},{}),r=Dn(e);return G(()=>{let e={},i=t?.vnode.props??{};return Object.keys(i).forEach(t=>{e[ie(t)]=i[t]}),Object.keys({...n,...e}).reduce((e,t)=>(r.value[t]!==void 0&&(e[t]=r.value[t]),e),{})})}function Ed(e,t){let n=Td(e),r=t?yd(t):{};return G(()=>({...n.value,...r}))}function Dd(){let e=Ls()?.vnode?.scopeId;return e?{[e]:``}:{}}function Od(e,t){let n=Gu(!1,300);Au(()=>{n.value=!1});let r=A(null),i=ju();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=Ad(a,kd(a,i.getBoundingClientRect()),1),s=jd(t.getBoundingClientRect()),c=Nd([...o,...s]);r.value=c,n.value=!0}return Or(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),Or(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!Md(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTransit:n,onPointerExit:i.on}}function kd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ad(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}function jd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Md(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function Nd(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Pd(t)}function Pd(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t.at(-1),n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n.at(-1),t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Fd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Id=new WeakMap,Ld=new WeakMap,Rd={},zd=0,Bd=function(e){return e&&(e.host||Bd(e.parentNode))},Vd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Bd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Hd=function(e,t,n,r){var i=Vd(t,Array.isArray(e)?e:[e]);Rd[n]||(Rd[n]=new WeakMap);var a=Rd[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Id.get(e)||0)+1,l=(a.get(e)||0)+1;Id.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ld.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),zd++,function(){o.forEach(function(e){var t=Id.get(e)-1,i=a.get(e)-1;Id.set(e,t),a.set(e,i),t||(Ld.has(e)||e.removeAttribute(r),Ld.delete(e)),i||e.removeAttribute(n)}),zd--,zd||(Id=new WeakMap,Id=new WeakMap,Ld=new WeakMap,Rd={})}},Ud=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Fd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Hd(r,i,n,`aria-hidden`)):function(){return null}};function Wd(e){let t;N(()=>Xu(e),e=>{let n=!1;try{n=!!e?.closest(`[popover]:not(:popover-open)`)}catch{}e&&!n?t=Ud(e):t&&t()}),aa(()=>{t&&t()})}var Gd=0;function Kd(e,t=`reka`){if(e)return e;let n,r=sd({useId:void 0});return n=r.useId?r.useId():`useId`in wu?li?.():`${++Gd}`,t?`${t}-${n}`:n}function qd(e){let t=A(),n=G(()=>t.value?.width??0),r=G(()=>t.value?.height??0),i;return ta(()=>{let n=Xu(e);n?(t.value={width:n.offsetWidth,height:n.offsetHeight},i=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;let r=e[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=n.offsetWidth,a=n.offsetHeight;t.value={width:i,height:a}}),i.observe(n,{box:`border-box`})):t.value=void 0}),aa(()=>{i?.disconnect(),i=void 0}),{width:n,height:r}}function Jd(e,t){let n=A(e);function r(e){return t[n.value][e]??n.value}return{state:n,dispatch:e=>{n.value=r(e)}}}function Yd(e){let t=Gu(``,1e3);return{search:t,handleTypeaheadSearch:(n,r)=>{if(t.value+=n,e)e(n);else{let e=Du(),n=r.map(e=>({...e,textValue:e.value?.textValue??e.ref.textContent?.trim()??``})),i=n.find(t=>t.ref===e),a=Zd(n.map(e=>e.textValue),t.value,i?.textValue),o=n.find(e=>e.textValue===a);return o&&o.ref.focus(),o?.ref}},resetTypeahead:()=>{t.value=``}}}function Xd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Zd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Xd(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Qd(e,t){let n=A({}),r=A(`none`),i=A(e),a=e.value?`mounted`:`unmounted`,o,s=t.value?.ownerDocument.defaultView??Yu,{state:c,dispatch:l}=Jd(a,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}}),u=e=>{if(Nu){let n=new CustomEvent(e,{bubbles:!1,cancelable:!1});t.value?.dispatchEvent(n)}};N(e,async(e,i)=>{let a=i!==e;if(await rr(),a){let a=r.value,o=$d(t.value);e?(l(`MOUNT`),u(`enter`),o===`none`&&u(`after-enter`)):o===`none`||o===`undefined`||n.value?.display===`none`?(l(`UNMOUNT`),u(`leave`),u(`after-leave`)):i&&a!==o?(l(`ANIMATION_OUT`),u(`leave`)):(l(`UNMOUNT`),u(`after-leave`))}},{immediate:!0});let d=e=>{if(e.target!==t.value)return;let n=$d(t.value),r=n.includes(CSS.escape(e.animationName)),a=c.value===`mounted`?`enter`:`leave`;if(r&&(u(`after-${a}`),l(`ANIMATION_END`),!i.value)){let e=t.value.style.animationFillMode;t.value.style.animationFillMode=`forwards`,o=s?.setTimeout(()=>{t.value?.style.animationFillMode===`forwards`&&(t.value.style.animationFillMode=e)})}n===`none`&&l(`ANIMATION_END`)},f=e=>{e.target===t.value&&(r.value=$d(t.value))},p=N(t,(e,t)=>{e?(n.value=getComputedStyle(e),e.addEventListener(`animationstart`,f),e.addEventListener(`animationcancel`,d),e.addEventListener(`animationend`,d)):(l(`ANIMATION_END`),o!==void 0&&s?.clearTimeout(o),t?.removeEventListener(`animationstart`,f),t?.removeEventListener(`animationcancel`,d),t?.removeEventListener(`animationend`,d))},{immediate:!0}),m=N(c,()=>{let e=$d(t.value);r.value=c.value===`mounted`?e:`none`});return aa(()=>{p(),m(),t.value&&(t.value.removeEventListener(`animationstart`,f),t.value.removeEventListener(`animationcancel`,d),t.value.removeEventListener(`animationend`,d)),o!==void 0&&s?.clearTimeout(o)}),{isPresent:G(()=>[`mounted`,`unmountSuspended`].includes(c.value))}}function $d(e){return e&&getComputedStyle(e).animationName||`none`}var ef=P({name:`Presence`,props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){let{present:r,forceMount:i}=wn(e),a=A(),{isPresent:o}=Qd(r,a);n({present:o});let s=t.default({present:o.value});s=rd(s||[]);let c=Ls();if(s&&s?.length>1){let e=c?.parent?.type.name?`<${c.parent.type.name} />`:`component`;throw Error([`Detected an invalid children for \`${e}\` for \`Presence\` component.`,``,"Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.",`You can apply a few solutions:`,["Provide a single child element so that `presence` directive attach correctly.",`Ensure the first child is an actual element instead of a raw text node or comment node.`].map(e=>` - ${e}`).join(`
|
|
5
|
-
`)].join(`
|
|
6
|
-
`))}return()=>i.value||r.value||o.value?rc(t.default({present:o.value})[0],{ref:e=>{let t=Xu(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),tf=P({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=rd(n.default()),r=e.findIndex(e=>e.type!==ds);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?js(t,i.props):t,o=Es({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),nf=[`area`,`img`,`input`],rf=P({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&nf.includes(r)?()=>rc(r,t):r===`template`?()=>rc(tf,t,{default:n.default}):()=>rc(e.as,t,{default:n.default})}});function af(){let e=A();return{primitiveElement:e,currentElement:G(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Xu(e))}}var[of,sf]=Eu(`DialogRoot`),cf=P({inheritAttrs:!1,__name:`DialogRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=nd(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=A(),a=A(),{modal:o,unmountOnHide:s}=wn(n);return sf({open:r,modal:o,unmountOnHide:s,openModal:()=>{r.value=!0},onOpenChange:e=>{r.value=e},onOpenToggle:()=>{r.value=!r.value},contentId:``,titleId:``,descriptionId:``,triggerElement:i,contentElement:a}),(e,t)=>I(e.$slots,`default`,{open:j(r),close:()=>r.value=!1})}}),lf=P({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;wd();let n=of();return(e,r)=>(R(),B(j(rf),js(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>j(n).onOpenChange(!1)}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`type`]))}}),uf=`dismissableLayer.pointerDownOutside`,df=`dismissableLayer.focusOutside`;function ff(e,t){if(!(t instanceof Element))return!1;if(e.contains(t))return!0;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function pf(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=A(!1),a=A(()=>{});return Or(o=>{if(!Nu||!yn(n))return;let s=async n=>{let o=n.target;if(t?.value&&o){if(ff(t.value,o)){r.removeEventListener(`click`,a.value),i.value=!1;return}if(n.target&&!i.value){let t={originalEvent:n};function i(){Ou(uf,e,t)}n.pointerType===`touch`?(r.removeEventListener(`click`,a.value),a.value=i,r.addEventListener(`click`,a.value,{once:!0})):i()}else r.removeEventListener(`click`,a.value);i.value=!1}},c=window.setTimeout(()=>{r.addEventListener(`pointerdown`,s)},0);o(()=>{window.clearTimeout(c),r.removeEventListener(`pointerdown`,s),r.removeEventListener(`click`,a.value)})}),{onPointerDownCapture:()=>{yn(n)&&(i.value=!0)}}}function mf(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=A(!1);return Or(a=>{if(!Nu||!yn(n))return;let o=async n=>{if(!t?.value)return;await rr(),await rr();let r=n.target;t.value&&r&&!ff(t.value,r)&&n.target&&!i.value&&Ou(df,e,{originalEvent:n})};r.addEventListener(`focusin`,o),a(()=>r.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{yn(n)&&(i.value=!0)},onBlurCapture:()=>{yn(n)&&(i.value=!1)}}}var hf=P({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=wd(),o=G(()=>a.value?.ownerDocument??globalThis.document),s=G(()=>ld.layersRoot),c=G(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=G(()=>ld.layersWithOutsidePointerEventsDisabled.size>0),u=G(()=>{let e=Array.from(s.value),[t]=[...ld.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=pf(async e=>{let t=[...ld.branches].some(t=>t?.contains(e.target));n.present&&u.value&&!t&&(r(`pointerDownOutside`,e),r(`interactOutside`,e),await rr(),e.defaultPrevented||r(`dismiss`))},a,()=>n.present),f=mf(e=>{let t=[...ld.branches].some(t=>t?.contains(e.target));n.present&&!t&&(r(`focusOutside`,e),r(`interactOutside`,e),e.defaultPrevented||r(`dismiss`))},a);return ed(`Escape`,e=>{n.present&&c.value===s.value.size-1&&(r(`escapeKeyDown`,e),e.defaultPrevented||r(`dismiss`))}),N([a,()=>n.disableOutsidePointerEvents,()=>n.present],([e,t,n],r,i)=>{e&&n&&t&&(ld.layersWithOutsidePointerEventsDisabled.size===0&&(ld.originalBodyPointerEvents=o.value.body.style.pointerEvents,o.value.body.style.pointerEvents=`none`),ld.layersWithOutsidePointerEventsDisabled.add(e),i(()=>{ld.layersWithOutsidePointerEventsDisabled.delete(e),ld.layersWithOutsidePointerEventsDisabled.size===0&&!ku(ld.originalBodyPointerEvents)&&(o.value.body.style.pointerEvents=ld.originalBodyPointerEvents)}))},{immediate:!0}),N([a,()=>n.present],([e,t],n,r)=>{e&&t&&(s.value.add(e),r(()=>{s.value.delete(e)}))},{immediate:!0}),Or(e=>{e(()=>{a.value&&(s.value.delete(a.value),ld.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(e,t)=>(R(),B(j(rf),{ref:j(i),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:ge({pointerEvents:l.value?u.value?`auto`:`none`:void 0}),onFocusCapture:j(f).onFocusCapture,onBlurCapture:j(f).onBlurCapture,onPointerdownCapture:j(d).onPointerDownCapture},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),gf=Mu(()=>A([]));function _f(){let e=gf();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=vf(e.value,t),e.value.unshift(t)},remove(t){e.value=vf(e.value,t),e.value[0]?.resume()}}}function vf(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var yf=`focusScope.autoFocusOnMount`,bf=`focusScope.autoFocusOnUnmount`,xf={bubbles:!1,cancelable:!0};function Sf(e,{select:t=!1}={}){let n=Du();for(let r of e)if(Of(r,{select:t}),Du()!==n)return!0}function Cf(e){let t=wf(e);return[Tf(t,e),Tf(t.reverse(),e)]}function wf(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Tf(e,t){for(let n of e)if(!Ef(n,{upTo:t}))return n}function Ef(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Df(e){return e instanceof HTMLInputElement&&`select`in e}function Of(e,{select:t=!1}={}){if(e&&e.focus){let n=Du();e.focus({preventScroll:!0}),e!==n&&Df(e)&&t&&e.select()}}var kf=P({__name:`FocusScope`,props:{loop:{type:Boolean,required:!1,default:!1},trapped:{type:Boolean,required:!1,default:!1},present:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`mountAutoFocus`,`unmountAutoFocus`],setup(e,{emit:t}){let n=e,r=t,{currentRef:i,currentElement:a}=wd(),o=A(null),s=_f(),c=en({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});Or(e=>{if(!Nu)return;let t=a.value;if(!n.trapped)return;function r(e){if(c.paused||!t)return;let n=e.target;t.contains(n)?o.value=n:Of(o.value,{select:!0})}function i(e){if(c.paused||!t)return;let n=e.relatedTarget;n!==null&&(t.contains(n)||Of(o.value,{select:!0}))}function s(e){let n=o.value;if(n===null||!e.some(e=>e.removedNodes.length>0))return;let r=Du();r&&t.contains(r)||t.contains(n)||Of(t)}document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,i);let l=new MutationObserver(s);t&&l.observe(t,{childList:!0,subtree:!0}),e(()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,i),l.disconnect()})});function l(e,t){let n=new CustomEvent(yf,xf),i=e=>r(`mountAutoFocus`,e);e.addEventListener(yf,i),e.dispatchEvent(n),e.removeEventListener(yf,i),n.defaultPrevented||(Sf(wf(e),{select:!0}),Du()===t&&Of(e))}Or(async e=>{let t=a.value;if(await rr(),!t)return;n.present!==!1&&s.add(c);let i=Du();!t.contains(i)&&n.present!==!1&&l(t,i),e(()=>{let e=new CustomEvent(bf,xf),n=e=>{r(`unmountAutoFocus`,e)};t.addEventListener(bf,n),t.dispatchEvent(e),t.setAttribute(`data-focus-scope-unmounting`,``),setTimeout(()=>{e.defaultPrevented||Of(i??document.body,{select:!0}),t.removeEventListener(bf,n),s.remove(c),t.removeAttribute(`data-focus-scope-unmounting`)},0)})}),N(()=>n.present,async(e,t)=>{if(!Nu)return;if(e===!1&&t===!0){s.remove(c);return}if(e!==!0||t!==!1)return;s.add(c),await rr();let n=a.value;if(!n)return;let r=Du();n.contains(r)||l(n,r)});function u(e){if(!n.loop&&!n.trapped||c.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=Du();if(t&&r){let t=e.currentTarget,[i,a]=Cf(t);i&&a?!e.shiftKey&&r===a?(e.preventDefault(),n.loop&&Of(i,{select:!0})):e.shiftKey&&r===i&&(e.preventDefault(),n.loop&&Of(a,{select:!0})):r===t&&e.preventDefault()}}return(e,t)=>(R(),B(j(rf),{ref_key:`currentRef`,ref:i,tabindex:`-1`,"as-child":e.asChild,as:e.as,onKeydown:u},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as-child`,`as`]))}}),Af=`menu.itemSelect`,jf=[`Enter`,` `],Mf=[`ArrowDown`,`PageUp`,`Home`],Nf=[`ArrowUp`,`PageDown`,`End`],Pf=[...Mf,...Nf];[...jf],[...jf];function Ff(e){return e?`open`:`closed`}function If(e){let t=Du();for(let n of e)if(n===t||(n.focus(),Du()!==t))return}function Lf(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function Rf(e,t){return t?Lf({x:e.clientX,y:e.clientY},t):!1}function zf(e){return e.pointerType===`mouse`}var Bf=P({__name:`DialogContentImpl`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=of(),{forwardRef:a,currentElement:o}=wd();return i.titleId||=Kd(void 0,`reka-dialog-title`),i.descriptionId||=Kd(void 0,`reka-dialog-description`),ta(()=>{i.contentElement=o,Du()!==document.body&&(i.triggerElement.value=Du())}),(e,t)=>(R(),B(j(kf),{"as-child":``,loop:``,trapped:n.trapFocus,present:n.present,onMountAutoFocus:t[5]||=e=>r(`openAutoFocus`,e),onUnmountAutoFocus:t[6]||=e=>r(`closeAutoFocus`,e)},{default:M(()=>[H(j(hf),js({id:j(i).contentId,ref:j(a),as:e.as,"as-child":e.asChild,present:n.present,"disable-outside-pointer-events":e.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":j(i).descriptionId,"aria-labelledby":j(i).titleId,"data-state":j(Ff)(j(i).open.value)},e.$attrs,{onDismiss:t[0]||=e=>j(i).onOpenChange(!1),onEscapeKeyDown:t[1]||=e=>r(`escapeKeyDown`,e),onFocusOutside:t[2]||=e=>r(`focusOutside`,e),onInteractOutside:t[3]||=e=>r(`interactOutside`,e),onPointerDownOutside:t[4]||=e=>r(`pointerDownOutside`,e)}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`id`,`as`,`as-child`,`present`,`disable-outside-pointer-events`,`aria-describedby`,`aria-labelledby`,`data-state`])]),_:3},8,[`trapped`,`present`]))}}),Vf=P({__name:`DialogContentModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=of(),a=yd(r),{forwardRef:o,currentElement:s}=wd();Wd(G(()=>n.present?s.value:void 0));let c=G(()=>{let{present:e,...t}=n;return t});return N(()=>n.present,(e,t)=>{!e&&t&&i.triggerElement.value?.focus()}),(e,t)=>(R(),B(Bf,js({...c.value,...j(a)},{ref:j(o),present:e.present,"trap-focus":j(i).open.value,"disable-outside-pointer-events":n.disableOutsidePointerEvents,onCloseAutoFocus:t[0]||=e=>{e.defaultPrevented||(e.preventDefault(),j(i).triggerElement.value?.focus())},onPointerDownOutside:t[1]||=e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()},onFocusOutside:t[2]||=e=>{e.preventDefault()}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`present`,`trap-focus`,`disable-outside-pointer-events`]))}}),Hf=P({__name:`DialogContentNonModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=yd(t);wd();let i=of(),a=A(!1),o=A(!1),s=G(()=>{let{present:e,...t}=n;return t});return N(()=>n.present,(e,t)=>{!e&&t&&(a.value||i.triggerElement.value?.focus(),a.value=!1,o.value=!1)}),(e,t)=>(R(),B(Bf,js({...s.value,...j(r)},{present:e.present,"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:t[0]||=e=>{e.defaultPrevented||(a.value||j(i).triggerElement.value?.focus(),e.preventDefault()),a.value=!1,o.value=!1},onInteractOutside:t[1]||=e=>{e.defaultPrevented||(a.value=!0,e.detail.originalEvent.type===`pointerdown`&&(o.value=!0));let t=e.target;j(i).triggerElement.value?.contains(t)&&e.preventDefault(),e.detail.originalEvent.type===`focusin`&&o.value&&e.preventDefault()}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`present`]))}}),Uf=P({__name:`DialogContent`,props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=of(),a=yd(r),{forwardRef:o}=wd(),s=G(()=>n.forceMount||!i.unmountOnHide.value);return(e,t)=>(R(),B(j(ef),{present:j(i).open.value,"force-mount":s.value},{default:M(({present:t})=>[j(i).modal.value?xr((R(),B(Vf,js({key:0,ref:j(o),present:!s.value||t},{...n,...j(a),...e.$attrs}),{default:M(()=>[I(e.$slots,`default`)]),_:2},1040,[`present`])),[[Wc,e.forceMount||j(i).unmountOnHide.value||t]]):xr((R(),B(Hf,js({key:1,ref:j(o),present:!s.value||t},{...n,...j(a),...e.$attrs}),{default:M(()=>[I(e.$slots,`default`)]),_:2},1040,[`present`])),[[Wc,e.forceMount||j(i).unmountOnHide.value||t]])]),_:3},8,[`present`,`force-mount`]))}}),Wf=P({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let t=e;wd();let n=of();return(e,r)=>(R(),B(j(rf),js(t,{id:j(n).descriptionId}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`id`]))}}),Gf=P({__name:`DialogOverlayImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},setup(e){let t=e,n=of(),r=hd(t.present);return N(()=>t.present,e=>r.value=e),wd(),(e,t)=>(R(),B(j(rf),{as:e.as,"as-child":e.asChild,"data-state":j(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`},onPointerdown:t[0]||=cu(()=>{},[`left`,`self`,`prevent`])},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),Kf=P({__name:`DialogOverlay`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=of(),{forwardRef:r}=wd(),i=G(()=>t.forceMount||!n.unmountOnHide.value);return(e,t)=>j(n)?.modal.value?(R(),B(j(ef),{key:0,present:j(n).open.value,"force-mount":i.value},{default:M(({present:t})=>[xr(H(Gf,js(e.$attrs,{ref:j(r),as:e.as,"as-child":e.asChild,present:!i.value||t}),{default:M(()=>[I(e.$slots,`default`)]),_:2},1040,[`as`,`as-child`,`present`]),[[Wc,e.forceMount||j(n).unmountOnHide.value||t]])]),_:3},8,[`present`,`force-mount`])):W(`v-if`,!0)}}),qf=P({__name:`Teleport`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e,n=sd({}),r=G(()=>t.to??n.teleportTo?.value??`body`),i=Qu();return(e,t)=>j(i)||e.forceMount?(R(),B(Gr,{key:0,to:r.value,disabled:e.disabled,defer:e.defer},[I(e.$slots,`default`)],8,[`to`,`disabled`,`defer`])):W(`v-if`,!0)}}),Jf=P({__name:`DialogPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(qf),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Yf=P({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let t=e,n=of();return wd(),(e,r)=>(R(),B(j(rf),js(t,{id:j(n).titleId}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`id`]))}}),Xf=`data-reka-collection-item`;function Zf(e={}){let{key:t=``,isProvider:n=!1}=e,r=`${t}CollectionProvider`,i;n?(i={collectionRef:A(),itemMap:A(new Map)},Cr(r,i)):i=wr(r);let a=(e,t=!1)=>{if(!i.collectionRef.value)return;let n=i.itemMap.value.get(e);return n&&(t||n.ref.dataset.disabled!==``)?n:void 0},o=(e=!1)=>{let t=i.collectionRef.value;if(!t)return[];let n=Array.from(t.querySelectorAll(`[${Xf}]`)),r=new Map(n.map((e,t)=>[e,t])),a=Array.from(i.itemMap.value.values()).sort((e,t)=>(r.get(e.ref)??-1)-(r.get(t.ref)??-1));return e?a:a.filter(e=>e.ref.dataset.disabled!==``)},s=P({name:`CollectionSlot`,inheritAttrs:!1,setup(e,{slots:t,attrs:n}){let{primitiveElement:r,currentElement:a}=af();return N(a,()=>{i.collectionRef.value=a.value}),()=>rc(tf,{ref:r,...n},t)}}),c=P({name:`CollectionItem`,inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(e,{slots:t,attrs:n}){let{primitiveElement:r,currentElement:a}=af();return Or(t=>{if(a.value){let n=dn(a.value);i.itemMap.value.set(n,{ref:a.value,value:e.value}),t(()=>i.itemMap.value.delete(n))}}),()=>rc(tf,{...n,[Xf]:``,ref:r},t)}});return{getItems:o,getItem:a,reactiveItems:G(()=>Array.from(i.itemMap.value.values())),itemMapSize:G(()=>i.itemMap.value.size),CollectionSlot:s,CollectionItem:c}}var Qf=P({__name:`VisuallyHidden`,props:{feature:{type:String,required:!1,default:`focusable`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,t)=>(R(),B(j(rf),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature===`focusable`||e.feature===`fully-hidden`?`true`:void 0,"data-hidden":e.feature===`fully-hidden`?``:void 0,tabindex:e.feature===`fully-hidden`?`-1`:void 0,style:{position:`absolute`,border:0,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,whiteSpace:`nowrap`,wordWrap:`normal`,top:`-1px`,left:`-1px`}},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-hidden`,`data-hidden`,`tabindex`]))}}),$f=P({inheritAttrs:!1,__name:`VisuallyHiddenInputBubble`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let t=e,{primitiveElement:n,currentElement:r}=af();return N(G(()=>t.checked??t.value),(e,t)=>{if(!r.value)return;let n=r.value,i=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(i,`value`).set;if(a&&e!==t){let t=new Event(`input`,{bubbles:!0}),r=new Event(`change`,{bubbles:!0});a.call(n,e),n.dispatchEvent(t),n.dispatchEvent(r)}}),(e,r)=>(R(),B(Qf,js({ref_key:`primitiveElement`,ref:n},{...t,...e.$attrs},{as:`input`}),null,16))}}),ep=P({inheritAttrs:!1,__name:`VisuallyHiddenInput`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let t=e,n=G(()=>typeof t.value==`object`&&Array.isArray(t.value)&&t.value.length===0&&t.required),r=G(()=>typeof t.value==`string`||typeof t.value==`number`||typeof t.value==`boolean`||t.value===null||t.value===void 0?[{name:t.name,value:t.value}]:typeof t.value==`object`&&Array.isArray(t.value)?t.value.flatMap((e,n)=>typeof e==`object`?Object.entries(e).map(([e,r])=>({name:`${t.name}[${n}][${e}]`,value:r})):{name:`${t.name}[${n}]`,value:e}):t.value!==null&&typeof t.value==`object`&&!Array.isArray(t.value)?Object.entries(t.value).map(([e,n])=>({name:`${t.name}[${e}]`,value:n})):[]);return(e,i)=>(R(),z(L,null,[W(` We render single input if it's required `),n.value?(R(),B($f,js({key:e.name},{...t,...e.$attrs},{name:e.name,value:e.value}),null,16,[`name`,`value`])):(R(!0),z(L,{key:1},F(r.value,n=>(R(),B($f,js({key:n.name},{ref_for:!0},{...t,...e.$attrs},{name:n.name,value:n.value}),null,16,[`name`,`value`]))),128))],2112))}}),tp=`rovingFocusGroup.onEntryFocus`,np={bubbles:!1,cancelable:!0};function rp(e,t=!1){let n=Du();for(let r of e)if(r===n||(r.focus({preventScroll:t}),Du()!==n))return}var[ip,ap]=Eu(`PopperRoot`),op=P({inheritAttrs:!1,__name:`PopperRoot`,setup(e){let t=A();return ap({anchor:t,onAnchorChange:e=>t.value=e}),(e,t)=>I(e.$slots,`default`)}}),sp=P({__name:`PopperAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:n,currentElement:r}=wd(),i=ip();return kr(()=>{i.onAnchorChange(t.reference??r.value)}),(e,t)=>(R(),B(j(rf),{ref:j(n),as:e.as,"as-child":e.asChild},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}});function cp(e){return e!==null}function lp(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=up(n),u={start:e.dir===`rtl`?`100%`:`0%`,center:`50%`,end:e.dir===`rtl`?`0%`:`100%`}[l],d={start:`0%`,center:`50%`,end:`100%`}[l],f=(i.arrow?.x??0)+o/2,p=(i.arrow?.y??0)+s/2,m=``,h=``;return c===`bottom`?(m=a?u:`${f}px`,h=`${-s}px`):c===`top`?(m=a?u:`${f}px`,h=`${r.floating.height+s}px`):c===`right`?(m=`${-s}px`,h=a?d:`${p}px`):c===`left`&&(m=`${r.floating.width+s}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}}}function up(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var dp=[`top`,`right`,`bottom`,`left`],fp=Math.min,pp=Math.max,mp=Math.round,hp=Math.floor,gp=e=>({x:e,y:e}),_p={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function vp(e,t,n){return pp(e,fp(t,n))}function yp(e,t){return typeof e==`function`?e(t):e}function bp(e){return e.split(`-`)[0]}function xp(e){return e.split(`-`)[1]}function Sp(e){return e===`x`?`y`:`x`}function Cp(e){return e===`y`?`height`:`width`}function wp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Tp(e){return Sp(wp(e))}function Ep(e,t,n){n===void 0&&(n=!1);let r=xp(e),i=Tp(e),a=Cp(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fp(o)),[o,Fp(o)]}function Dp(e){let t=Fp(e);return[Op(e),t,Op(t)]}function Op(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var kp=[`left`,`right`],Ap=[`right`,`left`],jp=[`top`,`bottom`],Mp=[`bottom`,`top`];function Np(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ap:kp:t?kp:Ap;case`left`:case`right`:return t?jp:Mp;default:return[]}}function Pp(e,t,n,r){let i=xp(e),a=Np(bp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Op)))),a}function Fp(e){let t=bp(e);return _p[t]+e.slice(t.length)}function Ip(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Lp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ip(e)}function Rp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function zp(e,t,n){let{reference:r,floating:i}=e,a=wp(t),o=Tp(t),s=Cp(o),c=bp(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=xp(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Bp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=yp(t,e),p=Lp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Rp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Rp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Vp=50,Hp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Bp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=zp(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Vp&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=zp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Up=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=yp(e,t)||{};if(l==null)return{};let d=Lp(u),f={x:n,y:r},p=Tp(i),m=Cp(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,ee=fp(d[_],T),E=fp(d[v],T),te=C-h[m]-E,ne=C/2-h[m]/2+w,re=vp(ee,ne,te),ie=!c.arrow&&xp(i)!=null&&ne!==re&&a.reference[m]/2-(ne<ee?ee:E)-h[m]/2<0,ae=ie?ne<ee?ne-ee:ne-te:0;return{[p]:f[p]+ae,data:{[p]:re,centerOffset:ne-re-ae,...ie&&{alignmentOffset:ae}},reset:ie}}}),Wp=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=yp(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=bp(r),_=wp(o),v=bp(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fp(o)]:Dp(o)),x=p!==`none`;!d&&x&&b.push(...Pp(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ep(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===wp(t)||T.every(e=>wp(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=wp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Gp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kp(e){return dp.some(t=>e[t]>=0)}var qp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=yp(e,t);switch(i){case`referenceHidden`:{let e=Gp(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Kp(e)}}}case`escaped`:{let e=Gp(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Kp(e)}}}default:return{}}}}},Jp=new Set([`left`,`top`]);async function Yp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=bp(n),s=xp(n),c=wp(n)===`y`,l=Jp.has(o)?-1:1,u=a&&c?-1:1,d=yp(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Xp=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Yp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Zp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=yp(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=wp(i),p=Sp(f),m=u[p],h=u[f],g=(e,t)=>vp(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Qp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=yp(e,t),u={x:n,y:r},d=wp(i),f=Sp(d),p=u[f],m=u[d],h=yp(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Jp.has(bp(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$p=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=yp(e,t),c=await i.detectOverflow(t,s),l=bp(n),u=xp(n),d=wp(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=fp(p-c[m],g),y=fp(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*pp(c.left,c.right):S=p-2*pp(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function em(){return typeof window<`u`}function tm(e){return im(e)?(e.nodeName||``).toLowerCase():`#document`}function nm(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rm(e){return((im(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function im(e){return em()?e instanceof Node||e instanceof nm(e).Node:!1}function am(e){return em()?e instanceof Element||e instanceof nm(e).Element:!1}function om(e){return em()?e instanceof HTMLElement||e instanceof nm(e).HTMLElement:!1}function sm(e){return!em()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof nm(e).ShadowRoot}function cm(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ym(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function lm(e){return/^(table|td|th)$/.test(tm(e))}function um(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var dm=/transform|translate|scale|rotate|perspective|filter/,fm=/paint|layout|strict|content/,pm=e=>!!e&&e!==`none`,mm;function hm(e){let t=am(e)?ym(e):e;return pm(t.transform)||pm(t.translate)||pm(t.scale)||pm(t.rotate)||pm(t.perspective)||!_m()&&(pm(t.backdropFilter)||pm(t.filter))||dm.test(t.willChange||``)||fm.test(t.contain||``)}function gm(e){let t=xm(e);for(;om(t)&&!vm(t);){if(hm(t))return t;if(um(t))return null;t=xm(t)}return null}function _m(){return mm??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),mm}function vm(e){return/^(html|body|#document)$/.test(tm(e))}function ym(e){return nm(e).getComputedStyle(e)}function bm(e){return am(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xm(e){if(tm(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||sm(e)&&e.host||rm(e);return sm(t)?t.host:t}function Sm(e){let t=xm(e);return vm(t)?(e.ownerDocument||e).body:om(t)&&cm(t)?t:Sm(t)}function Cm(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Sm(e),i=r===e.ownerDocument?.body,a=nm(r);if(i){let e=wm(a);return t.concat(a,a.visualViewport||[],cm(r)?r:[],e&&n?Cm(e):[])}return t.concat(r,Cm(r,[],n))}function wm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Tm(e){let t=ym(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=om(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=mp(n)!==a||mp(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Em(e){return am(e)?e:e.contextElement}function Dm(e){let t=Em(e);if(!om(t))return gp(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Tm(t),o=(a?mp(n.width):n.width)/r,s=(a?mp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Om=gp(0);function km(e){let t=nm(e);return!_m()||!t.visualViewport?Om:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Am(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===nm(e)}function jm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Em(e),o=gp(1);t&&(r?am(r)&&(o=Dm(r)):o=Dm(e));let s=Am(a,n,r)?km(a):gp(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=nm(a),t=am(r)?nm(r):r,n=e,i=wm(n);for(;i&&t!==n;){let e=Dm(i),t=i.getBoundingClientRect(),r=ym(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=nm(i),i=wm(n)}}return Rp({width:u,height:d,x:c,y:l})}function Mm(e,t){let n=bm(e).scrollLeft;return t?t.left+n:jm(rm(e)).left+n}function Nm(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Mm(e,n),y:n.top+t.scrollTop}}function Pm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=rm(r),s=t?um(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=gp(1),u=gp(0),d=om(r);if((d||!a)&&((tm(r)!==`body`||cm(o))&&(c=bm(r)),d)){let e=jm(r);l=Dm(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Nm(o,c):gp(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Fm(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Im(e){let t=bm(e),n=e.ownerDocument.body,r=pp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=pp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Mm(e),o=-t.scrollTop;return ym(n).direction===`rtl`&&(a+=pp(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Lm=25;function Rm(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=nm(e),a=rm(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!_m()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Mm(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Lm&&(s-=o)}return{width:s,height:c,x:l,y:u}}function zm(e,t){let n=jm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Dm(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Bm(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Rm(e,n,t);else if(t===`document`)r=Im(rm(e));else if(am(t))r=zm(t,n);else{let n=km(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Rp(r)}function Vm(e,t){let n=t.get(e);if(n)return n;let r=Cm(e,[],!1).filter(e=>am(e)&&tm(e)!==`body`),i=null,a=ym(e).position===`fixed`,o=a?xm(e):e;for(;am(o)&&!vm(o);){let e=ym(o),t=hm(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=xm(o)}return t.set(e,r),r}function Hm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?um(t)?[]:Vm(t,this._c):[].concat(n),r],o=Bm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Bm(t,a[e],i);s=pp(n.top,s),c=fp(n.right,c),l=fp(n.bottom,l),u=pp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Um(e){let{width:t,height:n}=Tm(e);return{width:t,height:n}}function Wm(e,t,n){let r=om(t),i=rm(t),a=n===`fixed`,o=jm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=gp(0);if((r||!a)&&((tm(t)!==`body`||cm(i))&&(s=bm(t)),r)){let e=jm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Mm(i));let l=i&&!r&&!a?Nm(i,s):gp(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Gm(e){return ym(e).position===`static`}function Km(e,t){if(!om(e)||ym(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return rm(e)===n&&(n=n.ownerDocument.body),n}function qm(e,t){let n=nm(e);if(um(e))return n;if(!om(e)){let t=xm(e);for(;t&&!vm(t);){if(am(t)&&!Gm(t))return t;t=xm(t)}return n}let r=Km(e,t);for(;r&&lm(r)&&Gm(r);)r=Km(r,t);return r&&vm(r)&&Gm(r)&&!hm(r)?n:r||gm(e)||n}var Jm=async function(e){let t=this.getOffsetParent||qm,n=this.getDimensions,r=await n(e.floating);return{reference:Wm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ym(e){return ym(e).direction===`rtl`}var Xm={convertOffsetParentRelativeRectToViewportRelativeRect:Pm,getDocumentElement:rm,getClippingRect:Hm,getOffsetParent:qm,getElementRects:Jm,getClientRects:Fm,getDimensions:Um,getScale:Dm,isElement:am,isRTL:Ym};function Zm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qm(e,t,n){let r=null,i,a=rm(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=hp(d),h=hp(a.clientWidth-(u+f)),g=hp(a.clientHeight-(d+p)),_=hp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:pp(0,fp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Zm(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=nm(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function $m(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Em(e),u=i||a?[...l?Cm(l):[],...t?Cm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Qm(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?jm(e):null;c&&g();function g(){let t=jm(e);h&&!Zm(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var eh=Xp,th=Zp,nh=Wp,rh=$p,ih=qp,ah=Up,oh=Qp,sh=(e,t,n)=>{let r=new Map,i=n??{},a={...Xm,...i.platform,_c:r};return Hp(e,t,{...i,platform:a})};function ch(e){return typeof e==`object`&&!!e&&`$el`in e}function lh(e){if(ch(e)){let t=e.$el;return im(t)&&tm(t)===`#comment`?null:t}return e}function uh(e){return typeof e==`function`?e():j(e)}function dh(e){return{name:`arrow`,options:e,fn(t){let n=lh(uh(e.element));return n==null?{}:ah({element:n,padding:e.padding}).fn(t)}}}function fh(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ph(e,t){let n=fh(e);return Math.round(t*n)/n}function mh(e,t,n){n===void 0&&(n={});let r=n.whileElementsMounted,i=G(()=>uh(n.open)??!0),a=G(()=>uh(n.middleware)),o=G(()=>uh(n.placement)??`bottom`),s=G(()=>uh(n.strategy)??`absolute`),c=G(()=>uh(n.transform)??!0),l=G(()=>lh(e.value)),u=G(()=>lh(t.value)),d=A(0),f=A(0),p=A(s.value),m=A(o.value),h=hn({}),g=A(!1),_=G(()=>{let e={position:p.value,left:`0`,top:`0`};if(!u.value)return e;let t=ph(u.value,d.value),n=ph(u.value,f.value);return c.value?{...e,transform:`translate(`+t+`px, `+n+`px)`,...fh(u.value)>=1.5&&{willChange:`transform`}}:{position:p.value,left:t+`px`,top:n+`px`}}),v;function y(){if(l.value==null||u.value==null)return;let e=i.value;sh(l.value,u.value,{middleware:a.value,placement:o.value,strategy:s.value}).then(t=>{d.value=t.x,f.value=t.y,p.value=t.strategy,m.value=t.placement,h.value=t.middlewareData,g.value=e!==!1})}function b(){typeof v==`function`&&(v(),v=void 0)}function x(){if(b(),r===void 0){y();return}if(l.value!=null&&u.value!=null){v=r(l.value,u.value,y);return}}function S(){i.value||(g.value=!1)}return N([a,o,s,i],y,{flush:`sync`}),N([l,u],x,{flush:`sync`}),N(i,S,{flush:`sync`}),Re()&&ze(b),{x:rn(d),y:rn(f),strategy:rn(p),placement:rn(m),middlewareData:rn(h),isPositioned:rn(g),floatingStyles:_,update:y}}var hh=[`dir`],gh={side:`bottom`,sideOffset:0,sideFlip:!0,align:`center`,alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:`partial`,hideWhenDetached:!1,positionStrategy:`fixed`,updatePositionStrategy:`optimized`,prioritizePosition:!1},[_h,vh]=Eu(`PopperContent`),yh=P({inheritAttrs:!1,__name:`PopperContent`,props:La({memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...gh}),emits:[`placed`],setup(e,{emit:t}){let n=e,r=t,i=ip(),{forwardRef:a,currentElement:o}=wd(),s=vd(G(()=>n.dir)),c=A(),l=A(),{width:u,height:d}=qd(l),f=G(()=>n.side+(n.align===`center`?``:`-${n.align}`)),p=G(()=>typeof n.collisionPadding==`number`?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),m=G(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),h=G(()=>({padding:p.value,boundary:m.value.filter(cp),altBoundary:m.value.length>0})),g=G(()=>({mainAxis:n.sideFlip,crossAxis:n.alignFlip})),_=G(()=>[eh({mainAxis:n.sideOffset+d.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&nh({...h.value,...g.value}),n.avoidCollisions&&th({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky===`partial`?oh():void 0,...h.value}),!n.prioritizePosition&&n.avoidCollisions&&nh({...h.value,...g.value}),rh({...h.value,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--reka-popper-available-width`,`${n}px`),o.setProperty(`--reka-popper-available-height`,`${r}px`),o.setProperty(`--reka-popper-anchor-width`,`${i}px`),o.setProperty(`--reka-popper-anchor-height`,`${a}px`)}}),l.value&&dh({element:l.value,padding:n.arrowPadding}),lp({arrowWidth:u.value,arrowHeight:d.value,dir:s.value}),n.hideWhenDetached&&ih({strategy:`referenceHidden`,...h.value})]),{floatingStyles:v,placement:y,isPositioned:b,middlewareData:x,update:S}=mh(G(()=>n.reference??i.anchor.value),c,{strategy:n.positionStrategy,placement:f,whileElementsMounted:(...e)=>$m(...e,{layoutShift:!n.disableUpdateOnLayoutShift,animationFrame:n.updatePositionStrategy===`always`}),middleware:_}),C=G(()=>up(y.value)[0]),w=G(()=>up(y.value)[1]);kr(()=>{b.value&&r(`placed`)});let T=G(()=>{let e=x.value.arrow?.centerOffset!==0;return n.hideShiftedArrow&&e}),ee=A(``);return Or(()=>{o.value&&(ee.value=window.getComputedStyle(o.value).zIndex)}),vh({placedSide:C,onArrowChange:e=>l.value=e,arrowX:G(()=>x.value.arrow?.x??0),arrowY:G(()=>x.value.arrow?.y??0),shouldHideArrow:T}),(e,t)=>(R(),z(`div`,{ref_key:`floatingRef`,ref:c,"data-reka-popper-content-wrapper":``,dir:j(s),style:ge({...j(v),transform:j(b)?j(v).transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ee.value,"--reka-popper-transform-origin":[j(x).transformOrigin?.x,j(x).transformOrigin?.y].join(` `),...j(x).hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}})},[n.memoDependencies?ac([n.asChild,n.as,C.value,w.value,j(b),...Object.values(e.$attrs),...n.memoDependencies],()=>(R(),B(j(rf),js({key:0,ref:j(a)},e.$attrs,{"as-child":n.asChild,as:n.as,"data-side":C.value,"data-align":w.value,style:{animation:j(b)?void 0:`none`}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`as-child`,`as`,`data-side`,`data-align`,`style`])),t,0):(R(),B(j(rf),js({key:1,ref:j(a)},e.$attrs,{"as-child":n.asChild,as:n.as,"data-side":C.value,"data-align":w.value,dir:j(s),style:{animation:j(b)?void 0:`none`}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`as-child`,`as`,`data-side`,`data-align`,`dir`,`style`]))],12,hh))}}),[bh,xh]=Eu(`RovingFocusGroup`),Sh=P({__name:`RovingFocusGroup`,props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`entryFocus`,`update:currentTabStopId`],setup(e,{expose:t,emit:n}){let r=e,i=n,{loop:a,orientation:o,dir:s}=wn(r),c=vd(s),l=nd(r,`currentTabStopId`,i,{defaultValue:r.defaultCurrentTabStopId,passive:r.currentTabStopId===void 0}),u=A(!1),d=A(!1),f=A(0),{getItems:p,CollectionSlot:m}=Zf({isProvider:!0});function h(e){let t=!d.value;if(e.currentTarget&&e.target===e.currentTarget&&t&&!u.value){let t=new CustomEvent(tp,np);if(e.currentTarget.dispatchEvent(t),i(`entryFocus`,t),!t.defaultPrevented){let e=p().map(e=>e.ref).filter(e=>e.dataset.disabled!==``);rp([e.find(e=>e.getAttribute(`data-active`)===``),e.find(e=>e.getAttribute(`data-highlighted`)===``),e.find(e=>e.id===l.value),...e].filter(Boolean),r.preventScrollOnEntryFocus)}}d.value=!1}function g(){setTimeout(()=>{d.value=!1},1)}return t({getItems:p}),xh({loop:a,dir:c,orientation:o,currentTabStopId:l,onItemFocus:e=>{l.value=e},onItemShiftTab:()=>{u.value=!0},onFocusableItemAdd:()=>{f.value++},onFocusableItemRemove:()=>{f.value--}}),(e,t)=>(R(),B(j(m),null,{default:M(()=>[H(j(rf),{tabindex:u.value||f.value===0?-1:0,"data-orientation":j(o),as:e.as,"as-child":e.asChild,dir:j(c),style:{outline:`none`},onMousedown:t[0]||=e=>d.value=!0,onMouseup:g,onFocus:h,onBlur:t[1]||=e=>u.value=!1},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`as`,`as-child`,`dir`])]),_:3}))}}),Ch=P({__name:`MenuAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(sp),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}});function wh(){let e=A(!1);return ta(()=>{Zu(`keydown`,()=>{e.value=!0},{capture:!0,passive:!0}),Zu([`pointerdown`,`pointermove`],()=>{e.value=!1},{capture:!0,passive:!0})}),e}var Th=Vu(wh),[Eh,Dh]=Eu([`MenuRoot`,`MenuSub`],`MenuContext`),[Oh,kh]=Eu(`MenuRoot`),Ah=P({__name:`MenuRoot`,props:{open:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t,{modal:i,dir:a}=wn(n),o=vd(a),s=nd(n,`open`,r),c=A(),l=Th();return Dh({open:s,onOpenChange:e=>{s.value=e},content:c,onContentChange:e=>{c.value=e}}),kh({onClose:()=>{s.value=!1},isUsingKeyboardRef:l,dir:o,modal:i}),(e,t)=>(R(),B(j(op),null,{default:M(()=>[I(e.$slots,`default`)]),_:3}))}}),[jh,Mh]=Eu(`MenuContent`),Nh=P({__name:`MenuContentImpl`,props:La({loop:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},disableOutsideScroll:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...gh}),emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`entryFocus`,`openAutoFocus`,`closeAutoFocus`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,i=Eh(),a=Oh(),{trapFocus:o,disableOutsidePointerEvents:s,loop:c}=wn(n);xd(),hd(s.value);let l=A(``),u=A(0),d=A(0),f=A(null),p=A(`right`),m=A(0),h=A(null),g=A(),{forwardRef:_,currentElement:v}=wd(),{handleTypeaheadSearch:y}=Yd(),b=A();function x(e){let t=ad(e,b.value||Du(),v.value,{loop:c.value,arrowKeyOptions:`vertical`,dir:a?.dir.value,focus:!1,attributeName:`[data-reka-collection-item]:not([data-disabled])`});t&&(b.value=t,t.scrollIntoView({block:`nearest`}))}function S(){b.value&&b.value.click()}let C=A(),w=A();N(b,e=>{if(w.value&&(e===void 0||e!==w.value.trigger.value)){if(e===void 0)return;w.value.onOpenChange(!1),w.value=void 0}}),N(v,e=>{i.onContentChange(e)}),aa(()=>{window.clearTimeout(u.value)});function T(e){return p.value===f.value?.side&&Rf(e,f.value?.area)}async function ee(e){r(`openAutoFocus`,e),!e.defaultPrevented&&(e.preventDefault(),v.value?.focus({preventScroll:!0}))}function E(e){if(e.defaultPrevented)return;let t=e.target,n=t.closest(`[data-reka-menu-content]`)===e.currentTarget,r=[`input`,`textarea`].includes(t.tagName.toLowerCase()),i=e.ctrlKey||e.altKey||e.metaKey,o=e.key.length===1,s=ad(e,Du(),v.value,{loop:c.value,arrowKeyOptions:`vertical`,dir:a?.dir.value,focus:!0,attributeName:`[data-reka-collection-item]:not([data-disabled])`});if(s)return s?.focus();if(e.code===`Space`)return;let l=g.value?.getItems()??[];if(n&&(e.key===`Tab`&&a.modal.value&&e.preventDefault(),!i&&o&&!r&&y(e.key,l)),e.target!==v.value||!Pf.includes(e.key))return;e.preventDefault();let u=[...l.map(e=>e.ref)];Nf.includes(e.key)&&u.reverse(),If(u)}function te(e){e?.currentTarget?.contains?.(e.target)||(window.clearTimeout(u.value),l.value=``)}function ne(e){if(!zf(e))return;let t=e.target,n=m.value!==e.clientX;if((e?.currentTarget)?.contains(t)&&n){let t=e.clientX>m.value?`right`:`left`;p.value=t,m.value=e.clientX}}function re(e){zf(e)&&C.value&&C.value.focus()}return Mh({onItemEnter:e=>!!T(e),onItemLeave:e=>T(e)?!0:([`INPUT`,`TEXTAREA`].includes(Du()?.tagName||``)||v.value?.focus(),h.value=null,!1),onTriggerLeave:e=>!!T(e),searchRef:l,highlightedElement:b,onKeydownNavigation:x,onKeydownEnter:S,filterElement:C,onFilterElementChange:e=>{C.value=e},activeSubmenuContext:w,pointerGraceTimerRef:d,onPointerGraceIntentChange:e=>{f.value=e}}),(e,t)=>(R(),B(j(kf),{"as-child":``,trapped:j(o),onMountAutoFocus:ee,onUnmountAutoFocus:t[7]||=e=>r(`closeAutoFocus`,e)},{default:M(()=>[H(j(hf),{"as-child":``,"disable-outside-pointer-events":j(s),onEscapeKeyDown:t[2]||=e=>r(`escapeKeyDown`,e),onPointerDownOutside:t[3]||=e=>r(`pointerDownOutside`,e),onFocusOutside:t[4]||=e=>r(`focusOutside`,e),onInteractOutside:t[5]||=e=>r(`interactOutside`,e),onDismiss:t[6]||=e=>r(`dismiss`)},{default:M(()=>[H(j(Sh),{ref_key:`rovingFocusGroupRef`,ref:g,"current-tab-stop-id":h.value,"onUpdate:currentTabStopId":t[0]||=e=>h.value=e,"as-child":``,orientation:`vertical`,dir:j(a).dir.value,loop:j(c),onEntryFocus:t[1]||=e=>{r(`entryFocus`,e),j(a).isUsingKeyboardRef.value||e.preventDefault()}},{default:M(()=>[H(j(yh),{ref:j(_),role:`menu`,as:e.as,"as-child":e.asChild,"aria-orientation":`vertical`,"data-reka-menu-content":``,"data-state":j(Ff)(j(i).open.value),dir:j(a).dir.value,side:e.side,"side-offset":e.sideOffset,align:e.align,"align-offset":e.alignOffset,"avoid-collisions":e.avoidCollisions,"collision-boundary":e.collisionBoundary,"collision-padding":e.collisionPadding,"arrow-padding":e.arrowPadding,"prioritize-position":e.prioritizePosition,"position-strategy":e.positionStrategy,"update-position-strategy":e.updatePositionStrategy,sticky:e.sticky,"hide-when-detached":e.hideWhenDetached,reference:e.reference,onKeydown:E,onBlur:te,onPointermove:ne,onPointerenter:re},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`,`dir`,`side`,`side-offset`,`align`,`align-offset`,`avoid-collisions`,`collision-boundary`,`collision-padding`,`arrow-padding`,`prioritize-position`,`position-strategy`,`update-position-strategy`,`sticky`,`hide-when-detached`,`reference`])]),_:3},8,[`current-tab-stop-id`,`dir`,`loop`])]),_:3},8,[`disable-outside-pointer-events`])]),_:3},8,[`trapped`]))}}),Ph=P({inheritAttrs:!1,__name:`MenuItemImpl`,props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=jh(),{forwardRef:r,currentElement:i}=wd(),{CollectionItem:a}=Zf(),o=A(!1),s=G(()=>o.value||i.value!=null&&n.highlightedElement.value===i.value);async function c(e){if(!e.defaultPrevented&&zf(e)){if(t.disabled)n.onItemLeave(e);else if(!n.onItemEnter(e)){let t=e.currentTarget;n.highlightedElement.value=t,[`INPUT`,`TEXTAREA`].includes(Du()?.tagName||``)||t.focus({preventScroll:!0})}}}async function l(e){await rr(),!e.defaultPrevented&&zf(e)&&n.highlightedElement.value===i.value&&!n.onItemLeave(e)&&n.highlightedElement.value===i.value&&(n.highlightedElement.value=void 0)}return(e,t)=>(R(),B(j(a),{value:{textValue:e.textValue}},{default:M(()=>[H(j(rf),js({ref:j(r),role:`menuitem`,tabindex:`-1`},e.$attrs,{as:e.as,"as-child":e.asChild,"aria-disabled":e.disabled||void 0,"data-disabled":e.disabled?``:void 0,"data-highlighted":s.value?``:void 0,onPointermove:c,onPointerleave:l,onFocus:t[0]||=async t=>{let r=t.currentTarget;await rr(),!(t.defaultPrevented||e.disabled)&&(o.value=!0,j(n).highlightedElement.value=r)},onBlur:t[1]||=async e=>{await rr(),!e.defaultPrevented&&(o.value=!1)}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`aria-disabled`,`data-disabled`,`data-highlighted`])]),_:3},8,[`value`]))}}),Fh=P({__name:`MenuItem`,props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`select`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=wd(),o=Oh(),s=jh(),c=A(!1);async function l(){let e=a.value;if(!n.disabled&&e){let e=new CustomEvent(Af,{bubbles:!0,cancelable:!0});r(`select`,e),await rr(),e.defaultPrevented?c.value=!1:o.onClose()}}return(e,t)=>(R(),B(Ph,js(n,{ref:j(i),onClick:l,onPointerdown:t[0]||=()=>{c.value=!0},onPointerup:t[1]||=async e=>{await rr(),!e.defaultPrevented&&(c.value||e.currentTarget?.click())},onKeydown:t[2]||=async t=>{let n=j(s).searchRef.value!==``;e.disabled||n&&t.key===` `||j(jf).includes(t.key)&&(t.currentTarget?.click(),t.preventDefault())}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Ih=P({__name:`MenuRootContentModal`,props:{loop:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`entryFocus`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Ed(n,r),a=Eh(),{forwardRef:o,currentElement:s}=wd();return Wd(s),(e,t)=>(R(),B(Nh,js(j(i),{ref:j(o),"trap-focus":j(a).open.value,"disable-outside-pointer-events":j(a).open.value,"disable-outside-scroll":!0,onDismiss:t[0]||=e=>j(a).onOpenChange(!1),onFocusOutside:t[1]||=cu(e=>r(`focusOutside`,e),[`prevent`])}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`trap-focus`,`disable-outside-pointer-events`]))}}),Lh=P({__name:`MenuRootContentNonModal`,props:{loop:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`entryFocus`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=Ed(e,t),r=Eh();return(e,t)=>(R(),B(Nh,js(j(n),{"trap-focus":!1,"disable-outside-pointer-events":!1,"disable-outside-scroll":!1,onDismiss:t[0]||=e=>j(r).onOpenChange(!1)}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Rh=P({__name:`MenuContent`,props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`entryFocus`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=Ed(e,t),r=Eh(),i=Oh();return(e,t)=>(R(),B(j(ef),{present:e.forceMount||j(r).open.value},{default:M(()=>[j(i).modal.value?(R(),B(Ih,xe(js({key:0},{...e.$attrs,...j(n)})),{default:M(()=>[I(e.$slots,`default`)]),_:3},16)):(R(),B(Lh,xe(js({key:1},{...e.$attrs,...j(n)})),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),zh=P({__name:`MenuPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(qf),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Bh=P({__name:`MenuSeparator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(rf),js(t,{role:`separator`,"aria-orientation":`horizontal`}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),[Vh,Hh]=Eu(`PopoverRoot`),Uh=P({__name:`PopoverRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},modal:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t,{modal:i}=wn(n),a=nd(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0});return Hh({contentId:``,triggerId:``,modal:i,open:a,onOpenChange:e=>{a.value=e},onOpenToggle:()=>{a.value=!a.value},triggerElement:A(),hasCustomAnchor:A(!1)}),(e,t)=>(R(),B(j(op),null,{default:M(()=>[I(e.$slots,`default`,{open:j(a),close:()=>a.value=!1})]),_:3}))}}),Wh=P({__name:`PopoverClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;wd();let n=Vh();return(e,r)=>(R(),B(j(rf),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,onClick:r[0]||=e=>j(n).onOpenChange(!1)},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`]))}}),Gh=P({__name:`PopoverContentImpl`,props:{trapFocus:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Td(Wu(n,`trapFocus`,`disableOutsidePointerEvents`)),{forwardRef:a}=wd(),o=Vh();return xd(),(e,t)=>(R(),B(j(kf),{"as-child":``,loop:``,trapped:e.trapFocus,onMountAutoFocus:t[5]||=e=>r(`openAutoFocus`,e),onUnmountAutoFocus:t[6]||=e=>r(`closeAutoFocus`,e)},{default:M(()=>[H(j(hf),{"as-child":``,"disable-outside-pointer-events":e.disableOutsidePointerEvents,onPointerDownOutside:t[0]||=e=>r(`pointerDownOutside`,e),onInteractOutside:t[1]||=e=>r(`interactOutside`,e),onEscapeKeyDown:t[2]||=e=>r(`escapeKeyDown`,e),onFocusOutside:t[3]||=e=>r(`focusOutside`,e),onDismiss:t[4]||=e=>j(o).onOpenChange(!1)},{default:M(()=>[H(j(yh),js(j(i),{id:j(o).contentId,ref:j(a),"data-state":j(o).open.value?`open`:`closed`,"aria-labelledby":j(o).triggerId,style:{"--reka-popover-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-popover-content-available-width":`var(--reka-popper-available-width)`,"--reka-popover-content-available-height":`var(--reka-popper-available-height)`,"--reka-popover-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-popover-trigger-height":`var(--reka-popper-anchor-height)`},role:`dialog`}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`id`,`data-state`,`aria-labelledby`])]),_:3},8,[`disable-outside-pointer-events`])]),_:3},8,[`trapped`]))}}),Kh=P({__name:`PopoverContentModal`,props:{memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Vh(),a=A(!1);hd(!0);let o=Ed(n,r),{forwardRef:s,currentElement:c}=wd();return Wd(c),(e,t)=>(R(),B(Gh,js(j(o),{ref:j(s),"trap-focus":j(i).open.value,"disable-outside-pointer-events":``,onCloseAutoFocus:t[0]||=cu(e=>{r(`closeAutoFocus`,e),a.value||j(i).triggerElement.value?.focus()},[`prevent`]),onPointerDownOutside:t[1]||=e=>{r(`pointerDownOutside`,e);let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,i=t.button===2||n;a.value=i},onFocusOutside:t[2]||=cu(()=>{},[`prevent`])}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`trap-focus`]))}}),qh=P({__name:`PopoverContentNonModal`,props:{memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Vh(),a=A(!1),o=A(!1),s=Ed(n,r);return(e,t)=>(R(),B(Gh,js(j(s),{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:t[0]||=e=>{r(`closeAutoFocus`,e),e.defaultPrevented||(a.value||j(i).triggerElement.value?.focus(),e.preventDefault()),a.value=!1,o.value=!1},onInteractOutside:t[1]||=async e=>{r(`interactOutside`,e),e.defaultPrevented||(a.value=!0,e.detail.originalEvent.type===`pointerdown`&&(o.value=!0));let t=e.target;j(i).triggerElement.value?.contains(t)&&e.preventDefault(),e.detail.originalEvent.type===`focusin`&&o.value&&e.preventDefault()}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Jh=P({__name:`PopoverContent`,props:{forceMount:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Vh(),a=Ed(n,r),{forwardRef:o}=wd();return i.contentId||=Kd(void 0,`reka-popover-content`),(e,t)=>(R(),B(j(ef),{present:e.forceMount||j(i).open.value},{default:M(()=>[j(i).modal.value?(R(),B(Kh,js({key:0},j(a),{ref:j(o)}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16)):(R(),B(qh,js({key:1},j(a),{ref:j(o)}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),Yh=P({__name:`PopoverPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(qf),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),Xh=P({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=Vh(),{forwardRef:r,currentElement:i}=wd();return n.triggerId||=Kd(void 0,`reka-popover-trigger`),n.contentId||=Kd(void 0,`reka-popover-content`),ta(()=>{n.triggerElement.value=i.value}),(e,i)=>(R(),B(ma(j(n).hasCustomAnchor.value?j(rf):j(sp)),{"as-child":``},{default:M(()=>[H(j(rf),{id:j(n).triggerId,ref:j(r),type:e.as===`button`?`button`:void 0,"aria-haspopup":`dialog`,"aria-expanded":j(n).open.value,"aria-controls":j(n).open.value?j(n).contentId:void 0,"data-state":j(n).open.value?`open`:`closed`,as:e.as,"as-child":t.asChild,onClick:j(n).onOpenToggle},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`id`,`type`,`aria-expanded`,`aria-controls`,`data-state`,`as`,`as-child`,`onClick`])]),_:3}))}}),[Zh,Qh]=Eu(`DropdownMenuRoot`),$h=P({__name:`DropdownMenuRoot`,props:{defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t;wd();let i=nd(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0}),a=A(),{modal:o,dir:s}=wn(n),c=vd(s);return Qh({open:i,onOpenChange:e=>{i.value=e},onOpenToggle:()=>{i.value=!i.value},triggerId:``,triggerElement:a,contentId:``,modal:o,dir:c}),(e,t)=>(R(),B(j(Ah),{open:j(i),"onUpdate:open":t[0]||=e=>mn(i)?i.value=e:null,dir:j(c),modal:j(o)},{default:M(()=>[I(e.$slots,`default`,{open:j(i)})]),_:3},8,[`open`,`dir`,`modal`]))}}),eg=P({__name:`DropdownMenuContent`,props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`closeAutoFocus`],setup(e,{emit:t}){let n=Ed(e,t);wd();let r=Zh(),i=A(!1);function a(e){e.defaultPrevented||(i.value||setTimeout(()=>{r.triggerElement.value?.focus()},0),i.value=!1,e.preventDefault())}return r.contentId||=Kd(void 0,`reka-dropdown-menu-content`),(e,t)=>(R(),B(j(Rh),js(j(n),{id:j(r).contentId,"aria-labelledby":j(r)?.triggerId,style:{"--reka-dropdown-menu-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-dropdown-menu-content-available-width":`var(--reka-popper-available-width)`,"--reka-dropdown-menu-content-available-height":`var(--reka-popper-available-height)`,"--reka-dropdown-menu-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-dropdown-menu-trigger-height":`var(--reka-popper-anchor-height)`},onCloseAutoFocus:a,onInteractOutside:t[0]||=e=>{if(e.defaultPrevented)return;let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,a=t.button===2||n;(!j(r).modal.value||a)&&(i.value=!0),j(r).triggerElement.value?.contains(e.target)&&e.preventDefault()}}),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`id`,`aria-labelledby`]))}}),tg=P({__name:`DropdownMenuItem`,props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`select`],setup(e,{emit:t}){let n=e,r=yd(t);return wd(),(e,t)=>(R(),B(j(Fh),xe(Ts({...n,...j(r)})),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),ng=P({__name:`DropdownMenuPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(zh),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),rg=P({__name:`DropdownMenuSeparator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return wd(),(e,n)=>(R(),B(j(Bh),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),ig=P({__name:`DropdownMenuTrigger`,props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=Zh(),{forwardRef:r,currentElement:i}=wd();return ta(()=>{n.triggerElement=i}),n.triggerId||=Kd(void 0,`reka-dropdown-menu-trigger`),(e,i)=>(R(),B(j(Ch),{"as-child":``},{default:M(()=>[H(j(rf),{id:j(n).triggerId,ref:j(r),type:e.as===`button`?`button`:void 0,"as-child":t.asChild,as:e.as,"aria-haspopup":`menu`,"aria-expanded":j(n).open.value,"aria-controls":j(n).open.value?j(n).contentId:void 0,"data-disabled":e.disabled?``:void 0,disabled:e.disabled,"data-state":j(n).open.value?`open`:`closed`,onClick:i[0]||=async t=>{!e.disabled&&t.button===0&&t.ctrlKey===!1&&(j(n)?.onOpenToggle(),await rr(),j(n).open.value&&t.preventDefault())},onKeydown:i[1]||=uu(t=>{e.disabled||([`Enter`,` `].includes(t.key)&&j(n).onOpenToggle(),t.key===`ArrowDown`&&j(n).onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(t.key)&&t.preventDefault())},[`enter`,`space`,`arrow-down`])},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as-child`,`as`,`aria-expanded`,`aria-controls`,`data-disabled`,`disabled`,`data-state`])]),_:3}))}}),[ag,og]=Eu(`SwitchRoot`),sg=P({inheritAttrs:!1,__name:`SwitchRoot`,props:{defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},value:{type:String,required:!1,default:`on`},trueValue:{type:null,required:!1,default:()=>!0},falseValue:{type:null,required:!1,default:()=>!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{disabled:i}=wn(n),a=nd(n,`modelValue`,r,{defaultValue:n.defaultValue??n.falseValue,passive:n.modelValue===void 0}),o=G(()=>a.value===n.trueValue);function s(){i.value||(a.value=o.value?n.falseValue:n.trueValue)}let{forwardRef:c,currentElement:l}=wd(),u=Cd(l),d=Dd(),f=G(()=>n.id&&l.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);return og({checked:o,toggleCheck:s,disabled:i}),(e,t)=>(R(),z(L,null,[H(j(rf),js({id:e.id,ref:j(c),role:`switch`,type:e.as===`button`?`button`:void 0,value:e.value,"aria-label":e.$attrs[`aria-label`]||f.value,"aria-checked":o.value,"aria-required":e.required,"data-state":o.value?`checked`:`unchecked`,"data-disabled":j(i)?``:void 0,"as-child":e.asChild,as:e.as,disabled:j(i)},{...j(d),...e.$attrs},{onClick:s,onKeydown:uu(cu(s,[`prevent`]),[`enter`])}),{default:M(()=>[I(e.$slots,`default`,{modelValue:j(a),checked:o.value})]),_:3},16,[`id`,`type`,`value`,`aria-label`,`aria-checked`,`aria-required`,`data-state`,`data-disabled`,`as-child`,`as`,`disabled`,`onKeydown`]),j(u)&&e.name?(R(),B(j(ep),js({key:0,type:`checkbox`,name:e.name,disabled:j(i),required:e.required,value:e.value,checked:o.value},j(d)),null,16,[`name`,`disabled`,`required`,`value`,`checked`])):W(`v-if`,!0)],64))}}),cg=P({__name:`SwitchThumb`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let t=ag();return wd(),(e,n)=>(R(),B(j(rf),{"data-state":j(t).checked.value?`checked`:`unchecked`,"data-disabled":j(t).disabled.value?``:void 0,"as-child":e.asChild,as:e.as},{default:M(()=>[I(e.$slots,`default`)]),_:3},8,[`data-state`,`data-disabled`,`as-child`,`as`]))}}),[lg,ug]=Eu(`TooltipProvider`),dg=P({inheritAttrs:!1,__name:`TooltipProvider`,props:{delayDuration:{type:Number,required:!1,default:700},skipDelayDuration:{type:Number,required:!1,default:300},disableHoverableContent:{type:Boolean,required:!1,default:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:!1},content:{type:Object,required:!1}},setup(e){let{delayDuration:t,skipDelayDuration:n,disableHoverableContent:r,disableClosingTrigger:i,ignoreNonKeyboardFocus:a,disabled:o,content:s}=wn(e);wd();let c=A(!0),l=A(!1),{start:u,stop:d}=qu(()=>{c.value=!0},n,{immediate:!1});return ug({isOpenDelayed:c,delayDuration:t,onOpen(){d(),c.value=!1},onClose(){u()},isPointerInTransitRef:l,disableHoverableContent:r,disableClosingTrigger:i,disabled:o,ignoreNonKeyboardFocus:a,content:s}),(e,t)=>I(e.$slots,`default`)}}),fg=`tooltip.open`,[pg,mg]=Eu(`TooltipRoot`),hg=P({__name:`TooltipRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},delayDuration:{type:Number,required:!1,default:void 0},disableHoverableContent:{type:Boolean,required:!1,default:void 0},disableClosingTrigger:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:void 0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t;wd();let i=lg(),a=G(()=>n.disableHoverableContent??i.disableHoverableContent.value),o=G(()=>n.disableClosingTrigger??i.disableClosingTrigger.value),s=G(()=>n.disabled??i.disabled.value),c=G(()=>n.delayDuration??i.delayDuration.value),l=G(()=>n.ignoreNonKeyboardFocus??i.ignoreNonKeyboardFocus.value),u=nd(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0});N(u,e=>{i.onClose&&(e?(i.onOpen(),document.dispatchEvent(new CustomEvent(fg))):i.onClose())});let d=A(!1),f=A(),p=G(()=>u.value?d.value?`delayed-open`:`instant-open`:`closed`),{start:m,stop:h}=qu(()=>{d.value=!0,u.value=!0},c,{immediate:!1});function g(){h(),d.value=!1,u.value=!0}function _(){h(),u.value=!1}function v(){m()}return mg({contentId:``,open:u,stateAttribute:p,trigger:f,onTriggerChange(e){f.value=e},onTriggerEnter(){i.isOpenDelayed.value?v():g()},onTriggerLeave(){a.value?_():h()},onOpen:g,onClose:_,disableHoverableContent:a,disableClosingTrigger:o,disabled:s,ignoreNonKeyboardFocus:l}),(e,t)=>(R(),B(j(op),null,{default:M(()=>[I(e.$slots,`default`,{open:j(u)})]),_:3}))}}),gg=P({__name:`TooltipContentImpl`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1,default:void 0},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1,default:void 0},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1,default:void 0},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=pg(),a=lg(),{forwardRef:o,currentElement:s}=wd(),c=G(()=>n.ariaLabel||s.value?.textContent),l=G(()=>{let{ariaLabel:e,...t}=n;return pd(t,a.content.value??{},{side:`top`,sideOffset:0,align:`center`,avoidCollisions:!0,collisionBoundary:[],collisionPadding:0,arrowPadding:0,sticky:`partial`,hideWhenDetached:!1})});return ta(()=>{Zu(window,`scroll`,e=>{e.target?.contains(i.trigger.value)&&i.onClose()},{capture:!0}),Zu(document,fg,i.onClose)}),(e,t)=>(R(),B(j(hf),{"as-child":``,"disable-outside-pointer-events":!1,onEscapeKeyDown:t[0]||=e=>r(`escapeKeyDown`,e),onPointerDownOutside:t[1]||=e=>{j(i).disableClosingTrigger.value&&j(i).trigger.value?.contains(e.target)&&e.preventDefault(),r(`pointerDownOutside`,e)},onFocusOutside:t[2]||=cu(()=>{},[`prevent`]),onDismiss:t[3]||=e=>j(i).onClose()},{default:M(()=>[H(j(yh),js({ref:j(o),"data-state":j(i).stateAttribute.value},{...e.$attrs,...l.value},{style:{"--reka-tooltip-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-tooltip-content-available-width":`var(--reka-popper-available-width)`,"--reka-tooltip-content-available-height":`var(--reka-popper-available-height)`,"--reka-tooltip-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-tooltip-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:M(()=>[I(e.$slots,`default`),H(j(Qf),{id:j(i).contentId,role:`tooltip`},{default:M(()=>[U(k(c.value),1)]),_:1},8,[`id`])]),_:3},16,[`data-state`])]),_:3}))}}),_g=P({__name:`TooltipContentHoverable`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},setup(e){let t=Td(e),{forwardRef:n,currentElement:r}=wd(),{trigger:i,onClose:a}=pg(),o=lg(),{isPointerInTransit:s,onPointerExit:c}=Od(i,r);return o.isPointerInTransitRef=s,c(()=>{a()}),Zu(r,`pointermove`,e=>{let t=r.value;t&&e.pointerType!==`touch`&&t.ownerDocument.elementsFromPoint?.(e.clientX,e.clientY).some(e=>{if(t.contains(e))return!1;let n=e.closest(`[data-grace-area-trigger]`);return!!n&&n!==i.value})&&a()}),(e,r)=>(R(),B(gg,js({ref:j(n)},j(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),vg=P({__name:`TooltipContent`,props:{forceMount:{type:Boolean,required:!1},ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=pg(),a=Ed(n,r),{forwardRef:o}=wd();return(e,t)=>(R(),B(j(ef),{present:e.forceMount||j(i).open.value},{default:M(()=>[(R(),B(ma(j(i).disableHoverableContent.value?gg:_g),js({ref:j(o)},j(a)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),yg=P({__name:`TooltipPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(R(),B(j(qf),xe(Ts(t)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16))}}),bg=P({__name:`TooltipTrigger`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=pg(),r=lg();n.contentId||=Kd(void 0,`reka-tooltip-content`);let{forwardRef:i,currentElement:a}=wd(),o=A(!1),s=A(!1),c=G(()=>n.disabled.value?{}:{click:h,focus:p,pointermove:d,pointerleave:f,pointerdown:u,blur:m});N(a,e=>{n.onTriggerChange(e)},{immediate:!0});function l(){setTimeout(()=>{o.value=!1},1)}function u(){n.open&&!n.disableClosingTrigger.value&&n.onClose(),o.value=!0,document.addEventListener(`pointerup`,l,{once:!0})}function d(e){e.pointerType!==`touch`&&!s.value&&!r.isPointerInTransitRef.value&&(n.onTriggerEnter(),s.value=!0)}function f(){n.onTriggerLeave(),s.value=!1}function p(e){o.value||(!n.ignoreNonKeyboardFocus.value||e.target.matches?.(`:focus-visible`))&&n.onOpen()}function m(){n.onClose()}function h(){n.disableClosingTrigger.value||n.onClose()}return(e,r)=>(R(),B(j(sp),{"as-child":``,reference:e.reference??j(a)},{default:M(()=>[H(j(rf),js({ref:j(i),"aria-describedby":j(n).open.value?j(n).contentId:void 0,"data-state":j(n).stateAttribute.value,as:e.as,"as-child":t.asChild,"data-grace-area-trigger":``},ba(c.value)),{default:M(()=>[I(e.$slots,`default`)]),_:3},16,[`aria-describedby`,`data-state`,`as`,`as-child`])]),_:3},8,[`reference`]))}}),xg=e=>e.startsWith(`/`);function Sg(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function Cg(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&Sg(e.default)}var wg=Object.assign;function Tg(e,t){let n={};for(let r in t){let i=t[r];n[r]=Dg(i)?i.map(e):e(i)}return n}var Eg=()=>{},Dg=Array.isArray;function Og(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var kg=Symbol(``);function Ag(e,t){return wg(Error(),{type:e,[kg]:!0},t)}function jg(e,t){return e instanceof Error&&kg in e&&(t==null||!!(e.type&t))}var Mg=Symbol(``),Ng=Symbol(``),Pg=Symbol(``),Fg=Symbol(``),Ig=Symbol(``);function Lg(){return wr(Pg)}function Rg(e){return wr(Fg)}var zg=typeof document<`u`,Bg=/#/g,Vg=/&/g,Hg=/\//g,Ug=/=/g,Wg=/\?/g,Gg=/\+/g,Kg=/%5B/g,qg=/%5D/g,Jg=/%5E/g,Yg=/%60/g,Xg=/%7B/g,Zg=/%7C/g,Qg=/%7D/g,$g=/%20/g;function e_(e){return e==null?``:encodeURI(``+e).replace(Zg,`|`).replace(Kg,`[`).replace(qg,`]`)}function t_(e){return e_(e).replace(Xg,`{`).replace(Qg,`}`).replace(Jg,`^`)}function n_(e){return e_(e).replace(Gg,`%2B`).replace($g,`+`).replace(Bg,`%23`).replace(Vg,`%26`).replace(Yg,"`").replace(Xg,`{`).replace(Qg,`}`).replace(Jg,`^`)}function r_(e){return n_(e).replace(Ug,`%3D`)}function i_(e){return e_(e).replace(Bg,`%23`).replace(Wg,`%3F`)}function a_(e){return i_(e).replace(Hg,`%2F`)}function o_(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var s_=/\/$/,c_=e=>e.replace(s_,``);function l_(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=__(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:o_(o)}}function u_(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function d_(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function f_(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&p_(t.matched[r],n.matched[i])&&m_(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function p_(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function m_(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!h_(e[n],t[n]))return!1;return!0}function h_(e,t){return Dg(e)?g_(e,t):Dg(t)?g_(t,e):(e&&e.valueOf())===(t&&t.valueOf())}function g_(e,t){return Dg(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function __(e,t){if(xg(e))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o<r.length;o++)if(s=r[o],s!==`.`){if(s===`..`)a>1&&a--;else break}return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var v_={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0};function y_(e){if(!e){if(zg){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^/]+/,``)}else e=`/`}return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),c_(e)}var b_=/^[^#]+#/;function x_(e,t){return e.replace(b_,`#`)+t}function S_(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var C_=()=>history.scrollRestoration===`manual`?{left:window.scrollX,top:window.scrollY}:null;function w_(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=S_(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function T_(e,t){return(history.state?history.state.position-t:-1)+e}var E_=new Map;function D_(e){E_.set(e,C_())}function O_(e){let t=E_.get(e);return E_.delete(e),t}function k_(e){return typeof e==`string`||e&&typeof e==`object`}function A_(e){return typeof e==`string`||typeof e==`symbol`}function j_(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;e<n.length;++e){let r=n[e].replace(Gg,` `),i=r.indexOf(`=`),a=o_(i<0?r:r.slice(0,i)),o=i<0?null:o_(r.slice(i+1));if(a in t){let e=t[a];Dg(e)||(e=t[a]=[e]),e.push(o)}else t[a]=o}return t}function M_(e){let t=``;for(let n in e){let r=e[n];if(n=r_(n),r==null){r!==void 0&&(t+=(t.length?`&`:``)+n);continue}(Dg(r)?r.map(e=>e&&n_(e)):[r&&n_(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function N_(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=Dg(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}function P_(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function F_(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(Ag(4,{from:n,to:t})):e instanceof Error?c(e):k_(e)?c(Ag(2,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function I_(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(t===`beforeRouteEnter`||o.instances[e]){if(Sg(s)){let c=(s.__vccOpts||s)[t];c&&a.push(F_(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=Cg(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&F_(c,n,r,o,e,i)()}))}}}return a}function L_(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;o<a;o++){let a=t.matched[o];a&&(e.matched.find(e=>p_(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>p_(e,s))||i.push(s))}return[n,r,i]}var R_=()=>location.protocol+`//`+location.host;function z_(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),d_(n,``)}return d_(n,e)+r+i}function B_(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=z_(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:`pop`,direction:u?u>0?`forward`:`back`:``})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){let{history:e}=window;e.state&&e.replaceState(wg({},e.state,{scroll:C_()}),``)}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),{pauseListeners:c,listen:l,destroy:d}}function V_(e,t,n,r=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:null}}function H_(e){let{history:t,location:n}=window,r={value:z_(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:R_()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,wg({},t.state,V_(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=wg({},i.value,t.state,{forward:e,scroll:C_()});a(o.current,o,!0),a(e,wg({},V_(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function U_(e){e=y_(e);let t=H_(e),n=B_(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=wg({location:``,base:e,go:r,createHref:x_.bind(null,e)},t,n);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>t.state.value}),i}var W_={type:0,value:``},G_=/[a-zA-Z0-9_]/;function K_(e){if(!e)return[[]];if(e===`/`)return[[W_]];if(!xg(e))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=0,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===0?a.push({type:0,value:l}):n===1||n===2||n===3?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;s<e.length;)switch(c=e[s++],n){case 0:c===`\\`?(r=n,n=4):c===`/`?(l&&d(),o()):c===`:`?(d(),n=1):f();break;case 4:f(),n=r;break;case 1:c===`(`?n=2:G_.test(c)?f():(d(),n=0,c!==`*`&&c!==`?`&&c!==`+`&&s--);break;case 2:c===`)`?u[u.length-1]==`\\`?u=u.slice(0,-1)+c:n=3:u+=c;break;case 3:d(),n=0,c!==`*`&&c!==`?`&&c!==`+`&&s--,u=``;break;default:t(`Unknown state`)}return n===2&&t(`Unfinished custom RegExp for param "${l}"`),d(),o(),i}var q_=`[^/]+?`,J_={sensitive:!1,strict:!1,start:!0,end:!0},Y_=/[.+*?^${}()[\]/\\]/g;function X_(e,t){let n=wg({},J_,t),r=[],i=n.start?`^`:``,a=[];for(let t of e){let e=t.length?[]:[90];n.strict&&!t.length&&(i+=`/`);for(let r=0;r<t.length;r++){let o=t[r],s=40+(n.sensitive?.25:0);if(o.type===0)r||(i+=`/`),i+=o.value.replace(Y_,`\\$&`),s+=40;else if(o.type===1){let{value:e,repeatable:n,optional:c,regexp:l}=o;a.push({name:e,repeatable:n,optional:c});let u=l||q_;if(u!==q_){s+=10;try{RegExp(`(${u})`)}catch(t){throw Error(`Invalid custom RegExp for param "${e}" (${u}): `+t.message)}}let d=n?`((?:${u})(?:/(?:${u}))*)`:`(${u})`;r||(d=c&&t.length<2?`(?:/${d})`:`/`+d),c&&(d+=`?`),i+=d,s+=20,c&&(s+=-8),n&&(s+=-20),u===`.*`&&(s+=-50)}e.push(s)}r.push(e)}if(n.strict&&n.end){let e=r.length-1;r[e][r[e].length-1]+=.7000000000000001}n.strict||(i+=`/?`),n.end?i+=`$`:n.strict&&!i.endsWith(`/`)&&(i+=`(?:/|$)`);let o=new RegExp(i,n.sensitive?``:`i`);function s(e){let t=e.match(o),n={};if(!t)return null;for(let e=1;e<t.length;e++){let r=t[e]||``,i=a[e-1];n[i.name]=r&&i.repeatable?r.split(`/`):r}return n}function c(t){let n=``,r=!1;for(let i of e){(!r||!n.endsWith(`/`))&&(n+=`/`),r=!1;for(let e of i)if(e.type===0)n+=e.value;else if(e.type===1){let{value:a,repeatable:o,optional:s}=e,c=a in t?t[a]:``;if(Dg(c)&&!o)throw Error(`Provided param "${a}" is an array but it is not repeatable (* or + modifiers)`);let l=Dg(c)?c.join(`/`):c;if(!l){if(s)i.length<2&&(n.endsWith(`/`)?n=n.slice(0,-1):r=!0);else throw Error(`Missing required param "${a}"`)}n+=l}}return n||`/`}return{re:o,score:r,keys:a,parse:s,stringify:c}}function Z_(e,t){let n=0;for(;n<e.length&&n<t.length;){let r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===80?-1:1:e.length>t.length?t.length===1&&t[0]===80?1:-1:0}function Q_(e,t){let n=0,r=e.score,i=t.score;for(;n<r.length&&n<i.length;){let e=Z_(r[n],i[n]);if(e)return e;n++}if(Math.abs(i.length-r.length)===1){if($_(r))return 1;if($_(i))return-1}return i.length-r.length}function $_(e){let t=e[e.length-1];return e.length>0&&t[t.length-1]<0}var ev={strict:!1,end:!0,sensitive:!1};function tv(e,t,n){let r=wg(X_(K_(e.path),n),{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function nv(e,t){let n=[],r=new Map;t=Og(ev,t);function i(e){return r.get(e)}function a(e,n,r){let i=!r,s=iv(e);s.aliasOf=r&&r.record;let l=Og(t,e),u=[s];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)u.push(iv(wg({},s,{components:r?r.record.components:s.components,path:e,aliasOf:r?r.record:s})))}let d,f;for(let t of u){let{path:u}=t;if(n&&!xg(u)){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(u&&r+u)}if(d=tv(t,n,l),r?r.alias.push(d):(f||=d,f!==d&&f.alias.push(d),i&&e.name&&!ov(d)&&o(e.name)),uv(d)&&c(d),s.children){let e=s.children;for(let t=0;t<e.length;t++)a(e[t],d,r&&r.children[t])}r||=d}return f?()=>{o(f)}:Eg}function o(e){if(A_(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(o),t.alias.forEach(o))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(o),e.alias.forEach(o))}}function s(){return n}function c(e){let t=cv(e,n);n.splice(t,0,e),e.record.name&&!ov(e)&&r.set(e.record.name,e)}function l(e,t){let i,a={},o,s;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw Ag(1,{location:e});s=i.record.name,a=wg(rv(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&rv(e.params,i.keys.map(e=>e.name))),o=i.stringify(a)}else if(e.path!=null)o=e.path,i=n.find(e=>e.re.test(o)),i&&(a=i.parse(o),s=i.record.name,i.keys.forEach(e=>{e.optional&&!a[e.name]&&delete a[e.name]}));else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw Ag(1,{location:e,currentLocation:t});s=i.record.name,a=wg({},t.params,e.params),o=i.stringify(a)}let c=[],l=i;for(;l;)c.unshift(l.record),l=l.parent;return{name:s,path:o,params:a,matched:c,meta:sv(c)}}e.forEach(e=>a(e));function u(){n.length=0,r.clear()}return{addRoute:a,resolve:l,removeRoute:o,clearRoutes:u,getRoutes:s,getRecordMatcher:i}}function rv(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function iv(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:av(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function av(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function ov(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function sv(e){return e.reduce((e,t)=>wg(e,t.meta),{})}function cv(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;Q_(e,t[i])<0?r=i:n=i+1}let i=lv(e);return i&&(r=t.lastIndexOf(i,r-1)),r}function lv(e){let t=e;for(;t=t.parent;)if(uv(t)&&Q_(e,t)===0)return t}function uv({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function dv(e){let t=wr(Pg),n=wr(Fg),r=G(()=>{let n=j(e.to);return t.resolve(n)}),i=G(()=>{let{matched:e}=r.value,{length:t}=e,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;let o=a.findIndex(p_.bind(null,i));if(o>-1)return o;let s=gv(e[t-2]);return t>1&&gv(i)===s&&a[a.length-1].path!==s?a.findIndex(p_.bind(null,e[t-2])):o}),a=G(()=>i.value>-1&&hv(n.params,r.value.params)),o=G(()=>i.value>-1&&i.value===n.matched.length-1&&m_(n.params,r.value.params));function s(n={}){if(mv(n)){let n=t[j(e.replace)?`replace`:`push`](j(e.to)).catch(Eg);return e.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}return{route:r,href:G(()=>r.value.href),isActive:a,isExactActive:o,navigate:s}}function fv(e){return e.length===1?e[0]:e}var pv=P({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:dv,setup(e,{slots:t}){let n=en(dv(e)),{options:r}=wr(Pg),i=G(()=>({[_v(e.activeClass,r.linkActiveClass,`router-link-active`)]:n.isActive,[_v(e.exactActiveClass,r.linkExactActiveClass,`router-link-exact-active`)]:n.isExactActive}));return()=>{let r=t.default&&fv(t.default(n));return e.custom?r:rc(`a`,{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:i.value},r)}}});function mv(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(e.button===void 0||e.button===0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function hv(e,t){for(let n in t){let r=t[n],i=e[n];if(Dg(r)){if(!Dg(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}else if(r!==i)return!1}return!0}function gv(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}var _v=(e,t,n)=>e??t??n,vv=P({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){let r=wr(Ig),i=G(()=>e.route||r.value),a=wr(Ng,0),o=G(()=>{let e=j(a),{matched:t}=i.value,n;for(;(n=t[e])&&!n.components;)e++;return e}),s=G(()=>i.value.matched[o.value]);Cr(Ng,G(()=>o.value+1)),Cr(Mg,s),Cr(Ig,i);let c=A();return N(()=>[c.value,s.value,e.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!p_(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let r=i.value,a=e.name,o=s.value,l=o&&o.components[a];if(!l)return yv(n.default,{Component:l,route:r});let u=o.props[a],d=rc(l,wg({},u?u===!0?r.params:typeof u==`function`?u(r):u:null,t,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(o.instances[a]=null)},ref:c}));return yv(n.default,{Component:d,route:r})||d}}});function yv(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}var bv=vv;function xv(e){let t=nv(e.routes,e),n=e.parseQuery||j_,r=e.stringifyQuery||M_,i=e.history,a=P_(),o=P_(),s=P_(),c=hn(v_),l=hn(0),u=v_;zg&&e.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let d=Tg.bind(null,e=>``+e),f=Tg.bind(null,a_),p=Tg.bind(null,o_);function m(e,n){let r,i;A_(e)?(r=t.getRecordMatcher(e),i=n):i=e;let a=t.addRoute(i,r);return l.value++,()=>{a(),l.value++}}function h(e){let n=t.getRecordMatcher(e);n&&(t.removeRoute(n),l.value++)}function g(){t.clearRoutes(),l.value++}function _(){return t.getRoutes().map(e=>e.record)}function v(e){return!!t.getRecordMatcher(e)}function y(e,a){if(l.value,typeof e==`string`){a||=e.startsWith(`/`)?v_:c.value;let r=l_(n,e,a.path),o=t.resolve({path:r.path},a),s=i.createHref(r.fullPath);return wg(r,o,{params:p(o.params),redirectedFrom:void 0,href:s})}a=wg({},a||(e.path!=null&&e.path.startsWith(`/`)&&!(`name`in e&&e.name)?v_:c.value));let o;if(e.path!=null)o=wg({},e,{path:l_(n,e.path,a.path).path});else{let t=wg({},e.params);for(let e in t)t[e]??delete t[e];o=wg({},e,{params:f(t)}),a.params=f(a.params)}let s=t.resolve(o,a),u=e.hash||``;s.params=d(p(s.params));let m=u_(r,wg({},e,{hash:t_(u),path:s.path})),h=i.createHref(m);return wg({fullPath:m,hash:u,query:r===M_?N_(e.query):e.query||{}},s,{redirectedFrom:void 0,href:h})}function b(e){return typeof e==`string`?l_(n,e,c.value.path):wg({},e)}function x(e,t){if(u!==e)return Ag(8,{from:t,to:e})}function S(e){return T(e)}function C(e){return S(wg(b(e),{replace:!0}))}function w(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;return typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=b(i):{path:i},i.params={}),wg({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function T(e,t){let n=u=y(e),i=c.value,a=e.state,o=e.force,s=e.replace===!0,l=w(n,i);if(l)return T(wg(b(l),{state:typeof l==`object`?wg({},a,l.state):a,force:o,replace:s}),t||n);let d=n;d.redirectedFrom=t;let f;return!o&&f_(r,i,n)&&(f=Ag(16,{to:d,from:i}),de(i,i,!0,!1)),(f?Promise.resolve(f):te(d,i)).catch(e=>jg(e)?jg(e,2)?e:ue(e):D(e,d,i)).then(e=>{if(e){if(jg(e,2))return T(wg({replace:s},b(e.to),{state:typeof e.to==`object`?wg({},a,e.to.state):a,force:o}),t||d)}else e=re(d,i,!0,s,a);return ne(d,i,e),e})}function ee(e,t){let n=x(e,t);return n?Promise.reject(n):Promise.resolve()}function E(e){let t=me.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function te(e,t){let n,[r,i,s]=L_(e,t);n=I_(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(F_(r,e,t))});let c=ee.bind(null,e,t);return n.push(c),ge(n).then(()=>{n=[];for(let r of a.list())n.push(F_(r,e,t));return n.push(c),ge(n)}).then(()=>{n=I_(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(F_(r,e,t))});return n.push(c),ge(n)}).then(()=>{n=[];for(let r of s)if(r.beforeEnter){if(Dg(r.beforeEnter))for(let i of r.beforeEnter)n.push(F_(i,e,t));else n.push(F_(r.beforeEnter,e,t))}return n.push(c),ge(n)}).then(()=>(e.matched.forEach(e=>e.enterCallbacks={}),n=I_(s,`beforeRouteEnter`,e,t,E),n.push(c),ge(n))).then(()=>{n=[];for(let r of o.list())n.push(F_(r,e,t));return n.push(c),ge(n)}).catch(e=>jg(e,8)?e:Promise.reject(e))}function ne(e,t,n){s.list().forEach(r=>E(()=>r(e,t,n)))}function re(e,t,n,r,a){let o=x(e,t);if(o)return o;let s=t===v_,l=zg?history.state:{};n&&(r||s?i.replace(e.fullPath,wg({scroll:s&&l&&l.scroll},a)):i.push(e.fullPath,a)),c.value=e,de(e,t,n,s),ue()}let ie;function ae(){ie||=i.listen((e,t,n)=>{if(!he.listening)return;let r=y(e),a=w(r,he.currentRoute.value);if(a){T(wg(a,{replace:!0,force:!0}),r).catch(Eg);return}u=r;let o=c.value;zg&&n.delta&&D_(T_(o.fullPath,n.delta)),te(r,o).catch(e=>jg(e,12)?e:jg(e,2)?(T(wg(b(e.to),{force:!0}),r).then(e=>{jg(e,20)&&!n.delta&&n.type===`pop`&&i.go(-1,!1)}).catch(Eg),Promise.reject()):(n.delta&&i.go(-n.delta,!1),D(e,r,o))).then(e=>{e||=re(r,o,!1),e&&(n.delta&&!jg(e,8)?i.go(-n.delta,!1):n.type===`pop`&&jg(e,20)&&i.go(-1,!1)),ne(r,o,e)}).catch(Eg)})}let oe=P_(),se=P_(),ce;function D(e,t,n){ue(e);let r=se.list();return r.length?r.forEach(r=>r(e,t,n)):console.error(e),Promise.reject(e)}function le(){return ce&&c.value!==v_?Promise.resolve():new Promise((e,t)=>{oe.add([e,t])})}function ue(e){return ce||(ce=!e,ae(),oe.list().forEach(([t,n])=>e?n(e):t()),oe.reset()),e}function de(t,n,r,i){let{scrollBehavior:a}=e;if(!zg||!a)return Promise.resolve();let o=!r&&O_(T_(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return rr().then(()=>a(t,n,o)).then(e=>t===c.value&&e&&w_(e)).catch(e=>t===c.value&&D(e,t,n))}let fe=e=>i.go(e),pe,me=new Set,he={currentRoute:c,listening:!0,addRoute:m,removeRoute:h,clearRoutes:g,hasRoute:v,getRoutes:_,resolve:y,options:e,push:S,replace:C,go:fe,back:()=>fe(-1),forward:()=>fe(1),beforeEach:a.add,beforeResolve:o.add,afterEach:s.add,onError:se.add,isReady:le,install(e){e.component(`RouterLink`,pv),e.component(`RouterView`,bv),e.config.globalProperties.$router=he,Object.defineProperty(e.config.globalProperties,"$route",{enumerable:!0,get:()=>j(c)}),zg&&!pe&&c.value===v_&&(pe=!0,S(i.location).catch(e=>{}));let t={};for(let e in v_)Object.defineProperty(t,e,{get:()=>c.value[e],enumerable:!0});e.provide(Pg,he),e.provide(Fg,tn(t)),e.provide(Ig,c);let n=e.unmount;me.add(e),e.unmount=function(){me.delete(e),me.size<1&&(u=v_,ie&&ie(),ie=null,c.value=v_,pe=!1,ce=!1),n()}}};function ge(e){return e.reduce((e,t)=>e.then(()=>E(t)),Promise.resolve())}return he}var Sv=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Cv=e=>e===``,wv=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Tv=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ev=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Dv=e=>{let t=Ev(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ov={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},kv=({name:e,iconNode:t,absoluteStrokeWidth:n,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":a,size:o=Ov.width,color:s=Ov.stroke,...c},{slots:l})=>rc(`svg`,{...Ov,...c,width:o,height:o,stroke:s,"stroke-width":Cv(n)||Cv(r)||n===!0||r===!0?Number(i||a||Ov[`stroke-width`])*24/Number(o):i||a||Ov[`stroke-width`],class:wv(`lucide`,c.class,...e?[`lucide-${Tv(Dv(e))}-icon`,`lucide-${Tv(e)}`]:[`lucide-icon`]),...!l.default&&!Sv(c)&&{"aria-hidden":`true`}},[...t.map(e=>rc(...e)),...l.default?[l.default()]:[]]),K=(e,t)=>(n,{slots:r,attrs:i})=>rc(kv,{...i,...n,iconNode:t,name:e},r),Av=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),jv=K(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Mv=K(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Nv=K(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Pv=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fv=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Iv=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Lv=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Rv=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),zv=K(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Bv=K(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Vv=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Hv=K(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Uv=K(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Wv=K(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Gv=K(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Kv=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),qv=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Jv=K(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Yv=K(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Xv=K(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Zv=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Qv=K(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),$v=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ey=K(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ty=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ny=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ry=K(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),iy=K(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),ay=K(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),oy=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),sy=K(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),cy=K(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ly=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),uy=K(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),dy=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),fy=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),py=K(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),my=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),hy=K(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),gy=K(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),_y=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),vy=K(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),yy=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),by=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),xy=K(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Sy=K(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Cy=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),wy=K(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ty=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ey=K(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Dy=K(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Oy=K(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),ky=K(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ay=K(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),jy=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),My=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ny=K(`thermometer`,[[`path`,{d:`M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z`,key:`17jzev`}]]),Py=K(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),Fy=K(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Iy=K(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ly=K(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),Ry=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),zy=e=>Array.isArray(e)?e:[e],By=(e,t)=>{let n=[[],[]];for(let r of e)t(r)?n[0].push(r):n[1].push(r);return n},Vy=Array,Hy=(e,t)=>e.includes(t),Uy=(e,t=0)=>[...Array(e)].map((e,n)=>n+t),Wy=(e,t,n)=>e===void 0?t===void 0?[]:Array.isArray(t)?t:[t]:(n?.prepend?Array.isArray(t)?e.unshift(...t):e.unshift(t):Array.isArray(t)?e.push(...t):e.push(t),e),Gy=(e,t)=>t==null?e??[]:e==null?zy(t):e.concat(t),Ky=(...e)=>e.reduce(Gy,[]),qy=(e,t,n)=>{if(e===void 0)return Array.isArray(t)?t:[t];let r=n?.isEqual??((e,t)=>e===t);for(let n of zy(t))e.some(e=>r(e,n))||e.push(n);return e},Jy=(e,t)=>e.reduce((e,n)=>{let r=n[t];return e[r]=Wy(e[r],n),e},{}),Yy=(e,t,n)=>e.length===t.length&&e.every(n?.isEqual?(e,r)=>n.isEqual(e,t[r]):(e,n)=>e===t[n]),Xy=(e,t)=>Zy(e)===t,Zy=e=>{let t=typeof e;return t===`object`?e===null?`null`:`object`:t===`function`?`object`:t},Qy={boolean:`boolean`,null:`null`,undefined:`undefined`,bigint:`a bigint`,number:`a number`,object:`an object`,string:`a string`,symbol:`a symbol`},$y={...Qy,function:`a function`},eb=class extends Error{},tb=e=>nb(e,eb),nb=(e,t=Error)=>{throw new t(e)},rb=class extends Error{name=`ParseError`},q=e=>nb(e,rb),ib=e=>` ${e}`,ab=(e,t)=>{let n={},r=Array.isArray(e),i=!1;for(let[a,o]of Object.entries(e).entries()){let e=r?t(a,o[1]):t(...o,a);i||=typeof e[0]==`number`;let s=Array.isArray(e[0])||e.length===0?e:[e];for(let[e,t]of s)typeof e==`object`?n[e.group]=Wy(n[e.group],t):n[e]=t}return i?Object.values(n):n},ob=Object.entries,sb=(e,t)=>e in t,cb=(e,t)=>t in e,lb=class{constructor(e){Object.assign(this,e)}},ub=class{},db=class extends ub{},fb=(e,t)=>{let n={},r={},i;for(i in e)i in t?n[i]=e[i]:r[i]=e[i];return[n,r]},pb=(e,t)=>fb(e,t)[1],mb=e=>Object.keys(e).length===0,hb=e=>[...Object.entries(e),...Object.getOwnPropertySymbols(e).map(t=>[t,e[t]])],gb=(e,t)=>Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),_b=e=>{let t=Object.keys(e).sort(),n={};for(let r=0;r<t.length;r++)n[t[r]]=e[t[r]];return n},vb=ib(`unset`),yb=e=>Object.values(e).filter(t=>typeof t==`number`||typeof e[t]!=`number`),bb={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},xb=globalThis.File??Blob,Sb={ArrayBuffer,Blob,File:xb,FormData,Headers,Request,Response,URL},Cb={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},wb={...bb,...Sb,...Cb,String,Number,Boolean},Tb=e=>{let t=Object.getPrototypeOf(e);for(;t?.constructor&&(!sb(t.constructor.name,wb)||!(e instanceof wb[t.constructor.name]));)t=Object.getPrototypeOf(t);let n=t?.constructor?.name;if(n!==void 0&&n!==`Object`)return n},Eb=e=>typeof e==`object`&&e?Tb(e)??`object`:Zy(e),Db=Array.isArray,Ob={Array:`an array`,Function:`a function`,Date:`a Date`,RegExp:`a RegExp`,Error:`an Error`,Map:`a Map`,Set:`a Set`,String:`a String object`,Number:`a Number object`,Boolean:`a Boolean object`,Promise:`a Promise`,WeakMap:`a WeakMap`,WeakSet:`a WeakSet`},kb={ArrayBuffer:`an ArrayBuffer instance`,Blob:`a Blob instance`,File:`a File instance`,FormData:`a FormData instance`,Headers:`a Headers instance`,Request:`a Request instance`,Response:`a Response instance`,URL:`a URL instance`},Ab={Int8Array:`an Int8Array`,Uint8Array:`a Uint8Array`,Uint8ClampedArray:`a Uint8ClampedArray`,Int16Array:`an Int16Array`,Uint16Array:`a Uint16Array`,Int32Array:`an Int32Array`,Uint32Array:`a Uint32Array`,Float32Array:`a Float32Array`,Float64Array:`a Float64Array`,BigInt64Array:`a BigInt64Array`,BigUint64Array:`a BigUint64Array`},jb={...Ob,...kb,...Ab},Mb=e=>{let t=Object(e).name??null;return t&&sb(t,wb)&&wb[t]===e?t:null},Nb=(e,t)=>{let n=e.prototype;for(;n!==null;){if(n===t.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},Pb=e=>Fb(e,new Map),Fb=(e,t)=>{if(typeof e!=`object`||!e)return e;if(t?.has(e))return t.get(e);let n=Mb(e.constructor);if(n===`Date`)return new Date(e.getTime());if(n&&n!==`Array`)return e;let r=Array.isArray(e)?e.slice():Object.create(Object.getPrototypeOf(e)),i=Object.getOwnPropertyDescriptors(e);if(t){t.set(e,r);for(let e in i){let n=i[e];`get`in n||`set`in n||(n.value=Fb(n.value,t))}}return Object.defineProperties(r,i),r},Ib=e=>{let t=vb;return()=>t===vb?t=e():t},Lb=e=>typeof e==`function`&&e.length===0,Rb=class extends Function{constructor(...e){let t=e.slice(0,-1),n=e[e.length-1];try{super(...t,n)}catch(t){return tb(`Encountered an unexpected error while compiling your definition:
|
|
7
|
-
Message: ${t}
|
|
8
|
-
Source: (${e.slice(0,-1)}) => {
|
|
9
|
-
${e[e.length-1]}
|
|
10
|
-
}`)}}},zb=class{constructor(e,...[t]){return Object.assign(Object.setPrototypeOf(e.bind(t?.bind??this),this.constructor.prototype),t?.attach)}},Bb=Ib(()=>{try{return Function(`return false`)()}catch{return!0}});ib(`brand`),ib(`arkInferred`),ib(`args`);var Vb=class{constructor(){}},Hb={fileName:()=>{try{return((Error().stack?.split(`
|
|
11
|
-
`)[2]?.trim()||``).match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||`unknown`).replace(/^file:\/\//,``)}catch{return`unknown`}},env:{}},Ub=e=>e[0].toUpperCase()+e.slice(1),Wb=e=>e[0].toLowerCase()+e.slice(1),Gb=e=>new RegExp(Kb(e),typeof e==`string`?``:e.flags),Kb=e=>`^(?:${typeof e==`string`?e:e.source})$`,qb={negativeLookahead:e=>`(?!${e})`,nonCapturingGroup:e=>`(?:${e})`},Jb={" ":1,"\n":1," ":1},Yb=`^-0\\.?0*$`,Xb=`[1-9]\\d*`,Zb=`\\.\\d+`,Qb=`\\.\\d*[1-9]`,$b=e=>Gb(qb.negativeLookahead(Yb)+qb.nonCapturingGroup(`-?`+qb.nonCapturingGroup(qb.nonCapturingGroup(`0|`+Xb)+qb.nonCapturingGroup(e.decimalPattern)+`?`)+(e.allowDecimalOnly?`|`+e.decimalPattern:``)+`?`)),ex=$b({decimalPattern:Qb,allowDecimalOnly:!1}),tx=ex.test.bind(ex),nx=$b({decimalPattern:Zb,allowDecimalOnly:!0});nx.test.bind(nx);var rx=/^-?\d*\.?\d*$/,ix=e=>e.length!==0&&rx.test(e),ax=Gb(qb.negativeLookahead(`^-0$`)+`-?`+qb.nonCapturingGroup(qb.nonCapturingGroup(`0|`+Xb))),ox=ax.test.bind(ax),sx=/^-?\d+$/,cx=sx.test.bind(sx),lx={number:`a number`,bigint:`a bigint`,integer:`an integer`},ux=(e,t)=>`'${e}' was parsed as ${lx[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,dx=(e,t)=>t===`number`?tx(e):ox(e),fx=(e,t)=>t===`number`?Number(e):Number.parseInt(e),px=(e,t)=>t===`number`?ix(e):cx(e),mx=(e,t)=>_x(e,`number`,t),hx=(e,t)=>_x(e,`number`,{...t,strict:!0}),gx=(e,t)=>_x(e,`integer`,t),_x=(e,t,n)=>{let r=fx(e,t);return!Number.isNaN(r)&&px(e,t)?n?.strict?dx(e,t)?r:q(ux(e,t)):r:n?.errorOnFail?q(n?.errorOnFail===!0?`Failed to parse ${lx[t]} from '${e}'`:n?.errorOnFail):void 0},vx=e=>{if(e[e.length-1]!==`n`)return;let t=e.slice(0,-1),n;try{n=BigInt(t)}catch{return}if(ax.test(t))return n;if(sx.test(t))return q(ux(e,`bigint`))},yx={version:`0.56.2`,filename:Hb.fileName(),FileConstructor:xb},bx=new Map,xx=Object.create(null),Sx=e=>{let t=bx.get(e);if(t)return t;let n=wx(e);return xx[n]?n=`${n}${xx[n]++}`:xx[n]=1,yx[n]=e,bx.set(e,n),n},Cx=e=>/^[$A-Z_a-z][\w$]*$/.test(e),wx=e=>{switch(typeof e){case`object`:{if(e===null)break;let t=Tb(e)??`object`;return t[0].toLowerCase()+t.slice(1)}case`function`:return Cx(e.name)?e.name:`fn`;case`symbol`:return e.description&&Cx(e.description)?e.description:`symbol`}return tb(`Unexpected attempt to register serializable value of type ${Zy(e)}`)},Tx=e=>typeof e==`string`?JSON.stringify(e):typeof e==`bigint`?`${e}n`:`${e}`,Ex=(e,t={})=>Ax(e,{onUndefined:`$ark.undefined`,onBigInt:e=>`$ark.bigint-${e}`,...t},[]),Dx=(e,t)=>{switch(Zy(e)){case`object`:let n=e,r=n.constructor?.name??`Object`;return r===`Object`||r===`Array`?t?.quoteKeys===!1?Ox(n,t?.indent??0,``):JSON.stringify(Ax(n,kx,[]),null,t?.indent):Ox(n,t?.indent??0,``);case`symbol`:return kx.onSymbol(e);default:return Tx(e)}},Ox=(e,t,n)=>{if(typeof e==`function`)return kx.onFunction(e);if(typeof e!=`object`||!e)return Tx(e);let r=n+` `.repeat(t);if(Array.isArray(e)){if(e.length===0)return`[]`;let i=e.map(e=>Ox(e,t,r)).join(`,
|
|
12
|
-
`+r);return t?`[\n${r}${i}\n${n}]`:`[${i}]`}let i=e.constructor?.name??`Object`;if(i===`Object`){let i=hb(e).map(([e,n])=>{let i=typeof e==`symbol`?kx.onSymbol(e):Cx(e)?e:JSON.stringify(e),a=Ox(n,t,r);return`${r}${i}: ${a}`});return i.length===0?`{}`:t?`{\n${i.join(`,
|
|
13
|
-
`)}\n${n}}`:`{${i.join(`, `)}}`}return e instanceof Date?jx(e):`expression`in e&&typeof e.expression==`string`?e.expression:i},kx={onCycle:()=>`(cycle)`,onSymbol:e=>`Symbol(${Sx(e)})`,onFunction:e=>`Function(${Sx(e)})`},Ax=(e,t,n)=>{switch(Zy(e)){case`object`:{let r=e;if(`toJSON`in r&&typeof r.toJSON==`function`)return r.toJSON();if(typeof r==`function`)return kx.onFunction(r);if(n.includes(r))return`(cycle)`;let i=[...n,r];if(Array.isArray(r))return r.map(e=>Ax(e,t,i));if(r instanceof Date)return r.toDateString();let a={};for(let e in r)a[e]=Ax(r[e],t,i);for(let e of Object.getOwnPropertySymbols(r))a[t.onSymbol?.(e)??e.toString()]=Ax(r[e],t,i);return a}case`symbol`:return kx.onSymbol(e);case`bigint`:return t.onBigInt?.(e)??`${e}n`;case`undefined`:return t.onUndefined??`undefined`;case`string`:return e.replace(/\\/g,`\\\\`);default:return e}},jx=e=>{let t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=e.getHours(),a=e.getMinutes(),o=e.getSeconds(),s=e.getMilliseconds();if(n===0&&r===1&&i===0&&a===0&&o===0&&s===0)return`${t}`;let c=`${Mx[n]} ${r}, ${t}`;if(i===0&&a===0&&o===0&&s===0)return c;let l=e.toLocaleTimeString(),u=l.endsWith(` AM`)||l.endsWith(` PM`)?l.slice(-3):``;return u&&(l=l.slice(0,-u.length)),s?l+=`.${Px(s,3)}`:Nx.test(l)&&(l=l.slice(0,-3)),`${l+u}, ${c}`},Mx=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Nx=/:\d\d:00$/,Px=(e,t)=>String(e).padStart(t,`0`),Fx=(e,t,...[n])=>{let r=n?.stringifySymbol??Dx,i=e;switch(typeof t){case`string`:i=Cx(t)?e===``?t:`${e}.${t}`:`${e}[${JSON.stringify(t)}]`;break;case`number`:i=`${e}[${t}]`;break;case`symbol`:i=`${e}[${r(t)}]`;break;default:n?.stringifyNonKey?i=`${e}[${n.stringifyNonKey(t)}]`:q(`${Dx(t)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return i},Ix=(e,...t)=>e.reduce((e,n)=>Fx(e,n,...t),``),Lx=class extends Vy{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]==`symbol`?Dx(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Ix(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e=``,t=[e];for(let n of this)e=Fx(e,n),t.push(e);return this.cache.stringifyAncestors=t}},Rx=class{chars;i;def;constructor(e){this.def=e,this.chars=[...e],this.i=0}shift(){return this.chars[this.i++]??``}get lookahead(){return this.chars[this.i]??``}get nextLookahead(){return this.chars[this.i+1]??``}get length(){return this.chars.length}shiftUntil(e){let t=``;for(;this.lookahead&&!e(this,t);)t+=this.shift();return t}shiftUntilEscapable(e){let t=``;for(;this.lookahead;)if(this.lookahead===`\\`)this.shift(),e(this,t)||this.lookahead===`\\`?t+=this.shift():t+=`\\${this.shift()}`;else if(e(this,t))break;else t+=this.shift();return t}shiftUntilLookahead(e){return typeof e==`string`?this.shiftUntil(t=>t.lookahead===e):this.shiftUntil(t=>t.lookahead in e)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in Jb))}jumpToIndex(e){this.i=e<0?this.length+e:e}jumpForward(e){this.i+=e}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join(``)}get scanned(){return this.chars.slice(0,this.i).join(``)}sliceChars(e,t){return this.chars.slice(e,t).join(``)}lookaheadIs(e){return this.lookahead===e}lookaheadIsIn(e){return this.lookahead in e}},zx=(e,t)=>`Unmatched ${e}${t===``?``:` before ${t}`}`,Bx=e=>`Missing ${e}`;ib(`implementedTraits`);for(var Vx=`$ark`,Hx=2;Vx in globalThis;)Vx=`$ark${Hx++}`;var Ux=Vx;globalThis[Ux]=yx;var J=yx,Wx=e=>`${Ux}.${e}`,Gx=e=>Wx(Sx(e)),Kx=class extends db{argNames;body=``;constructor(...e){super(),this.argNames=e;for(let t of e){if(t in this)throw Error(`Arg name '${t}' would overwrite an existing property on FunctionBody`);this[t]=t}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(e,t=!1){return Jx(e,t)}index(e,t=!1){return Xx(`${e}`,t)}line(e){return this.body+=`${` `.repeat(this.indentation)}${e}\n`,this}const(e,t){return this.line(`const ${e} = ${t}`),this}let(e,t){return this.line(`let ${e} = ${t}`)}set(e,t){return this.line(`${e} = ${t}`)}if(e,t){return this.block(`if (${e})`,t)}elseIf(e,t){return this.block(`else if (${e})`,t)}else(e){return this.block(`else`,e)}for(e,t,n=0){return this.block(`for (let i = ${n}; ${e}; i++)`,t)}forIn(e,t){return this.block(`for (const k in ${e})`,t)}block(e,t,n=``){return this.line(`${e} {`),this.indent(),t(this),this.dedent(),this.line(`}${n}`)}return(e=``){return this.line(`return ${e}`)}write(e=`anonymous`,t=0){return`${e}(${this.argNames.join(`, `)}) { ${t?this.body.split(`
|
|
14
|
-
`).map(e=>` `.repeat(t)+`${e}`).join(`
|
|
15
|
-
`):this.body} }`}compile(){return new Rb(...this.argNames,this.body)}},qx=e=>Xy(e,`object`)||typeof e==`symbol`?Gx(e):Tx(e),Jx=(e,t=!1)=>typeof e==`string`&&Cx(e)?`${t?`?`:``}.${e}`:Xx(Yx(e),t),Yx=e=>typeof e==`symbol`?Gx(e):JSON.stringify(e),Xx=(e,t=!1)=>`${t?`?.`:``}[${e}]`,Zx=class extends Kx{traversalKind;optimistic;constructor(e){super(`data`,`ctx`),this.traversalKind=e.kind,this.optimistic=e.optimistic===!0}invoke(e,t){let n=t?.arg??this.data,r=typeof e==`string`||this.requiresContextFor(e),i=typeof e==`string`?e:e.id;return r?`${this.referenceToId(i,t)}(${n}, ${this.ctx})`:`${this.referenceToId(i,t)}(${n})`}referenceToId(e,t){let n=`this.${e}${t?.kind??this.traversalKind}`;return t?.bind?`${n}.bind(${t?.bind})`:n}requiresContextFor(e){return this.traversalKind===`Apply`||e.allowsRequiresContext}initializeErrorCount(){return this.const(`errorCount`,`ctx.currentErrorCount`)}returnIfFail(){return this.if(`ctx.currentErrorCount > errorCount`,()=>this.return())}returnIfFailFast(){return this.if(`ctx.failFast && ctx.currentErrorCount > errorCount`,()=>this.return())}traverseKey(e,t,n){let r=this.requiresContextFor(n);return r&&this.line(`${this.ctx}.path.push(${e})`),this.check(n,{arg:t}),r&&this.line(`${this.ctx}.path.pop()`),this}check(e,t){return this.traversalKind===`Allows`?this.if(`!${this.invoke(e,t)}`,()=>this.return(!1)):this.line(this.invoke(e,t))}},Qx=e=>ab(e,(e,t)=>[e,Db(t)?[...t]:t]),$x=ib(`arkKind`),eS=(e,t)=>e?.[$x]===t,tS=e=>eS(e,`root`)||eS(e,`constraint`),nS=[`unit`,`proto`,`domain`],rS=[`required`,`optional`,`index`,`sequence`],iS=[`pattern`,`divisor`,`exactLength`,`max`,`min`,`maxLength`,`minLength`,`before`,`after`],aS=[...iS,`structure`,`predicate`],oS=[...aS,...rS],sS=[`alias`,`union`,`morph`,`unit`,`intersection`,`proto`,`domain`],cS=[...sS,...oS],lS=ab(oS,(e,t)=>[t,1]),uS=ab([...rS,`undeclared`],(e,t)=>[t,1]),dS=ab(cS,(e,t)=>[t,e]),fS=e=>typeof e==`string`&&e in dS,pS=e=>dS[e],mS=e=>sS.slice(pS(e)+1);[...mS(`union`)],[...mS(`morph`)];var hS=e=>typeof e==`string`||typeof e==`boolean`||e===null?e:typeof e==`number`?Number.isNaN(e)?`NaN`:e===1/0?`Infinity`:e===-1/0?`-Infinity`:e:qx(e),gS=e=>{let t=`{ `;for(let[n,r]of Object.entries(e))t+=`${n}: ${qx(r)}, `;return t+` }`},_S=e=>{let t=e;return t.hasAssociatedError&&(t.defaults.expected??=e=>`description`in e?e.description:t.defaults.description(e),t.defaults.actual??=e=>Dx(e),t.defaults.problem??=e=>`must be ${e.expected}${e.actual?` (was ${e.actual})`:``}`,t.defaults.message??=e=>{if(e.path.length===0)return e.problem;let t=`${e.propString} ${e.problem}`;return t[0]===`[`?`value at ${t}`:t}),t},vS={Error:class extends Error{name=`ToJsonSchemaError`;code;context;constructor(e,t){super(Dx(t,{quoteKeys:!1,indent:4})),this.code=e,this.context=t}hasCode(e){return this.code===e}},throw:(...e)=>{throw new vS.Error(...e)},throwInternalOperandError:(e,t)=>tb(`Unexpected JSON Schema input for ${e}: ${Dx(t)}`),defaultConfig:{target:`draft-2020-12`,dialect:`https://json-schema.org/draft/2020-12/schema`,useRefs:!1,fallback:{arrayObject:e=>vS.throw(`arrayObject`,e),arrayPostfix:e=>vS.throw(`arrayPostfix`,e),defaultValue:e=>vS.throw(`defaultValue`,e),domain:e=>vS.throw(`domain`,e),morph:e=>vS.throw(`morph`,e),patternIntersection:e=>vS.throw(`patternIntersection`,e),predicate:e=>vS.throw(`predicate`,e),proto:e=>vS.throw(`proto`,e),symbolKey:e=>vS.throw(`symbolKey`,e),unit:e=>vS.throw(`unit`,e),date:e=>vS.throw(`date`,e)}}};J.config??={};var yS=(e,t)=>{if(!t)return e;let n={...e},r;for(r in t){let i={...e.keywords};if(r===`keywords`){for(let e in t[r]){let n=t.keywords[e];n!==void 0&&(i[e]=typeof n==`string`?{description:n}:n)}n.keywords=i}else r===`toJsonSchema`?n[r]=xS(e.toJsonSchema,t.toJsonSchema):fS(r)?n[r]={...e[r],...t[r]}:n[r]=t[r]}return n},bS={"draft-2020-12":`https://json-schema.org/draft/2020-12/schema`,"draft-07":`http://json-schema.org/draft-07/schema#`},xS=((e,t)=>{if(!e)return SS(t??{},void 0);if(!t)return e;let n={...e},r;for(r in t)r===`fallback`?n.fallback=CS(e.fallback,t.fallback):n[r]=t[r];return SS(n,t)}),SS=(e,t)=>t?.dialect===void 0?t?.target===void 0?e:{...e,dialect:bS[t.target]}:e,CS=(e,t)=>{e=wS(e),t=wS(t);let n={},r;for(r in vS.defaultConfig.fallback)n[r]=t[r]??t.default??e[r]??e.default??vS.defaultConfig.fallback[r];return n},wS=e=>typeof e==`function`?{default:e}:e??{},TS=class e extends db{[$x]=`error`;path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:t,...n},r){super(),this.input=n,this.ctx=r,gb(this,n);let i=r.data;n.code===`union`&&(n.errors=n.errors.flatMap(n=>{let r=n.hasCode(`union`)?n.errors:[n];return!e&&!t?r:r.map(n=>n.transform(n=>({...n,path:Ky(e,n.path,t)})))})),this.nodeConfig=r.config[this.code];let a=[...n.path??r.path];t&&a.push(...t),e&&a.unshift(...e),this.path=new Lx(...a),this.data=`data`in n?n.data:i}transform(t){return new e(t({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return Ix(this.path)}get expected(){if(this.input.expected)return this.input.expected;let e=this.meta?.expected??this.nodeConfig.expected;return typeof e==`function`?e(this.input):e}get actual(){if(this.input.actual)return this.input.actual;let e=this.meta?.actual??this.nodeConfig.actual;return typeof e==`function`?e(this.data):e}get problem(){if(this.input.problem)return this.input.problem;let e=this.meta?.problem??this.nodeConfig.problem;return typeof e==`function`?e(this):e}get message(){if(this.input.message)return this.input.message;let e=this.meta?.message??this.nodeConfig.message;return typeof e==`function`?e(this):e}get flat(){return this.hasCode(`intersection`)?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}},ES=class e extends Vy{[$x]=`errors`;static get[Symbol.species](){return Array}ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return ab(this.byPath,(e,t)=>[e,t.flat])}get flatProblemsByPath(){return ab(this.byPath,(e,t)=>[e,t.flat.map(e=>e.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new DS(this)}add(e){let t=this.byPath[e.propString];if(t){if(e===t||t.hasCode(`union`)&&t.errors.length===0)return;let n=e.hasCode(`union`)&&e.errors.length===0?e:new TS({code:`intersection`,errors:t.hasCode(`intersection`)?[...t.errors,e]:[t,e]},this.ctx),r=this.indexOf(t);this.mutable[r===-1?this.length:r]=n,this.byPath[e.propString]=n,this.addAncestorPaths(e)}else this.byPath[e.propString]=e,this.addAncestorPaths(e),this.mutable.push(e);this.count++}transform(t){let n=new e(this.ctx);for(let e of this)n.add(t(e));return n}merge(e){for(let t of e)this.add(new TS({...t,path:[...this.ctx.path,...t.path]},this.ctx))}affectsPath(e){return this.length===0?!1:e.stringifyAncestors().some(e=>e in this.byPath)||e.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(e=>e.toJSON())]}toString(){return this.join(`
|
|
16
|
-
`)}addAncestorPaths(e){for(let t of e.path.stringifyAncestors())this.byAncestorPath[t]=Wy(this.byAncestorPath[t],e)}},DS=class extends Error{name=`TraversalError`;constructor(e){e.length===1?super(e.summary):super(`
|
|
17
|
-
`+e.map(e=>` • ${OS(e)}`).join(`
|
|
18
|
-
`)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}},OS=e=>e.toString().split(`
|
|
19
|
-
`).join(`
|
|
20
|
-
`),kS=class{path=[];errors=new ES(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(e,t){this.root=e,this.config=t}get data(){let e=this.root;for(let t of this.path)e=e?.[t];return e}get propString(){return Ix(this.path)}reject(e){return this.error(e),!1}mustBe(e){return this.error(e),!1}error(e){let t=typeof e==`object`?e.code?e:{...e,code:`predicate`}:{code:`predicate`,expected:e};return this.errorFromContext(t)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches[this.branches.length-1]}queueMorphs(e){let t={path:new Lx(...this.path),morphs:e};this.currentBranch?this.currentBranch.queuedMorphs.push(t):this.queuedMorphs.push(t)}finalize(e){return this.queuedMorphs.length&&(typeof this.root==`object`&&this.root!==null&&this.config.clone&&(this.root=this.config.clone(this.root)),this.applyQueuedMorphs()),this.hasError()?e?e(this.errors):this.errors:this.root}get currentErrorCount(){return this.currentBranch?+!!this.currentBranch.error:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(e){return this.errorFromContext(e)}errorFromContext(e){let t=new TS(e,this);return this.currentBranch?this.currentBranch.error=t:this.errors.add(t),t}applyQueuedMorphs(){for(;this.queuedMorphs.length;){let e=this.queuedMorphs;this.queuedMorphs=[];for(let{path:t,morphs:n}of e)this.errors.affectsPath(t)||this.applyMorphsAtPath(t,n)}}applyMorphsAtPath(e,t){let n=e[e.length-1],r;if(n!==void 0){r=this.root;for(let t=0;t<e.length-1;t++)r=r[e[t]]}for(let i of t){this.path=[...e];let t=tS(i),a=i(r===void 0?this.root:r[n],this);if(a instanceof TS){this.errors.add(a);break}if(a instanceof ES){t||this.errors.merge(a),this.queuedMorphs=[];break}r===void 0?this.root=a:r[n]=a,this.applyQueuedMorphs()}}},AS=(e,t,n)=>{if(!n)return t();n.path.push(e);let r=t();return n.path.pop(),r},jS=class extends zb{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,t){super((e,t,n=this.onFail)=>t?(this.traverseApply(e,t),t.hasError()?t.errors:t.data):this.rootApply(e,n),{attach:e}),this.attachments=e,this.$=t,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind(`morph`)||this.hasKind(`structure`)&&this.structuralMorph!==void 0||this.hasKind(`sequence`)&&this.inner.defaultables!==void 0,this.includesContextualPredicate=this.hasKind(`predicate`)&&this.inner.predicate.length!==1,this.isCyclic=this.kind===`alias`,this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind(`structure`)?[this,...this.children]:this.children.reduce((e,t)=>BS(e,t.shallowReferences),[this]);let n=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let e=0;e<this.children.length;e++){if(this.includesTransform||=this.children[e].includesTransform,this.includesContextualPredicate||=this.children[e].includesContextualPredicate,this.isCyclic||=this.children[e].isCyclic,!n){let t=this.children[e].flatRefs;for(let e=0;e<t.length;e++){let n=t[e];if(!this.flatRefs.some(e=>RS(e,n))){this.flatRefs.push(n);for(let e of n.node.branches)(e.hasKind(`morph`)||e.hasKind(`intersection`)&&e.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:n.path,propString:n.propString,node:e})}}}Object.assign(this.referencesById,this.children[e].referencesById)}this.flatRefs.sort((e,t)=>e.path.length>t.path.length?1:e.path.length<t.path.length?-1:e.propString>t.propString?1:e.propString<t.propString||e.node.expression<t.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?`allows`:this.shallowMorphs.every(e=>e.length===1||e.name===`$arkStructuralMorph`)?this.hasKind(`union`)?this.branches.some(e=>e.shallowMorphs.length>1)?`contextual`:`branchedOptimistic`:this.shallowMorphs.length>1?`contextual`:`optimistic`:`contextual`:`contextual`,this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?e=>this.traverseAllows(e,new kS(e,this.$.resolvedConfig)):e=>this.traverseAllows(e)}createRootApply(){switch(this.rootApplyStrategy){case`allows`:return(e,t)=>{if(this.allows(e))return e;let n=new kS(e,this.$.resolvedConfig);return this.traverseApply(e,n),n.finalize(t)};case`contextual`:return(e,t)=>{let n=new kS(e,this.$.resolvedConfig);return this.traverseApply(e,n),n.finalize(t)};case`optimistic`:this.contextFreeMorph=this.shallowMorphs[0];let e=this.$.resolvedConfig.clone;return(t,n)=>{if(this.allows(t))return this.contextFreeMorph(e&&(typeof t==`object`&&t||typeof t==`function`)?e(t):t);let r=new kS(t,this.$.resolvedConfig);return this.traverseApply(t,r),r.finalize(n)};case`branchedOptimistic`:return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,tb(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=IS(this.metaJson);cacheGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}get description(){return this.cacheGetter(`description`,this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=pS(this.kind);precompilation;assert=(e,t)=>this(e,t,e=>e.throw());traverse(e,t){return this(e,t,null)}get in(){return this.cacheGetter(`in`,this.rawIn.isRoot()?this.$.finalize(this.rawIn):this.rawIn)}get rawIn(){return this.cacheGetter(`rawIn`,this.getIo(`in`))}get out(){return this.cacheGetter(`out`,this.rawOut.isRoot()?this.$.finalize(this.rawOut):this.rawOut)}get rawOut(){return this.cacheGetter(`rawOut`,this.getIo(`out`))}getIo(e){if(!this.includesTransform)return this;let t={};for(let[n,r]of this.innerEntries){let i=this.impl.keys[n];if(i.reduceIo)i.reduceIo(e,t,r);else if(i.child){let i=r;t[n]=Db(i)?i.map(t=>e===`in`?t.rawIn:t.rawOut):e===`in`?i.rawIn:i.rawOut}else t[n]=r}return this.$.node(this.kind,t)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(e){let t=tS(e)?e:this.$.parseDefinition(e);return this.innerHash===t.innerHash}ifEquals(e){return this.equals(e)?this:void 0}hasKind(e){return this.kind===e}assertHasKind(e){return this.kind!==e&&nb(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return Hy(e,this.kind)||nb(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return Hy(nS,this.kind)}isConstraint(){return Hy(oS,this.kind)}isStructural(){return Hy(rS,this.kind)}isRefinement(){return Hy(aS,this.kind)}isRoot(){return Hy(sS,this.kind)}isUnknown(){return this.hasKind(`intersection`)&&this.children.length===0}isNever(){return this.hasKind(`union`)&&this.children.length===0}hasUnit(e){return this.hasKind(`unit`)&&this.allows(e)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(e){let t=MS.normalize(e);return this._select(t)}_select(e){let t=MS.applyBoundary[e.boundary??`references`](this);return e.kind&&(t=t.filter(t=>t.kind===e.kind)),e.where&&(t=t.filter(e.where)),MS.applyMethod[e.method??`filter`](t,this,e)}transform(e,t){return this._transform(e,this._createTransformContext(t))}_createTransformContext(e){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:e?.prereduced??!1},undeclaredKeyHandling:void 0,...e}}_transform(e,t){let n=t.bindScope??this.$;if(t.seen[this.id])return this.$.lazilyResolve(t.seen[this.id]);if(t.shouldTransform?.(this,t)===!1)return this;let r;t.seen[this.id]=()=>r,this.hasKind(`structure`)&&this.undeclared!==t.undeclaredKeyHandling&&(t={...t,undeclaredKeyHandling:this.undeclared});let i=ab(this.inner,(n,r)=>{if(!this.impl.keys[n].child)return[n,r];let i=r;if(!Db(i)){let r=i._transform(e,t);return r?[n,r]:[]}if(i.length===0)return[n,r];let a=i.flatMap(n=>n._transform(e,t)??[]);return a.length?[n,a]:[]});delete t.seen[this.id];let a=Object.assign(i,{meta:this.meta}),o=t.selected&&!t.selected.includes(this)?a:e(this.kind,a,t);if(o===null)return null;if(tS(o))return r=o;let s=Object.keys(o);return(s.length===0||s.length===1&&s[0]===`meta`)&&!mb(this.inner)?null:(this.kind===`required`||this.kind===`optional`||this.kind===`index`)&&!(`value`in o)?t.undeclaredKeyHandling?{...o,value:J.intrinsic.unknown}:null:(this.kind===`morph`&&(o.in??=J.intrinsic.unknown),r=n.node(this.kind,o,t.parseOptions))}configureReferences(e,t=`references`){let n=MS.normalize(t),r=typeof e==`string`?(t,n)=>({...n,meta:{...n.meta,description:e}}):typeof e==`function`?(t,n)=>({...n,meta:e(n.meta)}):(t,n)=>({...n,meta:{...n.meta,...e}});if(n.boundary===`self`)return this.$.node(this.kind,r(this.kind,{...this.inner,meta:this.meta}));let i=this._select(n),a=i&&zy(i),o=n.boundary===`child`?(e,t)=>t.root.children.includes(e):n.boundary===`shallow`?e=>e.kind!==`structure`:()=>!0;return this.$.finalize(this.transform(r,{shouldTransform:o,selected:a}))}},MS={applyBoundary:{self:e=>[e],child:e=>[...e.children],shallow:e=>[...e.shallowReferences],references:e=>[...e.references]},applyMethod:{filter:e=>e,assertFilter:(e,t,n)=>(e.length===0&&nb(NS(t,n)),e),find:e=>e[0],assertFind:(e,t,n)=>(e.length===0&&nb(NS(t,n)),e[0])},normalize:e=>typeof e==`function`?{boundary:`references`,method:`filter`,where:e}:typeof e==`string`?sb(e,MS.applyBoundary)?{method:`filter`,boundary:e}:{boundary:`references`,method:`filter`,kind:e}:{boundary:`references`,method:`filter`,...e}},NS=(e,t)=>`${e} had no references matching ${Dx(t)}.`,PS=e=>Ix(e,{stringifyNonKey:e=>e.expression}),FS=/"(\$ark\.[^"]+)"/g,IS=e=>JSON.stringify(e).replace(FS,`$1`),LS=(e,t)=>({path:e,node:t,propString:PS(e)}),RS=(e,t)=>e.propString===t.propString&&e.node.equals(t.node),zS=(e,t)=>qy(e,t,{isEqual:RS}),BS=(e,t)=>qy(e,t,{isEqual:(e,t)=>e.equals(t)}),VS=class e extends Array{static init(t,n,r,i){return new e({kind:t,l:n,r,path:i?.path??[],optional:i?.optional??!1})}add(e,t,n,r){return this.push({kind:e,l:t,r:n,path:r?.path??[],optional:r?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:e,l:t,r:n}=this[0],r=Ix(e);return WS(`Intersection${r&&` at ${r}`} of ${HS(t,n)}`)}return`The following intersections result in unsatisfiable types:\n• ${this.map(({path:e,l:t,r:n})=>`${e}: ${HS(t,n)}`).join(`
|
|
21
|
-
• `)}`}throw(){return q(this.describeReasons())}invert(){let t=this.map(e=>({...e,l:e.r,r:e.l}));return t instanceof e?t:new e(...t)}withPrefixKey(e,t){return this.map(n=>({...n,path:[e,...n.path],optional:n.optional||t===`optional`}))}toNeverIfDisjoint(){return J.intrinsic.never}},HS=(e,t)=>`${US(e)} and ${US(t)}`,US=e=>tS(e)?e.expression:Db(e)?e.map(US).join(` | `)||`never`:String(e),WS=e=>`${e} results in an unsatisfiable type`,GS={},KS=(e,t,n)=>JS(e,t,{$:n,invert:!1,pipe:!1}),qS=(e,t,n)=>JS(e,t,{$:n,invert:!1,pipe:!0}),JS=((e,t,n)=>{let r=n.pipe?`|>`:`&`,i=`${e.hash}${r}${t.hash}`;if(GS[i]!==void 0)return GS[i];if(!n.pipe){let n=`${t.hash}${r}${e.hash}`;if(GS[n]!==void 0){let e=GS[n],t=e instanceof VS?e.invert():e;return GS[i]=t,t}}let a=!n.pipe||!e.includesTransform&&!t.includesTransform;if(a&&e.equals(t))return e;let o=a?YS(e,t,n):e.hasKindIn(...sS)?XS(e,t,n):YS(e,t,n);return tS(o)&&(e.equals(o)?o=e:t.equals(o)&&(o=t)),GS[i]=o,o}),YS=(e,t,n)=>{let r=e.precedence<t.precedence?e.kind:t.kind,i=e.impl.intersections[t.kind]??t.impl.intersections[e.kind];if(i===void 0)return null;if(r===e.kind)return i(e,t,n);{let r=i(t,e,{...n,invert:!n.invert});return r instanceof VS&&(r=r.invert()),r}},XS=(e,t,n)=>e.includesTransform||t.includesTransform?n.invert?ZS(t,e,n):ZS(e,t,n):YS(e,t,n),ZS=(e,t,n)=>e.distribute(e=>QS(e,t,n),r=>{let i=r.filter(tS);if(i.length===0)return VS.init(`union`,e.branches,t.branches);if(i.length<e.branches.length||!e.branches.every((e,t)=>e.rawIn.equals(i[t].rawIn)))return n.$.parseSchema(i);if(i.length===1)return i[0];let a={branches:i};return n.$.parseSchema(a)}),QS=(e,t,n)=>{if(e.hasKind(`morph`)){let r=[...e.morphs];if(e.lastMorphIfNode){let i=JS(e.lastMorphIfNode,t,n);if(i instanceof VS)return i;r[r.length-1]=i}else r.push(t);return n.$.node(`morph`,{morphs:r,in:e.inner.in})}if(t.hasKind(`morph`)){let r=JS(e,t.rawIn,n);return r instanceof VS?r:n.$.node(`morph`,{morphs:[t],in:r})}return n.$.node(`morph`,{morphs:[t],in:e})},$S=class extends jS{constructor(e,t){super(e,t),Object.defineProperty(this,$x,{value:`constraint`,enumerable:!1})}impliedSiblings;intersect(e){return KS(this,e,this.$)}},eC=class extends $S{traverseApply=(e,t)=>{this.traverseAllows(e,t)||t.errorFromNodeContext(this.errorContext)};compile(e){e.traversalKind===`Allows`?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return gS(this.errorContext)}},tC=e=>(t,n)=>{if(Db(t)){if(t.length===0)return;let r=t.map(t=>n.$.node(e,t));return e===`predicate`?r:r.sort((e,t)=>e.hash<t.hash?-1:1)}let r=n.$.node(e,t);if(!r.isRoot())return r.hasOpenIntersection()?[r]:r},nC=e=>{let t=e.r.shift();if(!t){let t=e.l.length===0&&e.kind===`structure`?J.intrinsic.unknown.internal:e.ctx.$.node(e.kind,Object.assign(e.baseInner,iC(e.l)),{prereduced:!0});for(let n of e.roots){if(t instanceof VS)return t;t=JS(n,t,e.ctx)}return t}let n=!1;for(let r=0;r<e.l.length;r++){let i=JS(e.l[r],t,e.ctx);if(i!==null){if(i instanceof VS)return i;if(i.isRoot())return e.roots.push(i),e.l.splice(r),nC(e);if(!n)e.l[r]=i,n=!0;else if(!e.l.includes(i))return tb(`Unexpectedly encountered multiple distinct intersection results for refinement ${t}`)}}if(n||e.l.push(t),e.kind===`intersection`&&t.impliedSiblings)for(let n of t.impliedSiblings)qy(e.r,n);return nC(e)},rC=e=>Object.entries(e).flatMap(([e,t])=>e in lS?t:[]).sort((e,t)=>e.precedence<t.precedence?-1:e.precedence>t.precedence?1:e.kind===`predicate`&&t.kind===`predicate`?0:e.hash<t.hash?-1:1),iC=e=>{let t={};for(let n of e)if(n.hasOpenIntersection())t[n.kind]=Wy(t[n.kind],n);else{if(t[n.kind])return tb(`Unexpected intersection of closed refinements of kind ${n.kind}`);t[n.kind]=n}return t},aC=(...e)=>q(oC(...e)),oC=(e,t,n)=>{let r=n.hasKind(`morph`)?`a morph`:n.isUnknown()?`unknown`:n.exclude(t).defaultShortDescription;return`${Ub(e)} operand must be ${t.description} (was ${r})`},sC=(e,t,n)=>new lC(e,t,n,n,null),cC=class extends zb{},lC=class extends zb{[$x]=`generic`;paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,t,n,r,i){super((...e)=>{let n=ab(this.names,(t,n)=>{let r=this.arg$.parse(e[t]);return r.extends(this.constraints[t])||q(uC(n,this.constraints[t].expression,r.expression)),[n,r]});if(this.defIsLazy()){let e=this.bodyDef(n);return this.$.parse(e)}return this.$.parse(t,{args:n})}),this.paramDefs=e,this.bodyDef=t,this.$=n,this.arg$=r,this.hkt=i,this.description=i?new i().description??`a generic type for ${i.constructor.name}`:`a generic type`,this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof cC}cacheGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}get json(){return this.cacheGetter(`json`,{params:this.params.map(e=>e[1].isUnknown()?e[0]:[e[0],e[1].json]),body:Ex(this.bodyDef)})}get params(){return this.cacheGetter(`params`,this.paramDefs.map(e=>typeof e==`string`?[e,J.intrinsic.unknown]:[e[0],this.$.parse(e[1])]))}get names(){return this.cacheGetter(`names`,this.params.map(e=>e[0]))}get constraints(){return this.cacheGetter(`constraints`,this.params.map(e=>e[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}},uC=(e,t,n)=>`${e} must be assignable to ${t} (was ${n})`,dC={implementation:_S({kind:`predicate`,hasAssociatedError:!0,collapsibleKey:`predicate`,keys:{predicate:{}},normalize:e=>typeof e==`function`?{predicate:e}:e,defaults:{description:e=>`valid according to ${e.predicate.name||`an anonymous predicate`}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}}),Node:class extends $S{serializedPredicate=Gx(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:`predicate`,description:this.description,meta:this.meta};compiledErrorContext=gS(this.errorContext);traverseApply=(e,t)=>{let n=t.currentErrorCount;!this.predicate(e,t.external)&&t.currentErrorCount===n&&t.errorFromNodeContext(this.errorContext)};compile(e){if(e.traversalKind===`Allows`){e.return(this.compiledCondition);return}e.initializeErrorCount(),e.if(`${this.compiledNegation} && ctx.currentErrorCount === errorCount`,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(e,t){return t.fallback.predicate({code:`predicate`,base:e,predicate:this.predicate})}}},fC={implementation:_S({kind:`divisor`,collapsibleKey:`rule`,keys:{rule:{parse:e=>Number.isInteger(e)?e:q(pC(e))}},normalize:e=>typeof e==`number`?{rule:e}:e,hasAssociatedError:!0,defaults:{description:e=>e.rule===1?`an integer`:e.rule===2?`even`:`a multiple of ${e.rule}`},intersections:{divisor:(e,t,n)=>n.$.node(`divisor`,{rule:Math.abs(e.rule*t.rule/mC(e.rule,t.rule))})},obviatesBasisDescription:!0}),Node:class extends eC{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=J.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type=`integer`,this.rule===1||(e.multipleOf=this.rule),e}}},pC=e=>`divisor must be an integer (was ${e})`,mC=(e,t)=>{let n,r=e,i=t;for(;i!==0;)n=i,i=r%i,r=n;return r},hC=class extends eC{boundOperandKind=wC[this.kind];compiledActual=this.boundOperandKind===`value`?`data`:this.boundOperandKind===`length`?`data.length`:`data.valueOf()`;comparator=TC(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${gC[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind===`date`?EC(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator[0]===`<`?`upper`:`lower`;isStricterThan(e){return(this.limitKind===`upper`?this.numericLimit<e.numericLimit:this.numericLimit>e.numericLimit)||this.numericLimit===e.numericLimit&&this.exclusive===!0&&!e.exclusive}overlapsRange(e){return!(this.isStricterThan(e)||this.numericLimit===e.numericLimit&&(this.exclusive||e.exclusive))}overlapIsUnit(e){return this.numericLimit===e.numericLimit&&!this.exclusive&&!e.exclusive}},gC={"<":`>=`,"<=":`>`,">":`<=`,">=":`<`},_C={min:`max`,minLength:`maxLength`,after:`before`},vC={parse:e=>e||void 0},yC=e=>t=>{if(typeof t==`number`)return{rule:t};let{exclusive:n,...r}=t;return n?{...r,rule:e===`minLength`?r.rule+1:r.rule-1}:r},bC=e=>t=>{if(typeof t==`number`||typeof t==`string`||t instanceof Date)return{rule:t};let{exclusive:n,...r}=t;if(!n)return r;let i=typeof r.rule==`number`?r.rule:typeof r.rule==`string`?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:e===`after`?i+1:i-1}:r},xC=e=>typeof e==`string`||typeof e==`number`?new Date(e):e,SC=(e,t)=>`${e} bound must be a positive integer (was ${t})`,CC=e=>t=>((!Number.isInteger(t)||t<0)&&q(SC(e,t)),t),wC={min:`value`,max:`value`,minLength:`length`,maxLength:`length`,after:`date`,before:`date`},TC=(e,t)=>`${sb(e,_C)?`>`:`<`}${t?``:`=`}`,EC=e=>typeof e==`string`?e:new Date(e).toLocaleString(),DC=e=>`Bounded expression ${e} must be exactly one of number, string, Array, or Date`,OC={implementation:_S({kind:`after`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{parse:xC,serialize:e=>e.toISOString()}},normalize:bC(`after`),defaults:{description:e=>`${e.collapsibleLimitString} or later`,actual:jx},intersections:{after:(e,t)=>e.isStricterThan(t)?e:t}}),Node:class extends hC{impliedBasis=J.intrinsic.Date.internal;collapsibleLimitString=jx(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,t){return t.fallback.date({code:`date`,base:e,after:this.rule})}}},kC={implementation:_S({kind:`before`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{parse:xC,serialize:e=>e.toISOString()}},normalize:bC(`before`),defaults:{description:e=>`${e.collapsibleLimitString} or earlier`,actual:jx},intersections:{before:(e,t)=>e.isStricterThan(t)?e:t,after:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node(`unit`,{unit:e.rule}):null:VS.init(`range`,e,t)}}),Node:class extends hC{collapsibleLimitString=jx(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=J.intrinsic.Date.internal;reduceJsonSchema(e,t){return t.fallback.date({code:`date`,base:e,before:this.rule})}}},AC={implementation:_S({kind:`exactLength`,collapsibleKey:`rule`,keys:{rule:{parse:CC(`exactLength`)}},normalize:e=>typeof e==`number`?{rule:e}:e,hasAssociatedError:!0,defaults:{description:e=>`exactly length ${e.rule}`,actual:e=>`${e.length}`},intersections:{exactLength:(e,t,n)=>VS.init(`unit`,n.$.node(`unit`,{unit:e.rule}),n.$.node(`unit`,{unit:t.rule}),{path:[`length`]}),minLength:(e,t)=>e.rule>=t.rule?e:VS.init(`range`,e,t),maxLength:(e,t)=>e.rule<=t.rule?e:VS.init(`range`,e,t)}}),Node:class extends eC{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=J.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(e){switch(e.type){case`string`:return e.minLength=this.rule,e.maxLength=this.rule,e;case`array`:return e.minItems=this.rule,e.maxItems=this.rule,e;default:return vS.throwInternalOperandError(`exactLength`,e)}}}},jC={implementation:_S({kind:`max`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{},exclusive:vC},normalize:e=>typeof e==`number`?{rule:e}:e,defaults:{description:e=>e.rule===0?e.exclusive?`negative`:`non-positive`:`${e.exclusive?`less than`:`at most`} ${e.rule}`},intersections:{max:(e,t)=>e.isStricterThan(t)?e:t,min:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node(`unit`,{unit:e.rule}):null:VS.init(`range`,e,t)},obviatesBasisDescription:!0}),Node:class extends hC{impliedBasis=J.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e<this.rule:e=>e<=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMaximum=this.rule:e.maximum=this.rule,e}}},MC={implementation:_S({kind:`maxLength`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{parse:CC(`maxLength`)}},reduce:(e,t)=>e.rule===0?t.node(`exactLength`,e):void 0,normalize:yC(`maxLength`),defaults:{description:e=>`at most length ${e.rule}`,actual:e=>`${e.length}`},intersections:{maxLength:(e,t)=>e.isStricterThan(t)?e:t,minLength:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node(`exactLength`,{rule:e.rule}):null:VS.init(`range`,e,t)}}),Node:class extends hC{impliedBasis=J.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length<=this.rule;reduceJsonSchema(e){switch(e.type){case`string`:return e.maxLength=this.rule,e;case`array`:return e.maxItems=this.rule,e;default:return vS.throwInternalOperandError(`maxLength`,e)}}}},NC={implementation:_S({kind:`min`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{},exclusive:vC},normalize:e=>typeof e==`number`?{rule:e}:e,defaults:{description:e=>e.rule===0?e.exclusive?`positive`:`non-negative`:`${e.exclusive?`more than`:`at least`} ${e.rule}`},intersections:{min:(e,t)=>e.isStricterThan(t)?e:t},obviatesBasisDescription:!0}),Node:class extends hC{impliedBasis=J.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}},PC={implementation:_S({kind:`minLength`,collapsibleKey:`rule`,hasAssociatedError:!0,keys:{rule:{parse:CC(`minLength`)}},reduce:e=>e.rule===0?J.intrinsic.unknown:void 0,normalize:yC(`minLength`),defaults:{description:e=>e.rule===1?`non-empty`:`at least length ${e.rule}`,actual:e=>e.length===0?``:`${e.length}`},intersections:{minLength:(e,t)=>e.isStricterThan(t)?e:t}}),Node:class extends hC{impliedBasis=J.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length>=this.rule;reduceJsonSchema(e){switch(e.type){case`string`:return e.minLength=this.rule,e;case`array`:return e.minItems=this.rule,e;default:return vS.throwInternalOperandError(`minLength`,e)}}}},FC={min:NC.implementation,max:jC.implementation,minLength:PC.implementation,maxLength:MC.implementation,exactLength:AC.implementation,after:OC.implementation,before:kC.implementation},IC={min:NC.Node,max:jC.Node,minLength:PC.Node,maxLength:MC.Node,exactLength:AC.Node,after:OC.Node,before:kC.Node},LC={implementation:_S({kind:`pattern`,collapsibleKey:`rule`,keys:{rule:{},flags:{}},normalize:e=>typeof e==`string`?{rule:e}:e instanceof RegExp?e.flags?{rule:e.source,flags:e.flags}:{rule:e.source}:e,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:e=>`matched by ${e.rule}`},intersections:{pattern:()=>null}}),Node:class extends eC{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=J.intrinsic.string.internal;reduceJsonSchema(e,t){return e.pattern?t.fallback.patternIntersection({code:`patternIntersection`,base:e,pattern:this.rule}):(e.pattern=this.rule,e)}}},RC=(e,t)=>{let n=zC(e);return t&&!t.includes(n)?q(`Root of kind ${n} should be one of ${t}`):n},zC=e=>{if(eS(e,`root`))return e.kind;if(typeof e==`string`)return e[0]===`$`?`alias`:e in Qy?`domain`:`proto`;if(typeof e==`function`)return`proto`;if(typeof e!=`object`||!e)return q(BC(e));if(`morphs`in e)return`morph`;if(`branches`in e||Db(e))return`union`;if(`unit`in e)return`unit`;if(`reference`in e)return`alias`;let t=Object.keys(e);return t.length===0||t.some(e=>e in lS)?`intersection`:`proto`in e?`proto`:`domain`in e?`domain`:q(BC(e))},BC=e=>`${Dx(e)} is not a valid type schema`,VC={},HC=e=>Db(e)?e.map(e=>e.collapsibleJson):e.collapsibleJson,UC={};J.nodesByRegisteredId=UC;var WC=e=>(VC[e]??=0,`${e}${++VC[e]}`),GC=e=>{let t=AT[e.kind],n=t.applyConfig?.(e.def,e.$.resolvedConfig)??e.def,r={},{meta:i,...a}=n,o=i===void 0?{}:typeof i==`string`?{description:i}:i,s=ob(a).sort(([e],[t])=>fS(e)?fS(t)?pS(e)-pS(t):1:fS(t)||e<t?-1:1).filter(([e,t])=>{if(e.startsWith(`meta.`)){let n=e.slice(5);return o[n]=t,!1}return!0});for(let n of s){let i=n[0],a=t.keys[i];if(!a)return q(`Key ${i} is not valid on ${e.kind} schema`);let o=a.parse?a.parse(n[1],e):n[1];o!==vb&&(o!==void 0||a.preserveUndefined)&&(r[i]=o)}if(t.reduce&&!e.prereduced){let n=t.reduce(r,e.$);if(n)return n instanceof VS?n.throw():JC(n,o)}return KC({id:e.id,kind:e.kind,inner:r,meta:o,$:e.$})},KC=({id:e,kind:t,inner:n,meta:r,$:i,ignoreCache:a})=>{let o=AT[t],s=ob(n),c=[],l={};for(let[e,t]of s){let n=o.keys[e],r=n.serialize??(n.child?HC:hS);if(l[e]=r(t),n.child===!0){let e=t;Db(e)?c.push(...e):c.push(e)}else typeof n.child==`function`&&c.push(...n.child(t))}o.finalizeInnerJson&&(l=o.finalizeInnerJson(l));let u={...l},d={};mb(r)||(d=ab(r,(e,t)=>[e,e===`examples`?t:hS(t)]),u.meta=YC(d,`description`,!0)),l=YC(l,o.collapsibleKey,!1);let f=JSON.stringify({kind:t,...l});u=YC(u,o.collapsibleKey,!1);let p=YC(u,o.collapsibleKey,!0),m=JSON.stringify({kind:t,...u});if(i.nodesByHash[m]&&!a)return i.nodesByHash[m];let h={id:e,kind:t,impl:o,inner:n,innerEntries:s,innerJson:l,innerHash:f,meta:r,metaJson:d,json:u,hash:m,collapsibleJson:p,children:c};if(t!==`intersection`)for(let e in n)e!==`in`&&e!==`out`&&(h[e]=n[e]);let g=new jT[t](h,i);return i.nodesByHash[m]=g},qC=(e,t)=>e.id===t?e:(tS(UC[t])&&tb(`Unexpected attempt to overwrite node id ${t}`),KC({id:t,kind:e.kind,inner:e.inner,meta:e.meta,$:e.$,ignoreCache:!0})),JC=(e,t,n)=>(n&&tS(UC[n])&&tb(`Unexpected attempt to overwrite node id ${n}`),KC({id:n??WC(t.alias??e.kind),kind:e.kind,inner:e.inner,meta:t,$:e.$})),YC=(e,t,n)=>{let r=Object.keys(e);if(r.length===1&&r[0]===t){let r=e[t];if(n||Xy(r,`object`)&&(Object.keys(r).length===1||Array.isArray(r)))return r}return e},XC=(e,t,n)=>{if(e.key!==t.key)return null;let r=e.key,i=JS(e.value,t.value,n),a=e.required||t.required?`required`:`optional`;if(i instanceof VS){if(a===`optional`)i=J.intrinsic.never.internal;else return i.withPrefixKey(e.key,e.required&&t.required?`required`:`optional`)}if(a===`required`)return n.$.node(`required`,{key:r,value:i});let o=e.hasDefault()?t.hasDefault()?e.default===t.default?e.default:q(QC(e.default,t.default)):e.default:t.hasDefault()?t.default:vb;return n.$.node(`optional`,{key:r,value:i,default:o})},ZC=class extends $S{required=this.kind===`required`;optional=this.kind===`optional`;impliedBasis=J.intrinsic.object.internal;serializedKey=qx(this.key);compiledKey=typeof this.key==`string`?this.key:this.serializedKey;flatRefs=Wy(this.value.flatRefs.map(e=>LS([this.key,...e.path],e.node)),LS([this.key],this.value));_transform(e,t){t.path.push(this.key);let n=super._transform(e,t);return t.path.pop(),n}hasDefault(){return`default`in this.inner}traverseAllows=(e,t)=>this.key in e?AS(this.key,()=>this.value.traverseAllows(e[this.key],t),t):this.optional;traverseApply=(e,t)=>{this.key in e?AS(this.key,()=>this.value.traverseApply(e[this.key],t),t):this.hasKind(`required`)&&t.errorFromNodeContext(this.errorContext)};compile(e){e.if(`${this.serializedKey} in data`,()=>e.traverseKey(this.serializedKey,`data${e.prop(this.key)}`,this.value)),this.hasKind(`required`)&&e.else(()=>e.traversalKind===`Apply`?e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):e.return(!1)),e.traversalKind===`Allows`&&e.return(!0)}},QC=(e,t)=>`Invalid intersection of default values ${Dx(e)} & ${Dx(t)}`,$C={implementation:_S({kind:`optional`,hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)},default:{preserveUndefined:!0}},normalize:e=>e,reduce:(e,t)=>{if(t.resolvedConfig.exactOptionalPropertyTypes===!1&&!e.value.allows(void 0))return t.node(`optional`,{...e,value:e.value.or(sE.undefined)},{prereduced:!0})},defaults:{description:e=>`${e.compiledKey}?: ${e.value.description}`},intersections:{optional:XC}}),Node:class extends ZC{constructor(...e){super(...e),`default`in this.inner&&rw(this.value,this.inner.default,this.key)}get rawIn(){let e=super.rawIn;return this.hasDefault()?this.$.node(`optional`,pb(e.inner,{default:!0}),{prereduced:!0}):e}get outProp(){if(!this.hasDefault())return this;let{default:e,...t}=this.inner;return this.cacheGetter(`outProp`,this.$.node(`required`,t,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Dx(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=tw(this);defaultValueMorphRef=this.defaultValueMorph&&Gx(this.defaultValueMorph)}},ew={},tw=e=>{if(!e.hasDefault())return;let t=`{${e.compiledKey}: ${e.value.id} = ${hS(e.default)}}`;return ew[t]??=nw(e.key,e.value,e.default)},nw=(e,t,n)=>{if(typeof n==`function`)return t.includesTransform?(r,i)=>(AS(e,()=>t(r[e]=n(),i),i),r):t=>(t[e]=n(),t);let r=t.includesTransform?t.assert(n):n;return Xy(r,`object`)?(r,i)=>(AS(e,()=>t(r[e]=n,i),i),r):t=>(t[e]=r,t)},rw=(e,t,n)=>{let r=Lb(t);Xy(t,`object`)&&!r&&q(iw(n));let i=e.in(r?t():t);return i instanceof ES&&(n===null&&q(`Default ${i.summary}`),q(`Default for ${i.transform(e=>e.transform(e=>({...e,prefixPath:[n]}))).summary}`)),t},iw=e=>`Non-primitive default ${e===null?``:typeof e==`number`?`for value at [${e}] `:`for ${qx(e)} `}must be specified as a function like () => ({my: 'object'})`,aw=class extends jS{constructor(e,t){super(e,t),Object.defineProperty(this,$x,{value:`root`,enumerable:!1})}get rawIn(){return super.rawIn}get rawOut(){return super.rawOut}get internal(){return this}get"~standard"(){return{vendor:`arktype`,version:1,validate:e=>{let t=this(e);return t instanceof ES?t:{value:t}},jsonSchema:{input:e=>this.rawIn.toJsonSchema({target:lw(e.target),...e.libraryOptions}),output:e=>this.rawOut.toJsonSchema({target:lw(e.target),...e.libraryOptions})}}}as(){return this}brand(e){return e===``?q(ow):this}readonly(){return this}branches=this.hasKind(`union`)?this.inner.branches:[this];distribute(e,t){let n=this.branches.map(e);return t?.(n)??n}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){let t=xS(this.$.resolvedConfig.toJsonSchema,e);t.useRefs||=this.isCyclic;let n=typeof t.dialect==`string`?{$schema:t.dialect}:{};if(Object.assign(n,this.toJsonSchemaRecurse(t)),t.useRefs){let e=ab(this.references,(e,n)=>n.isRoot()&&!n.alwaysExpandJsonSchema?[n.id,n.toResolvedJsonSchema(t)]:[]);t.target===`draft-07`?Object.assign(n,{definitions:e}):n.$defs=e}return n}toJsonSchemaRecurse(e){return e.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/${e.target===`draft-07`?`definitions`:`$defs`}/${this.id}`}:this.toResolvedJsonSchema(e)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind===`alias`||this.hasKind(`union`)&&this.isBoolean}toResolvedJsonSchema(e){let t=this.innerToJsonSchema(e);return Object.assign(t,this.metaJson)}intersect(e){let t=this.$.parseDefinition(e),n=this.rawIntersect(t);return n instanceof VS?n:this.$.finalize(n)}rawIntersect(e){return KS(this,e,this.$)}toNeverIfDisjoint(){return this}and(e){let t=this.intersect(e);return t instanceof VS?t.throw():t}rawAnd(e){let t=this.rawIntersect(e);return t instanceof VS?t.throw():t}or(e){let t=this.$.parseDefinition(e);return this.$.finalize(this.rawOr(t))}rawOr(e){let t=[...this.branches,...e.branches];return this.$.node(`union`,t)}map(e){return this.$.schema(this.applyStructuralOperation(`map`,[e]))}pick(...e){return this.$.schema(this.applyStructuralOperation(`pick`,e))}omit(...e){return this.$.schema(this.applyStructuralOperation(`omit`,e))}required(){return this.$.schema(this.applyStructuralOperation(`required`,[]))}partial(){return this.$.schema(this.applyStructuralOperation(`partial`,[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.applyStructuralOperation(`keyof`,[]).reduce((e,t)=>e.intersect(t).toNeverIfDisjoint(),J.intrinsic.unknown.internal);return e.branches.length===0&&q(WS(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length===1?[...this.applyStructuralOperation(`props`,[])[0]]:q(pw(this.expression))}merge(e){let t=this.$.parseDefinition(e);return this.$.schema(t.distribute(e=>this.applyStructuralOperation(`merge`,[fw(e)??q(mw(`merge`,e.expression))])))}applyStructuralOperation(e,t){return this.distribute(n=>{if(n.equals(J.intrinsic.object)&&e!==`merge`)return n;let r=fw(n);if(r||q(mw(e,n.expression)),e===`keyof`)return r.keyof();if(e===`get`)return r.get(...t);if(e===`props`)return r.props;let i=e===`required`?`require`:e===`partial`?`optionalize`:e;return this.$.node(`intersection`,{domain:`object`,structure:r[i](...t)})})}get(...e){return e[0]===void 0?this:this.$.schema(this.applyStructuralOperation(`get`,e))}extract(e){let t=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(e=>e.extends(t)))}exclude(e){let t=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(e=>!e.extends(t)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(e){return!(this.intersect(e)instanceof VS)}extends(e){if(this.isNever())return!0;let t=this.intersect(e);return!(t instanceof VS)&&this.equals(t)}ifExtends(e){return this.extends(e)?this:void 0}subsumes(e){return this.$.parseDefinition(e).extends(this)}configure(e,t=`shallow`){return this.configureReferences(e,t)}describe(e,t=`shallow`){return this.configure({description:e},t)}optional(){return[this,`?`]}default(e){return rw(this,e,null),[this,`=`,e]}from(e){return this.assert(e)}_pipe(...e){let t=e.reduce((e,t)=>e.rawPipeOnce(t),this);return this.$.finalize(t)}tryPipe(...e){let t=e.reduce((e,t)=>e.rawPipeOnce(eS(t,`root`)?t:((e,n)=>{try{return t(e,n)}catch(e){return n.error({code:`predicate`,predicate:t,actual:`aborted due to error:\n ${e}\n`})}})),this);return this.$.finalize(t)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){let t=qS(this,e,this.$);return t instanceof VS?t.throw():t}rawPipeOnce(e){return eS(e,`root`)?this.toNode(e):this.distribute(t=>t.hasKind(`morph`)?this.$.node(`morph`,{in:t.inner.in,morphs:[...t.morphs,e]}):this.$.node(`morph`,{in:t,morphs:[e]}),this.$.parseSchema)}narrow(e){return this.constrainOut(`predicate`,e)}constrain(e,t){return this._constrain(`root`,e,t)}constrainIn(e,t){return this._constrain(`in`,e,t)}constrainOut(e,t){return this._constrain(`out`,e,t)}_constrain(e,t,n){let r=this.$.node(t,n);if(r.isRoot())return r.isUnknown()?this:tb(`Unexpected constraint node ${r}`);let i=e===`root`?this:e===`in`?this.rawIn:this.rawOut;if(i.hasKind(`morph`)||r.impliedBasis&&!i.extends(r.impliedBasis))return aC(t,r.impliedBasis,this);let a=this.$.node(`intersection`,{[r.kind]:r}),o=e===`out`?qS(this,a,this.$):KS(this,a,this.$);return o instanceof VS&&o.throw(),this.$.finalize(o)}onUndeclaredKey(e){let t=typeof e==`string`?e:e.rule,n=typeof e!=`string`&&e.deep;return this.$.finalize(this.transform((e,n)=>e===`structure`?t===`ignore`?pb(n,{undeclared:1}):{...n,undeclared:t}:n,n?void 0:{shouldTransform:e=>!Hy(rS,e.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform||!(!Yy(this.shallowMorphs,e.shallowMorphs)||!Yy(this.flatMorphs,e.flatMorphs,{isEqual:(e,t)=>e.propString===t.propString&&(e.node.hasKind(`morph`)&&t.node.hasKind(`morph`)?e.node.hasEqualMorphs(t.node):e.node.hasKind(`intersection`)&&t.node.hasKind(`intersection`)?e.node.structure?.structuralMorphRef===t.node.structure?.structuralMorphRef:!1)}))}onDeepUndeclaredKey(e){return this.onUndeclaredKey({rule:e,deep:!0})}filter(e){return this.constrainIn(`predicate`,e)}divisibleBy(e){return this.constrain(`divisor`,e)}matching(e){return this.constrain(`pattern`,e)}atLeast(e){return this.constrain(`min`,e)}atMost(e){return this.constrain(`max`,e)}moreThan(e){return this.constrain(`min`,uw(e))}lessThan(e){return this.constrain(`max`,uw(e))}atLeastLength(e){return this.constrain(`minLength`,e)}atMostLength(e){return this.constrain(`maxLength`,e)}moreThanLength(e){return this.constrain(`minLength`,uw(e))}lessThanLength(e){return this.constrain(`maxLength`,uw(e))}exactlyLength(e){return this.constrain(`exactLength`,e)}atOrAfter(e){return this.constrain(`after`,e)}atOrBefore(e){return this.constrain(`before`,e)}laterThan(e){return this.constrain(`after`,uw(e))}earlierThan(e){return this.constrain(`before`,uw(e))}},ow=`Expected a non-empty brand name after #`,sw=[`draft-2020-12`,`draft-07`],cw=e=>`JSONSchema target '${e}' is not supported (must be ${sw.map(e=>`"${e}"`).join(` or `)})`,lw=e=>(Hy(sw,e)||q(cw(e)),e),uw=e=>typeof e==`object`&&!(e instanceof Date)?{...e,exclusive:!0}:{rule:e,exclusive:!0},dw=(e,t)=>eS(t,`root`)?eS(e,`root`)?e.extends(t):t.allows(e):eS(e,`root`)?e.hasUnit(t):t===e,fw=e=>e.hasKind(`morph`)?null:e.hasKind(`intersection`)?e.inner.structure??(e.basis?.domain===`object`?e.$.bindReference(J.intrinsic.emptyStructure):null):e.isBasis()&&e.domain===`object`?e.$.bindReference(J.intrinsic.emptyStructure):null,pw=e=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
22
|
-
${e}`,mw=(e,t)=>`${e} operand must be an object (was ${t})`,hw=(e,t)=>ab(mS(e),(e,n)=>[n,t]),gw=e=>typeof e==`string`?{reference:e}:e,_w=e=>e instanceof VS?J.intrinsic.never.internal:e,vw=_S({kind:`alias`,hasAssociatedError:!1,collapsibleKey:`reference`,keys:{reference:{serialize:e=>e.startsWith(`$`)?e:`$ark.${e}`},resolve:{}},normalize:gw,defaults:{description:e=>e.reference},intersections:{alias:(e,t,n)=>n.$.lazilyResolve(()=>_w(JS(e.resolution,t.resolution,n)),`${e.reference}${n.pipe?`=>`:`&`}${t.reference}`),...hw(`alias`,(e,t,n)=>t.isUnknown()?e:t.isNever()?t:t.isBasis()&&!t.overlaps(J.intrinsic.object)?VS.init(`assignability`,J.intrinsic.object,t):n.$.lazilyResolve(()=>_w(JS(e.resolution,t,n)),`${e.reference}${n.pipe?`=>`:`&`}${t.id}`))}}),yw=class extends aw{expression=this.reference;structure=void 0;get resolution(){let e=this._resolve();return UC[this.id]=e}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]===`$`)return this.$.resolveRoot(this.reference.slice(1));let e=UC[this.reference],t=[];for(;eS(e,`context`);){if(t.includes(e.id))return q(bw(e.id,t));t.push(e.id),e=UC[e.id]}return eS(e,`root`)?e:tb(`Unexpected resolution for reference ${this.reference}
|
|
23
|
-
Seen: [${t.join(`->`)}]
|
|
24
|
-
Resolution: ${Dx(e)}`)}get resolutionId(){if(this.reference.includes(`&`)||this.reference.includes(`=>`))return this.resolution.id;if(this.reference[0]!==`$`)return this.reference;let e=this.reference.slice(1),t=this.$.resolutions[e];return typeof t==`string`?t:eS(t,`root`)?t.id:tb(`Unexpected resolution for reference ${this.reference}: ${Dx(t)}`)}get defaultShortDescription(){return Qy.object}innerToJsonSchema(e){return this.resolution.toJsonSchemaRecurse(e)}traverseAllows=(e,t)=>{let n=t.seen[this.reference];return n?.includes(e)?!0:(t.seen[this.reference]=Wy(n,e),this.resolution.traverseAllows(e,t))};traverseApply=(e,t)=>{let n=t.seen[this.reference];n?.includes(e)||(t.seen[this.reference]=Wy(n,e),this.resolution.traverseApply(e,t))};compile(e){let t=this.resolutionId;e.if(`ctx.seen.${t} && ctx.seen.${t}.includes(data)`,()=>e.return(!0)),e.if(`!ctx.seen.${t}`,()=>e.line(`ctx.seen.${t} = []`)),e.line(`ctx.seen.${t}.push(data)`),e.return(e.invoke(t))}},bw=(e,t)=>`Alias '${e}' has a shallow resolution cycle: ${[...t,e].join(`->`)}`,xw={implementation:vw,Node:yw},Sw=class extends aw{traverseApply=(e,t)=>{this.traverseAllows(e,t)||t.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return gS(this.errorContext)}compile(e){e.traversalKind===`Allows`?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}},Cw={implementation:_S({kind:`domain`,hasAssociatedError:!0,collapsibleKey:`domain`,keys:{domain:{},numberAllowsNaN:{}},normalize:e=>typeof e==`string`?{domain:e}:cb(e,`numberAllowsNaN`)&&e.domain!==`number`?q(Cw.writeBadAllowNanMessage(e.domain)):e,applyConfig:(e,t)=>e.numberAllowsNaN===void 0&&e.domain===`number`&&t.numberAllowsNaN?{...e,numberAllowsNaN:!0}:e,defaults:{description:e=>Qy[e.domain],actual:e=>Number.isNaN(e)?`NaN`:Qy[Zy(e)]},intersections:{domain:(e,t)=>e.domain===`number`&&t.domain===`number`?e.numberAllowsNaN?t:e:VS.init(`domain`,e,t)}}),Node:class extends Sw{requiresNaNCheck=this.domain===`number`&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e==`number`&&!Number.isNaN(e):e=>Zy(e)===this.domain;compiledCondition=this.domain===`object`?`((typeof data === "object" && data !== null) || typeof data === "function")`:`typeof data === "${this.domain}"${this.requiresNaNCheck?` && !Number.isNaN(data)`:``}`;compiledNegation=this.domain===`object`?`((typeof data !== "object" || data === null) && typeof data !== "function")`:`typeof data !== "${this.domain}"${this.requiresNaNCheck?` || Number.isNaN(data)`:``}`;expression=this.numberAllowsNaN?`number | NaN`:this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Qy[this.domain]}innerToJsonSchema(e){return this.domain===`bigint`||this.domain===`symbol`?e.fallback.domain({code:`domain`,base:{},domain:this.domain}):{type:this.domain}}},writeBadAllowNanMessage:e=>`numberAllowsNaN may only be specified with domain "number" (was ${e})`},ww={implementation:_S({kind:`intersection`,hasAssociatedError:!0,normalize:e=>{if(tS(e))return e;let{structure:t,...n}=e,r=!!t,i=t??{},a=ab(n,(e,t)=>sb(e,uS)?(r&&q(`Flattened structure key ${e} cannot be specified alongside a root 'structure' key.`),i[e]=t,[]):[e,t]);return(eS(i,`constraint`)||!mb(i))&&(a.structure=i),a},finalizeInnerJson:({structure:e,...t})=>Xy(e,`object`)?{...e,...t}:t,keys:{domain:{child:!0,parse:(e,t)=>t.$.node(`domain`,e)},proto:{child:!0,parse:(e,t)=>t.$.node(`proto`,e)},structure:{child:!0,parse:(e,t)=>t.$.node(`structure`,e),serialize:e=>{if(!e.sequence?.minLength)return e.collapsibleJson;let{sequence:t,...n}=e.collapsibleJson,{minVariadicLength:r,...i}=t,a=i.variadic&&Object.keys(i).length===1?i.variadic:i;return{...n,sequence:a}}},divisor:{child:!0,parse:tC(`divisor`)},max:{child:!0,parse:tC(`max`)},min:{child:!0,parse:tC(`min`)},maxLength:{child:!0,parse:tC(`maxLength`)},minLength:{child:!0,parse:tC(`minLength`)},exactLength:{child:!0,parse:tC(`exactLength`)},before:{child:!0,parse:tC(`before`)},after:{child:!0,parse:tC(`after`)},pattern:{child:!0,parse:tC(`pattern`)},predicate:{child:!0,parse:tC(`predicate`)}},reduce:(e,t)=>Ew({},e,{$:t,invert:!1,pipe:!1}),defaults:{description:e=>{if(e.children.length===0)return`unknown`;if(e.structure)return e.structure.description;let t=[];if(e.basis&&!e.prestructurals.some(e=>e.impl.obviatesBasisDescription)&&t.push(e.basis.description),e.prestructurals.length){let n=e.prestructurals.slice().sort((e,t)=>e.kind===`min`&&t.kind===`max`?-1:0).map(e=>e.description);t.push(...n)}return e.inner.predicate&&t.push(...e.inner.predicate.map(e=>e.description)),t.join(` and `)},expected:e=>` ◦ ${e.errors.map(e=>e.expected).join(`
|
|
25
|
-
◦ `)}`,problem:e=>`(${e.actual}) must be...\n${e.expected}`},intersections:{intersection:(e,t,n)=>Ew(e.inner,t.inner,n),...hw(`intersection`,(e,t,n)=>{if(e.children.length===0)return t;let{domain:r,proto:i,...a}=e.inner,o=i??r,s=o?JS(o,t,n):t;return s instanceof VS?s:e?.basis?.equals(s)?e:e.$.node(`intersection`,{...a,[s.kind]:s},{prereduced:!0})})}}),Node:class extends aw{basis=this.inner.domain??this.inner.proto??null;prestructurals=[];refinements=this.children.filter(e=>e.isRefinement()?(Hy(iS,e.kind)&&this.prestructurals.push(e),!0):!1);structure=this.inner.structure;expression=Tw(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??`present`}innerToJsonSchema(e){return this.children.reduce((t,n)=>n.isBasis()?n.toJsonSchemaRecurse(e):n.reduceJsonSchema(t,e),{})}traverseAllows=(e,t)=>this.children.every(n=>n.traverseAllows(e,t));traverseApply=(e,t)=>{let n=t.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(e,t),t.currentErrorCount>n))){if(this.prestructurals.length){for(let r=0;r<this.prestructurals.length-1;r++)if(this.prestructurals[r].traverseApply(e,t),t.failFast&&t.currentErrorCount>n)return;if(this.prestructurals[this.prestructurals.length-1].traverseApply(e,t),t.currentErrorCount>n)return}if(!(this.structure&&(this.structure.traverseApply(e,t),t.currentErrorCount>n))&&this.inner.predicate){for(let r=0;r<this.inner.predicate.length-1;r++)if(this.inner.predicate[r].traverseApply(e,t),t.failFast&&t.currentErrorCount>n)return;this.inner.predicate[this.inner.predicate.length-1].traverseApply(e,t)}}};compile(e){if(e.traversalKind===`Allows`){for(let t of this.children)e.check(t);e.return(!0);return}if(e.initializeErrorCount(),this.basis&&(e.check(this.basis),this.children.length>1&&e.returnIfFail()),this.prestructurals.length){for(let t=0;t<this.prestructurals.length-1;t++)e.check(this.prestructurals[t]),e.returnIfFailFast();e.check(this.prestructurals[this.prestructurals.length-1]),(this.structure||this.inner.predicate)&&e.returnIfFail()}if(this.structure&&(e.check(this.structure),this.inner.predicate&&e.returnIfFail()),this.inner.predicate){for(let t=0;t<this.inner.predicate.length-1;t++)e.check(this.inner.predicate[t]),e.returnIfFail();e.check(this.inner.predicate[this.inner.predicate.length-1])}}}},Tw=e=>{if(e.structure?.expression)return e.structure.expression;let t=e.basis&&!e.prestructurals.some(e=>e.impl.obviatesBasisExpression)?e.basis.nestableExpression:``,n=e.prestructurals.map(e=>e.expression).join(` & `),r=`${t}${t&&n?` `:``}${n}`;return r===`Array == 0`?`[]`:r||`unknown`},Ew=(e,t,n)=>{let r={},i=e.proto??e.domain,a=t.proto??t.domain,o=i?a?JS(i,a,n):i:a;return o instanceof VS?o:(o&&(r[o.kind]=o),nC({kind:`intersection`,baseInner:r,l:rC(e),r:rC(t),roots:[],ctx:n}))},Dw={implementation:_S({kind:`morph`,hasAssociatedError:!1,keys:{in:{child:!0,parse:(e,t)=>t.$.parseSchema(e)},morphs:{parse:zy,serialize:e=>e.map(e=>eS(e,`root`)?e.json:Gx(e))},declaredIn:{child:!1,serialize:e=>e.json},declaredOut:{child:!1,serialize:e=>e.json}},normalize:e=>e,defaults:{description:e=>`a morph from ${e.rawIn.description} to ${e.rawOut?.description??`unknown`}`},intersections:{morph:(e,t,n)=>{if(!e.hasEqualMorphs(t))return q(Ow(e.expression,t.expression));let r=JS(e.rawIn,t.rawIn,n);if(r instanceof VS)return r;let i={morphs:e.morphs};if(e.declaredIn||t.declaredIn){let r=JS(e.rawIn,t.rawIn,n);if(r instanceof VS)return r.throw();i.declaredIn=r}if(e.declaredOut||t.declaredOut){let r=JS(e.rawOut,t.rawOut,n);if(r instanceof VS)return r.throw();i.declaredOut=r}return r.distribute(e=>n.$.node(`morph`,{...i,in:e}),n.$.parseSchema)},...hw(`morph`,(e,t,n)=>{let r=e.inner.in?JS(e.inner.in,t,n):t;return r instanceof VS?r:r.equals(e.inner.in)?e:n.$.node(`morph`,{...e.inner,in:r})})}}),Node:class extends aw{serializedMorphs=this.morphs.map(Gx);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs[this.inner.morphs.length-1];lastMorphIfNode=eS(this.lastMorph,`root`)?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.rawOut:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get rawIn(){return this.declaredIn??this.inner.in?.rawIn??J.intrinsic.unknown.internal}get rawOut(){return this.declaredOut??this.introspectableOut??J.intrinsic.unknown.internal}declareIn(e){return this.$.node(`morph`,{...this.inner,declaredIn:e})}declareOut(e){return this.$.node(`morph`,{...this.inner,declaredOut:e})}expression=`(In: ${this.rawIn.expression}) => ${this.lastMorphIfNode?`To`:`Out`}<${this.rawOut.expression}>`;get defaultShortDescription(){return this.rawIn.meta.description??this.rawIn.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:`morph`,base:this.rawIn.toJsonSchemaRecurse(e),out:this.introspectableOut?.toJsonSchemaRecurse(e)??null})}compile(e){if(e.traversalKind===`Allows`){if(!this.introspectableIn)return;e.return(e.invoke(this.introspectableIn));return}this.introspectableIn&&e.line(e.invoke(this.introspectableIn)),e.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(e,t)=>!this.introspectableIn||this.introspectableIn.traverseAllows(e,t);traverseApply=(e,t)=>{this.introspectableIn&&this.introspectableIn.traverseApply(e,t),t.queueMorphs(this.morphs)};hasEqualMorphs(e){return Yy(this.morphs,e.morphs,{isEqual:(e,t)=>e===t||eS(e,`root`)&&eS(t,`root`)&&e.equals(t)})}}},Ow=(e,t)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
26
|
-
Left: ${e}
|
|
27
|
-
Right: ${t}`,kw={implementation:_S({kind:`proto`,hasAssociatedError:!0,collapsibleKey:`proto`,keys:{proto:{serialize:e=>Mb(e)??hS(e)},dateAllowsInvalid:{}},normalize:e=>{let t=typeof e==`string`?{proto:wb[e]}:typeof e==`function`?tS(e)?e:{proto:e}:typeof e.proto==`string`?{...e,proto:wb[e.proto]}:e;return typeof t.proto!=`function`&&q(kw.writeInvalidSchemaMessage(t.proto)),cb(t,`dateAllowsInvalid`)&&t.proto!==Date&&q(kw.writeBadInvalidDateMessage(t.proto)),t},applyConfig:(e,t)=>e.dateAllowsInvalid===void 0&&e.proto===Date&&t.dateAllowsInvalid?{...e,dateAllowsInvalid:!0}:e,defaults:{description:e=>e.builtinName?jb[e.builtinName]:`an instance of ${e.proto.name}`,actual:e=>e instanceof Date&&e.toString()===`Invalid Date`?`an invalid Date`:Eb(e)},intersections:{proto:(e,t)=>e.proto===Date&&t.proto===Date?e.dateAllowsInvalid?t:e:Nb(e.proto,t.proto)?e:Nb(t.proto,e.proto)?t:VS.init(`proto`,e,t),domain:(e,t)=>t.domain===`object`?e:VS.init(`domain`,J.intrinsic.object.internal,t)}}),Node:class extends Sw{builtinName=Mb(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?e=>e instanceof Date&&e.toString()!==`Invalid Date`:e=>e instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?` && data.toString() !== "Invalid Date"`:``}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(e){switch(this.builtinName){case`Array`:return{type:`array`};case`Date`:return e.fallback.date?.({code:`date`,base:{}})??e.fallback.proto({code:`proto`,base:{},proto:this.proto});default:return e.fallback.proto({code:`proto`,base:{},proto:this.proto})}}expression=this.dateAllowsInvalid?`Date | InvalidDate`:this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain=`object`;get defaultShortDescription(){return this.description}},writeBadInvalidDateMessage:e=>`dateAllowsInvalid may only be specified with constructor Date (was ${e.name})`,writeInvalidSchemaMessage:e=>`instanceOf operand must be a function (was ${Zy(e)})`},Aw=_S({kind:`union`,hasAssociatedError:!0,collapsibleKey:`branches`,keys:{ordered:{},branches:{child:!0,parse:(e,t)=>{let n=[];for(let r of e){let e=eS(r,`root`)?r.branches:t.$.parseSchema(r).branches;for(let r of e)if(r.hasKind(`morph`)){let e=n.findIndex(e=>e.hasKind(`morph`)&&e.hasEqualMorphs(r));if(e===-1)n.push(r);else{let i=n[e];n[e]=t.$.node(`morph`,{...i.inner,in:i.rawIn.rawOr(r.rawIn)})}}else n.push(r)}return t.def.ordered||n.sort((e,t)=>e.hash<t.hash?-1:1),n}}},normalize:e=>Db(e)?{branches:e}:e,reduce:(e,t)=>{let n=Gw(e);if(n.length===1)return n[0];if(n.length!==e.branches.length)return t.node(`union`,{...e,branches:n},{prereduced:!0})},defaults:{description:e=>e.distribute(e=>e.description,Uw),expected:e=>{let t=Jy(e.errors,`propString`);return Uw(Object.entries(t).map(([e,t])=>{let n=[];for(let e of t)qy(n,e.expected);let r=Uw(n),i=t.every(e=>e.actual===t[0].actual)?t[0].actual:Dx(t[0].data);return`${e&&`${e} `}must be ${r}${i&&` (was ${i})`}`}))},problem:e=>e.expected,message:e=>e.problem[0]===`[`?`value at ${e.problem}`:e.problem},intersections:{union:(e,t,n)=>{if(e.isNever!==t.isNever)return VS.init(`presence`,e,t);let r;return e.ordered?(t.ordered&&q(Yw(e.expression,t.expression)),r=Ww(t.branches,e.branches,n),r instanceof VS&&r.invert()):r=Ww(e.branches,t.branches,n),r instanceof VS?r:n.$.parseSchema(e.ordered||t.ordered?{branches:r,ordered:!0}:{branches:r})},...hw(`union`,(e,t,n)=>{let r=Ww(e.branches,[t],n);return r instanceof VS?r:r.length===1?r[0]:n.$.parseSchema(e.ordered?{branches:r,ordered:!0}:{branches:r})})}}),jw=class extends aw{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let e=[],t=-1;for(let n of this.branches){if(n.hasKind(`unit`)&&n.domain===`boolean`){t===-1?(t=e.length,e.push(n)):e[t]=J.intrinsic.boolean;continue}e.push(n)}return e}unitBranches=this.branches.filter(e=>e.rawIn.hasKind(`unit`));discriminant=this.discriminate();discriminantJson=this.discriminant?Bw(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,Hw);createBranchedOptimisticRootApply(){return(e,t)=>{let n=this.traverseOptimistic(e);if(n!==vb)return n;let r=new kS(e,this.$.resolvedConfig);return this.traverseApply(e,r),r.finalize(t)}}get shallowMorphs(){return this.branches.reduce((e,t)=>qy(e,t.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,Uw)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(J.intrinsic.boolean))return{type:`boolean`};let t=this.branchGroups.map(t=>t.toJsonSchemaRecurse(e));return t.every(e=>Object.keys(e).length===1&&cb(e,`const`))?{enum:t.map(e=>e.const)}:{anyOf:t}}traverseAllows=(e,t)=>this.branches.some(n=>n.traverseAllows(e,t));traverseApply=(e,t)=>{let n=[];for(let r=0;r<this.branches.length;r++){if(t.pushBranch(),this.branches[r].traverseApply(e,t),!t.hasError())return this.branches[r].includesTransform?t.queuedMorphs.push(...t.popBranch().queuedMorphs):t.popBranch();n.push(t.popBranch().error)}t.errorFromNodeContext({code:`union`,errors:n,meta:this.meta})};traverseOptimistic=e=>{for(let t=0;t<this.branches.length;t++){let n=this.branches[t];if(n.traverseAllows(e))return n.contextFreeMorph?n.contextFreeMorph(e):e}return vb};compile(e){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(e);let t=this.discriminant.optionallyChainedPropString;this.discriminant.kind===`domain`&&(t=`typeof ${t} === "object" ? ${t} === null ? "null" : "object" : typeof ${t} === "function" ? "object" : typeof ${t}`);let n=this.discriminant.cases,r=Object.keys(n),{optimistic:i}=e;if(e.optimistic=!1,e.block(`switch(${t})`,()=>{for(let t in n){let r=n[t],a=t==="default"?t:`case ${t}`,o;o=r===!0?i?`data`:`true`:i?r.rootApplyStrategy===`branchedOptimistic`?e.invoke(r,{kind:`Optimistic`}):r.contextFreeMorph?`${e.invoke(r)} ? ${Gx(r.contextFreeMorph)}(data) : "${vb}"`:`${e.invoke(r)} ? data : "${vb}"`:e.invoke(r),e.line(`${a}: return ${o}`)}return e}),e.traversalKind===`Allows`){e.return(i?`"${vb}"`:!1);return}let a=Uw(this.discriminant.kind===`domain`?r.map(e=>{let t=e.slice(1,-1);return t===`function`?Qy.object:Qy[t]}):r),o=this.discriminant.path.map(e=>typeof e==`symbol`?Gx(e):JSON.stringify(e)),s=JSON.stringify(a),c=this.discriminant.kind===`domain`?`${Lw}[${t}]`:`${Rw}(${t})`;e.line(`ctx.errorFromNodeContext({
|
|
28
|
-
code: "predicate",
|
|
29
|
-
expected: ${s},
|
|
30
|
-
actual: ${c},
|
|
31
|
-
relativePath: [${o}],
|
|
32
|
-
meta: ${this.compiledMeta}
|
|
33
|
-
})`)}compileIndiscriminable(e){if(e.traversalKind===`Apply`){e.const(`errors`,`[]`);for(let t of this.branches)e.line(`ctx.pushBranch()`).line(e.invoke(t)).if(`!ctx.hasError()`,()=>e.return(t.includesTransform?`ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)`:`ctx.popBranch()`)).line(`errors.push(ctx.popBranch().error)`);e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{let{optimistic:t}=e;e.optimistic=!1;for(let n of this.branches)e.if(`${e.invoke(n)}`,()=>e.return(t?n.contextFreeMorph?`${Gx(n.contextFreeMorph)}(data)`:`data`:!0));e.return(t?`"${vb}"`:!1)}}get nestableExpression(){return this.isBoolean?`boolean`:`(${this.expression})`}discriminate(){if(this.branches.length<2)return null;if(this.unitBranches.length===this.branches.length)return{kind:`unit`,path:[],optionallyChainedPropString:`data`,cases:ab(this.unitBranches,(e,t)=>[`${t.rawIn.serializedValue}`,!t.hasKind(`morph`)||t])};let e=[];for(let t=0;t<this.branches.length-1;t++){let n=this.branches[t];for(let r=t+1;r<this.branches.length;r++){let i=this.branches[r],a=KS(n.rawIn,i.rawIn,n.$);if(a instanceof VS)for(let n of a){if(!n.kind||n.optional)continue;let i,a;if(n.kind===`domain`){let e=n.l,t=n.r;i=`"${typeof e==`string`?e:e.domain}"`,a=`"${typeof t==`string`?t:t.domain}"`}else if(n.kind===`unit`)i=n.l.serializedValue,a=n.r.serializedValue;else continue;let o=e.find(e=>Yy(e.path,n.path)&&e.kind===n.kind);o?(o.cases[i]?o.cases[i].branchIndices=qy(o.cases[i].branchIndices,t):o.cases[i]??={branchIndices:[t],condition:n.l},o.cases[a]?o.cases[a].branchIndices=qy(o.cases[a].branchIndices,r):o.cases[a]??={branchIndices:[r],condition:n.r}):e.push({kind:n.kind,cases:{[i]:{branchIndices:[t],condition:n.l},[a]:{branchIndices:[r],condition:n.r}},path:n.path})}}}let t=this.ordered?Pw(e,this.branches):e;if(!t.length)return null;let n=Mw(t,this),r={};for(let e in n.best.cases){let t=Nw(n,e);if(t===null){r[e]=!0;continue}if(t.length===this.branches.length)return null;this.ordered&&t.sort((e,t)=>e.originalIndex-t.originalIndex);let i=t.map(e=>e.branch),a=i.length===1?i[0]:this.$.node(`union`,this.ordered?{branches:i,ordered:!0}:i);Object.assign(this.referencesById,a.referencesById),r[e]=a}if(n.defaultEntries.length){let e=n.defaultEntries.map(e=>e.branch);r.default=this.$.node(`union`,this.ordered?{branches:e,ordered:!0}:e,{prereduced:!0}),Object.assign(this.referencesById,r.default.referencesById)}return Object.assign(n.location,{cases:r})}},Mw=(e,t)=>{let n=e.sort((e,t)=>e.path.length===t.path.length?Object.keys(t.cases).length-Object.keys(e.cases).length:e.path.length-t.path.length)[0];return{best:n,location:{kind:n.kind,path:n.path,optionallyChainedPropString:Iw(n.path)},defaultEntries:t.branches.map((e,t)=>({originalIndex:t,branch:e})),node:t}},Nw=(e,t)=>{let n=e.best.cases[t],r=Fw(n.condition,e.location.path,e.node.$),i=[],a=[];for(let t=0;t<e.defaultEntries.length;t++){let o=e.defaultEntries[t];if(n.branchIndices.includes(o.originalIndex)){let t=qw(e.node.branches[o.originalIndex],e.location);t===null?i=null:i?.push({originalIndex:o.originalIndex,branch:t})}else if(o.branch.hasKind(`alias`)&&r.hasKind(`domain`)&&r.domain===`object`)i?.push(o);else{if(o.branch.rawIn.overlaps(r)){let t=qw(o.branch,e.location);i?.push({originalIndex:o.originalIndex,branch:t})}a.push(o)}}return e.defaultEntries=a,i},Pw=(e,t)=>e.filter(e=>{let n=Object.values(e.cases).map(e=>e.branchIndices);for(let e=0;e<n.length-1;e++){let r=n[e];for(let i=e+1;i<n.length;i++){let e=n[i];for(let n of r)for(let r of e)if(n>r&&t[n].overlaps(t[r]))return!1}}return!0}),Fw=(e,t,n)=>{let r=e===`undefined`?n.node(`unit`,{unit:void 0}):e===`null`?n.node(`unit`,{unit:null}):e===`boolean`?n.units([!0,!1]):e;for(let e=t.length-1;e>=0;e--){let i=t[e];r=n.node(`intersection`,typeof i==`number`?{proto:`Array`,sequence:[...Uy(i).map(e=>({})),r]}:{domain:`object`,required:[{key:i,value:r}]})}return r},Iw=e=>e.reduce((e,t)=>e+Jx(t,!0),`data`),Lw=Gx($y),Rw=Gx(Dx),zw={implementation:Aw,Node:jw},Bw=e=>({kind:e.kind,path:e.path.map(e=>typeof e==`string`?e:qx(e)),cases:ab(e.cases,(e,t)=>[e,t===!0?t:t.hasKind(`union`)&&t.discriminantJson?t.discriminantJson:t.json])}),Vw={delimiter:` | `,finalDelimiter:` | `},Hw=e=>Uw(e,Vw),Uw=(e,t)=>{let n=t?.delimiter??`, `,r=t?.finalDelimiter??` or `;if(e.length===0)return`never`;if(e.length===1)return e[0];if(e.length===2&&e[0]===`false`&&e[1]===`true`||e[0]===`true`&&e[1]===`false`)return`boolean`;let i={},a=e.filter(e=>i[e]?!1:i[e]=!0),o=a.pop();return`${a.join(n)}${a.length?r:``}${o}`},Ww=(e,t,n)=>{let r=t.map(()=>[]);for(let i=0;i<e.length;i++){let a={};for(let o=0;o<t.length;o++){if(r[o]===null)continue;if(e[i].equals(t[o])){r[o]=null,a={};break}let s=JS(e[i],t[o],n);if(!(s instanceof VS)){if(s.equals(e[i])){r[o].push(e[i]),a={};break}s.equals(t[o])?r[o]=null:a[o]=s}}for(let e in a)r[e][i]=a[e]}let i=r.flatMap((e,n)=>e?.flatMap(e=>e.branches)??t[n]);return i.length===0?VS.init(`union`,e,t):i},Gw=({branches:e,ordered:t})=>{if(e.length<2)return e;let n=e.map(()=>!0);for(let r=0;r<e.length;r++)for(let i=r+1;i<e.length&&n[r]&&n[i];i++){if(e[r].equals(e[i])){n[i]=!1;continue}let a=KS(e[r].rawIn,e[i].rawIn,e[0].$);a instanceof VS||(t||Kw(e[r],e[i]),a.equals(e[r].rawIn)?n[r]=!!t:a.equals(e[i].rawIn)&&(n[i]=!1))}return e.filter((e,t)=>n[t])},Kw=(e,t)=>{(e.includesTransform||t.includesTransform)&&(Yy(e.shallowMorphs,t.shallowMorphs)||q(Jw(e.expression,t.expression)),Yy(e.flatMorphs,t.flatMorphs,{isEqual:(e,t)=>e.propString===t.propString&&(e.node.hasKind(`morph`)&&t.node.hasKind(`morph`)?e.node.hasEqualMorphs(t.node):e.node.hasKind(`intersection`)&&t.node.hasKind(`intersection`)?e.node.structure?.structuralMorphRef===t.node.structure?.structuralMorphRef:!1)})||q(Jw(e.expression,t.expression)))},qw=(e,t)=>e.transform((e,t)=>e===`domain`||e===`unit`?null:t,{shouldTransform:(e,n)=>{let r=Iw(n.path);return t.optionallyChainedPropString.startsWith(r)?e.hasKind(`domain`)&&e.domain===`object`||(e.hasKind(`domain`)||t.kind===`unit`)&&r===t.optionallyChainedPropString?!0:e.children.length!==0&&e.kind!==`index`:!1}}),Jw=(e,t)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
34
|
-
Left: ${e}
|
|
35
|
-
Right: ${t}`,Yw=(e,t)=>`The intersection of two ordered unions is indeterminate:
|
|
36
|
-
Left: ${e}
|
|
37
|
-
Right: ${t}`,Xw={implementation:_S({kind:`unit`,hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:e=>e instanceof Date?e.toISOString():hS(e)}},normalize:e=>e,defaults:{description:e=>Dx(e.unit),problem:({expected:e,actual:t})=>`${e===t?`must be reference equal to ${e} (serialized to the same value)`:`must be ${e} (was ${t})`}`},intersections:{unit:(e,t)=>VS.init(`unit`,e,t),...hw(`unit`,(e,t)=>{if(t.allows(e.unit))return e;let n=t.hasKind(`intersection`)?t.basis:t;if(n){let t=n.hasKind(`domain`)?n:J.intrinsic.object;if(e.domain!==t.domain){let n=e.domain===`undefined`||e.domain===`null`||e.domain===`boolean`?e.domain:J.intrinsic[e.domain];return VS.init(`domain`,n,t)}}return VS.init(`assignability`,e,t.hasKind(`intersection`)?t.children.find(t=>!t.allows(e.unit)):t)})}}),Node:class extends Sw{compiledValue=this.json.unit;serializedValue=typeof this.unit==`string`||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Zw(this.unit,this.serializedValue);compiledNegation=Zw(this.unit,this.serializedValue,`negated`);expression=Dx(this.unit);domain=Zy(this.unit);get defaultShortDescription(){return this.domain===`object`?Qy.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:`null`}:J.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:`unit`,base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}},Zw=(e,t,n)=>{if(e instanceof Date){let e=`data instanceof Date && data.toISOString() === ${t}`;return n?`!(${e})`:e}return Number.isNaN(e)?`${n?`!`:``}Number.isNaN(data)`:`data ${n?`!`:`=`}== ${t}`},Qw={implementation:_S({kind:`index`,hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(e,t)=>{let n=t.$.parseSchema(e);if(!n.extends(J.intrinsic.key))return q(eT(n.expression));let r=n.branches.filter(e=>e.hasKind(`unit`));return r.length?q($w(r.map(e=>Dx(e.unit)))):n}},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`[${e.signature.expression}]: ${e.value.description}`},intersections:{index:(e,t,n)=>{if(e.signature.equals(t.signature)){let r=JS(e.value,t.value,n),i=r instanceof VS?J.intrinsic.never.internal:r;return n.$.node(`index`,{signature:e.signature,value:i})}return e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:null}}}),Node:class extends $S{impliedBasis=J.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Wy(this.value.flatRefs.map(e=>LS([this.signature,...e.path],e.node)),LS([this.signature],this.value));traverseAllows=(e,t)=>hb(e).every(e=>!this.signature.traverseAllows(e[0],t)||AS(e[0],()=>this.value.traverseAllows(e[1],t),t));traverseApply=(e,t)=>{for(let n of hb(e))this.signature.traverseAllows(n[0],t)&&AS(n[0],()=>this.value.traverseApply(n[1],t),t)};_transform(e,t){t.path.push(this.signature);let n=super._transform(e,t);return t.path.pop(),n}compile(){}}},$w=e=>`Index keys ${e.join(`, `)} should be specified as named props.`,eT=e=>`Indexed key definition '${e}' must be a string or symbol`,tT={implementation:_S({kind:`required`,hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`${e.compiledKey}: ${e.value.description}`,expected:e=>e.missingValueDescription,actual:()=>`missing`},intersections:{required:XC,optional:XC}}),Node:class extends ZC{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:`required`,missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=gS(this.errorContext)}},nT=_S({kind:`sequence`,hasAssociatedError:!1,collapsibleKey:`variadic`,keys:{prefix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},optionals:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},defaultables:{child:e=>e.map(e=>e[0]),parse:(e,t)=>{if(e.length!==0)return e.map(e=>{let n=t.$.parseSchema(e[0]);return rw(n,e[1],null),[n,e[1]]})},serialize:e=>e.map(e=>[e[0].collapsibleJson,hS(e[1])]),reduceIo:(e,t,n)=>{if(e===`in`){t.optionals=n.map(e=>e[0].rawIn);return}t.prefix=n.map(e=>e[0].rawOut)}},variadic:{child:!0,parse:(e,t)=>t.$.parseSchema(e,t)},minVariadicLength:{parse:e=>e===0?void 0:e},postfix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}}},normalize:e=>{if(typeof e==`string`)return{variadic:e};if(`variadic`in e||`prefix`in e||`defaultables`in e||`optionals`in e||`postfix`in e||`minVariadicLength`in e){if(e.postfix?.length){if(!e.variadic)return q(uT);if(e.optionals?.length||e.defaultables?.length)return q(lT)}return e.minVariadicLength&&!e.variadic?q(`minVariadicLength may not be specified without a variadic element`):e}return{variadic:e}},reduce:(e,t)=>{let n=e.minVariadicLength??0,r=e.prefix?.slice()??[],i=e.defaultables?.slice()??[],a=e.optionals?.slice()??[],o=e.postfix?.slice()??[];if(e.variadic){for(;a[a.length-1]?.equals(e.variadic);)a.pop();if(a.length===0&&i.length===0)for(;r[r.length-1]?.equals(e.variadic);)r.pop(),n++;for(;o[0]?.equals(e.variadic);)o.shift(),n++}else a.length===0&&i.length===0&&r.push(...o.splice(0));if(n!==e.minVariadicLength||e.prefix&&e.prefix.length!==r.length)return t.node(`sequence`,{...e,prefix:r,defaultables:i,optionals:a,postfix:o,minVariadicLength:n},{prereduced:!0})},defaults:{description:e=>e.isVariadicOnly?`${e.variadic.nestableExpression}[]`:`[${e.tuple.map(e=>e.kind===`defaultables`?`${e.node.nestableExpression} = ${Dx(e.default)}`:e.kind===`optionals`?`${e.node.nestableExpression}?`:e.kind===`variadic`?`...${e.node.nestableExpression}[]`:e.node.expression).join(`, `)}]`},intersections:{sequence:(e,t,n)=>{let r=dT({l:e.tuple,r:t.tuple,disjoint:new VS,result:[],fixedVariants:[],ctx:n}),i=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return i.length===0?r.disjoint:i.length===1?n.$.node(`sequence`,cT(i[0].result)):n.$.node(`union`,i.map(e=>({proto:Array,sequence:cT(e.result)})))}}}),rT=class extends $S{impliedBasis=J.intrinsic.Array.internal;tuple=sT(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind===`defaultables`||e.kind===`optionals`?(this.defaultablesAndOptionals.push(e.node),!0):e.kind===`prefix`);variadicOrPostfix=Gy(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return zS(this.flatRefs,this.prevariadic.flatMap((e,t)=>Wy(e.node.flatRefs.map(e=>LS([`${t}`,...e.path],e.node)),LS([`${t}`],e.node)))),zS(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Wy(e.flatRefs.map(e=>LS([J.intrinsic.nonNegativeIntegerString.internal,...e.path],e.node)),LS([J.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node(`minLength`,this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node(`maxLength`,this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=aT(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Gx(this.defaultValueMorphs):void 0;elementAtIndex(e,t){if(t<this.prevariadic.length)return this.tuple[t];let n=e.length-this.postfixLength;return t>=n?{kind:`postfix`,node:this.postfix[t-n]}:{kind:`variadic`,node:this.variadic??tb(`Unexpected attempt to access index ${t} on ${this}`)}}traverseAllows=(e,t)=>{for(let n=0;n<e.length;n++)if(!this.elementAtIndex(e,n).node.traverseAllows(e[n],t))return!1;return!0};traverseApply=(e,t)=>{let n=0;for(;n<e.length;n++)AS(n,()=>this.elementAtIndex(e,n).node.traverseApply(e[n],t),t)};get element(){return this.cacheGetter(`element`,this.$.node(`union`,this.children))}compile(e){if(this.prefix)for(let[t,n]of this.prefix.entries())e.traverseKey(`${t}`,`data[${t}]`,n);for(let[t,n]of this.defaultablesAndOptionals.entries()){let r=`${t+this.prefixLength}`;e.if(`${r} >= data.length`,()=>e.traversalKind===`Allows`?e.return(!0):e.return()),e.traverseKey(r,`data[${r}]`,n)}if(this.variadic&&(this.postfix&&e.const(`firstPostfixIndex`,`data.length${this.postfix?`- ${this.postfix.length}`:``}`),e.for(`i < ${this.postfix?`firstPostfixIndex`:`data.length`}`,()=>e.traverseKey(`i`,`data[i]`,this.variadic),this.prevariadic.length),this.postfix))for(let[t,n]of this.postfix.entries()){let r=`firstPostfixIndex + ${t}`;e.traverseKey(r,`data[${r}]`,n)}e.traversalKind===`Allows`&&e.return(!0)}_transform(e,t){t.path.push(J.intrinsic.nonNegativeIntegerString.internal);let n=super._transform(e,t);return t.path.pop(),n}expression=this.description;reduceJsonSchema(e,t){let n=t.target===`draft-07`;if(this.prevariadic.length){let r=this.prevariadic.map(e=>{let n=e.node.toJsonSchemaRecurse(t);if(e.kind===`defaultables`){let r=typeof e.default==`function`?e.default():e.default;n.default=J.intrinsic.jsonData.allows(r)?r:t.fallback.defaultValue({code:`defaultValue`,base:n,value:r})}return n});n?e.items=r:e.prefixItems=r}if(this.minLength&&(e.minItems=this.minLength),this.variadic){let r=this.variadic.toJsonSchemaRecurse(t);if(n&&this.prevariadic.length?e.additionalItems=r:e.items=r,this.maxLength&&(e.maxItems=this.maxLength),this.postfix){let n=this.postfix.map(e=>e.toJsonSchemaRecurse(t));e=t.fallback.arrayPostfix({code:`arrayPostfix`,base:e,elements:n})}}else n?e.additionalItems=!1:e.items=!1,delete e.maxItems;return e}},iT={},aT=e=>{if(!e.defaultables)return[];let t=[],n=`[`,r=e.prefixLength+e.defaultablesLength-1;for(let i=e.prefixLength;i<=r;i++){let[r,a]=e.defaultables[i-e.prefixLength];t.push(nw(i,r,a)),n+=`${i}: ${r.id} = ${hS(a)}, `}return n+=`]`,iT[n]??=t},oT={implementation:nT,Node:rT},sT=e=>{let t=[];if(e.prefix)for(let n of e.prefix)t.push({kind:`prefix`,node:n});if(e.defaultables)for(let[n,r]of e.defaultables)t.push({kind:`defaultables`,node:n,default:r});if(e.optionals)for(let n of e.optionals)t.push({kind:`optionals`,node:n});if(e.variadic&&t.push({kind:`variadic`,node:e.variadic}),e.postfix)for(let n of e.postfix)t.push({kind:`postfix`,node:n});return t},cT=e=>e.reduce((e,t)=>(t.kind===`variadic`?e.variadic=t.node:t.kind===`defaultables`?e.defaultables=Wy(e.defaultables,[[t.node,t.default]]):e[t.kind]=Wy(e[t.kind],t.node),e),{}),lT=`A postfix required element cannot follow an optional or defaultable element`,uT=`A postfix element requires a variadic element`,dT=e=>{let[t,...n]=e.l,[r,...i]=e.r;if(!t||!r)return e;let a=n[n.length-1]?.kind===`postfix`,o=i[i.length-1]?.kind===`postfix`,s=t.kind===`prefix`||r.kind===`prefix`?`prefix`:t.kind===`postfix`||r.kind===`postfix`?`postfix`:t.kind===`variadic`&&r.kind===`variadic`?`variadic`:a||o?`prefix`:t.kind===`defaultables`||r.kind===`defaultables`?`defaultables`:`optionals`;if(t.kind===`prefix`&&r.kind===`variadic`&&o){let t=dT({...e,fixedVariants:[],r:i.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}else if(r.kind===`prefix`&&t.kind===`variadic`&&a){let t=dT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}let c=JS(t.node,r.node,e.ctx);if(c instanceof VS){if(s===`prefix`||s===`postfix`)e.disjoint.push(...c.withPrefixKey(s===`prefix`?e.result.length:`-${n.length+1}`,fT(t)&&fT(r)?`required`:`optional`)),e.result=[...e.result,{kind:s,node:J.intrinsic.never.internal}];else if(s===`optionals`||s===`defaultables`)return e;else return dT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`})),r:n.map(e=>({...e,kind:`prefix`}))})}else s===`defaultables`?(t.kind===`defaultables`&&r.kind===`defaultables`&&t.default!==r.default&&q(QC(t.default,r.default)),e.result=[...e.result,{kind:s,node:c,default:t.kind===`defaultables`?t.default:r.kind===`defaultables`?r.default:tb(`Unexpected defaultable intersection from ${t.kind} and ${r.kind} elements.`)}]):e.result=[...e.result,{kind:s,node:c}];let l=e.l.length,u=e.r.length;return(t.kind!==`variadic`||l>=u&&(r.kind===`variadic`||u===1))&&(e.l=n),(r.kind!==`variadic`||u>=l&&(t.kind===`variadic`||l===1))&&(e.r=i),dT(e)},fT=e=>e.kind===`prefix`||e.kind===`postfix`,pT=e=>t=>{if(t.props.length||t.index){let n=t.index?.map(t=>t[e])??[];for(let r of t.props)n.push(r[e]);t.undeclared&&n.push(`+ (undeclared): ${t.undeclared}`);let r=`{ ${n.join(`, `)} }`;return t.sequence?`${r} & ${t.sequence.description}`:r}return t.sequence?.description??`{}`},mT=pT(`description`),hT=pT(`expression`),gT=(e,t,n)=>{let r=e.required?`required`:`optional`;if(!t.signature.allows(e.key))return null;let i=KS(e.value,t.value,n);return i instanceof VS?r===`optional`?n.node(`optional`,{key:e.key,value:J.intrinsic.never.internal}):i.withPrefixKey(e.key,e.kind):null},_T=_S({kind:`structure`,hasAssociatedError:!1,normalize:e=>e,applyConfig:(e,t)=>!e.undeclared&&t.onUndeclaredKey!==`ignore`?{...e,undeclared:t.onUndeclaredKey}:e,keys:{required:{child:!0,parse:tC(`required`),reduceIo:(e,t,n)=>{t.required=Wy(t.required,n.map(t=>e===`in`?t.rawIn:t.rawOut))}},optional:{child:!0,parse:tC(`optional`),reduceIo:(e,t,n)=>{if(e===`in`){t.optional=n.map(e=>e.rawIn);return}for(let e of n)t[e.outProp.kind]=Wy(t[e.outProp.kind],e.outProp.rawOut)}},index:{child:!0,parse:tC(`index`)},sequence:{child:!0,parse:tC(`sequence`)},undeclared:{parse:e=>e===`ignore`?void 0:e,reduceIo:(e,t,n)=>{if(n===`reject`){t.undeclared=`reject`;return}e===`in`?delete t.undeclared:t.undeclared=`reject`}}},defaults:{description:mT},intersections:{structure:(e,t,n)=>{let r={...e.inner},i={...t.inner},a=new VS;if(e.undeclared){let r=e.keyof();for(let e of t.requiredKeys)r.allows(e)||a.add(`presence`,J.intrinsic.never.internal,t.propsByKey[e].value,{path:[e]});i.optional&&=i.optional.filter(e=>r.allows(e.key)),i.index&&=i.index.flatMap(e=>{if(e.signature.extends(r))return e;let t=KS(r,e.signature,n.$);if(t instanceof VS)return[];let a=ET(t,e.value,n.$);return a.required&&(i.required=Gy(i.required,a.required)),a.optional&&(i.optional=Gy(i.optional,a.optional)),a.index??[]})}if(t.undeclared){let i=t.keyof();for(let t of e.requiredKeys)i.allows(t)||a.add(`presence`,e.propsByKey[t].value,J.intrinsic.never.internal,{path:[t]});r.optional&&=r.optional.filter(e=>i.allows(e.key)),r.index&&=r.index.flatMap(e=>{if(e.signature.extends(i))return e;let t=KS(i,e.signature,n.$);if(t instanceof VS)return[];let a=ET(t,e.value,n.$);return a.required&&(r.required=Gy(r.required,a.required)),a.optional&&(r.optional=Gy(r.optional,a.optional)),a.index??[]})}let o={};(e.undeclared||t.undeclared)&&(o.undeclared=e.undeclared===`reject`||t.undeclared===`reject`?`reject`:`delete`);let s=nC({kind:`structure`,baseInner:o,l:rC(r),r:rC(i),roots:[],ctx:n});return s instanceof VS&&a.push(...s),a.length?a:s}},reduce:(e,t)=>{if(!e.required&&!e.optional)return;let n=Object.create(null),r=!1,i=e.optional?[...e.optional]:[];if(e.required)for(let r=0;r<e.required.length;r++){let i=e.required[r];if(i.key in n&&q(kT(i.key)),n[i.key]=!0,e.index)for(let n of e.index){let e=gT(i,n,t);if(e instanceof VS)return e}}if(e.optional)for(let a=0;a<e.optional.length;a++){let o=e.optional[a];if(o.key in n&&q(kT(o.key)),n[o.key]=!0,e.index)for(let n of e.index){let e=gT(o,n,t);if(e instanceof VS)return e;e!==null&&(i[a]=e,r=!0)}}if(r)return t.node(`structure`,{...e,optional:i},{prereduced:!0})}}),vT=class extends $S{impliedBasis=J.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=Gy(this.required,this.optional);propsByKey=ab(this.props,(e,t)=>[t.key,t]);propsByKeyReference=Gx(this.propsByKey);expression=hT(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:t}of this.index)e=e.concat(t.branches);return this._keyof=this.$.node(`union`,e)}map(e){return this.$.node(`structure`,this.props.flatMap(e).reduce((e,t)=>{let n=this.propsByKey[t.key];if(tS(t))return t.kind!==`required`&&t.kind!==`optional`?q(`Map result must have kind "required" or "optional" (was ${t.kind})`):(e[t.kind]=Wy(e[t.kind],t),e);let r=t.kind??n?.kind??`required`,i=ab(t,(e,t)=>e in $C.implementation.keys?[e,t]:[]);return e[r]=Wy(e[r],this.$.node(r,i)),e},{}))}assertHasKeys(e){let t=e.filter(e=>!dw(e,this.keyof()));if(t.length)return q(OT(this.expression,t))}get(e,...t){let n,r=!1,i=wT(e);if((typeof i==`string`||typeof i==`symbol`)&&this.propsByKey[i]&&(n=this.propsByKey[i].value,r=this.propsByKey[i].required),this.index)for(let e of this.index)dw(i,e.signature)&&(n=n?.and(e.value)??e.value);if(this.sequence&&dw(i,J.intrinsic.nonNegativeIntegerString)){if(eS(i,`root`))this.sequence.variadic&&(n=n?.and(this.sequence.element)??this.sequence.element);else{let e=Number.parseInt(i);if(e<this.sequence.prevariadic.length){let t=this.sequence.prevariadic[e].node;n=n?.and(t)??t,r||=e<this.sequence.prefixLength}else if(this.sequence.variadic){let e=this.$.node(`union`,this.sequence.variadicOrPostfix);n=n?.and(e)??e}}}if(!n)return this.sequence?.variadic&&eS(i,`root`)&&i.extends(J.intrinsic.number)?q(TT(i.expression,this.sequence.expression)):q(OT(this.expression,[i]));let a=n.get(...t);return r?a:a.or(J.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`pick`,e))}omit(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`omit`,e))}optionalize(){let{required:e,...t}=this.inner;return this.$.node(`structure`,{...t,optional:this.props.map(e=>e.hasKind(`required`)?this.$.node(`optional`,e.inner):e)})}require(){let{optional:e,...t}=this.inner;return this.$.node(`structure`,{...t,required:this.props.map(e=>e.hasKind(`optional`)?{key:e.key,value:e.value}:e)})}merge(e){let t=this.filterKeys(`omit`,[e.keyof()]);return e.required&&(t.required=Wy(t.required,e.required)),e.optional&&(t.optional=Wy(t.optional,e.optional)),e.index&&(t.index=Wy(t.index,e.index)),e.sequence&&(t.sequence=e.sequence),e.undeclared?t.undeclared=e.undeclared:delete t.undeclared,this.$.node(`structure`,t)}filterKeys(e,t){let n=Qx(this.inner),r=n=>{let r=t.some(e=>dw(n,e));return e===`pick`?r:!r};return n.required&&=n.required.filter(e=>r(e.key)),n.optional&&=n.optional.filter(e=>r(e.key)),n.index&&=n.index.filter(e=>r(e.signature)),n}traverseAllows=(e,t)=>this._traverse(`Allows`,e,t);traverseApply=(e,t)=>this._traverse(`Apply`,e,t);_traverse=(e,t,n)=>{let r=n?.currentErrorCount??0;for(let i=0;i<this.props.length;i++)if(e===`Allows`){if(!this.props[i].traverseAllows(t,n))return!1}else if(this.props[i].traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1;if(this.sequence){if(e===`Allows`){if(!this.sequence.traverseAllows(t,n))return!1}else if(this.sequence.traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1}if(this.index||this.undeclared===`reject`){let i=Object.keys(t);i.push(...Object.getOwnPropertySymbols(t));for(let a=0;a<i.length;a++){let o=i[a];if(this.index){for(let i of this.index)if(i.signature.traverseAllows(o,n)){if(e===`Allows`){if(!AS(o,()=>i.value.traverseAllows(t[o],n),n))return!1}else if(AS(o,()=>i.value.traverseApply(t[o],n),n),n.failFast&&n.currentErrorCount>r)return!1}}if(this.undeclared===`reject`&&!this.declaresKey(o)&&(e===`Allows`||(n.errorFromNodeContext({code:`predicate`,expected:`removed`,actual:``,relativePath:[o],meta:this.meta}),n.failFast)))return!1}}return this.structuralMorph&&n&&!n.hasError()&&n.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter(`defaultable`,this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(t=>t.signature.allows(e))||this.sequence!==void 0&&J.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){let t=[];if(this.props.length&&t.push(`k in ${this.propsByKeyReference}`),this.index)for(let n of this.index)t.push(e.invoke(n.signature,{kind:`Allows`,arg:`k`}));return this.sequence&&t.push(`$ark.intrinsic.nonNegativeIntegerString.allows(k)`),t.join(` || `)||`false`}get structuralMorph(){return this.cacheGetter(`structuralMorph`,xT(this))}structuralMorphRef=this.structuralMorph&&Gx(this.structuralMorph);compile(e){e.traversalKind===`Apply`&&e.initializeErrorCount();for(let t of this.props)e.check(t),e.traversalKind===`Apply`&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind===`Apply`&&e.returnIfFailFast()),(this.index||this.undeclared===`reject`)&&(e.const(`keys`,`Object.keys(data)`),e.line(`keys.push(...Object.getOwnPropertySymbols(data))`),e.for(`i < keys.length`,()=>this.compileExhaustiveEntry(e))),e.traversalKind===`Allows`)return e.return(!0);this.structuralMorphRef&&e.if(`ctx && !ctx.hasError()`,()=>(e.line(`ctx.queueMorphs([`),ST(e,this),e.line(`])`)))}compileExhaustiveEntry(e){if(e.const(`k`,`keys[i]`),this.index)for(let t of this.index)e.if(`${e.invoke(t.signature,{arg:`k`,kind:`Allows`})}`,()=>e.traverseKey(`k`,`data[k]`,t.value));return this.undeclared===`reject`&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind===`Allows`?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if(`ctx.failFast`,()=>e.return())),e}reduceJsonSchema(e,t){switch(e.type){case`object`:return this.reduceObjectJsonSchema(e,t);case`array`:let n=this.sequence?.reduceJsonSchema(e,t)??e;return this.props.length||this.index?t.fallback.arrayObject({code:`arrayObject`,base:n,object:this.reduceObjectJsonSchema({type:`object`},t)}):n;default:return vS.throwInternalOperandError(`structure`,e)}}reduceObjectJsonSchema(e,t){if(this.props.length){e.properties={};for(let n of this.props){let r=n.value.toJsonSchemaRecurse(t);if(typeof n.key==`symbol`){t.fallback.symbolKey({code:`symbolKey`,base:e,key:n.key,value:r,optional:n.optional});continue}if(n.hasDefault()){let e=typeof n.default==`function`?n.default():n.default;r.default=J.intrinsic.jsonData.allows(e)?e:t.fallback.defaultValue({code:`defaultValue`,base:r,value:e})}e.properties[n.key]=r}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(t=>typeof t==`string`&&t in e.properties))}if(this.index)for(let n of this.index){let r=n.value.toJsonSchemaRecurse(t);if(n.signature.equals(J.intrinsic.string)){e.additionalProperties=r;continue}for(let i of n.signature.branches){if(!i.extends(J.intrinsic.string)){e=t.fallback.symbolKey({code:`symbolKey`,base:e,key:null,value:r,optional:!1});continue}let n={type:`string`};if(i.hasKind(`morph`)&&(n=t.fallback.morph({code:`morph`,base:i.rawIn.toJsonSchemaRecurse(t),out:i.rawOut.toJsonSchemaRecurse(t)})),!i.hasKind(`intersection`))return tb(`Unexpected index branch kind ${i.kind}.`);let{pattern:a}=i.inner;if(a){let i=Object.assign(n,{pattern:a[0].rule});for(let e=1;e<a.length;e++)n=t.fallback.patternIntersection({code:`patternIntersection`,base:i,pattern:a[e].rule});e.patternProperties??={},e.patternProperties[i.pattern]=r}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}},yT={},bT=e=>{let t=``;for(let n=0;n<e.defaultable.length;n++)t+=e.defaultable[n].defaultValueMorphRef;if(e.sequence?.defaultValueMorphsReference&&(t+=e.sequence?.defaultValueMorphsReference),e.undeclared===`delete`){if(t+=`delete !(`,e.required)for(let n of e.required)t+=n.compiledKey+` | `;if(e.optional)for(let n of e.optional)t+=n.compiledKey+` | `;if(e.index)for(let n of e.index)t+=n.signature.id+` | `;if(e.sequence){if(e.sequence.maxLength===null)t+=sE.nonNegativeIntegerString.id;else for(let n=0;n<e.sequence.tuple.length;n++)t+=n+` | `}t+=`)`}return t},xT=e=>{let t=bT(e);return t?yT[t]?yT[t]:yT[t]=(t,n)=>{for(let r=0;r<e.defaultable.length;r++)e.defaultable[r].key in t||e.defaultable[r].defaultValueMorph(t,n);if(e.sequence?.defaultables)for(let r=t.length-e.sequence.prefixLength;r<e.sequence.defaultables.length;r++)e.sequence.defaultValueMorphs[r](t,n);if(e.undeclared===`delete`)for(let n in t)e.declaresKey(n)||delete t[n];return t}:void 0},ST=(e,t)=>{let n=`(data${t.defaultable.some(e=>e.defaultValueMorph.length===2)||t.sequence?.defaultValueMorphs.some(e=>e.length===2)?`, ctx`:``})`;return e.block(`${n} => `,e=>{for(let r=0;r<t.defaultable.length;r++){let{serializedKey:i,defaultValueMorphRef:a}=t.defaultable[r];e.if(`!(${i} in data)`,e=>e.line(`${a}${n}`))}return t.sequence?.defaultables&&e.for(`i < ${t.sequence.defaultables.length}`,e=>e.line(`${t.sequence.defaultValueMorphsReference}[i]${n}`),`data.length - ${t.sequence.prefixLength}`),t.undeclared===`delete`&&e.forIn(`data`,e=>e.if(`!(${t._compileDeclaresKey(e)})`,e=>e.line(`delete data[k]`))),e.return(`data`)})},CT={implementation:_T,Node:vT},wT=e=>(eS(e,`root`)&&e.hasKind(`unit`)&&(e=e.unit),typeof e==`number`&&(e=`${e}`),e),TT=(e,t)=>`${e} is not allowed as an array index on ${t}. Use the 'nonNegativeIntegerString' keyword instead.`,ET=(e,t,n)=>{let[r,i]=By(e.branches,e=>e.hasKind(`unit`));if(!r.length)return{index:n.node(`index`,{signature:e,value:t})};let a={};for(let e of r){let r=n.node(`required`,{key:e.unit,value:t});a[r.kind]=Wy(a[r.kind],r)}return i.length&&(a.index=n.node(`index`,{signature:i,value:t})),a},DT=e=>eS(e,`root`)?e.expression:Dx(e),OT=(e,t)=>`Key${t.length===1?``:`s`} ${t.map(DT).join(`, `)} ${t.length===1?`does`:`do`} not exist on ${e}`,kT=e=>`Duplicate key ${qx(e)}`,AT={...FC,alias:xw.implementation,domain:Cw.implementation,unit:Xw.implementation,proto:kw.implementation,union:zw.implementation,morph:Dw.implementation,intersection:ww.implementation,divisor:fC.implementation,pattern:LC.implementation,predicate:dC.implementation,required:tT.implementation,optional:$C.implementation,index:Qw.implementation,sequence:oT.implementation,structure:CT.implementation};J.defaultConfig=_b(Object.assign(ab(AT,(e,t)=>[e,t.defaults]),{jitless:Bb(),clone:Pb,onUndeclaredKey:`ignore`,exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:vS.defaultConfig})),J.resolvedConfig=yS(J.defaultConfig,J.config);var jT={...IC,alias:xw.Node,domain:Cw.Node,unit:Xw.Node,proto:kw.Node,union:zw.Node,morph:Dw.Node,intersection:ww.Node,divisor:fC.Node,pattern:LC.Node,predicate:dC.Node,required:tT.Node,optional:$C.Node,index:Qw.Node,sequence:oT.Node,structure:CT.Node},MT=class extends lb{get[$x](){return`module`}},NT=(e,t)=>new MT(ab(e,(e,n)=>[e,eS(n,`module`)?NT(n,t):t.bindReference(n)])),PT=e=>Db(e)?e:`branches`in e&&Db(e.branches)?e.branches:void 0,FT=(e,t)=>q(`Node of kind ${t} is not valid as a ${e} definition`),IT=e=>`#${e} duplicates public alias ${e}`,LT={};J.ambient??={};var RT,zT=`function $`,BT=e=>VT(e,HT(e)),VT=(e,t,n)=>{let r=t.write(zT,4),i=t.compile()();for(let t of e)(!t.precompilation||n&&t.$===n)&&(t.traverseAllows=i[`${t.id}Allows`].bind(i),t.isRoot()&&!t.allowsRequiresContext&&(t.allows=t.traverseAllows),t.traverseApply=i[`${t.id}Apply`].bind(i),i[`${t.id}Optimistic`]&&(t.traverseOptimistic=i[`${t.id}Optimistic`].bind(i)),t.precompilation=r)},HT=e=>new Kx().return(e.reduce((e,t)=>{let n=new Zx({kind:`Allows`}).indent();t.compile(n);let r=n.write(`${t.id}Allows`),i=new Zx({kind:`Apply`}).indent();t.compile(i);let a=`${e}${r},\n${i.write(`${t.id}Apply`)},\n`;if(!t.hasKind(`union`))return a;let o=new Zx({kind:`Allows`,optimistic:!0}).indent();return t.compile(o),`${a}${o.write(`${t.id}Optimistic`)},\n`},`{
|
|
38
|
-
`)+`}`),UT=class{config;resolvedConfig;name;get[$x](){return`scope`}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,t){this.config=yS(J.config,t),this.resolvedConfig=yS(J.resolvedConfig,t),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(LT).length}`,this.name in LT&&q(`A Scope already named ${this.name} already exists`),LT[this.name]=this;let n=Object.entries(e).map(e=>this.preparseOwnAliasEntry(...e));for(let[e,t]of n){let n=e;if(e[0]===`#`?(n=e.slice(1),n in this.aliases&&q(IT(n)),this.aliases[n]=t):(n in this.aliases&&q(IT(e)),this.aliases[n]=t,this.exportedNames.push(n)),!eS(t,`module`)&&!eS(t,`generic`)&&!Lb(t)){let e=this.preparseOwnDefinitionFormat(t,{alias:n});this.resolutions[n]=eS(e,`root`)?this.bindReference(e):this.createParseContext(e).id}}RT??=this.node(`union`,{branches:[`string`,`number`,`object`,`bigint`,`symbol`,{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[RT.hash]=this.node(`intersection`,{},{prereduced:!0}),this.intrinsic=J.intrinsic?ab(J.intrinsic,(e,t)=>e.startsWith(`json`)?[]:[e,this.bindReference(t)]):{}}cacheGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{let t=this;return(n,r)=>new lC(e,r?new cC(n):n,t,t,r??null)};units=(e,t)=>{let n=[];for(let t of e)n.includes(t)||n.push(t);let r=n.map(e=>this.node(`unit`,{unit:e},t));return this.node(`union`,r,{...t,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,t){let n=this.node(`alias`,{reference:t??`synthetic`,resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(n),n}schema=(e,t)=>this.finalize(this.parseSchema(e,t));parseSchema=(e,t)=>this.node(RC(e),e,t);preparseNode(e,t,n){let r=typeof e==`string`?e:RC(t,e);if(tS(t)&&t.kind===r)return t;if(r===`alias`&&!n?.prereduced){let{reference:e}=xw.implementation.normalize(t,this);if(e.startsWith(`$`)){let n=this.resolveRoot(e.slice(1));t=n,r=n.kind}}else if(r===`union`&&Xy(t,`object`)){let e=PT(t);e?.length===1&&(t=e[0],r=RC(t))}if(tS(t)&&t.kind===r)return t;let i=AT[r].normalize?.(t,this)??t;return tS(i)?i.kind===r?i:FT(r,i.kind):{...n,$:this,kind:r,def:i,prefix:n.alias??r}}bindReference(e){let t;return t=tS(e)?e.$===this?e:new e.constructor(e.attachments,this):e.$===this?e:new lC(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,t.referencesById),t}resolveRoot(e){return this.maybeResolveRoot(e)??q(ZT(e))}maybeResolveRoot(e){let t=this.maybeResolve(e);if(!eS(t,`generic`))return t}maybeResolveSubalias(e){return qT(this.aliases,e)??qT(this.ambient,e)}get ambient(){return J.ambient}maybeResolve(e){let t=this.resolutions[e];if(t){if(typeof t!=`string`)return this.bindReference(t);let n=UC[t];if(eS(n,`root`))return this.resolutions[e]=n;if(eS(n,`context`)){if(n.phase===`resolving`)return this.node(`alias`,{reference:`$${e}`},{prereduced:!0});if(n.phase===`resolved`)return tb(`Unexpected resolved context for was uncached by its scope: ${Dx(n)}`);n.phase=`resolving`;let t=this.bindReference(this.parseOwnDefinitionFormat(n.def,n));return n.phase=`resolved`,UC[t.id]=t,UC[n.id]=t,this.resolutions[e]=t}return tb(`Unexpected nodesById entry for ${t}: ${Dx(n)}`)}let n=this.aliases[e]??this.ambient?.[e];return n?(n=this.normalizeRootScopeValue(n),eS(n,`generic`)?this.resolutions[e]=this.bindReference(n):eS(n,`module`)?(n.root||q($T(e)),this.resolutions[e]=this.bindReference(n.root)):this.resolutions[e]=this.parse(n,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){let t=e.id??WC(e.prefix);return UC[t]=Object.assign(e,{[$x]:`context`,$:this,id:t,phase:`unresolved`})}traversal(e){return new kS(e,this.resolvedConfig)}import(...e){return new MT(ab(this.export(...e),(e,t)=>[`#${e}`,t]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(let e of this.exportedNames){let t=this.aliases[e];this._exports[e]=eS(t,`module`)?NT(t,this):GT(this.maybeResolve(e))}for(let e of this.lazyResolutions)e.resolution;if(this._exportedResolutions=XT(this,this._exports),this._json=KT(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let e=HT(this.references);this.precompilation=e.write(zT,4),VT(this.references,e,this)}this.resolved=!0}return new MT(ab(e.length?e:this.exportedNames,(e,t)=>[t,this._exports[t]]))}resolve(e){return this.export()[e]}node=(e,t,n={})=>{let r=this.preparseNode(e,t,n);if(tS(r))return this.bindReference(r);let i=this.createParseContext(r),a=GC(i),o=this.bindReference(a);return UC[i.id]=o};parse=(e,t={})=>this.finalize(this.parseDefinition(e,t));parseDefinition(e,t={}){if(eS(e,`root`))return this.bindReference(e);let n=this.preparseOwnDefinitionFormat(e,t);if(eS(n,`root`))return this.bindReference(n);let r=this.createParseContext(n);UC[r.id]=r;let i=this.bindReference(this.parseOwnDefinitionFormat(e,r));return i.isCyclic&&(i=qC(i,r.id)),UC[r.id]=i,i}finalize(e){return GT(e),!e.precompilation&&!this.resolvedConfig.jitless&&BT(e.references),e}},WT=class extends UT{parseOwnDefinitionFormat(e,t){return GC(t)}preparseOwnDefinitionFormat(e,t){return this.preparseNode(RC(e),e,t)}preparseOwnAliasEntry(e,t){return[e,t]}normalizeRootScopeValue(e){return e}},GT=e=>{let t=e.references.filter(e=>e.hasKind(`alias`));for(let n of t){Object.assign(n.referencesById,n.resolution.referencesById);for(let t of e.references)n.id in t.referencesById&&Object.assign(t.referencesById,n.referencesById)}return e},KT=e=>ab(e,(e,t)=>[e,eS(t,`root`)||eS(t,`generic`)?t.json:eS(t,`module`)?KT(t):tb(`Unexpected resolution ${Dx(t)}`)]),qT=(e,t)=>{let n=t.indexOf(`.`);if(n===-1)return;let r=t.slice(0,n),i=e[r];if(i===void 0)return;if(!eS(i,`module`))return q(QT(r));let a=t.slice(n+1),o=i[a];if(o===void 0)return qT(i,a);if(eS(o,`root`)||eS(o,`generic`))return o;if(eS(o,`module`))return o.root??q($T(t));tb(`Unexpected resolution for alias '${t}': ${Dx(o)}`)},JT=(e,t)=>new WT(e,t),YT=new WT({}),XT=(e,t)=>{let n={};for(let r in t){let i=t[r];if(eS(i,`module`)){let t=ab(XT(e,i),(e,t)=>[`${r}.${e}`,t]);Object.assign(n,t)}else eS(i,`root`)||eS(i,`generic`)?n[r]=i:tb(`Unexpected scope resolution ${Dx(i)}`)}return n},ZT=e=>`'${e}' is unresolvable`,QT=e=>`'${e}' must reference a module to be accessed using dot syntax`,$T=e=>`Reference to submodule '${e}' must specify an alias`;YT.export();var eE=YT.schema,tE=YT.node;YT.defineSchema;var nE=YT.generic,rE=`^(?:0|[1-9]\\d*)$`;Gx(new RegExp(rE));var iE=JT({bigint:`bigint`,boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:`number`,object:`object`,string:`string`,symbol:`symbol`,true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();J.intrinsic={...iE};var aE=JT({integer:{domain:`number`,divisor:1},lengthBoundable:[`string`,Array],key:[`string`,`symbol`],nonNegativeIntegerString:{domain:`string`,pattern:rE}},{prereducedAliases:!0}).export();Object.assign(J.intrinsic,aE);var oE=JT({jsonPrimitive:[`string`,`number`,{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:`object`,index:{signature:`string`,value:`$jsonData`}},jsonData:[`$jsonPrimitive`,`$jsonObject`]},{prereducedAliases:!0}).export(),sE={...iE,...aE,...oE,emptyStructure:tE(`structure`,{},{prereduced:!0})};J.intrinsic={...sE};var cE=((e,t)=>new RegExp(e,t));Object.assign(cE,{as:cE});var lE=e=>typeof e==`string`&&e[0]===`d`&&(e[1]===`'`||e[1]===`"`)&&e[e.length-1]===e[1],uE=e=>e.toString()!==`Invalid Date`,dE=e=>e.slice(2,-1),fE=e=>`'${e}' could not be parsed by the Date constructor`,pE=(e,t)=>mE(e,t),mE=(e,t)=>{let n=new Date(e);if(uE(n))return n;let r=mx(e);if(r!==void 0){let e=new Date(r);if(uE(e))return e}return t?q(t===!0?fE(e):t):void 0},hE=eE({proto:`Array`,sequence:`string`,required:{key:`groups`,value:[`object`,{unit:void 0}]}}),gE=(e,t)=>{let n=e.scanner.shiftUntilEscapable(SE[xE[t]]);if(e.scanner.lookahead===``)return e.error(wE(n,t));if(e.scanner.shift(),t in bE){let r;try{r=new RegExp(n)}catch(e){q(String(e))}e.root=e.ctx.$.node(`intersection`,{domain:`string`,pattern:n},{prereduced:!0}),t===`x/`&&(e.root=e.ctx.$.node(`morph`,{in:e.root,morphs:e=>r.exec(e),declaredOut:hE}))}else if(sb(t,_E))e.root=e.ctx.$.node(`unit`,{unit:n});else{let t=pE(n,fE(n));e.root=e.ctx.$.node(`unit`,{meta:n,unit:t})}},_E={"'":1,'"':1},vE={"/":1,"'":1,'"':1},yE={"d'":`'`,'d"':`"`,"'":`'`,'"':`"`},bE={"/":`/`,"x/":`/`},xE={...yE,...bE},SE={"'":e=>e.lookahead===`'`,'"':e=>e.lookahead===`"`,"/":e=>e.lookahead===`/`},CE={'"':`double-quote`,"'":`single-quote`,"/":`forward slash`},wE=(e,t)=>`${t}${e} requires a closing ${CE[xE[t]]}`,TE=e=>`Private type references should not include '#'. Use '${e}' instead.`,EE=`Optional definitions like 'string?' are only valid as properties in an object or tuple`,DE=`Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple`,OE={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...Jb},kE=(e,t)=>e===`>`?t[0]===`=`?t[1]===`=`:t.trimStart()===``||sb(t.trimStart()[0],OE):e===`=`?t[0]!==`=`:e===`,`||e===`?`,AE=(e,t,n)=>jE(e,t,n,[]),jE=(e,t,n,r)=>{let i=n.parseUntilFinalizer();return r.push(i.root),i.finalizer===`>`?r.length===t.params.length?r:n.error(ME(e,t.names,r.map(e=>e.expression))):i.finalizer===`,`?jE(e,t,n,r):i.error(Bx(`>`))},ME=(e,t,n)=>`${e}<${t.join(`, `)}> requires exactly ${t.length} args (got ${n.length}${n.length===0?``:`: ${n.join(`, `)}`})`,NE=e=>{let t=e.scanner.shiftUntilLookahead(OE);t===`keyof`?e.addPrefix(`keyof`):e.root=FE(e,t)},PE=(e,t,n)=>(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()===`<`?t(...AE(e,t,n)):n.error(ME(e,t.names,[]))),FE=(e,t)=>IE(e,t)??LE(e,t)??e.error(t===``?e.scanner.lookahead===`#`?TE(e.shiftedBy(1).scanner.shiftUntilLookahead(OE)):RE(e):ZT(t)),IE=(e,t)=>{if(e.ctx.args?.[t]){let n=e.ctx.args[t];return typeof n==`string`?e.ctx.$.node(`alias`,{reference:n},{prereduced:!0}):n}let n=e.ctx.$.maybeResolve(t);if(eS(n,`root`))return n;if(n!==void 0)return eS(n,`generic`)?PE(t,n,e):q(`Unexpected resolution ${Dx(n)}`)},LE=(e,t)=>{let n=hx(t);if(n!==void 0)return e.ctx.$.node(`unit`,{unit:n});let r=vx(t);if(r!==void 0)return e.ctx.$.node(`unit`,{unit:r})},RE=e=>{let t=e.previousOperator();return t?zE(t,e.scanner.unscanned):BE(e.scanner.unscanned)},zE=(e,t=``)=>`Token '${e}' requires a right operand${t?` before '${t}'`:``}`,BE=e=>`Expected an expression${e?` before '${e}'`:``}`,VE=e=>e.scanner.lookahead===``?e.error(RE(e)):e.scanner.lookahead===`(`?e.shiftedBy(1).reduceGroupOpen():e.scanner.lookaheadIsIn(vE)?gE(e,e.scanner.shift()):e.scanner.lookaheadIsIn(Jb)?VE(e.shiftedBy(1)):e.scanner.lookahead===`d`?e.scanner.nextLookahead in _E?gE(e,`${e.scanner.shift()}${e.scanner.shift()}`):NE(e):e.scanner.lookahead===`x`&&e.scanner.nextLookahead===`/`?e.shiftedBy(2)&&gE(e,`x/`):NE(e),HE={">":!0,">=":!0},UE={"<":!0,"<=":!0},WE={"<":`>`,">":`<`,"<=":`>=`,">=":`<=`,"==":`==`},GE=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,KE=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,qE=(e,t,n,r)=>`An expression may have at most one left bound (parsed ${e}${WE[t]}, ${n}${WE[r]})`,JE=(e,t)=>{let n=XE(e,t);if(e.root.hasKind(`unit`)){if(typeof e.root.unit==`number`){e.reduceLeftBound(e.root.unit,n),e.unsetRoot();return}if(e.root.unit instanceof Date){let t=`d'${e.root.description??e.root.unit.toISOString()}'`;e.unsetRoot(),e.reduceLeftBound(t,n);return}}return $E(e,n)},YE={"<":1,">":1,"=":1},XE=(e,t)=>e.scanner.lookaheadIs(`=`)?`${t}${e.scanner.shift()}`:t,ZE=(e,t,n,r)=>n.extends(J.intrinsic.number)?typeof t==`number`?e===`==`?[`min`,`max`]:e[0]===`>`?[`min`]:[`max`]:q(eD(e,t,r)):n.extends(J.intrinsic.lengthBoundable)?typeof t==`number`?e===`==`?[`exactLength`]:e[0]===`>`?[`minLength`]:[`maxLength`]:q(eD(e,t,r)):n.extends(J.intrinsic.Date)?e===`==`?[`after`,`before`]:e[0]===`>`?[`after`]:[`before`]:q(DC(n.expression)),QE=e=>({rule:lE(e.limit)?dE(e.limit):e.limit,exclusive:e.comparator.length===1}),$E=(e,t)=>{let n=e.unsetRoot(),r=e.scanner.location;e.parseOperand();let i=e.unsetRoot(),a=e.scanner.sliceChars(r,e.scanner.location);if(e.root=n,!i.hasKind(`unit`)||typeof i.unit!=`number`&&!(i.unit instanceof Date))return e.error(eD(t,a,`right`));let o=i.unit,s=t.length===1,c=ZE(t,typeof o==`number`?o:a,n,`right`);for(let n of c)e.constrainRoot(n,t===`==`?{rule:o}:{rule:o,exclusive:s});if(!e.branches.leftBound)return;if(!sb(t,UE))return e.error(KE(t));let l=ZE(e.branches.leftBound.comparator,e.branches.leftBound.limit,n,`left`);e.constrainRoot(l[0],QE(e.branches.leftBound)),e.branches.leftBound=null},eD=(e,t,n)=>`Comparator ${n===`left`?WE[e]:e} must be ${n===`left`?`preceded`:`followed`} by a corresponding literal (was ${t})`,tD=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(OE);e.root=e.root.brand(t)},nD=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(OE),n=gx(t,{errorOnFail:rD(t)});n===0&&e.error(rD(0)),e.root=e.root.constrain(`divisor`,n)},rD=e=>`% operator must be followed by a non-zero integer literal (was ${e})`,iD=e=>{let t=e.scanner.shift();return t===``?e.finalize(``):t===`[`?e.scanner.shift()===`]`?e.setRoot(e.root.array()):e.error(oD):t===`|`?e.scanner.lookahead===`>`?e.shiftedBy(1).pushRootToBranch(`|>`):e.pushRootToBranch(t):t===`&`?e.pushRootToBranch(t):t===`)`?e.finalizeGroup():kE(t,e.scanner.unscanned)?e.finalize(t):sb(t,YE)?JE(e,t):t===`%`?nD(e):t===`#`?tD(e):t in Jb?iD(e):e.error(aD(t))},aD=(e,t=``)=>`'${e}' is not allowed here${t&&` (should be ${t})`}`,oD=`Missing expected ']'`,sD=e=>{let t=e.unsetRoot();e.parseOperand();let n=e.unsetRoot();return n.hasKind(`unit`)?[t,`=`,n.unit instanceof Date?()=>new Date(n.unit):n.unit]:e.error(cD(n.expression))},cD=e=>`Default value '${e}' must be a literal value`,lD=(e,t)=>{let n=t.$.maybeResolveRoot(e);if(n)return n;if(e.endsWith(`[]`)){let n=t.$.maybeResolveRoot(e.slice(0,-2));if(n)return n.array()}let r=new pD(new Rx(e),t),i=uD(r);return r.finalizer===`>`&&q(aD(`>`)),i},uD=e=>{e.parseOperand();let t=dD(e).root;return t?(e.finalizer===`=`?t=sD(e):e.finalizer===`?`&&(t=[t,`?`]),e.scanner.shiftUntilNonWhitespace(),e.scanner.lookahead&&q(aD(e.scanner.lookahead)),t):tb(`Root was unexpectedly unset after parsing string '${e.scanner.scanned}'`)},dD=e=>{for(;e.finalizer===void 0;)fD(e);return e},fD=e=>e.hasRoot()?e.parseOperator():e.parseOperand(),pD=class e{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,t){this.scanner=e,this.ctx=t}error(e){return q(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){let e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(Bx(`)`));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,t){let n=WE[t];if(!sb(n,HE))return this.error(KE(t));if(this.branches.leftBound)return this.error(qE(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,n));this.branches.leftBound={comparator:n,limit:e}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch(`|>`),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch(`|`),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch(`&`),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let e=this.groups.pop();if(!e)return this.error(zx(`)`,this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){let e=this.branches.prefixes.pop();this.root=e===`keyof`?this.root.keyof():tb(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();let t=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(t)??t,e!==`&`&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!==`|`&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return dD(new e(this.scanner,this.ctx))}parseOperator(){return iD(this)}parseOperand(){return VE(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(GE(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes[this.branches.prefixes.length-1]??(this.branches.intersection?`&`:this.branches.union?`|`:this.branches.pipe?`|>`:void 0)}shiftedBy(e){return this.scanner.jumpForward(e),this}},mD=`An empty string is not a valid generic parameter name`,hD=(e,t,n)=>{e.shiftUntilNonWhitespace();let r=e.shiftUntilLookahead(OE);return r===``?e.lookahead===``&&t.length?t:q(mD):(e.shiftUntilNonWhitespace(),_D(e,r,t,n))},gD=`extends `,_D=(e,t,n,r)=>{if(e.shiftUntilNonWhitespace(),e.unscanned.startsWith(gD))e.jumpForward(8);else return e.lookahead===`,`&&e.shift(),n.push(t),hD(e,n,r);let i=dD(new pD(e,r));return n.push([t,i.root]),hD(e,n,r)},vD=class extends zb{constructor(e){let t=(...t)=>{let n=t.indexOf(`:`),r=n===-1?t.length-1:n-1,i=t.slice(0,r+1),a=e.parse(i).assertHasKind(`intersection`),o=e.intrinsic.unknown;if(n!==-1){if(n!==t.length-2)return q(bD);o=e.parse(t[n+1])}return e=>new yD(e,a,o)};super(t,{attach:{$:e,raw:t}})}},yD=class extends zb{raw;params;returns;expression;constructor(e,t,n){let r=`typed ${e.name}`,i={[r]:(...r)=>{let i=e(...t.assert(r));return n.assert(i)}}[r];super(i),this.raw=e,this.params=t,this.returns=n;let a=t.expression;a[0]===`[`&&a[a.length-1]===`]`?a=a.slice(1,-1):a.endsWith(`[]`)&&(a=`...${a}`),this.expression=`(${a}) => ${n?.expression??`unknown`}`}},bD=`":" must be followed by exactly one return type e.g:
|
|
39
|
-
fn("string", ":", "number")(s => s.length)`,xD=class extends zb{$;constructor(e){super((...t)=>new SD(e)(...t),{bind:e}),this.$=e}in(e){return new SD(this.$,e===void 0?void 0:this.$.parse(e))}at(e,t){return new SD(this.$).at(e,t)}case(e,t){return new SD(this.$).case(e,t)}},SD=class extends zb{$;in;key;branches=[];constructor(e,t){super(e=>this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.parse(e),t]))),this.$=e,this.in=t}at(e,t){return this.key&&q(TD),this.branches.length&&q(wD),this.key=e,t?this.match(t):this}case(e,t){return this.caseEntry(this.$.parse(e),t)}caseEntry(e,t){let n=(this.key?this.$.parse({[this.key]:e}):e).pipe(t);return this.branches.push(n),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.node(`unit`,{unit:e}),t]))}caseEntries(e){for(let t=0;t<e.length;t++){let[n,r]=e[t];if(n==="default")return t!==e.length-1&&q(`default may only be specified as the last key of a switch definition`),this.default(r);if(typeof r!=`function`)return q(`Value for case "${n}" must be a function (was ${Zy(r)})`);this.caseEntry(n,r)}return this}default(e){typeof e==`function`&&this.case(sE.unknown,e);let t={branches:this.branches,ordered:!0};(e===`never`||e===`assert`)&&(t.meta={onFail:CD});let n=this.$.node(`union`,t);if(!this.in)return this.$.finalize(n);let r=this.in.pipe(n);return(e===`never`||e===`assert`)&&(r=r.configureReferences({onFail:CD},`self`)),this.$.finalize(r)}},CD=e=>e.throw(),wD=`A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`,TD=`At most one key matcher may be specified per expression`,ED=(e,t)=>{if(Db(e)){if(e[1]===`=`)return[t.$.parseOwnDefinitionFormat(e[0],t),`=`,e[2]];if(e[1]===`?`)return[t.$.parseOwnDefinitionFormat(e[0],t),`?`]}return lO(e,t)},DD=`Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`,OD=`Only required keys may specify default values, e.g. { value: 'number = 0' }`,kD=(e,t)=>{let n,r={},i=hb(e);for(let[e,a]of i){let i=ND(e);if(i.kind===`spread`){if(!mb(r))return q(MD);let e=t.$.parseOwnDefinitionFormat(a,t);if(e.equals(sE.object))continue;if(!e.hasKind(`intersection`)||!e.basis?.equals(sE.object))return q(PD(e.expression));n=e.structure;continue}if(i.kind===`undeclared`){a!==`reject`&&a!==`delete`&&a!==`ignore`&&q(jD(a)),r.undeclared=a;continue}let o=ED(a,t),s=i;if(i.kind===`required`){Db(o)?AD(r,`optional`,o[1]===`=`?{key:i.normalized,value:o[0],default:o[2]}:{key:i.normalized,value:o[0]},t):AD(r,`required`,{key:i.normalized,value:o},t);continue}if(Db(o)&&(o[1]===`?`&&q(DD),o[1]===`=`&&q(OD)),i.kind===`optional`){AD(r,`optional`,{key:i.normalized,value:o},t);continue}let c=ET(t.$.parseOwnDefinitionFormat(s.normalized,t),o,t.$);c.index&&(r.index=Wy(r.index,c.index)),c.required&&(r.required=Wy(r.required,c.required))}let a=t.$.node(`structure`,r);return t.$.parseSchema({domain:`object`,structure:n?.merge(a)??a})},AD=(e,t,n,r)=>{e[t]=Wy(e[t],r.$.node(t,n))},jD=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Dx(e)})`,MD=`Spread operator may only be used as the first key in an object`,ND=e=>typeof e==`symbol`?{kind:`required`,normalized:e}:e[e.length-1]===`?`?e[e.length-2]===`\\`?{kind:`required`,normalized:`${e.slice(0,-2)}?`}:{kind:`optional`,normalized:e.slice(0,-1)}:e[0]===`[`&&e[e.length-1]===`]`?{kind:`index`,normalized:e.slice(1,-1)}:e[0]===`\\`&&e[1]===`[`&&e[e.length-1]===`]`?{kind:`required`,normalized:e.slice(1)}:e===`...`?{kind:`spread`}:e===`+`?{kind:`undeclared`}:{kind:`required`,normalized:e===`\\...`?`...`:e===`\\+`?`+`:e},PD=e=>`Spread operand must resolve to an object literal type (was ${e})`,FD=(e,t)=>YD(e)?JD[e[0]](e,t):qD(e)?KD[e[1]](e,t):null,ID=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),LD=(e,t)=>{if(e[2]===void 0)return q(zE(e[1],``));let n=t.$.parseOwnDefinitionFormat(e[0],t),r=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]===`|`)return t.$.node(`union`,{branches:[n,r]});let i=e[1]===`&`?KS(n,r,t.$):qS(n,r,t.$);return i instanceof VS?i.throw():i},RD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).array(),zD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]):q(BD(`=>`,e[2])),BD=(e,t)=>`${e===`:`?`Narrow`:`Morph`} expression requires a function following '${e}' (was ${typeof t})`,VD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).constrain(`predicate`,e[2]):q(BD(`:`,e[2])),HD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configure(e[2],e[3]),UD=e=>e,WD=UD({"[]":RD,"?":()=>q(EE)}),GD=UD({"|":LD,"&":LD,":":VD,"=>":zD,"|>":LD,"@":HD,"=":()=>q(DE)}),KD={...WD,...GD},qD=e=>KD[e[1]]!==void 0,JD=(e=>e)({keyof:ID,instanceof:(e,t)=>{if(typeof e[1]!=`function`)return q(XD(Eb(e[1])));let n=e.slice(1).map(e=>typeof e==`function`?t.$.node(`proto`,{proto:e}):q(XD(Eb(e))));return n.length===1?n[0]:t.$.node(`union`,{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),YD=e=>JD[e[0]]!==void 0,XD=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,ZD=(e,t)=>{let n=[{}],r=0;for(;r<e.length;){let i=!1;e[r]===`...`&&r<e.length-1&&(i=!0,r++);let a=ED(e[r],t),[o,s,c]=Db(a)?a:[a];if(r++,i){if(!o.extends(J.intrinsic.Array))return q(rO(o.expression));n=n.flatMap(e=>o.distribute(t=>nO(Qx(e),t)))}else n=n.map(e=>s===`?`?$D(e,o):s===`=`?eO(e,o,c):QD(e,o))}return t.$.parseSchema(n.map(e=>mb(e)?{proto:Array,exactLength:0}:{proto:Array,sequence:e}))},QD=(e,t)=>e.defaultables||e.optionals?q(e.variadic?lT:aO):(e.variadic?e.postfix=Wy(e.postfix,t):e.prefix=Wy(e.prefix,t),e),$D=(e,t)=>e.variadic?q(oO):(e.optionals=Wy(e.optionals,t),e),eO=(e,t,n)=>e.variadic?q(oO):e.optionals?q(sO):(e.defaultables=Wy(e.defaultables,[[t,n]]),e),tO=(e,t)=>(e.postfix&&q(iO),e.variadic?e.variadic.equals(t)||q(iO):e.variadic=t.internal,e),nO=(e,t)=>{let n=t.select({method:`find`,kind:`sequence`});if(!n)return tO(e,J.intrinsic.unknown);if(n.prefix)for(let t of n.prefix)QD(e,t);if(n.optionals)for(let t of n.optionals)$D(e,t);if(n.variadic&&tO(e,n.variadic),n.postfix)for(let t of n.postfix)QD(e,t);return e},rO=e=>`Spread element must be an array (was ${e})`,iO=`A tuple may have at most one variadic element`,aO=`A required element may not follow an optional element`,oO=`An optional element may not follow a variadic element`,sO=`A defaultable element may not follow an optional element without a default`,cO={},lO=(e,t)=>{if(typeof e==`string`){if(t.args&&Object.keys(t.args).some(t=>e.includes(t)))return lD(e,t);let n=cO[t.$.name]??={};return n[e]??=lD(e,t)}return Xy(e,`object`)?uO(e,t):q(pO(Zy(e)))},uO=(e,t)=>{let n=Tb(e);switch(n){case void 0:return eS(e,`root`)?e:`~standard`in e?dO(e,t):kD(e,t);case`Array`:return fO(e,t);case`RegExp`:return t.$.node(`intersection`,{domain:`string`,pattern:e},{prereduced:!0});case`Function`:{let t=Lb(e)?e():e;return eS(t,`root`)?t:q(pO(`Function`))}default:return q(pO(n??Dx(e)))}},dO=(e,t)=>t.$.intrinsic.unknown.pipe((t,n)=>{let r=e[`~standard`].validate(t);if(!r.issues)return r.value;for(let{message:e,path:t}of r.issues)t&&t.length?n.error({problem:Wb(e),relativePath:t.map(e=>typeof e==`object`?e.key:e)}):n.error({message:e})}),fO=(e,t)=>FD(e,t)??ZD(e,t),pO=e=>`Type definitions must be strings or objects (was ${e})`,mO=class extends zb{constructor(e){let t=Object.assign({errors:ES,hkt:Vb,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...t)=>{if(t.length===1)return e.parse(t[0]);if(t.length===2&&typeof t[0]==`string`&&t[0][0]===`<`&&t[0][t[0].length-1]===`>`){let n=t[0].slice(1,-1);return new lC(e.parseGenericParams(n,{}),t[1],e,e,null)}return e.parse(t)},{attach:t})}},hO=J,gO=class e extends UT{get ambientAttachments(){if(hO.typeAttachments)return this.cacheGetter(`ambientAttachments`,ab(hO.typeAttachments,(e,t)=>[e,this.bindReference(t)]))}preparseOwnAliasEntry(e,t){let n=e.indexOf(`<`);if(n===-1){if(eS(t,`module`)||eS(t,`generic`))return[e,t];let n=this.name===`ark`?e:e===`root`?this.name:`${this.name}.${e}`,r=this.resolvedConfig.keywords?.[n];return r&&(t=[t,`@`,r]),[e,t]}e[e.length-1]!==`>`&&q(`'>' must be the last character of a generic declaration in a scope`);let r=e.slice(0,n),i=e.slice(n+1,-1);return[r,()=>sC(this.parseGenericParams(i,{alias:r}),t,this)]}parseGenericParams(e,t){return hD(new Rx(e),[],this.createParseContext({...t,def:e,prefix:`generic`}))}normalizeRootScopeValue(e){return Lb(e)&&!eS(e,`generic`)?e():e}preparseOwnDefinitionFormat(e,t){return{...t,def:e,prefix:t.alias??`type`}}parseOwnDefinitionFormat(e,t){!(t.alias&&t.alias in this.aliases)&&!t.args&&(t.args={this:t.id});let n=lO(e,t);if(Db(n)){if(n[1]===`=`)return q(DE);if(n[1]===`?`)return q(EE)}return n}unit=e=>this.units([e]);valueOf=e=>this.units(yb(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node(`proto`,{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(e=>this.parse(e)));and=(...e)=>e.reduce((e,t)=>e.and(this.parse(t)),this.intrinsic.unknown);merge=(...e)=>e.reduce((e,t)=>e.merge(this.parse(t)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new vD(this);match=new xD(this);declare=()=>({type:this.type});define(e){return e}type=new mO(this);static scope=((t,n={})=>new e(t,n));static module=((e,t={})=>this.scope(e,t).export())},_O=Object.assign(gO.scope,{define:e=>e}),vO=gO,yO=class extends Vb{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'},bO=nE([`base`,sE.object],[`props`,sE.object])(e=>e.base.merge(e.props),yO),xO=vO.module({Key:sE.key,Merge:bO}),SO=class extends Vb{},CO=nE(`element`)(e=>{let t=e.element.exclude(sE.Array),n=t.array();return t.rawOr(n).pipe(zy).distribute(e=>e.assertHasKind(`morph`).declareOut(n),eE)},SO),wO=vO.module({root:sE.Array,readonly:`root`,index:sE.nonNegativeIntegerString,liftFrom:CO},{name:`Array`}),TO=eE([`string`,yx.FileConstructor]),EO=eE({meta:`an object representing parsed form data`,domain:`object`,index:{signature:`string`,value:TO.rawOr(TO.array())}}),DO=vO.module({root:[`instanceof`,FormData],value:TO,parsed:EO,parse:eE({in:FormData,morphs:e=>{let t={};for(let[n,r]of e)if(n in t){let e=t[n];typeof e==`string`||e instanceof yx.FileConstructor?t[n]=[e,r]:e.push(r)}else t[n]=r;return t},declaredOut:EO})},{name:`FormData`}),OO=vO.module({Int8:[`instanceof`,Int8Array],Uint8:[`instanceof`,Uint8Array],Uint8Clamped:[`instanceof`,Uint8ClampedArray],Int16:[`instanceof`,Int16Array],Uint16:[`instanceof`,Uint16Array],Int32:[`instanceof`,Int32Array],Uint32:[`instanceof`,Uint32Array],Float32:[`instanceof`,Float32Array],Float64:[`instanceof`,Float64Array],BigInt64:[`instanceof`,BigInt64Array],BigUint64:[`instanceof`,BigUint64Array]},{name:`TypedArray`}),kO={Boolean:1,Number:1,String:1},AO=vO.module({...ab({...bb,...Sb},(e,t)=>e in kO?[]:[e,[`instanceof`,t]]),Array:wO,TypedArray:OO,FormData:DO}),jO=eE({domain:{domain:`number`,meta:`a number representing a Unix timestamp`},divisor:{rule:1,meta:`an integer representing a Unix timestamp`},min:{rule:-864e13,meta:`a Unix timestamp after -8640000000000000`},max:{rule:864e13,meta:`a Unix timestamp before 8640000000000000`},meta:`an integer representing a safe Unix timestamp`}),MO=eE({domain:`number`,divisor:1}),NO=vO.module({root:sE.number,integer:MO,epoch:jO,safe:eE({domain:{domain:`number`,numberAllowsNaN:!1},min:-(2**53-1),max:2**53-1}),NaN:[`===`,NaN],Infinity:[`===`,1/0],NegativeInfinity:[`===`,-1/0]},{name:`number`}),PO=(e,t,n)=>{let r={domain:`string`,pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(r.meta={format:n}),tE(`intersection`,r)},FO=PO(ax,`a well-formed integer string`),IO=vO.module({root:FO,parse:eE({in:FO,morphs:(e,t)=>{let n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error(`an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER`)},declaredOut:sE.integer})},{name:`string.integer`}),LO=PO(/^[\dA-Fa-f]+$/,`hex characters only`),RO=vO.module({root:PO(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,`base64-encoded`),url:PO(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,`base64url-encoded`)},{name:`string.base64`}),zO=PO(/^[A-Z].*$/,`capitalized`),BO=vO.module({root:eE({in:`string`,morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:zO}),preformatted:zO},{name:`string.capitalize`}),VO=eE({domain:`string`,pattern:{meta:`a credit card number`,rule:`^(?:4\\d{12}(?:\\d{3,6})?|5[1-5]\\d{14}|(222[1-9]|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}|6(?:011|5\\d\\d)\\d{12,15}|3[47]\\d{13}|3(?:0[0-5]|[68]\\d)\\d{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27]\\d{14}|^(81\\d{14,17}))$`},predicate:{meta:`a credit card number`,predicate:e=>{let t=e.replace(/[ -]+/g,``),n=0,r,i,a=!1;for(let e=t.length-1;e>=0;e--)r=t.substring(e,e+1),i=Number.parseInt(r,10),a?(i*=2,n+=i>=10?i%10+1:i):n+=i,a=!a;return!!(n%10==0&&t)}}}),HO=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,UO=eE({domain:`string`,predicate:{meta:`a parsable date`,predicate:e=>!Number.isNaN(new Date(e).valueOf())}}).assertHasKind(`intersection`),WO=IO.root.internal.narrow((e,t)=>{let n=Number.parseInt(e),r=NO.epoch(n);return r instanceof ES?(t.errors.merge(r),!1):!0}).configure({description:`an integer string representing a safe Unix timestamp`},`self`).assertHasKind(`intersection`),GO=vO.module({root:WO,parse:eE({in:WO,morphs:e=>new Date(e),declaredOut:sE.Date})},{name:`string.date.epoch`}),KO=PO(HO,`an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date`).internal.assertHasKind(`intersection`),qO=vO.module({root:KO,parse:eE({in:KO,morphs:e=>new Date(e),declaredOut:sE.Date})},{name:`string.date.iso`}),JO=vO.module({root:UO,parse:eE({declaredIn:UO,in:`string`,morphs:(e,t)=>{let n=new Date(e);return Number.isNaN(n.valueOf())?t.error(`a parsable date`):n},declaredOut:sE.Date}),iso:qO,epoch:GO},{name:`string.date`}),YO=PO(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,`an email address`,`email`),XO=`(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,ZO=`(${XO}[.]){3}${XO}`,QO=RegExp(`^${ZO}$`),$O=`(?:[0-9a-fA-F]{1,4})`,ek=RegExp(`^((?:${$O}:){7}(?:${$O}|:)|(?:${$O}:){6}(?:${ZO}|:${$O}|:)|(?:${$O}:){5}(?::${ZO}|(:${$O}){1,2}|:)|(?:${$O}:){4}(?:(:${$O}){0,1}:${ZO}|(:${$O}){1,3}|:)|(?:${$O}:){3}(?:(:${$O}){0,2}:${ZO}|(:${$O}){1,4}|:)|(?:${$O}:){2}(?:(:${$O}){0,3}:${ZO}|(:${$O}){1,5}|:)|(?:${$O}:){1}(?:(:${$O}){0,4}:${ZO}|(:${$O}){1,6}|:)|(?::((?::${$O}){0,5}:${ZO}|(?::${$O}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?\$`),tk=vO.module({root:[`v4 | v6`,`@`,`an IP address`],v4:PO(QO,`an IPv4 address`,`ipv4`),v6:PO(ek,`an IPv6 address`,`ipv6`)},{name:`string.ip`}),nk=`a JSON string`,rk=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${nk} (${e})`},ik=eE({meta:nk,domain:`string`,predicate:{meta:nk,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(e){return t.reject({code:`predicate`,expected:nk,problem:rk(e)})}}}}),ak=vO.module({root:ik,parse:eE({meta:`safe JSON string parser`,in:`string`,morphs:(e,t)=>{if(e.length===0)return t.error({code:`predicate`,expected:nk,actual:`empty`});try{return JSON.parse(e)}catch(e){return t.error({code:`predicate`,expected:nk,problem:rk(e)})}},declaredOut:sE.jsonObject})},{name:`string.json`}),ok=PO(/^[a-z]*$/,`only lowercase letters`),sk=vO.module({root:eE({in:`string`,morphs:e=>e.toLowerCase(),declaredOut:ok}),preformatted:ok},{name:`string.lower`}),ck=[`NFC`,`NFD`,`NFKC`,`NFKD`],lk=ab(ck,(e,t)=>[t,eE({domain:`string`,predicate:e=>e.normalize(t)===e,meta:`${t}-normalized unicode`})]),uk=ab(ck,(e,t)=>[t,eE({in:`string`,morphs:e=>e.normalize(t),declaredOut:lk[t]})]),dk=vO.module({root:uk.NFC,preformatted:lk.NFC},{name:`string.normalize.NFC`}),fk=vO.module({root:uk.NFD,preformatted:lk.NFD},{name:`string.normalize.NFD`}),pk=vO.module({root:uk.NFKC,preformatted:lk.NFKC},{name:`string.normalize.NFKC`}),mk=vO.module({root:uk.NFKD,preformatted:lk.NFKD},{name:`string.normalize.NFKD`}),hk=vO.module({root:`NFC`,NFC:dk,NFD:fk,NFKC:pk,NFKD:mk},{name:`string.normalize`}),gk=PO(nx,`a well-formed numeric string`),_k=vO.module({root:gk,parse:eE({in:gk,morphs:e=>Number.parseFloat(e),declaredOut:sE.number})},{name:`string.numeric`}),vk=`a regex pattern`,yk=eE({domain:`string`,predicate:{meta:vk,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(e){return t.reject({code:`predicate`,expected:vk,problem:String(e)})}}},meta:{format:`regex`}}),bk=PO(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,`a semantic version (see https://semver.org/)`),xk=PO(/^\S.*\S$|^\S?$/,`trimmed`),Sk=vO.module({root:eE({in:`string`,morphs:e=>e.trim(),declaredOut:xk}),preformatted:xk},{name:`string.trim`}),Ck=PO(/^[A-Z]*$/,`only uppercase letters`),wk=vO.module({root:eE({in:`string`,morphs:e=>e.toUpperCase(),declaredOut:Ck}),preformatted:Ck},{name:`string.upper`}),Tk=eE({domain:`string`,predicate:{meta:`a URL string`,predicate:e=>URL.canParse(e)},meta:{format:`uri`}}),Ek=vO.module({root:Tk,parse:eE({declaredIn:Tk,in:`string`,morphs:(e,t)=>{try{return new URL(e)}catch{return t.error(`a URL string`)}},declaredOut:eE(URL)})},{name:`string.url`}),Dk=vO.module({root:[`versioned | nil | max`,`@`,{description:`a UUID`,format:`uuid`}],"#nil":`'00000000-0000-0000-0000-000000000000'`,"#max":`'ffffffff-ffff-ffff-ffff-ffffffffffff'`,"#versioned":/^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,v1:PO(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv1`),v2:PO(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv2`),v3:PO(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv3`),v4:PO(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv4`),v5:PO(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv5`),v6:PO(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv6`),v7:PO(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv7`),v8:PO(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv8`)},{name:`string.uuid`}),Ok=vO.module({root:sE.string,alpha:PO(/^[A-Za-z]*$/,`only letters`),alphanumeric:PO(/^[\dA-Za-z]*$/,`only letters and digits 0-9`),hex:LO,base64:RO,capitalize:BO,creditCard:VO,date:JO,digits:PO(/^\d*$/,`only digits 0-9`),email:YO,integer:IO,ip:tk,json:ak,lower:sk,normalize:hk,numeric:_k,regex:yk,semver:bk,trim:Sk,upper:wk,url:Ek,uuid:Dk},{name:`string`}),kk=vO.module({bigint:sE.bigint,boolean:sE.boolean,false:sE.false,never:sE.never,null:sE.null,number:sE.number,object:sE.object,string:sE.string,symbol:sE.symbol,true:sE.true,unknown:sE.unknown,undefined:sE.undefined}),Ak=vO.module({root:sE.unknown,any:sE.unknown},{name:`unknown`}),jk=vO.module({root:sE.jsonObject,stringify:tE(`morph`,{in:sE.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:sE.string})},{name:`object.json`}),Mk=vO.module({root:sE.object,json:jk},{name:`object`}),Nk=class extends Vb{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'},Pk=nE([`K`,sE.key],`V`)(e=>({domain:`object`,index:{signature:e.K,value:e.V}}),Nk),Fk=class extends Vb{description='pick a set of properties from an object like `Pick(User, "name | age")`'},Ik=nE([`T`,sE.object],[`K`,sE.key])(e=>e.T.pick(e.K),Fk),Lk=class extends Vb{description='omit a set of properties from an object like `Omit(User, "age")`'},Rk=nE([`T`,sE.object],[`K`,sE.key])(e=>e.T.omit(e.K),Lk),zk=class extends Vb{description="make all named properties of an object optional like `Partial(User)`"},Bk=nE([`T`,sE.object])(e=>e.T.partial(),zk),Vk=class extends Vb{description="make all named properties of an object required like `Required(User)`"},Hk=nE([`T`,sE.object])(e=>e.T.required(),Vk),Uk=class extends Vb{description='exclude branches of a union like `Exclude("boolean", "true")`'},Wk=nE(`T`,`U`)(e=>e.T.exclude(e.U),Uk),Gk=class extends Vb{description='extract branches of a union like `Extract("0 | false | 1", "number")`'},Kk=nE(`T`,`U`)(e=>e.T.extract(e.U),Gk),qk=vO.module({Exclude:Wk,Extract:Kk,Omit:Rk,Partial:Bk,Pick:Ik,Record:Pk,Required:Hk}),Jk=_O({...kk,...qk,...AO,...xO,string:Ok,number:NO,object:Mk,unknown:Ak},{prereducedAliases:!0,name:`ark`}),Yk=Jk.export();Object.assign(hO.ambient,Yk),hO.typeAttachments={string:Yk.string.root,number:Yk.number.root,bigint:Yk.bigint,boolean:Yk.boolean,symbol:Yk.symbol,undefined:Yk.undefined,null:Yk.null,object:Yk.object.root,unknown:Yk.unknown.root,false:Yk.false,true:Yk.true,never:Yk.never,arrayIndex:Yk.Array.index,Key:Yk.Key,Record:Yk.Record,Array:Yk.Array.root,Date:Yk.Date};var Y=Object.assign(Jk.type,hO.typeAttachments);Jk.match,Jk.fn,Jk.generic,Jk.schema,Jk.define,Jk.declare;var Xk=Y(`"local" | "lan" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/`),Zk=Y(`/^[a-z0-9][a-z0-9_-]*$/`);Y({id:Zk,label:`1 <= string <= 60`}).onUndeclaredKey(`reject`),Y({"id?":Zk,"label?":`1 <= string <= 60`}).onUndeclaredKey(`reject`),Y({label:`1 <= string <= 60`}).onUndeclaredKey(`reject`);function Qk(e){let t=Xk(e);return t instanceof Y.errors?null:t}var $k=Y(`1 <= number.integer <= 65535 | null`),eA=Y.enumerated(`block`,`warn`,`follow`,`reclaim`,`kill`),tA=eA.default(`block`),nA=Y({enabled:`boolean = true`,maxRetries:`number.integer >= 0 = 3`,baseDelayMs:`number >= 0 = 1000`,factor:`number >= 1 = 2`,maxDelayMs:`number >= 0 = 30000`,resetAfterMs:`number >= 0 = 60000`}).onUndeclaredKey(`reject`),rA=Y({path:`string = "/"`,method:`"GET" | "HEAD" = "GET"`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer = 400`,expectBody:`string = ""`}).onUndeclaredKey(`reject`),iA=Y({maxRssBytes:`number.integer >= 0 = 0`}).onUndeclaredKey(`reject`),aA=Y({enabled:`boolean = true`,mode:`"port" | "http" = "port"`,http:rA.default(()=>({})),intervalMs:`number >= 500 = 5000`,timeoutMs:`number >= 100 = 1500`,unhealthyThreshold:`number.integer >= 1 = 3`,forceRestartAfterMs:`number >= 0 = 0`,startTimeoutMs:`number >= 0 = 20000`}).onUndeclaredKey(`reject`),oA=Y({signal:`"SIGTERM" | "SIGINT" | "SIGKILL" = "SIGTERM"`,killGroup:`boolean = true`,graceMs:`number >= 0 = 5000`,killPortHolders:`boolean = false`}).onUndeclaredKey(`reject`),sA=Y({command:`string`,args:Y(`string[]`).default(()=>[]),env:Y(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 120000`,runOnce:`boolean = true`}).onUndeclaredKey(`reject`).or(Y(`null`)),cA=Y(`string | null`),lA=Y(`50 <= number.integer <= 100000`),uA=Y({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:cA.optional(),enabled:`boolean = true`,autostart:`boolean = false`,persistent:`boolean = false`,command:`string >= 1`,args:Y(`string[]`).default(()=>[]),cwd:`string = "."`,env:Y(`Record<string, string>`).default(()=>({})),dataEnvs:Y(`Record<string, string>`).default(()=>({})),bootstrap:sA.optional(),port:$k.optional(),bind:Xk.default(()=>`local`),onPortConflict:tA,restart:nA.default(()=>({})),health:aA.default(()=>({})),stop:oA.default(()=>({})),logBufferLines:lA.default(()=>500),dependsOn:Y(`string[]`).default(()=>[]),envFile:`string = ""`,resources:iA.default(()=>({})),backupPaths:Y(`string[]`).default(()=>[]),backupIgnoreGenerated:`boolean = true`}).onUndeclaredKey(`reject`),dA=Y({enabled:`boolean = true`,sessionTtlMs:`number >= 60000 = 604800000`,cookieSecure:`"auto" | "always" | "never" = "auto"`,trustProxy:`boolean | "loopback" = false`,maxLoginAttempts:`number.integer >= 1 = 5`,lockoutMs:`number >= 1000 = 60000`}).onUndeclaredKey(`reject`);Y({telegram:Y({enabled:`boolean = false`,chatId:`string = ""`,onCrash:`boolean = true`,onUnhealthy:`boolean = true`,onForcedRestart:`boolean = true`,onRecovered:`boolean = false`,onHost:`boolean = true`,onDdns:`boolean = true`,cooldownMs:`number >= 0 = 120000`}).onUndeclaredKey(`reject`).default(()=>({}))}).onUndeclaredKey(`reject`);var fA=Y({persist:`boolean = true`,maxBytes:`10000 <= number <= 100000000 = 2000000`,keep:`1 <= number.integer <= 10 = 3`}).onUndeclaredKey(`reject`),pA=Y({enabled:`boolean = false`}).onUndeclaredKey(`reject`),mA=Y({enabled:`boolean = true`,intervalMs:`number >= 5000 = 15000`,diskPaths:Y(`string[]`).default(()=>[`.`]),diskUsedPercent:`number >= 0 = 90`,memoryUsedPercent:`number >= 0 = 90`,swapUsedPercent:`number >= 0 = 50`,loadPerCpu:`number >= 0 = 2`,tempCelsius:`number >= 0 = 85`}).onUndeclaredKey(`reject`),hA=Y.enumerated(`A`,`AAAA`),gA=Y({id:`/^[a-z0-9][a-z0-9_-]*$/`,provider:`string >= 1`,label:`string = ""`}).onUndeclaredKey(`reject`),_A=Y({host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/`,account:`string >= 1`,types:hA.array().default(()=>[`A`]),zone:`string?`,ttl:`number.integer >= 1?`,proxied:`boolean = false`,enabled:`boolean = true`}).onUndeclaredKey(`reject`),vA=Y({enabled:`boolean = true`,url:`string = ""`}).onUndeclaredKey(`reject`),yA=Y({enabled:`boolean = false`,url:`string = ""`}).onUndeclaredKey(`reject`),bA=Y({enabled:`boolean = false`,intervalMs:`number >= 60000 = 300000`,ipv4:vA.default(()=>({})),ipv6:yA.default(()=>({})),ttl:`number.integer >= 1 = 1`,accounts:gA.array().default(()=>[]),domains:_A.array().default(()=>[])}).onUndeclaredKey(`reject`),xA=Y({enabled:`boolean`,running:`boolean`,lastRunAt:`number | null`,lastResult:`string | null`,ipv4:`string | null`,ipv6:`string | null`,records:Y({host:`string`,account:`string`,provider:`string`,type:hA,ip:`string | null`,state:Y(`"pending" | "ok" | "unchanged" | "error" | "skipped"`),message:`string | null`,updatedAt:`number | null`}).array()}),SA=Y({key:`string`,label:`string`,hint:`string = ""`,optional:`boolean = false`}),CA=Y({config:bA,status:xA,providers:Y({id:`string`,label:`string`,docsUrl:`string`,families:hA.array(),fields:SA.array(),ttl:`boolean`,proxied:`boolean`,txt:`boolean`}).array(),credentials:Y(`string[]`)});Y({provider:`string >= 1`,credentials:Y(`Record<string, string>`)}).onUndeclaredKey(`reject`),Y({enabled:`boolean?`,intervalMs:`number >= 60000?`,ipv4:Y({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ipv6:Y({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ttl:`number.integer >= 1?`,accounts:gA.array().optional(),domains:_A.array().optional()}).onUndeclaredKey(`reject`),Y({enabled:`boolean = true`,dir:`string = ".backups"`,keep:`number.integer >= 1 = 5`,includePaths:Y(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),Y({label:`1 <= string <= 60 = "home-hosted"`,port:`1 <= number.integer <= 65535 = 3999`,host:Xk.default(()=>`local`),openBrowser:`boolean = false`,auth:dA.default(()=>({})),tls:pA.default(()=>({}))}).onUndeclaredKey(`reject`);var wA=Y({enabled:`boolean = true`,autostart:`boolean = false`,bind:Xk.default(()=>`local`),onPortConflict:tA,restart:nA.default(()=>({})),health:aA.default(()=>({})),stop:oA.default(()=>({})),logBufferLines:lA.default(()=>500)}).onUndeclaredKey(`reject`),TA=Y({enabled:`boolean?`,maxRetries:`number.integer >= 0?`,baseDelayMs:`number >= 0?`,factor:`number >= 1?`,maxDelayMs:`number >= 0?`,resetAfterMs:`number >= 0?`}).onUndeclaredKey(`reject`),EA=Y({path:`string?`,method:`"GET" | "HEAD"?`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer?`,expectBody:`string?`}).onUndeclaredKey(`reject`),DA=Y({maxRssBytes:`number.integer >= 0?`}).onUndeclaredKey(`reject`),OA=Y({enabled:`boolean?`,mode:`"port" | "http"?`,http:EA.optional(),intervalMs:`number >= 500?`,timeoutMs:`number >= 100?`,unhealthyThreshold:`number.integer >= 1?`,forceRestartAfterMs:`number >= 0?`,startTimeoutMs:`number >= 0?`}).onUndeclaredKey(`reject`),kA=Y({signal:`"SIGTERM" | "SIGINT" | "SIGKILL"?`,killGroup:`boolean?`,graceMs:`number >= 0?`,killPortHolders:`boolean?`}).onUndeclaredKey(`reject`),AA=Y({enabled:`boolean?`,sessionTtlMs:`number >= 60000?`,cookieSecure:`"auto" | "always" | "never"?`,trustProxy:`boolean | "loopback"?`,maxLoginAttempts:`number.integer >= 1?`,lockoutMs:`number >= 1000?`}).onUndeclaredKey(`reject`),jA=Y({telegram:Y({enabled:`boolean?`,chatId:`string?`,onCrash:`boolean?`,onUnhealthy:`boolean?`,onForcedRestart:`boolean?`,onRecovered:`boolean?`,onHost:`boolean?`,onDdns:`boolean?`,cooldownMs:`number >= 0?`}).onUndeclaredKey(`reject`).optional()}).onUndeclaredKey(`reject`),MA=Y({enabled:`boolean?`,intervalMs:`number >= 5000?`,diskPaths:Y(`string[]`).optional(),diskUsedPercent:`number >= 0?`,memoryUsedPercent:`number >= 0?`,swapUsedPercent:`number >= 0?`,loadPerCpu:`number >= 0?`,tempCelsius:`number >= 0?`}).onUndeclaredKey(`reject`),NA=Y({enabled:`boolean?`,dir:`string?`,keep:`number.integer >= 1?`,includePaths:Y(`string[]`).optional()}).onUndeclaredKey(`reject`),PA=Y({persist:`boolean?`,maxBytes:`10000 <= number <= 100000000?`,keep:`1 <= number.integer <= 10?`}).onUndeclaredKey(`reject`),FA=Y({enabled:`boolean?`}).onUndeclaredKey(`reject`),IA=Y({label:`1 <= string <= 60 | null?`,port:`1 <= number.integer <= 65535?`,host:Xk.optional(),openBrowser:`boolean?`,auth:AA.optional(),tls:FA.optional()}).onUndeclaredKey(`reject`),LA=Y({enabled:`boolean?`,autostart:`boolean?`,bind:Xk.optional(),onPortConflict:eA.optional(),restart:TA.optional(),health:OA.optional(),stop:kA.optional(),logBufferLines:lA.optional()}).onUndeclaredKey(`reject`),RA={label:cA.optional(),enabled:`boolean?`,autostart:`boolean?`,persistent:`boolean?`,command:`string?`,args:`string[]?`,cwd:`string?`,env:`Record<string, string>?`,dataEnvs:`Record<string, string>?`,bootstrap:sA.optional(),port:$k.optional(),bind:Xk.optional(),onPortConflict:eA.optional(),restart:TA.optional(),health:OA.optional(),stop:kA.optional(),logBufferLines:lA.optional(),dependsOn:Y(`string[]`).optional(),envFile:`string?`,resources:DA.optional(),backupPaths:Y(`string[]`).optional(),backupIgnoreGenerated:`boolean?`},zA=Y(RA).onUndeclaredKey(`reject`),BA=Y({id:`/^[a-z0-9][a-z0-9_-]*$/`,...RA,command:`string`}).onUndeclaredKey(`reject`);Y({serverId:`string`,command:`string`,args:`string[]`,cwd:`string`,env:`Record<string, string>`,logDir:`string`,logs:fA,stop:oA}).onUndeclaredKey(`reject`),Y({serverId:`string`,nannyPid:`number`,childPid:`number | null`,startedAt:`number`,logFile:`string`,heartbeatAt:`number`,"lastExit?":Y({code:`number | null`,signal:`string | null`,at:`number`,runtimeMs:`number`}).onUndeclaredKey(`reject`)}).onUndeclaredKey(`reject`);var VA=Y({control:IA.optional(),host:MA.optional(),backups:NA.optional()}).onUndeclaredKey(`reject`),HA=Y({defaults:LA.optional(),logs:PA.optional(),notifications:jA.optional()}).onUndeclaredKey(`reject`),UA=Y({enabled:`boolean`,passwordSet:`boolean`,passwordUpdatedAt:`number | null`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,exposed:`boolean`,blockedReason:`string | null`,sessionTtlMs:`number`,cookieSecure:`string`,trustProxy:`boolean | "loopback"`,maxLoginAttempts:`number`,lockoutMs:`number`}),WA=Y({enabled:`boolean`,certPresent:`boolean`,subject:`string | null`,issuer:`string | null`,validFrom:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,fingerprint:`string | null`,keyMatches:`boolean | null`,error:`string | null`}),GA=Y.enumerated(`caddy`),KA=Y.enumerated(`server`,`panel`,`external`),qA=Y.enumerated(`auto`,`off`,`manual`),JA=Y({id:`/^[a-z0-9][a-z0-9_-]*$/`,host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/`,enabled:`boolean = true`,target:KA.default(()=>`server`),workspace:`string = ""`,server:`string = ""`,url:`string = ""`,path:`string = ""`,tls:qA.default(()=>`auto`),dnsAccount:`string = ""`}).onUndeclaredKey(`reject`),YA=Y({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:`string = ""`}).onUndeclaredKey(`reject`),XA=Y.enumerated(`off`,`local`,`uploaded`,`issued`,`pending`,`failed`,`fallback`),ZA=Y({enabled:`boolean = false`,resolvers:Y(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),QA=Y({enabled:`boolean = false`,engine:GA.default(()=>`caddy`),httpPort:`1 <= number.integer <= 65535 = 80`,httpsPort:`1 <= number.integer <= 65535 = 443`,email:`string = ""`,staging:`boolean = false`,dns01:ZA.default(()=>({})),certificates:YA.array().default(()=>[]),routes:JA.array().default(()=>[])}).onUndeclaredKey(`reject`),$A=Y({id:GA,installed:`boolean`,version:`string | null`,source:Y.enumerated(`downloaded`,`custom`).or(Y(`null`)),path:`string | null`,bytes:`number | null`,error:`string | null`}),ej=Y({id:GA,label:`string`,docsUrl:`string`,releaseUrl:`string`,acme:`boolean`,internalCa:`boolean`,dns01:`boolean`,tcp:`boolean`}),tj=Y({route:JA,status:Y.enumerated(`ok`,`disabled`,`no-upstream`,`error`),upstream:`string | null`,message:`string | null`,"certificate?":Y({state:XA,message:`string | null`,"retryInMinutes?":`number`})}),nj=Y({state:Y.enumerated(`off`,`stopped`,`starting`,`running`,`error`,`unsupported`),pid:`number | null`,urls:Y(`string[]`),certExpiryDays:`number | null`,since:`number | null`,lastError:`string | null`}),rj=Y({id:`string`,label:`string`,present:`boolean`,used:`boolean`,subject:`string | null`,issuer:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,hosts:Y(`string[]`),error:`string | null`}),ij=Y({workspace:`string`,account:`string`,provider:`string`,label:`string`,writesTxt:`boolean`,hasCredentials:`boolean`}),aj=Y({config:QA,engine:$A,engines:ej.array(),status:nj,routes:tj.array(),certificates:rj.array(),"dnsAccounts?":ij.array()}),oj=Y({id:`string`,host:`string`,enabled:`boolean?`,target:KA.optional(),workspace:`string?`,server:`string?`,url:`string?`,path:`string?`,tls:qA.optional(),dnsAccount:`string?`}).onUndeclaredKey(`reject`),sj=Y({enabled:`boolean?`,engine:GA.optional(),httpPort:`1 <= number.integer <= 65535?`,httpsPort:`1 <= number.integer <= 65535?`,email:`string?`,staging:`boolean?`,dns01:Y({enabled:`boolean | null?`,resolvers:`string[] | null?`}).onUndeclaredKey(`reject`).optional(),certificates:YA.array().optional(),routes:oj.array().optional()}).onUndeclaredKey(`reject`),cj=Y({label:`string = ""`,certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`);Y({version:`string = ""`}).onUndeclaredKey(`reject`);var lj=Y({enabled:`boolean`,tokenSet:`boolean`,chatId:`string`,onCrash:`boolean`,onUnhealthy:`boolean`,onForcedRestart:`boolean`,onRecovered:`boolean`,onHost:`boolean`,onDdns:`boolean?`,cooldownMs:`number`,lastResult:`string | null`,lastResultAt:`number | null`});Y({chats:Y({id:`string | number`,title:`string`}).array()});var uj=Y({telegram:lj});Y({authenticated:`boolean`,authRequired:`boolean`,passwordSet:`boolean`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,defaultPassword:`string | null`,sessionTtlMs:`number`});var dj=Y({password:`string`}).onUndeclaredKey(`reject`),fj=Y(`1 <= string <= 512`),pj=Y({currentPassword:`string?`,newPassword:fj}).onUndeclaredKey(`reject`),mj=Y(`"stopped" | "starting" | "running" | "stopping" | "backoff" | "crashed" | "conflict"`),hj=Y(`"disabled" | "unknown" | "healthy" | "unhealthy"`),gj=Y(`"unknown" | "free" | "in-use"`),_j=Y({ts:`number`,stream:Y(`"stdout" | "stderr" | "system"`),text:`string`}),vj=Y({windowMs:`number`,uptimeRatio:`number | null`,restarts:`number`,crashes:`number`,forcedRestarts:`number`,lastCrashAt:`number | null`,lastExitAt:`number | null`,lastRuntimeMs:`number | null`,events:Y({serverId:`string`,ts:`number`,type:`"start" | "exit" | "crash" | "forced-restart" | "unhealthy" | "recovered"`,detail:`string`,runtimeMs:`number?`}).array()}),yj=Y({cpuPercent:`number | null`,rssBytes:`number | null`,processes:`number`,sampledAt:`number`}),bj=Y({path:`string`,totalBytes:`number`,freeBytes:`number`,usedPercent:`number`}),xj=Y({enabled:`boolean`,cpus:`number`,loadAvg:Y(`number[]`),uptimeMs:`number`,memoryUsedPercent:`number`,swapUsedPercent:`number`,tempCelsius:`number | null`,disks:bj.array(),alerts:Y(`string[]`),sampledAt:`number | null`}),Sj=Y({name:`string`,sizeBytes:`number`,createdAt:`number`,encrypted:`boolean`}),Cj=Y({id:`string`,label:`string`,kind:`"settings" | "secrets" | "tls" | "workspace"`,"workspaceId?":`string`,note:`string | null`,items:Y({id:`string`,label:`string`,kind:`"settings" | "servers" | "secrets" | "data"`,"path?":`string`,"origin?":`string`,included:`boolean`,note:`string | null`,"ignoreGenerated?":`boolean`}).array()}),wj=Y({enabled:`boolean`,dir:`string`,keep:`number`,includePaths:Y(`string[]`),entries:Cj.array(),files:Sj.array()});Y({dryRun:`boolean`,encrypted:`boolean`,needsPassword:`boolean`,items:Y({id:`string`,label:`string`,kind:`"settings" | "secrets" | "servers" | "tls" | "data"`,"workspaceId?":`string`,restorable:`boolean`,selected:`boolean`,note:`string | null`}).array(),applied:Y(`string[]`),skipped:Y(`string[]`),restartRequired:`boolean`,reloaded:`boolean`,error:`string?`}),Y({password:fj.optional(),include:Y(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`),Y({name:`string?`,password:fj.optional(),include:Y(`string[]`).optional()}).onUndeclaredKey(`reject`);var Tj=Y({id:`string`,"workspaceId?":`string`,config:uA,bindHost:`string`,url:`string | null`,status:mj,health:hj,portState:gj,pid:`number | null`,adopted:`boolean?`,startedAt:`number | null`,exitCode:`number | null`,exitSignal:`string | null`,restarts:`number`,maxRetries:`number`,lastError:`string | null`,nextRetryAt:`number | null`,unhealthySince:`number | null`,bufferedLines:`number`,history:vj,responseMs:`number | null`,resources:yj.or(Y(`null`))});Y({status:`"ok" | "degraded"`,uptimeMs:`number`,"servers?":Y({total:`number`,running:`number`,crashed:`number`,unhealthy:`number`}),"hostAlerts?":`string[]`});var Ej=Y({label:`string`,port:`number`,host:`string`,bindHost:`string`,url:`string`,openBrowser:`boolean`,restartRequired:`boolean`,protocol:`string`,auth:UA,tls:WA}),Dj=Y({custom:`boolean`,dir:`string`,meta:Y({"name?":`string`,"version?":`string | null`,"uploadedAt?":`number`,"files?":`number.integer >= 1`,"repo?":`string`,"tag?":`string`,"asset?":`string`,"unix?":`number.integer >= 0`}).or(Y(`null`))}),Oj=Y({id:`string`,label:`string`,configPath:`string`,settingsPath:`string`,configError:`string | null`,"configWarnings?":Y(`string[]`),logsDir:`string`,defaults:wA,logs:fA,notifications:uj,"ddns?":xA,serverCount:`number`,runningCount:`number`,crashedCount:`number`,servers:Tj.array()}),kj=Y({control:Ej,host:xj,backups:wj,ui:Dj,workspaces:Oj.array(),"proxy?":aj,projectDir:`string`,dataRoot:`string`,"version?":`string`}),Aj=Y({type:`"hello" | "state" | "log" | "server"`,ts:`number`,"workspaceId?":`string`,serverId:`string?`,state:kj.optional(),server:Tj.optional(),lines:_j.array().optional()});Y({limit:`string?`}),Y({ok:`boolean`,port:`number | null`,terminated:`number[]`,forced:`number[]`,skipped:`number[]`,free:`boolean`}),Y({tail:`string?`,search:`string?`,stream:`"stdout" | "stderr" | "system"?`});var jj=Y({servers:Y({serverId:`string`,label:`string`,status:mj,enabled:`boolean`,sizeBytes:`number`,files:Y({name:`string`,sizeBytes:`number`}).array()}).array()}),Mj=Y({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:Y(`string[]`),searched:`number | null`,lines:_j.array()});Y({botToken:`string?`,chatId:`string?`}).onUndeclaredKey(`reject`),Y({botToken:`string >= 1`}).onUndeclaredKey(`reject`),Y({message:`string`,code:`string`,"detail?":`unknown`}).onUndeclaredKey(`reject`),Y({certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`),Y({control:Ej,host:mA,backups:wj,ui:Dj}).and(Y({rebinding:`boolean`,targetUrl:`string | null`}));var Nj=Y({id:`string`,label:`string`,settingsPath:`string`,configPath:`string`,configError:`string | null`,defaults:wA,logs:fA,notifications:uj});function Pj(e,t){return`${e}/${t}`}function Fj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ij=class extends Error{name=`AuthRequiredError`;constructor(){super(`authentication required`)}};async function Lj(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers}}),r=await n.text(),i=r.length>0?JSON.parse(r):null;if(!n.ok){if(n.status===401&&Fj(i)&&i.code===`AUTH_REQUIRED`)throw new Ij;let e=Fj(i)&&typeof i.message==`string`?i.message:Fj(i)&&`error`in i?String(i.error):`request failed with ${n.status}`;throw Error(e)}return i}async function Rj(e){let t=aj(e);if(t instanceof Y.errors)throw Error(`proxy contract mismatch: ${t.summary}`);return t}async function zj(e){let t=CA(e);if(t instanceof Y.errors)throw Error(`ddns contract mismatch: ${t.summary}`);return t}function Bj(e){return Lj(`/api/proxy/${e}`,{method:`POST`}).then(Rj)}function Vj(){return Bj(`apply`)}function Hj(e){return`/api/backups/${encodeURIComponent(e)}/download`}function Uj(){return Lj(`/api/auth/password`,{method:`DELETE`})}async function Wj(e){return Rj(await Lj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`DELETE`}))}function Gj(e){return Lj(`/api/backups/${encodeURIComponent(e)}`,{method:`DELETE`})}async function Kj(){return Rj(await Lj(`/api/proxy`))}function qj(){return Lj(`/api/auth/session`)}function Jj(){return Lj(`/api/settings`)}async function Yj(e=``){return Rj(await Lj(`/api/proxy/engine`,{method:`POST`,body:JSON.stringify({version:e})}))}function Xj(e){let t=dj({password:e});if(t instanceof Y.errors)throw Error(t.summary);return Lj(`/api/auth/login`,{method:`POST`,body:JSON.stringify(t)})}function Zj(){return Lj(`/api/auth/logout`,{method:`POST`})}async function Qj(e){let t=sj(e);if(t instanceof Y.errors)throw Error(t.summary);return Rj(await Lj(`/api/proxy`,{method:`PATCH`,body:JSON.stringify(t)}))}function $j(e){let t={};return e.password!==void 0&&e.password.length>0&&(t.password=e.password),e.include!==void 0&&(t.include=e.include),t}function eM(e,t,n={}){return Lj(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:JSON.stringify({name:e,...$j(n)})})}async function tM(e){return Rj(await Lj(`/api/proxy/routes/${encodeURIComponent(e)}/retry-certificate`,{method:`POST`}))}function nM(){return Bj(`revert`)}function rM(){return Lj(`/api/settings/ui`,{method:`DELETE`})}function iM(e,t){let n=pj(e===void 0?{newPassword:t}:{currentPassword:e,newPassword:t});if(n instanceof Y.errors)throw Error(n.summary);return Lj(`/api/auth/password`,{method:`POST`,body:JSON.stringify(n)})}function aM(){return Bj(`start`)}function oM(){return Bj(`stop`)}async function sM(e,t,n,r){let i=cj({label:t,certificate:n,privateKey:r});if(i instanceof Y.errors)throw Error(i.summary);return Rj(await Lj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(i)}))}async function cM(e){let t=new FormData;t.append(`file`,e);let n=await fetch(`/api/settings/ui`,{method:`POST`,body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??r?.error??`the upload failed with ${n.status}`);return r}var lM=/^[\w!#$%&'*.^`|~+-]+$/,uM=(e,t,n={})=>{if(!lM.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},dM=(e,t,n)=>(t=encodeURIComponent(t),uM(e,t,n)),fM=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),pM=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},mM=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},hM=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},gM=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function _M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vM(e,t){if(!_M(e)&&!_M(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=_M(n[e])&&_M(r)?vM(n[e],r):r}return n}var yM=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return yM(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),bM=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},xM=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(dM(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=gM(a),a=pM(a,this.pathParams),this.queryParams&&(a=bM(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},SM=((e,t)=>yM(function n(r){let i=t?.buildSearchParams??mM,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=fM(e,a.join(`/`));if(s===`url`||s===`path`){let t=gM(c);return r.args[0]&&(r.args[0].param&&(t=pM(t,r.args[0].param)),r.args[0].query&&(t=bM(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=gM(c),n=hM(r.args[0]?.param?pM(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new xM(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=vM(t,e);return l.fetch(r.args[0],a)}return l},[]))(typeof window>`u`?`http://127.0.0.1`:window.location.origin);Y({workspaces:Oj.array()});var CM=Y({workspace:Oj}),wM=Y({ok:`boolean`,removed:`unknown`});function TM(e){return e==null||e.length===0?``:`?workspace=${encodeURIComponent(e)}`}function EM(e,t){return{param:{id:t},query:e.length>0?{workspace:e}:{}}}function DM(e,t,n){let r=n??new URLSearchParams;t.length>0&&r.set(`workspace`,t);let i=r.toString();return i.length>0?`${e}?${i}`:e}async function OM(){let e=kj(await Lj(`/api/state`));if(e instanceof Y.errors)throw Error(`state contract mismatch: ${e.summary}`);return e}async function kM(e){let t=CM(e);if(t instanceof Y.errors)throw Error(`workspace contract mismatch: ${t.summary}`);return t.workspace}async function AM(e){return kM(await Lj(`/api/workspaces`,{method:`POST`,body:JSON.stringify(e)}))}async function jM(e,t){return kM(await Lj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({label:t})}))}async function MM(e){let t=wM(await Lj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`DELETE`}));if(t instanceof Y.errors)throw Error(`workspace removal contract mismatch: ${t.summary}`);return t}function NM(e){let t=VA(e);if(t instanceof Y.errors)throw Error(t.summary);return Lj(`/api/settings`,{method:`PATCH`,body:JSON.stringify(t)})}async function PM(e,t){let n=HA(t);if(n instanceof Y.errors)throw Error(n.summary);let r=Nj(await Lj(DM(`/api/settings/workspace`,e),{method:`PATCH`,body:JSON.stringify(n)}));if(r instanceof Y.errors)throw Error(`workspace settings contract mismatch: ${r.summary}`);return r}async function FM(e){let t=jj(await Lj(DM(`/api/logs`,e)));if(t instanceof Y.errors)throw Error(`logs contract mismatch: ${t.summary}`);return t.servers}async function IM(e,t,n){let r=new URLSearchParams;n.tail!==void 0&&r.set(`tail`,String(n.tail)),n.search!==void 0&&n.search.length>0&&r.set(`search`,n.search),n.stream!==void 0&&n.stream.length>0&&r.set(`stream`,n.stream);let i=Mj(await Lj(DM(`/api/logs/${encodeURIComponent(t)}`,e,r)));if(i instanceof Y.errors)throw Error(`log history contract mismatch: ${i.summary}`);return i}function LM(e,t){return Lj(DM(`/api/logs/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function RM(e,t,n){return DM(`/api/logs/${encodeURIComponent(t)}/download`,e,new URLSearchParams({file:n}))}function zM(e,t){if(t!==void 0&&t.length===0)throw Error("nothing is selected: omit `include` to capture everything, or select at least one item");let n={};return e!==void 0&&e.length>0&&(n.password=e),t!==void 0&&(n.include=t),Lj(`/api/backups`,{method:`POST`,body:JSON.stringify(n)})}async function BM(e,t,n={}){let r=new FormData;r.append(`file`,e),n.password!==void 0&&n.password.length>0&&r.append(`password`,n.password),n.include!==void 0&&r.append(`include`,JSON.stringify(n.include));let i=await fetch(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:r}),a=await i.json().catch(()=>null);if(!i.ok)throw Error(a?.message??a?.error??`restore failed with ${i.status}`);return a}function VM(e,t){return Lj(DM(`/api/notifications/token`,e),{method:`PUT`,body:JSON.stringify({botToken:t})})}function HM(e){return Lj(DM(`/api/notifications/token`,e),{method:`DELETE`})}function UM(e,t){return Lj(DM(`/api/notifications/test`,e),{method:`POST`,body:JSON.stringify(t)})}function WM(e,t){return Lj(DM(`/api/notifications/detect-chats`,e),{method:`POST`,body:JSON.stringify(t)})}async function GM(e){return zj(await Lj(DM(`/api/ddns`,e)))}async function KM(e,t){return zj(await Lj(DM(`/api/ddns`,e),{method:`PUT`,body:JSON.stringify(t)}))}async function qM(e,t,n,r){return zj(await Lj(DM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`PUT`,body:JSON.stringify({provider:n,credentials:r})}))}async function JM(e,t){return zj(await Lj(DM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`DELETE`}))}async function YM(e){return zj(await Lj(DM(`/api/ddns/check`,e),{method:`POST`}))}function XM(e,t){return Lj(`/api/settings/tls`,{method:`POST`,body:JSON.stringify({certificate:e,privateKey:t})})}function ZM(){return Lj(`/api/settings/tls`,{method:`DELETE`})}async function QM(e,t,n){let r=await SM.api.servers[`:id`][n].$post(EM(e,t)),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.message??`request failed with ${r.status}`);return i??{ok:!0}}function $M(e){return Lj(DM(`/api/servers/start-all`,e),{method:`POST`})}async function eN(e,t){let n=await SM.api.servers[`:id`][`free-port`].$post(EM(e,t)),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??`request failed with ${n.status}`);return r??{ok:!0,port:null,terminated:[],forced:[],skipped:[],free:!1}}function tN(e){return Lj(DM(`/api/servers/stop-all`,e),{method:`POST`})}function nN(e,t){return Lj(DM(`/api/servers/${encodeURIComponent(t)}/clear-logs`,e),{method:`POST`})}function rN(e,t,n){return Lj(DM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`PATCH`,body:JSON.stringify(n)})}function iN(e,t){return Lj(DM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function aN(e,t){return Lj(DM(`/api/servers`,e),{method:`POST`,body:JSON.stringify(t)})}var oN=A(null),sN=A(null);function cN(e){return e===null?`wait`:e.authRequired&&!e.authenticated?`login`:`connect`}function lN(){async function e(){try{oN.value=await qj()}catch{oN.value=null}}async function t(e){sN.value=null;try{return oN.value=await Xj(e),!0}catch(e){return sN.value=e instanceof Error?e.message:String(e),!1}}async function n(){try{await Zj()}finally{await e()}}function r(){oN.value={authenticated:!1,authRequired:!0,passwordSet:oN.value?.passwordSet??!0,apiTokenSet:oN.value?.apiTokenSet??!1,usingDefaultPassword:oN.value?.usingDefaultPassword??!1,defaultPassword:oN.value?.defaultPassword??null,sessionTtlMs:oN.value?.sessionTtlMs??0}}async function i(t,n){sN.value=null;try{return await iM(t,n),await e(),null}catch(e){return e instanceof Error?e.message:String(e)}}async function a(){sN.value=null;try{return await Uj(),await e(),null}catch(e){return e instanceof Error?e.message:String(e)}}return{session:nn(oN),error:nn(sN),refresh:e,login:t,logout:n,requireLogin:r,setPassword:i,clearPassword:a}}var uN=A([]),dN=1;function fN(e){uN.value=uN.value.filter(t=>t.id!==e)}function pN(e,t=4800){let n=dN++;return uN.value=[...uN.value,{...e,id:n}],t>0&&setTimeout(fN,t,n),n}function mN(){return{toasts:nn(uN),dismiss:fN,push:pN,success:(e,t)=>pN({tone:`ok`,title:e,description:t}),failure:(e,t)=>pN({tone:`danger`,title:e,description:t},9e3),info:(e,t)=>pN({tone:`info`,title:e,description:t}),warn:(e,t)=>pN({tone:`warn`,title:e,description:t},7e3)}}var hN=4e3;function gN(){return en({ts:[],cpu:[],rss:[],probe:[],lastSampledAt:-1})}function _N(e){let t=e.ts.length-120;t<=0||(e.ts.splice(0,t),e.cpu.splice(0,t),e.rss.splice(0,t),e.probe.splice(0,t))}function vN(e,t,n){let r=t.resources?.sampledAt??0,i=e.ts[e.ts.length-1]??0;if(!(r!==e.lastSampledAt||n-i>=hN)){e.probe.length>0&&(e.probe[e.probe.length-1]=t.responseMs);return}e.lastSampledAt=r,e.ts.push(n);let a=t.status===`running`;e.cpu.push(a?t.resources?.cpuPercent??null:null),e.rss.push(a?t.resources?.rssBytes??null:null),e.probe.push(t.responseMs),_N(e)}function yN(e){let t=0;for(let n of e)n!==null&&n>t&&(t=n);return t}function bN(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!=null)return n}return null}var xN=8e3,SN=A(null),CN=A(`connecting`),wN=A(null),TN=A(Date.now()),EN=new Map,DN=mN(),ON=new Map,kN=A(0),AN=null,jN=null;function MN(e){let t=ON.get(e);if(t)return t;let n={lines:[],version:A(0),refs:0,source:null};return ON.set(e,n),n}function NN(e,t){let n=MN(e),r=n.lines.concat(t);n.lines=r.length>8e3?r.slice(r.length-xN):r,n.version.value+=1,kN.value+=1}function PN(e){return ON.get(e)?.lines??[]}function FN(e){let t=ON.get(e);t&&(t.lines=[],t.version.value+=1,kN.value+=1)}function IN(e){let t=EN.get(e);if(t)return t;let n=gN();return EN.set(e,n),n}function LN(e){e.workspaceId!==void 0&&vN(IN(Pj(e.workspaceId,e.id)),e,Date.now())}function RN(e){let t=SN.value;if(!t)return;let n=e.workspaceId,r=n===void 0?t.workspaces.filter(t=>t.servers.some(t=>t.id===e.id)):t.workspaces.filter(e=>e.id===n);if(r.length!==1)return;let i=r[0],a=i.servers.find(t=>t.id===e.id),o=n===void 0?{...e,workspaceId:i.id}:e;i.servers=a===void 0?[...i.servers,o]:i.servers.map(t=>t.id===e.id?o:t)}function zN(e){let t;try{t=JSON.parse(e)}catch{return}let n=Aj(t);if(n instanceof Y.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,n.summary);return}if(n.type===`hello`||n.type===`state`){if(n.state){SN.value=n.state;for(let e of SN.value.workspaces)for(let t of e.servers)LN(t)}return}if(n.type===`server`&&n.server){let e=n.server;RN(e),LN(e);return}if(n.type===`log`&&n.serverId&&n.lines){let e=n.workspaceId;if(e===void 0)return;NN(Pj(e,n.serverId),n.lines)}}function BN(e,t,n){let r=Pj(e,t);n.lines=[],n.version.value+=1,kN.value+=1;let i=new EventSource(`/api/servers/${encodeURIComponent(t)}/stream${TM(e)}`),a=e=>{let t=e,n;try{n=JSON.parse(t.data)}catch{return}let i=Aj(n);if(i instanceof Y.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,i.summary);return}if(i.type===`log`&&i.lines){NN(r,i.lines);return}i.type===`server`&&i.server&&RN(i.server)};for(let e of[`log`,`server`])i.addEventListener(e,a);i.onerror=()=>{},n.source=i}function VN(e,t){let n=MN(Pj(e,t));n.refs+=1,n.source||BN(e,t,n)}function HN(e,t){let n=ON.get(Pj(e,t));n&&(n.refs=Math.max(0,n.refs-1),n.refs===0&&(n.source?.close(),n.source=null))}function UN(){if(AN)return;jN??=setInterval(()=>{TN.value=Date.now()},1e3);let e=new EventSource(`/api/events?logs=0`);AN=e,CN.value=`connecting`,e.onopen=()=>{CN.value=`open`},e.onerror=()=>{CN.value=`closed`};for(let t of[`hello`,`state`,`server`,`log`])e.addEventListener(t,e=>{zN(e.data)})}function WN(){AN?.close(),AN=null,jN&&clearInterval(jN),jN=null}function GN(e,t){let n=G(()=>{let n=yn(e),r=yn(t);return n===null||r===null?null:Pj(n,r)}),r=null;return N(n,e=>{if(r!==null&&r!==e){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&HN(e,t)}if(r=e,e!==null){let[t,n]=e.split(`/`);t!==void 0&&n!==void 0&&VN(t,n)}},{immediate:!0}),ze(()=>{if(r!==null){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&HN(e,t)}r=null}),{version:G(()=>{let e=n.value;return kN.value,e===null?0:ON.get(e)?.version.value??0}),lines(){let e=n.value;return e===null?[]:PN(e)},count:G(()=>{let e=n.value;return kN.value,e===null?0:ON.get(e)?.lines.length??0}),clear(){let e=n.value;e!==null&&FN(e)}}}function KN(){let e=G(()=>SN.value?.workspaces??[]),t=G(()=>e.value.flatMap(e=>e.servers.map(t=>({workspace:e,server:t})))),n=G(()=>SN.value?.control??null),r=G(()=>SN.value?.host??null),i=G(()=>SN.value?.backups??null),a=G(()=>SN.value?.proxy??null),o=G(()=>SN.value?.projectDir??null),s=G(()=>SN.value?.dataRoot??null),c=G(()=>SN.value?.version??null);function l(e){return SN.value?.workspaces.find(t=>t.id===e)}function u(e,t){return l(e)?.servers.find(e=>e.id===t)}function d(e,t){return IN(Pj(e,t))}async function f(){if(SN.value===null)try{SN.value=await OM()}catch(e){e instanceof Ij&&lN().requireLogin()}}async function p(e,t){wN.value=null;try{let n=await e();SN.value=await OM();let r=typeof t.success==`function`?t.success(n):t.success;return r&&DN.success(r),n}catch(e){if(e instanceof Ij){lN().requireLogin();return}let n=e instanceof Error?e.message:String(e);wN.value=n,DN.failure(t.title,n);return}}return{appState:SN,workspaces:e,allServers:t,control:n,host:r,backups:i,proxy:a,projectDir:o,dataRoot:s,version:c,connection:nn(CN),lastError:nn(wN),now:nn(TN),workspaceById:l,ensureState:f,serverById:u,seriesOf:d,refresh:(e=`Refresh failed`)=>p(async()=>{},{title:e}),start:(e,t)=>p(()=>QM(e,t,`start`),{title:`Could not start ${t}`}),stop:(e,t)=>p(()=>QM(e,t,`stop`),{title:`Could not stop ${t}`}),restart:(e,t)=>p(()=>QM(e,t,`restart`),{title:`Could not restart ${t}`}),startAll:e=>p(()=>$M(e),{title:`Could not start every server`,success:`Starting every enabled server`}),stopAll:e=>p(()=>tN(e),{title:`Could not stop every server`,success:`Stopping every server`}),setAutostart:(e,t,n)=>p(()=>rN(e,t,{autostart:n}),{title:`Could not change autostart for ${t}`}),setEnabled:(e,t,n)=>p(()=>rN(e,t,{enabled:n}),{title:`Could not change ${t}`}),freePort:(e,t)=>p(()=>eN(e,t),{title:`Could not free the port for ${t}`,success:e=>e.free?`Port ${e.port} is free — start ${t} now`:`Port ${e.port} is still held`}),setBind:(e,t,n)=>{let r=Qk(n);return r===null?(DN.failure(`Could not change the bind for ${t}`,`"${n}" is not a bind value`),Promise.resolve(void 0)):p(()=>rN(e,t,{bind:r}),{title:`Could not change the bind for ${t}`})},saveConfig:(e,t,n)=>p(()=>rN(e,t,n),{title:`Could not save ${t}`,success:`${t} updated`}),saveGlobalSettings:e=>p(()=>NM(e),{title:`Could not save the settings`}),saveWorkspaceSettings:(e,t)=>p(()=>PM(e,t),{title:`Could not save the settings`}),clearLogs:(e,t)=>p(async()=>{await nN(e,t),FN(Pj(e,t))},{title:`Could not clear the logs for ${t}`,success:`Buffer cleared`}),create:(e,t)=>p(()=>aN(e,t),{title:`Could not add the server`,success:`Server added`}),remove:(e,t)=>p(async()=>{await iN(e,t),HN(e,t),ON.delete(Pj(e,t)),EN.delete(Pj(e,t))},{title:`Could not remove ${t}`,success:`${t} removed`})}}var qN=`hh.theme`;function JN(){try{let e=localStorage.getItem(qN);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var YN=A(JN()),XN=A(typeof matchMedia<`u`&&matchMedia(`(prefers-color-scheme: dark)`).matches),ZN=!1;function QN(){ZN||typeof matchMedia>`u`||(ZN=!0,matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e=>{XN.value=e.matches,eP()}))}var $N=G(()=>YN.value===`system`?XN.value:YN.value===`dark`);function eP(){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,$N.value)}function tP(){QN(),eP();function e(e){YN.value=e;try{localStorage.setItem(qN,e)}catch{}eP()}return{preference:YN,isDark:$N,setPreference:e,cycle(){e(YN.value===`light`?`dark`:YN.value===`dark`?`system`:`light`)}}}var nP=`hh.workspace`;function rP(){try{return localStorage.getItem(nP)}catch{return null}}function iP(e){try{e===null?localStorage.removeItem(nP):localStorage.setItem(nP,e)}catch{}}var aP=A(rP()),oP=A(!1);function sP(){let e=KN(),t=mN(),n=G(()=>e.appState.value?.workspaces??[]),r=G(()=>{let e=n.value;return e.find(e=>e.id===aP.value)??e[0]??null}),i=G(()=>r.value?.id??``);N([n,aP],()=>{let e=n.value;if(e.length===0)return;let t=e.find(e=>e.id===aP.value)?.id??e[0].id;t!==aP.value&&(aP.value=t,iP(t))},{immediate:!0});function a(e){aP.value=e,iP(e)}let o=G(()=>r.value?.servers??[]),s=G(()=>r.value?.defaults??null),c=G(()=>r.value?.logs??null),l=G(()=>r.value?.notifications??null),u=G(()=>r.value?.configError??null),d=G(()=>r.value?.configWarnings??[]),f=G(()=>r.value?.logsDir??null),p=G(()=>r.value?.serverCount??0),m=G(()=>r.value?.runningCount??0),h=G(()=>r.value?.crashedCount??0);function g(e){return o.value.find(t=>t.id===e)}function _(t){return e.seriesOf(i.value,t)}async function v(n){oP.value=!0;try{let r=await AM(n.trim().length>0?{label:n.trim()}:{});return await e.refresh(`Could not read the workspaces`),a(r.id),t.success(`Workspace “${r.label}” created`),r}catch(e){t.failure(`Could not create the workspace`,e instanceof Error?e.message:String(e));return}finally{oP.value=!1}}async function y(n,r){try{return await jM(n,r.trim()),await e.refresh(`Could not read the workspaces`),t.success(`Workspace renamed`),!0}catch(e){return t.failure(`Could not rename the workspace`,e instanceof Error?e.message:String(e)),!1}}async function b(n){try{return await MM(n),await e.refresh(`Could not read the workspaces`),t.success(`Workspace deleted`),!0}catch(e){return t.failure(`Could not delete the workspace`,e instanceof Error?e.message:String(e)),!1}}return{workspaces:n,selectedId:nn(aP),selected:r,activeId:i,creating:nn(oP),select:a,create:v,rename:y,remove:b,servers:o,serverById:g,seriesOf:_,defaults:s,logsConfig:c,notifications:l,configError:u,configWarnings:d,logsDir:f,serverCount:p,runningCount:m,crashedCount:h,refresh:e.refresh,start:t=>e.start(i.value,t),stop:t=>e.stop(i.value,t),restart:t=>e.restart(i.value,t),startAll:()=>e.startAll(i.value),stopAll:()=>e.stopAll(i.value),setEnabled:(t,n)=>e.setEnabled(i.value,t,n),setAutostart:(t,n)=>e.setAutostart(i.value,t,n),setBind:(t,n)=>e.setBind(i.value,t,n),freePort:t=>e.freePort(i.value,t),clearLogs:t=>e.clearLogs(i.value,t),saveConfig:(t,n)=>e.saveConfig(i.value,t,n),createServer:t=>e.create(i.value,t),removeServer:t=>e.remove(i.value,t)}}function cP(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=cP(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function lP(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=cP(e))&&(r&&(r+=` `),r+=t);return r}var uP=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},dP=(e,t)=>({classGroupId:e,validator:t}),fP=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),pP=`-`,mP=[],hP=`arbitrary..`,gP=e=>{let t=yP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return vP(e);let n=e.split(pP);return _P(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?uP(i,t):t:i||mP}return n[e]||mP}}},_P=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=_P(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(pP):e.slice(t).join(pP),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},vP=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?hP+r:void 0})(),yP=e=>{let{theme:t,classGroups:n}=e;return bP(n,t)},bP=(e,t)=>{let n=fP();for(let r in e){let i=e[r];xP(i,n,r,t)}return n},xP=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];SP(i,t,n,r)}},SP=(e,t,n,r)=>{if(typeof e==`string`){CP(e,t,n);return}if(typeof e==`function`){wP(e,t,n,r);return}TP(e,t,n,r)},CP=(e,t,n)=>{let r=e===``?t:EP(t,e);r.classGroupId=n},wP=(e,t,n,r)=>{if(DP(e)){xP(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(dP(n,e))},TP=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];xP(o,EP(t,a),n,r)}},EP=(e,t)=>{let n=e,r=t.split(pP),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=fP(),n.nextPart.set(t,i)),n=i}return n},DP=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,OP=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},kP=`!`,AP=`:`,jP=[],MP=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),NP=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===AP){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(kP)?(c=s.slice(0,-1),l=!0):s.startsWith(kP)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return MP(t,l,c,u)};if(t){let e=t+AP,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):MP(jP,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},PP=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},FP=e=>({cache:OP(e.cacheSize),parseClassName:NP(e),sortModifiers:PP(e),postfixLookupClassGroupIds:IP(e),...gP(e)}),IP=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},LP=/\s+/,RP=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(LP),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+kP:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},zP=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=BP(n))&&(i&&(i+=` `),i+=r);return i},BP=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=BP(e[r]))&&(n&&(n+=` `),n+=t);return n},VP=(e,...t)=>{let n,r,i,a,o=o=>(n=FP(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=RP(e,n);return i(e,a),a};return a=o,(...e)=>a(zP(...e))},HP=[],UP=e=>{let t=t=>t[e]||HP;return t.isThemeGetter=!0,t.themeKey=e,t},WP=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,GP=/^\((?:(\w[\w-]*):)?(.+)\)$/i,KP=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,qP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,YP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,XP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,QP=e=>KP.test(e),$P=e=>!!e&&!Number.isNaN(Number(e)),eF=e=>!!e&&Number.isInteger(Number(e)),tF=e=>e.endsWith(`%`)&&$P(e.slice(0,-1)),nF=e=>qP.test(e),rF=()=>!0,iF=e=>JP.test(e)&&!YP.test(e),aF=()=>!1,oF=e=>XP.test(e),sF=e=>ZP.test(e),cF=e=>!X(e)&&!Z(e),lF=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),uF=e=>TF(e,kF,aF),X=e=>WP.test(e),dF=e=>TF(e,AF,iF),fF=e=>TF(e,jF,$P),pF=e=>TF(e,NF,rF),mF=e=>TF(e,MF,aF),hF=e=>TF(e,DF,aF),gF=e=>TF(e,OF,sF),_F=e=>TF(e,PF,oF),Z=e=>GP.test(e),vF=e=>EF(e,AF),yF=e=>EF(e,MF),bF=e=>EF(e,DF),xF=e=>EF(e,kF),SF=e=>EF(e,OF),CF=e=>EF(e,PF,!0),wF=e=>EF(e,NF,!0),TF=(e,t,n)=>{let r=WP.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},EF=(e,t,n=!1)=>{let r=GP.exec(e);return r?r[1]?t(r[1]):n:!1},DF=e=>e===`position`||e===`percentage`,OF=e=>e===`image`||e===`url`,kF=e=>e===`length`||e===`size`||e===`bg-size`,AF=e=>e===`length`,jF=e=>e===`number`,MF=e=>e===`family-name`,NF=e=>e===`number`||e===`weight`,PF=e=>e===`shadow`,FF=VP(()=>{let e=UP(`color`),t=UP(`font`),n=UP(`text`),r=UP(`font-weight`),i=UP(`tracking`),a=UP(`leading`),o=UP(`breakpoint`),s=UP(`container`),c=UP(`spacing`),l=UP(`radius`),u=UP(`shadow`),d=UP(`inset-shadow`),f=UP(`text-shadow`),p=UP(`drop-shadow`),m=UP(`blur`),h=UP(`perspective`),g=UP(`aspect`),_=UP(`ease`),v=UP(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[QP,`full`,`auto`,...w()],ee=()=>[eF,`none`,`subgrid`,Z,X],E=()=>[`auto`,{span:[`full`,eF,Z,X]},eF,Z,X],te=()=>[eF,`auto`,Z,X],ne=()=>[`auto`,`min`,`max`,`fr`,Z,X],re=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ie=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ae=()=>[`auto`,...w()],oe=()=>[QP,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],se=()=>[s,QP,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ce=()=>[QP,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],D=()=>[e,Z,X],le=()=>[...b(),bF,hF,{position:[Z,X]}],ue=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],de=()=>[`auto`,`cover`,`contain`,xF,uF,{size:[Z,X]}],fe=()=>[tF,vF,dF],pe=()=>[``,`none`,`full`,l,Z,X],me=()=>[``,$P,vF,dF],he=()=>[`solid`,`dashed`,`dotted`,`double`],ge=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],_e=()=>[$P,tF,bF,hF],ve=()=>[``,`none`,m,Z,X],ye=()=>[`none`,$P,Z,X],be=()=>[`none`,$P,Z,X],O=()=>[$P,Z,X],xe=()=>[QP,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[nF],breakpoint:[nF],color:[rF],container:[nF],"drop-shadow":[nF],ease:[`in`,`out`,`in-out`],font:[cF],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[nF],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[nF],shadow:[nF],spacing:[`px`,$P],text:[nF],"text-shadow":[nF],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,QP,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[lF],columns:[{columns:[$P,`auto`,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[eF,`auto`,Z,X]}],basis:[{basis:[QP,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[$P,QP,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,$P,Z,X]}],shrink:[{shrink:[``,$P,Z,X]}],order:[{order:[eF,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...re(),`normal`]}],"justify-items":[{"justify-items":[...ie(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ie()]}],"align-content":[{content:[`normal`,...re()]}],"align-items":[{items:[...ie(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ie(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...ie(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ie()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ae()}],mx:[{mx:ae()}],my:[{my:ae()}],ms:[{ms:ae()}],me:[{me:ae()}],mbs:[{mbs:ae()}],mbe:[{mbe:ae()}],mt:[{mt:ae()}],mr:[{mr:ae()}],mb:[{mb:ae()}],ml:[{ml:ae()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:oe()}],"inline-size":[{inline:[`auto`,...se()]}],"min-inline-size":[{"min-inline":[`auto`,...se()]}],"max-inline-size":[{"max-inline":[`none`,...se()]}],"block-size":[{block:[`auto`,...ce()]}],"min-block-size":[{"min-block":[`auto`,...ce()]}],"max-block-size":[{"max-block":[`none`,...ce()]}],w:[{w:[s,`screen`,...oe()]}],"min-w":[{"min-w":[s,`screen`,`none`,...oe()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...oe()]}],h:[{h:[`screen`,`lh`,...oe()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...oe()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...oe()]}],"font-size":[{text:[`base`,n,vF,dF]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,wF,pF]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,tF,X]}],"font-family":[{font:[yF,mF,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[$P,`none`,Z,fF]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...he(),`wavy`]}],"text-decoration-thickness":[{decoration:[$P,`from-font`,`auto`,Z,dF]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[$P,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[eF,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:de()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},eF,Z,X],radial:[``,Z,X],conic:[``,eF,Z,X]},SF,gF]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:fe()}],"gradient-via-pos":[{via:fe()}],"gradient-to-pos":[{to:fe()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:pe()}],"rounded-s":[{"rounded-s":pe()}],"rounded-e":[{"rounded-e":pe()}],"rounded-t":[{"rounded-t":pe()}],"rounded-r":[{"rounded-r":pe()}],"rounded-b":[{"rounded-b":pe()}],"rounded-l":[{"rounded-l":pe()}],"rounded-ss":[{"rounded-ss":pe()}],"rounded-se":[{"rounded-se":pe()}],"rounded-ee":[{"rounded-ee":pe()}],"rounded-es":[{"rounded-es":pe()}],"rounded-tl":[{"rounded-tl":pe()}],"rounded-tr":[{"rounded-tr":pe()}],"rounded-br":[{"rounded-br":pe()}],"rounded-bl":[{"rounded-bl":pe()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":me()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...he(),`hidden`,`none`]}],"divide-style":[{divide:[...he(),`hidden`,`none`]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...he(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[$P,Z,X]}],"outline-w":[{outline:[``,$P,vF,dF]}],"outline-color":[{outline:D()}],shadow:[{shadow:[``,`inner`,`none`,u,CF,_F]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":[`none`,d,CF,_F]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:me()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[$P,dF]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":[`none`,f,CF,_F]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[$P,Z,X]}],"mix-blend":[{"mix-blend":[...ge(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[$P]}],"mask-image-linear-from-pos":[{"mask-linear-from":_e()}],"mask-image-linear-to-pos":[{"mask-linear-to":_e()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":_e()}],"mask-image-t-to-pos":[{"mask-t-to":_e()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":_e()}],"mask-image-r-to-pos":[{"mask-r-to":_e()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":_e()}],"mask-image-b-to-pos":[{"mask-b-to":_e()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":_e()}],"mask-image-l-to-pos":[{"mask-l-to":_e()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":_e()}],"mask-image-x-to-pos":[{"mask-x-to":_e()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":_e()}],"mask-image-y-to-pos":[{"mask-y-to":_e()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":_e()}],"mask-image-radial-to-pos":[{"mask-radial-to":_e()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[$P]}],"mask-image-conic-from-pos":[{"mask-conic-from":_e()}],"mask-image-conic-to-pos":[{"mask-conic-to":_e()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:de()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ve()}],brightness:[{brightness:[$P,Z,X]}],contrast:[{contrast:[$P,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,CF,_F]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:[``,$P,Z,X]}],"hue-rotate":[{"hue-rotate":[$P,Z,X]}],invert:[{invert:[``,$P,Z,X]}],saturate:[{saturate:[$P,Z,X]}],sepia:[{sepia:[``,$P,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[$P,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[$P,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,$P,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$P,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,$P,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[$P,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[$P,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,$P,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[$P,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[$P,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":[`scale-3d`],skew:[{skew:O()}],"skew-x":[{"skew-x":O()}],"skew-y":[{"skew-y":O()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":[`translate-none`],zoom:[{zoom:[eF,Z,X]}],accent:[{accent:D()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...D()]}],"stroke-w":[{stroke:[$P,vF,dF,fF]}],stroke:[{stroke:[`none`,...D()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return FF(lP(e))}var IF={stopped:{label:`Stopped`,tone:`neutral`,transitional:!1},starting:{label:`Starting`,tone:`warn`,transitional:!0},running:{label:`Running`,tone:`ok`,transitional:!1},stopping:{label:`Stopping`,tone:`warn`,transitional:!0},backoff:{label:`Restarting`,tone:`warn`,transitional:!0},crashed:{label:`Crashed`,tone:`danger`,transitional:!1},conflict:{label:`Port conflict`,tone:`danger`,transitional:!1}},LF={disabled:{label:`Not checked`,tone:`neutral`},unknown:{label:`Not probed`,tone:`neutral`},healthy:{label:`Healthy`,tone:`ok`},unhealthy:{label:`Unhealthy`,tone:`danger`}},RF={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},zF={ok:`bg-ok-soft text-ok border-ok/25`,warn:`bg-warn-soft text-warn border-warn/25`,danger:`bg-danger-soft text-danger border-danger/25`,info:`bg-info-soft text-info border-info/25`,neutral:`bg-hover text-muted border-line`,accent:`bg-accent-soft text-accent border-accent/25`},BF={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,info:`bg-info`,neutral:`bg-faint`,accent:`bg-accent`};function VF(e,t){return e===`crashed`||e===`conflict`||t===`unhealthy`?`danger`:e===`starting`||e===`stopping`||e===`backoff`?`warn`:e===`running`?`ok`:`neutral`}var HF={start:`Started`,exit:`Exited`,crash:`Crashed`,"forced-restart":`Forced restart`,unhealthy:`Unhealthy`,recovered:`Recovered`},UF={start:`ok`,exit:`neutral`,crash:`danger`,"forced-restart":`warn`,unhealthy:`warn`,recovered:`info`},WF={viewBox:`0 0 80 80`,class:`size-full -rotate-0`},GF=[`stroke-dasharray`],KF=[`stroke-dasharray`],qF={class:`absolute inset-0 grid place-items-center`},JF={class:`font-mono text-sm font-semibold tabular-nums text-ink`},YF={class:`text-2xs font-medium text-faint`},XF=34,ZF=.75,QF=P({__name:`Gauge`,props:{value:{},label:{},display:{default:void 0},size:{default:74},tone:{default:void 0},warnAt:{default:75},dangerAt:{default:90}},setup(e){let t=e,n=2*Math.PI*XF,r=G(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(1,Math.max(0,t.value/100))*ZF),i=G(()=>t.tone?t.tone:t.value===null||!Number.isFinite(t.value)?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),a={ok:`stroke-ok`,warn:`stroke-warn`,danger:`stroke-danger`,info:`stroke-info`,neutral:`stroke-faint`,accent:`stroke-accent`};return(e,o)=>(R(),z(`div`,{class:O(j(Q)(`flex flex-col items-center gap-1`))},[V(`div`,{class:`relative`,style:ge({width:`${t.size}px`,height:`${t.size}px`})},[(R(),z(`svg`,WF,[V(`circle`,{cx:`40`,cy:`40`,r:XF,fill:`none`,class:`stroke-line-soft`,"stroke-width":6,"stroke-dasharray":`${ZF*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,8,GF),V(`circle`,{cx:`40`,cy:`40`,r:XF,fill:`none`,class:O([a[i.value],`transition-[stroke-dasharray] duration-300 ease-out`]),"stroke-width":6,"stroke-dasharray":`${r.value*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,10,KF)])),V(`div`,qF,[V(`span`,JF,k(t.display??(t.value===null?`—`:`${Math.round(t.value)}%`)),1)])],4),V(`span`,YF,k(t.label),1)],2))}}),$F=P({__name:`Meter`,props:{value:{},warnAt:{default:75},dangerAt:{default:90},height:{default:`h-1.5`},class:{default:void 0}},setup(e){let t=e,n=G(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(100,Math.max(0,t.value))),r=G(()=>t.value===null?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),i={ok:`bg-ok/80`,warn:`bg-warn/85`,danger:`bg-danger/85`,info:`bg-info/80`,neutral:`bg-faint/60`,accent:`bg-accent/80`};return(e,a)=>(R(),z(`div`,{class:O(j(Q)(`w-full overflow-hidden rounded-full bg-line-soft`,t.height,t.class))},[V(`div`,{class:O(j(Q)(`h-full rounded-full transition-[width] duration-300 ease-out`,i[r.value])),style:ge({width:`${n.value}%`})},null,6)],2))}}),eI={key:0,class:`grid size-10 place-items-center rounded-full border border-line bg-panel-2 text-faint`},tI={class:`max-w-sm space-y-1`},nI={class:`text-sm font-medium text-ink`},rI={key:0,class:`text-xs leading-relaxed text-muted`},iI={key:1,class:`flex items-center gap-2`},aI=P({__name:`EmptyState`,props:{title:{},description:{default:void 0},compact:{type:Boolean,default:!1}},setup(e){return(e,t)=>(R(),z(`div`,{class:O(j(Q)(`flex flex-col items-center justify-center gap-3 text-center`,e.$props.compact?`px-4 py-8`:`px-6 py-14`))},[e.$slots.icon?(R(),z(`div`,eI,[I(e.$slots,`icon`)])):W(``,!0),V(`div`,tI,[V(`p`,nI,k(e.$props.title),1),e.$props.description?(R(),z(`p`,rI,k(e.$props.description),1)):W(``,!0)]),e.$slots.action?(R(),z(`div`,iI,[I(e.$slots,`action`)])):W(``,!0)],2))}});function oI(e){return e===null||!Number.isFinite(e)?`—`:`${(e*100).toFixed(e>=.999?0:1)}%`}function sI(e){if(!Number.isFinite(e)||e<0)return`—`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function cI(e,t){let n=Math.max(0,e-t);return n<1e3?`now`:n<6e4?`in ${Math.ceil(n/1e3)}s`:`in ${Math.ceil(n/6e4)}m`}function lI(e,t){if(e===null)return`never`;let n=Math.max(0,t-e);return n<6e4?`${Math.floor(n/1e3)}s ago`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function uI(e){let t=new Date(e);return`${t.toLocaleTimeString(void 0,{hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function dI(e){return new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function fI(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`:`—`}function pI(e){if(e===null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t<1e3?`${e} B`:t<1e6?`${(e/1e3).toFixed(0)} kB`:t<1e9?`${(e/1e3/1e3).toFixed(1)} MB`:`${(e/1e3/1e3/1e3).toFixed(2)} GB`}function mI(e){return e===null||!Number.isFinite(e)?`—`:e>=100?`${Math.round(e)}%`:`${e.toFixed(1)}%`}function hI(e){return e===void 0?`unset`:typeof e==`string`?e:JSON.stringify(e)}var gI={key:1,class:`space-y-4`},_I={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},vI={class:`grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line-soft pt-3 sm:grid-cols-4`},yI={class:`flex items-center gap-1 text-2xs text-faint`},bI={class:`font-mono text-xs text-ink`},xI={class:`font-mono text-xs tabular-nums text-ink`},SI={class:`flex items-center gap-1 text-2xs text-faint`},CI={class:`font-mono text-xs text-ink`},wI={class:`flex items-center gap-1 text-2xs text-faint`},TI={class:`font-mono text-xs text-ink`},EI={class:`space-y-2 border-t border-line-soft pt-3`},DI={class:`flex items-center gap-1.5 text-2xs font-medium text-faint`},OI={class:`flex items-baseline justify-between gap-2`},kI=[`title`],AI={class:`shrink-0 font-mono text-2xs tabular-nums text-faint`},jI={key:0,class:`space-y-1 rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2`},MI=P({__name:`HostVitalsPanel`,props:{host:{},now:{}},setup(e){let t=e,n=G(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=G(()=>t.host?.loadAvg.map(e=>e.toFixed(2)).join(` `)??`—`);return(e,i)=>!t.host||!t.host.enabled?(R(),B(aI,{key:0,compact:``,title:`Host sampling is off`,description:`Turn it on in Settings to collect load, memory, disk and temperature.`})):(R(),z(`div`,gI,[V(`div`,_I,[H(QF,{value:n.value===null?null:n.value/2*100,label:`Load / cpu`,display:n.value===null?`—`:n.value.toFixed(2),size:72,"warn-at":70,"danger-at":100},null,8,[`value`,`display`]),H(QF,{value:t.host.memoryUsedPercent,label:`Memory`,size:72},null,8,[`value`]),H(QF,{value:t.host.swapUsedPercent,label:`Swap`,size:72,"warn-at":50},null,8,[`value`]),H(QF,{value:t.host.tempCelsius===null?null:t.host.tempCelsius/85*100,label:`CPU temp`,display:t.host.tempCelsius===null?`n/a`:`${Math.round(t.host.tempCelsius)}°C`,size:72},null,8,[`value`,`display`])]),V(`dl`,vI,[V(`div`,null,[V(`dt`,yI,[H(j(qv),{class:`size-3`}),i[0]||=U(`CPUs `,-1)]),V(`dd`,bI,k(t.host.cpus),1)]),V(`div`,null,[i[1]||=V(`dt`,{class:`text-2xs text-faint`},` Load 1 / 5 / 15 `,-1),V(`dd`,xI,k(r.value),1)]),V(`div`,null,[V(`dt`,SI,[H(j(uy),{class:`size-3`}),i[2]||=U(`Memory used `,-1)]),V(`dd`,CI,k(t.host.memoryUsedPercent.toFixed(0))+`% `,1)]),V(`div`,null,[V(`dt`,wI,[H(j(Ny),{class:`size-3`}),i[3]||=U(`Sampled `,-1)]),V(`dd`,TI,k(j(lI)(t.host.sampledAt,t.now)),1)])]),V(`div`,EI,[V(`p`,DI,[H(j(ty),{class:`size-3`}),i[4]||=U(`Filesystems `,-1)]),(R(!0),z(L,null,F(t.host.disks,e=>(R(),z(`div`,{key:e.path,class:`space-y-1`},[V(`div`,OI,[V(`span`,{class:`truncate font-mono text-2xs text-muted`,title:e.path},k(e.path),9,kI),V(`span`,AI,k(j(fI)(e.totalBytes-e.freeBytes))+` / `+k(j(fI)(e.totalBytes))+` · `+k(e.usedPercent.toFixed(0))+`% `,1)]),H($F,{value:e.usedPercent},null,8,[`value`])]))),128))]),t.host.alerts.length>0?(R(),z(`div`,jI,[i[5]||=V(`p`,{class:`text-2xs font-medium text-danger`},` Thresholds breached `,-1),(R(!0),z(L,null,F(t.host.alerts,e=>(R(),z(`p`,{key:e,class:`text-2xs text-danger`},k(e),1))),128))])):W(``,!0)]))}}),NI={key:1,class:`flex flex-col`},PI={class:`min-w-0 flex-1`},FI={class:`flex items-baseline gap-1.5`},II={class:`truncate text-xs font-medium text-ink`},LI=[`title`],RI={key:0,class:`text-muted`},zI={class:`shrink-0 pt-0.5 text-2xs text-faint`},BI=P({__name:`ActivityFeed`,props:{servers:{},now:{},limit:{default:12},serverId:{default:void 0}},setup(e){let t=e,n={start:gy,exit:Ay,crash:Bv,"forced-restart":xy,unhealthy:Iy,recovered:Vv},r=G(()=>{let e=[];for(let n of t.servers)if(t.serverId===void 0||n.id===t.serverId)for(let t of n.history.events)e.push({...t,label:n.config.label??n.id});return e.sort((e,t)=>t.ts-e.ts).slice(0,t.limit)});return(e,i)=>{let a=fa(`RouterLink`);return r.value.length===0?(R(),B(aI,{key:0,compact:``,title:`No events in the last 24 hours`,description:`Starts, exits, crashes and recoveries show up here as they happen.`})):(R(),z(`ol`,NI,[(R(!0),z(L,null,F(r.value,(e,r)=>(R(),z(`li`,{key:`${e.serverId}-${e.ts}-${r}`,class:O([`flex items-start gap-2.5 border-line-soft py-2`,r>0&&`border-t`])},[(R(),B(ma(n[e.type]),{class:O(j(Q)(`mt-0.5 size-3.5 shrink-0`,j(RF)[j(UF)[e.type]]))},null,8,[`class`])),V(`div`,PI,[V(`p`,FI,[V(`span`,II,k(j(HF)[e.type]),1),H(a,{to:`/servers/${e.serverId}`,class:`truncate text-2xs text-muted hover:text-accent`},{default:M(()=>[U(k(e.label),1)]),_:2},1032,[`to`])]),V(`p`,{class:`mt-0.5 truncate font-mono text-2xs text-faint`,title:e.detail},[U(k(e.detail)+` `,1),e.runtimeMs===void 0?W(``,!0):(R(),z(`span`,RI,` · ran `+k(j(sI)(e.runtimeMs)),1))],8,LI)]),V(`span`,zI,k(j(lI)(e.ts,t.now)),1)],2))),128))]))}}}),VI=[`restart`,`health`,`stop`];function HI(e,t){return JSON.stringify(UI(e))===JSON.stringify(UI(t))}function UI(e){if(Array.isArray(e))return e.map(UI);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!=null&&(t[n]=UI(r))}return t}return e??null}function WI(e,t,n=[]){let r={};for(let[i,a]of Object.entries(t)){if(n.includes(i)){let t=e[i]??{},n={};for(let[e,r]of Object.entries(a??{}))HI(t[e],r)||(n[e]=r);Object.keys(n).length>0&&(r[i]=n);continue}HI(e[i],a)||(r[i]=a)}return r}function GI(e,t){let n=e;return WI({...n,label:n.label??``},t,VI)}function KI(e,t=``){return typeof e!=`object`||!e||Array.isArray(e)?[{path:t,value:e}]:Object.entries(e).flatMap(([e,n])=>KI(n,t.length===0?e:`${t}.${e}`))}function qI(e,t){let n=new Map(KI(t).map(e=>[e.path,e.value]));return KI(e).map(e=>({path:e.path,from:n.get(e.path),to:e.value}))}function JI(e){let t=0;for(let n of Object.values(e))t+=typeof n==`object`&&n&&!Array.isArray(n)?JI(n):1;return t}async function YI(e,t=8e3){let n=Date.now()+t;for(;;){try{if((await fetch(`${e}/api/auth/session`,{cache:`no-store`})).ok)return!0}catch{}if(Date.now()>n)return!1;await new Promise(e=>setTimeout(e,250))}}var XI={enabled:!0,maxRetries:3,baseDelayMs:1e3,factor:2,maxDelayMs:3e4,resetAfterMs:6e4},ZI={enabled:!0,mode:`port`,http:{path:`/`,method:`GET`,expectStatusBelow:400,expectBody:``},intervalMs:5e3,timeoutMs:1500,unhealthyThreshold:3,forceRestartAfterMs:0,startTimeoutMs:2e4},QI={signal:`SIGTERM`,killGroup:!0,graceMs:5e3,killPortHolders:!1};function $I(e){return{...e,http:{...e.http}}}function eL(){return{control:{label:`home-hosted`,port:3999,host:`local`,openBrowser:!1,tlsEnabled:!1},auth:{enabled:!1,sessionTtlMs:6048e5,cookieSecure:`auto`,trustProxy:`off`,maxLoginAttempts:5,lockoutMs:6e4},host:{enabled:!0,intervalMs:15e3,diskPaths:`.`,diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,loadPerCpu:2,tempCelsius:85},backups:{enabled:!0,keep:5,includePaths:``}}}function tL(){return{defaults:{enabled:!0,autostart:!1,bind:`local`,onPortConflict:`block`,logBufferLines:500,restart:{...XI},health:$I(ZI),stop:{...QI}},logs:{persist:!0,maxBytes:2e6,keep:3},telegram:{enabled:!1,chatId:``,cooldownMs:12e4,onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0}}}function nL(e){return e===`loopback`?`loopback`:e===`any`||e===!0}function rL(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:nL(e.trustProxy),maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function iL(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:e.trustProxy===`loopback`?`loopback`:e.trustProxy?`any`:`off`,maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function aL(e){return{label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,tlsEnabled:e.tls.enabled}}function oL(e){return{enabled:e.enabled,chatId:e.chatId,cooldownMs:e.cooldownMs,onCrash:e.onCrash,onUnhealthy:e.onUnhealthy,onForcedRestart:e.onForcedRestart,onRecovered:e.onRecovered,onHost:e.onHost,onDdns:e.onDdns??!0}}function sL(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function cL(e){return{enabled:e.enabled,intervalMs:e.intervalMs,diskPaths:e.diskPaths.join(`, `),diskUsedPercent:e.diskUsedPercent,memoryUsedPercent:e.memoryUsedPercent,swapUsedPercent:e.swapUsedPercent,loadPerCpu:e.loadPerCpu,tempCelsius:e.tempCelsius}}function lL(e){return{enabled:e.enabled,keep:e.keep,includePaths:e.includePaths.join(`, `)}}function uL(e,t){return WI(e,{...t,diskPaths:sL(t.diskPaths)})}function dL(e,t){return WI(e,{...t,includePaths:sL(t.includePaths)})}function fL(e,t){return WI({label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,auth:rL(e.auth),tls:{enabled:e.tls.enabled}},{label:t.control.label,port:t.control.port,host:t.control.host,openBrowser:t.control.openBrowser,auth:{...t.auth,trustProxy:nL(t.auth.trustProxy)},tls:{enabled:t.control.tlsEnabled}},[`auth`,`tls`])}function pL(e,t){return WI(e,t,[`restart`,`health`,`stop`])}function mL(e,t){return WI(e,t)}function hL(e,t){return WI({telegram:oL(e)},{telegram:{...t}},[`telegram`])}function gL(e,t){switch(t){case`control`:return{...e.control,auth:{...e.auth}};case`host`:return{...e.host};case`backups`:return{...e.backups}}}function _L(e,t){return t===`auth`?{...e.auth}:t===`tls`?e.control.tlsEnabled:{label:e.control.label,port:e.control.port,host:e.control.host,openBrowser:e.control.openBrowser}}function vL(e,t,n){return t!==void 0&&xL(t[n],_L(e,n))}function yL(e,t,n){t.control={...t.control??{},[n]:_L(e,n)}}function bL(e,t){switch(t){case`defaults`:return{...e.defaults,restart:{...e.defaults.restart},health:$I(e.defaults.health),stop:{...e.defaults.stop}};case`logs`:return{...e.logs};case`telegram`:return{...e.telegram}}}function xL(e,t){return e!==void 0&&JSON.stringify(e)!==JSON.stringify(t)}function SL(e,t){return e.label!==t.control.label||e.port!==t.control.port||e.host!==t.control.host||e.openBrowser!==t.control.openBrowser}function CL(e,t){return e.tls.enabled!==t.control.tlsEnabled}function wL(e,t){return JI(WI({...iL(e.auth)},{...t.auth}))>0}function TL(e,t,n){return G({get:e,set:e=>{t(e===null||Number.isNaN(e)?n:e)}})}async function EL(e){if(!e.rebinding)return null;let t=e.targetUrl??e.control.url;return t.length===0||t===window.location.origin?null:await YI(t)?(window.location.replace(t),null):`The control panel did not answer on ${t}. Check the console for the new listener.`}function DL(e){return e.split(`
|
|
40
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}function OL(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
|
|
41
|
-
`)}function kL(e){let t={};for(let n of DL(e)){let e=n.indexOf(`=`);e<=0||(t[n.slice(0,e).trim()]=n.slice(e+1).trim())}return t}function AL(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}var jL=/^[a-z0-9][a-z0-9_-]*$/;function ML(e){return{id:``,label:``,command:``,args:``,cwd:``,port:null,bind:e?.bind??`local`,autostart:e?.autostart??!1,persistent:!1,enabled:e?.enabled??!0,onPortConflict:e?.onPortConflict??`block`,logBufferLines:null,dependsOn:``,envFile:``,env:``,dataEnvs:``,backupPaths:``,backupIgnoreGenerated:!0,maxRssMb:null,restart:{...e?.restart??XI},health:$I(e?.health??ZI),stop:{...e?.stop??QI},bootstrapEnabled:!1,bootstrapCommand:``,bootstrapArgs:``,bootstrapEnv:``,bootstrapTimeoutMs:12e4,bootstrapRunOnce:!0}}function NL(e){return e!==null&&Number.isFinite(e)?e:0}function PL(e){return{args:[],cwd:`.`,env:{},dataEnvs:{},dependsOn:[],envFile:``,backupPaths:[],backupIgnoreGenerated:!0,resources:{maxRssBytes:0},bind:e?.bind??`local`,enabled:e?.enabled??!0,autostart:e?.autostart??!1,persistent:!1,onPortConflict:e?.onPortConflict??`block`,logBufferLines:e?.logBufferLines??500}}function FL(e){return e===null||Number.isNaN(e)||Number.isInteger(e)&&e>=1&&e<=65535?null:`Port must be a whole number between 1 and 65535.`}function IL(e,t){let n=NL(e.maxRssMb),r=NL(e.bootstrapTimeoutMs),i=PL(t),a=WI({restart:t?.restart??XI,health:t?.health??ZI,stop:t?.stop??QI},{restart:e.restart,health:e.health,stop:e.stop});return{...WI(i,{args:DL(e.args),cwd:e.cwd.trim().length>0?e.cwd.trim():`.`,env:kL(e.env),dataEnvs:kL(e.dataEnvs),dependsOn:AL(e.dependsOn),envFile:e.envFile.trim(),backupPaths:DL(e.backupPaths),backupIgnoreGenerated:e.backupIgnoreGenerated,resources:{maxRssBytes:n>0?Math.round(n*1024*1024):0},bind:e.bind,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent,onPortConflict:e.onPortConflict,logBufferLines:NL(e.logBufferLines)>0?NL(e.logBufferLines):i.logBufferLines}),...a,id:e.id.trim(),...e.label.trim().length===0?{}:{label:e.label.trim()},command:e.command.trim(),...e.port===null||Number.isNaN(e.port)?{}:{port:e.port},...e.bootstrapEnabled?{bootstrap:{command:e.bootstrapCommand.trim(),args:DL(e.bootstrapArgs),env:kL(e.bootstrapEnv),timeoutMs:r>=1e3?r:12e4,runOnce:e.bootstrapRunOnce}}:{}}}function LL(e){return e.id.trim().length===0?`An id is required — it is the key this server lives under.`:jL.test(e.id.trim())?e.command.trim().length===0?`A command is required — the executable the supervisor spawns.`:e.bootstrapEnabled&&e.bootstrapCommand.trim().length===0?`A bootstrap needs a command to run.`:FL(e.port):`The id must start with a lowercase letter or digit and contain only lowercase letters, digits, dashes and underscores.`}var RL={class:`mb-3 flex items-start justify-between gap-3`},zL={class:`min-w-0`},BL={class:`text-xs font-semibold text-ink`},VL={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},HL={class:`flex shrink-0 items-center gap-2`},UL=P({__name:`FieldGroup`,props:{title:{},description:{default:void 0},columns:{default:2},dense:{type:Boolean,default:!1},class:{default:void 0}},setup(e){let t=e,n=G(()=>({1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`})[t.columns]);return(e,r)=>(R(),z(`section`,{class:O(j(Q)(`rounded-panel border border-line bg-panel-2/40`,t.dense?`p-3`:`p-3.5`,t.class))},[V(`header`,RL,[V(`div`,zL,[V(`h3`,BL,k(t.title),1),t.description?(R(),z(`p`,VL,k(t.description),1)):W(``,!0)]),V(`div`,HL,[I(e.$slots,`actions`)])]),V(`div`,{class:O(j(Q)(`grid gap-3`,n.value))},[I(e.$slots,`default`)],2)],2))}});function WL(e){return e==null||Number.isNaN(e)?``:String(e)}function GL(e,t){let n=String(e??``).trim();if(n.length===0)return t?null:NaN;let r=Number(n);return Number.isNaN(r)?NaN:r}var KL=`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 focus-visible:ring-offset-2 focus-visible:ring-offset-page`,qL=`text-xs font-medium text-muted`,JL=`text-2xs leading-4 text-faint`,YL=[`w-full min-w-0 rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-sm text-ink`,`placeholder:text-faint transition-colors duration-150`,`hover:border-line/80 hover:bg-page`,`focus:border-accent focus:bg-page focus:outline-none focus:ring-2 focus:ring-accent/25`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25`].join(` `),XL=`${YL} font-mono text-xs`,ZL=[`for`],QL=[`id`,`step`,`min`,`max`,`aria-invalid`],$L={key:1,class:`text-2xs text-danger`},eR=P({inheritAttrs:!1,__name:`NumberField`,props:Ra({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1},nullable:{type:Boolean,default:!1},step:{default:void 0},min:{default:void 0},max:{default:void 0}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`),r=li(),i=G({get:()=>WL(n.value),set:e=>{n.value=GL(e,t.nullable)}}),a=G(()=>n.value!==null&&Number.isNaN(n.value));return(e,n)=>(R(),z(`div`,{class:O(j(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(R(),z(`label`,{key:0,for:j(r),class:O(j(qL))},k(t.label),11,ZL)):W(``,!0),xr(V(`input`,js({id:j(r),"onUpdate:modelValue":n[0]||=e=>i.value=e,type:`number`,inputmode:`numeric`,step:t.step,min:t.min,max:t.max,class:j(Q)(j(YL),`font-mono tabular-nums`,(t.error||a.value)&&`border-danger`),"aria-invalid":t.error||a.value?!0:void 0},e.$attrs),null,16,QL),[[ql,i.value]]),t.error?(R(),z(`p`,$L,k(t.error),1)):t.hint?(R(),z(`p`,{key:2,class:O(j(JL))},k(t.hint),3)):W(``,!0)],2))}}),tR=[`for`],nR={class:`relative`},rR=[`id`],iR=[`value`,`disabled`],aR={key:1,class:`text-2xs text-danger`},oR=P({inheritAttrs:!1,__name:`SelectField`,props:Ra({label:{default:void 0},hint:{default:void 0},error:{default:null},options:{},wide:{type:Boolean,default:!1},mono:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`),r=li();return(e,i)=>(R(),z(`div`,{class:O(j(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(R(),z(`label`,{key:0,for:j(r),class:O(j(qL))},k(t.label),11,tR)):W(``,!0),V(`div`,nR,[xr(V(`select`,js({id:j(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,class:j(Q)(j(YL),`cursor-pointer appearance-none pr-7`,t.mono&&`font-mono text-xs`,t.error&&`border-danger`)},e.$attrs),[(R(!0),z(L,null,F(t.options,e=>(R(),z(`option`,{key:e.value,value:e.value,disabled:e.disabled},k(e.label),9,iR))),128))],16,rR),[[Zl,n.value]]),H(j(Fv),{class:`pointer-events-none absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`,"aria-hidden":`true`})]),t.error?(R(),z(`p`,aR,k(t.error),1)):t.hint?(R(),z(`p`,{key:2,class:O(j(JL))},k(t.hint),3)):W(``,!0)],2))}}),sR=[`for`],cR=[`id`,`aria-invalid`,`aria-describedby`],lR=[`id`],uR=[`id`],dR=P({inheritAttrs:!1,__name:`TextField`,props:Ra({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`),r=li(),i=G(()=>t.hint||t.error?`${r}-hint`:void 0);return(e,a)=>(R(),z(`div`,{class:O(j(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(R(),z(`label`,{key:0,for:j(r),class:O(j(qL))},k(t.label),11,sR)):W(``,!0),xr(V(`input`,js({id:j(r),"onUpdate:modelValue":a[0]||=e=>n.value=e,class:j(Q)(j(YL),t.error&&`border-danger`),"aria-invalid":t.error?!0:void 0,"aria-describedby":i.value},e.$attrs),null,16,cR),[[nu,n.value]]),t.error?(R(),z(`p`,{key:1,id:`${j(r)}-hint`,class:`text-2xs text-danger`},k(t.error),9,lR)):t.hint?(R(),z(`p`,{key:2,id:`${j(r)}-hint`,class:O(j(JL))},k(t.hint),11,uR)):W(``,!0)],2))}}),fR=[`id`],pR={key:0,class:`block text-2xs text-faint`},mR=P({__name:`ToggleSwitch`,props:Ra({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1},trailing:{type:Boolean,default:!1},wide:{type:Boolean,default:!1},srOnly:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=li(),r=oo(e,`modelValue`);return(e,i)=>(R(),z(`div`,{class:O(j(Q)(`flex items-center gap-2.5`,t.trailing&&`flex-row-reverse justify-end`,t.wide&&`sm:col-span-2`))},[H(j(sg),{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,disabled:t.disabled,"aria-labelledby":j(n),class:O(j(Q)(`relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-150`,`data-[state=checked]:border-accent data-[state=checked]:bg-accent`,`data-[state=unchecked]:border-line data-[state=unchecked]:bg-line-soft`,`disabled:cursor-not-allowed disabled:opacity-45`,j(KL)))},{default:M(()=>[H(j(cg),{class:`block size-3 translate-x-[3px] rounded-full bg-white shadow-sm transition-transform duration-150 ease-out data-[state=checked]:translate-x-[16px]`})]),_:1},8,[`modelValue`,`disabled`,`aria-labelledby`,`class`]),V(`label`,{class:`min-w-0 cursor-pointer select-none`,onClick:i[1]||=e=>!t.disabled&&(r.value=!r.value)},[V(`span`,{id:j(n),class:O(j(Q)(`block text-xs text-ink`,t.srOnly&&`sr-only`))},k(t.label),11,fR),t.hint?(R(),z(`span`,pR,k(t.hint),1)):W(``,!0)])],2))}}),hR=P({__name:`LifecycleFields`,props:Ra({showHttp:{type:Boolean,default:!0}},{restart:{required:!0},restartModifiers:{},health:{required:!0},healthModifiers:{},stop:{required:!0},stopModifiers:{}}),emits:[`update:restart`,`update:health`,`update:stop`],setup(e){let t=oo(e,`restart`),n=oo(e,`health`),r=oo(e,`stop`);function i(e,t,n=0){return G({get:e,set:e=>t(e===null||Number.isNaN(e)?n:e)})}let a=i(()=>t.value.maxRetries,e=>t.value.maxRetries=e),o=i(()=>t.value.baseDelayMs,e=>t.value.baseDelayMs=e),s=i(()=>t.value.factor,e=>t.value.factor=e,1),c=i(()=>t.value.maxDelayMs,e=>t.value.maxDelayMs=e),l=i(()=>t.value.resetAfterMs,e=>t.value.resetAfterMs=e),u=i(()=>n.value.intervalMs,e=>n.value.intervalMs=e,500),d=i(()=>n.value.timeoutMs,e=>n.value.timeoutMs=e,100),f=i(()=>n.value.unhealthyThreshold,e=>n.value.unhealthyThreshold=e,1),p=i(()=>n.value.forceRestartAfterMs,e=>n.value.forceRestartAfterMs=e),m=i(()=>n.value.startTimeoutMs,e=>n.value.startTimeoutMs=e),h=G({get:()=>n.value.http.expectStatus??null,set:e=>{e===null||Number.isNaN(e)?delete n.value.http.expectStatus:n.value.http.expectStatus=e}}),g=i(()=>n.value.http.expectStatusBelow,e=>n.value.http.expectStatusBelow=e,400),_=i(()=>r.value.graceMs,e=>r.value.graceMs=e),v=[{value:`SIGTERM`,label:`SIGTERM — ask it to stop`},{value:`SIGINT`,label:`SIGINT — interrupt (Ctrl-C)`},{value:`SIGKILL`,label:`SIGKILL — kill immediately`}];return(i,y)=>(R(),z(L,null,[H(UL,{title:`Restart policy`,description:`Backoff between attempts after a crash.`,columns:3},{default:M(()=>[H(mR,{modelValue:t.value.enabled,"onUpdate:modelValue":y[0]||=e=>t.value.enabled=e,label:`Restart on crash`,wide:``},null,8,[`modelValue`]),H(eR,{modelValue:j(a),"onUpdate:modelValue":y[1]||=e=>mn(a)?a.value=e:null,label:`Max retries`,min:0,hint:`Attempts before the server is left crashed.`},null,8,[`modelValue`]),H(eR,{modelValue:j(o),"onUpdate:modelValue":y[2]||=e=>mn(o)?o.value=e:null,label:`Base delay (ms)`,min:0},null,8,[`modelValue`]),H(eR,{modelValue:j(s),"onUpdate:modelValue":y[3]||=e=>mn(s)?s.value=e:null,label:`Backoff factor`,min:1,step:.1},null,8,[`modelValue`]),H(eR,{modelValue:j(c),"onUpdate:modelValue":y[4]||=e=>mn(c)?c.value=e:null,label:`Max delay (ms)`,min:0},null,8,[`modelValue`]),H(eR,{modelValue:j(l),"onUpdate:modelValue":y[5]||=e=>mn(l)?l.value=e:null,label:`Reset after (ms)`,min:0,hint:`A run this long clears the retry counter.`},null,8,[`modelValue`])]),_:1}),H(UL,{title:`Health check`,description:`How readiness is probed once the process is up.`,columns:3},{default:M(()=>[H(mR,{modelValue:n.value.enabled,"onUpdate:modelValue":y[6]||=e=>n.value.enabled=e,label:`Probe this server`,wide:``},null,8,[`modelValue`]),H(oR,{modelValue:n.value.mode,"onUpdate:modelValue":y[7]||=e=>n.value.mode=e,label:`Probe type`,options:[{value:`port`,label:`TCP port — connection only`},{value:`http`,label:`HTTP request — assert a response`}]},null,8,[`modelValue`]),H(eR,{modelValue:j(u),"onUpdate:modelValue":y[8]||=e=>mn(u)?u.value=e:null,label:`Interval (ms)`,min:500,step:100},null,8,[`modelValue`]),H(eR,{modelValue:j(d),"onUpdate:modelValue":y[9]||=e=>mn(d)?d.value=e:null,label:`Timeout (ms)`,min:100,step:100},null,8,[`modelValue`]),H(eR,{modelValue:j(f),"onUpdate:modelValue":y[10]||=e=>mn(f)?f.value=e:null,label:`Unhealthy after`,min:1,hint:`Consecutive failed probes.`},null,8,[`modelValue`]),H(eR,{modelValue:j(p),"onUpdate:modelValue":y[11]||=e=>mn(p)?p.value=e:null,label:`Force restart after (ms)`,min:0,hint:`0 disables it.`},null,8,[`modelValue`]),H(eR,{modelValue:j(m),"onUpdate:modelValue":y[12]||=e=>mn(m)?m.value=e:null,label:`Start timeout (ms)`,min:0},null,8,[`modelValue`]),e.showHttp&&n.value.mode===`http`?(R(),z(L,{key:0},[H(dR,{modelValue:n.value.http.path,"onUpdate:modelValue":y[13]||=e=>n.value.http.path=e,label:`HTTP path`,placeholder:`/healthz`},null,8,[`modelValue`]),H(oR,{modelValue:n.value.http.method,"onUpdate:modelValue":y[14]||=e=>n.value.http.method=e,label:`HTTP method`,options:[{value:`GET`,label:`GET`},{value:`HEAD`,label:`HEAD`}]},null,8,[`modelValue`]),H(eR,{modelValue:h.value,"onUpdate:modelValue":y[15]||=e=>h.value=e,label:`Expect status`,nullable:``,hint:`Blank accepts anything below.`},null,8,[`modelValue`]),H(eR,{modelValue:j(g),"onUpdate:modelValue":y[16]||=e=>mn(g)?g.value=e:null,label:`Healthy below status`,min:100},null,8,[`modelValue`]),H(dR,{modelValue:n.value.http.expectBody,"onUpdate:modelValue":y[17]||=e=>n.value.http.expectBody=e,label:`Body must contain`,placeholder:`optional substring`,wide:``,hint:n.value.http.method===`HEAD`&&n.value.http.expectBody.length>0?`HEAD has no response body, so this check is ignored — use GET, or clear it.`:void 0},null,8,[`modelValue`,`hint`])],64)):W(``,!0)]),_:1}),H(UL,{title:`Stop behaviour`,description:`How the process tree is asked to go away.`,columns:3},{default:M(()=>[H(oR,{modelValue:r.value.signal,"onUpdate:modelValue":y[18]||=e=>r.value.signal=e,label:`Signal`,options:v},null,8,[`modelValue`]),H(eR,{modelValue:j(_),"onUpdate:modelValue":y[19]||=e=>mn(_)?_.value=e:null,label:`Grace period (ms)`,min:0},null,8,[`modelValue`]),H(mR,{modelValue:r.value.killGroup,"onUpdate:modelValue":y[20]||=e=>r.value.killGroup=e,label:`Kill the whole process group`},null,8,[`modelValue`]),H(mR,{modelValue:r.value.killPortHolders,"onUpdate:modelValue":y[21]||=e=>r.value.killPortHolders=e,label:`Also kill whatever holds the port`,wide:``},null,8,[`modelValue`])]),_:1})],64))}}),gR=[`type`,`disabled`,`aria-busy`],$=P({inheritAttrs:!1,__name:`AppButton`,props:{variant:{default:`secondary`},size:{default:`sm`},type:{default:`button`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},setup(e){let t=e,n=Pa(),r={primary:`bg-accent text-accent-ink border-transparent hover:brightness-110 active:brightness-95 shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]`,secondary:`bg-raise text-ink border-line hover:bg-hover`,ghost:`bg-transparent text-muted border-transparent hover:bg-hover hover:text-ink`,danger:`bg-danger text-white border-transparent hover:brightness-110 active:brightness-95`,"danger-ghost":`bg-transparent text-danger border-danger/30 hover:bg-danger-soft`},i={xs:`h-6 gap-1 px-1.5 text-2xs`,sm:`h-8 gap-1.5 px-2.5 text-xs`,md:`h-9 gap-2 px-3.5 text-sm`,icon:`h-9 w-9 justify-center`,"icon-sm":`h-8 w-8 justify-center`},a=G(()=>Q(`inline-flex select-none items-center rounded-control border font-medium whitespace-nowrap`,`transition-[background-color,border-color,color,filter,opacity] duration-150 ease-out`,`disabled:pointer-events-none disabled:opacity-45`,r[t.variant],i[t.size],t.block&&`w-full`,KL,n.class));return(e,r)=>(R(),z(`button`,js({...j(n),class:void 0},{type:t.type,class:a.value,disabled:t.disabled||t.loading,"aria-busy":t.loading||void 0}),[t.loading?(R(),B(j(oy),{key:0,class:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`})):W(``,!0),I(e.$slots,`default`)],16,gR))}}),_R=[`open`],vR={class:`flex cursor-pointer list-none select-none items-center gap-1.5 px-3 py-2 text-xs font-semibold text-ink [&::-webkit-details-marker]:hidden`},yR={key:0,class:`ml-1 truncate text-2xs font-normal text-faint`},bR={class:`grid gap-3 border-t border-line-soft px-3 py-3`},xR=P({__name:`Disclosure`,props:{title:{},hint:{default:void 0},open:{type:Boolean,default:!1}},setup(e){let t=e;return(e,n)=>(R(),z(`details`,{class:`group rounded-panel border border-line bg-panel-2/40`,open:t.open},[V(`summary`,vR,[H(j(Lv),{class:`size-3.5 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90`,"aria-hidden":`true`}),U(` `+k(t.title)+` `,1),t.hint?(R(),z(`span`,yR,k(t.hint),1)):W(``,!0)]),V(`div`,bR,[I(e.$slots,`default`)])],8,_R))}}),SR={class:`flex shrink-0 items-start justify-between gap-4 border-b border-line px-4 py-3`},CR={class:`min-w-0`},wR={class:`min-h-0 flex-1 overflow-y-auto px-4 py-3.5`},TR={key:0,class:`flex shrink-0 items-center justify-end gap-2 border-t border-line bg-panel-2 px-4 py-3`},ER=P({__name:`Modal`,props:Ra({title:{},description:{default:void 0},width:{default:`w-[min(92vw,34rem)]`}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=oo(e,`open`);return(e,r)=>(R(),B(j(cf),{open:n.value,"onUpdate:open":r[0]||=e=>n.value=e},{default:M(()=>[H(j(Jf),null,{default:M(()=>[H(j(Kf),{class:`fixed inset-0 z-50 bg-black/45 backdrop-blur-[1px] data-[state=closed]:animate-[hh-fade-out_120ms_ease-in] data-[state=open]:animate-[hh-fade-in_150ms_ease-out]`}),H(j(Uf),{class:O(j(Q)(`fixed left-1/2 top-1/2 z-50 flex max-h-[88dvh] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-panel border border-line bg-panel shadow-float`,`data-[state=closed]:animate-[hh-pop-out_120ms_ease-in] data-[state=open]:animate-[hh-pop-in_160ms_var(--ease-out-quick)]`,t.width))},{default:M(()=>[V(`header`,SR,[V(`div`,CR,[H(j(Yf),{class:`text-sm font-semibold text-ink`},{default:M(()=>[U(k(t.title),1)]),_:1}),t.description?(R(),B(j(Wf),{key:0,class:`mt-0.5 text-xs text-muted`},{default:M(()=>[U(k(t.description),1)]),_:1})):W(``,!0)]),H(j(lf),{class:O(j(Q)(`-mr-1 -mt-0.5 grid size-7 shrink-0 place-items-center rounded-control text-muted transition-colors duration-150 hover:bg-hover hover:text-ink`,j(KL))),"aria-label":`Close`},{default:M(()=>[H(j(Ry),{class:`size-4`})]),_:1},8,[`class`])]),V(`div`,wR,[I(e.$slots,`default`)]),e.$slots.footer?(R(),z(`footer`,TR,[I(e.$slots,`footer`)])):W(``,!0)]),_:3},8,[`class`])]),_:3})]),_:3},8,[`open`]))}}),DR=[`for`],OR=[`id`,`rows`,`placeholder`],kR={key:1,class:`text-2xs text-danger`},AR=P({inheritAttrs:!1,__name:`TextAreaField`,props:Ra({label:{default:void 0},hint:{default:void 0},error:{default:null},rows:{default:3},placeholder:{default:void 0},wide:{type:Boolean,default:!0},mono:{type:Boolean,default:!0}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`),r=li();return(e,i)=>(R(),z(`div`,{class:O(j(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(R(),z(`label`,{key:0,for:j(r),class:O(j(qL))},k(t.label),11,DR)):W(``,!0),xr(V(`textarea`,js({id:j(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,rows:t.rows,placeholder:t.placeholder,spellcheck:`false`,class:j(Q)(t.mono?j(XL):`font-sans`,`resize-y leading-relaxed`,t.error&&`border-danger`)},e.$attrs),null,16,OR),[[ql,n.value]]),t.error?(R(),z(`p`,kR,k(t.error),1)):t.hint?(R(),z(`p`,{key:2,class:O(j(JL))},k(t.hint),3)):W(``,!0)],2))}}),jR={class:`rounded-panel border border-line-soft bg-panel-2/40 p-3`},MR={class:`mt-1.5 flex flex-wrap gap-1`},NR={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},PR=P({__name:`AddServerDialog`,props:Ra({workspaceId:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Ra([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`open`),a=KN(),o=A(!1),s=A(null),c=[`{port}`,`{host}`,`{home}`,`{projectDir}`,`{dataRoot}`,`{id}`,`{label}`,`{cwd}`,`{bind}`,`{lanIp}`],l=G(()=>a.workspaceById(n.workspaceId)?.defaults),u=G(()=>a.workspaceById(n.workspaceId)?.label??`this workspace`),d=en(ML(l.value)),f=G(()=>FL(d.port));function p(){Object.assign(d,ML(l.value)),s.value=null}N(i,e=>{e&&p()});async function m(){s.value=null;let e=LL(d);if(e!==null){s.value=e;return}let t=BA(IL(d,l.value));if(t instanceof Y.errors){s.value=t.summary;return}o.value=!0;try{if(await a.create(n.workspaceId,t),a.lastError.value!==null){s.value=a.lastError.value;return}r(`created`),i.value=!1,p()}finally{o.value=!1}}return(e,t)=>(R(),B(ER,{open:i.value,"onUpdate:open":t[29]||=e=>i.value=e,title:`Add a server`,description:`Appends an entry to ${u.value}'s servers.config.json; every policy you leave out is inherited from its defaults.`,width:`w-[min(94vw,40rem)]`},{footer:M(()=>[H($,{variant:`ghost`,onClick:t[28]||=e=>i.value=!1},{default:M(()=>[...t[32]||=[U(` Cancel `,-1)]]),_:1}),H($,{type:`submit`,form:`add-server-form`,variant:`primary`,loading:o.value},{default:M(()=>[...t[33]||=[U(` Add to servers.config.json `,-1)]]),_:1},8,[`loading`])]),default:M(()=>[V(`form`,{id:`add-server-form`,class:`flex flex-col gap-3`,onSubmit:cu(m,[`prevent`])},[H(UL,{title:`Identity`,columns:2,dense:``},{default:M(()=>[H(dR,{modelValue:d.id,"onUpdate:modelValue":t[0]||=e=>d.id=e,label:`Id`,placeholder:`my-server`,hint:`Lowercase letters, digits, dashes and underscores; used in URLs and logs.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(dR,{modelValue:d.label,"onUpdate:modelValue":t[1]||=e=>d.label=e,label:`Label`,placeholder:`My server`,hint:`Shown in the panel; defaults to the id.`},null,8,[`modelValue`])]),_:1}),H(UL,{title:`Process`,columns:2,dense:``},{default:M(()=>[H(dR,{modelValue:d.command,"onUpdate:modelValue":t[2]||=e=>d.command=e,label:`Command`,placeholder:`node`,hint:`Spawned without a shell.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(dR,{modelValue:d.cwd,"onUpdate:modelValue":t[3]||=e=>d.cwd=e,label:`Working directory`,placeholder:`.`,hint:`Relative paths resolve under projectDir.`,class:`font-mono text-xs`},null,8,[`modelValue`])]),_:1}),H(AR,{modelValue:d.args,"onUpdate:modelValue":t[4]||=e=>d.args=e,label:`Arguments`,rows:3,hint:`One argument per line; whitespace inside a line is preserved.`,placeholder:`-p
|
|
42
|
-
{port}`},null,8,[`modelValue`]),H(UL,{title:`Port & lifecycle`,columns:2,dense:``},{default:M(()=>[H(eR,{modelValue:d.port,"onUpdate:modelValue":t[5]||=e=>d.port=e,label:`Port`,nullable:``,min:1,max:65535,error:f.value,hint:`Blank means the server has no port to probe or preflight.`},null,8,[`modelValue`,`error`]),H(oR,{modelValue:d.bind,"onUpdate:modelValue":t[6]||=e=>d.bind=e,label:`Bind address`,options:[{value:`local`,label:`local — 127.0.0.1`},{value:`lan`,label:`lan — 0.0.0.0`}],hint:`lan exposes it to the network; only do that behind auth.`},null,8,[`modelValue`]),H(mR,{modelValue:d.autostart,"onUpdate:modelValue":t[7]||=e=>d.autostart=e,label:`Autostart with up`,hint:`Start it whenever the control plane comes up.`,wide:``},null,8,[`modelValue`]),H(mR,{modelValue:d.persistent,"onUpdate:modelValue":t[8]||=e=>d.persistent=e,label:`Persistent`,hint:"Keeps running when the panel stops; `down` reports it instead of stopping it.",wide:``},null,8,[`modelValue`])]),_:1}),H(xR,{title:`Advanced settings`,hint:`environment, backups, policy, lifecycle, bootstrap`},{default:M(()=>[H(UL,{title:`Environment`,columns:2,dense:``},{default:M(()=>[H(AR,{modelValue:d.env,"onUpdate:modelValue":t[9]||=e=>d.env=e,label:`Environment`,rows:3,hint:`KEY=value per line, exported to the process.`,placeholder:`NODE_ENV=production`},null,8,[`modelValue`]),H(AR,{modelValue:d.dataEnvs,"onUpdate:modelValue":t[10]||=e=>d.dataEnvs=e,label:`Data envs`,rows:3,hint:`ENV=path per line — exported to the process and backed up automatically.`,placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`]),H(dR,{modelValue:d.envFile,"onUpdate:modelValue":t[11]||=e=>d.envFile=e,label:`Env file`,placeholder:`optional KEY=value file`,hint:`Loaded at spawn; its values override env.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(dR,{modelValue:d.dependsOn,"onUpdate:modelValue":t[12]||=e=>d.dependsOn=e,label:`Depends on`,placeholder:`postgres, redis`,hint:`Comma separated; started first and waited for until healthy, stopped last.`,class:`font-mono text-xs`},null,8,[`modelValue`])]),_:1}),H(UL,{title:`Backups`,columns:2,dense:``},{default:M(()=>[H(AR,{modelValue:d.backupPaths,"onUpdate:modelValue":t[13]||=e=>d.backupPaths=e,label:`Extra backup paths`,rows:2,hint:`One per line, placeholders allowed; data envs are captured already.`,placeholder:`{home}/.app/uploads`},null,8,[`modelValue`]),H(mR,{modelValue:d.backupIgnoreGenerated,"onUpdate:modelValue":t[14]||=e=>d.backupIgnoreGenerated=e,label:`Ignore known generated files`,hint:`Skips node_modules, dist, .next and the other caches nothing restores from.`,wide:``},null,8,[`modelValue`])]),_:1}),H(hR,{restart:d.restart,"onUpdate:restart":t[15]||=e=>d.restart=e,health:d.health,"onUpdate:health":t[16]||=e=>d.health=e,stop:d.stop,"onUpdate:stop":t[17]||=e=>d.stop=e},null,8,[`restart`,`health`,`stop`]),H(UL,{title:`Bootstrap`,description:`A one-off command run before the first start.`,columns:2,dense:``},{default:M(()=>[H(mR,{modelValue:d.bootstrapEnabled,"onUpdate:modelValue":t[18]||=e=>d.bootstrapEnabled=e,label:`Run a bootstrap`,hint:`Installs, migrations, downloads — before the first start, not on every one.`,wide:``},null,8,[`modelValue`]),d.bootstrapEnabled?(R(),z(L,{key:0},[H(dR,{modelValue:d.bootstrapCommand,"onUpdate:modelValue":t[19]||=e=>d.bootstrapCommand=e,label:`Command`,placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(eR,{modelValue:d.bootstrapTimeoutMs,"onUpdate:modelValue":t[20]||=e=>d.bootstrapTimeoutMs=e,label:`Timeout (ms)`,min:1e3,step:1e3},null,8,[`modelValue`]),H(mR,{modelValue:d.bootstrapRunOnce,"onUpdate:modelValue":t[21]||=e=>d.bootstrapRunOnce=e,label:`Only once per session`,hint:`Off means every start re-runs it.`},null,8,[`modelValue`]),H(AR,{modelValue:d.bootstrapArgs,"onUpdate:modelValue":t[22]||=e=>d.bootstrapArgs=e,label:`Bootstrap arguments`,rows:2,hint:`One per line; same placeholders as the main arguments.`},null,8,[`modelValue`]),H(AR,{modelValue:d.bootstrapEnv,"onUpdate:modelValue":t[23]||=e=>d.bootstrapEnv=e,label:`Bootstrap environment`,rows:2,hint:`KEY=value per line, exported to the bootstrap process only.`},null,8,[`modelValue`])],64)):W(``,!0)]),_:1}),H(UL,{title:`Policy & resources`,columns:2,dense:``},{default:M(()=>[H(oR,{modelValue:d.onPortConflict,"onUpdate:modelValue":t[24]||=e=>d.onPortConflict=e,label:`On port conflict`,options:[{value:`block`,label:`block — refuse to start`},{value:`warn`,label:`warn — start anyway`},{value:`follow`,label:`follow — adopt a detached restart of itself`},{value:`reclaim`,label:`reclaim — replace it with a supervised copy`},{value:`kill`,label:`kill — stop whatever holds the port`}]},null,8,[`modelValue`]),H(eR,{modelValue:d.logBufferLines,"onUpdate:modelValue":t[25]||=e=>d.logBufferLines=e,label:`Log buffer lines`,min:50,max:1e5,step:50,hint:`Blank keeps the default.`},null,8,[`modelValue`]),H(eR,{modelValue:d.maxRssMb,"onUpdate:modelValue":t[26]||=e=>d.maxRssMb=e,label:`Max RSS (MB)`,min:0,hint:`Restart above this; blank or 0 disables it.`},null,8,[`modelValue`]),H(mR,{modelValue:d.enabled,"onUpdate:modelValue":t[27]||=e=>d.enabled=e,label:`Enabled`,hint:`Off keeps the entry in the config but refuses to start it.`,wide:``},null,8,[`modelValue`])]),_:1}),t[30]||=V(`p`,{class:`text-2xs leading-4 text-faint`},[U(` Restart, health and stop start out matching `),V(`span`,{class:`font-mono`},`Settings → Server defaults`),U(`; change one here and it is written into this entry instead of staying inherited. `)],-1)]),_:1}),V(`div`,jR,[t[31]||=V(`p`,{class:`text-2xs font-medium text-muted`},` Available argument placeholders `,-1),V(`div`,MR,[(R(),z(L,null,F(c,e=>V(`code`,{key:e,class:`rounded-control border border-line bg-raise px-1.5 py-0.5 font-mono text-2xs text-ink`},k(e),1)),64))])]),s.value?(R(),z(`p`,NR,k(s.value),1)):W(``,!0)],32)]),_:1},8,[`open`,`description`]))}});function FR(e){let t=e.trim().toLowerCase();return t===`localhost`||t===`::1`||t===`[::1]`||t.endsWith(`.localhost`)?!0:/^127(?:\.\d{1,3}){3}$/.test(t)}function IR(e,t){let{url:n,bindHost:r}=e,i=t.trim();if(n===null||r.trim()!==`0.0.0.0`||i===``||FR(i))return n;try{let e=new URL(n),t=i.includes(`:`)&&!i.startsWith(`[`)?`[${i}]`:i,r=e.port.length>0?`:${e.port}`:``,a=e.pathname===`/`?``:e.pathname;return`${e.protocol}//${t}${r}${a}${e.search}${e.hash}`}catch{return n}}function LR(){return globalThis.location?.hostname??``}var RR={class:`text-xs font-semibold text-ink`},zR={class:`mt-2.5 flex justify-end gap-1.5`},BR=P({__name:`KillPortButton`,props:{port:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=A(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(R(),B(j(Uh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:M(()=>[H(j(Xh),{"as-child":``},{default:M(()=>[H($,{variant:`danger-ghost`,size:`xs`,loading:n.busy},{default:M(()=>[U(` Kill what holds port `+k(n.port),1)]),_:1},8,[`loading`])]),_:1}),H(j(Yh),null,{default:M(()=>[H(j(Jh),{"side-offset":6,align:`start`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[V(`p`,RR,` Kill the process on port `+k(n.port)+`? `,1),t[3]||=V(`p`,{class:`mt-1 text-2xs leading-4 text-muted`},` It is asked to stop first, and killed only if it ignores that. Anything this panel supervises is refused, so a managed server cannot be lost this way. `,-1),V(`div`,zR,[H(j(Wh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`ghost`},{default:M(()=>[...t[1]||=[U(` Keep it `,-1)]]),_:1})]),_:1}),H($,{size:`xs`,variant:`danger`,loading:n.busy,onClick:a},{default:M(()=>[...t[2]||=[U(` Kill it `,-1)]]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),VR=[`viewBox`],HR=[`id`],UR=[`stop-color`],WR=[`stop-color`],GR=[`d`,`fill`],KR=[`d`,`stroke`,`stroke-width`],qR=[`x1`,`x2`,`y2`,`stroke`],JR=[`cx`,`cy`,`fill`],YR={key:0,class:`absolute inset-x-0 top-1/2 border-t border-dashed border-line`},XR=100,ZR=P({__name:`Sparkline`,props:Ra({values:{},height:{default:34},max:{default:null},min:{default:null},fill:{type:Boolean,default:!0},strokeWidth:{default:1.5},color:{default:void 0},class:{default:void 0},interactive:{type:Boolean,default:!1}},{hoverIndex:{default:null},hoverIndexModifiers:{}}),emits:[`update:hoverIndex`],setup(e){let t=e,n=oo(e,`hoverIndex`),r=li(),i=A(null),a=G(()=>{let e=t.values.filter(e=>e!==null&&Number.isFinite(e)),n=t.max??(e.length>0?Math.max(...e):1),r=t.min??0;return{bottom:r,ceiling:n===r?r+1:n}}),o=G(()=>{let e=t.values,{bottom:n,ceiling:r}=a.value,i=r-n,o=e.length>1?XR/(e.length-1):XR,s=e=>t.height-(e-n)/i*t.height,c=[],l=[],u=()=>{if(l.length===0)return;let e=l.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(` `),n=l[0],r=`${e} L${l[l.length-1].x.toFixed(2)} ${t.height} L${n.x.toFixed(2)} ${t.height} Z`;c.push({line:e,area:r}),l=[]};return e.forEach((e,t)=>{if(e===null||!Number.isFinite(e)){u();return}l.push({x:t*o,y:s(e)})}),u(),c}),s=G(()=>n.value===null||t.values.length<2?null:n.value/(t.values.length-1)*XR),c=G(()=>{let e=n.value;if(e===null)return null;let r=t.values[e];if(r==null||!Number.isFinite(r))return null;let{bottom:i,ceiling:o}=a.value;return t.height-(r-i)/(o-i)*t.height});function l(e){if(!t.interactive||!i.value||t.values.length===0)return;let r=i.value.getBoundingClientRect();if(r.width===0)return;let a=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));n.value=Math.round(a*(t.values.length-1))}function u(){n.value=null}return(e,n)=>(R(),z(`div`,{ref_key:`track`,ref:i,class:O(j(Q)(`relative w-full`,t.class)),style:ge({height:`${t.height}px`}),onMousemove:l,onMouseleave:u},[(R(),z(`svg`,{viewBox:`0 0 ${XR} ${t.height}`,preserveAspectRatio:`none`,class:`block size-full overflow-visible`,role:`img`,"aria-hidden":`true`},[V(`defs`,null,[V(`linearGradient`,{id:j(r),x1:`0`,y1:`0`,x2:`0`,y2:`1`},[V(`stop`,{offset:`0%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0.26`},null,8,UR),V(`stop`,{offset:`100%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0`},null,8,WR)],8,HR)]),(R(!0),z(L,null,F(o.value,(e,n)=>(R(),z(L,{key:n},[t.fill?(R(),z(`path`,{key:0,d:e.area,fill:`url(#${j(r)})`,stroke:`none`},null,8,GR)):W(``,!0),V(`path`,{d:e.line,fill:`none`,stroke:t.color??`currentColor`,"stroke-width":t.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,KR)],64))),128)),s.value===null?W(``,!0):(R(),z(`line`,{key:0,x1:s.value,x2:s.value,y1:`0`,y2:t.height,stroke:t.color??`currentColor`,"stroke-width":`1`,"stroke-dasharray":`2 2`,"vector-effect":`non-scaling-stroke`,opacity:`0.5`},null,8,qR)),s.value!==null&&c.value!==null?(R(),z(`circle`,{key:1,cx:s.value,cy:c.value,r:`2`,fill:t.color??`currentColor`,"vector-effect":`non-scaling-stroke`},null,8,JR)):W(``,!0)],8,VR)),o.value.length===0?(R(),z(`div`,YR)):W(``,!0)],38))}}),QR={class:`min-w-0`},$R={class:`flex items-baseline justify-between gap-2`},ez={class:`truncate text-2xs font-medium text-faint`},tz={class:`flex shrink-0 items-baseline gap-1.5`},nz={key:0,class:`font-mono text-2xs text-faint`},rz=P({__name:`MetricSpark`,props:{label:{},values:{},format:{},max:{default:null},colorClass:{default:`text-accent`},height:{default:30},sampleMs:{default:5e3},emptyHint:{default:`collecting…`}},setup(e){let t=e,n=A(null),r=G(()=>bN(t.values)),i=G(()=>t.values.some(e=>e!==null)),a=G(()=>{let e=n.value;return e!==null&&t.values[e]!==void 0?t.values[e]??null:r.value}),o=G(()=>{let e=n.value;if(e===null)return null;let r=t.values.length-1-e;if(r<=0)return null;let i=Math.round(r*t.sampleMs/1e3);return i<60?`−${i}s`:`−${Math.round(i/60)}m`});return(e,r)=>(R(),z(`div`,QR,[V(`div`,$R,[V(`span`,ez,k(t.label),1),V(`span`,tz,[o.value?(R(),z(`span`,nz,k(o.value),1)):W(``,!0),V(`span`,{class:O(j(Q)(`font-mono text-xs font-medium tabular-nums`,i.value?`text-ink`:`text-faint`))},k(i.value?t.format(a.value):t.emptyHint),3)])]),H(ZR,{"hover-index":n.value,"onUpdate:hoverIndex":r[0]||=e=>n.value=e,values:t.values,height:t.height,max:t.max,interactive:``,class:O(j(Q)(`mt-1`,t.colorClass))},null,8,[`hover-index`,`values`,`height`,`max`,`class`])]))}}),iz={class:`inline-flex flex-wrap items-center gap-1.5`},az={class:`relative flex size-1.5`},oz={key:0,class:`absolute inset-0 rounded-full bg-current opacity-60`,style:{animation:`hh-pulse-ring 1.6s ease-out infinite`}},sz=P({__name:`StatusPill`,props:{status:{},health:{default:null},showHealth:{type:Boolean,default:!0}},setup(e){let t=e,n=G(()=>IF[t.status]),r=G(()=>t.health?LF[t.health]:null),i=G(()=>t.showHealth&&r.value!==null&&t.health!==`disabled`&&t.health!==`unknown`&&(r.value.tone===`danger`||r.value.tone===`warn`)),a=G(()=>n.value.transitional);return(e,t)=>(R(),z(`span`,iz,[V(`span`,{class:O(j(Q)(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium`,j(zF)[n.value.tone]))},[V(`span`,az,[a.value?(R(),z(`span`,oz)):W(``,!0),V(`span`,{class:O(j(Q)(`relative size-1.5 rounded-full`,j(BF)[n.value.tone]))},null,2)]),U(` `+k(n.value.label),1)],2),i.value&&r.value?(R(),z(`span`,{key:0,class:O(j(Q)(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium`,j(zF)[r.value.tone]))},k(r.value.label),3)):W(``,!0)]))}}),cz=P({__name:`Tip`,props:{label:{},side:{default:`top`},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),B(j(hg),{"delay-duration":350},{default:M(()=>[H(j(bg),{"as-child":``},{default:M(()=>[I(t.$slots,`default`)]),_:3}),e.disabled?W(``,!0):(R(),B(j(yg),{key:0},{default:M(()=>[H(j(vg),{side:e.side,"side-offset":6,class:`z-50 max-w-64 rounded-control border border-line bg-raise px-2 py-1 text-2xs text-ink shadow-float data-[state=delayed-open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[U(k(e.label),1)]),_:1},8,[`side`])]),_:1}))]),_:3}))}}),lz={class:`flex items-start justify-between gap-3 px-4 pb-2.5 pt-3.5`},uz={class:`min-w-0`},dz={class:`flex items-center gap-2`},fz=[`href`,`title`,`aria-label`],pz={class:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-2xs text-faint`},mz={class:`text-muted`},hz={key:1,class:`rounded bg-hover px-1 py-px text-muted`},gz={key:2,class:`rounded bg-accent-soft px-1 py-px text-accent`},_z=[`title`],vz={key:0,class:`space-y-2.5 border-y border-line-soft px-4 py-3`},yz={class:`grid grid-cols-2 gap-x-4 gap-y-2`},bz={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5`},xz={class:`text-muted`},Sz={class:`text-faint`},Cz={key:2,class:`flex flex-col gap-1 px-4 pt-2.5`},wz={key:0,class:`flex items-start gap-1.5 text-2xs leading-4 text-danger`},Tz={class:`min-w-0 break-words`},Ez={key:2,class:`text-2xs leading-4 text-warn`},Dz={key:3,class:`text-2xs leading-4 text-warn`},Oz={class:`grid grid-cols-2 gap-x-4 gap-y-1 px-4 py-3 sm:grid-cols-4`},kz={class:`truncate text-2xs text-faint`},Az={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},jz={class:`mt-auto flex items-center gap-1.5 border-t border-line-soft px-4 py-2.5`},Mz={class:`grid grid-cols-2 gap-2 text-xs`},Nz={class:`font-mono text-ink`},Pz={class:`text-ink capitalize`},Fz=P({__name:`ServerCard`,props:{server:{},workspaceId:{},series:{},now:{},variant:{default:`default`}},setup(e){let t=e,n={start:gy,exit:Ay,crash:Bv,"forced-restart":xy,unhealthy:Iy,recovered:Vv},r=KN(),i=sP(),a=A(!1),o=A(!1),s=G(()=>t.server.config),c=G(()=>s.value.label&&s.value.label.length>0?s.value.label:t.server.id),l=G(()=>`${s.value.command} ${s.value.args.join(` `)}`.trim()),u=G(()=>VF(t.server.status,t.server.health)),d=G(()=>IR(t.server,LR())),f=G(()=>t.server.status===`running`),p=G(()=>s.value.enabled&&[`stopped`,`crashed`,`conflict`].includes(t.server.status)),m=G(()=>[`running`,`starting`,`backoff`].includes(t.server.status)),h=G(()=>t.server.startedAt===null||!f.value?`—`:sI(t.now-t.server.startedAt)),g=G(()=>t.server.nextRetryAt===null?null:cI(t.server.nextRetryAt,t.now)),_=G(()=>t.server.unhealthySince===null?null:sI(t.now-t.server.unhealthySince)),v=G(()=>t.series?.cpu??[]),y=G(()=>t.series?.rss??[]),b=G(()=>t.series?.probe??[]),x=G(()=>[...t.server.history.events].slice(-3).reverse()),S=G(()=>{let e=t.server,n=[{key:`pid`,label:`PID`,value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:`Uptime`,value:h.value},{key:`restarts`,label:`Restarts`,value:`${e.restarts}/${e.maxRetries}`},{key:`port`,label:`Port`,value:e.portState},{key:`uptime24`,label:`24h up`,value:oI(e.history.uptimeRatio)},{key:`probe`,label:`Probe`,value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:`RSS`,value:pI(e.resources?.rssBytes??null)},{key:`procs`,label:`Procs`,value:e.resources?String(e.resources.processes):`—`}];return e.history.crashes>0&&n.splice(5,0,{key:`crashes`,label:`24h crashes`,value:String(e.history.crashes)}),e.history.lastCrashAt!==null&&n.push({key:`lastcrash`,label:`Last crash`,value:lI(e.history.lastCrashAt,t.now)}),n});async function C(e){a.value=!0;try{await r[e](t.workspaceId,t.server.id)}finally{a.value=!1}}async function w(){a.value=!0;try{await r.freePort(t.workspaceId,t.server.id)}finally{a.value=!1}}async function T(e){let n=!(e===`enabled`?s.value.enabled:s.value.autostart);e===`enabled`?await r.setEnabled(t.workspaceId,t.server.id,n):await r.setAutostart(t.workspaceId,t.server.id,n)}async function ee(){o.value=!1,await r.remove(t.workspaceId,t.server.id)}function E(){i.select(t.workspaceId)}return(i,f)=>{let h=fa(`RouterLink`);return R(),z(`article`,{class:O(j(Q)(`group relative flex flex-col rounded-panel border bg-panel shadow-card transition-colors duration-150`,`hover:border-line/90`,t.server.status===`crashed`||t.server.status===`conflict`?`border-danger/30`:`border-line`,!s.value.enabled&&`opacity-70`))},[V(`span`,{class:O(j(Q)(`absolute inset-y-3 left-0 w-0.5 rounded-full`,{"bg-ok":u.value===`ok`,"bg-warn":u.value===`warn`,"bg-danger":u.value===`danger`,"bg-faint/50":u.value===`neutral`,"bg-accent":u.value===`accent`||u.value===`info`}))},null,2),V(`header`,lz,[V(`div`,uz,[V(`div`,dz,[H(h,{to:`/servers/${e.server.id}`,class:`truncate text-sm font-semibold tracking-tight text-ink hover:text-accent`,onClick:E},{default:M(()=>[U(k(c.value),1)]),_:1},8,[`to`]),d.value?(R(),z(`a`,{key:0,href:d.value,target:`_blank`,rel:`noreferrer`,class:`shrink-0 text-faint transition-colors duration-150 hover:text-accent`,title:d.value,"aria-label":`Open ${d.value}`},[H(j(Xv),{class:`size-3.5`})],8,fz)):W(``,!0)]),V(`p`,pz,[V(`span`,null,k(e.server.id),1),s.value.port===null?W(``,!0):(R(),z(L,{key:0},[f[9]||=V(`span`,{"aria-hidden":`true`},`·`,-1),V(`span`,mz,`:`+k(s.value.port),1)],64)),f[10]||=V(`span`,{"aria-hidden":`true`},`·`,-1),V(`span`,null,k(e.server.bindHost),1),s.value.enabled?W(``,!0):(R(),z(`span`,hz,`disabled`)),s.value.autostart?(R(),z(`span`,gz,`autostart`)):W(``,!0)])]),H(sz,{status:e.server.status,health:e.server.health},null,8,[`status`,`health`]),e.server.adopted?(R(),B(cz,{key:0,label:`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`},{default:M(()=>[...f[11]||=[V(`span`,{class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},`detached`,-1)]]),_:1})):W(``,!0),s.value.persistent?(R(),B(cz,{key:1,label:"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only an explicit stop does."},{default:M(()=>[...f[12]||=[V(`span`,{class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},`persistent`,-1)]]),_:1})):W(``,!0)]),V(`p`,{class:`truncate px-4 pb-3 font-mono text-2xs text-muted`,title:l.value},k(l.value),9,_z),t.variant===`compact`?W(``,!0):(R(),z(`div`,vz,[V(`div`,yz,[H(rz,{label:`CPU`,values:v.value,format:j(mI),max:100,"color-class":`text-cpu`},null,8,[`values`,`format`]),H(rz,{label:`Memory`,values:y.value,format:j(pI),"color-class":`text-mem`},null,8,[`values`,`format`])]),H(rz,{label:`Health probe`,values:b.value,format:e=>e===null?`—`:`${e} ms`,height:22,"color-class":`text-probe`,"empty-hint":`not probed`},null,8,[`values`,`format`])])),x.value.length>0?(R(),z(`div`,bz,[(R(!0),z(L,null,F(x.value,e=>(R(),z(`span`,{key:`${e.ts}`,class:`inline-flex items-center gap-1 text-2xs`},[(R(),B(ma(n[e.type]),{class:O(j(Q)(`size-3`,j(RF)[j(UF)[e.type]]))},null,8,[`class`])),V(`span`,xz,k(j(HF)[e.type]),1),V(`span`,Sz,k(j(lI)(e.ts,t.now)),1)]))),128))])):W(``,!0),e.server.lastError||_.value||g.value?(R(),z(`div`,Cz,[e.server.lastError?(R(),z(`p`,wz,[H(j(Bv),{class:`mt-0.5 size-3 shrink-0`}),V(`span`,Tz,k(e.server.lastError),1)])):W(``,!0),e.server.status===`conflict`&&s.value.port!==null?(R(),B(BR,{key:1,port:s.value.port,busy:a.value,class:`self-start`,onConfirm:w},null,8,[`port`,`busy`])):W(``,!0),_.value?(R(),z(`p`,Ez,` Unhealthy for `+k(_.value),1)):W(``,!0),g.value?(R(),z(`p`,Dz,` Next attempt `+k(g.value),1)):W(``,!0)])):W(``,!0),V(`dl`,Oz,[(R(!0),z(L,null,F(S.value,e=>(R(),z(`div`,{key:e.key,class:`min-w-0`},[V(`dt`,kz,k(e.label),1),V(`dd`,Az,k(e.value),1)]))),128))]),V(`div`,jz,[H($,{variant:`primary`,size:`xs`,disabled:a.value||!p.value,onClick:f[0]||=e=>C(`start`)},{default:M(()=>[H(j(gy),{class:`size-3`}),f[13]||=U(`Start `,-1)]),_:1},8,[`disabled`]),H($,{size:`xs`,disabled:a.value||!m.value,onClick:f[1]||=e=>C(`stop`)},{default:M(()=>[H(j(Ay),{class:`size-3`}),f[14]||=U(`Stop `,-1)]),_:1},8,[`disabled`]),H($,{size:`xs`,disabled:a.value||!s.value.enabled,onClick:f[2]||=e=>C(`restart`)},{default:M(()=>[H(j(xy),{class:`size-3`}),f[15]||=U(`Restart `,-1)]),_:1},8,[`disabled`]),H(cz,{label:`Live logs and full telemetry`},{default:M(()=>[H(h,{to:`/servers/${e.server.id}`,onClick:E},{default:M(()=>[H($,{size:`xs`,variant:`ghost`},{default:M(()=>[H(j(Sy),{class:`size-3`}),f[16]||=U(`Details `,-1)]),_:1})]),_:1},8,[`to`])]),_:1}),H(j($h),null,{default:M(()=>[H(j(ig),{"as-child":``},{default:M(()=>[H($,{size:`icon-sm`,variant:`ghost`,class:`ml-auto`,"aria-label":`More actions for ${c.value}`},{default:M(()=>[H(j(Yv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),H(j(ng),null,{default:M(()=>[H(j(eg),{"side-offset":4,align:`end`,class:`z-50 min-w-52 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[3]||=e=>T(`enabled`)},{default:M(()=>[H(j(vy),{class:`size-3.5`}),U(` `+k(s.value.enabled?`Disable server`:`Enable server`),1)]),_:1}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[4]||=e=>T(`autostart`)},{default:M(()=>[H(j(gy),{class:`size-3.5`}),U(` `+k(s.value.autostart?`Remove from autostart`:`Autostart with the panel`),1)]),_:1}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[5]||=t=>j(r).clearLogs(e.workspaceId,e.server.id)},{default:M(()=>[H(j(Sy),{class:`size-3.5`}),f[17]||=U(` Clear log buffer `,-1)]),_:1}),H(j(rg),{class:`my-1 h-px bg-line`}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:f[6]||=e=>o.value=!0},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),f[18]||=U(` Remove server `,-1)]),_:1})]),_:1})]),_:1})]),_:1})]),H(ER,{open:o.value,"onUpdate:open":f[8]||=e=>o.value=e,title:`Remove this server?`,description:`${c.value} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,width:`w-[min(92vw,26rem)]`},{footer:M(()=>[H($,{variant:`ghost`,onClick:f[7]||=e=>o.value=!1},{default:M(()=>[...f[21]||=[U(` Keep it `,-1)]]),_:1}),H($,{variant:`danger`,onClick:ee},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),f[22]||=U(`Remove `,-1)]),_:1})]),default:M(()=>[V(`dl`,Mz,[V(`div`,null,[f[19]||=V(`dt`,{class:`text-faint`},` id `,-1),V(`dd`,Nz,k(e.server.id),1)]),V(`div`,null,[f[20]||=V(`dt`,{class:`text-faint`},` status `,-1),V(`dd`,Pz,k(e.server.status),1)])])]),_:1},8,[`open`,`description`])],2)}}}),Iz={class:`flex flex-wrap items-start justify-between gap-3`},Lz={class:`min-w-0`},Rz={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},zz={class:`text-2xl font-semibold tracking-tight text-ink`},Bz={key:1,class:`mt-1 max-w-2xl text-xs leading-relaxed text-muted`},Vz={class:`flex shrink-0 flex-wrap items-center gap-2`},Hz=P({__name:`PageHeader`,props:{title:{},description:{default:void 0},backTo:{default:void 0},backLabel:{default:`Back`}},setup(e){return(e,t)=>{let n=fa(`RouterLink`);return R(),z(`header`,Iz,[V(`div`,Lz,[e.$props.backTo?(R(),B(n,{key:0,to:e.$props.backTo,class:`mb-1 inline-flex items-center gap-1 text-2xs text-muted transition-colors duration-150 hover:text-ink`},{default:M(()=>[H(j(Iv),{class:`size-3`}),U(` `+k(e.$props.backLabel),1)]),_:1},8,[`to`])):W(``,!0),V(`div`,Rz,[V(`h1`,zz,k(e.$props.title),1),I(e.$slots,`badges`)]),e.$props.description?(R(),z(`p`,Bz,k(e.$props.description),1)):W(``,!0)]),V(`div`,Vz,[I(e.$slots,`actions`)])])}}}),Uz={key:0,class:`mb-3 flex items-start justify-between gap-3`},Wz={class:`min-w-0`},Gz={class:`flex shrink-0 items-center gap-1.5`},Kz=P({__name:`Panel`,props:{padded:{type:Boolean,default:!0},class:{}},setup(e){return(e,t)=>(R(),z(`section`,{class:O(j(FF)(`rounded-panel border border-line bg-panel shadow-card`,e.$props.padded&&`p-4`,e.$props.class))},[e.$slots.header||e.$slots.actions?(R(),z(`header`,Uz,[V(`div`,Wz,[I(e.$slots,`header`)]),V(`div`,Gz,[I(e.$slots,`actions`)])])):W(``,!0),I(e.$slots,`default`)],2))}}),qz=P({__name:`Skeleton`,props:{class:{default:`h-4 w-24`},rounded:{default:`rounded`}},setup(e){return(t,n)=>(R(),z(`span`,{class:O(j(Q)(`block animate-pulse bg-line-soft`,e.rounded,t.$props.class)),style:{"animation-duration":`1.4s`},"aria-hidden":`true`},null,2))}}),Jz={class:`min-w-0`},Yz={class:`truncate text-2xs font-medium text-faint`},Xz={key:0,class:`mt-0.5 truncate text-2xs text-muted`},Zz=P({__name:`StatTile`,props:{label:{},value:{},hint:{default:void 0},tone:{default:`neutral`},mono:{type:Boolean,default:!0}},setup(e){return(e,t)=>(R(),z(`div`,Jz,[V(`p`,Yz,k(e.$props.label),1),V(`p`,{class:O(j(Q)(`mt-0.5 truncate text-xl font-semibold tracking-tight`,e.$props.mono&&`font-mono tabular-nums`,e.$props.tone===`neutral`?`text-ink`:j(RF)[e.$props.tone]))},k(e.$props.value),3),e.$props.hint?(R(),z(`p`,Xz,k(e.$props.hint),1)):W(``,!0)]))}}),Qz=A(null),$z=A(`unknown`),eB=null;async function tB(){try{let e=await(await fetch(`/healthz`,{cache:`no-store`})).json();typeof e.uptimeMs==`number`&&(Qz.value=Date.now()-e.uptimeMs),$z.value=e.status===`degraded`?`degraded`:`ok`}catch{$z.value=`unknown`}}function nB(){return eB??=tB().finally(()=>{eB=null}),{startedAt:Qz,status:$z,refresh:tB}}var rB={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},iB={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},aB={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},oB={class:`p-4`},sB={class:`p-4`},cB={class:`p-4`},lB={class:`p-4`},uB={class:`p-4`},dB={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},fB={class:`min-w-0`},pB={class:`text-xs font-medium text-danger`},mB={class:`mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-danger`},hB=[`onClick`],gB={class:`grid gap-4 lg:grid-cols-3`},_B={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},vB={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},yB={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},bB={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},xB={class:`font-mono text-2xs font-normal text-faint`},SB={class:`text-2xs text-muted`},CB={class:`ml-auto flex items-center gap-1.5`},wB={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-3 py-2 text-2xs leading-4 text-danger`},TB={key:2,class:`grid gap-4 lg:grid-cols-2`},EB={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},DB={class:`font-mono`},OB=P({__name:`GlobalOverviewView`,setup(e){let t=KN(),n=sP(),r=nB(),i=Lg(),a=A(!1),o=A(``),s=G(()=>t.appState.value===null),c=G(()=>t.workspaces.value),l=G(()=>t.allServers.value.map(e=>e.server)),u=G(()=>l.value.filter(e=>e.status===`running`)),d=G(()=>l.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),f=G(()=>t.host.value),p=G(()=>r.startedAt.value===null?`—`:sI(t.now.value-r.startedAt.value)),m=G(()=>f.value?.enabled?sI(f.value.uptimeMs):`—`);function h(e){o.value=e,a.value=!0}function g(e,t){n.select(e),i.push(XX(e,`servers`,t))}return ta(async()=>{await r.refresh()}),(e,_)=>(R(),z(`div`,rB,[H(Hz,{title:`Global Overview`,description:`Host vitals and every server from every workspace, grouped by where it lives.`}),H(Kz,{class:`p-0`},{default:M(()=>[s.value?(R(),z(`div`,iB,[(R(),z(L,null,F(5,e=>V(`div`,{key:e,class:`space-y-2`},[H(qz,{class:`h-2.5 w-16`}),H(qz,{class:`h-6 w-20`})])),64))])):(R(),z(`div`,aB,[V(`div`,oB,[H(Zz,{label:`Workspaces`,value:String(c.value.length),hint:`${l.value.length} servers in total`},null,8,[`value`,`hint`])]),V(`div`,sB,[H(Zz,{label:`Running`,value:`${u.value.length}/${l.value.length}`,tone:`ok`,hint:`${l.value.length-u.value.length} not up`},null,8,[`value`,`hint`])]),V(`div`,cB,[H(Zz,{label:`Needs attention`,value:String(d.value.length),tone:d.value.length>0?`danger`:`ok`,hint:d.value.length===0?`nothing is broken`:`crashed or unhealthy`},null,8,[`value`,`tone`,`hint`])]),V(`div`,lB,[H(Zz,{label:`Panel uptime`,value:p.value,hint:j(r).status.value===`degraded`?`degraded`:`serving`},null,8,[`value`,`hint`])]),V(`div`,uB,[H(Zz,{label:`Host uptime`,value:m.value,hint:f.value?.enabled?`sampling on`:`sampling off`},null,8,[`value`,`hint`])])]))]),_:1}),d.value.length>0?(R(),z(`div`,dB,[H(j(Bv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),V(`div`,fB,[V(`p`,pB,k(d.value.length)+` server`+k(d.value.length===1?``:`s`)+` need a look `,1),V(`p`,mB,[(R(!0),z(L,null,F(j(t).allServers.value.filter(e=>e.server.status===`crashed`||e.server.status===`conflict`||e.server.health===`unhealthy`),e=>(R(),z(`button`,{key:`${e.workspace.id}:${e.server.id}`,type:`button`,class:`font-mono underline decoration-danger/40 underline-offset-2 hover:decoration-danger`,onClick:t=>g(e.workspace.id,e.server.id)},k(e.workspace.label)+`/`+k(e.server.id),9,hB))),128))])])])):W(``,!0),V(`div`,gB,[H(Kz,{class:`lg:col-span-2`},{header:M(()=>[V(`h2`,_B,[H(j(qv),{class:`size-3.5 text-faint`}),_[1]||=U(` Host vitals `,-1)]),_[2]||=V(`p`,{class:`text-2xs text-muted`},` This machine, shared by every workspace. `,-1)]),default:M(()=>[H(MI,{host:f.value,now:j(t).now.value},null,8,[`host`,`now`])]),_:1}),H(Kz,null,{header:M(()=>[V(`h2`,vB,[H(j(Av),{class:`size-3.5 text-faint`}),_[3]||=U(` Recent activity `,-1)])]),default:M(()=>[H(BI,{servers:l.value,now:j(t).now.value,limit:12},null,8,[`servers`,`now`])]),_:1})]),!s.value&&l.value.length===0?(R(),B(aI,{key:1,title:`No servers anywhere yet`,description:`Pick a workspace in the header and add the first process it should keep alive.`},{icon:M(()=>[H(j(wy),{class:`size-4`})]),_:1})):W(``,!0),(R(!0),z(L,null,F(c.value,e=>(R(),z(`section`,{key:e.id,class:`space-y-3`},[V(`div`,yB,[V(`h2`,bB,[H(j(iy),{class:`size-3.5 text-faint`}),U(` `+k(e.label)+` `,1),V(`span`,xB,k(e.id),1)]),V(`span`,SB,k(e.runningCount)+`/`+k(e.serverCount)+` running`,1),V(`div`,CB,[H($,{size:`xs`,variant:`ghost`,onClick:t=>h(e.id)},{default:M(()=>[H(j(_y),{class:`size-3`}),_[4]||=U(`Add server `,-1)]),_:1},8,[`onClick`]),H($,{size:`xs`,variant:`ghost`,onClick:t=>{j(n).select(e.id),j(i).push(j(XX)(e.id,`overview`))}},{default:M(()=>[..._[5]||=[U(` Open workspace `,-1)]]),_:1},8,[`onClick`])])]),e.configError?(R(),z(`p`,wB,` The config could not be read: `+k(e.configError),1)):W(``,!0),e.servers.length===0?(R(),B(aI,{key:1,compact:``,title:`No servers in this workspace`,description:`Add one and it will show up here and on the workspace page.`},{action:M(()=>[H($,{size:`sm`,variant:`primary`,onClick:t=>h(e.id)},{default:M(()=>[H(j(_y),{class:`size-3.5`}),_[6]||=U(`Add a server `,-1)]),_:1},8,[`onClick`])]),_:2},1024)):(R(),z(`div`,TB,[(R(!0),z(L,null,F(e.servers,n=>(R(),B(Fz,{key:n.id,server:n,"workspace-id":e.id,series:j(t).seriesOf(e.id,n.id),now:j(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]))),128)),V(`p`,EB,[_[7]||=V(`span`,null,`resource history is sampled every 5 s and kept for this session`,-1),V(`span`,DB,k(j(t).appState.value?.control.url),1)]),H(PR,{open:a.value,"onUpdate:open":_[0]||=e=>a.value=e,"workspace-id":o.value},null,8,[`open`,`workspace-id`])]))}}),kB={class:`text-xs font-semibold text-ink`},AB={key:0,class:`mt-1 text-2xs leading-4 text-muted`},jB={class:`mt-2.5 flex justify-end gap-1.5`},MB=P({__name:`ConfirmButton`,props:{label:{},confirmLabel:{default:`Confirm`},variant:{default:`danger-ghost`},confirmVariant:{default:`danger`},size:{default:`sm`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{default:void 0},hint:{default:void 0}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=A(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(R(),B(j(Uh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:M(()=>[H(j(Xh),{"as-child":``},{default:M(()=>[H($,{variant:n.variant,size:n.size,disabled:n.disabled,loading:n.loading},{default:M(()=>[U(k(n.label),1)]),_:1},8,[`variant`,`size`,`disabled`,`loading`])]),_:1}),H(j(Yh),null,{default:M(()=>[H(j(Jh),{"side-offset":6,align:`end`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[V(`p`,kB,k(n.title??`${n.confirmLabel}?`),1),n.hint?(R(),z(`p`,AB,k(n.hint),1)):W(``,!0),V(`div`,jB,[H(j(Wh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`ghost`},{default:M(()=>[...t[1]||=[U(` Cancel `,-1)]]),_:1})]),_:1}),H($,{size:`xs`,variant:n.confirmVariant,loading:n.loading,onClick:a},{default:M(()=>[U(k(n.confirmLabel),1)]),_:1},8,[`variant`,`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),NB={class:`min-w-0 flex-1`},PB={key:0,class:`text-xs font-semibold`},FB=P({__name:`Notice`,props:{tone:{default:`info`},title:{default:void 0},class:{default:void 0}},setup(e){let t=e,n={ok:Vv,warn:Iy,danger:py,info:ny,neutral:ny,accent:Ey},r=G(()=>n[t.tone]);return(e,n)=>(R(),z(`div`,{class:O(j(Q)(`flex items-start gap-2 rounded-panel border px-3 py-2`,j(zF)[t.tone],t.class))},[(R(),B(ma(r.value),{class:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`})),V(`div`,NB,[t.title?(R(),z(`p`,PB,k(t.title),1)):W(``,!0),V(`div`,{class:O(j(Q)(`text-xs leading-relaxed text-ink/85`,t.title&&`mt-0.5`))},[I(e.$slots,`default`)],2)])],2))}}),IB={class:`space-y-2`},LB={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},RB=P({__name:`AuthenticationSection`,props:Ra({view:{},dirty:{type:Boolean}},{auth:{required:!0},authModifiers:{}}),emits:Ra([`reset`],[`update:auth`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`auth`),a=TL(()=>i.value.sessionTtlMs,e=>i.value.sessionTtlMs=e,6048e5),o=TL(()=>i.value.maxLoginAttempts,e=>i.value.maxLoginAttempts=e,5),s=TL(()=>i.value.lockoutMs,e=>i.value.lockoutMs=e,6e4),c=G(()=>n.view?.auth.passwordSet===!0),l=G(()=>n.view?.auth.apiTokenSet===!0),u=G(()=>n.view?.auth.blockedReason??null),d=G(()=>n.view?.auth.exposed===!0),f=G(()=>n.view?.auth.usingDefaultPassword===!0),p=G(()=>i.value.enabled&&!c.value),{setPassword:m,clearPassword:h}=lN(),g=A(``),_=A(``),v=A(``),y=A(null),b=A(null),x=A(!1),S=G(()=>v.value.length>0&&v.value!==_.value),C=G(()=>_.value.length>0&&_.value.length<8),w=G(()=>_.value.length>0&&!S.value&&(!c.value||g.value.length>0));async function T(){if(w.value&&!x.value){x.value=!0,b.value=null,y.value=null;try{let e=await m(c.value?g.value:void 0,_.value);if(e!==null){b.value=e;return}g.value=``,_.value=``,v.value=``,y.value=`Password updated. Other sessions were signed out.`}finally{x.value=!1}}}async function ee(){b.value=null,y.value=null;let e=await h();e===null?y.value=`Password cleared and authentication disabled.`:b.value=e}return(e,t)=>(R(),z(L,null,[H(UL,{title:`Access policy`,description:`Authentication applies whether the panel is on loopback or exposed to the network.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[10]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:`Require a password`,hint:`Every request needs a signed-in session.`,class:`sm:col-span-2`},null,8,[`modelValue`]),H(eR,{modelValue:j(a),"onUpdate:modelValue":t[2]||=e=>mn(a)?a.value=e:null,label:`Session lifetime (ms)`,min:6e4,hint:`Idle timeout: 604800000 is one week of no activity. Each request restarts it.`},null,8,[`modelValue`]),H(oR,{modelValue:i.value.cookieSecure,"onUpdate:modelValue":t[3]||=e=>i.value.cookieSecure=e,label:`Cookie Secure`,options:[{value:`auto`,label:`Auto — only over HTTPS`},{value:`always`,label:`Always`},{value:`never`,label:`Never — plain HTTP`}]},null,8,[`modelValue`]),H(oR,{modelValue:i.value.trustProxy,"onUpdate:modelValue":t[4]||=e=>i.value.trustProxy=e,label:`Behind a reverse proxy`,options:[{value:`off`,label:`No — ignore x-forwarded-*`},{value:`loopback`,label:`Yes, from this machine only`},{value:`any`,label:`Yes, from any caller`}],hint:`Trust x-forwarded-* for the client address and protocol. 'From this machine only' is the safe choice for a proxy on the same host. 'From any caller' believes the caller's own header, so login lockout counts per forged address and can be bypassed.`,class:`sm:col-span-2`},null,8,[`modelValue`]),H(eR,{modelValue:j(o),"onUpdate:modelValue":t[5]||=e=>mn(o)?o.value=e:null,label:`Max login attempts`,min:1,hint:`Failures before a temporary lockout.`},null,8,[`modelValue`]),H(eR,{modelValue:j(s),"onUpdate:modelValue":t[6]||=e=>mn(s)?s.value=e:null,label:`Lockout (ms)`,min:1e3},null,8,[`modelValue`])]),_:1}),V(`div`,IB,[H(FB,{tone:l.value?`info`:`neutral`,title:l.value?`An API token is set`:`No API token`},{default:M(()=>[l.value?(R(),z(L,{key:0},[t[11]||=U(` Scripts can call the API with `,-1),t[12]||=V(`code`,null,`Authorization: Bearer …`,-1),t[13]||=U(` instead of signing in. `,-1)],64)):(R(),z(L,{key:1},[t[14]||=U(` For shell scripts and agents, generate one with `,-1),t[15]||=V(`code`,null,`home-hosted set-token --generate`,-1),t[16]||=U(`. `,-1)],64))]),_:1},8,[`tone`,`title`]),f.value?(R(),B(FB,{key:0,tone:`warn`,title:`The default password is still in use`},{default:M(()=>[...t[17]||=[U(` Set your own password below. Binding beyond `,-1),V(`code`,null,`127.0.0.1`,-1),U(` stays refused until you do. `,-1)]]),_:1})):W(``,!0),u.value?(R(),B(FB,{key:1,tone:`danger`,title:`This listener is being refused`},{default:M(()=>[U(k(u.value),1)]),_:1})):p.value?(R(),B(FB,{key:2,tone:`warn`,title:`Authentication is on but no password is set`},{default:M(()=>[...t[18]||=[U(` Nothing is actually required yet, and binding beyond `,-1),V(`code`,null,`127.0.0.1`,-1),U(` stays refused until a password exists. `,-1)]]),_:1})):d.value?(R(),B(FB,{key:3,tone:`warn`,title:`Reachable beyond 127.0.0.1`},{default:M(()=>[...t[19]||=[U(` Keep the password strong, or put a TLS-terminating proxy in front of the panel. `,-1)]]),_:1})):W(``,!0)]),V(`form`,{class:`mt-3`,onSubmit:cu(T,[`prevent`])},[H(UL,{title:c.value?`Change password`:`Set a password`,description:`Stored as a scrypt hash in the secrets file, never in the config.`},{default:M(()=>[c.value?(R(),B(dR,{key:0,modelValue:g.value,"onUpdate:modelValue":t[7]||=e=>g.value=e,type:`password`,autocomplete:`current-password`,label:`Current password`},null,8,[`modelValue`])):W(``,!0),H(dR,{modelValue:_.value,"onUpdate:modelValue":t[8]||=e=>_.value=e,type:`password`,autocomplete:`new-password`,label:`New password`},null,8,[`modelValue`]),H(dR,{modelValue:v.value,"onUpdate:modelValue":t[9]||=e=>v.value=e,type:`password`,autocomplete:`new-password`,label:`Repeat new password`,error:S.value?`The two passwords do not match.`:null},null,8,[`modelValue`,`error`]),V(`div`,LB,[H($,{type:`submit`,variant:`primary`,disabled:!w.value,loading:x.value},{default:M(()=>[U(k(c.value?`Update password`:`Set password and enable auth`),1)]),_:1},8,[`disabled`,`loading`]),c.value?(R(),B(MB,{key:0,label:`Clear password`,"confirm-label":`Confirm clear`,"confirm-variant":`danger`,title:`Clear the password?`,hint:`Authentication is switched off with it, and anyone reaching the panel is let straight in.`,disabled:x.value,onConfirm:ee},null,8,[`disabled`])):W(``,!0)]),C.value||b.value||y.value?(R(),z(L,{key:1},[C.value?(R(),B(FB,{key:0,tone:`warn`,title:`That is a short password`,class:`sm:col-span-2`},{default:M(()=>[...t[20]||=[U(` It is allowed, but longer is the only thing standing between the network and this panel. `,-1)]]),_:1})):W(``,!0),b.value?(R(),B(FB,{key:1,tone:`danger`,class:`sm:col-span-2`},{default:M(()=>[U(k(b.value),1)]),_:1})):W(``,!0),y.value?(R(),B(FB,{key:2,tone:`ok`,class:`sm:col-span-2`},{default:M(()=>[U(k(y.value),1)]),_:1})):W(``,!0)],64)):W(``,!0)]),_:1},8,[`title`])],32)],64))}});function zB(e){return e.kind===`settings`?`Server defaults, log retention and notifications`:e.kind===`servers`?`Every entry in servers.config.json`:e.kind===`secrets`?`Telegram bot token and DDNS credentials`:e.path===void 0?e.note??`A declared data path`:e.origin===void 0?e.path:`${e.path} — from ${e.origin}`}function BB(e){return e.leaves.length>0&&e.leaves.every(e=>e.selected)}function VB(e){return e.note!==null&&e.note.length>0?e.note:e.kind===`settings`?`Listener, auth, host vitals and the backups policy`:e.kind===`secrets`?`Password hash and API token hash`:e.kind===`tls`?`The panel's own certificate pair`:`Its settings, servers, secrets and declared data paths`}function HB(e,t=[]){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{id:e.id,label:e.label,hint:VB(e),kind:e.kind,...e.workspaceId===void 0?{}:{workspaceId:e.workspaceId},selected:t?.selected??!0,leaves:e.items.map(e=>({id:e.id,label:e.label,hint:zB(e),kind:e.kind,selected:t?.leaves.find(t=>t.id===e.id)?.selected??!0}))}})}function UB(e){return e.kind===`workspace`?e.selected&&e.leaves.some(e=>e.selected):e.selected}function WB(e,t){for(let n of e){n.selected=t;for(let e of n.leaves)e.selected=t}}function GB(e){let t=e.filter(e=>UB(e));if(e.length>0&&t.length===e.length&&t.every(e=>e.kind!==`workspace`||BB(e)))return;let n=[];for(let e of t){if(e.kind!==`workspace`){n.push(e.id);continue}BB(e)?n.push(e.id):n.push(...e.leaves.filter(e=>e.selected).map(e=>e.id))}return n}function KB(e){let t=0,n=0;for(let r of e)UB(r)&&(n+=1,t+=r.kind===`workspace`?r.leaves.filter(e=>e.selected).length:1);return{entries:n,leaves:t}}var qB=[`disabled`],JB={class:`min-w-0`},YB={class:`text-ink`},XB=P({__name:`CheckField`,props:Ra({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`);return(e,r)=>(R(),z(`label`,{class:O(j(Q)(`flex cursor-pointer select-none items-start gap-2 rounded-control px-2 py-1.5 text-xs transition-colors duration-150`,`hover:bg-hover`,t.disabled&&`cursor-not-allowed opacity-50 hover:bg-transparent`))},[xr(V(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,type:`checkbox`,disabled:t.disabled,class:`mt-0.5 size-3.5 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-line bg-page checked:border-accent checked:bg-accent checked:bg-[length:9px] checked:bg-center checked:bg-no-repeat checked:[background-image:url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22white%22 stroke-width=%224%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M20 6 9 17l-5-5%22/></svg>')] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-not-allowed`},null,8,qB),[[Jl,n.value]]),V(`span`,JB,[V(`span`,YB,k(t.label),1),t.hint?(R(),z(`span`,{key:0,class:O([`mt-0.5 block`,[j(JL)]])},k(t.hint),3)):W(``,!0),I(e.$slots,`default`)])],2))}}),ZB={class:`space-y-3`},QB={class:`flex items-center justify-between gap-2`},$B={class:`text-xs font-medium text-muted`},eV={class:`flex items-center gap-1.5`},tV={class:`max-h-80 space-y-1.5 overflow-auto`},nV={class:`flex items-start gap-2.5`},rV={class:`min-w-0 flex-1`},iV={key:0,class:`flex shrink-0 items-center gap-1.5 pt-0.5`},aV={class:`font-mono text-2xs text-faint`},oV={key:1,class:`shrink-0 rounded-control border border-line px-1.5 py-0.5 text-2xs text-faint`},sV={key:0,class:`mt-1 flex items-center gap-1 pl-6 text-2xs text-warn`},cV={class:`space-y-3`},lV={class:`flex items-center justify-between gap-2`},uV={class:`text-xs font-medium text-muted`},dV={class:`flex items-center gap-1.5`},fV={class:`max-h-72 space-y-1 overflow-auto`},pV={key:0,class:`text-xs text-muted`},mV=P({__name:`BackupDialog`,props:Ra({state:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Ra([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`open`),a=A(!1),o=A(null),s=A(``),c=A([]),l=A(!1),u=A(null),d=A({});function f(e){c.value=HB(n.state?.entries??[],e?c.value:[])}let p=G(()=>KB(c.value)),m=G(()=>c.value.find(e=>e.id===`global:settings`)?.selected??!1),h=G(()=>n.state!==null&&p.value.leaves>0&&!a.value),g=G(()=>u.value===null?0:u.value.leaves.filter(e=>d.value[e.id]===!0).length);N(i,e=>{e&&(s.value=``,o.value=null,f(!1))},{immediate:!0}),N(()=>n.state,()=>{i.value&&f(!0)});function _(e){u.value=e,d.value=Object.fromEntries(e.leaves.map(e=>[e.id,e.selected])),l.value=!0}function v(){let e=u.value;if(e!==null){for(let t of e.leaves)t.selected=d.value[t.id]===!0;e.leaves.some(e=>e.selected)&&(e.selected=!0),l.value=!1,u.value=null}}function y(e){let t=u.value;t!==null&&(d.value=Object.fromEntries(t.leaves.map(t=>[t.id,e])))}async function b(){if(h.value){a.value=!0,o.value=null;try{await zM(s.value,GB(c.value)),i.value=!1,r(`created`,`Backup created.`)}catch(e){o.value=e instanceof Error?e.message:String(e)}finally{a.value=!1}}}return(e,t)=>(R(),z(L,null,[H(ER,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:`Create a backup`,description:`Pick what this archive captures. Nothing is written until you create it.`,width:`w-[min(92vw,40rem)]`},{footer:M(()=>[H($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:M(()=>[...t[14]||=[U(` Cancel `,-1)]]),_:1},8,[`disabled`]),H($,{size:`sm`,variant:`primary`,disabled:!h.value,loading:a.value,onClick:b},{default:M(()=>[...t[15]||=[U(` Create backup `,-1)]]),_:1},8,[`disabled`,`loading`])]),default:M(()=>[V(`div`,ZB,[V(`div`,QB,[V(`span`,$B,k(p.value.entries)+` entr`+k(p.value.entries===1?`y`:`ies`)+` · `+k(p.value.leaves)+` item`+k(p.value.leaves===1?``:`s`)+` selected `,1),V(`div`,eV,[H($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[0]||=e=>j(WB)(c.value,!0)},{default:M(()=>[...t[9]||=[U(` Select all `,-1)]]),_:1},8,[`disabled`]),H($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>j(WB)(c.value,!1)},{default:M(()=>[...t[10]||=[U(` Select none `,-1)]]),_:1},8,[`disabled`])])]),V(`ul`,tV,[(R(!0),z(L,null,F(c.value,e=>(R(),z(`li`,{key:e.id,class:`rounded-control border border-line-soft bg-panel-2/30 px-2.5 py-2`},[V(`div`,nV,[V(`div`,rV,[H(XB,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:e.hint,disabled:a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]),e.kind===`workspace`?(R(),z(`div`,iV,[V(`span`,aV,k(e.leaves.filter(e=>e.selected).length)+`/`+k(e.leaves.length),1),H($,{size:`xs`,variant:`secondary`,disabled:a.value,onClick:t=>_(e)},{default:M(()=>[H(j(Nv),{class:`size-3`}),t[11]||=U(`Choose items `,-1)]),_:1},8,[`disabled`,`onClick`])])):(R(),z(`span`,oV,k(e.kind),1))]),e.kind===`workspace`&&e.selected&&!j(BB)(e)&&e.leaves.some(e=>e.selected)?(R(),z(`p`,sV,[H(j(iy),{class:`size-3`}),t[12]||=U(` Only the chosen items are captured. `,-1)])):W(``,!0)]))),128))]),m.value?W(``,!0):(R(),B(FB,{key:0,tone:`warn`},{default:M(()=>[...t[13]||=[U(` Without the global settings, a restore can only place a workspace where the target panel already declares it. `,-1)]]),_:1})),H(dR,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,type:`password`,autocomplete:`new-password`,label:`Password (optional)`,hint:`Encrypts the archive; restoring it asks for the same password.`,wide:``},null,8,[`modelValue`]),o.value?(R(),B(FB,{key:1,tone:`danger`},{default:M(()=>[U(k(o.value),1)]),_:1})):W(``,!0)])]),_:1},8,[`open`]),H(ER,{open:l.value,"onUpdate:open":t[8]||=e=>l.value=e,title:u.value===null?`Choose items`:`${u.value.label} — choose items`,description:`A workspace can be captured whole or only its settings, servers, secrets and declared data paths.`,width:`w-[min(92vw,34rem)]`},{footer:M(()=>[H($,{size:`sm`,variant:`ghost`,onClick:t[7]||=e=>l.value=!1},{default:M(()=>[...t[18]||=[U(` Cancel `,-1)]]),_:1}),H($,{size:`sm`,variant:`primary`,onClick:v},{default:M(()=>[...t[19]||=[U(` Apply `,-1)]]),_:1})]),default:M(()=>[V(`div`,cV,[V(`div`,lV,[V(`span`,uV,k(g.value)+` of `+k(u.value?.leaves.length??0)+` selected`,1),V(`div`,dV,[H($,{size:`xs`,variant:`ghost`,onClick:t[5]||=e=>y(!0)},{default:M(()=>[...t[16]||=[U(` Select all `,-1)]]),_:1}),H($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>y(!1)},{default:M(()=>[...t[17]||=[U(` Select none `,-1)]]),_:1})])]),V(`ul`,fV,[(R(!0),z(L,null,F(u.value?.leaves??[],e=>(R(),z(`li`,{key:e.id,class:`rounded-control px-2 py-1.5 hover:bg-hover`},[H(XB,{"model-value":d.value[e.id]===!0,label:e.label,hint:e.hint,"onUpdate:modelValue":t=>d.value[e.id]=t===!0},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`])]))),128))]),u.value?.leaves.length===0?(R(),z(`p`,pV,` This workspace declares nothing selectable yet. `)):W(``,!0)])]),_:1},8,[`open`,`title`])],64))}}),hV={class:`space-y-3`},gV={key:0,class:`flex min-w-0 flex-col gap-1`},_V=[`disabled`],vV={key:0,class:`font-mono text-2xs text-muted`},yV={class:`mt-2`},bV={class:`mt-2 max-w-sm`},xV={class:`mt-2`},SV={class:`mt-2`},CV={class:`mt-1 max-h-64 space-y-0.5 overflow-auto`},wV={class:`mt-2 flex flex-wrap items-center gap-2`},TV={class:`mt-2`},EV=`__upload__`,DV=P({__name:`RestoreDialog`,props:Ra({files:{},initial:{default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Ra([`applied`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`open`),a=A(!1),o=A(null),s=A(null),c=A(null),l=A(``),u=A({kind:`upload`}),d=A(EV),f=G(()=>s.value?.items.filter(e=>e.selected).length??0),p=G(()=>s.value?.items.some(e=>e.id===`global:settings`&&e.selected)??!1),m=G(()=>s.value?.needsPassword===!0),h=G(()=>s.value!==null&&!m.value&&f.value>0&&!a.value),g=G(()=>[...n.files.map(e=>({value:e.name,label:e.encrypted?`${e.name} — encrypted`:e.name})),{value:EV,label:`Upload a file…`}]),_=Q(YL,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);function v(e){return e instanceof Error?e.message:String(e)}function y(){return l.value.length>0?{password:l.value}:{}}async function b(){let e=u.value;if(e.kind===`upload`&&c.value===null){s.value=null;return}a.value=!0,o.value=null,s.value=null;try{s.value=e.kind===`stored`?await eM(e.name,!1,y()):await BM(c.value,!1,y())}catch(e){o.value=v(e)}finally{a.value=!1}}function x(e){d.value=e,c.value=null,u.value=e===EV?{kind:`upload`}:{kind:`stored`,name:e},b()}function S(e){c.value=e.target.files?.[0]??null,b()}function C(e){for(let t of s.value?.items??[])t.restorable&&(t.selected=e)}async function w(){let e=s.value,t=u.value;if(e===null||!h.value)return;a.value=!0,o.value=null;let n={...y(),include:e.items.filter(e=>e.restorable&&e.selected).map(e=>e.id)};try{let e=t.kind===`stored`?await eM(t.name,!0,n):await BM(c.value,!0,n);i.value=!1,s.value=null,c.value=null,l.value=``;let a=[];e.reloaded&&a.push(`the restored servers are live, autostart entries starting`),e.restartRequired&&a.push(`restart the panel to apply its own settings`),r(`applied`,`Restored ${e.applied.length} item(s)${a.length===0?``:` — ${a.join(`; `)}`}.`)}catch(e){o.value=v(e)}finally{a.value=!1}}return N(i,e=>{if(!e){s.value=null,c.value=null,l.value=``,o.value=null;return}let t=n.files[0];u.value=n.initial??(t===void 0?{kind:`upload`}:{kind:`stored`,name:t.name}),d.value=u.value.kind===`stored`?u.value.name:EV,b()},{immediate:!0}),(e,t)=>(R(),B(ER,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:`Restore a backup`,description:`Nothing is written until the plan is applied.`,width:`w-[min(92vw,38rem)]`},{footer:M(()=>[H($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:M(()=>[...t[10]||=[U(` Cancel `,-1)]]),_:1},8,[`disabled`]),s.value&&!m.value?(R(),B($,{key:0,size:`sm`,variant:`danger`,disabled:!h.value,loading:a.value,onClick:w},{default:M(()=>[U(k(u.value.kind===`stored`?`Apply this restore`:`Restore the upload`),1)]),_:1},8,[`disabled`,`loading`])):W(``,!0)]),default:M(()=>[V(`div`,hV,[H(oR,{"model-value":d.value,label:`Archive`,hint:`A stored archive, or a .zip from this machine.`,options:g.value,disabled:a.value,wide:``,"onUpdate:modelValue":x},null,8,[`model-value`,`options`,`disabled`]),u.value.kind===`upload`?(R(),z(`div`,gV,[V(`label`,{class:O(j(qL)),for:`restore-upload`},`Archive file (.zip)`,2),V(`input`,{id:`restore-upload`,type:`file`,accept:`.zip,application/zip`,class:O(j(_)),disabled:a.value,onChange:S},null,42,_V),c.value?(R(),z(`p`,vV,k(c.value.name),1)):W(``,!0)])):W(``,!0),a.value?(R(),B(qz,{key:1,class:`h-20 w-full`})):s.value?(R(),B(FB,{key:2,tone:`warn`,title:`Nothing has changed yet`},{default:M(()=>[V(`p`,null,[u.value.kind===`stored`?(R(),z(L,{key:0},[t[5]||=U(` Archive `,-1),V(`code`,null,k(u.value.name),1),t[6]||=U(`. `,-1)],64)):(R(),z(L,{key:1},[U(` The uploaded archive. `)],64))]),s.value.needsPassword?(R(),z(L,{key:0},[V(`p`,yV,k(s.value.error??`This backup is password-protected.`),1),V(`div`,bV,[H(dR,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`password`,autocomplete:`off`,label:`Password`},null,8,[`modelValue`])]),V(`div`,xV,[H($,{size:`sm`,variant:`secondary`,disabled:a.value,onClick:b},{default:M(()=>[...t[7]||=[U(` Check again with the password `,-1)]]),_:1},8,[`disabled`])])],64)):(R(),z(L,{key:1},[V(`p`,SV,` Choose what to restore — `+k(f.value)+` of `+k(s.value.items.length)+` selected. `,1),V(`ul`,CV,[(R(!0),z(L,null,F(s.value.items,e=>(R(),z(`li`,{key:e.id},[H(XB,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:[e.kind,e.workspaceId,e.note].filter(Boolean).join(` · `),disabled:!e.restorable||a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]))),128))]),V(`div`,wV,[H($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>C(!0)},{default:M(()=>[...t[8]||=[U(` Select all `,-1)]]),_:1},8,[`disabled`]),H($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[2]||=e=>C(!1)},{default:M(()=>[...t[9]||=[U(` Select none `,-1)]]),_:1},8,[`disabled`])]),V(`p`,TV,[U(` Will restore: `+k(s.value.applied.join(`, `)||`nothing`)+`. `,1),s.value.skipped.length?(R(),z(L,{key:0},[U(` Skipped: `+k(s.value.skipped.join(`, `))+`. `,1)],64)):W(``,!0),s.value.restartRequired?(R(),z(L,{key:1},[U(` The panel's own settings differ, so restart the panel afterwards. `)],64)):p.value?(R(),z(L,{key:2},[U(` Restored workspaces are reloaded immediately; entries marked autostart start on their own. `)],64)):W(``,!0)])],64))]),_:1})):W(``,!0),o.value?(R(),B(FB,{key:3,tone:`danger`},{default:M(()=>[U(k(o.value),1)]),_:1})):W(``,!0)])]),_:1},8,[`open`]))}}),OV=[`aria-label`],kV=P({__name:`CopyButton`,props:{value:{},label:{default:`Copy`},class:{default:void 0}},setup(e){let t=e,n=A(!1),r=null;async function i(){try{await navigator.clipboard.writeText(t.value),n.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{n.value=!1},1400)}catch{}}return ze(()=>{r&&clearTimeout(r)}),(e,r)=>(R(),z(`button`,{type:`button`,class:O(j(Q)(`inline-grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,j(KL),t.class)),"aria-label":n.value?`Copied`:t.label,onClick:i},[n.value?(R(),B(j(Pv),{key:0,class:`size-3.5 text-ok`})):(R(),B(j(Kv),{key:1,class:`size-3.5`}))],10,OV))}}),AV={key:0,class:`size-1.5 shrink-0 rounded-full bg-current`},jV=P({__name:`ToneBadge`,props:{tone:{default:`neutral`},dot:{type:Boolean,default:!1},mono:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){let t=e,n=G(()=>Q(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium whitespace-nowrap`,t.plain?Q(`border-transparent bg-transparent`,zF[t.tone].split(` `).filter(e=>e.startsWith(`text-`)).join(` `)):zF[t.tone],t.mono&&`font-mono`));return(e,r)=>(R(),z(`span`,{class:O(n.value)},[t.dot?(R(),z(`span`,AV)):W(``,!0),I(e.$slots,`default`)],2))}}),MV={class:`space-y-3`},NV={key:0,class:`sm:col-span-2`},PV={key:1,class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},FV={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},IV={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},LV={class:`text-2xs leading-4 text-faint`},RV={key:0,class:`space-y-2 sm:col-span-2`},zV={key:1,class:`text-xs text-muted sm:col-span-2`},BV={key:2,class:`divide-y divide-line-soft sm:col-span-2`},VV={class:`flex items-center gap-2`},HV={class:`min-w-0 flex-1 truncate text-xs font-medium text-ink`},UV={key:0,class:`font-mono text-2xs text-faint`},WV={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},GV={key:1,class:`mt-1 space-y-1`},KV={class:`min-w-0`},qV={class:`truncate font-mono text-2xs text-ink`},JV={class:`mt-0.5 text-2xs leading-4 text-faint`},YV={key:3,class:`text-2xs leading-4 text-faint sm:col-span-2`},XV={key:0,class:`space-y-2 sm:col-span-2`},ZV={key:1,class:`sm:col-span-2`},QV={key:2,class:`divide-y divide-line-soft sm:col-span-2`},$V={class:`min-w-0 flex-1`},eH={class:`flex items-center gap-2`},tH={class:`truncate font-mono text-xs text-ink`},nH={class:`mt-0.5 font-mono text-2xs tabular-nums text-muted`},rH={class:`flex items-center gap-1.5`},iH=[`href`],aH={key:3,class:`space-y-2 sm:col-span-2`},oH=P({__name:`BackupsSection`,props:Ra({state:{},policy:{},configPath:{},workspaces:{},dirty:{type:Boolean}},{form:{required:!0},formModifiers:{}}),emits:Ra([`reset`],[`update:form`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`form`),a=KN(),o=TL(()=>i.value.keep,e=>i.value.keep=e,5),s=A(!1),c=A(null),l=A(null),u=A(!1),d=A(!1),f=A(null),p=G(()=>n.state?.files??[]),m=G(()=>n.state?.entries??[]),h={settings:`settings`,servers:`servers`,secrets:`secrets`,tls:`tls`,data:`data`},g=Q(`inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-line bg-raise px-2 text-2xs font-medium text-ink`,`transition-colors duration-150 hover:bg-hover`,KL);function _(e){f.value=e===void 0?null:{kind:`stored`,name:e},d.value=!0}function v(e){l.value=null,c.value=e,a.refresh()}function y(e){l.value=null,c.value=e,a.refresh()}async function b(e){s.value=!0,l.value=null,c.value=null;try{await Gj(e),c.value=`Deleted ${e}.`,await a.refresh()}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{s.value=!1}}return(e,t)=>(R(),z(`div`,MV,[H(UL,{title:`Policy`,description:`How many archives the panel keeps, and the extra paths every one of them captures.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[9]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:`Allow backups`,hint:`Off stops new archives; whatever is already on disk stays downloadable and restorable.`,wide:``},null,8,[`modelValue`]),i.value.enabled?W(``,!0):(R(),z(`div`,NV,[H(FB,{tone:`warn`,title:`Backups are off`},{default:M(()=>[...t[10]||=[U(` Nothing new is archived until this is back on. The archives below can still be downloaded, restored and deleted. `,-1)]]),_:1})])),H(eR,{modelValue:j(o),"onUpdate:modelValue":t[2]||=e=>mn(o)?o.value=e:null,label:`Keep`,min:1,hint:`Older archives are pruned after each backup.`},null,8,[`modelValue`]),H(dR,{modelValue:i.value.includePaths,"onUpdate:modelValue":t[3]||=e=>i.value.includePaths=e,label:`Extra paths`,hint:`Comma separated, captured in every archive on top of what each workspace declares.`,placeholder:`{home}/myapp-data`},null,8,[`modelValue`]),n.policy===null?W(``,!0):(R(),z(`div`,PV,[t[13]||=V(`span`,{class:`text-xs font-medium text-muted`},`Archive directory`,-1),V(`div`,FV,[V(`span`,IV,k(n.policy.dir),1),H(kV,{value:n.policy.dir,label:`Copy the archive directory`},null,8,[`value`])]),V(`p`,LV,[t[11]||=U(` Changing it is a file-level decision: edit `,-1),V(`code`,null,k(n.configPath??`the settings file`),1),t[12]||=U(`. `,-1)])]))]),_:1}),H(UL,{title:`What a backup captures`,description:`Pick these in the create dialog. A workspace can be taken whole or only its settings, servers, secrets and declared data paths.`},{default:M(()=>[n.state===null?(R(),z(`div`,RV,[H(qz,{class:`h-4 w-full`}),H(qz,{class:`h-4 w-2/3`})])):m.value.length===0?(R(),z(`p`,zV,` Nothing is selectable yet. `)):(R(),z(`ul`,BV,[(R(!0),z(L,null,F(m.value,e=>(R(),z(`li`,{key:e.id,class:`py-2 first:pt-0`},[V(`div`,VV,[V(`p`,HV,k(e.label),1),H(jV,{tone:`neutral`,plain:``},{default:M(()=>[U(k(h[e.kind]??e.kind),1)]),_:2},1024),e.workspaceId?(R(),z(`span`,UV,k(e.workspaceId),1)):W(``,!0)]),e.note?(R(),z(`p`,WV,k(e.note),1)):W(``,!0),e.items.length>0?(R(),z(`ul`,GV,[(R(!0),z(L,null,F(e.items,e=>(R(),z(`li`,{key:e.id,class:`flex items-start justify-between gap-3 rounded-control bg-panel-2/40 px-2 py-1`},[V(`div`,KV,[V(`p`,qV,k(e.path??e.label),1),V(`p`,JV,[U(k(e.included?e.origin?`from ${e.origin}`:e.note??`included`:e.note??`not captured`)+` `,1),e.included&&e.ignoreGenerated?(R(),z(L,{key:0},[U(` · generated directories skipped `)],64)):W(``,!0)])]),H(jV,{tone:e.included?`ok`:`neutral`,plain:``},{default:M(()=>[U(k(e.included?`included`:`skipped`),1)]),_:2},1032,[`tone`])]))),128))])):W(``,!0)]))),128))])),n.workspaces.length>1?(R(),z(`p`,YV,` This panel serves `+k(n.workspaces.length)+` workspaces; each is its own selectable entry. `,1)):W(``,!0)]),_:1}),H(UL,{title:`Archives`,description:`Stored in the backup directory and downloadable at any time.`},{actions:M(()=>[i.value.enabled?(R(),B($,{key:0,size:`xs`,variant:`primary`,disabled:n.state===null,onClick:t[4]||=e=>u.value=!0},{default:M(()=>[...t[14]||=[U(` Create backup… `,-1)]]),_:1},8,[`disabled`])):W(``,!0),H($,{size:`xs`,variant:`secondary`,disabled:n.state===null,onClick:t[5]||=e=>_()},{default:M(()=>[...t[15]||=[U(` Restore… `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[n.state===null?(R(),z(`div`,XV,[H(qz,{class:`h-4 w-full`}),H(qz,{class:`h-4 w-2/3`})])):p.value.length===0?(R(),z(`div`,ZV,[H(aI,{compact:``,title:`No archives yet`,description:i.value.enabled?`Create one now to capture the panel and whichever workspaces you pick.`:`Nothing has been archived yet, and backups are off.`},va({icon:M(()=>[H(j(jv),{class:`size-4`})]),_:2},[i.value.enabled?{name:`action`,fn:M(()=>[H($,{size:`sm`,variant:`primary`,onClick:t[6]||=e=>u.value=!0},{default:M(()=>[...t[16]||=[U(` Create backup… `,-1)]]),_:1})]),key:`0`}:void 0]),1032,[`description`])])):(R(),z(`ul`,QV,[(R(!0),z(L,null,F(p.value,e=>(R(),z(`li`,{key:e.name,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0 last:pb-0`},[V(`div`,$V,[V(`div`,eH,[V(`span`,tH,k(e.name),1),e.encrypted?(R(),B(jV,{key:0,tone:`warn`,plain:``},{default:M(()=>[...t[17]||=[U(` encrypted `,-1)]]),_:1})):W(``,!0)]),V(`p`,nH,k(j(fI)(e.sizeBytes))+` · `+k(j(dI)(e.createdAt)),1)]),V(`div`,rH,[V(`a`,{href:Hj(e.name),class:O(j(g))},[H(j(Jv),{class:`size-3`,"aria-hidden":`true`}),t[18]||=U(` Download `,-1)],10,iH),H($,{size:`xs`,variant:`secondary`,onClick:t=>_(e.name)},{default:M(()=>[H(j(by),{class:`size-3`,"aria-hidden":`true`}),t[19]||=U(` Restore `,-1)]),_:1},8,[`onClick`]),H(MB,{label:`Delete`,"confirm-label":`Confirm delete`,size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:s.value,onConfirm:t=>b(e.name)},null,8,[`disabled`,`onConfirm`])])]))),128))])),l.value||c.value?(R(),z(`div`,aH,[l.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(l.value),1)]),_:1})):W(``,!0),c.value?(R(),B(FB,{key:1,tone:`ok`},{default:M(()=>[U(k(c.value),1)]),_:1})):W(``,!0)])):W(``,!0)]),_:1}),H(mV,{open:u.value,"onUpdate:open":t[7]||=e=>u.value=e,state:n.state,onCreated:v},null,8,[`open`,`state`]),H(DV,{open:d.value,"onUpdate:open":t[8]||=e=>d.value=e,files:p.value,initial:f.value,onApplied:y},null,8,[`open`,`files`,`initial`])]))}}),sH={key:0,class:`mt-3 flex flex-wrap items-center gap-1.5`},cH={key:1,class:`mt-3 text-xs text-muted`},lH=P({__name:`HostSection`,props:Ra({config:{},alerts:{},dirty:{type:Boolean}},{host:{required:!0},hostModifiers:{}}),emits:Ra([`reset`],[`update:host`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`host`),a=TL(()=>i.value.intervalMs,e=>i.value.intervalMs=e,15e3),o=TL(()=>i.value.diskUsedPercent,e=>i.value.diskUsedPercent=e,90),s=TL(()=>i.value.memoryUsedPercent,e=>i.value.memoryUsedPercent=e,90),c=TL(()=>i.value.swapUsedPercent,e=>i.value.swapUsedPercent=e,50),l=TL(()=>i.value.loadPerCpu,e=>i.value.loadPerCpu=e,2),u=TL(()=>i.value.tempCelsius,e=>i.value.tempCelsius=e,85);return(e,t)=>(R(),z(L,null,[H(UL,{title:`Thresholds`,description:`A threshold of 0 disables that alert. Breaches notify once, and once more on recovery.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[9]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:`Sample this machine`,hint:`Load, memory, swap, disk and CPU temperature, on the interval below.`,wide:``},null,8,[`modelValue`]),H(eR,{modelValue:j(a),"onUpdate:modelValue":t[2]||=e=>mn(a)?a.value=e:null,label:`Interval (ms)`,min:5e3,hint:`How often the host is sampled and alerts are checked.`},null,8,[`modelValue`]),H(dR,{modelValue:i.value.diskPaths,"onUpdate:modelValue":t[3]||=e=>i.value.diskPaths=e,label:`Disk paths`,hint:`Comma separated; templates like {home} are expanded.`},null,8,[`modelValue`]),H(eR,{modelValue:j(o),"onUpdate:modelValue":t[4]||=e=>mn(o)?o.value=e:null,label:`Disk used (%)`,min:0,max:100,hint:`0 disables the alert.`},null,8,[`modelValue`]),H(eR,{modelValue:j(s),"onUpdate:modelValue":t[5]||=e=>mn(s)?s.value=e:null,label:`Memory used (%)`,min:0,max:100,hint:`0 disables the alert.`},null,8,[`modelValue`]),H(eR,{modelValue:j(c),"onUpdate:modelValue":t[6]||=e=>mn(c)?c.value=e:null,label:`Swap used (%)`,min:0,max:100,hint:`0 disables the alert.`},null,8,[`modelValue`]),H(eR,{modelValue:j(l),"onUpdate:modelValue":t[7]||=e=>mn(l)?l.value=e:null,label:`Load per CPU`,min:0,hint:`1-minute load average divided by the core count.`},null,8,[`modelValue`]),H(eR,{modelValue:j(u),"onUpdate:modelValue":t[8]||=e=>mn(u)?u.value=e:null,label:`CPU temperature (°C)`,min:0,hint:`Linux only; ignored where the OS does not expose it.`},null,8,[`modelValue`])]),_:1}),n.alerts.length>0?(R(),z(`div`,sH,[t[10]||=V(`span`,{class:`text-xs text-muted`},`Breaching now:`,-1),(R(!0),z(L,null,F(n.alerts,e=>(R(),B(jV,{key:e,tone:`danger`,dot:``},{default:M(()=>[U(k(e),1)]),_:2},1024))),128))])):i.value.enabled?(R(),z(`p`,cH,` Nothing is breaching right now. `)):W(``,!0)],64))}}),uH={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},dH={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},fH={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},pH={class:`text-2xs leading-4 text-faint`},mH={key:0},hH={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},gH={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},_H={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},vH={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},yH=[`disabled`],bH=P({__name:`InterfaceSection`,props:Ra({ui:{},panelVersion:{},labelDirty:{type:Boolean}},{label:{required:!0},labelModifiers:{}}),emits:Ra([`changed`,`resetLabel`],[`update:label`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`label`),a=A(null),o=A(!1),s=A(null),c=A(null),l=A(!1),u=G(()=>{let e=n.ui;if(e===null)return`unknown`;if(!e.custom)return`stock`;let t=e.meta;return t===null?`custom`:`custom · ${t.name??`unnamed`}${t.version==null?``:` ${t.version}`}`}),d=G(()=>{let e=n.ui?.meta;if(e==null)return null;let t=e.uploadedAt===void 0?null:new Date(e.uploadedAt).toLocaleString();return`${e.files??0} files${t===null?``:` · ${t}`}`});function f(e){a.value=e.target.files?.[0]??null,s.value=null,c.value=null}async function p(){if(a.value!==null){o.value=!0,c.value=null,s.value=null;try{let e=await cM(a.value);s.value=`UI replaced with ${e.meta?.name??`your build`} — refresh the page`,a.value=null,r(`changed`)}catch(e){c.value=e instanceof Error?e.message:String(e)}finally{o.value=!1}}}async function m(){if(!l.value){l.value=!0,setTimeout(()=>{l.value=!1},5e3);return}l.value=!1,o.value=!0,c.value=null;try{let e=await rM();s.value=e.removed?`stock UI restored — refresh the page`:`no custom UI was installed`,r(`changed`)}catch(e){c.value=e instanceof Error?e.message:String(e)}finally{o.value=!1}}return(t,h)=>(R(),B(UL,{title:`Interface`,description:`The panel is a static site: keep the stock one, or serve your own build from the state directory.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.labelDirty,onClick:h[1]||=e=>r(`resetLabel`)},{default:M(()=>[...h[6]||=[U(` Reset name `,-1)]]),_:1},8,[`disabled`]),e.ui?.custom?(R(),B($,{key:0,size:`xs`,variant:`ghost`,disabled:o.value,onClick:m},{default:M(()=>[U(k(l.value?`Confirm revert`:`Revert to stock`),1)]),_:1},8,[`disabled`])):W(``,!0),H($,{size:`xs`,variant:`primary`,disabled:o.value||a.value===null,onClick:p},{default:M(()=>[...h[7]||=[U(` Install UI `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[V(`div`,uH,[h[2]||=V(`span`,{class:`text-xs font-medium text-muted`},`Currently serving`,-1),V(`div`,dH,[V(`span`,fH,k(u.value),1),H(kV,{value:e.ui?.dir??``,label:`Copy the UI directory`},null,8,[`value`])]),V(`p`,pH,[d.value?(R(),z(`span`,mH,k(d.value)+` · `,1)):W(``,!0),V(`code`,null,k(e.ui?.dir??`—`),1)])]),V(`div`,hH,[h[3]||=V(`span`,{class:`text-xs font-medium text-muted`},`Panel version`,-1),V(`div`,gH,[V(`span`,_H,`home-hosted `+k(n.panelVersion??`unknown`),1),n.panelVersion?(R(),B(kV,{key:0,value:n.panelVersion,label:`Copy the panel version`},null,8,[`value`])):W(``,!0)]),h[4]||=V(`p`,{class:`text-2xs leading-4 text-faint`},[U(` The release this panel process is running — `),V(`code`,null,`home-hosted status`),U(` prints the same number. `)],-1)]),H(dR,{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,label:`Panel name`,hint:`Shown in the sidebar by the stock UI. A custom UI may show its own name instead.`,wide:``},null,8,[`modelValue`]),V(`label`,vH,[h[5]||=V(`span`,{class:`text-xs font-medium text-muted`},`Upload a UI build (.zip with an index.html)`,-1),V(`input`,{type:`file`,accept:`.zip,application/zip`,class:`rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-xs text-ink file:mr-2 file:rounded file:border-0 file:bg-line file:px-2 file:py-1 file:text-xs`,disabled:o.value,onChange:f},null,40,yH)]),c.value?(R(),B(FB,{key:0,tone:`warn`,title:c.value},null,8,[`title`])):s.value?(R(),B(FB,{key:1,tone:`ok`,title:s.value},null,8,[`title`])):W(``,!0),h[8]||=V(`p`,{class:`text-2xs leading-4 text-faint sm:col-span-2`},[U(` See `),V(`code`,null,`docs/UI_CREATION.md`),U(` for the API contract. If a custom UI breaks the panel, `),V(`code`,null,`home-hosted ui-revert`),U(` puts the stock one back from the terminal. `)],-1)]),_:1}))}}),xH={class:`inline-flex items-center gap-0.5 rounded-control border border-line bg-panel-2 p-0.5`},SH=[`aria-pressed`,`onClick`],CH=P({__name:`SegmentedControl`,props:Ra({options:{},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=oo(e,`modelValue`);return(e,r)=>(R(),z(`div`,xH,[(R(!0),z(L,null,F(t.options,e=>(R(),z(`button`,{key:e.value,type:`button`,class:O(j(Q)(`rounded-[5px] font-medium transition-colors duration-150`,t.size===`sm`?`h-6 px-2 text-2xs`:`h-7 px-2.5 text-xs`,n.value===e.value?`bg-raise text-ink shadow-card`:`text-muted hover:text-ink`)),"aria-pressed":n.value===e.value,onClick:t=>n.value=e.value},k(e.label),11,SH))),128))]))}}),wH={class:`flex min-w-0 flex-col gap-1`},TH={class:`text-2xs leading-4 text-faint`},EH={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},DH={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},OH={class:`min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-ink`},kH=P({__name:`ListenerSection`,props:Ra({view:{},dirty:{type:Boolean}},{control:{required:!0},controlModifiers:{}}),emits:Ra([`reset`],[`update:control`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`control`),a=TL(()=>i.value.port,e=>i.value.port=e,3999),o=[`local`,`lan`],s=G({get:()=>o.includes(i.value.host)?i.value.host:`custom`,set:e=>{if(e!==`custom`){i.value.host=e;return}if(!o.includes(i.value.host))return;let t=n.view?.bindHost??``,r=t!==``&&t!==`0.0.0.0`&&t!==`127.0.0.1`&&Qk(t)!==null;i.value.host=r?t:`127.0.0.1`}}),c=G(()=>{if(s.value===`custom`&&Qk(i.value.host)===null)return`Enter an IPv4 address, for example 192.168.1.20.`}),l=G(()=>n.view?.url??`—`);return(e,t)=>(R(),B(UL,{title:`Listener`,description:`Where the panel answers. Moving this restarts the panel and sends this page to the new address.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[5]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(eR,{modelValue:j(a),"onUpdate:modelValue":t[1]||=e=>mn(a)?a.value=e:null,label:`Control port`,min:1,max:65535,hint:`Default 3999.`},null,8,[`modelValue`]),V(`div`,wH,[t[6]||=V(`span`,{class:`text-xs font-medium text-muted`},`Bind`,-1),H(CH,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,options:[{value:`local`,label:`Local`},{value:`lan`,label:`LAN`},{value:`custom`,label:`Custom`}]},null,8,[`modelValue`]),V(`p`,TH,k(s.value===`lan`?`0.0.0.0 — reachable from the whole network.`:s.value===`local`?`127.0.0.1 — this machine only.`:`A specific interface address you type in below.`),1)]),s.value===`custom`?(R(),B(dR,{key:0,modelValue:i.value.host,"onUpdate:modelValue":t[3]||=e=>i.value.host=e,label:`IPv4 address`,placeholder:`192.168.1.20`,error:c.value,hint:`Binding beyond 127.0.0.1 needs a real password.`},null,8,[`modelValue`,`error`])):W(``,!0),H(mR,{modelValue:i.value.openBrowser,"onUpdate:modelValue":t[4]||=e=>i.value.openBrowser=e,label:`Open a browser when the panel comes up`,wide:``},null,8,[`modelValue`]),V(`div`,EH,[t[8]||=V(`span`,{class:`text-xs font-medium text-muted`},`Live address`,-1),V(`div`,DH,[V(`span`,OH,k(l.value),1),n.view?.restartRequired?(R(),B(jV,{key:0,tone:`warn`,dot:``},{default:M(()=>[...t[7]||=[U(` restart required `,-1)]]),_:1})):W(``,!0),H(kV,{value:l.value,label:`Copy the live address`},null,8,[`value`])]),t[9]||=V(`p`,{class:`text-2xs leading-4 text-faint`},` What the listener is bound to right now; saved changes take effect after the panel rebinds. `,-1)])]),_:1}))}}),AH={class:`space-y-3`},jH={class:`divide-y divide-line-soft sm:col-span-2`},MH={class:`min-w-0`},NH={class:`text-xs font-medium text-ink`},PH={class:`mt-0.5 text-2xs leading-4 text-faint`},FH={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},IH={class:`min-w-0 truncate font-mono text-xs text-ink`},LH={class:`flex items-center gap-2 text-xs font-medium text-ink`},RH={class:`font-mono text-2xs font-normal text-faint`},zH={class:`divide-y divide-line-soft`},BH={class:`min-w-0`},VH={class:`text-2xs font-medium text-ink`},HH={class:`mt-0.5 text-2xs leading-4 text-faint`},UH={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},WH={class:`min-w-0 truncate font-mono text-2xs text-ink`},GH=P({__name:`PathsSection`,props:{dataRoot:{},projectDir:{},panelUrl:{},workspaces:{}},setup(e){let t=e,n=G(()=>t.dataRoot===null?null:`${t.dataRoot}/settings.json`),r=G(()=>[{key:`data`,label:`Data root`,hint:`HHOSTED_HOME — global settings, workspaces, TLS, backups and the UI.`,value:t.dataRoot??`—`},{key:`settings`,label:`Global settings`,hint:`settings.json — listener, auth, TLS policy, host vitals, backups.`,value:n.value??`—`},{key:`project`,label:`Project directory`,hint:`Base for relative entry paths.`,value:t.projectDir??`—`},{key:`panel`,label:`Panel address`,hint:`Where this control panel is live right now.`,value:t.panelUrl??`—`}]);function i(e){return[{key:`${e.id}:config`,label:`Servers config`,hint:`${e.label}'s servers.config.json.`,value:e.configPath},{key:`${e.id}:settings`,label:`Workspace settings`,hint:`Server defaults, log retention, notifications, DDNS.`,value:e.settingsPath},{key:`${e.id}:logs`,label:`Logs`,hint:`Persisted output for this workspace.`,value:e.logsDir}]}return(t,n)=>(R(),z(`div`,AH,[H(UL,{title:`Where things live`,description:`Read-only. Copy a path straight into a shell or an editor.`},{default:M(()=>[V(`ul`,jH,[(R(!0),z(L,null,F(r.value,e=>(R(),z(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`},[V(`div`,MH,[V(`p`,NH,k(e.label),1),V(`p`,PH,k(e.hint),1)]),V(`div`,FH,[V(`span`,IH,k(e.value),1),H(kV,{value:e.value,label:`Copy ${e.label.toLowerCase()}`},null,8,[`value`,`label`])])]))),128))])]),_:1}),H(UL,{title:`Workspace files`,description:`Each workspace owns its config, settings and log directory; nothing is shared between them.`},{default:M(()=>[(R(!0),z(L,null,F(e.workspaces,e=>(R(),z(`div`,{key:e.id,class:`space-y-2 sm:col-span-2`},[V(`p`,LH,[U(k(e.label)+` `,1),V(`span`,RH,k(e.id),1)]),V(`ul`,zH,[(R(!0),z(L,null,F(i(e),e=>(R(),z(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-1.5`},[V(`div`,BH,[V(`p`,VH,k(e.label),1),V(`p`,HH,k(e.hint),1)]),V(`div`,UH,[V(`span`,WH,k(e.value),1),H(kV,{value:e.value,label:`Copy ${e.label.toLowerCase()}`},null,8,[`value`,`label`])])]))),128))])]))),128))]),_:1})]))}}),KH={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},qH={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},JH={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},YH={key:0,class:`sm:col-span-2`},XH={key:1,class:`space-y-3 sm:col-span-2`},ZH={class:`divide-y divide-line-soft text-xs`},QH={class:`flex items-start justify-between gap-4 py-1.5`},$H={class:`min-w-0 text-right font-mono text-xs text-ink`},eU={class:`flex items-start justify-between gap-4 py-1.5`},tU={class:`min-w-0 text-right font-mono text-xs text-ink`},nU={class:`flex items-start justify-between gap-4 py-1.5`},rU={class:`font-mono text-xs tabular-nums text-ink`},iU={class:`flex items-center justify-between gap-4 py-1.5`},aU={class:`flex items-start justify-between gap-4 py-1.5`},oU={class:`flex min-w-0 items-center gap-1.5`},sU={class:`min-w-0 truncate font-mono text-2xs text-ink`},cU={key:2,class:`sm:col-span-2`},lU={class:`flex min-w-0 flex-col gap-1`},uU={class:`flex min-w-0 flex-col gap-1`},dU={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},fU={key:3,class:`space-y-2 sm:col-span-2`},pU=P({__name:`TlsSection`,props:Ra({view:{},dirty:{type:Boolean}},{tlsEnabled:{type:Boolean,required:!0},tlsEnabledModifiers:{}}),emits:Ra([`reset`],[`update:tlsEnabled`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`tlsEnabled`),a=KN(),o=A(``),s=A(``),c=A(null),l=A(null),u=A(!1),d=G(()=>n.view?.tls??null),f=G(()=>n.view?`${n.view.protocol}://${n.view.bindHost}:${n.view.port}`:`—`),p=G(()=>o.value.trim().length>0&&s.value.trim().length>0&&!u.value),m=Q(YL,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?o.value=r:s.value=r}async function g(){u.value=!0,l.value=null,c.value=null;try{let e=await XM(o.value,s.value);o.value=``,s.value=``,c.value=`Certificate stored.`,await a.refresh();let t=await EL(e);t!==null&&(l.value=t)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}async function _(){u.value=!0,l.value=null,c.value=null;try{let e=await ZM();c.value=`Certificate removed.`,await a.refresh();let t=await EL(e);t!==null&&(l.value=t)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}return(e,t)=>(R(),z(L,null,[H(UL,{title:`HTTPS`,description:`Upload a PEM pair and the panel serves TLS on its own listener. A self-signed certificate is fine on a home network.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[6]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value,"onUpdate:modelValue":t[1]||=e=>i.value=e,label:`Serve the panel over HTTPS`,hint:`Saved with Save settings; the panel rebinds and this page follows it.`,class:`sm:col-span-2`},null,8,[`modelValue`]),V(`div`,KH,[t[7]||=V(`span`,{class:`text-xs font-medium text-muted`},`Live address`,-1),V(`div`,qH,[V(`span`,JH,k(f.value),1),H(kV,{value:f.value,label:`Copy the live address`},null,8,[`value`])])])]),_:1}),H(UL,{class:`mt-3`,title:`Certificate`,description:`PEM-encoded certificate and its private key. Both stay in the secrets file.`},{default:M(()=>[d.value?.error?(R(),z(`div`,YH,[H(FB,{tone:`danger`,title:`The stored certificate cannot be used`},{default:M(()=>[U(k(d.value.error),1)]),_:1})])):d.value?.certPresent?(R(),z(`div`,XH,[V(`dl`,ZH,[V(`div`,QH,[t[8]||=V(`dt`,{class:`text-muted`},` Subject `,-1),V(`dd`,$H,k(d.value.subject??`—`),1)]),V(`div`,eU,[t[9]||=V(`dt`,{class:`text-muted`},` Issuer `,-1),V(`dd`,tU,k(d.value.issuer??`—`),1)]),V(`div`,nU,[t[10]||=V(`dt`,{class:`text-muted`},` Valid until `,-1),V(`dd`,rU,[U(k(d.value.validTo?d.value.validTo.slice(0,10):`—`)+` `,1),d.value.daysRemaining===null?W(``,!0):(R(),z(`span`,{key:0,class:O(j(Q)(`ml-1.5`,d.value.daysRemaining<14?`text-warn`:`text-faint`))},` (`+k(d.value.daysRemaining)+` days) `,3))])]),V(`div`,iU,[t[11]||=V(`dt`,{class:`text-muted`},` Private key `,-1),V(`dd`,null,[H(jV,{tone:d.value.keyMatches?`ok`:`danger`,dot:``},{default:M(()=>[U(k(d.value.keyMatches?`matches the certificate`:`does not match`),1)]),_:1},8,[`tone`])])]),V(`div`,aU,[t[12]||=V(`dt`,{class:`text-muted`},` Fingerprint `,-1),V(`dd`,oU,[V(`span`,sU,k(d.value.fingerprint??`—`),1),d.value.fingerprint?(R(),B(kV,{key:0,value:d.value.fingerprint,label:`Copy the fingerprint`},null,8,[`value`])):W(``,!0)])])])])):(R(),z(`div`,cU,[H(FB,{tone:`info`,title:`No certificate uploaded`},{default:M(()=>[...t[13]||=[U(` Upload a PEM certificate and key below, then save. HTTPS is not served until a certificate is present. `,-1)]]),_:1})])),V(`div`,lU,[V(`label`,{class:O(j(qL)),for:`tls-cert-file`},`Certificate file (.pem, .crt)`,2),V(`input`,{id:`tls-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:O(j(m)),onChange:t[2]||=e=>h(e,`cert`)},null,34)]),V(`div`,uU,[V(`label`,{class:O(j(qL)),for:`tls-key-file`},`Private key file (.pem, .key)`,2),V(`input`,{id:`tls-key-file`,type:`file`,accept:`.pem,.key,text/plain`,class:O(j(m)),onChange:t[3]||=e=>h(e,`key`)},null,34)]),H(AR,{modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,label:`Or paste the certificate`,rows:4,placeholder:`-----BEGIN CERTIFICATE-----`},null,8,[`modelValue`]),H(AR,{modelValue:s.value,"onUpdate:modelValue":t[5]||=e=>s.value=e,label:`Or paste the private key`,rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`},null,8,[`modelValue`]),V(`div`,dU,[H($,{variant:`primary`,disabled:!p.value,loading:u.value,onClick:g},{default:M(()=>[...t[14]||=[U(` Save certificate `,-1)]]),_:1},8,[`disabled`,`loading`]),d.value?.certPresent?(R(),B(MB,{key:0,label:`Remove certificate`,"confirm-label":`Confirm remove`,"confirm-variant":`danger`,title:`Remove the certificate?`,hint:`TLS stays on but has nothing to serve, so the panel falls back to http once the listener rebinds.`,disabled:u.value,onConfirm:_},null,8,[`disabled`])):W(``,!0)]),l.value||c.value?(R(),z(`div`,fU,[l.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(l.value),1)]),_:1})):W(``,!0),c.value?(R(),B(FB,{key:1,tone:`ok`},{default:M(()=>[U(k(c.value),1)]),_:1})):W(``,!0)])):W(``,!0)]),_:1})],64))}}),mU={class:`min-h-full`},hU={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},gU={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},_U={"aria-label":`Global settings sections`,class:`hidden lg:block`},vU={class:`sticky top-6 space-y-0.5 border-l border-line`},yU=[`aria-current`,`onClick`],bU={class:`space-y-6`},xU={id:`listener`,class:`scroll-mt-5`},SU={id:`authentication`,class:`scroll-mt-5`},CU={id:`host`,class:`scroll-mt-5`},wU={id:`backups`,class:`scroll-mt-5`},TU={id:`tls`,class:`scroll-mt-5`},EU={id:`interface`,class:`scroll-mt-5`},DU={id:`paths`,class:`scroll-mt-5`},OU={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},kU={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},AU={class:`min-w-0 flex-1`},jU={class:`text-xs text-muted`},MU={class:`font-mono tabular-nums text-ink`},NU={key:0,class:`mt-0.5 text-xs text-danger`},PU={key:1,class:`mt-0.5 text-xs text-ok`},FU={class:`flex shrink-0 items-center gap-2`},IU={class:`max-h-[60dvh] overflow-auto px-4 py-3`},LU={key:0,class:`divide-y divide-line-soft`},RU={class:`font-mono text-xs text-ink`},zU={class:`ml-auto font-mono text-xs text-muted line-through`},BU={class:`font-mono text-xs text-accent`},VU={key:1,class:`text-xs text-muted`},HU={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},UU=P({__name:`GlobalSettingsView`,setup(e){let t=[{id:`listener`,title:`Listener`},{id:`authentication`,title:`Authentication`},{id:`host`,title:`Host vitals`},{id:`backups`,title:`Backups`},{id:`tls`,title:`TLS`},{id:`interface`,title:`Interface`},{id:`paths`,title:`Paths`}],n=Rg(),r=Lg(),i=KN(),a=mN(),o=en(eL()),s=A(`listener`),c=A(!1),l=A(null),u=A(null),d=A(null),f=A(null),p=G(()=>i.control.value),m=G(()=>i.host.value?.alerts??[]),h=G(()=>f.value?.host??null),g=G(()=>f.value?.backups??null),_=G(()=>i.backups.value),v=G(()=>f.value?.ui??null),y=G(()=>i.version.value),b=G(()=>i.dataRoot.value),x=G(()=>i.projectDir.value),S=G(()=>b.value===null?null:`${b.value}/settings.json`),C=G(()=>{let e={},t=p.value;if(t!==null){let n=fL(t,o);Object.keys(n).length>0&&(e.control=n)}let n=h.value;if(n!==null){let t=uL(n,o.host);Object.keys(t).length>0&&(e.host=t)}let r=g.value;if(r!==null){let t=dL(r,o.backups);Object.keys(t).length>0&&(e.backups=t)}return e}),w=G(()=>JI(C.value)),T=G(()=>{let e=p.value,t=h.value,n=g.value;return{control:e===null?{}:{...aL(e),auth:iL(e.auth)},host:t??{},backups:n===null?{}:{enabled:n.enabled,keep:n.keep,includePaths:n.includePaths}}}),ee=G(()=>qI(C.value,T.value)),E=A(!1),te=G(()=>p.value!==null&&SL(p.value,o)),ne=G(()=>p.value!==null&&CL(p.value,o)),re=G(()=>p.value!==null&&wL(p.value,o)),ie=G(()=>h.value!==null&&Object.keys(uL(h.value,o.host)).length>0),ae=G(()=>g.value!==null&&Object.keys(dL(g.value,o.backups)).length>0),oe={};function se(){let e=(e,t)=>{xL(oe[e],gL(o,e))||(t(),oe[e]=gL(o,e))},t=p.value;t!==null&&(vL(o,oe.control,`listener`)||(Object.assign(o.control,aL(t)),yL(o,oe,`listener`)),vL(o,oe.control,`auth`)||(Object.assign(o.auth,iL(t.auth)),yL(o,oe,`auth`)),vL(o,oe.control,`tls`)||(o.control.tlsEnabled=t.tls.enabled,yL(o,oe,`tls`)));let n=h.value;n!==null&&e(`host`,()=>Object.assign(o.host,cL(n)));let r=g.value;r!==null&&e(`backups`,()=>Object.assign(o.backups,lL(r)))}function ce(){for(let e of Object.keys(oe))delete oe[e]}function D(e){oe[e]=gL(o,e)}N([p,f],()=>{se()},{immediate:!0});async function le(){d.value=null;try{f.value=await Jj()}catch(e){d.value=e instanceof Error?e.message:String(e)}}ta(()=>{le()});async function ue(){let e=C.value;if(!(Object.keys(e).length===0||c.value)){c.value=!0,l.value=null,u.value=null;try{let t=await i.saveGlobalSettings(e);if(!t){l.value=i.lastError.value??`The settings could not be saved.`;return}u.value=`Settings saved.`,a.success(`Settings saved`),await le(),ce(),se();let n=await EL(t);n===null?t.rebinding&&(u.value=`Settings saved — the panel is moving to a new address.`):(u.value=null,l.value=n)}finally{c.value=!1}}}function de(){l.value=null,u.value=null,ce(),se()}function fe(){h.value!==null&&Object.assign(o.host,cL(h.value)),D(`host`)}function pe(){g.value!==null&&Object.assign(o.backups,lL(g.value)),D(`backups`)}function me(){if(p.value!==null){let e=aL(p.value);o.control.label=e.label,o.control.port=e.port,o.control.host=e.host,o.control.openBrowser=e.openBrowser}yL(o,oe,`listener`)}function he(){p.value!==null&&Object.assign(o.auth,iL(p.value.auth)),yL(o,oe,`auth`)}function ge(){p.value!==null&&(o.control.tlsEnabled=p.value.tls.enabled),yL(o,oe,`tls`)}function _e(e){rr(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function ve(e){s.value=e,n.query.section!==e&&r.replace({query:{...n.query,section:e}}),_e(e)}N(()=>n.query.section,e=>{let n=typeof e==`string`?e:``;t.some(e=>e.id===n)&&(s.value=n,_e(n))},{immediate:!0});let ye=null;return ta(()=>{ye=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(s.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of t){let t=document.getElementById(e.id);t&&ye.observe(t)}}),ia(()=>ye?.disconnect()),(e,n)=>(R(),z(L,null,[V(`div`,mU,[V(`div`,hU,[n[17]||=V(`header`,{class:`mb-5`},[V(`h1`,{class:`text-xl font-semibold tracking-tight text-ink`},` Global settings `),V(`p`,{class:`mt-1 text-xs text-muted`},` Listener, access, host vitals, backups, TLS and paths for this panel — shared by every workspace. `)],-1),d.value?(R(),B(FB,{key:0,tone:`warn`,title:`Some file-only values could not be loaded`,class:`mb-4`},{default:M(()=>[U(k(d.value),1)]),_:1})):W(``,!0),V(`div`,gU,[V(`nav`,_U,[V(`ul`,vU,[(R(),z(L,null,F(t,e=>V(`li`,{key:e.id},[V(`button`,{type:`button`,"aria-current":s.value===e.id?`true`:void 0,class:O(j(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,s.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>ve(e.id)},k(e.title),11,yU)])),64))])]),V(`div`,bU,[V(`section`,xU,[n[10]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Listener `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Where the control panel listens and how it announces itself. `)],-1),H(kH,{control:o.control,"onUpdate:control":n[0]||=e=>o.control=e,view:p.value,dirty:te.value,onReset:me},null,8,[`control`,`view`,`dirty`])]),V(`section`,SU,[n[11]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Authentication `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Who may sign in to this panel, and how a session is trusted. `)],-1),H(RB,{auth:o.auth,"onUpdate:auth":n[1]||=e=>o.auth=e,view:p.value,dirty:re.value,onReset:he},null,8,[`auth`,`view`,`dirty`])]),V(`section`,CU,[n[12]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Host vitals `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Alert thresholds for this machine's own resources. `)],-1),H(lH,{host:o.host,"onUpdate:host":n[2]||=e=>o.host=e,config:h.value,alerts:m.value,dirty:ie.value,onReset:fe},null,8,[`host`,`config`,`alerts`,`dirty`])]),V(`section`,wU,[n[13]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Backups `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` One archive per capture, covering the panel and any workspace you pick. `)],-1),H(oH,{form:o.backups,"onUpdate:form":n[3]||=e=>o.backups=e,state:_.value,policy:g.value,"config-path":S.value,workspaces:j(i).workspaces.value,dirty:ae.value,onReset:pe},null,8,[`form`,`state`,`policy`,`config-path`,`workspaces`,`dirty`])]),V(`section`,TU,[n[14]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` TLS `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Serve the panel over HTTPS with your own certificate. `)],-1),H(pU,{"tls-enabled":o.control.tlsEnabled,"onUpdate:tlsEnabled":n[4]||=e=>o.control.tlsEnabled=e,view:p.value,dirty:ne.value,onReset:ge},null,8,[`tls-enabled`,`view`,`dirty`])]),V(`section`,EU,[n[15]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Interface `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Serve your own panel UI instead of the stock one. `)],-1),H(bH,{label:o.control.label,"onUpdate:label":n[5]||=e=>o.control.label=e,ui:v.value,"panel-version":y.value,"label-dirty":te.value,onChanged:le,onResetLabel:me},null,8,[`label`,`ui`,`panel-version`,`label-dirty`])]),V(`section`,DU,[n[16]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Paths `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Where home-hosted keeps its files, globally and per workspace. `)],-1),H(GH,{"data-root":b.value,"project-dir":x.value,"panel-url":p.value?.url??null,workspaces:j(i).workspaces.value},null,8,[`data-root`,`project-dir`,`panel-url`,`workspaces`])])])])]),V(`div`,OU,[V(`div`,kU,[V(`div`,AU,[V(`p`,jU,[w.value>0?(R(),z(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:n[6]||=e=>E.value=!0},[V(`span`,MU,k(w.value),1),U(` field`+k(w.value===1?``:`s`)+` changed `,1)])):(R(),z(L,{key:1},[U(` No unsaved changes `)],64))]),l.value?(R(),z(`p`,NU,k(l.value),1)):u.value?(R(),z(`p`,PU,k(u.value),1)):W(``,!0)]),V(`div`,FU,[H($,{variant:`ghost`,disabled:w.value===0||c.value,onClick:de},{default:M(()=>[...n[18]||=[U(` Discard changes `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`primary`,disabled:w.value===0,loading:c.value,onClick:ue},{default:M(()=>[...n[19]||=[U(` Save settings `,-1)]]),_:1},8,[`disabled`,`loading`])])])])]),H(ER,{open:E.value,"onUpdate:open":n[9]||=e=>E.value=e,title:`Unsaved changes`,description:`What Save would write to the panel's settings file.`,width:`w-[min(92vw,42rem)]`},{default:M(()=>[V(`div`,IU,[ee.value.length>0?(R(),z(`ul`,LU,[(R(!0),z(L,null,F(ee.value,e=>(R(),z(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[V(`code`,RU,k(e.path),1),V(`span`,zU,k(j(hI)(e.from)),1),n[20]||=V(`span`,{class:`text-2xs text-faint`},`→`,-1),V(`span`,BU,k(j(hI)(e.to)),1)]))),128))])):(R(),z(`p`,VU,` Nothing to save. `))]),V(`footer`,HU,[H($,{size:`sm`,variant:`ghost`,onClick:n[7]||=e=>E.value=!1},{default:M(()=>[...n[21]||=[U(` Close `,-1)]]),_:1}),H($,{size:`sm`,variant:`primary`,disabled:ee.value.length===0||c.value,loading:c.value,onClick:n[8]||=e=>{ue(),E.value=!1}},{default:M(()=>[U(` Save `+k(ee.value.length)+` change`+k(ee.value.length===1?``:`s`),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`])],64))}}),WU={class:`relative flex min-h-dvh items-center justify-center overflow-hidden bg-page px-4 py-10`},GU={class:`hh-enter relative w-full max-w-md`},KU={class:`rounded-panel border border-line bg-panel/95 p-5 shadow-float backdrop-blur-sm`},qU={class:`flex items-start justify-between gap-3`},JU={class:`min-w-0`},YU={class:`text-base font-semibold text-ink`},XU={class:`mt-1 text-xs leading-relaxed text-muted`},ZU={class:`flex flex-col gap-1.5`},QU={class:`relative`},$U=[`type`],eW=[`aria-label`],tW={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`},nW={key:1,class:`mt-5`},rW={class:`mt-4 space-y-2`},iW={key:0,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},aW={class:`text-2xs leading-4 text-warn`},oW={class:`ml-1 rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},sW={key:1,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},cW={key:2,class:`flex items-start gap-2 rounded-control border border-line-soft bg-panel-2 px-2.5 py-2`},lW={class:`text-2xs leading-4 text-muted`},uW={class:`mt-4 flex items-center justify-center gap-2 text-2xs text-faint`},dW={class:`font-mono`},fW=P({__name:`LoginView`,setup(e){let t=Rg(),n=Lg(),r=KN(),{session:i,error:a,login:o,refresh:s}=lN(),c=A(``),l=A(!1),u=A(!1),d=G(()=>i.value?.passwordSet===!1),f=G(()=>i.value!==null&&!i.value.authRequired),p=G(()=>i.value?.usingDefaultPassword===!0&&i.value.defaultPassword!==null),m=G(()=>r.control.value?.auth.exposed===!0),h=G(()=>r.control.value?.url??`—`),g=G(()=>d.value?`This panel has no password yet`:f.value?`Authentication is turned off`:`Sign in to continue`),_=G(()=>d.value?`Anything on this machine can reach it. Set a password right after you are in.`:f.value?`The panel only listens on loopback, which is the only thing protecting it right now.`:`The control panel is protected. Enter the password to continue.`);async function v(){l.value=!0;try{if(await o(c.value)){c.value=``;let e=typeof t.query.next==`string`?t.query.next:`/`;await n.push(e)}}finally{l.value=!1}}async function y(){await s(),await n.push(`/`)}return ta(async()=>{i.value===null&&await s()}),(e,t)=>(R(),z(`div`,WU,[t[11]||=V(`div`,{class:`bg-instrument pointer-events-none absolute inset-0 opacity-60`},null,-1),t[12]||=V(`div`,{class:`pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_15%,var(--page)_78%)]`},null,-1),V(`div`,GU,[t[10]||=Ds(`<div class="mb-6 flex items-center gap-3"><span class="grid size-11 shrink-0 place-items-center rounded-panel border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span><div><p class="text-lg font-semibold tracking-tight text-ink"> home-hosted </p><p class="text-xs text-muted"> Process supervisor control panel </p></div></div>`,1),V(`section`,KU,[V(`div`,qU,[V(`div`,JU,[V(`h1`,YU,k(g.value),1),V(`p`,XU,k(_.value),1)]),m.value?(R(),B(jV,{key:0,tone:`warn`,dot:``},{default:M(()=>[...t[2]||=[U(` Exposed `,-1)]]),_:1})):W(``,!0)]),f.value?(R(),z(`div`,nW,[H($,{variant:`primary`,size:`md`,block:``,onClick:y},{default:M(()=>[...t[4]||=[U(` Open the dashboard `,-1)]]),_:1})])):(R(),z(`form`,{key:0,class:`mt-5 space-y-3`,onSubmit:cu(v,[`prevent`])},[V(`div`,ZU,[V(`label`,{for:`hh-password`,class:O(j(qL))},`Password`,2),V(`div`,QU,[xr(V(`input`,{id:`hh-password`,"onUpdate:modelValue":t[0]||=e=>c.value=e,type:u.value?`text`:`password`,autocomplete:`current-password`,autofocus:``,required:``,class:O(j(Q)(j(YL),`pr-9`))},null,10,$U),[[nu,c.value]]),V(`button`,{type:`button`,class:`absolute right-1 top-1/2 grid size-7 -translate-y-1/2 place-items-center rounded-control text-faint transition-colors duration-150 hover:text-ink`,"aria-label":u.value?`Hide password`:`Show password`,onClick:t[1]||=e=>u.value=!u.value},[u.value?(R(),B(j(Zv),{key:0,class:`size-3.5`})):(R(),B(j(Qv),{key:1,class:`size-3.5`}))],8,eW)])]),j(a)?(R(),z(`p`,tW,k(j(a)),1)):W(``,!0),H($,{type:`submit`,variant:`primary`,size:`md`,block:``,loading:l.value},{default:M(()=>[H(j(sy),{class:`size-3.5`}),t[3]||=U(` Sign in `,-1)]),_:1},8,[`loading`])],32)),V(`div`,rW,[p.value?(R(),z(`div`,iW,[H(j(Ey),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),V(`p`,aW,[t[5]||=U(` Still on the default password `,-1),V(`code`,oW,k(j(i)?.defaultPassword),1),t[6]||=U(`. Change it under Settings — binding beyond 127.0.0.1 stays refused until you do. `,-1)])])):d.value?(R(),z(`div`,sW,[H(j(Oy),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),t[7]||=V(`p`,{class:`text-2xs leading-4 text-warn`},[U(` No password is set. Open Settings from this machine to add one, or run `),V(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`pnpm run auth:set-password`),U(`. `)],-1)])):(R(),z(`div`,cW,[H(j(Dy),{class:`mt-0.5 size-3.5 shrink-0 text-ok`}),V(`p`,lW,` Sessions stay signed in for `+k(Math.round((j(i)?.sessionTtlMs??0)/864e5))+` days after the last visit — each request extends that window. Signing out clears this browser only. `,1)]))])]),V(`p`,uW,[V(`span`,dW,k(h.value),1),t[8]||=V(`span`,{"aria-hidden":`true`},`·`,-1),t[9]||=V(`span`,null,`served from this machine`,-1)])])]))}}),pW=[`#3f4a5c`,`#f07178`,`#7fd88f`,`#e6b673`,`#82aaff`,`#c792ea`,`#7fdbca`,`#c7d2e3`,`#5a6779`,`#ff8b92`,`#9ae6a8`,`#f2c98a`,`#9dbaff`,`#d7aef0`,`#9ce9dc`,`#eef3fb`],mW=[`#4b5563`,`#c0392b`,`#1c7c3f`,`#9a6700`,`#2f5fe0`,`#7c3aed`,`#0b6f89`,`#334155`,`#6b7280`,`#d64535`,`#22854a`,`#a8620d`,`#3f6bff`,`#8b5cf6`,`#0e7d9c`,`#0f1722`],hW=/\u001B\[([0-9;]*)m/g,gW=/\u001B(?:\[[0-9;?]*[A-HJKSTfhilmnprsu]|\][^\u0007\u001B]*(?:\u0007|\u001B\\)?|[()][0-9A-Z])/g;function _W(e){return Math.max(0,Math.min(255,e))}function vW(e){return e===0?0:55+e*40}function yW(e,t){let n=t?pW:mW;if(e<16)return n[e]??n[7];if(e<232){let t=e-16;return`rgb(${vW(Math.floor(t/36))} ${vW(Math.floor(t%36/6))} ${vW(t%6)})`}let r=8+(e-232)*10;return`rgb(${r} ${r} ${r})`}function bW(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function xW(e,t,n){let r=t.length===0?[0]:t.split(`;`).map(e=>e.length===0?0:Number(e));for(let t=0;t<r.length;t+=1){let i=r[t];if(i===0)Object.assign(e,bW());else if(i===1)e.bold=!0;else if(i===2)e.dim=!0;else if(i===3)e.italic=!0;else if(i===4)e.underline=!0;else if(i===22)e.bold=!1,e.dim=!1;else if(i===23)e.italic=!1;else if(i===24)e.underline=!1;else if(i===39)e.fg=null;else if(i===49)e.bg=null;else if(i>=30&&i<=37)e.fg=(n?pW:mW)[i-30]??null;else if(i>=90&&i<=97)e.fg=(n?pW:mW)[i-90+8]??null;else if(i>=40&&i<=47)e.bg=(n?pW:mW)[i-40]??null;else if(i>=100&&i<=107)e.bg=(n?pW:mW)[i-100+8]??null;else if(i===38||i===48){let a=i===38?`fg`:`bg`,o=r[t+1];o===5&&r[t+2]!==void 0?(e[a]=yW(_W(r[t+2]),n),t+=2):o===2&&(e[a]=`rgb(${_W(r[t+2]??0)} ${_W(r[t+3]??0)} ${_W(r[t+4]??0)})`,t+=4)}}}function SW(e,t,n){if(t.length===0)return;let r=e[e.length-1];if(r&&r.fg===n.fg&&r.bg===n.bg&&r.bold===n.bold&&r.dim===n.dim&&r.italic===n.italic&&r.underline===n.underline){r.text+=t;return}e.push({text:t,...n})}function CW(e){return e.includes(`\x1B`)}function wW(e,t=!0){if(!CW(e))return[{text:e,fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}];let n=[],r=bW(),i=0;hW.lastIndex=0;let a=hW.exec(e);for(;a!==null;)SW(n,e.slice(i,a.index).replace(gW,``),r),xW(r,a[1]??``,t),i=a.index+a[0].length,a=hW.exec(e);return SW(n,e.slice(i).replace(gW,``),r),n}var TW={class:`flex h-5 w-max min-w-full items-center gap-2 whitespace-pre px-2 font-mono text-xs leading-5`},EW={key:0,class:`shrink-0 select-none text-faint`},DW={class:`min-w-0`},OW=P({__name:`LogRow`,props:{line:{},query:{},dark:{type:Boolean},showTime:{type:Boolean}},setup(e){let t=e,n=G(()=>wW(t.line.text,t.dark)),r=G(()=>{let e=t.query.trim().toLowerCase(),r=[];for(let t of n.value){if(e.length===0){r.push({text:t.text,hit:!1,span:t});continue}let n=t.text.toLowerCase(),i=0,a=n.indexOf(e);for(;a!==-1;)a>i&&r.push({text:t.text.slice(i,a),hit:!1,span:t}),r.push({text:t.text.slice(a,a+e.length),hit:!0,span:t}),i=a+e.length,a=n.indexOf(e,i);i<t.text.length&&r.push({text:t.text.slice(i),hit:!1,span:t})}return r}),i={stdout:`bg-transparent`,stderr:`bg-danger`,system:`bg-info`};function a(e){let t={};return e.span.fg&&(t.color=e.span.fg),e.span.bg&&(t.backgroundColor=e.span.bg),e.span.bold&&(t.fontWeight=`600`),e.span.dim&&(t.opacity=`0.62`),e.span.italic&&(t.fontStyle=`italic`),e.span.underline&&(t.textDecoration=`underline`),e.hit&&(t.backgroundColor=`var(--warn)`,t.color=`var(--accent-ink)`,t.borderRadius=`2px`),t}return(e,n)=>(R(),z(`div`,TW,[t.showTime?(R(),z(`span`,EW,k(j(uI)(t.line.ts)),1)):W(``,!0),V(`span`,{class:O([`h-3.5 w-0.5 shrink-0 rounded-full`,[i[t.line.stream]]]),"aria-hidden":`true`},null,2),V(`span`,DW,[(R(!0),z(L,null,F(r.value,(e,t)=>(R(),z(`span`,{key:t,style:ge(a(e))},k(e.text),5))),128))])]))}}),kW={class:`flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-panel`},AW={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel-2/60 px-2.5 py-2`},jW={class:`relative min-w-40 flex-1 sm:max-w-72`},MW={class:`absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5`},NW={key:0,class:`px-1 font-mono text-2xs tabular-nums text-faint`},PW={class:`ml-auto flex items-center gap-1.5`},FW=[`href`,`download`],IW={class:`relative min-h-0 flex-1`},LW={key:0,class:`px-3 py-6 text-center text-xs text-faint`},RW={class:`flex items-center gap-3 border-t border-line bg-panel-2/60 px-2.5 py-1.5 text-2xs text-faint`},zW={class:`flex items-center gap-1.5`},BW={class:`font-mono tabular-nums`},VW={key:0,class:`font-mono tabular-nums`},HW=20,UW=12,WW=P({__name:`LogViewer`,props:{lines:{},version:{default:0},live:{type:Boolean,default:!1},emptyHint:{default:`No output yet.`},clearable:{type:Boolean,default:!1},downloadUrl:{default:void 0},downloadName:{default:void 0},minHeight:{default:`16rem`}},emits:[`clear`],setup(e,{emit:t}){let n=e,r=t,i=tP(),a=A(null),o=A(0),s=A(320),c=A(!0),l=A(`all`),u=A(``),d=A(!0),f=A(0),p=G(()=>{n.version;let e=u.value.trim().toLowerCase(),t=l.value;return e.length===0&&t===`all`?n.lines:n.lines.filter(n=>!(t!==`all`&&n.stream!==t||e.length>0&&!n.text.toLowerCase().includes(e)))}),m=G(()=>p.value.length),h=G(()=>{let e=u.value.trim().toLowerCase();if(e.length===0)return[];let t=[],n=p.value;for(let r=0;r<n.length;r+=1)n[r].text.toLowerCase().includes(e)&&t.push(r);return t}),g=G(()=>Math.max(0,Math.floor(o.value/HW)-UW)),_=G(()=>Math.min(m.value,Math.ceil((o.value+s.value)/HW)+UW)),v=G(()=>p.value.slice(g.value,_.value)),y=G(()=>h.value[f.value]??-1);function b(){let e=a.value;if(!e)return;o.value=e.scrollTop;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c.value=t<12}function x(){let e=a.value;e&&(e.scrollTop=e.scrollHeight,o.value=e.scrollTop,c.value=!0)}function S(e){let t=a.value;t&&(t.scrollTop=Math.max(0,e*HW-t.clientHeight/2),o.value=t.scrollTop,c.value=!1)}function C(e){let t=h.value.length;t!==0&&(f.value=(f.value+e+t)%t,S(h.value[f.value]))}N(()=>[n.version,m.value],()=>{c.value&&(f.value=0,requestAnimationFrame(x))}),N(h,()=>{f.value=0,h.value.length>0&&u.value.trim().length>0&&requestAnimationFrame(()=>S(h.value[0]))}),N(l,()=>{c.value=!0,requestAnimationFrame(x)});let w=null;ta(()=>{let e=a.value;e&&(s.value=e.clientHeight,w=new ResizeObserver(()=>{a.value&&(s.value=a.value.clientHeight)}),w.observe(e),x())}),ze(()=>{w?.disconnect(),w=null});let T=[{value:`all`,label:`All`},{value:`stdout`,label:`out`},{value:`stderr`,label:`err`},{value:`system`,label:`sys`}];return(e,t)=>(R(),z(`div`,kW,[V(`header`,AW,[H(CH,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,options:T},null,8,[`modelValue`]),V(`div`,jW,[H(j(Cy),{class:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),xr(V(`input`,{"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`search`,placeholder:`Search this output`,class:O([`h-7 py-0 pl-7 text-xs`,[j(YL)]]),"aria-label":`Search the log output`,onKeydown:t[2]||=uu(cu(e=>C(e.shiftKey?-1:1),[`prevent`]),[`enter`])},null,34),[[ql,u.value]]),V(`div`,MW,[u.value.trim().length>0?(R(),z(`span`,NW,k(h.value.length===0?`0`:`${f.value+1}/${h.value.length}`),1)):W(``,!0),u.value.length>0?(R(),z(`button`,{key:1,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":`Clear the search`,onClick:t[3]||=e=>u.value=``},[H(j(Ry),{class:`size-3`})])):W(``,!0),h.value.length>0?(R(),z(`button`,{key:2,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":`Previous match`,onClick:t[4]||=e=>C(-1)},[H(j(Rv),{class:`size-3`})])):W(``,!0),h.value.length>0?(R(),z(`button`,{key:3,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":`Next match`,onClick:t[5]||=e=>C(1)},[H(j(Fv),{class:`size-3`})])):W(``,!0)])]),V(`div`,PW,[H(cz,{label:d.value?`Hide timestamps`:`Show timestamps`},{default:M(()=>[H($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>d.value=!d.value},{default:M(()=>[H(j(Uv),{class:O(j(Q)(`size-3`,d.value?`fill-accent text-accent`:`text-faint`))},null,8,[`class`]),t[9]||=U(` ts `,-1)]),_:1})]),_:1},8,[`label`]),H($,{size:`xs`,variant:c.value?`secondary`:`primary`,onClick:t[7]||=e=>c.value?c.value=!1:x()},{default:M(()=>[(R(),B(ma(c.value?j(my):j(gy)),{class:`size-3`})),U(` `+k(c.value?`Pause`:`Follow`),1)]),_:1},8,[`variant`]),n.clearable?(R(),B(cz,{key:0,label:`Clear the in-memory buffer`},{default:M(()=>[H($,{size:`icon-sm`,variant:`ghost`,"aria-label":`Clear the log buffer`,onClick:t[8]||=e=>r(`clear`)},{default:M(()=>[H(j(Fy),{class:`size-3.5`})]),_:1})]),_:1})):W(``,!0),n.downloadUrl?(R(),B(cz,{key:1,label:`Download the persisted file`},{default:M(()=>[V(`a`,{href:n.downloadUrl,download:n.downloadName},[H($,{size:`icon-sm`,variant:`ghost`,"aria-label":`Download the log file`},{default:M(()=>[H(j(Mv),{class:`size-3.5`})]),_:1})],8,FW)]),_:1})):W(``,!0)])]),V(`div`,IW,[V(`div`,{ref_key:`scroller`,ref:a,class:`h-full overflow-auto overscroll-contain bg-page/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`,style:ge({minHeight:n.minHeight}),tabindex:`0`,role:`log`,"aria-label":`Log output`,onScrollPassive:b},[m.value===0?(R(),z(`p`,LW,k(n.lines.length===0?n.emptyHint:`Nothing matches that search or stream filter.`),1)):(R(),z(`div`,{key:1,class:`relative w-full`,style:ge({height:`${m.value*HW}px`})},[(R(!0),z(L,null,F(v.value,(e,t)=>(R(),z(`div`,{key:g.value+t,class:O([`absolute left-0 top-0`,g.value+t===y.value&&`bg-warn/10`]),style:ge({transform:`translateY(${(g.value+t)*HW}px)`})},[H(OW,{line:e,query:u.value,dark:j(i).isDark.value,"show-time":d.value},null,8,[`line`,`query`,`dark`,`show-time`])],6))),128))],4))],36),H(Ec,{"enter-active-class":`transition duration-150`,"leave-active-class":`transition duration-100`,"enter-from-class":`opacity-0 translate-y-1`,"leave-to-class":`opacity-0 translate-y-1`},{default:M(()=>[!c.value&&m.value>0?(R(),z(`button`,{key:0,type:`button`,class:`absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-line bg-raise px-2.5 py-1 text-2xs text-muted shadow-float transition-colors duration-150 hover:text-ink`,onClick:x},[H(j(Mv),{class:`size-3`}),t[10]||=U(` Jump to latest `,-1)])):W(``,!0)]),_:1})]),V(`footer`,RW,[V(`span`,zW,[V(`span`,{class:O(j(Q)(`size-1.5 rounded-full`,n.live?c.value?`bg-ok`:`bg-warn`:`bg-faint`))},null,2),U(` `+k(n.live?c.value?`streaming`:`paused`:`snapshot`),1)]),V(`span`,BW,k(m.value===n.lines.length?`${m.value} lines`:`${m.value} of ${n.lines.length} lines`),1),u.value.trim().length>0?(R(),z(`span`,VW,k(h.value.length)+` matches`,1)):W(``,!0),V(`span`,{class:`ml-auto hidden font-mono tabular-nums sm:inline`},`row height `+k(HW)+`px · windowed`)])]))}}),GW={class:`flex h-full min-h-0`},KW={class:`hidden w-64 shrink-0 flex-col border-r border-line bg-panel/40 md:flex`},qW={class:`border-b border-line px-3 py-2.5`},JW={class:`mt-0.5 text-2xs text-faint`},YW={class:`min-h-0 flex-1 overflow-y-auto p-1.5`},XW={key:0,class:`space-y-1.5 p-1.5`},ZW=[`onClick`],QW={class:`min-w-0 flex-1`},$W={class:`block truncate font-mono text-2xs text-faint`},eG={class:`flex min-w-0 flex-1 flex-col`},tG={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel/40 px-3 py-2.5`},nG={class:`min-w-0`},rG={class:`truncate text-sm font-semibold text-ink`},iG={key:0,class:`ml-1.5 font-mono text-2xs font-normal text-faint`},aG={key:0,class:`flex flex-wrap items-center gap-1.5 border-b border-line-soft bg-panel-2/40 px-3 py-2`},oG=[`href`,`download`],sG={class:`text-faint`},cG={key:1,class:`text-2xs text-faint`},lG={key:2,class:`ml-auto font-mono text-2xs text-faint`},uG={key:3,class:`font-mono text-2xs text-faint`},dG={key:1,class:`flex items-center gap-1.5 border-b border-danger/25 bg-danger-soft px-3 py-2 text-2xs text-danger`},fG={class:`min-h-0 flex-1 p-3`},pG=P({__name:`LogsView`,setup(e){let t=Rg(),n=Lg(),r=sP(),i=A([]),a=A(null),o=A(`disk`),s=A(`2000`),c=A(``),l=A(``),u=A(null),d=A(!1),f=A(null),p=A([]),m=A(0),h=A(!1),g=A(!0),_=G(()=>i.value.find(e=>e.serverId===a.value)??null),v=GN(r.activeId,()=>o.value===`live`?a.value:null),y=v.version,b=G(()=>(y.value,v.lines())),x=G(()=>o.value===`live`?b.value:p.value),S=G(()=>o.value===`live`?y.value:m.value),C=[{value:`200`,label:`200 lines`},{value:`500`,label:`500 lines`},{value:`2000`,label:`2000 lines`},{value:`5000`,label:`5000 lines`}],w=[{value:``,label:`All streams`},{value:`stdout`,label:`stdout`},{value:`stderr`,label:`stderr`},{value:`system`,label:`system`}],T=G(()=>i.value.reduce((e,t)=>e+t.sizeBytes,0)),ee=G(()=>i.value.filter(e=>e.files.length>0).length);async function E(){g.value=!0;try{i.value=await FM(r.activeId.value);let e=typeof t.query.server==`string`?t.query.server:null,n=e&&i.value.some(t=>t.serverId===e)?e:a.value&&i.value.some(e=>e.serverId===a.value)?a.value:i.value[0]?.serverId??null;a.value=n}catch(e){f.value=e instanceof Error?e.message:String(e)}finally{g.value=!1}}let te=0;async function ne(){let e=a.value;if(e===null||o.value===`live`)return;let t=++te;d.value=!0,f.value=null;try{let n=await IM(r.activeId.value,e,{tail:Number(s.value),...c.value.length>0?{stream:c.value}:{},...l.value.trim().length>0?{search:l.value.trim()}:{}});if(t!==te)return;p.value=n.lines,u.value=n.searched??null,m.value+=1}catch(e){if(t!==te)return;f.value=e instanceof Error?e.message:String(e)}finally{t===te&&(d.value=!1)}}async function re(){let e=a.value;if(e!==null){h.value=!1;try{await LM(r.activeId.value,e),p.value=[],m.value+=1,await E()}catch(e){f.value=e instanceof Error?e.message:String(e)}}}function ie(e){a.value=e,o.value===`live`&&(p.value=[]),n.replace({query:{...t.query,server:e}})}N([a,s,c,o],()=>{o.value===`disk`?ne():u.value=null},{immediate:!1});let ae=null;return N(l,()=>{ae!==null&&clearTimeout(ae),ae=setTimeout(()=>{ae=null,o.value===`disk`&&ne()},300)}),ze(()=>{ae!==null&&clearTimeout(ae)}),N(()=>r.activeId.value,()=>{a.value=null,p.value=[],o.value=`disk`,E().then(()=>ne())}),ta(async()=>{await E(),o.value===`disk`&&await ne()}),(e,t)=>(R(),z(`div`,GW,[V(`aside`,KW,[V(`div`,qW,[t[7]||=V(`p`,{class:`text-xs font-semibold text-ink`},` Persisted logs `,-1),V(`p`,JW,k(j(r).selected.value?.label??`Workspace`)+` · `+k(ee.value)+` of `+k(i.value.length)+` servers on disk · `+k(j(fI)(T.value)),1)]),V(`div`,YW,[g.value?(R(),z(`div`,XW,[(R(),z(L,null,F(5,e=>H(qz,{key:e,class:`h-10 w-full`,rounded:`rounded-control`})),64))])):(R(!0),z(L,{key:1},F(i.value,e=>(R(),z(`button`,{key:e.serverId,type:`button`,class:O(j(Q)(`flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors duration-150`,e.serverId===a.value?`bg-accent-soft`:`hover:bg-hover`)),onClick:t=>ie(e.serverId)},[V(`span`,{class:O(j(Q)(`size-1.5 shrink-0 rounded-full`,j(BF)[j(IF)[e.status].tone]))},null,2),V(`span`,QW,[V(`span`,{class:O(j(Q)(`block truncate text-xs`,e.serverId===a.value?`font-medium text-accent`:`text-ink`))},k(e.label),3),V(`span`,$W,k(e.files.length>0?`${e.files.length} file${e.files.length===1?``:`s`} · ${j(fI)(e.sizeBytes)}`:`nothing persisted`),1)])],10,ZW))),128)),!g.value&&i.value.length===0?(R(),B(aI,{key:2,compact:``,title:`No servers`,description:`Add one and its output will be persisted here.`})):W(``,!0)]),t[8]||=V(`div`,{class:`border-t border-line p-2.5`},[V(`p`,{class:`text-2xs leading-4 text-faint`},` Rotation and retention are set under Workspace settings → Logs. `)],-1)]),V(`div`,eG,[V(`header`,tG,[V(`div`,nG,[V(`h1`,rG,[U(k(_.value?.label??`Logs`)+` `,1),_.value?(R(),z(`span`,iG,k(_.value.serverId),1)):W(``,!0)])]),H(CH,{modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:`ml-auto`,options:[{value:`disk`,label:`Persisted`},{value:`live`,label:`Live stream`}]},null,8,[`modelValue`]),o.value===`disk`?(R(),B(oR,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,options:C,class:`w-32`,"aria-label":`Tail size`},null,8,[`modelValue`])):W(``,!0),o.value===`disk`?(R(),B(oR,{key:1,modelValue:c.value,"onUpdate:modelValue":t[2]||=e=>c.value=e,options:w,class:`w-32`,"aria-label":`Stream`},null,8,[`modelValue`])):W(``,!0),o.value===`disk`?xr((R(),z(`input`,{key:2,"onUpdate:modelValue":t[3]||=e=>l.value=e,type:`search`,class:`w-44 min-w-0 rounded-control border border-line bg-panel px-2.5 py-1.5 text-xs text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50`,"aria-label":`Search the log`,placeholder:`search the tail window`},null,512)),[[ql,l.value]]):W(``,!0),o.value===`disk`?(R(),B($,{key:3,size:`sm`,loading:d.value,onClick:ne},{default:M(()=>[H(j(yy),{class:`size-3.5`}),t[9]||=U(`Reload `,-1)]),_:1},8,[`loading`])):W(``,!0),o.value===`disk`?(R(),B($,{key:4,size:`sm`,variant:`ghost`,disabled:!_.value||_.value.files.length===0,onClick:t[4]||=e=>h.value=!0},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),t[10]||=U(`Clear file `,-1)]),_:1},8,[`disabled`])):W(``,!0)]),_.value?(R(),z(`div`,aG,[H(j($v),{class:`size-3.5 shrink-0 text-faint`}),_.value.files.length>0?(R(!0),z(L,{key:0},F(_.value.files,e=>(R(),z(`a`,{key:e.name,href:RM(j(r).activeId.value,_.value.serverId,e.name),download:e.name,class:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},[U(k(e.name)+` `,1),V(`span`,sG,k(j(fI)(e.sizeBytes)),1),H(j(Mv),{class:`size-3`})],8,oG))),128)):(R(),z(`span`,cG,` Nothing on disk for this server — persistence is off, or it has not written anything yet. `)),o.value===`disk`&&p.value.length>0?(R(),z(`span`,lG,` loaded `+k(p.value.length)+` lines `,1)):W(``,!0),u.value===null?W(``,!0):(R(),z(`span`,uG,` · searched `+k(u.value)+` lines `,1))])):W(``,!0),f.value?(R(),z(`p`,dG,[H(j(Bv),{class:`size-3.5`}),U(` `+k(f.value),1)])):W(``,!0),V(`div`,fG,[_.value?d.value&&x.value.length===0?(R(),B(qz,{key:1,class:`h-full w-full`,rounded:`rounded-panel`})):(R(),B(WW,{key:2,lines:x.value,version:S.value,live:o.value===`live`,class:`h-full`,"empty-hint":o.value===`live`?`Connected — waiting for output.`:`The persisted file is empty.`,"min-height":`100%`},null,8,[`lines`,`version`,`live`,`empty-hint`])):(R(),B(aI,{key:0,title:`Pick a server`,description:`Persisted output and live streams are per server. Choose one from the list.`},{icon:M(()=>[H(j(Sy),{class:`size-4`})]),_:1}))])]),H(ER,{open:h.value,"onUpdate:open":t[6]||=e=>h.value=e,title:`Clear the persisted log file?`,description:`${_.value?.serverId??``} — the file on disk is truncated. The process keeps running and new lines are written from here on.`,width:`w-[min(92vw,26rem)]`},{footer:M(()=>[H($,{variant:`ghost`,onClick:t[5]||=e=>h.value=!1},{default:M(()=>[...t[11]||=[U(` Keep it `,-1)]]),_:1}),H($,{variant:`danger`,onClick:re},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),t[12]||=U(`Clear `,-1)]),_:1})]),default:M(()=>[t[13]||=V(`p`,{class:`text-xs text-muted`},` Download it first if the output is still needed — this cannot be undone from the panel. `,-1)]),_:1},8,[`open`,`description`])]))}}),mG={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},hG={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},gG={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},_G={class:`p-4`},vG={class:`p-4`},yG={class:`p-4`},bG={class:`p-4`},xG={class:`p-4`},SG={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},CG={class:`min-w-0`},wG={class:`text-xs font-medium text-danger`},TG={class:`mt-0.5 flex flex-wrap gap-x-2 text-2xs text-danger`},EG={class:`space-y-3`},DG={class:`flex items-center justify-between`},OG={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},kG={key:0,class:`grid gap-4 lg:grid-cols-2`},AG={key:2,class:`grid gap-4 lg:grid-cols-2`},jG={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},MG={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},NG={class:`flex items-center gap-1`},PG={class:`font-mono`},FG=P({__name:`OverviewView`,setup(e){let t=KN(),n=sP(),r=A(!1),i=G(()=>t.appState.value===null),a=n.servers,o=G(()=>n.selected.value?.label??`Workspace`),s=G(()=>a.value.filter(e=>e.status===`running`)),c=G(()=>a.value.filter(e=>[`stopped`,`stopping`].includes(e.status))),l=G(()=>a.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),u=G(()=>{let e=0;for(let t of s.value){let n=t.resources?.rssBytes;typeof n==`number`&&(e+=n)}return e}),d=G(()=>{let e=0;for(let t of a.value){let r=yN(n.seriesOf(t.id).rss);r>e&&(e=r)}return e}),f=G(()=>{let e=0;for(let t of s.value)e+=t.resources?.cpuPercent??0;return e}),p=G(()=>{let e=a.value.map(e=>e.startedAt).filter(e=>typeof e==`number`);return e.length===0?`—`:sI(t.now.value-Math.min(...e))});return(e,m)=>{let h=fa(`RouterLink`);return R(),z(`div`,mG,[H(Hz,{title:o.value,description:`Live state of every server in this workspace, refreshed over a single event stream.`},{actions:M(()=>[H($,{variant:`ghost`,onClick:m[0]||=e=>j(n).startAll()},{default:M(()=>[H(j(gy),{class:`size-3.5`}),m[5]||=U(`Start all `,-1)]),_:1}),H($,{variant:`ghost`,onClick:m[1]||=e=>j(n).stopAll()},{default:M(()=>[H(j(Ay),{class:`size-3.5`}),m[6]||=U(`Stop all `,-1)]),_:1}),H($,{variant:`primary`,onClick:m[2]||=e=>r.value=!0},{default:M(()=>[H(j(_y),{class:`size-3.5`}),m[7]||=U(`Add server `,-1)]),_:1})]),_:1},8,[`title`]),H(Kz,{class:`p-0`},{default:M(()=>[i.value?(R(),z(`div`,hG,[(R(),z(L,null,F(5,e=>V(`div`,{key:e,class:`space-y-2`},[H(qz,{class:`h-2.5 w-16`}),H(qz,{class:`h-6 w-20`})])),64))])):(R(),z(`div`,gG,[V(`div`,_G,[H(Zz,{label:`Running`,value:`${s.value.length}/${j(a).length}`,tone:`ok`,hint:`${j(a).length-s.value.length} not up`},null,8,[`value`,`hint`])]),V(`div`,vG,[H(Zz,{label:`Stopped`,value:String(c.value.length),hint:`${j(a).filter(e=>e.config.enabled).length} enabled`},null,8,[`value`,`hint`])]),V(`div`,yG,[H(Zz,{label:`Needs attention`,value:String(l.value.length),tone:l.value.length>0?`danger`:`ok`,hint:l.value.length===0?`nothing is broken`:`crashed or unhealthy`},null,8,[`value`,`tone`,`hint`])]),V(`div`,bG,[H(Zz,{label:`Process memory`,value:j(pI)(u.value),hint:d.value>0?`peak ${j(pI)(d.value)}`:`across the tree`},null,8,[`value`,`hint`])]),V(`div`,xG,[H(Zz,{label:`Longest uptime`,value:p.value,hint:s.value.length>0?`${f.value.toFixed(1)}% cpu now`:`nothing running`},null,8,[`value`,`hint`])])]))]),_:1}),l.value.length>0?(R(),z(`div`,SG,[H(j(Bv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),V(`div`,CG,[V(`p`,wG,k(l.value.length)+` server`+k(l.value.length===1?``:`s`)+` need a look `,1),V(`p`,TG,[(R(!0),z(L,null,F(l.value,e=>(R(),B(h,{key:e.id,to:`/servers/${e.id}`,class:`font-mono underline-offset-2 hover:underline`},{default:M(()=>[U(k(e.id),1)]),_:2},1032,[`to`]))),128))])])])):W(``,!0),V(`section`,EG,[V(`div`,DG,[V(`h2`,OG,[H(j(wy),{class:`size-3.5 text-faint`}),m[8]||=U(` Servers `,-1)]),H(h,{to:j(XX)(j(n).activeId.value,`servers`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:M(()=>[...m[9]||=[U(` Open the full list `,-1)]]),_:1},8,[`to`])]),i.value?(R(),z(`div`,kG,[(R(),z(L,null,F(4,e=>H(qz,{key:e,class:`h-64 w-full`,rounded:`rounded-panel`})),64))])):j(a).length===0?(R(),B(aI,{key:1,title:`No servers in this workspace`,description:`Add the first process this workspace should keep alive.`},{icon:M(()=>[H(j(wy),{class:`size-4`})]),action:M(()=>[H($,{variant:`primary`,onClick:m[3]||=e=>r.value=!0},{default:M(()=>[H(j(_y),{class:`size-3.5`}),m[10]||=U(`Add a server `,-1)]),_:1})]),_:1})):(R(),z(`div`,AG,[(R(!0),z(L,null,F(j(a),e=>(R(),B(Fz,{key:e.id,server:e,"workspace-id":j(n).activeId.value,series:j(n).seriesOf(e.id),now:j(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]),H(Kz,null,{header:M(()=>[V(`h2`,jG,[H(j(Av),{class:`size-3.5 text-faint`}),m[11]||=U(` Recent activity `,-1)])]),actions:M(()=>[H(h,{to:j(XX)(j(n).activeId.value,`logs`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:M(()=>[...m[12]||=[U(` Logs `,-1)]]),_:1},8,[`to`])]),default:M(()=>[H(BI,{servers:j(a),now:j(t).now.value,limit:10},null,8,[`servers`,`now`])]),_:1}),V(`p`,MG,[V(`span`,NG,[H(j(Py),{class:`size-3`}),m[13]||=U(`resource history is sampled every 5 s and kept for this session`,-1)]),V(`span`,PG,k(j(n).selected.value?.configPath),1),V(`span`,{class:O(j(Q)(`flex items-center gap-1`))},[m[14]||=V(`span`,{class:`size-1.5 rounded-full bg-ok`},null,-1),U(` workspace `+k(j(n).activeId.value),1)],2)]),H(PR,{open:r.value,"onUpdate:open":m[4]||=e=>r.value=e,"workspace-id":j(n).activeId.value},null,8,[`open`,`workspace-id`])])}}}),IG=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i,LG=/^(?:[a-z][a-z0-9+.-]*:\/\/)?(?<authority>[^/?#]+)/i,RG=[`.localhost`,`.local`,`.internal`,`.home.arpa`,`.lan`,`.home`,`.test`,`.invalid`,`.example`],zG=/^[a-z0-9][a-z0-9_-]*$/,BG=4443,VG=4480;function HG(e){return e.label.trim().length>0?e.label:e.id}var UG=0;function WG(e){return e.find(e=>e.tls!==`off`&&qG(e.host))?.host??null}function GG(e){if(e===null||e<0)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function KG(e){return e>0&&e<1024}function qG(e){let t=e.trim().toLowerCase();return t.length===0||t===`localhost`||!t.includes(`.`)||RG.some(e=>t.endsWith(e))?!1:!/^\d{1,3}(?:\.\d{1,3}){3,}$/.test(t)}function JG(e,t){let n={};e.enabled!==t.enabled&&(n.enabled=t.enabled),e.httpPort!==t.httpPort&&(n.httpPort=t.httpPort),e.httpsPort!==t.httpsPort&&(n.httpsPort=t.httpsPort),e.email!==t.email&&(n.email=t.email),e.staging!==t.staging&&(n.staging=t.staging);let r=ZG(t.resolvers);return(e.dns01.enabled!==t.dns01||e.dns01.resolvers.join(`,`)!==r.join(`,`))&&(n.dns01={enabled:t.dns01,resolvers:r}),n}function YG(){return{key:XG(),id:`route`,host:``,enabled:!0,target:`server`,workspace:``,server:``,url:``,path:``,tls:`auto`,dnsAccount:``}}function XG(){return UG+=1,`proxy-route-${UG}`}function ZG(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(e=>e.length>0)}function QG(e,t,n){let r=JG(e,t),i=rK(e.routes,n);return i!==null&&(r.routes=i),Object.keys(r).length===0?null:r}function $G(e,t){return e.staging||e.email.trim().length>0?!1:t.some(e=>e.tls!==`off`&&qG(e.host))}function eK(e){if(e===null)return`~8 hours`;if(e<60)return`~${e} minute${e===1?``:`s`}`;let t=Math.max(1,Math.round(e/60));return`~${t} hour${t===1?``:`s`}`}function tK(e,t,n){let r=e.host.trim();if(r.length===0)return null;let i=e.tls===`off`,a=i?t:n,o=i?80:443,s=e.path.length===0||e.path.startsWith(`/`)?e.path:`/${e.path}`;return`${i?`http`:`https`}://${r}${a===o?``:`:${a}`}${s}`}function nK(e,t){return e.length===t.length&&e.every((e,n)=>iK(e,t[n]))}function rK(e,t){return nK(e,t)?null:lK(t)}function iK(e,t){return JSON.stringify(uK(e))===JSON.stringify(uK(t))}function aK(e){return oK(e,`certificate`)}function oK(e,t){let n=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40).replace(/-+$/,``);return n.length===0?t:/^[a-z0-9]/.test(n)?n:`r-${n}`}function sK(e){return oK(e,`route`)}function cK(e,t){return e.target===`panel`?`control panel`:e.target===`external`?e.url.trim().length>0?e.url.trim():`no upstream`:e.workspace.length===0||e.server.length===0?`no server picked`:`${t.find(t=>t.id===e.workspace)?.label??e.workspace} / ${e.server}`}function lK(e){return e.map(uK)}function uK(e){return{id:e.id,host:e.host,enabled:e.enabled,target:e.target,workspace:e.workspace,server:e.server,url:e.url,path:e.path,tls:e.tls,dnsAccount:e.dnsAccount}}function dK(e,t){return fK(e,t)}function fK(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}-${r}`);)r+=1;return`${e}-${r}`}function pK(e,t){return fK(e,t)}function mK(e){return e.httpPort===4480&&e.httpsPort===4443}function hK(e,t){let n={},r=e.host.trim();if(r.length===0?n.host=`a hostname is required`:IG.test(r)?t.others.some(t=>t.host.trim().toLowerCase()===r.toLowerCase()&&t.path.replace(/\/+$/,``)===e.path.replace(/\/+$/,``))&&(n.host=`"${r}" is already routed for this path`):n.host=`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,e.path.length>0&&!e.path.startsWith(`/`)?n.path=`a path prefix starts with /`:/\s/.test(e.path)&&(n.path=`a path prefix cannot contain a space`),zG.test(e.id)?t.others.some(t=>t.id===e.id)&&(n.id=`route id "${e.id}" is used twice`):n.id=`the id must start with a letter or digit, then letters, digits, dash or underscore`,e.target===`server`){let r=t.workspaces.find(t=>t.id===e.workspace);e.workspace.length===0||r===void 0?n.workspace=`pick the workspace that owns the server`:(e.server.length===0||!r.servers.some(t=>t.id===e.server))&&(n.server=`pick a server in that workspace`)}e.target===`external`&&gK(e.url)===null&&(n.url=`an upstream like http://10.0.0.5:8080`);let i=JA({...uK(e),host:r});return i instanceof Y.errors&&Object.keys(n).length===0&&(n.form=i.summary),n}function gK(e){let t=e.trim();if(t.length===0)return null;let n=LG.exec(t)?.groups?.authority;if(n===void 0||n.length===0||n.endsWith(`:`)||/\s/.test(n))return null;let r=t.slice(0,t.indexOf(`:`)).toLowerCase(),i=n.lastIndexOf(`:`);if(i<=0)return{host:n,port:r===`https`?`443`:`80`};let a=n.slice(i+1);return/^\d{1,5}$/.test(a)?{host:n.slice(0,i),port:a}:null}var _K=[{value:`server`,label:`A supervised server`},{value:`panel`,label:`This control panel`},{value:`external`,label:`A literal upstream`}],vK=[{value:`auto`,label:`Automatic — the engine decides`},{value:`off`,label:`Off — plain HTTP`},{value:`manual`,label:`Uploaded certificate`}],yK={off:{label:`Off`,tone:`neutral`,transitional:!1},stopped:{label:`Stopped`,tone:`neutral`,transitional:!1},starting:{label:`Starting`,tone:`warn`,transitional:!0},running:{label:`Running`,tone:`ok`,transitional:!1},error:{label:`Error`,tone:`danger`,transitional:!1},unsupported:{label:`Unsupported`,tone:`warn`,transitional:!1}},bK={ok:{label:`Serving`,tone:`ok`},disabled:{label:`Disabled`,tone:`neutral`},"no-upstream":{label:`No upstream`,tone:`warn`},error:{label:`Error`,tone:`danger`}},xK={off:null,local:{label:`engine CA`,tone:`neutral`},uploaded:{label:`uploaded pair`,tone:`info`},issued:{label:`certificate ready`,tone:`ok`},pending:{label:`waiting for the CA`,tone:`warn`},failed:{label:`certificate failed`,tone:`danger`},fallback:{label:`Fell back to Local CA`,tone:`warn`}};function SK(e){let t=e.certificate;if(t===void 0)return null;let n=xK[t.state]??null;return n===null?null:{...n,message:t.message,retryInMinutes:t.retryInMinutes??null}}function CK(e){return{enabled:e.enabled,httpPort:e.httpPort,httpsPort:e.httpsPort,email:e.email,staging:e.staging,dns01:e.dns01.enabled,resolvers:e.dns01.resolvers.join(`, `)}}function wK(e){let t=[{value:``,label:`Automatic (the only account that can answer)`}];for(let n of e){let e=n.label.length>0?n.label:n.account,r=[n.writesTxt?null:`no TXT support`,n.writesTxt&&!n.hasCredentials?`no credentials`:null].filter(e=>e!==null);t.push({value:`${n.workspace}/${n.account}`,label:`${e} · ${n.provider} · ${n.workspace}${r.length>0?` (${r.join(`, `)})`:``}`})}return t}function TK(e){return{...CK(e)}}function EK(e){return structuredClone(un(e)).map(e=>({...e,key:XG()}))}function DK(e,t,n){return t===null?[...e,n]:e.map(e=>e.id===t.id?n:e)}function OK(e){return e.tls===`off`?`plain HTTP`:e.tls===`manual`?`uploaded certificate`:qG(e.host)?`Let’s Encrypt`:`engine CA (local)`}var kK={class:`grid gap-3 sm:grid-cols-2`},AK={class:`grid gap-3 sm:grid-cols-2`},jK={class:`flex min-w-0 flex-col gap-1`},MK={class:`flex min-w-0 flex-col gap-1`},NK=P({__name:`CertificateDialog`,props:Ra({taken:{},busy:{type:Boolean},error:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Ra([`submit`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`open`),a=A(``),o=A(``),s=A(``),c=A(``),l=A({}),u=A(!1),d=Q(YL,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`),f=G(()=>dK(aK(a.value),n.taken)),p=G(()=>!n.busy&&a.value.trim().length>0&&s.value.trim().length>0&&c.value.trim().length>0);function m(e){o.value=e,u.value=e.trim().length>0}N([a,()=>n.taken],()=>{u.value||(o.value=f.value)},{immediate:!0}),N(i,e=>{e&&(a.value=``,o.value=``,s.value=``,c.value=``,l.value={},u.value=!1)});async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?s.value=r:c.value=r}function g(){let e=a.value.trim(),t=o.value.trim(),i={};e.length===0&&(i.label=`a label is required`),zG.test(t)?n.taken.includes(t)&&(i.id=`"${t}" is already used by another certificate`):i.id=`the id must start with a letter or digit, then letters, digits, dash or underscore`,s.value.trim().length===0&&(i.certificate=`paste or choose the certificate`),c.value.trim().length===0&&(i.privateKey=`paste or choose the private key`),l.value=i,!(Object.keys(i).length>0)&&r(`submit`,{id:t,label:e,certificate:s.value,privateKey:c.value})}return(e,t)=>(R(),B(ER,{open:i.value,"onUpdate:open":t[6]||=e=>i.value=e,title:`Add a certificate`,description:`The pair is stored on disk under its id, and a route set to “Uploaded certificate” can serve it.`},{footer:M(()=>[H($,{variant:`ghost`,disabled:n.busy,onClick:t[5]||=e=>i.value=!1},{default:M(()=>[...t[7]||=[U(` Cancel `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`primary`,disabled:!p.value,loading:n.busy,onClick:g},{default:M(()=>[...t[8]||=[U(` Store the certificate `,-1)]]),_:1},8,[`disabled`,`loading`])]),default:M(()=>[V(`form`,{class:`space-y-3`,onSubmit:cu(g,[`prevent`])},[V(`div`,kK,[H(dR,{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Label`,placeholder:`Home wildcard`,error:l.value.label},null,8,[`modelValue`,`error`]),H(dR,{"model-value":o.value,label:`Id`,hint:`names the files on disk`,error:l.value.id,"onUpdate:modelValue":m},null,8,[`model-value`,`error`])]),V(`div`,AK,[V(`div`,jK,[V(`label`,{class:O(j(qL)),for:`proxy-cert-file`},`Certificate file (.pem, .crt)`,2),V(`input`,{id:`proxy-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:O(j(d)),onChange:t[1]||=e=>h(e,`cert`)},null,34)]),V(`div`,MK,[V(`label`,{class:O(j(qL)),for:`proxy-cert-key`},`Private key file (.pem, .key)`,2),V(`input`,{id:`proxy-cert-key`,type:`file`,accept:`.pem,.key,text/plain`,class:O(j(d)),onChange:t[2]||=e=>h(e,`key`)},null,34)])]),H(AR,{modelValue:s.value,"onUpdate:modelValue":t[3]||=e=>s.value=e,label:`Or paste the certificate`,rows:4,placeholder:`-----BEGIN CERTIFICATE-----`,error:l.value.certificate},null,8,[`modelValue`,`error`]),H(AR,{modelValue:c.value,"onUpdate:modelValue":t[4]||=e=>c.value=e,label:`Or paste the private key`,rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`,error:l.value.privateKey},null,8,[`modelValue`,`error`]),n.error?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(n.error),1)]),_:1})):W(``,!0)],32)]),_:1},8,[`open`]))}}),PK={key:0,class:`sm:col-span-2`},FK={key:1,class:`space-y-2 sm:col-span-2`},IK={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},LK={class:`min-w-0 text-xs font-medium text-ink`},RK={class:`ml-1.5 font-mono text-2xs text-faint`},zK={key:0,class:`mt-2`},BK={key:1,class:`mt-2 divide-y divide-line-soft text-2xs`},VK={class:`flex items-start justify-between gap-4 py-1`},HK={class:`min-w-0 text-right font-mono text-ink`},UK={class:`flex items-start justify-between gap-4 py-1`},WK={class:`min-w-0 text-right font-mono text-ink`},GK={class:`flex items-start justify-between gap-4 py-1`},KK={class:`font-mono text-ink`},qK={class:`flex items-start justify-between gap-4 py-1`},JK={class:`min-w-0 text-right font-mono text-ink`},YK={key:1,class:`text-faint`},XK={class:`mt-2 flex justify-end`},ZK={class:`text-xs font-semibold text-ink`},QK={class:`mt-2.5 flex justify-end gap-1.5`},$K={key:2,class:`space-y-2 sm:col-span-2`},eq=P({__name:`CertificatePanel`,props:{certificates:{},disabled:{type:Boolean}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,i=A(!1),a=A(!1),o=A(null),s=A(null),c=A(null),l=G(()=>n.certificates.map(e=>e.id));async function u(e,t){a.value=!0,o.value=null,s.value=null;try{return r(`changed`,await e()),s.value=t,!0}catch(e){return o.value=e instanceof Error?e.message:String(e),!1}finally{a.value=!1}}async function d(e){await u(()=>sM(e.id,e.label,e.certificate,e.privateKey),`“${e.label}” stored.`)&&(i.value=!1)}function f(e){c.value=null,u(()=>Wj(e.id),`“${HG(e)}” removed.`)}return(e,t)=>(R(),B(UL,{title:`Uploaded certificates`,description:`Served by routes set to “Uploaded certificate”. Everything else — public or local — is certified by the engine on its own.`},{actions:M(()=>[H($,{size:`xs`,variant:`secondary`,disabled:n.disabled||a.value,onClick:t[0]||=e=>i.value=!0},{default:M(()=>[H(j(_y),{class:`size-3.5`}),t[3]||=U(` Add certificate `,-1)]),_:1},8,[`disabled`])]),default:M(()=>[n.certificates.length===0?(R(),z(`div`,PK,[H(aI,{compact:``,title:`No certificate uploaded`,description:`A route set to “Uploaded certificate” needs a pair covering its hostname, or the engine has nothing to serve for it.`},{icon:M(()=>[H(j(ry),{class:`size-5`})]),action:M(()=>[H($,{variant:`primary`,disabled:n.disabled||a.value,onClick:t[1]||=e=>i.value=!0},{default:M(()=>[...t[4]||=[U(` Add a certificate `,-1)]]),_:1},8,[`disabled`])]),_:1})])):(R(),z(`ul`,FK,[(R(!0),z(L,null,F(n.certificates,e=>(R(),z(`li`,{key:e.id,class:`rounded-panel border border-line bg-page/40 p-3`},[V(`div`,IK,[V(`p`,LK,[U(k(j(HG)(e))+` `,1),V(`span`,RK,k(e.id),1)]),e.daysRemaining===null?W(``,!0):(R(),z(`span`,{key:0,class:O([`text-2xs tabular-nums`,e.daysRemaining<14?`text-warn`:`text-faint`])},k(e.daysRemaining)+` days left `,3))]),e.error?(R(),z(`div`,zK,[H(FB,{tone:`danger`},{default:M(()=>[U(k(e.error),1)]),_:2},1024)])):(R(),z(`dl`,BK,[V(`div`,VK,[t[5]||=V(`dt`,{class:`text-muted`},` Subject `,-1),V(`dd`,HK,k(e.subject??`—`),1)]),V(`div`,UK,[t[6]||=V(`dt`,{class:`text-muted`},` Issuer `,-1),V(`dd`,WK,k(e.issuer??`—`),1)]),V(`div`,GK,[t[7]||=V(`dt`,{class:`text-muted`},` Valid until `,-1),V(`dd`,KK,k(e.validTo?e.validTo.slice(0,10):`—`),1)]),V(`div`,qK,[t[8]||=V(`dt`,{class:`shrink-0 text-muted`},` Covers `,-1),V(`dd`,JK,[e.hosts.length>0?(R(),z(L,{key:0},[U(k(e.hosts.join(`, `)),1)],64)):(R(),z(`span`,YK,`no hostnames in its SANs`))])])])),V(`div`,XK,[H(j(Uh),{open:c.value===e.id,"onUpdate:open":t=>c.value=t?e.id:null},{default:M(()=>[H(j(Xh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`danger-ghost`,disabled:a.value,"aria-label":`Remove ${j(HG)(e)}`},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),t[9]||=U(` Remove `,-1)]),_:1},8,[`disabled`,`aria-label`])]),_:2},1024),H(j(Yh),null,{default:M(()=>[H(j(Jh),{"side-offset":6,align:`end`,class:O(j(Q)(`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float`,`focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`))},{default:M(()=>[V(`p`,ZK,` Remove “`+k(j(HG)(e))+`”? `,1),t[12]||=V(`p`,{class:`mt-1 text-2xs leading-4 text-muted`},` The pair is deleted from disk. A route still set to “Uploaded certificate” keeps serving the engine's own certificate until you change it, and the panel refuses this while one still serves it. `,-1),V(`div`,QK,[H(j(Wh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`ghost`},{default:M(()=>[...t[10]||=[U(` Keep it `,-1)]]),_:1})]),_:1}),H($,{size:`xs`,variant:`danger`,loading:a.value,onClick:t=>f(e)},{default:M(()=>[...t[11]||=[U(` Remove it `,-1)]]),_:1},8,[`loading`,`onClick`])])]),_:2},1032,[`class`])]),_:2},1024)]),_:2},1032,[`open`,`onUpdate:open`])])]))),128))])),o.value||s.value?(R(),z(`div`,$K,[o.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(o.value),1)]),_:1})):W(``,!0),s.value?(R(),B(FB,{key:1,tone:`ok`},{default:M(()=>[U(k(s.value),1)]),_:1})):W(``,!0)])):W(``,!0),H(NK,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,taken:l.value,busy:a.value,error:o.value,onSubmit:d},null,8,[`open`,`taken`,`busy`,`error`])]),_:1}))}}),tq={key:0,class:`sm:col-span-2`},nq={key:0,class:`sm:col-span-2`},rq={key:1,class:`sm:col-span-2`},iq={class:`divide-y divide-line-soft text-xs sm:col-span-2`},aq={class:`flex items-start justify-between gap-4 py-1.5`},oq={class:`font-mono text-xs text-ink`},sq={class:`flex items-start justify-between gap-4 py-1.5`},cq={class:`text-right text-xs text-ink`},lq={key:0,class:`flex items-start justify-between gap-4 py-1.5`},uq={class:`font-mono text-xs tabular-nums text-ink`},dq={key:1,class:`flex items-start justify-between gap-4 py-1.5`},fq={class:`flex min-w-0 items-center gap-1.5`},pq={class:`min-w-0 truncate font-mono text-2xs text-ink`},mq={class:`flex items-start justify-between gap-4 py-1.5`},hq={class:`flex flex-wrap items-center justify-end gap-x-2 gap-y-1 text-right font-mono text-xs`},gq=[`href`],_q={key:0,class:`text-ink`},vq={class:`flex items-start justify-between gap-4 py-1.5`},yq={class:`font-mono text-xs tabular-nums text-ink`},bq={class:`flex items-start justify-between gap-4 py-1.5`},xq={class:`text-xs text-ink`},Sq={class:`flex flex-wrap gap-1.5 sm:col-span-2`},Cq=[`href`],wq={key:3,class:`sm:col-span-2`},Tq={key:4,class:`text-2xs leading-4 text-faint sm:col-span-2`},Eq={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},Dq={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},Oq=P({__name:`EnginePanel`,props:{view:{},busy:{}},emits:[`act`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>n.view?.engine??null),a=G(()=>n.view?.status??null),o=G(()=>n.view?.engines[0]??null),s=G(()=>a.value===null?null:yK[a.value.state]),c=G(()=>i.value?.installed===!0),l=G(()=>i.value?.path??null),u=G(()=>l.value===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${l.value}`),d=[{key:`acme`,label:`ACME certificates`},{key:`internalCa`,label:`Local CA`},{key:`dns01`,label:`DNS-01`},{key:`tcp`,label:`TCP/UDP`}];return(e,t)=>(R(),B(UL,{title:`Engine`,description:`The reverse proxy itself. The panel downloads the current build, supervises it and applies its configuration through the engine's own admin API.`},{actions:M(()=>[s.value?(R(),B(jV,{key:0,tone:s.value.tone,dot:``},{default:M(()=>[U(k(s.value.label),1)]),_:1},8,[`tone`])):W(``,!0)]),default:M(()=>[i.value===null?(R(),z(`div`,tq,[H(FB,{tone:`info`},{default:M(()=>[...t[6]||=[U(` The proxy state is not in this panel's frame yet. `,-1)]]),_:1})])):(R(),z(L,{key:1},[i.value.error?(R(),z(`div`,nq,[H(FB,{tone:`danger`,title:`The engine could not be read`},{default:M(()=>[U(k(i.value.error),1)]),_:1})])):W(``,!0),c.value?(R(),z(L,{key:2},[V(`dl`,iq,[V(`div`,aq,[t[7]||=V(`dt`,{class:`text-muted`},` Version `,-1),V(`dd`,oq,k(i.value.version??`not probed yet`),1)]),V(`div`,sq,[t[8]||=V(`dt`,{class:`text-muted`},` Source `,-1),V(`dd`,cq,k(i.value.source===`custom`?`a path configured by hand`:`downloaded by the panel`),1)]),i.value.bytes===null?W(``,!0):(R(),z(`div`,lq,[t[9]||=V(`dt`,{class:`text-muted`},` Size `,-1),V(`dd`,uq,k(j(GG)(i.value.bytes)),1)])),l.value?(R(),z(`div`,dq,[t[10]||=V(`dt`,{class:`text-muted`},` Binary `,-1),V(`dd`,fq,[V(`span`,pq,k(l.value),1),H(kV,{value:l.value,label:`Copy the binary path`},null,8,[`value`])])])):W(``,!0),V(`div`,mq,[t[11]||=V(`dt`,{class:`text-muted`},` Live address `,-1),V(`dd`,hq,[(R(!0),z(L,null,F(a.value?.urls??[],e=>(R(),z(`a`,{key:e,href:e,target:`_blank`,rel:`noreferrer`,class:`text-accent underline decoration-line underline-offset-2 hover:decoration-accent`},k(e),9,gq))),128)),!a.value||a.value.urls.length===0?(R(),z(`span`,_q,`—`)):W(``,!0)])]),V(`div`,vq,[t[12]||=V(`dt`,{class:`text-muted`},` Process `,-1),V(`dd`,yq,k(a.value?.pid??`—`),1)]),V(`div`,bq,[t[13]||=V(`dt`,{class:`text-muted`},` Certificates `,-1),V(`dd`,xq,k(a.value?.certExpiryDays===null||a.value?.certExpiryDays===void 0?`no public certificate yet`:`soonest expires in ${a.value.certExpiryDays} days`),1)])]),V(`div`,Sq,[(R(),z(L,null,F(d,e=>H(jV,{key:e.key,tone:o.value?.[e.key]?`ok`:`neutral`},{default:M(()=>[U(k(o.value?.[e.key]?`✓`:`✗`)+` `+k(e.label),1)]),_:2},1032,[`tone`])),64)),o.value?(R(),z(`a`,{key:0,class:`ml-1 self-center text-2xs text-accent underline decoration-line underline-offset-2`,href:o.value.docsUrl,target:`_blank`,rel:`noreferrer`},k(o.value.label)+` documentation`,9,Cq)):W(``,!0)])],64)):(R(),z(`div`,rq,[H(FB,{tone:`info`,title:`No engine installed`},{default:M(()=>[U(` Installing downloads the current `+k(o.value?.label??i.value.id)+` release the panel supervises — about 46 MB, once. Nothing is exposed until a route is added and the proxy is switched on. `,1)]),_:1})])),a.value?.lastError?(R(),z(`div`,wq,[H(FB,{tone:`danger`,title:`The engine reported a failure`},{default:M(()=>[U(k(a.value.lastError),1)]),_:1})])):W(``,!0),c.value&&u.value?(R(),z(`p`,Tq,[t[14]||=U(` A privileged port (below 1024) needs this once on Linux: `,-1),V(`code`,Eq,k(u.value),1),H(kV,{value:u.value,label:`Copy the command`,class:`ml-1 align-middle`},null,8,[`value`])])):W(``,!0)],64)),V(`div`,Dq,[c.value?(R(),z(L,{key:1},[H($,{variant:`primary`,disabled:n.busy!==null||a.value?.state===`running`,loading:n.busy===`start`,onClick:t[1]||=e=>r(`act`,`start`)},{default:M(()=>[...t[16]||=[U(` Start `,-1)]]),_:1},8,[`disabled`,`loading`]),H($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state===`off`||a.value?.state===`stopped`,loading:n.busy===`stop`,onClick:t[2]||=e=>r(`act`,`stop`)},{default:M(()=>[...t[17]||=[U(` Stop `,-1)]]),_:1},8,[`disabled`,`loading`]),H($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`apply`,onClick:t[3]||=e=>r(`act`,`apply`)},{default:M(()=>[...t[18]||=[U(` Apply configuration `,-1)]]),_:1},8,[`disabled`,`loading`]),H($,{variant:`ghost`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`revert`,title:`Go back to the configuration that applied before the last one`,onClick:t[4]||=e=>r(`act`,`revert`)},{default:M(()=>[...t[19]||=[U(` Revert `,-1)]]),_:1},8,[`disabled`,`loading`]),H($,{variant:`ghost`,disabled:n.busy!==null,loading:n.busy===`install`,onClick:t[5]||=e=>r(`act`,`install`)},{default:M(()=>[...t[20]||=[U(` Update engine `,-1)]]),_:1},8,[`disabled`,`loading`])],64)):(R(),B($,{key:0,variant:`primary`,loading:n.busy===`install`,disabled:n.busy!==null,onClick:t[0]||=e=>r(`act`,`install`)},{default:M(()=>[...t[15]||=[U(` Install engine `,-1)]]),_:1},8,[`loading`,`disabled`]))])]),_:1}))}}),kq={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},Aq={key:0,class:`text-2xs text-faint`},jq={key:0,class:`sm:col-span-2`},Mq={key:0,class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},Nq={key:1},Pq={key:1,class:`sm:col-span-2`},Fq={key:3,class:`sm:col-span-2`},Iq={key:4,class:`sm:col-span-2`},Lq={key:5,class:`text-2xs leading-4 text-faint sm:col-span-2`},Rq=P({__name:`ListenerPanel`,props:Ra({emailHost:{},enginePath:{},dnsAccounts:{}},{form:{required:!0},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=oo(e,`form`),r=G(()=>t.dnsAccounts.filter(e=>e.writesTxt&&e.hasCredentials)),i=G(()=>mK(n.value)),a=G(()=>t.enginePath===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${t.enginePath}`),o=G(()=>KG(n.value.httpPort)||KG(n.value.httpsPort));function s(){n.value.httpPort=VG,n.value.httpsPort=BG}function c(){n.value.httpPort=80,n.value.httpsPort=443}function l(e,t){e===null||Number.isNaN(e)||e>=1&&e<=65535&&(n.value[t]=Math.trunc(e))}return(e,u)=>(R(),B(UL,{title:`Listener & certificates`,description:`Where the proxy listens. 80 and 443 are what a router forwards and what an ACME challenge expects; a port below 1024 needs a privileged bind.`},{actions:M(()=>[i.value?(R(),B(jV,{key:0,tone:`info`},{default:M(()=>[...u[7]||=[U(` unprivileged ports `,-1)]]),_:1})):W(``,!0)]),default:M(()=>[H(mR,{modelValue:n.value.enabled,"onUpdate:modelValue":u[0]||=e=>n.value.enabled=e,label:`Run the reverse proxy`,hint:`Saved with Save settings; the panel starts or stops the engine to match.`,wide:``},null,8,[`modelValue`]),H(eR,{"model-value":n.value.httpPort,label:`HTTP port`,min:1,max:65535,hint:`ACME HTTP-01 challenges and the redirect to HTTPS.`,"onUpdate:modelValue":u[1]||=e=>l(e,`httpPort`)},null,8,[`model-value`]),H(eR,{"model-value":n.value.httpsPort,label:`HTTPS port`,min:1,max:65535,hint:`Where certificates are served.`,"onUpdate:modelValue":u[2]||=e=>l(e,`httpsPort`)},null,8,[`model-value`]),V(`div`,kq,[H($,{size:`xs`,variant:`secondary`,onClick:s},{default:M(()=>[U(` Use `+k(j(VG))+` / `+k(j(BG)),1)]),_:1}),H($,{size:`xs`,variant:`ghost`,onClick:c},{default:M(()=>[...u[8]||=[U(` Use 80 / 443 `,-1)]]),_:1}),i.value?(R(),z(`span`,Aq,` Running unprivileged — forward 80 and 443 to these ports on your router. `)):W(``,!0)]),o.value?(R(),z(`div`,jq,[H(FB,{tone:`warn`,title:`A port below 1024 needs a privileged bind`},{default:M(()=>[u[10]||=U(` Running the panel as your own user cannot bind 80 or 443 without permission. Either grant it once `,-1),a.value?(R(),z(`code`,Mq,k(a.value),1)):(R(),z(`span`,Nq,[...u[9]||=[U(`with `,-1),V(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`setcap`,-1),U(` on the engine binary`,-1)]])),a.value?(R(),B(kV,{key:2,value:a.value,label:`Copy the command`,class:`ml-1 align-middle`},null,8,[`value`])):W(``,!0),U(` and restart the engine, or keep `+k(j(VG))+`/`+k(j(BG))+` and forward 80/443 from your router. On Windows the port is free to bind, but something else may hold it. `,1)]),_:1})])):W(``,!0),H(dR,{modelValue:n.value.email,"onUpdate:modelValue":u[3]||=e=>n.value.email=e,label:`ACME account e-mail`,placeholder:`you@example.com`,hint:`Let's Encrypt uses it to warn you about an expiring certificate. A local-only name gets the engine's own CA and needs none.`,wide:``},null,8,[`modelValue`]),t.emailHost===null?W(``,!0):(R(),z(`div`,Pq,[H(FB,{tone:`warn`,title:`An e-mail is needed for automatic HTTPS`},{default:M(()=>[U(` “`+k(t.emailHost)+`” is a public hostname, so the engine asks a CA for a certificate and the account address is required. Fill it in, switch the route's TLS off, or turn on the staging endpoint while you try things out. `,1)]),_:1})])),H(mR,{modelValue:n.value.staging,"onUpdate:modelValue":u[4]||=e=>n.value.staging=e,label:`Use the ACME staging endpoint`,hint:`Untrusted certificates and no rate-limit burn while you try things out.`,wide:``},null,8,[`modelValue`]),H(mR,{modelValue:n.value.dns01,"onUpdate:modelValue":u[5]||=e=>n.value.dns01=e,label:`Answer challenges with DNS-01`,hint:`The panel writes the challenge record through a route's DNS account, so no inbound port is needed to get a certificate.`,wide:``},null,8,[`modelValue`]),n.value.dns01?(R(),B(dR,{key:2,modelValue:n.value.resolvers,"onUpdate:modelValue":u[6]||=e=>n.value.resolvers=e,label:`Check the record against`,placeholder:`1.1.1.1, 8.8.8.8`,hint:`Nameservers the engine reads the record from; empty uses its own. Needed where split-horizon DNS shows it a different view.`,spellcheck:`false`,wide:``},null,8,[`modelValue`])):W(``,!0),n.value.dns01&&r.value.length===0?(R(),z(`div`,Fq,[H(FB,{tone:`warn`,title:`No DNS account can answer a challenge`},{default:M(()=>[...u[11]||=[U(` DNS-01 is on, but no account has credentials it can use. Add one under Workspace Settings → Dynamic DNS, or public names stay on the port challenges and wait for a CA that cannot reach them. `,-1)]]),_:1})])):n.value.dns01&&r.value.length>1?(R(),z(`div`,Iq,[H(FB,{tone:`info`,title:`Each public route has to pick an account`},{default:M(()=>[...u[12]||=[U(` More than one account can answer, so “Automatic” cannot choose. Pick one per route, or those names stay on the port challenges. `,-1)]]),_:1})])):W(``,!0),n.value.dns01?(R(),z(`p`,Lq,` Each route picks its own account, so names in different zones each get the right one. A route left on “Automatic” uses the only account the table names. A name no account answers stays on the port challenges. `)):W(``,!0),u[13]||=V(`p`,{class:`text-2xs leading-4 text-faint sm:col-span-2`},` A public name whose certificate is still being issued is reachable in the meantime — over HTTPS with a temporary untrusted certificate, or over plain HTTP with a page naming the ports to forward. `,-1)]),_:1}))}}),zq={class:`space-y-3`},Bq={key:1,class:`text-2xs leading-4 text-faint sm:col-span-2`},Vq={key:4,class:`text-2xs leading-4 text-warn sm:col-span-2`},Hq=P({__name:`RouteDialog`,props:Ra({draft:{},others:{},workspaces:{},dnsAccounts:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Ra([`save`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`open`),a=A(YG()),o=A({}),s=G(()=>n.draft!==null),c=G(()=>(n.workspaces.find(e=>e.id===a.value.workspace)?.servers??[]).map(e=>({value:e.id,label:e.id}))),l=G(()=>a.value.tls===`off`?`Plain HTTP: no certificate is served for this hostname.`:a.value.tls===`manual`?`Serves the certificate pair uploaded below.`:a.value.host.trim().length===0?`A public hostname gets an ACME certificate; a local-only name gets the engine’s own CA.`:qG(a.value.host)?`A public hostname, so the engine asks a CA for a certificate — an ACME account e-mail is needed.`:`A local-only name, so the engine signs it with its own locally-trusted CA.`),u=G(()=>a.value.tls===`auto`&&qG(a.value.host)),d=G(()=>wK(n.dnsAccounts)),f=G(()=>n.dnsAccounts.find(e=>`${e.workspace}/${e.account}`===a.value.dnsAccount)),p=G(()=>f.value===void 0?a.value.dnsAccount.length>0?`That account is no longer configured.`:`DNS-01 writes the challenge record here. Empty uses the only account that can answer a challenge, when there is one.`:f.value.writesTxt?f.value.hasCredentials?`The challenge is written through this ${f.value.provider} account.`:`No credentials are stored for this ${f.value.provider} account yet.`:`A ${f.value.provider} account cannot write TXT records, so it cannot answer a DNS-01 challenge.`);N(i,e=>{e&&(a.value=n.draft===null?YG():structuredClone(un(n.draft)),a.value.workspace.length===0&&(a.value.workspace=n.workspaces[0]?.id??``),o.value={})}),N(()=>a.value.workspace,()=>{c.value.some(e=>e.value===a.value.server)||(a.value.server=c.value[0]?.value??``)});function m(){let e=a.value.host.trim().toLowerCase(),t={...a.value,host:e,id:pK(sK(e),n.others.map(e=>e.id)),workspace:a.value.target===`server`?a.value.workspace:``,server:a.value.target===`server`?a.value.server:``,url:a.value.target===`external`?a.value.url.trim():``},s=hK(t,{others:n.others,workspaces:n.workspaces});o.value=s,!(Object.keys(s).length>0)&&(r(`save`,t),i.value=!1)}return(e,t)=>(R(),B(ER,{open:i.value,"onUpdate:open":t[9]||=e=>i.value=e,title:s.value?`Edit route`:`Add route`,description:`A hostname, what it forwards to, and how it is served over TLS.`,width:`w-[min(92vw,34rem)]`},{footer:M(()=>[H($,{size:`sm`,variant:`ghost`,onClick:t[8]||=e=>i.value=!1},{default:M(()=>[...t[11]||=[U(` Cancel `,-1)]]),_:1}),H($,{size:`sm`,variant:`primary`,onClick:m},{default:M(()=>[U(k(s.value?`Save route`:`Add route`),1)]),_:1})]),default:M(()=>[V(`div`,zq,[H(dR,{modelValue:a.value.host,"onUpdate:modelValue":t[0]||=e=>a.value.host=e,label:`Hostname`,placeholder:`gitea.example.com`,autocomplete:`off`,spellcheck:`false`,error:o.value.host,wide:``},null,8,[`modelValue`,`error`]),H(dR,{modelValue:a.value.path,"onUpdate:modelValue":t[1]||=e=>a.value.path=e,label:`Path prefix`,placeholder:`/optional`,hint:`Empty serves the whole host.`,spellcheck:`false`,error:o.value.path,wide:``},null,8,[`modelValue`,`error`]),H(oR,{modelValue:a.value.target,"onUpdate:modelValue":t[2]||=e=>a.value.target=e,label:`Target`,options:j(_K)},null,8,[`modelValue`,`options`]),H(oR,{modelValue:a.value.tls,"onUpdate:modelValue":t[3]||=e=>a.value.tls=e,label:`TLS`,options:j(vK),hint:l.value},null,8,[`modelValue`,`options`,`hint`]),u.value?(R(),B(oR,{key:0,modelValue:a.value.dnsAccount,"onUpdate:modelValue":t[4]||=e=>a.value.dnsAccount=e,label:`DNS account`,options:d.value,hint:p.value},null,8,[`modelValue`,`options`,`hint`])):a.value.tls===`auto`?(R(),z(`p`,Bq,` A local-only name is signed by the engine's own CA, so no DNS account is involved. `)):W(``,!0),a.value.target===`server`?(R(),z(L,{key:2},[H(oR,{modelValue:a.value.workspace,"onUpdate:modelValue":t[5]||=e=>a.value.workspace=e,label:`Workspace`,options:n.workspaces.map(e=>({value:e.id,label:e.label})),error:o.value.workspace},null,8,[`modelValue`,`options`,`error`]),H(oR,{modelValue:a.value.server,"onUpdate:modelValue":t[6]||=e=>a.value.server=e,label:`Server`,options:c.value,disabled:c.value.length===0,error:o.value.server??(c.value.length===0?`this workspace has no servers`:null)},null,8,[`modelValue`,`options`,`disabled`,`error`]),t[10]||=V(`p`,{class:`text-2xs leading-4 text-faint sm:col-span-2`},` A server that is stopped is not routed: the row shows “No upstream” until it runs again. `,-1)],64)):W(``,!0),a.value.target===`external`?(R(),B(dR,{key:3,modelValue:a.value.url,"onUpdate:modelValue":t[7]||=e=>a.value.url=e,label:`Upstream`,placeholder:`http://10.0.0.5:8080`,hint:`A literal address, including the port. A scheme is optional.`,spellcheck:`false`,error:o.value.url,wide:``},null,8,[`modelValue`,`error`])):W(``,!0),a.value.target===`panel`?(R(),z(`p`,Vq,` Serving the control panel needs authentication on and a password that is not the default — the panel refuses the save otherwise. `)):W(``,!0),o.value.form?(R(),B(FB,{key:5,tone:`danger`},{default:M(()=>[U(k(o.value.form),1)]),_:1})):W(``,!0)])]),_:1},8,[`open`,`title`]))}}),Uq={class:`text-xs font-semibold text-ink`},Wq={class:`mt-1 text-2xs leading-4 text-muted`},Gq={class:`mt-2.5 flex justify-end gap-1.5`},Kq=P({__name:`RetryCertificateButton`,props:{host:{},retryIn:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=A(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(R(),B(j(Uh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:M(()=>[H(j(Xh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`secondary`,loading:n.busy,disabled:n.busy},{default:M(()=>[...t[1]||=[U(` Force retry certificate `,-1)]]),_:1},8,[`loading`,`disabled`])]),_:1}),H(j(Yh),null,{default:M(()=>[H(j(Jh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[V(`p`,Uq,` Ask the CA again for `+k(n.host)+`? `,1),V(`p`,Wq,` The engine failed to obtain a CA certificate for this hostname previously and is using its local CA. It retries automatically every `+k(n.retryIn)+`. `,1),t[4]||=V(`p`,{class:`mt-1 text-2xs leading-4 text-warn`},` Retrying now will kill this route and make it unavailable for a bit, are you sure to continue? `,-1),V(`div`,Gq,[H(j(Wh),{"as-child":``},{default:M(()=>[H($,{size:`xs`,variant:`ghost`},{default:M(()=>[...t[2]||=[U(` Leave it `,-1)]]),_:1})]),_:1}),H($,{size:`xs`,variant:`primary`,loading:n.busy,onClick:a},{default:M(()=>[...t[3]||=[U(` Retry now `,-1)]]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),qq={key:0,class:`sm:col-span-2`},Jq={class:`list-disc space-y-0.5 pl-4`},Yq={key:1,class:`sm:col-span-2`},Xq={key:2,class:`overflow-x-auto sm:col-span-2`},Zq={class:`w-full text-left text-xs`},Qq={class:`py-1.5 pr-3`},$q={class:`font-mono text-xs text-ink`},eJ=[`href`,`title`],tJ={key:2,class:`text-accent`},nJ={class:`font-mono text-2xs text-faint`},rJ={class:`py-1.5 pr-3 text-2xs text-muted`},iJ={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},aJ={class:`py-1.5 pr-3 text-2xs text-muted`},oJ={key:0,class:`mt-0.5`},sJ={key:1,class:`mt-1`},cJ={class:`py-1.5 pr-3`},lJ={class:`py-1.5 pr-3`},uJ={class:`py-1.5`},dJ={class:`flex items-center justify-end gap-1`},fJ=P({__name:`RouteTable`,props:{routes:{},views:{},workspaces:{},httpPort:{},httpsPort:{},disabled:{type:Boolean}},emits:[`add`,`edit`,`remove`,`retry`,`toggle`],setup(e,{emit:t}){let n=e,r=t;function i(e){return e===`fallback`}let a=G(()=>n.routes.map(e=>{let t=n.views.find(t=>t.route.id===e.id)??null;return{route:e,view:t,meta:t===null?null:bK[t.status],target:cK(e,n.workspaces),tls:OK(e),certificate:t===null?null:SK(t),url:tK(e,n.httpPort,n.httpsPort)}})),o=G(()=>a.value.filter(e=>e.view?.status===`error`));return(e,t)=>(R(),B(UL,{title:`Routes`,description:`One public hostname per service. A route may point at a supervised server in any workspace, at this panel, or at a literal upstream.`},{actions:M(()=>[H($,{size:`xs`,variant:`secondary`,disabled:n.disabled,onClick:t[0]||=e=>r(`add`)},{default:M(()=>[H(j(_y),{class:`size-3.5`}),t[2]||=U(` Add route `,-1)]),_:1},8,[`disabled`])]),default:M(()=>[o.value.length>0?(R(),z(`div`,qq,[H(FB,{tone:`danger`,title:`These routes cannot be saved as they stand`},{default:M(()=>[V(`ul`,Jq,[(R(!0),z(L,null,F(o.value,e=>(R(),z(`li`,{key:e.route.id},k(e.view?.message??`${e.route.host} cannot be routed`),1))),128))])]),_:1})])):W(``,!0),a.value.length===0?(R(),z(`div`,Yq,[H(aI,{compact:``,title:`No routes yet`,description:`Add one to expose a server through a domain — the engine gets the certificate on its own.`},{icon:M(()=>[H(j(Ly),{class:`size-5`})]),action:M(()=>[H($,{variant:`primary`,disabled:n.disabled,onClick:t[1]||=e=>r(`add`)},{default:M(()=>[...t[3]||=[U(` Add the first route `,-1)]]),_:1},8,[`disabled`])]),_:1})])):(R(),z(`div`,Xq,[V(`table`,Zq,[t[5]||=V(`thead`,null,[V(`tr`,{class:`text-2xs text-faint`},[V(`th`,{class:`py-1 pr-3 font-medium`},` Hostname `),V(`th`,{class:`py-1 pr-3 font-medium`},` Target `),V(`th`,{class:`py-1 pr-3 font-medium`},` Upstream `),V(`th`,{class:`py-1 pr-3 font-medium`},` TLS `),V(`th`,{class:`py-1 pr-3 font-medium`},` State `),V(`th`,{class:`py-1 pr-3 font-medium`},` On `),V(`th`,{class:`py-1 font-medium`},[V(`span`,{class:`sr-only`},`Actions`)])])],-1),V(`tbody`,null,[(R(!0),z(L,null,F(a.value,e=>(R(),z(`tr`,{key:e.route.key,class:`border-t border-line-soft align-top`},[V(`td`,Qq,[V(`p`,$q,[e.url!==null&&e.route.enabled?(R(),z(`a`,{key:0,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`transition-colors duration-150 hover:text-accent hover:underline`,title:`Open ${e.url} in a new tab`},k(e.route.host),9,eJ)):(R(),z(L,{key:1},[U(k(e.route.host.trim().length>0?e.route.host:`no hostname yet`),1)],64)),e.route.path.length>0?(R(),z(`span`,tJ,k(e.route.path),1)):W(``,!0)]),V(`p`,nJ,k(e.route.id),1)]),V(`td`,rJ,k(e.target),1),V(`td`,iJ,k(e.view?.upstream??`—`),1),V(`td`,aJ,[U(k(e.tls)+` `,1),e.certificate?(R(),z(`div`,oJ,[H(jV,{tone:e.certificate.tone,dot:``},{default:M(()=>[U(k(e.certificate.label),1)]),_:2},1032,[`tone`]),e.certificate.message?(R(),z(`p`,{key:0,class:O([`mt-0.5 text-2xs`,e.certificate.tone===`danger`?`text-danger`:`text-faint`])},k(e.certificate.message),3)):W(``,!0),i(e.view?.certificate?.state)?(R(),z(`div`,sJ,[H(Kq,{host:e.route.host,"retry-in":j(eK)(e.certificate?.retryInMinutes??null),busy:n.disabled,onConfirm:t=>r(`retry`,e.route)},null,8,[`host`,`retry-in`,`busy`,`onConfirm`])])):W(``,!0)])):W(``,!0)]),V(`td`,cJ,[e.meta?(R(),B(jV,{key:0,tone:e.meta.tone,dot:``},{default:M(()=>[U(k(e.meta.label),1)]),_:2},1032,[`tone`])):(R(),B(jV,{key:1,tone:`info`,dot:``},{default:M(()=>[...t[4]||=[U(` Not applied yet `,-1)]]),_:1})),e.view?.message?(R(),z(`p`,{key:2,class:O([`mt-0.5 text-2xs`,e.view.status===`error`?`text-danger`:`text-warn`])},k(e.view.message),3)):W(``,!0)]),V(`td`,lJ,[H(mR,{"model-value":e.route.enabled,label:`Route ${e.route.host||e.route.id}`,"sr-only":``,disabled:n.disabled,"onUpdate:modelValue":t=>r(`toggle`,e.route,t)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])]),V(`td`,uJ,[V(`span`,dJ,[H($,{size:`xs`,variant:`ghost`,disabled:n.disabled,"aria-label":`Edit ${e.route.host||e.route.id}`,onClick:t=>r(`edit`,e.route)},{default:M(()=>[H(j(hy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`]),H($,{size:`xs`,variant:`danger-ghost`,disabled:n.disabled,"aria-label":`Remove ${e.route.host||e.route.id}`,onClick:t=>r(`remove`,e.route)},{default:M(()=>[H(j(Fy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`])])])]))),128))])])]))]),_:1}))}}),pJ={class:`min-h-full`},mJ={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},hJ={key:2,class:`space-y-6`},gJ={key:0,class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},_J={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},vJ={class:`min-w-0 flex-1`},yJ={class:`text-xs text-muted`},bJ={class:`font-mono tabular-nums text-ink`},xJ={key:0,class:`mt-0.5 text-xs text-danger`},SJ={key:1,class:`mt-0.5 text-xs text-danger`},CJ={key:2,class:`mt-0.5 text-xs text-ok`},wJ={class:`flex shrink-0 items-center gap-2`},TJ=P({__name:`ProxyView`,setup(e){let t=KN(),n=mN(),r=A(null),i=A(null),a=A(null),o=A(!1),s=A(null),c=A({enabled:!1,httpPort:80,httpsPort:443,email:``,staging:!1,dns01:!1,resolvers:``}),l=A([]),u=A(!1),d=A(null),f=G(()=>t.proxy.value??r.value),p=G(()=>f.value?.config??null),m=G(()=>f.value?.engine.path??null),h=G(()=>t.workspaces.value.map(e=>({id:e.id,label:e.label,servers:e.servers.map(e=>({id:e.id}))}))),g=G(()=>$G(c.value,l.value)?WG(l.value):null),_=G(()=>p.value!==null&&rK(p.value.routes,l.value)!==null),v=G(()=>{if(p.value===null)return 0;let e=QG(p.value,c.value,l.value);return e===null?0:Object.keys(e).filter(e=>e!==`routes`).length+(e.routes===void 0?0:1)}),y=G(()=>(f.value?.routes??[]).filter(e=>e.status===`error`)),b=G(()=>_.value?[]:y.value.map(e=>e.message??`${e.route.host} cannot be routed`)),x={};function S(){let e=p.value;if(e===null)return;xL(x.listener,{...c.value})||(Object.assign(c.value,TK(e)),x.listener={...c.value});let t=lK(l.value);xL(x.routes,t)||(l.value=EK(e.routes),x.routes=lK(l.value))}N(f,S,{immediate:!0});async function C(){i.value=null;try{r.value=await Kj()}catch(e){i.value=e instanceof Error?e.message:String(e)}}ta(()=>{t.proxy.value===null&&C()});let w={install:()=>Yj(),start:aM,stop:oM,apply:Vj,revert:nM},T={install:`Engine installed`,start:`Engine starting`,stop:`Engine stopping`,apply:`Configuration applied`,revert:`Configuration reverted`};async function ee(e){if(s.value===null){s.value=e,a.value=null;try{r.value=await w[e](),n.success(T[e]),await t.refresh()}catch(e){a.value=e instanceof Error?e.message:String(e)}finally{s.value=null}}}let E=A(null),te=A(null);async function ne(){let e=p.value,i=e===null?null:QG(e,c.value,l.value);if(!(i===null||o.value||b.value.length>0)){o.value=!0,E.value=null,te.value=null;try{r.value=await Qj(i),await t.refresh(),te.value=`Settings saved.`,n.success(`Settings saved`),delete x.listener,delete x.routes,S()}catch(e){E.value=e instanceof Error?e.message:String(e)}finally{o.value=!1}}}function re(){E.value=null,te.value=null,delete x.listener,delete x.routes,S()}function ie(){d.value=null,u.value=!0}function ae(e){d.value=e,u.value=!0}function oe(e){l.value=DK(l.value,d.value,e),d.value=null}function se(e){l.value=l.value.filter(t=>t.key!==e.key)}async function ce(e){s.value=`apply`;try{r.value=await tM(e.id),await t.refresh(),n.success(`asking the CA again for ${e.host}`)}catch(e){n.failure(`the retry failed`,e instanceof Error?e.message:String(e))}finally{s.value=null}}function D(e,t){e.enabled=t}async function le(e){r.value=e,await t.refresh()}return(e,t)=>(R(),z(`div`,pJ,[V(`div`,mJ,[t[3]||=V(`header`,{class:`mb-5`},[V(`h1`,{class:`text-xl font-semibold tracking-tight text-ink`},` Reverse Proxy `),V(`p`,{class:`mt-1 text-xs text-muted`},` Expose your servers through domains, with automatic HTTPS via 80/443 or a DNS challenge. `),V(`p`,{class:`mt-1 text-2xs leading-4 text-faint`},` For DNS-01, add the domain's DNS provider to any workspace under Workspace Settings → Dynamic DNS; a route can then pick that account, from any workspace. `)],-1),i.value?(R(),B(FB,{key:0,tone:`danger`,title:`The reverse proxy could not be read`,class:`mb-4`},{default:M(()=>[U(k(i.value),1)]),_:1})):W(``,!0),f.value===null&&i.value===null?(R(),B(FB,{key:1,tone:`info`,class:`mb-4`},{default:M(()=>[...t[2]||=[U(` Reading the reverse proxy… `,-1)]]),_:1})):W(``,!0),f.value===null?W(``,!0):(R(),z(`div`,hJ,[H(Oq,{view:f.value,busy:s.value,onAct:ee},null,8,[`view`,`busy`]),a.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(a.value),1)]),_:1})):W(``,!0),H(Rq,{form:c.value,"onUpdate:form":t[0]||=e=>c.value=e,"engine-path":m.value,"email-host":g.value,"dns-accounts":f.value?.dnsAccounts??[]},null,8,[`form`,`engine-path`,`email-host`,`dns-accounts`]),H(fJ,{routes:l.value,views:f.value.routes,workspaces:h.value,"http-port":f.value.config.httpPort,"https-port":f.value.config.httpsPort,disabled:o.value,onAdd:ie,onEdit:ae,onRemove:se,onRetry:ce,onToggle:D},null,8,[`routes`,`views`,`workspaces`,`http-port`,`https-port`,`disabled`]),H(eq,{certificates:f.value.certificates,disabled:o.value,onChanged:le},null,8,[`certificates`,`disabled`])]))]),f.value===null?W(``,!0):(R(),z(`div`,gJ,[V(`div`,_J,[V(`div`,vJ,[V(`p`,yJ,[v.value>0?(R(),z(L,{key:0},[V(`span`,bJ,k(v.value),1),U(` field`+k(v.value===1?``:`s`)+` changed `,1)],64)):(R(),z(L,{key:1},[U(` No unsaved changes `)],64))]),b.value.length>0?(R(),z(`p`,xJ,k(b.value.join(` · `)),1)):E.value?(R(),z(`p`,SJ,k(E.value),1)):te.value?(R(),z(`p`,CJ,k(te.value),1)):W(``,!0)]),V(`div`,wJ,[H($,{variant:`ghost`,disabled:v.value===0||o.value,onClick:re},{default:M(()=>[...t[4]||=[U(` Discard changes `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`primary`,disabled:v.value===0||b.value.length>0,loading:o.value,onClick:ne},{default:M(()=>[...t[5]||=[U(` Save settings `,-1)]]),_:1},8,[`disabled`,`loading`])])])])),H(Hq,{open:u.value,"onUpdate:open":t[1]||=e=>u.value=e,draft:d.value,others:l.value.filter(e=>e.key!==d.value?.key),workspaces:h.value,"dns-accounts":f.value?.dnsAccounts??[],onSave:oe},null,8,[`open`,`draft`,`others`,`workspaces`,`dns-accounts`])]))}}),EJ={class:`mb-4 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},DJ={class:`flex items-center gap-2`},OJ={class:`font-mono tabular-nums`},kJ={key:1,class:`text-2xs text-faint`},AJ={class:`flex flex-col gap-3`},jJ={key:0,class:`mt-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},MJ={class:`mt-4 flex items-center justify-end gap-2 border-t border-line pt-3.5`},NJ={class:`max-h-[60dvh] overflow-auto`},PJ={key:0,class:`divide-y divide-line-soft`},FJ={class:`font-mono text-xs text-ink`},IJ={class:`ml-auto font-mono text-xs text-muted line-through`},LJ={class:`font-mono text-xs text-accent`},RJ={key:1,class:`text-xs text-muted`},zJ=P({__name:`ServerConfigEditor`,props:{serverId:{},workspaceId:{},config:{}},emits:[`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=[`restart`,`health`,`stop`],a=KN(),o=A(!1),s=A(null);function c(e){return e>0?Math.round(e/1024/1024):null}function l(e){return{label:e.label??``,command:e.command,cwd:e.cwd,args:e.args.join(`
|
|
43
|
-
`),env:OL(e.env),dataEnvs:OL(e.dataEnvs),backupPaths:e.backupPaths.join(`
|
|
44
|
-
`),backupIgnoreGenerated:e.backupIgnoreGenerated!==!1,dependsOn:e.dependsOn.join(`, `),envFile:e.envFile,maxRssMb:c(e.resources.maxRssBytes),port:e.port,bind:e.bind,onPortConflict:e.onPortConflict,logBufferLines:e.logBufferLines,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent===!0,bootstrapEnabled:e.bootstrap!==null&&e.bootstrap!==void 0,bootstrapCommand:e.bootstrap?.command??``,bootstrapArgs:(e.bootstrap?.args??[]).join(`
|
|
45
|
-
`),bootstrapEnv:OL(e.bootstrap?.env??{}),bootstrapTimeoutMs:e.bootstrap?.timeoutMs??12e4,bootstrapRunOnce:e.bootstrap?.runOnce??!0}}let u=en(l(n.config)),d=A({...n.config.restart}),f=A($I(n.config.health)),p=A({...n.config.stop}),m=G(()=>{let e=[{value:`local`,label:`local — 127.0.0.1`},{value:`lan`,label:`lan — 0.0.0.0`}];return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n.config.bind)&&e.push({value:n.config.bind,label:`${n.config.bind} — explicit`}),e});function h(){let e=Number.isFinite(u.maxRssMb)?u.maxRssMb:0,t=Number.isFinite(u.logBufferLines)&&u.logBufferLines>=50?u.logBufferLines:50,n=Number.isFinite(u.bootstrapTimeoutMs)?u.bootstrapTimeoutMs:0;return{label:u.label.trim().length===0?null:u.label.trim(),command:u.command.trim(),cwd:u.cwd.trim()===``?`.`:u.cwd.trim(),args:DL(u.args),env:kL(u.env),dataEnvs:kL(u.dataEnvs),backupPaths:DL(u.backupPaths),backupIgnoreGenerated:u.backupIgnoreGenerated,dependsOn:AL(u.dependsOn),envFile:u.envFile.trim(),resources:{maxRssBytes:e>0?Math.round(e*1024*1024):0},port:u.port===null||Number.isNaN(u.port)?null:u.port,bind:u.bind,onPortConflict:u.onPortConflict,logBufferLines:t,enabled:u.enabled,autostart:u.autostart,persistent:u.persistent,restart:{...d.value},health:$I(f.value),stop:{...p.value},bootstrap:u.bootstrapEnabled?{command:u.bootstrapCommand.trim(),args:DL(u.bootstrapArgs),env:kL(u.bootstrapEnv),timeoutMs:n,runOnce:u.bootstrapRunOnce}:null}}function g(e,t){let r=n.config[t]??{},i=e[t]??{},a={};for(let[e,t]of Object.entries(i))r[e]!==t&&(a[e]=t);return Object.keys(a).length>0?a:null}function _(e){for(let t of i)g(e,t)===null&&delete e[t];return GI(n.config,e)}function v(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}let y=G(()=>_(h())),b=G(()=>JI(y.value)),x=G(()=>b.value>0),S=G(()=>qI(y.value,n.config)),C=A(!1),w=T(n.config);function T(e){return JSON.parse(JSON.stringify(e))}function ee(e){Object.assign(u,l(e)),d.value={...e.restart},f.value=$I(e.health),p.value={...e.stop},w=T(e),s.value=null}N(()=>n.config,e=>{v(e,w)||ee(e)});async function E(){s.value=null,o.value=!0;try{let e=h(),t=zA(e);if(t instanceof Y.errors){s.value=t.summary;return}let i=_(e);if(Object.keys(i).length===0){r(`saved`);return}if(await a.saveConfig(n.workspaceId,n.serverId,i),a.lastError.value!==null){s.value=a.lastError.value;return}r(`saved`)}finally{o.value=!1}}return(e,t)=>(R(),z(L,null,[V(`form`,{class:`border-t border-line bg-page/40 px-4 py-4`,onSubmit:cu(E,[`prevent`])},[V(`header`,EJ,[t[32]||=V(`div`,{class:`min-w-0`},[V(`h2`,{class:`text-sm font-semibold text-ink`},` Edit configuration `),V(`p`,{class:`mt-0.5 text-2xs leading-4 text-muted`},[U(` Writes overrides to `),V(`span`,{class:`font-mono`},`servers.config.json`),U(`; anything left alone keeps inheriting the defaults. `)])],-1),V(`div`,DJ,[b.value>0?(R(),z(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-2xs text-warn underline decoration-warn/40 underline-offset-2 transition-colors duration-150 hover:text-ink`,onClick:t[0]||=e=>C.value=!0},[V(`span`,OJ,k(b.value),1),U(` unsaved `+k(b.value===1?`change`:`changes`),1)])):(R(),z(`span`,kJ,`in sync`))])]),V(`div`,AJ,[H(UL,{title:`Process`,description:`What gets spawned, where, and with which environment.`,columns:2},{default:M(()=>[H(dR,{modelValue:u.label,"onUpdate:modelValue":t[1]||=e=>u.label=e,label:`Label`,placeholder:`falls back to the id`},null,8,[`modelValue`]),H(dR,{modelValue:u.command,"onUpdate:modelValue":t[2]||=e=>u.command=e,label:`Command`,placeholder:`node`,required:``,class:`font-mono text-xs`},null,8,[`modelValue`]),H(dR,{modelValue:u.cwd,"onUpdate:modelValue":t[3]||=e=>u.cwd=e,label:`Working directory`,placeholder:`.`,hint:`Relative paths resolve under projectDir.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(dR,{modelValue:u.envFile,"onUpdate:modelValue":t[4]||=e=>u.envFile=e,label:`Env file`,placeholder:`optional KEY=value file`,hint:`Loaded at spawn; its values override env.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(AR,{modelValue:u.args,"onUpdate:modelValue":t[5]||=e=>u.args=e,label:`Arguments`,rows:3,hint:`One per line; {port} {host} {home} {projectDir} {dataRoot} {id} {label} {cwd} {bind} {lanIp} are substituted.`,placeholder:`-p
|
|
46
|
-
{port}`},null,8,[`modelValue`]),H(AR,{modelValue:u.env,"onUpdate:modelValue":t[6]||=e=>u.env=e,label:`Environment`,rows:3,hint:`KEY=value per line, exported to the process.`,placeholder:`NODE_ENV=production`},null,8,[`modelValue`]),H(AR,{modelValue:u.dataEnvs,"onUpdate:modelValue":t[7]||=e=>u.dataEnvs=e,label:`Data envs`,rows:3,hint:`ENV=path per line — exported to the process and backed up automatically.`,placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`]),H(AR,{modelValue:u.backupPaths,"onUpdate:modelValue":t[8]||=e=>u.backupPaths=e,label:`Extra backup paths`,rows:2,hint:`One per line, placeholders allowed; data envs are captured already.`,placeholder:`{home}/.app/uploads`},null,8,[`modelValue`]),H(mR,{modelValue:u.backupIgnoreGenerated,"onUpdate:modelValue":t[9]||=e=>u.backupIgnoreGenerated=e,label:`Ignore known generated files when backing this up`,hint:`Skips node_modules, dist, .next and the other caches nothing restores from.`,wide:``},null,8,[`modelValue`]),H(dR,{modelValue:u.dependsOn,"onUpdate:modelValue":t[10]||=e=>u.dependsOn=e,label:`Depends on`,placeholder:`postgres, redis`,hint:`Comma separated; started first and waited for until healthy, stopped last.`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(eR,{modelValue:u.maxRssMb,"onUpdate:modelValue":t[11]||=e=>u.maxRssMb=e,label:`Max RSS (MB)`,min:0,hint:`Restart above this; blank or 0 disables it.`},null,8,[`modelValue`])]),_:1}),H(UL,{title:`Port & binding`,description:`How the port is preflighted and where the process is reachable.`,columns:2},{default:M(()=>[H(eR,{modelValue:u.port,"onUpdate:modelValue":t[12]||=e=>u.port=e,label:`Port`,nullable:``,min:1,max:65535,hint:`Blank means the server has no port to probe or preflight.`},null,8,[`modelValue`]),H(oR,{modelValue:u.bind,"onUpdate:modelValue":t[13]||=e=>u.bind=e,label:`Bind address`,options:m.value,hint:`A custom IPv4 the config already sets stays selectable.`},null,8,[`modelValue`,`options`]),H(oR,{modelValue:u.onPortConflict,"onUpdate:modelValue":t[14]||=e=>u.onPortConflict=e,label:`On port conflict`,options:[{value:`block`,label:`block — refuse to start`},{value:`warn`,label:`warn — start anyway`},{value:`follow`,label:`follow — adopt a detached restart of itself`},{value:`reclaim`,label:`reclaim — replace it with a supervised copy`},{value:`kill`,label:`kill — stop whatever holds the port`}]},null,8,[`modelValue`]),H(eR,{modelValue:u.logBufferLines,"onUpdate:modelValue":t[15]||=e=>u.logBufferLines=e,label:`Log buffer lines`,min:50,max:1e5,step:50},null,8,[`modelValue`])]),_:1}),H(UL,{title:`Lifecycle`,description:`Whether the supervisor owns this entry at all.`,columns:3},{default:M(()=>[H(mR,{modelValue:u.enabled,"onUpdate:modelValue":t[16]||=e=>u.enabled=e,label:`Enabled`,hint:`Off keeps the entry in the config but refuses to start it.`},null,8,[`modelValue`]),H(mR,{modelValue:u.autostart,"onUpdate:modelValue":t[17]||=e=>u.autostart=e,label:`Autostart with up`,hint:`Start it whenever the control plane comes up.`},null,8,[`modelValue`]),H(mR,{modelValue:u.persistent,"onUpdate:modelValue":t[18]||=e=>u.persistent=e,label:`Persistent`,hint:"Keeps running when the panel stops; `down` reports it instead of stopping it."},null,8,[`modelValue`])]),_:1}),H(hR,{restart:d.value,"onUpdate:restart":t[19]||=e=>d.value=e,health:f.value,"onUpdate:health":t[20]||=e=>f.value=e,stop:p.value,"onUpdate:stop":t[21]||=e=>p.value=e},null,8,[`restart`,`health`,`stop`]),H(UL,{title:`Bootstrap`,description:`A one-off command run before the first start — installs, migrations, downloads.`,columns:2},{default:M(()=>[H(mR,{modelValue:u.bootstrapEnabled,"onUpdate:modelValue":t[22]||=e=>u.bootstrapEnabled=e,label:`Run a bootstrap`,hint:`Off means the entry has none and the key is sent as null.`,wide:``},null,8,[`modelValue`]),u.bootstrapEnabled?(R(),z(L,{key:0},[H(dR,{modelValue:u.bootstrapCommand,"onUpdate:modelValue":t[23]||=e=>u.bootstrapCommand=e,label:`Command`,placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`]),H(eR,{modelValue:u.bootstrapTimeoutMs,"onUpdate:modelValue":t[24]||=e=>u.bootstrapTimeoutMs=e,label:`Timeout (ms)`,min:1e3,step:1e3},null,8,[`modelValue`]),H(mR,{modelValue:u.bootstrapRunOnce,"onUpdate:modelValue":t[25]||=e=>u.bootstrapRunOnce=e,label:`Only once per session`,hint:`Off means every start re-runs it.`},null,8,[`modelValue`])],64)):W(``,!0),u.bootstrapEnabled?(R(),B(AR,{key:1,modelValue:u.bootstrapArgs,"onUpdate:modelValue":t[26]||=e=>u.bootstrapArgs=e,label:`Bootstrap arguments`,rows:2,hint:`One per line; same placeholders as the main arguments.`},null,8,[`modelValue`])):W(``,!0),u.bootstrapEnabled?(R(),B(AR,{key:2,modelValue:u.bootstrapEnv,"onUpdate:modelValue":t[27]||=e=>u.bootstrapEnv=e,label:`Bootstrap environment`,rows:2,hint:`KEY=value per line, exported to the bootstrap process only.`},null,8,[`modelValue`])):W(``,!0)]),_:1})]),s.value?(R(),z(`p`,jJ,k(s.value),1)):W(``,!0),V(`div`,MJ,[H($,{variant:`ghost`,onClick:t[28]||=e=>r(`cancel`)},{default:M(()=>[...t[33]||=[U(` Cancel `,-1)]]),_:1}),H($,{type:`submit`,variant:`primary`,disabled:o.value||!x.value,loading:o.value},{default:M(()=>[...t[34]||=[U(` Save to servers.config.json `,-1)]]),_:1},8,[`disabled`,`loading`])])],32),H(ER,{open:C.value,"onUpdate:open":t[31]||=e=>C.value=e,title:`Unsaved changes`,description:`What Save would write to servers.config.json.`,width:`w-[min(92vw,42rem)]`},{footer:M(()=>[H($,{size:`sm`,variant:`ghost`,onClick:t[29]||=e=>C.value=!1},{default:M(()=>[...t[36]||=[U(` Close `,-1)]]),_:1}),H($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||o.value,loading:o.value,onClick:t[30]||=e=>{E(),C.value=!1}},{default:M(()=>[U(` Save `+k(S.value.length)+` change`+k(S.value.length===1?``:`s`),1)]),_:1},8,[`disabled`,`loading`])]),default:M(()=>[V(`div`,NJ,[S.value.length>0?(R(),z(`ul`,PJ,[(R(!0),z(L,null,F(S.value,e=>(R(),z(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[V(`code`,FJ,k(e.path),1),V(`span`,IJ,k(j(hI)(e.from)),1),t[35]||=V(`span`,{class:`text-2xs text-faint`},`→`,-1),V(`span`,LJ,k(j(hI)(e.to)),1)]))),128))])):(R(),z(`p`,RJ,` Nothing to save. `))])]),_:1},8,[`open`])],64))}}),BJ={key:0,class:`mx-auto max-w-3xl p-4 sm:p-5`},VJ={key:1,class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},HJ={class:`font-mono text-xs text-faint`},UJ=[`href`],WJ={class:`px-2 py-1.5`},GJ={class:`flex flex-col gap-0.5`},KJ=[`onClick`],qJ={class:`space-y-2`},JJ={key:0,class:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-danger/25 bg-danger-soft px-3 py-2`},YJ={class:`min-w-0 flex-1 text-2xs leading-4 text-danger`},XJ={key:1,class:`rounded-control border border-warn/25 bg-warn-soft px-3 py-2 text-2xs leading-4 text-warn`},ZJ={class:`grid grid-cols-2 gap-x-4 gap-y-3 p-4 sm:grid-cols-4 lg:grid-cols-6`},QJ={class:`truncate text-2xs text-faint`},$J={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},eY={class:`grid gap-4 sm:grid-cols-3`},tY={class:`flex items-center justify-between gap-3`},nY=[`title`],rY={key:1,class:`space-y-4`},iY={key:0,class:`max-h-96 overflow-auto rounded-control border border-line bg-page/60 p-3 font-mono text-2xs leading-5 text-muted`},aY={key:1,class:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`},oY={class:`text-2xs text-faint`},sY=[`title`],cY={key:2,class:`grid gap-4 lg:grid-cols-3`},lY={key:0,class:`flex flex-wrap gap-1.5`},uY={key:1,class:`text-xs text-muted`},dY=P({__name:`ServerDetailView`,setup(e){let t=Rg(),n=KN(),r=sP(),i=G(()=>String(t.params.id??``));N([i,()=>n.appState.value],()=>{let e=i.value;if(e.length===0||r.serverById(e)!==void 0)return;let t=n.workspaces.value.filter(t=>t.servers.some(t=>t.id===e));t.length===1&&r.select(t[0].id)},{immediate:!0});let a=G(()=>r.serverById(i.value)),o=G(()=>a.value?.config),s=G(()=>{let e=o.value;return e?.label&&e.label.length>0?e.label:i.value}),c=A(`output`),l=A(!1),u=A(!1),d=A(!1),f=A(!1),p=GN(r.activeId,()=>a.value?i.value:null),m=p.version,h=G(()=>(m.value,p.lines())),g=G(()=>r.seriesOf(i.value)),_=n.now,v=G(()=>a.value?IR(a.value,LR()):null),y=G(()=>g.value.cpu),b=G(()=>g.value.rss),x=G(()=>g.value.probe),S=G(()=>{let e=a.value;return!e||e.startedAt===null||e.status!==`running`?`—`:sI(_.value-e.startedAt)}),C=G(()=>a.value?.status===`running`),w=G(()=>{let e=a.value;if(!e)return[];let t=[{key:`pid`,label:`PID`,value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:`Uptime`,value:S.value},{key:`status`,label:`Status`,value:e.status},{key:`health`,label:`Health`,value:e.health},{key:`port`,label:`Port state`,value:e.portState},{key:`probe`,label:`Last probe`,value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:`RSS`,value:pI(e.resources?.rssBytes??null)},{key:`procs`,label:`Processes`,value:e.resources?String(e.resources.processes):`—`},{key:`restarts`,label:`Restarts`,value:`${e.restarts}/${e.maxRetries}`},{key:`up24`,label:`24h uptime`,value:oI(e.history.uptimeRatio)},{key:`crashes`,label:`24h crashes`,value:String(e.history.crashes)},{key:`lastcrash`,label:`Last crash`,value:lI(e.history.lastCrashAt,_.value)}];return e.nextRetryAt!==null&&t.push({key:`retry`,label:`Next attempt`,value:cI(e.nextRetryAt,_.value)}),e.unhealthySince!==null&&t.push({key:`unhealthy`,label:`Unhealthy for`,value:sI(_.value-e.unhealthySince)}),t}),T=G(()=>JSON.stringify(o.value??{},null,2)),ee=G(()=>o.value?`${o.value.command} ${o.value.args.join(` `)}`.trim():``),E=G(()=>{let e=o.value?.bind??`local`,t=[{value:`local`,label:`127.0.0.1 — this machine only`},{value:`lan`,label:`0.0.0.0 — every interface`}];return e!==`local`&&e!==`lan`&&t.push({value:e,label:`${e} — custom`}),t});async function te(e){f.value=!0;try{await n[e](r.activeId.value,i.value)}finally{f.value=!1}}async function ne(){d.value=!1,await r.removeServer(i.value)}async function re(){let e=a.value;if(e){f.value=!0;try{await r.freePort(e.id)}finally{f.value=!1}}}let ie=G(()=>RM(r.activeId.value,i.value,`${i.value}.log`)),ae=[{value:`output`,label:`Live output`},{value:`config`,label:`Configuration`},{value:`history`,label:`History`}];return(e,t)=>{let n=fa(`RouterLink`);return a.value?(R(),z(`div`,VJ,[H(Hz,{title:s.value,"back-to":j(XX)(j(r).activeId.value,`servers`),"back-label":`All servers`},{badges:M(()=>[H(sz,{status:a.value.status,health:a.value.health},null,8,[`status`,`health`]),a.value.adopted?(R(),B(cz,{key:0,label:`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`},{default:M(()=>[...t[16]||=[V(`span`,{class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},`detached`,-1)]]),_:1})):W(``,!0),a.value.config.persistent?(R(),B(cz,{key:1,label:"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only Stop does."},{default:M(()=>[...t[17]||=[V(`span`,{class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},`persistent`,-1)]]),_:1})):W(``,!0),V(`span`,HJ,k(a.value.id),1),v.value?(R(),z(`a`,{key:2,href:v.value,target:`_blank`,rel:`noreferrer`,class:`inline-flex items-center gap-1 font-mono text-xs text-accent hover:underline`},[U(k(v.value)+` `,1),H(j(Xv),{class:`size-3`})],8,UJ)):W(``,!0)]),actions:M(()=>[H($,{variant:`primary`,disabled:f.value||!o.value?.enabled||[`running`,`starting`].includes(a.value.status),onClick:t[0]||=e=>te(`start`)},{default:M(()=>[H(j(gy),{class:`size-3.5`}),t[18]||=U(`Start `,-1)]),_:1},8,[`disabled`]),H($,{disabled:f.value||a.value.status===`stopped`,onClick:t[1]||=e=>te(`stop`)},{default:M(()=>[H(j(Ay),{class:`size-3.5`}),t[19]||=U(`Stop `,-1)]),_:1},8,[`disabled`]),H($,{disabled:f.value||!o.value?.enabled,onClick:t[2]||=e=>te(`restart`)},{default:M(()=>[H(j(xy),{class:`size-3.5`}),t[20]||=U(`Restart `,-1)]),_:1},8,[`disabled`]),H(cz,{label:`Edit every field of this entry`},{default:M(()=>[H($,{variant:l.value?`secondary`:`ghost`,onClick:t[3]||=e=>{l.value=!l.value,c.value=`config`}},{default:M(()=>[H(j(hy),{class:`size-3.5`}),U(k(l.value?`Close editor`:`Edit`),1)]),_:1},8,[`variant`])]),_:1}),H(j($h),null,{default:M(()=>[H(j(ig),{"as-child":``},{default:M(()=>[H($,{variant:`ghost`,size:`icon-sm`,"aria-label":`More actions for ${s.value}`},{default:M(()=>[H(j(Yv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),H(j(ng),null,{default:M(()=>[H(j(eg),{"side-offset":4,align:`end`,class:`z-50 min-w-56 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[4]||=e=>j(r).setEnabled(a.value.id,!a.value.config.enabled)},{default:M(()=>[U(k(o.value?.enabled?`Disable server`:`Enable server`),1)]),_:1}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[5]||=e=>j(r).setAutostart(a.value.id,!a.value.config.autostart)},{default:M(()=>[U(k(o.value?.autostart?`Remove from autostart`:`Autostart with the panel`),1)]),_:1}),H(j(rg),{class:`my-1 h-px bg-line`}),V(`div`,WJ,[t[21]||=V(`p`,{class:`mb-1 text-2xs text-faint`},` Bind `,-1),V(`div`,GJ,[(R(!0),z(L,null,F(E.value,e=>(R(),z(`button`,{key:e.value,type:`button`,class:O([`rounded-control px-2 py-1 text-left font-mono text-2xs transition-colors duration-150 hover:bg-hover`,e.value===o.value?.bind?`text-accent`:`text-muted`]),onClick:t=>j(r).setBind(a.value.id,e.value)},k(e.label),11,KJ))),128))])]),H(j(rg),{class:`my-1 h-px bg-line`}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:t[6]||=e=>d.value=!0},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),t[22]||=U(` Remove server `,-1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,[`title`,`back-to`]),V(`div`,qJ,[a.value.lastError?(R(),z(`div`,JJ,[V(`p`,YJ,k(a.value.lastError),1),a.value.status===`conflict`&&a.value.config.port!==null?(R(),B(BR,{key:0,port:a.value.config.port,busy:f.value,onConfirm:re},null,8,[`port`,`busy`])):W(``,!0)])):W(``,!0),a.value.health===`unhealthy`?(R(),z(`p`,XJ,[t[23]||=U(` The health probe has not passed `,-1),a.value.unhealthySince===null?W(``,!0):(R(),z(L,{key:0},[U(` for `+k(j(sI)(j(_)-a.value.unhealthySince)),1)],64)),t[24]||=U(`. `,-1)])):W(``,!0)]),H(Kz,{class:`p-0`},{default:M(()=>[V(`dl`,ZJ,[(R(!0),z(L,null,F(w.value,e=>(R(),z(`div`,{key:e.key,class:`min-w-0`},[V(`dt`,QJ,k(e.label),1),V(`dd`,$J,k(e.value),1)]))),128))])]),_:1}),H(Kz,null,{header:M(()=>[...t[25]||=[V(`h2`,{class:`text-sm font-semibold text-ink`},` Telemetry `,-1),V(`p`,{class:`text-2xs text-muted`},` Sampled every 5 s while this page is open. `,-1)]]),default:M(()=>[V(`div`,eY,[H(rz,{label:`CPU`,values:y.value,format:j(mI),max:100,"color-class":`text-cpu`,height:40},null,8,[`values`,`format`]),H(rz,{label:`Memory (RSS)`,values:b.value,format:j(pI),"color-class":`text-mem`,height:40},null,8,[`values`,`format`]),H(rz,{label:`Health probe`,values:x.value,format:e=>e===null?`—`:`${e} ms`,"color-class":`text-probe`,height:40},null,8,[`values`,`format`])])]),_:1}),V(`div`,tY,[H(CH,{modelValue:c.value,"onUpdate:modelValue":t[7]||=e=>c.value=e,options:ae,size:`md`},null,8,[`modelValue`]),V(`p`,{class:`hidden font-mono text-2xs text-faint sm:block`,title:ee.value},k(ee.value),9,nY)]),c.value===`output`?(R(),B(WW,{key:0,lines:h.value,version:j(m),live:``,clearable:``,"download-url":a.value.config.logBufferLines>0?ie.value:void 0,"download-name":`${a.value.id}.log`,"empty-hint":C.value?`Waiting for the first line…`:`This server has not written anything yet.`,"min-height":`22rem`,onClear:t[8]||=e=>j(r).clearLogs(a.value.id)},null,8,[`lines`,`version`,`download-url`,`download-name`,`empty-hint`])):c.value===`config`?(R(),z(`div`,rY,[l.value?(R(),B(zJ,{key:0,"server-id":a.value.id,"workspace-id":j(r).activeId.value,config:a.value.config,onSaved:t[9]||=e=>l.value=!1,onCancel:t[10]||=e=>l.value=!1},null,8,[`server-id`,`workspace-id`,`config`])):(R(),B(Kz,{key:1},{header:M(()=>[...t[26]||=[V(`h2`,{class:`text-sm font-semibold text-ink`},` Effective configuration `,-1),V(`p`,{class:`text-2xs text-muted`},` Defaults from Settings are already merged into these values. `,-1)]]),actions:M(()=>[H($,{size:`xs`,variant:`ghost`,onClick:t[11]||=e=>u.value=!u.value},{default:M(()=>[H(j(Wv),{class:`size-3`}),U(k(u.value?`Fields`:`Raw JSON`),1)]),_:1}),H(kV,{value:T.value,label:`Copy the JSON config`},null,8,[`value`]),H($,{size:`xs`,variant:`primary`,onClick:t[12]||=e=>l.value=!0},{default:M(()=>[H(j(hy),{class:`size-3`}),t[27]||=U(`Edit `,-1)]),_:1})]),default:M(()=>[u.value?(R(),z(`pre`,iY,k(T.value),1)):(R(),z(`dl`,aY,[(R(!0),z(L,null,F([{label:`command`,value:o.value?.command},{label:`args`,value:o.value?.args.join(` `)||`—`},{label:`cwd`,value:o.value?.cwd},{label:`env`,value:Object.keys(o.value?.env??{}).join(`, `)||`—`},{label:`data envs`,value:Object.entries(o.value?.dataEnvs??{}).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`},{label:`env file`,value:o.value?.envFile||`—`},{label:`port · bind`,value:`${o.value?.port??`none`} · ${o.value?.bind}`},{label:`on port conflict`,value:o.value?.onPortConflict},{label:`log buffer`,value:`${o.value?.logBufferLines} lines`},{label:`rtss limit`,value:o.value?.resources.maxRssBytes?j(pI)(o.value.resources.maxRssBytes):`none`},{label:`health`,value:o.value?.health.enabled?`${o.value.health.mode} every ${o.value.health.intervalMs} ms`:`off`},{label:`restart`,value:o.value?.restart.enabled?`${o.value.restart.maxRetries} retries, ×${o.value.restart.factor}`:`off`},{label:`stop`,value:o.value?`${o.value.stop.signal} after ${o.value.stop.graceMs} ms`:`—`},{label:`bootstrap`,value:o.value?.bootstrap?`${o.value.bootstrap.command} ${o.value.bootstrap.args.join(` `)}`:`none`},{label:`backup paths`,value:o.value?.backupPaths.join(`, `)||`—`},{label:`depends on`,value:o.value?.dependsOn.join(`, `)||`—`}],e=>(R(),z(`div`,{key:e.label,class:`min-w-0 border-b border-line-soft pb-1.5 last:border-0`},[V(`dt`,oY,k(e.label),1),V(`dd`,{class:`truncate font-mono text-xs text-ink`,title:String(e.value)},k(e.value),9,sY)]))),128))]))]),_:1}))])):(R(),z(`div`,cY,[H(Kz,{class:`lg:col-span-2`},{header:M(()=>[...t[28]||=[V(`h2`,{class:`text-sm font-semibold text-ink`},` Event history `,-1),V(`p`,{class:`text-2xs text-muted`},` Kept by the panel for 24 hours. `,-1)]]),default:M(()=>[H(BI,{servers:[a.value],now:j(_),limit:30},null,8,[`servers`,`now`])]),_:1}),H(Kz,null,{header:M(()=>[...t[29]||=[V(`h2`,{class:`text-sm font-semibold text-ink`},` Dependencies `,-1)]]),default:M(()=>[o.value&&o.value.dependsOn.length>0?(R(),z(`div`,lY,[(R(!0),z(L,null,F(o.value.dependsOn,e=>(R(),B(n,{key:e,to:`/servers/${e}`,class:`rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},{default:M(()=>[U(k(e),1)]),_:2},1032,[`to`]))),128))])):(R(),z(`p`,uY,[...t[30]||=[U(` Starts on its own. Add ids under `,-1),V(`code`,null,`dependsOn`,-1),U(` to order it after other servers. `,-1)]]))]),_:1})])),H(ER,{open:d.value,"onUpdate:open":t[14]||=e=>d.value=e,title:`Remove this server?`,description:`${s.value} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,width:`w-[min(92vw,26rem)]`},{footer:M(()=>[H($,{variant:`ghost`,onClick:t[13]||=e=>d.value=!1},{default:M(()=>[...t[31]||=[U(` Keep it `,-1)]]),_:1}),H($,{variant:`danger`,onClick:ne},{default:M(()=>[H(j(Fy),{class:`size-3.5`}),t[32]||=U(`Remove `,-1)]),_:1})]),default:M(()=>[t[33]||=V(`p`,{class:`text-xs text-muted`},` This cannot be undone from the panel — the entry has to be added back by hand or from a backup. `,-1)]),_:1},8,[`open`,`description`])])):(R(),z(`div`,BJ,[H(aI,{title:`That server is gone`,description:`${i.value} is not in servers.config.json any more. It may have been removed from another tab.`},{action:M(()=>[H(n,{to:j(XX)(j(r).activeId.value,`servers`)},{default:M(()=>[H($,{variant:`primary`},{default:M(()=>[...t[15]||=[U(` Back to servers `,-1)]]),_:1})]),_:1},8,[`to`])]),_:1},8,[`description`])]))}}}),fY={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},pY={class:`flex flex-wrap items-center gap-2`},mY={class:`relative ml-auto w-full sm:w-64`},hY={key:0,class:`grid gap-4 lg:grid-cols-2`},gY={key:3,class:`grid gap-4 lg:grid-cols-2`},_Y=P({__name:`ServersView`,setup(e){let t=KN(),n=sP(),{servers:r}=n,i=A(!1),a=A(``),o=A(`all`),s=[{value:`all`,label:`All`},{value:`running`,label:`Running`},{value:`stopped`,label:`Stopped`},{value:`attention`,label:`Attention`},{value:`disabled`,label:`Disabled`}],c=G(()=>t.appState.value===null),l=G(()=>{let e=a.value.trim().toLowerCase();return r.value.filter(t=>o.value===`running`&&t.status!==`running`||o.value===`stopped`&&![`stopped`,`stopping`].includes(t.status)||o.value===`disabled`&&t.config.enabled||o.value===`attention`&&t.status!==`crashed`&&t.status!==`conflict`&&t.health!==`unhealthy`?!1:e.length===0||`${t.id} ${t.config.label??``} ${t.config.command} ${t.config.port??``}`.toLowerCase().includes(e))}),u=G(()=>({all:r.value.length,running:r.value.filter(e=>e.status===`running`).length,attention:r.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`).length}));return(e,d)=>(R(),z(`div`,fY,[H(Hz,{title:`Servers`,description:`Every entry in ${j(n).selected.value?.label??`this workspace`}'s servers.config.json, with live resources, health and history.`},{actions:M(()=>[H($,{variant:`ghost`,onClick:d[0]||=e=>j(n).startAll()},{default:M(()=>[H(j(gy),{class:`size-3.5`}),d[9]||=U(`Start all `,-1)]),_:1}),H($,{variant:`ghost`,onClick:d[1]||=e=>j(n).stopAll()},{default:M(()=>[H(j(Ay),{class:`size-3.5`}),d[10]||=U(`Stop all `,-1)]),_:1}),H($,{variant:`primary`,onClick:d[2]||=e=>i.value=!0},{default:M(()=>[H(j(_y),{class:`size-3.5`}),d[11]||=U(`Add server `,-1)]),_:1})]),_:1},8,[`description`]),V(`div`,pY,[H(CH,{modelValue:o.value,"onUpdate:modelValue":d[3]||=e=>o.value=e,options:s.map(e=>({...e,label:`${e.label}${e.value===`all`?` ${u.value.all}`:e.value===`running`?` ${u.value.running}`:e.value===`attention`&&u.value.attention>0?` ${u.value.attention}`:``}`}))},null,8,[`modelValue`,`options`]),V(`div`,mY,[H(j(Cy),{class:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),xr(V(`input`,{"onUpdate:modelValue":d[4]||=e=>a.value=e,type:`search`,placeholder:`Filter by id, label, command or port`,class:O([`pl-8`,[j(YL)]]),"aria-label":`Filter servers`},null,2),[[ql,a.value]]),a.value.length>0?(R(),z(`button`,{key:0,type:`button`,class:`absolute right-1.5 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-control text-faint hover:text-ink`,"aria-label":`Clear the filter`,onClick:d[5]||=e=>a.value=``},[H(j(Ry),{class:`size-3.5`})])):W(``,!0)])]),c.value?(R(),z(`div`,hY,[(R(),z(L,null,F(4,e=>H(qz,{key:e,class:`h-72 w-full`,rounded:`rounded-panel`})),64))])):j(r).length===0?(R(),B(aI,{key:1,title:`No servers configured`,description:`Add the first process this panel should supervise. Its command, args, env and working directory all live in the config file.`},{icon:M(()=>[H(j(wy),{class:`size-4`})]),action:M(()=>[H($,{variant:`primary`,onClick:d[6]||=e=>i.value=!0},{default:M(()=>[H(j(_y),{class:`size-3.5`}),d[12]||=U(`Add a server `,-1)]),_:1})]),_:1})):l.value.length===0?(R(),B(aI,{key:2,compact:``,title:`Nothing matches that filter`,description:`Try a different status or clear the search.`},{action:M(()=>[H($,{onClick:d[7]||=e=>{a.value=``,o.value=`all`}},{default:M(()=>[...d[13]||=[U(` Clear filters `,-1)]]),_:1})]),_:1})):(R(),z(`div`,gY,[(R(!0),z(L,null,F(l.value,e=>(R(),B(Fz,{key:e.id,server:e,"workspace-id":j(n).activeId.value,series:j(n).seriesOf(e.id),now:j(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))])),H(PR,{open:i.value,"onUpdate:open":d[8]||=e=>i.value=e,"workspace-id":j(n).activeId.value},null,8,[`open`,`workspace-id`])]))}}),vY=0;function yY(){return vY+=1,`ddns-row-${vY}`}function bY(){return yY()}function xY(e){let t=structuredClone(un(e));return t.domains=(t.domains??[]).map(e=>({...e,key:e.key??yY()})),t}function SY(e){let t=structuredClone(un(e));return{...t,domains:t.domains.map(({key:e,...t})=>t)}}function CY(e,t){return e===null||t===null?e===t:JSON.stringify(SY(e))===JSON.stringify(SY(t))}var wY={intervalMs:3e5,ttl:1};function TY(e,t){return e===null||Number.isNaN(e)?wY[t]:e}var EY={class:`space-y-3`},DY={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},OY={key:0,class:`divide-y divide-line-soft`},kY={class:`min-w-0`},AY={class:`font-mono text-xs text-ink`},jY={class:`text-2xs text-faint`},MY={key:0},NY={class:`ml-auto flex items-center gap-2`},PY={key:1,class:`text-2xs text-muted`},FY={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},IY={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},LY={key:0,class:`space-y-2`},RY={class:`flex flex-wrap items-end gap-2`},zY={class:`min-w-40 flex-1`},BY={class:`w-44 shrink-0`},VY={class:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1`},HY={key:1,class:`text-2xs text-muted`},UY={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},WY={key:1,class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},GY={class:`mb-2 flex flex-wrap items-center gap-x-3 gap-y-1`},KY={key:0,class:`text-2xs text-muted`},qY={key:1,class:`font-mono text-2xs text-faint`},JY={key:2,class:`font-mono text-2xs text-faint`},YY={key:3,class:`ml-auto text-2xs text-faint`},XY={class:`overflow-x-auto`},ZY={class:`w-full text-left text-xs`},QY={class:`py-1.5 pr-3 font-mono text-2xs text-ink`},$Y={class:`py-1.5 pr-3 text-2xs text-muted`},eX={class:`py-1.5 pr-3`},tX={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},nX={class:`py-1.5 text-2xs text-faint`},rX={class:`space-y-3`},iX=[`href`],aX=P({__name:`DdnsSection`,props:{patch:{default:null},patchModifiers:{},baseline:{default:null},baselineModifiers:{}},emits:[`update:patch`,`update:baseline`],setup(e,{expose:t}){let n=oo(e,`patch`),r=oo(e,`baseline`),i={pending:{label:`Waiting`,tone:`neutral`},ok:{label:`Updated`,tone:`ok`},unchanged:{label:`Current`,tone:`neutral`},skipped:{label:`Skipped`,tone:`warn`},error:{label:`Failed`,tone:`danger`}},a=KN(),o=sP(),s=mN(),c=A(null),l=A(null),u=A(null),d=A(null),f=A(!1),p=en({id:``,provider:`cloudflare`}),m=en({host:``,account:``}),h=A(null),g=A({}),_=A(!1),v=A(null),y=G(()=>c.value?.providers??[]),b=G(()=>l.value?.accounts??[]),x=G(()=>l.value?.domains??[]),S=G(()=>b.value.map(e=>e.id).join(`,`)),C=G(()=>y.value.map(e=>({value:e.id,label:e.label}))),w=G(()=>b.value.map(e=>({value:e.id,label:e.id}))),T=G(()=>o.selected.value?.ddns??c.value?.status??null),ee=G(()=>l.value!==null&&r.value!==null&&!CY(l.value,r.value)),E=G(()=>/^[a-z0-9][a-z0-9_-]*$/.test(p.id)&&!b.value.some(e=>e.id===p.id)),te=G(()=>m.host.includes(`.`)&&m.account.length>0&&!x.value.some(e=>e.host.toLowerCase()===m.host.trim().toLowerCase())),ne=G({get:()=>h.value!==null,set:e=>{e||(h.value=null)}}),re=G(()=>h.value===null?[]:ie(h.value.provider)?.fields??[]);function ie(e){return y.value.find(t=>t.id===e)??null}function ae(e){let t=b.value.find(t=>t.id===e.account);return t===void 0?null:ie(t.provider)}function oe(e){return ie(e.provider)?.label??e.provider}function se(e){return c.value?.credentials.includes(e)===!0}function ce(e){return x.value.filter(t=>t.account===e).length}function D(e,t,n){let r=n?[...new Set([...e.types,t])]:e.types.filter(e=>e!==t);e.types=r.length>0?r:e.types}function le(e,t,n){n==null||n===``?delete e[t]:e[t]=n}function ue(e,t,n){e!==null&&(e[t]=TY(n,t))}function de(){n.value=l.value===null||r.value===null||CY(l.value,r.value)?null:SY(l.value)}function fe(e,t=!1){c.value=e,r.value=xY(e.config),t||(l.value=xY(e.config)),de()}async function pe(){u.value=null;try{fe(await GM(o.activeId.value)),p.provider=C.value[0]?.value??`cloudflare`,m.account=b.value[0]?.id??``}catch(e){u.value=e instanceof Error?e.message:String(e)}}ta(()=>{pe()}),N(()=>o.activeId.value,(e,t)=>{e!==t&&e.length>0&&pe()}),N(l,de,{deep:!0}),N(S,()=>{b.value.some(e=>e.id===m.account)||(m.account=b.value[0]?.id??``)});function me(){E.value&&l.value!==null&&(l.value.accounts.push({id:p.id,provider:p.provider,label:``}),p.id=``)}function he(e){l.value===null||ce(e.id)>0||(l.value.accounts=l.value.accounts.filter(t=>t.id!==e.id))}function ge(){te.value&&l.value!==null&&(l.value.domains.push({host:m.host.trim().toLowerCase(),account:m.account,types:[`A`],proxied:!1,enabled:!0,key:bY()}),m.host=``)}function _e(e){l.value!==null&&(l.value.domains=l.value.domains.filter(t=>t!==e))}function ve(){r.value!==null&&(l.value=xY(r.value)),d.value=null}async function ye(){if(!f.value){f.value=!0,d.value=null;try{fe(await YM(o.activeId.value),!0),s.success(T.value?.lastResult??`Dynamic DNS pass finished`)}catch(e){d.value=e instanceof Error?e.message:String(e)}finally{f.value=!1}}}function be(e){h.value=e,g.value=Object.fromEntries((ie(e.provider)?.fields??[]).map(e=>[e.key,``])),v.value=null}async function O(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{fe(await qM(o.activeId.value,e.id,e.provider,g.value),!0),s.success(`Credentials saved for ${e.id}`),h.value=null}catch(e){v.value=e instanceof Error?e.message:String(e)}finally{_.value=!1}}}async function xe(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{fe(await JM(o.activeId.value,e.id),!0),s.success(`Credentials removed for ${e.id}`),h.value=null}catch(e){v.value=e instanceof Error?e.message:String(e)}finally{_.value=!1}}}return t({reload:pe}),(e,t)=>(R(),z(L,null,[V(`div`,EY,[u.value?(R(),B(FB,{key:0,tone:`danger`,title:`Dynamic DNS settings could not be loaded`},{default:M(()=>[U(k(u.value),1)]),_:1})):W(``,!0),l.value===null?W(``,!0):(R(),z(L,{key:1},[H(UL,{title:`Dynamic DNS`,description:`Keep these hostnames pointed at this machine's public address. Credentials live in the secrets file, never in servers.config.json.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!ee.value,onClick:ve},{default:M(()=>[...t[11]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`]),T.value?.running?(R(),B(jV,{key:0,tone:`info`,dot:``},{default:M(()=>[...t[12]||=[U(` checking `,-1)]]),_:1})):T.value?.enabled?(R(),B(jV,{key:1,tone:T.value.records.some(e=>e.state===`error`)?`danger`:`ok`,dot:``},{default:M(()=>[U(k(T.value.records.some(e=>e.state===`error`)?`needs attention`:`watching`),1)]),_:1},8,[`tone`])):W(``,!0),H($,{size:`xs`,variant:`ghost`,loading:f.value,onClick:ye},{default:M(()=>[...t[13]||=[U(` Update now `,-1)]]),_:1},8,[`loading`])]),default:M(()=>[H(mR,{modelValue:l.value.enabled,"onUpdate:modelValue":t[0]||=e=>l.value.enabled=e,label:`Keep dynamic DNS updated`,hint:`A pass runs on the interval below; a provider is only called when the address actually changed.`,wide:``},null,8,[`modelValue`]),H(eR,{"model-value":l.value.intervalMs,label:`Check every (ms)`,min:6e4,step:6e4,hint:`60000 is one minute; the default is five.`,"onUpdate:modelValue":t[1]||=e=>ue(l.value,`intervalMs`,e)},null,8,[`model-value`]),H(eR,{"model-value":l.value.ttl,label:`TTL (s)`,min:1,hint:`1 means automatic where the provider supports it.`,"onUpdate:modelValue":t[2]||=e=>ue(l.value,`ttl`,e)},null,8,[`model-value`]),H(mR,{modelValue:l.value.ipv4.enabled,"onUpdate:modelValue":t[3]||=e=>l.value.ipv4.enabled=e,label:`Detect IPv4`,hint:`Needed for A records.`},null,8,[`modelValue`]),H(mR,{modelValue:l.value.ipv6.enabled,"onUpdate:modelValue":t[4]||=e=>l.value.ipv6.enabled=e,label:`Detect IPv6`,hint:`Needed for AAAA records.`},null,8,[`modelValue`])]),_:1}),d.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(d.value),1)]),_:1})):W(``,!0),V(`section`,DY,[t[17]||=V(`header`,{class:`mb-3`},[V(`h3`,{class:`text-xs font-semibold text-ink`},` Provider accounts `),V(`p`,{class:`mt-0.5 text-2xs leading-4 text-muted`},` One entry per API token. Credentials are stored on the server and never come back. `)],-1),b.value.length>0?(R(),z(`ul`,OY,[(R(!0),z(L,null,F(b.value,e=>(R(),z(`li`,{key:e.id,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0`},[V(`div`,kY,[V(`p`,AY,k(e.id),1),V(`p`,jY,[U(k(oe(e))+` `,1),ce(e.id)>0?(R(),z(`span`,MY,` · `+k(ce(e.id))+` hostname`+k(ce(e.id)===1?``:`s`),1)):W(``,!0)])]),V(`div`,NY,[H(jV,{tone:se(e.id)?`ok`:`warn`,dot:``},{default:M(()=>[U(k(se(e.id)?`credentials saved`:`no credentials`),1)]),_:2},1032,[`tone`]),H($,{size:`xs`,variant:`secondary`,onClick:t=>be(e)},{default:M(()=>[...t[14]||=[U(` Credentials `,-1)]]),_:1},8,[`onClick`]),H($,{size:`xs`,variant:`danger-ghost`,disabled:ce(e.id)>0,title:ce(e.id)>0?`Remove the hostnames using this account first`:void 0,onClick:t=>he(e)},{default:M(()=>[...t[15]||=[U(` Remove `,-1)]]),_:1},8,[`disabled`,`title`,`onClick`])])]))),128))])):(R(),z(`p`,PY,` No accounts yet. Pick a provider and add one. `)),V(`div`,FY,[H(oR,{modelValue:p.provider,"onUpdate:modelValue":t[5]||=e=>p.provider=e,label:`Provider`,options:C.value},null,8,[`modelValue`,`options`]),H(dR,{modelValue:p.id,"onUpdate:modelValue":t[6]||=e=>p.id=e,label:`Account id`,placeholder:`cloudflare-home`},null,8,[`modelValue`]),H($,{variant:`secondary`,disabled:!E.value,onClick:me},{default:M(()=>[...t[16]||=[U(` Add `,-1)]]),_:1},8,[`disabled`])]),t[18]||=V(`p`,{class:`mt-1.5 text-2xs text-faint`}," The account id names the account and keys its stored credentials; lowercase letters, digits, `-` and `_`. ",-1)]),V(`section`,IY,[t[22]||=V(`header`,{class:`mb-3`},[V(`h3`,{class:`text-xs font-semibold text-ink`},` Hostnames `),V(`p`,{class:`mt-0.5 text-2xs leading-4 text-muted`},` The whole list to keep updated — suba.domain.com, domain.xyz and so on. `)],-1),x.value.length>0?(R(),z(`ul`,LY,[(R(!0),z(L,null,F(x.value,e=>(R(),z(`li`,{key:e.key,class:`rounded-control border border-line-soft bg-panel/50 p-2.5`},[V(`div`,RY,[V(`div`,zY,[H(dR,{modelValue:e.host,"onUpdate:modelValue":t=>e.host=t,label:`Hostname`},null,8,[`modelValue`,`onUpdate:modelValue`])]),V(`div`,BY,[H(oR,{modelValue:e.account,"onUpdate:modelValue":t=>e.account=t,label:`Account`,options:w.value},null,8,[`modelValue`,`onUpdate:modelValue`,`options`])]),H(XB,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:`Enabled`},null,8,[`modelValue`,`onUpdate:modelValue`]),H($,{size:`xs`,variant:`danger-ghost`,onClick:t=>_e(e)},{default:M(()=>[...t[19]||=[U(` Remove `,-1)]]),_:1},8,[`onClick`])]),V(`div`,VY,[H(XB,{"model-value":e.types.includes(`A`),label:`A (IPv4)`,"onUpdate:modelValue":t=>D(e,`A`,t===!0)},null,8,[`model-value`,`onUpdate:modelValue`]),H(XB,{"model-value":e.types.includes(`AAAA`),label:`AAAA (IPv6)`,disabled:ae(e)?.families.includes(`AAAA`)===!1,hint:ae(e)?.families.includes(`AAAA`)===!1?`This provider cannot manage AAAA records.`:void 0,"onUpdate:modelValue":t=>D(e,`AAAA`,t===!0)},null,8,[`model-value`,`disabled`,`hint`,`onUpdate:modelValue`]),ae(e)?.proxied===!0?(R(),B(XB,{key:0,modelValue:e.proxied,"onUpdate:modelValue":t=>e.proxied=t,label:`Proxied`,hint:`Cloudflare serves this record through its own network.`},null,8,[`modelValue`,`onUpdate:modelValue`])):W(``,!0),e.types.includes(`AAAA`)&&!l.value.ipv6.enabled?(R(),B(jV,{key:1,tone:`warn`},{default:M(()=>[...t[20]||=[U(` IPv6 detection is off `,-1)]]),_:1})):W(``,!0)]),H(xR,{title:`Advanced`,hint:`registered domain and TTL override`,class:`mt-2`},{default:M(()=>[H(dR,{"model-value":e.zone??``,label:`Registered domain`,placeholder:`example.co.uk`,hint:`Only when the provider has to be told the apex, e.g. three-label domains.`,"onUpdate:modelValue":t=>le(e,`zone`,t)},null,8,[`model-value`,`onUpdate:modelValue`]),ae(e)?.ttl===!1?W(``,!0):(R(),B(eR,{key:0,"model-value":e.ttl??null,min:1,nullable:``,label:`TTL override (s)`,hint:`Blank uses the value above.`,"onUpdate:modelValue":t=>le(e,`ttl`,t)},null,8,[`model-value`,`onUpdate:modelValue`]))]),_:2},1024)]))),128))])):(R(),z(`p`,HY,` No hostnames yet. `)),V(`div`,UY,[H(dR,{modelValue:m.host,"onUpdate:modelValue":t[7]||=e=>m.host=e,label:`Hostname`,placeholder:`home.example.com`},null,8,[`modelValue`]),H(oR,{modelValue:m.account,"onUpdate:modelValue":t[8]||=e=>m.account=e,label:`Account`,options:w.value,disabled:b.value.length===0},null,8,[`modelValue`,`options`,`disabled`]),H($,{variant:`secondary`,disabled:!te.value,onClick:ge},{default:M(()=>[...t[21]||=[U(` Add `,-1)]]),_:1},8,[`disabled`])])]),T.value!==null&&T.value.records.length>0?(R(),z(`section`,WY,[V(`header`,GY,[t[23]||=V(`h3`,{class:`text-xs font-semibold text-ink`},` Last pass `,-1),T.value.lastResult?(R(),z(`span`,KY,k(T.value.lastResult),1)):W(``,!0),T.value.ipv4?(R(),z(`span`,qY,`IPv4 `+k(T.value.ipv4),1)):W(``,!0),T.value.ipv6?(R(),z(`span`,JY,`IPv6 `+k(T.value.ipv6),1)):W(``,!0),T.value.lastRunAt?(R(),z(`span`,YY,k(j(lI)(T.value.lastRunAt,j(a).now.value)),1)):W(``,!0)]),V(`div`,XY,[V(`table`,ZY,[t[24]||=V(`thead`,null,[V(`tr`,{class:`text-2xs text-faint`},[V(`th`,{class:`py-1 pr-3 font-medium`},` Hostname `),V(`th`,{class:`py-1 pr-3 font-medium`},` Type `),V(`th`,{class:`py-1 pr-3 font-medium`},` State `),V(`th`,{class:`py-1 pr-3 font-medium`},` Address `),V(`th`,{class:`py-1 font-medium`},` Detail `)])],-1),V(`tbody`,null,[(R(!0),z(L,null,F(T.value.records,e=>(R(),z(`tr`,{key:`${e.host}|${e.type}`,class:`border-t border-line-soft align-top`},[V(`td`,QY,k(e.host),1),V(`td`,$Y,k(e.type),1),V(`td`,eX,[H(jV,{tone:i[e.state].tone,dot:``},{default:M(()=>[U(k(i[e.state].label),1)]),_:2},1032,[`tone`])]),V(`td`,tX,k(e.ip??`—`),1),V(`td`,nX,k(e.message??`—`),1)]))),128))])])])])):W(``,!0)],64))]),H(ER,{open:ne.value,"onUpdate:open":t[10]||=e=>ne.value=e,title:`Provider credentials`,description:h.value===null?``:`${oe(h.value)} — ${h.value.id}`,width:`w-[min(92vw,32rem)]`},{footer:M(()=>[h.value!==null&&se(h.value.id)?(R(),B(MB,{key:0,label:`Forget`,"confirm-label":`Forget them`,title:`Forget the stored credentials?`,hint:`They are removed from disk and cannot be read back; you would need to paste them again.`,loading:_.value,disabled:_.value,onConfirm:xe},null,8,[`loading`,`disabled`])):W(``,!0),H($,{size:`sm`,variant:`ghost`,disabled:_.value,onClick:t[9]||=e=>ne.value=!1},{default:M(()=>[...t[26]||=[U(` Cancel `,-1)]]),_:1},8,[`disabled`]),H($,{size:`sm`,variant:`primary`,loading:_.value,disabled:Object.values(g.value).every(e=>e.trim().length===0),onClick:O},{default:M(()=>[...t[27]||=[U(` Save credentials `,-1)]]),_:1},8,[`loading`,`disabled`])]),default:M(()=>[V(`div`,rX,[t[25]||=V(`p`,{class:`text-2xs leading-4 text-muted`},` Saved fields are never sent back. Saving replaces every field for this account and runs a pass right away. `,-1),(R(!0),z(L,null,F(re.value,e=>(R(),B(dR,{key:e.key,modelValue:g.value[e.key],"onUpdate:modelValue":t=>g.value[e.key]=t,type:`password`,autocomplete:`off`,label:e.label,hint:`${e.hint}${e.optional?` Optional.`:``}`,wide:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),h.value===null?W(``,!0):(R(),z(`a`,{key:0,class:`inline-block text-2xs text-accent underline decoration-line underline-offset-2`,href:ie(h.value.provider)?.docsUrl,target:`_blank`,rel:`noreferrer`},`Where to get these`,8,iX)),v.value?(R(),B(FB,{key:1,tone:`danger`},{default:M(()=>[U(k(v.value),1)]),_:1})):W(``,!0)])]),_:1},8,[`open`,`description`])],64))}}),oX={class:`mt-3 space-y-3`},sX=P({__name:`DefaultsSection`,props:Ra({dirty:{type:Boolean}},{defaults:{required:!0},defaultsModifiers:{}}),emits:Ra([`reset`],[`update:defaults`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`defaults`),a=TL(()=>i.value.logBufferLines,e=>i.value.logBufferLines=e,500);return(e,t)=>(R(),z(L,null,[H(UL,{title:`Server defaults`,description:`Applied to every entry that does not set its own value.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[9]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:`Enabled`,hint:`New entries start enabled.`,wide:``},null,8,[`modelValue`]),H(mR,{modelValue:i.value.autostart,"onUpdate:modelValue":t[2]||=e=>i.value.autostart=e,label:`Autostart with the panel`},null,8,[`modelValue`]),H(oR,{modelValue:i.value.bind,"onUpdate:modelValue":t[3]||=e=>i.value.bind=e,label:`Bind`,options:[{value:`local`,label:`Local — 127.0.0.1`},{value:`lan`,label:`LAN — 0.0.0.0`}]},null,8,[`modelValue`]),H(oR,{modelValue:i.value.onPortConflict,"onUpdate:modelValue":t[4]||=e=>i.value.onPortConflict=e,label:`On port conflict`,options:[{value:`block`,label:`Block the start`},{value:`warn`,label:`Warn and start anyway`},{value:`follow`,label:`Follow a detached restart of itself`},{value:`reclaim`,label:`Replace a detached restart with a supervised copy`},{value:`kill`,label:`Kill whatever holds the port`}]},null,8,[`modelValue`]),H(eR,{modelValue:j(a),"onUpdate:modelValue":t[5]||=e=>mn(a)?a.value=e:null,label:`Log buffer lines`,min:50,max:1e5,hint:`Kept in memory per server.`},null,8,[`modelValue`])]),_:1}),V(`div`,oX,[H(hR,{restart:i.value.restart,"onUpdate:restart":t[6]||=e=>i.value.restart=e,health:i.value.health,"onUpdate:health":t[7]||=e=>i.value.health=e,stop:i.value.stop,"onUpdate:stop":t[8]||=e=>i.value.stop=e},null,8,[`restart`,`health`,`stop`])])],64))}}),cX={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},lX={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},uX={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},dX={class:`text-2xs leading-4 text-faint`},fX=P({__name:`LogsSection`,props:Ra({logsDir:{},dirty:{type:Boolean}},{logs:{required:!0},logsModifiers:{}}),emits:Ra([`reset`],[`update:logs`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`logs`),a=sP(),o=TL(()=>i.value.maxBytes,e=>i.value.maxBytes=e,2e6),s=TL(()=>i.value.keep,e=>i.value.keep=e,3),c=G(()=>n.logsDir??`—`);return(e,t)=>{let l=fa(`RouterLink`);return R(),B(UL,{title:`Retention`,description:`The live view always comes from memory; these files survive a restart and feed the Logs page.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[4]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.persist,"onUpdate:modelValue":t[1]||=e=>i.value.persist=e,label:`Keep logs on disk`,hint:`Turn off to hold everything in memory only.`,class:`sm:col-span-2`},null,8,[`modelValue`]),H(eR,{modelValue:j(o),"onUpdate:modelValue":t[2]||=e=>mn(o)?o.value=e:null,label:`Rotate at (bytes)`,min:1e4,max:1e8,hint:`Per server, before rolling to .1, .2, …`},null,8,[`modelValue`]),H(eR,{modelValue:j(s),"onUpdate:modelValue":t[3]||=e=>mn(s)?s.value=e:null,label:`Keep rotated files`,min:1,max:10},null,8,[`modelValue`]),V(`div`,cX,[t[8]||=V(`span`,{class:`text-xs font-medium text-muted`},`Logs directory`,-1),V(`div`,lX,[V(`span`,uX,k(c.value),1),H(kV,{value:c.value,label:`Copy the logs directory`},null,8,[`value`])]),V(`p`,dX,[t[6]||=U(` Browse and download these files on the `,-1),H(l,{to:j(XX)(j(a).activeId.value,`logs`),class:`text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`},{default:M(()=>[...t[5]||=[U(` Logs `,-1)]]),_:1},8,[`to`]),t[7]||=U(` page. `,-1)])])]),_:1})}}}),pX={class:`flex items-center gap-2 border-t border-line-soft pt-3 sm:col-span-2`},mX={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},hX={key:0,class:`sm:col-span-2`},gX={class:`flex flex-wrap gap-1.5`},_X={key:1,class:`sm:col-span-2`},vX={class:`text-2xs leading-4 text-faint`},yX={key:2,class:`space-y-2 sm:col-span-2`},bX=P({__name:`NotificationsSection`,props:Ra({status:{},dirty:{type:Boolean}},{telegram:{required:!0},telegramModifiers:{}}),emits:Ra([`reset`],[`update:telegram`]),setup(e,{emit:t}){let n=e,r=t,i=oo(e,`telegram`),a=KN(),o=sP(),s=TL(()=>i.value.cooldownMs,e=>i.value.cooldownMs=e,12e4),c=A(``),l=A(null),u=A(null),d=A([]),f=A(!1),p=G(()=>n.status?.tokenSet===!0),m=G(()=>n.status?.lastResult??null),h=G(()=>n.status?.lastResultAt??null),g=G(()=>p.value?`Saved — type a new token to replace it`:`123456789:AA…`);async function _(){f.value=!0,u.value=null,l.value=null;try{let e=await VM(o.activeId.value,c.value.trim());c.value=``,l.value=`Token saved${e.username?` for @${e.username}`:``}.`,await a.refresh()}catch(e){u.value=e instanceof Error?e.message:String(e)}finally{f.value=!1}}async function v(){f.value=!0,u.value=null,l.value=null;try{await HM(o.activeId.value),l.value=`Token removed.`,await a.refresh()}catch(e){u.value=e instanceof Error?e.message:String(e)}finally{f.value=!1}}async function y(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await WM(o.activeId.value,e.length>0?{botToken:e}:{});d.value=t.chats,t.chats.length===0&&(u.value=`No chats found. Send /start to the bot first, then detect again.`)}catch(e){u.value=e instanceof Error?e.message:String(e)}finally{f.value=!1}}async function b(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await UM(o.activeId.value,{chatId:i.value.chatId.length>0?i.value.chatId:void 0,...e.length>0?{botToken:e}:{}});t.ok?l.value=`Test message sent.`:u.value=t.error??`The test message failed.`,await a.refresh()}catch(e){u.value=e instanceof Error?e.message:String(e)}finally{f.value=!1}}return(e,t)=>(R(),B(UL,{title:`Telegram`,description:`Policy lives in the config; the bot token is a secret and never comes back from the server.`},{actions:M(()=>[H($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:M(()=>[...t[11]||=[U(` Reset `,-1)]]),_:1},8,[`disabled`])]),default:M(()=>[H(mR,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:`Send notifications`,hint:`One message per event, throttled by the cooldown below.`,wide:``},null,8,[`modelValue`]),H(dR,{modelValue:i.value.chatId,"onUpdate:modelValue":t[2]||=e=>i.value.chatId=e,label:`Chat id`,placeholder:`123456789 or @channel`,hint:`Use Detect chats to fill this from the bot's updates.`},null,8,[`modelValue`]),H(eR,{modelValue:j(s),"onUpdate:modelValue":t[3]||=e=>mn(s)?s.value=e:null,label:`Cooldown per event (ms)`,min:0,hint:`Per server and reason, so a flapping server cannot spam.`},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onCrash,"onUpdate:modelValue":t[4]||=e=>i.value.onCrash=e,label:`Retries exhausted`},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onUnhealthy,"onUpdate:modelValue":t[5]||=e=>i.value.onUnhealthy=e,label:`Port unhealthy`},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onForcedRestart,"onUpdate:modelValue":t[6]||=e=>i.value.onForcedRestart=e,label:`Forced restart`},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onRecovered,"onUpdate:modelValue":t[7]||=e=>i.value.onRecovered=e,label:`Recovered`},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onHost,"onUpdate:modelValue":t[8]||=e=>i.value.onHost=e,label:`Host vitals breached`,hint:`Disk, memory, swap, load and CPU temperature, per the thresholds under Host vitals.`,wide:``},null,8,[`modelValue`]),H(mR,{modelValue:i.value.onDdns,"onUpdate:modelValue":t[9]||=e=>i.value.onDdns=e,label:`Dynamic DNS changed or failed`,hint:`One message per pass that changed a record, and one for a pass that failed.`,wide:``},null,8,[`modelValue`]),V(`div`,pX,[t[12]||=V(`span`,{class:`text-xs font-medium text-muted`},`Bot token`,-1),H(jV,{tone:p.value?`ok`:`warn`,dot:``},{default:M(()=>[U(k(p.value?`token set`:`no token`),1)]),_:1},8,[`tone`]),t[13]||=V(`span`,{class:`text-2xs text-faint`},`From @BotFather — a secret, never in servers.config.json.`,-1)]),H(dR,{modelValue:c.value,"onUpdate:modelValue":t[10]||=e=>c.value=e,type:`password`,autocomplete:`off`,label:`Bot token`,placeholder:g.value,wide:``},null,8,[`modelValue`,`placeholder`]),V(`div`,mX,[H($,{variant:`primary`,disabled:f.value||c.value.trim().length===0,loading:f.value&&c.value.trim().length>0,onClick:_},{default:M(()=>[...t[14]||=[U(` Save token `,-1)]]),_:1},8,[`disabled`,`loading`]),H($,{variant:`secondary`,disabled:f.value,onClick:y},{default:M(()=>[...t[15]||=[U(` Detect chats `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`secondary`,disabled:f.value,onClick:b},{default:M(()=>[...t[16]||=[U(` Send test `,-1)]]),_:1},8,[`disabled`]),p.value?(R(),B(MB,{key:0,label:`Remove token`,"confirm-label":`Confirm remove`,"confirm-variant":`danger`,title:`Remove the bot token?`,hint:`Notifications stop until you paste a token again.`,disabled:f.value,onConfirm:v},null,8,[`disabled`])):W(``,!0)]),d.value.length>0?(R(),z(`div`,hX,[t[17]||=V(`p`,{class:`mb-1.5 text-xs text-muted`},` Chats the bot has seen: `,-1),V(`div`,gX,[(R(!0),z(L,null,F(d.value,e=>(R(),B($,{key:String(e.id),size:`xs`,variant:`secondary`,onClick:t=>i.value.chatId=String(e.id)},{default:M(()=>[U(k(e.title)+` (`+k(e.id)+`) `,1)]),_:2},1032,[`onClick`]))),128))])])):W(``,!0),m.value?(R(),z(`div`,_X,[V(`p`,vX,` Last send: `+k(m.value)+k(h.value?` · ${j(lI)(h.value,j(a).now.value)}`:``),1)])):W(``,!0),u.value||l.value?(R(),z(`div`,yX,[u.value?(R(),B(FB,{key:0,tone:`danger`},{default:M(()=>[U(k(u.value),1)]),_:1})):W(``,!0),l.value?(R(),B(FB,{key:1,tone:`ok`},{default:M(()=>[U(k(l.value),1)]),_:1})):W(``,!0)])):W(``,!0)]),_:1}))}}),xX={class:`min-h-full`},SX={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},CX={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},wX={"aria-label":`Workspace settings sections`,class:`hidden lg:block`},TX={class:`sticky top-6 space-y-0.5 border-l border-line`},EX=[`aria-current`,`onClick`],DX={class:`space-y-6`},OX={id:`defaults`,class:`scroll-mt-5`},kX={id:`logs`,class:`scroll-mt-5`},AX={id:`notifications`,class:`scroll-mt-5`},jX={id:`ddns`,class:`scroll-mt-5`},MX={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},NX={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},PX={class:`min-w-0 flex-1`},FX={class:`text-xs text-muted`},IX={class:`font-mono tabular-nums text-ink`},LX={key:0,class:`mt-0.5 text-xs text-danger`},RX={key:1,class:`mt-0.5 text-xs text-ok`},zX={class:`flex shrink-0 items-center gap-2`},BX={class:`max-h-[60dvh] overflow-auto px-4 py-3`},VX={key:0,class:`divide-y divide-line-soft`},HX={class:`font-mono text-xs text-ink`},UX={class:`ml-auto font-mono text-xs text-muted line-through`},WX={class:`font-mono text-xs text-accent`},GX={key:1,class:`text-xs text-muted`},KX={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},qX=P({__name:`SettingsView`,setup(e){let t=[{id:`defaults`,title:`Server defaults`},{id:`logs`,title:`Logs`},{id:`notifications`,title:`Notifications`},{id:`ddns`,title:`Dynamic DNS`}],n=Rg(),r=Lg(),i=KN(),a=sP(),o=mN(),s=en(tL()),c=A(`defaults`),l=A(!1),u=A(null),d=A(null),f=A(null),p=A(null),m=A(null),h=G(()=>a.defaults.value),g=G(()=>a.logsConfig.value),_=G(()=>a.notifications.value?.telegram??null),v=G(()=>a.logsDir.value),y=G(()=>{let e={},t=h.value,n=g.value,r=_.value;if(t!==null){let n=pL(t,s.defaults);Object.keys(n).length>0&&(e.defaults=n)}if(n!==null){let t=mL(n,s.logs);Object.keys(t).length>0&&(e.logs=t)}if(r!==null){let t=hL(r,s.telegram);Object.keys(t).length>0&&(e.notifications=t)}return e}),b=G(()=>JI(y.value)+(f.value===null?0:JI(f.value))),x=G(()=>{let e=_.value;return{defaults:h.value??{},logs:g.value??{},notifications:e===null?{}:{telegram:oL(e)},ddns:p.value??{}}}),S=G(()=>qI({...y.value,...f.value===null?{}:{ddns:f.value}},x.value)),C=A(!1),w=G(()=>h.value!==null&&Object.keys(pL(h.value,s.defaults)).length>0),T=G(()=>g.value!==null&&Object.keys(mL(g.value,s.logs)).length>0),ee=G(()=>_.value!==null&&Object.keys(hL(_.value,s.telegram)).length>0),E={};function te(){let e=(e,t)=>{xL(E[e],bL(s,e))||(t(),E[e]=bL(s,e))},t=h.value;t!==null&&e(`defaults`,()=>{s.defaults.enabled=t.enabled,s.defaults.autostart=t.autostart,s.defaults.bind=t.bind,s.defaults.onPortConflict=t.onPortConflict,s.defaults.logBufferLines=t.logBufferLines,s.defaults.restart={...t.restart},s.defaults.health=$I(t.health),s.defaults.stop={...t.stop}});let n=g.value;n!==null&&e(`logs`,()=>Object.assign(s.logs,n));let r=_.value;r!==null&&e(`telegram`,()=>Object.assign(s.telegram,oL(r)))}function ne(){for(let e of Object.keys(E))delete E[e]}function re(e){E[e]=bL(s,e)}N([h,g,_],()=>{te()},{immediate:!0});async function ie(){let e=y.value,t=f.value,n=Object.keys(e).length>0;if(!(!n&&t===null||l.value||a.activeId.value.length===0)){l.value=!0,u.value=null,d.value=null;try{if(n&&!await i.saveWorkspaceSettings(a.activeId.value,e)){u.value=i.lastError.value??`The settings could not be saved.`;return}t!==null&&(await KM(a.activeId.value,t),await m.value?.reload()),d.value=`Workspace settings saved.`,o.success(`Workspace settings saved`),ne(),te()}catch(e){u.value=e instanceof Error?e.message:String(e)}finally{l.value=!1}}}function ae(){u.value=null,d.value=null,ne(),te(),m.value?.reload()}function oe(){let e=h.value;e!==null&&(s.defaults.enabled=e.enabled,s.defaults.autostart=e.autostart,s.defaults.bind=e.bind,s.defaults.onPortConflict=e.onPortConflict,s.defaults.logBufferLines=e.logBufferLines,s.defaults.restart={...e.restart},s.defaults.health=$I(e.health),s.defaults.stop={...e.stop},re(`defaults`))}function se(){g.value!==null&&Object.assign(s.logs,g.value),re(`logs`)}function ce(){_.value!==null&&Object.assign(s.telegram,oL(_.value)),re(`telegram`)}function D(e){rr(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function le(e){c.value=e,n.query.section!==e&&r.replace({query:{...n.query,section:e}}),D(e)}N(()=>n.query.section,e=>{let n=typeof e==`string`?e:``;t.some(e=>e.id===n)&&(c.value=n,D(n))},{immediate:!0}),N(()=>a.activeId.value,()=>{ne(),te(),u.value=null,d.value=null});let ue=null;return ta(()=>{ue=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(c.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of t){let t=document.getElementById(e.id);t&&ue.observe(t)}}),ia(()=>ue?.disconnect()),(e,n)=>(R(),z(L,null,[V(`div`,xX,[V(`div`,SX,[H(Hz,{title:`Workspace settings`,description:`Server defaults, log retention, notifications and dynamic DNS for ${j(a).selected.value?.label??`this workspace`}.`},null,8,[`description`]),j(a).configError.value?(R(),B(FB,{key:0,tone:`danger`,title:`The workspace config could not be read`,class:`mb-4`},{default:M(()=>[V(`p`,null,k(j(a).configError.value),1),n[9]||=V(`p`,{class:`mt-1`},` The panel keeps supervising with the config it already had; fixing the file reloads it on its own. `,-1)]),_:1})):j(a).configWarnings.value.length>0?(R(),B(FB,{key:1,tone:`warn`,title:`This workspace's config has a warning`,class:`mb-4`},{default:M(()=>[(R(!0),z(L,null,F(j(a).configWarnings.value,e=>(R(),z(`p`,{key:e,class:`font-mono`},k(e),1))),128))]),_:1})):W(``,!0),V(`div`,CX,[V(`nav`,wX,[V(`ul`,TX,[(R(),z(L,null,F(t,e=>V(`li`,{key:e.id},[V(`button`,{type:`button`,"aria-current":c.value===e.id?`true`:void 0,class:O(j(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,c.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>le(e.id)},k(e.title),11,EX)])),64))])]),V(`div`,DX,[V(`section`,OX,[n[10]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Server defaults `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Applied to every entry in this workspace that does not set its own value. `)],-1),H(sX,{defaults:s.defaults,"onUpdate:defaults":n[0]||=e=>s.defaults=e,dirty:w.value,onReset:oe},null,8,[`defaults`,`dirty`])]),V(`section`,kX,[n[11]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Logs `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` How much output this workspace keeps on disk and for how long. `)],-1),H(fX,{logs:s.logs,"onUpdate:logs":n[1]||=e=>s.logs=e,"logs-dir":v.value,dirty:T.value,onReset:se},null,8,[`logs`,`logs-dir`,`dirty`])]),V(`section`,AX,[n[12]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Notifications `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Crash and health alerts for this workspace, sent to a Telegram chat. `)],-1),H(bX,{telegram:s.telegram,"onUpdate:telegram":n[2]||=e=>s.telegram=e,status:_.value,dirty:ee.value,onReset:ce},null,8,[`telegram`,`status`,`dirty`])]),V(`section`,jX,[n[13]||=V(`header`,{class:`mb-3`},[V(`h2`,{class:`text-lg font-semibold text-ink`},` Dynamic DNS `),V(`p`,{class:`mt-0.5 text-xs text-muted`},` Keep hostnames pointed at this machine's public address, whichever registrar holds them. `)],-1),H(aX,{ref_key:`ddnsSection`,ref:m,patch:f.value,"onUpdate:patch":n[3]||=e=>f.value=e,baseline:p.value,"onUpdate:baseline":n[4]||=e=>p.value=e},null,8,[`patch`,`baseline`])])])])]),V(`div`,MX,[V(`div`,NX,[V(`div`,PX,[V(`p`,FX,[b.value>0?(R(),z(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:n[5]||=e=>C.value=!0},[V(`span`,IX,k(b.value),1),U(` field`+k(b.value===1?``:`s`)+` changed `,1)])):(R(),z(L,{key:1},[U(` No unsaved changes `)],64))]),u.value?(R(),z(`p`,LX,k(u.value),1)):d.value?(R(),z(`p`,RX,k(d.value),1)):W(``,!0)]),V(`div`,zX,[H($,{variant:`ghost`,disabled:b.value===0||l.value,onClick:ae},{default:M(()=>[...n[14]||=[U(` Discard changes `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`primary`,disabled:b.value===0,loading:l.value,onClick:ie},{default:M(()=>[...n[15]||=[U(` Save settings `,-1)]]),_:1},8,[`disabled`,`loading`])])])])]),H(ER,{open:C.value,"onUpdate:open":n[8]||=e=>C.value=e,title:`Unsaved changes`,description:`What Save would write to ${j(a).selected.value?.label??`this workspace`}'s settings.`,width:`w-[min(92vw,42rem)]`},{default:M(()=>[V(`div`,BX,[S.value.length>0?(R(),z(`ul`,VX,[(R(!0),z(L,null,F(S.value,e=>(R(),z(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[V(`code`,HX,k(e.path),1),V(`span`,UX,k(j(hI)(e.from)),1),n[16]||=V(`span`,{class:`text-2xs text-faint`},`→`,-1),V(`span`,WX,k(j(hI)(e.to)),1)]))),128))])):(R(),z(`p`,GX,` Nothing to save. `))]),V(`footer`,KX,[H($,{size:`sm`,variant:`ghost`,onClick:n[6]||=e=>C.value=!1},{default:M(()=>[...n[17]||=[U(` Close `,-1)]]),_:1}),H($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||l.value,loading:l.value,onClick:n[7]||=e=>{ie(),C.value=!1}},{default:M(()=>[U(` Save `+k(S.value.length)+` change`+k(S.value.length===1?``:`s`),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`,`description`])],64))}}),JX=new Set([`overview`,`servers`,`server-detail`,`logs`,`settings`]),YX=xv({history:U_(),routes:[{path:`/w/:workspaceId`,name:`overview`,component:FG,meta:{title:`Overview`}},{path:`/w/:workspaceId/servers`,name:`servers`,component:_Y,meta:{title:`Servers`}},{path:`/w/:workspaceId/servers/:id`,name:`server-detail`,component:dY,meta:{title:`Server`}},{path:`/w/:workspaceId/logs`,name:`logs`,component:pG,meta:{title:`Logs`}},{path:`/w/:workspaceId/settings`,name:`settings`,component:qX,meta:{title:`Workspace settings`}},{path:`/global/overview`,name:`global-overview`,component:OB,meta:{title:`Global Overview`}},{path:`/global/settings`,name:`global-settings`,component:UU,meta:{title:`Global settings`}},{path:`/proxy`,name:`proxy`,component:TJ,meta:{title:`Reverse Proxy`}},{path:`/login`,name:`login`,component:fW,meta:{title:`Sign in`}},{path:`/`,name:`home`,component:FG},{path:`/servers`,name:`legacy-servers`,component:_Y},{path:`/servers/:id`,name:`legacy-server-detail`,component:dY},{path:`/logs`,name:`legacy-logs`,component:pG},{path:`/settings`,name:`legacy-settings`,component:qX},{path:`/global`,name:`legacy-global`,component:OB},{path:`/global-settings`,name:`legacy-global-settings`,component:UU},{path:`/:pathMatch(.*)*`,name:`not-found`,component:FG}]});function XX(e,t=`overview`,n){let r=`/w/${encodeURIComponent(e)}`;return t===`overview`?r:t===`servers`?n===void 0?`${r}/servers`:`${r}/servers/${encodeURIComponent(n)}`:`${r}/${t}`}YX.beforeEach(async e=>{let{session:t,refresh:n}=lN();t.value===null&&await n();let r=t.value?.authRequired===!0,i=t.value?.authenticated===!0;if(r&&!i&&e.name!==`login`)return{name:`login`,query:e.fullPath===`/`?void 0:{next:e.fullPath}};if(e.name===`login`&&(!r||i))return{name:`global-overview`,replace:!0};if(e.name===`login`||e.name===`global-overview`||e.name===`global-settings`||e.name===`proxy`)return!0;if(e.name===`legacy-global`)return{name:`global-overview`,query:e.query,replace:!0};if(e.name===`legacy-global-settings`)return{name:`global-settings`,query:e.query,replace:!0};if(e.name===`home`||e.name===`not-found`)return{name:`global-overview`,replace:!0};await KN().ensureState();let a=sP(),o=a.workspaces.value;if(o.length===0)return!0;let s=typeof e.params.workspaceId==`string`?e.params.workspaceId:``;if(s.length>0&&o.some(e=>e.id===s)&&(a.select(s),JX.has(String(e.name))))return!0;let c=a.activeId.value||o[0].id,l=String(e.name??``).replace(/^legacy-/,``),u=l===`server-detail`||l===`servers`&&`id`in e.params?`server-detail`:JX.has(l)?l:`overview`,d={...e.params,workspaceId:c};return u===`server-detail`&&d.id===void 0?{name:`servers`,params:{workspaceId:c},query:e.query,replace:!0}:{name:u,params:d,query:e.query,replace:!0}});var ZX={class:`flex items-center gap-2.5 border-b border-line px-3.5`},QX={key:0,class:`px-3 py-8 text-center text-xs text-muted`},$X={class:`px-2.5 pb-1 pt-2.5 text-2xs font-medium text-faint`},eZ=[`data-active`,`onMousemove`,`onClick`],tZ={class:`min-w-0 flex-1 truncate text-sm`},nZ={key:0,class:`shrink-0 font-mono text-2xs text-faint`},rZ={class:`flex items-center gap-3 border-t border-line bg-panel-2 px-3.5 py-2 text-2xs text-faint`},iZ={class:`ml-auto font-mono`},aZ=P({__name:`CommandPalette`,props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:[`update:open`],setup(e){let t=oo(e,`open`),n=Lg(),r=KN(),i=sP(),a=tP(),o=A(``),s=A(0),c=A(null),l=A(null);function u(e){n.push(e)}function d(e){i.select(e);let t=String(n.currentRoute.value.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?u(XX(e,t)):t===`server-detail`&&u(XX(e,`servers`))}function f(e){e(),t.value=!1}let p=[`stopped`,`crashed`,`conflict`],m=[`running`,`starting`,`backoff`],h=G(()=>{let e=[],t=r.allServers.value;function n(e,t){i.select(e),u(t)}let o=e=>XX(i.activeId.value,e);for(let{workspace:i,server:a}of t){let t=a.config.label??a.id,o=IF[a.status].label;e.push({id:`open:${i.id}:${a.id}`,title:`Open ${t}`,group:`Servers`,icon:wy,detail:`${i.label} · ${a.id} · ${o}`,keywords:`server detail ${a.id} ${i.label} show`,run:()=>n(i.id,XX(i.id,`servers`,a.id))}),e.push({id:`logs:${i.id}:${a.id}`,title:`Logs for ${t}`,group:`Servers`,icon:My,detail:`${i.label} · ${a.id}`,keywords:`log tail output ${a.id} ${i.label}`,run:()=>n(i.id,`${XX(i.id,`logs`)}?server=${encodeURIComponent(a.id)}`)}),p.includes(a.status)&&a.config.enabled&&e.push({id:`start:${i.id}:${a.id}`,title:`Start ${t}`,group:`Actions`,icon:gy,detail:`${i.label} · ${a.id}`,keywords:`run launch ${a.id} ${i.label}`,run:()=>f(()=>void r.start(i.id,a.id))}),m.includes(a.status)&&e.push({id:`stop:${i.id}:${a.id}`,title:`Stop ${t}`,group:`Actions`,icon:Ay,detail:`${i.label} · ${a.id}`,keywords:`halt kill ${a.id} ${i.label}`,run:()=>f(()=>void r.stop(i.id,a.id))}),a.config.enabled&&e.push({id:`restart:${i.id}:${a.id}`,title:`Restart ${t}`,group:`Actions`,icon:xy,detail:`${i.label} · ${a.id}`,keywords:`bounce reload ${a.id} ${i.label}`,run:()=>f(()=>void r.restart(i.id,a.id))})}e.push({id:`nav:overview`,title:`Go to Overview`,group:`Navigate`,icon:ay,keywords:`dashboard home workspace`,run:()=>u(o(`overview`))},{id:`nav:global`,title:`Go to Global Overview`,group:`Navigate`,icon:ey,keywords:`dashboard home host vitals every workspace`,run:()=>u(`/global/overview`)},{id:`nav:global-settings`,title:`Go to Global settings`,group:`Navigate`,icon:ky,keywords:`panel listener auth tls backups host`,run:()=>u(`/global/settings`)},{id:`nav:proxy`,title:`Go to Reverse Proxy`,group:`Navigate`,icon:Ly,keywords:`caddy domain route acme certificate https expose`,run:()=>u(`/proxy`)},{id:`nav:servers`,title:`Go to Servers`,group:`Navigate`,icon:wy,keywords:`processes list workspace`,run:()=>u(o(`servers`))},{id:`nav:logs`,title:`Go to Logs`,group:`Navigate`,icon:Sy,keywords:`output files tail workspace`,run:()=>u(o(`logs`))},{id:`nav:settings`,title:`Go to Workspace settings`,group:`Navigate`,icon:Ty,keywords:`defaults notifications ddns config workspace`,run:()=>u(o(`settings`))},{id:`act:start-all`,title:`Start every enabled server here`,group:`Actions`,icon:gy,keywords:`boot all workspace`,run:()=>f(()=>void r.startAll(i.activeId.value))},{id:`act:stop-all`,title:`Stop every server here`,group:`Actions`,icon:Ay,keywords:`halt all workspace`,run:()=>f(()=>void r.stopAll(i.activeId.value))});for(let t of i.workspaces.value)e.push({id:`ws:${t.id}`,title:`Switch to ${t.label}`,group:`Workspaces`,icon:iy,detail:t.id,keywords:`workspace switch scope ${t.label}`,run:()=>f(()=>d(t.id))});for(let[t,n]of[[`listener`,`Listener`],[`authentication`,`Authentication`],[`host`,`Host vitals`],[`backups`,`Backups`],[`tls`,`TLS`],[`interface`,`Interface`],[`paths`,`Paths`]])e.push({id:`gset:${t}`,title:`Global setting: ${n}`,group:`Global settings`,icon:ey,keywords:`configure panel ${t}`,run:()=>u(`/global/settings?section=${t}`)});for(let[t,n]of[[`defaults`,`Server defaults`],[`logs`,`Log storage`],[`notifications`,`Telegram notifications`],[`ddns`,`Dynamic DNS`]])e.push({id:`wset:${t}`,title:`Workspace setting: ${n}`,group:`Workspace settings`,icon:Ty,keywords:`configure workspace ${t}`,run:()=>u(`${XX(i.activeId.value,`settings`)}?section=${t}`)});let s=[[`light`,`Light`,jy],[`dark`,`Dark`,fy],[`system`,`System`,dy]];for(let[t,n,r]of s)e.push({id:`theme:${t}`,title:`${n} theme`,group:`Appearance`,icon:r,keywords:`colour color dark light mode appearance`,run:()=>f(()=>a.setPreference(t))});return e}),g=G(()=>{let e=o.value.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.length===0?h.value.slice(0,40):h.value.map(t=>{let n=`${t.title} ${t.detail??``} ${t.keywords??``} ${t.group}`.toLowerCase(),r=0;for(let t of e){let e=n.indexOf(t);if(e===-1)return null;r+=e===0?0:e}return{command:t,score:r}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).slice(0,40).map(e=>e.command)}),_=G(()=>{let e=new Map;for(let t of g.value){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]}),v=G(()=>_.value.flatMap(([,e])=>e));N(g,()=>{s.value=0}),N(t,async e=>{e&&(o.value=``,s.value=0,await rr(),c.value?.focus())});function y(e){let t=v.value.length;t!==0&&(s.value=(s.value+e+t)%t,rr(()=>{l.value?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})}))}function b(e){e.key===`ArrowDown`?(e.preventDefault(),y(1)):e.key===`ArrowUp`?(e.preventDefault(),y(-1)):e.key===`Enter`&&(e.preventDefault(),v.value[s.value]?.run())}function x(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.value=!t.value)}return ta(()=>window.addEventListener(`keydown`,x)),ze(()=>window.removeEventListener(`keydown`,x)),(e,n)=>(R(),B(j(cf),{open:t.value,"onUpdate:open":n[2]||=e=>t.value=e},{default:M(()=>[H(j(Jf),null,{default:M(()=>[H(j(Kf),{class:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px] data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`}),H(j(Uf),{class:`fixed left-1/2 top-[10vh] z-50 w-[min(94vw,38rem)] -translate-x-1/2 overflow-hidden rounded-panel border border-line bg-panel shadow-float data-[state=open]:animate-[hh-pop-in_150ms_var(--ease-out-quick)]`,onOpenAutoFocus:n[1]||=cu(()=>{},[`prevent`]),onKeydown:b},{default:M(()=>[H(j(Yf),{class:`sr-only`},{default:M(()=>[...n[3]||=[U(` Command palette `,-1)]]),_:1}),V(`div`,ZX,[H(j(Cy),{class:`size-4 shrink-0 text-faint`}),xr(V(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:`Jump to a server, run an action, open a setting…`,class:`h-12 w-full bg-transparent text-sm text-ink outline-none placeholder:text-faint`,autocomplete:`off`,spellcheck:`false`},null,512),[[ql,o.value]]),n[4]||=V(`kbd`,{class:`shrink-0 rounded border border-line bg-page px-1.5 py-0.5 font-mono text-2xs text-faint`},`esc`,-1)]),V(`div`,{ref_key:`list`,ref:l,class:`max-h-[min(60vh,26rem)] overflow-y-auto p-1.5`},[v.value.length===0?(R(),z(`p`,QX,` Nothing matches “`+k(o.value)+`”. `,1)):W(``,!0),(R(!0),z(L,null,F(_.value,([e,t])=>(R(),z(L,{key:e},[V(`p`,$X,k(e),1),(R(!0),z(L,null,F(t,e=>(R(),z(`button`,{key:e.id,type:`button`,"data-active":v.value[s.value]?.id===e.id,class:O(j(Q)(`flex w-full items-center gap-2.5 rounded-control px-2.5 py-2 text-left transition-colors duration-100`,v.value[s.value]?.id===e.id?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onMousemove:t=>s.value=v.value.findIndex(t=>t.id===e.id),onClick:t=>e.run()},[(R(),B(ma(e.icon),{class:O([`size-4 shrink-0`,v.value[s.value]?.id===e.id?`text-accent`:`text-faint`])},null,8,[`class`])),V(`span`,tZ,k(e.title),1),e.detail?(R(),z(`span`,nZ,k(e.detail),1)):W(``,!0),H(j(Lv),{class:O([`size-3.5 shrink-0 text-faint opacity-0 transition-opacity duration-100`,{"opacity-100":v.value[s.value]?.id===e.id}])},null,8,[`class`])],42,eZ))),128))],64))),128))],512),V(`div`,rZ,[n[5]||=V(`span`,null,[V(`kbd`,{class:`font-mono`},`↑↓`),U(` navigate`)],-1),n[6]||=V(`span`,null,[V(`kbd`,{class:`font-mono`},`↵`),U(` run`)],-1),V(`span`,iZ,k(v.value.length)+` results`,1)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),oZ={class:`rounded-panel border border-line bg-panel-2/70 p-3`},sZ={class:`mb-2 flex items-center justify-between`},cZ={key:0,class:`text-2xs text-faint`},lZ={key:0,class:`grid grid-cols-2 gap-x-1 gap-y-2`},uZ={key:1,class:`py-3 text-center text-2xs text-faint`},dZ={key:2,class:`mt-2 flex items-start gap-1.5 rounded-control bg-danger-soft px-2 py-1.5`},fZ={class:`text-2xs leading-4 text-danger`},pZ=2,mZ=85,hZ=P({__name:`InstrumentCluster`,props:{host:{}},setup(e){let t=e,n=G(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=G(()=>n.value===null?null:n.value/pZ*100),i=G(()=>n.value===null?`—`:n.value.toFixed(2)),a=G(()=>{let e=t.host?.disks??[];return e.length===0?null:Math.max(...e.map(e=>e.usedPercent))}),o=G(()=>{let e=t.host?.tempCelsius??null;return e===null?null:e/mZ*100}),s=G(()=>{let e=t.host?.tempCelsius??null;return e===null?`n/a`:`${Math.round(e)}°`});return(e,n)=>(R(),z(`div`,oZ,[V(`div`,sZ,[n[0]||=V(`span`,{class:`text-2xs font-medium text-faint`},`Host vitals`,-1),t.host?.enabled===!1?(R(),z(`span`,cZ,`off`)):W(``,!0)]),t.host?.enabled?(R(),z(`div`,lZ,[H(QF,{value:r.value,label:`Load / cpu`,display:i.value,size:58,"warn-at":70,"danger-at":100},null,8,[`value`,`display`]),H(QF,{value:t.host?.memoryUsedPercent??null,label:`Memory`,size:58},null,8,[`value`]),H(QF,{value:a.value,label:`Disk`,size:58},null,8,[`value`]),H(QF,{value:o.value,label:`CPU temp`,display:s.value,size:58},null,8,[`value`,`display`])])):(R(),z(`p`,uZ,` Sampling is disabled in Settings. `)),t.host&&t.host.alerts.length>0?(R(),z(`div`,dZ,[n[1]||=V(`span`,{class:`mt-1 size-1.5 shrink-0 rounded-full bg-danger`},null,-1),V(`span`,fZ,k(t.host.alerts.join(` · `)),1)])):W(``,!0)]))}}),gZ={class:`flex h-full min-h-0 flex-col gap-3 overflow-y-auto p-3`},_Z={class:`flex items-center gap-2 px-1 pt-1`},vZ={class:`min-w-0`},yZ=[`title`],bZ={class:`flex flex-col gap-3`,"aria-label":`Navigation`},xZ={class:`flex items-center gap-1 truncate px-2.5 pb-1 text-2xs font-medium text-faint`},SZ={key:1,class:`text-muted`},CZ={class:`mt-auto flex flex-col gap-3`},wZ={class:`flex items-center gap-2 rounded-control border border-line bg-panel-2/70 px-2.5 py-2`},TZ={class:`relative flex size-2 shrink-0`},EZ={class:`text-2xs text-muted`},DZ=[`title`],OZ=P({__name:`SideNav`,props:{host:{},connection:{},panelLabel:{},panelVersion:{},planLabel:{},workspaceId:{},workspaceLabel:{},running:{},total:{}},emits:[`navigate`,`close`],setup(e,{emit:t}){let n=e,r=t,i=Rg(),a=G(()=>[{to:XX(n.workspaceId,`overview`),label:`Overview`,icon:ay,exact:!0,servers:!1},{to:XX(n.workspaceId,`servers`),label:`Servers`,icon:wy,exact:!1,servers:!0},{to:XX(n.workspaceId,`logs`),label:`Logs`,icon:Sy,exact:!1,servers:!1},{to:XX(n.workspaceId,`settings`),label:`Workspace settings`,icon:Ty,exact:!1,servers:!1}]),o=[{to:`/global/overview`,label:`Global Overview`,icon:ey,exact:!0,servers:!1},{to:`/global/settings`,label:`Global settings`,icon:ky,exact:!1,servers:!1}],s=[{to:`/proxy`,label:`Reverse Proxy`,icon:Ly,exact:!1,servers:!1}],c=G(()=>[{title:`Global`,label:``,icon:ey,items:o},{title:`Workspace`,label:n.workspaceLabel,icon:void 0,items:a.value},{title:`Others`,label:``,icon:Nv,items:s}]);function l(e){return e.exact?i.path===e.to:i.path===e.to||i.path.startsWith(`${e.to}/`)}let u=G(()=>n.panelVersion===null?n.panelLabel:`${n.panelLabel} · v${n.panelVersion}`),d=G(()=>({open:{label:`Live`,dot:`bg-ok`},connecting:{label:`Connecting`,dot:`bg-warn`},closed:{label:`Reconnecting`,dot:`bg-danger`}})[n.connection]);return(e,t)=>{let i=fa(`RouterLink`);return R(),z(`div`,gZ,[V(`div`,_Z,[t[3]||=Ds(`<span class="grid size-8 shrink-0 place-items-center rounded-[9px] border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),V(`div`,vZ,[t[2]||=V(`p`,{class:`truncate text-sm font-semibold tracking-tight text-ink`},` home-hosted `,-1),V(`p`,{class:`truncate text-2xs text-faint`,title:u.value},k(u.value),9,yZ)]),V(`button`,{type:`button`,class:`ml-auto grid size-7 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":`Close navigation`,onClick:t[0]||=e=>r(`close`)},[H(j(Ry),{class:`size-4`})])]),V(`nav`,bZ,[(R(!0),z(L,null,F(c.value,e=>(R(),z(`div`,{key:e.title,class:`flex min-h-0 flex-col gap-0.5`},[V(`p`,xZ,[e.icon?(R(),B(ma(e.icon),{key:0,class:`size-3 shrink-0`})):W(``,!0),U(` `+k(e.label?`${e.title} · `:e.title),1),e.label?(R(),z(`span`,SZ,k(e.label),1)):W(``,!0)]),(R(!0),z(L,null,F(e.items,e=>(R(),B(i,{key:e.to,to:e.to,class:O(j(Q)(`group flex items-center gap-2.5 rounded-control px-2.5 py-1.5 text-sm transition-colors duration-150`,l(e)?`bg-accent-soft font-medium text-accent`:`text-muted hover:bg-hover hover:text-ink`)),onClick:t[1]||=e=>r(`navigate`)},{default:M(()=>[(R(),B(ma(e.icon),{class:`size-4 shrink-0`,"stroke-width":l(e)?2.1:1.8},null,8,[`stroke-width`])),U(` `+k(e.label)+` `,1),e.servers?(R(),z(`span`,{key:0,class:O([`ml-auto font-mono text-2xs tabular-nums`,l(e)?`text-accent`:`text-faint`])},k(n.running)+`/`+k(n.total),3)):W(``,!0)]),_:2},1032,[`to`,`class`]))),128))]))),128))]),V(`div`,CZ,[H(hZ,{host:n.host},null,8,[`host`]),V(`div`,wZ,[V(`span`,TZ,[V(`span`,{class:O(j(Q)(`absolute inset-0 rounded-full`,d.value.dot,n.connection!==`open`&&`animate-ping opacity-60`))},null,2),V(`span`,{class:O(j(Q)(`relative size-2 rounded-full`,d.value.dot))},null,2)]),V(`span`,EZ,k(d.value.label),1),V(`span`,{class:`ml-auto truncate font-mono text-2xs text-faint`,title:n.planLabel},k(n.planLabel),9,DZ)])])])}}}),kZ={key:0,class:`flex flex-col gap-px border-b border-line bg-panel/60`},AZ={class:`text-2xs leading-4`},jZ={class:`font-medium`},MZ={key:0,class:`opacity-80`},NZ=P({__name:`SystemNotices`,props:{control:{},configError:{},configPath:{}},setup(e){let t=e,n=G(()=>{let e=[],n=t.control?.auth;return t.configError&&e.push({id:`config`,tone:`danger`,text:`The config could not be read: ${t.configError}`,hint:`The panel keeps running the config it already had; fix ${t.configPath??`servers.config.json`} and it reloads on its own.`}),n&&(n.blockedReason&&e.push({id:`blocked`,tone:`danger`,text:n.blockedReason}),n.usingDefaultPassword?e.push({id:`default-password`,tone:`warn`,text:`This panel is still on its default password.`,hint:`Change it in Global settings — binding beyond 127.0.0.1 stays refused until you do.`}):n.enabled&&!n.passwordSet&&e.push({id:`no-password`,tone:`warn`,text:`Authentication is on but no password is set, so nothing is being asked for.`,hint:`Set one in Global settings to actually lock the panel.`}),n.exposed&&e.push({id:`exposed`,tone:`warn`,text:`This panel is reachable beyond 127.0.0.1.`,hint:`Keep the password strong, or put a TLS-terminating proxy in front of it.`}),!n.enabled&&!n.exposed&&e.push({id:`auth-off`,tone:`info`,text:`Authentication is disabled — the panel is only protected by its loopback bind.`})),e}),r={warn:{wrap:`border-warn/25 bg-warn-soft text-warn`,icon:Iy},danger:{wrap:`border-danger/25 bg-danger-soft text-danger`,icon:Bv},info:{wrap:`border-line bg-panel-2 text-muted`,icon:Bv}};return(e,t)=>n.value.length>0?(R(),z(`div`,kZ,[(R(!0),z(L,null,F(n.value,e=>(R(),z(`div`,{key:e.id,class:O([`flex items-start gap-2 px-3 py-1.5 sm:px-4`,r[e.tone].wrap])},[(R(),B(ma(r[e.tone].icon),{class:`mt-0.5 size-3.5 shrink-0`})),V(`p`,AZ,[V(`span`,jZ,k(e.text),1),e.hint?(R(),z(`span`,MZ,k(e.hint),1)):W(``,!0)])],2))),128))])):W(``,!0)}}),PZ={class:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-[min(92vw,22rem)] flex-col gap-2`,role:`status`,"aria-live":`polite`},FZ={class:`min-w-0 flex-1`},IZ={class:`text-xs font-medium text-ink`},LZ={key:0,class:`mt-0.5 break-words text-2xs leading-4 text-muted`},RZ=[`onClick`],zZ=P({__name:`ToastStack`,setup(e){let{toasts:t,dismiss:n}=mN(),r={ok:Vv,danger:Hv,warn:Iy,info:ny,accent:ny,neutral:ny},i={ok:`text-ok`,danger:`text-danger`,warn:`text-warn`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},a=G(()=>t.value);return(e,t)=>(R(),z(`div`,PZ,[H(Fl,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`translate-x-2 opacity-0`,"leave-active-class":`transition duration-100 ease-in`,"leave-to-class":`translate-x-2 opacity-0`},{default:M(()=>[(R(!0),z(L,null,F(a.value,e=>(R(),z(`div`,{key:e.id,class:`pointer-events-auto flex items-start gap-2.5 rounded-panel border border-line bg-raise p-3 shadow-float`},[(R(),B(ma(r[e.tone]),{class:O(j(Q)(`mt-0.5 size-4 shrink-0`,i[e.tone]))},null,8,[`class`])),V(`div`,FZ,[V(`p`,IZ,k(e.title),1),e.description?(R(),z(`p`,LZ,k(e.description),1)):W(``,!0)]),V(`button`,{type:`button`,class:`-mr-1 -mt-0.5 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,"aria-label":`Dismiss`,onClick:t=>j(n)(e.id)},[H(j(Ry),{class:`size-3.5`})],8,RZ)]))),128))]),_:1})]))}}),BZ={class:`space-y-3`},VZ={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 text-2xs leading-4 text-danger`},HZ=P({__name:`WorkspaceDialog`,props:Ra({mode:{},initial:{default:``},submit:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=oo(e,`open`),r=A(t.initial),i=A(!1),a=A(null),o=G(()=>t.mode===`create`?`New workspace`:`Rename workspace`),s=G(()=>t.mode===`create`?`Create workspace`:`Rename`),c=G(()=>r.value.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40));N(n,e=>{e&&(r.value=t.initial,a.value=null)});async function l(){let e=r.value.trim();if(e.length===0){a.value=`A workspace needs a name.`;return}i.value=!0,a.value=null;try{await t.submit(e)&&(n.value=!1)}finally{i.value=!1}}return(t,u)=>(R(),B(ER,{open:n.value,"onUpdate:open":u[2]||=e=>n.value=e,title:o.value,description:e.mode===`create`?`Its own settings, servers, logs, secrets and backups entry — served by this same panel.`:`Only the name changes; the workspace id stays, so URLs and paths keep working.`,width:`w-[min(92vw,26rem)]`},{footer:M(()=>[H($,{variant:`ghost`,disabled:i.value,onClick:u[1]||=e=>n.value=!1},{default:M(()=>[...u[3]||=[U(` Cancel `,-1)]]),_:1},8,[`disabled`]),H($,{variant:`primary`,loading:i.value,onClick:l},{default:M(()=>[U(k(s.value),1)]),_:1},8,[`loading`])]),default:M(()=>[V(`div`,BZ,[H(dR,{modelValue:r.value,"onUpdate:modelValue":u[0]||=e=>r.value=e,label:`Name`,placeholder:`Home lab`,hint:e.mode===`create`&&c.value.length>0?`Shown in the header. Id: ${c.value}`:`Shown in the header.`,wide:``,onKeydown:uu(cu(l,[`prevent`]),[`enter`])},null,8,[`modelValue`,`hint`,`onKeydown`]),a.value?(R(),z(`p`,VZ,k(a.value),1)):W(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),UZ=[`aria-label`],WZ={class:`min-w-0 truncate font-medium text-ink`},GZ={class:`hidden shrink-0 font-mono text-2xs text-faint sm:inline`},KZ={key:0,class:`max-h-64 overflow-y-auto`},qZ=[`onClick`],JZ={class:`min-w-0 flex-1`},YZ={class:`block truncate text-xs`},XZ={class:`block truncate font-mono text-2xs text-faint`},ZZ={class:`shrink-0 font-mono text-2xs text-faint`},QZ={key:1,class:`px-2 py-2 text-xs text-muted`},$Z={class:`px-2 pt-1.5 text-xs font-semibold text-ink`},eQ={class:`mt-2 flex justify-end gap-1.5 px-1 pb-1`},tQ=P({__name:`WorkspacePicker`,props:{workspaces:{},selectedId:{}},emits:[`select`,`create`,`rename`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=A(!1),a=A(!1),o=G(()=>n.workspaces.find(e=>e.id===n.selectedId)??null);function s(e){r(`select`,e),i.value=!1}function c(){a.value=!0}function l(){a.value=!1}function u(){let e=o.value;a.value=!1,i.value=!1,e!==null&&r(`remove`,e)}function d(){i.value=!1,r(`create`)}function f(){i.value=!1,o.value!==null&&r(`rename`,o.value)}async function p(e){i.value=e,e&&(a.value=!1,await rr())}return(t,n)=>(R(),B(j(Uh),{open:i.value,"onUpdate:open":p},{default:M(()=>[H(j(Xh),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,class:O(j(Q)(`flex h-8 max-w-36 items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 text-xs transition-colors duration-150 hover:border-line hover:text-ink sm:max-w-52`,j(KL))),"aria-label":`Workspace: ${o.value?.label??`none`}`},[H(j(iy),{class:`size-3.5 shrink-0 text-faint`}),V(`span`,WZ,k(o.value?.label??`No workspace`),1),V(`span`,GZ,k(o.value?.runningCount??0)+`/`+k(o.value?.serverCount??0),1),H(j(zv),{class:`size-3 shrink-0 text-faint`})],10,UZ)]),_:1}),H(j(Yh),null,{default:M(()=>[H(j(Jh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-1 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[a.value?(R(),z(L,{key:1},[V(`p`,$Z,` Delete “`+k(o.value?.label)+`”? `,1),n[5]||=V(`p`,{class:`mt-1 px-2 text-2xs leading-4 text-muted`},` Its servers are stopped, and its config, settings, logs, secrets and nanny state are removed from disk. A backup taken first is the only way back. `,-1),V(`div`,eQ,[H($,{size:`xs`,variant:`ghost`,onClick:l},{default:M(()=>[...n[3]||=[U(` Keep it `,-1)]]),_:1}),H($,{size:`xs`,variant:`danger`,onClick:u},{default:M(()=>[H(j(Fy),{class:`size-3`}),n[4]||=U(`Delete workspace `,-1)]),_:1})])],64)):(R(),z(L,{key:0},[n[1]||=V(`p`,{class:`px-2 pb-1 pt-1.5 text-2xs font-medium text-faint`},` Workspaces `,-1),e.workspaces.length>0?(R(),z(`ul`,KZ,[(R(!0),z(L,null,F(e.workspaces,t=>(R(),z(`li`,{key:t.id},[V(`button`,{type:`button`,class:O(j(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left transition-colors duration-100`,t.id===e.selectedId?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onClick:e=>s(t.id)},[H(j(Pv),{class:O([`size-3.5 shrink-0`,t.id===e.selectedId?`text-accent`:`opacity-0`])},null,8,[`class`]),V(`span`,JZ,[V(`span`,YZ,k(t.label),1),V(`span`,XZ,k(t.id),1)]),V(`span`,ZZ,k(t.runningCount)+`/`+k(t.serverCount),1)],10,qZ)]))),128))])):(R(),z(`p`,QZ,` The panel serves no workspace yet. `)),n[2]||=V(`div`,{class:`my-1 h-px bg-line`},null,-1),V(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:d},[H(j(_y),{class:`size-3.5`}),n[0]||=U(` New workspace… `,-1)]),o.value?(R(),z(L,{key:2},[V(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:f},[H(j(hy),{class:`size-3.5`}),U(` Rename “`+k(o.value.label)+`”… `,1)]),V(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-danger outline-none transition-colors duration-100 hover:bg-danger-soft`,onClick:c},[H(j(Fy),{class:`size-3.5`}),U(` Delete “`+k(o.value.label)+`”… `,1)])],64)):W(``,!0)],64))]),_:1})]),_:1})]),_:1},8,[`open`]))}}),nQ=P({__name:`WorkspaceSwitcher`,setup(e){let{workspaces:t,activeId:n,select:r,create:i,rename:a,remove:o}=sP(),s=Rg(),c=Lg(),l=A(!1),u=A(`create`),d=A(null);function f(e){r(e);let t=String(s.name??``);if(t===`overview`||t===`servers`||t===`logs`||t===`settings`){c.push(XX(e,t));return}t===`server-detail`&&c.push(XX(e,`servers`))}function p(){u.value=`create`,d.value=null,l.value=!0}function m(e){u.value=`rename`,d.value=e,l.value=!0}async function h(e){if(u.value===`create`)return await i(e)!==void 0;let t=d.value;return t!==null&&a(t.id,e)}async function g(e){let t=String(s.params.workspaceId??``)||n.value;if(!await o(e.id)||t!==e.id)return;let r=String(s.name??``);(r===`overview`||r===`servers`||r===`logs`||r===`settings`)&&c.push(XX(n.value,r))}return(e,r)=>(R(),z(L,null,[H(tQ,{workspaces:j(t),"selected-id":j(n),onSelect:f,onCreate:p,onRename:m,onRemove:g},null,8,[`workspaces`,`selected-id`]),H(HZ,{open:l.value,"onUpdate:open":r[0]||=e=>l.value=e,mode:u.value,initial:d.value?.label??``,submit:h},null,8,[`open`,`mode`,`initial`])],64))}}),rQ={class:`flex h-13 shrink-0 items-center gap-3 border-b border-line bg-panel/80 px-3 backdrop-blur-sm sm:px-4`},iQ={class:`min-w-0 flex-1 truncate text-sm font-semibold tracking-tight text-ink`},aQ={class:`flex shrink-0 items-center gap-1.5`},oQ={class:`hidden items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 py-1.5 md:flex`},sQ={class:`font-mono text-2xs text-muted`},cQ={class:`px-2 py-1.5`},lQ={class:`truncate font-mono text-2xs text-muted`},uQ=P({__name:`TopBar`,props:{panelUrl:{},connection:{},authenticated:{type:Boolean}},emits:[`menu`,`palette`,`signOut`],setup(e,{emit:t}){let n=e,r=t,i=Rg(),a=tP(),o=G(()=>i.name===`server-detail`?`Servers / ${String(i.params.id??``)}`:String(i.meta.title??`home-hosted`)),s=G(()=>a.preference.value===`dark`?fy:a.preference.value===`light`?jy:dy),c=G(()=>`Theme: ${a.preference.value}`),l=G(()=>({open:`bg-ok`,connecting:`bg-warn`,closed:`bg-danger`})[n.connection]),u=G(()=>({open:`Live updates`,connecting:`Connecting`,closed:`Reconnecting`})[n.connection]);return(t,i)=>(R(),z(`header`,rQ,[V(`button`,{type:`button`,class:`grid size-8 shrink-0 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":`Open navigation`,onClick:i[0]||=e=>r(`menu`)},[H(j(ly),{class:`size-4`})]),V(`h1`,iQ,k(o.value),1),V(`div`,aQ,[V(`button`,{type:`button`,class:O(j(Q)(`hidden h-8 items-center gap-2 rounded-control border border-line bg-panel-2 px-2.5 text-xs text-faint transition-colors duration-150 hover:border-line hover:text-muted sm:flex`,j(KL))),onClick:i[1]||=e=>r(`palette`)},[H(j(Cy),{class:`size-3.5`}),i[5]||=V(`span`,{class:`pr-6`},`Search or run a command`,-1),i[6]||=V(`kbd`,{class:`rounded border border-line bg-page px-1 py-0.5 font-mono text-2xs text-faint`},`⌘K`,-1)],2),H(cz,{label:u.value},{default:M(()=>[V(`span`,oQ,[V(`span`,{class:O(j(Q)(`size-1.5 rounded-full`,l.value))},null,2),V(`span`,sQ,k(e.panelUrl),1)])]),_:1},8,[`label`]),H(cz,{label:c.value},{default:M(()=>[H($,{variant:`ghost`,size:`icon-sm`,"aria-label":c.value,onClick:i[2]||=e=>j(a).cycle()},{default:M(()=>[(R(),B(ma(s.value),{class:`size-4`}))]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),n.authenticated?(R(),B(j($h),{key:0},{default:M(()=>[H(j(ig),{"as-child":``},{default:M(()=>[H($,{variant:`ghost`,size:`icon-sm`,"aria-label":`Account`},{default:M(()=>[...i[7]||=[V(`span`,{class:`grid size-5 place-items-center rounded-full bg-accent-soft font-mono text-2xs font-semibold text-accent`},`hh`,-1)]]),_:1})]),_:1}),H(j(ng),null,{default:M(()=>[H(j(eg),{"side-offset":6,align:`end`,class:`z-50 min-w-44 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:M(()=>[V(`div`,cQ,[i[8]||=V(`p`,{class:`text-2xs text-faint`},` Signed in `,-1),V(`p`,lQ,k(n.panelUrl),1)]),H(j(rg),{class:`my-1 h-px bg-line`}),H(j(tg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:i[3]||=e=>r(`signOut`)},{default:M(()=>[H(j(cy),{class:`size-3.5`}),i[9]||=U(` Sign out `,-1)]),_:1})]),_:1})]),_:1})]),_:1})):W(``,!0),H(cz,{label:`Command palette`},{default:M(()=>[H($,{variant:`ghost`,size:`icon-sm`,class:`sm:hidden`,"aria-label":`Open the command palette`,onClick:i[4]||=e=>r(`palette`)},{default:M(()=>[H(j(Gv),{class:`size-4`})]),_:1})]),_:1}),H(nQ)])]))}}),dQ={key:1,class:`flex h-dvh overflow-hidden bg-page`},fQ={class:`hidden w-60 shrink-0 border-r border-line bg-panel/50 lg:block`},pQ={key:0,class:`fixed inset-y-0 left-0 z-40 w-64 border-r border-line bg-panel lg:hidden`},mQ={class:`flex min-w-0 flex-1 flex-col`};vu(P({__name:`App`,setup(e){let t=Rg(),n=Lg(),r=KN(),i=sP(),{session:a,logout:o}=lN(),s=A(!1),c=A(!1),l=G(()=>a.value?.authenticated===!0),u=G(()=>a.value?.authRequired===!0),d=G(()=>t.name===`login`),f=G(()=>t.name===`logs`),p=G(()=>i.runningCount.value),m=G(()=>i.serverCount.value),h=G(()=>r.control.value?.url??`—`),g=G(()=>r.host.value),_=G(()=>r.control.value?.label??`home-hosted`),v=G(()=>r.version.value),y=G(()=>i.selected.value?.label??`none`),b=G(()=>i.activeId.value);return N(G(()=>cN(a.value)),e=>{if(e!==`wait`){if(e===`login`){WN(),n.push({name:`login`});return}UN()}},{immediate:!0}),N(()=>t.fullPath,()=>{c.value=!1}),ta(async()=>{(!u.value||l.value)&&await r.refresh()}),ze(()=>WN()),(e,t)=>{let n=fa(`RouterView`);return R(),B(j(dg),{"delay-duration":300},{default:M(()=>[d.value?(R(),B(n,{key:0})):(R(),z(`div`,dQ,[V(`aside`,fQ,[H(OZ,{host:g.value,connection:j(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])]),H(Ec,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:M(()=>[c.value?(R(),z(`div`,{key:0,class:`fixed inset-0 z-40 bg-black/45 lg:hidden`,onClick:t[0]||=e=>c.value=!1})):W(``,!0)]),_:1}),H(Ec,{"enter-active-class":`transition-transform duration-150 ease-out`,"leave-active-class":`transition-transform duration-100 ease-in`,"enter-from-class":`-translate-x-full`,"leave-to-class":`-translate-x-full`},{default:M(()=>[c.value?(R(),z(`aside`,pQ,[H(OZ,{host:g.value,connection:j(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value,onNavigate:t[1]||=e=>c.value=!1,onClose:t[2]||=e=>c.value=!1},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])])):W(``,!0)]),_:1}),V(`div`,mQ,[H(uQ,{"panel-url":h.value,connection:j(r).connection.value,authenticated:l.value,onMenu:t[3]||=e=>c.value=!0,onPalette:t[4]||=e=>s.value=!0,onSignOut:t[5]||=e=>j(o)()},null,8,[`panel-url`,`connection`,`authenticated`]),d.value?W(``,!0):(R(),B(NZ,{key:0,control:j(r).control.value,"config-error":j(i).configError.value,"config-path":j(i).selected.value?.configPath},null,8,[`control`,`config-error`,`config-path`])),V(`main`,{class:O(j(Q)(`relative min-h-0 flex-1`,f.value?`overflow-hidden`:`overflow-y-auto`))},[H(n)],2)])])),H(aZ,{open:s.value,"onUpdate:open":t[6]||=e=>s.value=e},null,8,[`open`]),H(zZ)]),_:1})}}})).use(YX).mount(`#app`);
|