@miravo/cli-linux-x64 0.7.0 → 0.7.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/console-dist/assets/api-DUOCKS6t.js +1 -0
- package/console-dist/assets/catalog-CJE-3rom.js +1 -0
- package/console-dist/assets/{catalog-BpH3Cu8D.js → catalog-D7hkpcg7.js} +1 -1
- package/console-dist/assets/{catalog-source-CwrkTmsS.js → catalog-source-m5FRUDDK.js} +1 -1
- package/console-dist/assets/control-CBwmlJms.js +1 -0
- package/console-dist/assets/control-CHTvn7eR.js +1 -0
- package/console-dist/assets/events-BAIJMW48.js +1 -0
- package/console-dist/assets/{events-DWA1VT_k.js → events-Dn1dw88v.js} +1 -1
- package/console-dist/assets/{fleet-BFlqrO3Q.js → fleet-DvAEc0m4.js} +1 -1
- package/console-dist/assets/fleet-OmC_KrHK.js +1 -0
- package/console-dist/assets/index-DDdzUkma.css +2 -0
- package/console-dist/assets/index-Dr-HXmHo.js +12 -0
- package/console-dist/assets/{instance-detail-Dj-HV8SZ.js → instance-detail-BH62ZPtN.js} +1 -1
- package/console-dist/assets/login-D3gn-Fs3.js +136 -0
- package/console-dist/assets/{models-3mtC2SNR.js → models-CZEVv1PS.js} +1 -1
- package/console-dist/assets/models-S3NJFuma.js +1 -0
- package/console-dist/assets/platforms-Czbg-aTO.js +1 -0
- package/console-dist/assets/platforms-DbF8XkYf.js +1 -0
- package/console-dist/assets/query-fetch-error-B2TVF0yM.js +1 -0
- package/console-dist/assets/{route-preload-BFzhCemJ.js → route-preload-DbQkUHRM.js} +2 -2
- package/console-dist/assets/tags-BQ0SNj_k.js +1 -0
- package/console-dist/assets/{tags-B8HK3sMj.js → tags-PUzKpHKV.js} +2 -2
- package/console-dist/assets/{transition-nav-link-D6yUsYsK.js → transition-nav-link-OkNLoEe3.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-Bc3iCawV.js → use-engine-command-mutation-BHd8IkoT.js} +1 -1
- package/console-dist/assets/use-platform-stream-EUBU4hC1.js +2 -0
- package/console-dist/assets/{use-transition-navigate-Cwez-Egt.js → use-transition-navigate-My6Q66M2.js} +1 -1
- package/console-dist/assets/{validation-DELUYyVZ.js → validation-CEcQWBjy.js} +1 -1
- package/console-dist/index.html +18 -18
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/api-Dr74arfP.js +0 -1
- package/console-dist/assets/catalog-eEp5qWXA.js +0 -1
- package/console-dist/assets/control-Cs6l0S42.js +0 -1
- package/console-dist/assets/control-HmsS8PVv.js +0 -1
- package/console-dist/assets/events-cE0ex41b.js +0 -1
- package/console-dist/assets/fleet-BwUT-GVy.js +0 -1
- package/console-dist/assets/index-BPBcRRBZ.css +0 -2
- package/console-dist/assets/index-Bj0gjqob.js +0 -12
- package/console-dist/assets/login--xDTnfsr.js +0 -132
- package/console-dist/assets/models-CeCzWtHx.js +0 -1
- package/console-dist/assets/platforms-BR0rAG4P.js +0 -1
- package/console-dist/assets/platforms-w6gbgm2g.js +0 -1
- package/console-dist/assets/query-fetch-error-idV9_p3h.js +0 -1
- package/console-dist/assets/tags-B_gW580r.js +0 -1
- package/console-dist/assets/use-platform-stream-Dgbg0wbc.js +0 -2
package/console-dist/index.html
CHANGED
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
}
|
|
22
22
|
</style>
|
|
23
23
|
<title>Miravo</title>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-Dr-HXmHo.js"></script>
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-COnpUsM8.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/vendor-charts-CAZdaPlq.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/chunk-OE4NN4TA-m2UhO8Q2.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/api-DUOCKS6t.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-ui-BcvPjvmT.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/utils-CH98NBUe.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/format-B243kebG.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/assets/query-fetch-error-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/query-fetch-error-B2TVF0yM.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/proxy-Dd7NWn5E.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/AnimatePresence-DOKfbxUr.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/activity-CHJbwIn_.js">
|
|
@@ -44,37 +44,37 @@
|
|
|
44
44
|
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-B7bgkvtE.js">
|
|
45
45
|
<link rel="modulepreload" crossorigin href="/assets/badge-Dl0qmCnt.js">
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/assets/label-CM_MIru8.js">
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/use-platform-stream-
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/use-platform-stream-EUBU4hC1.js">
|
|
48
48
|
<link rel="modulepreload" crossorigin href="/assets/catalog-template-icons-MOd-xD7l.js">
|
|
49
49
|
<link rel="modulepreload" crossorigin href="/assets/layers-Cg3yeSqL.js">
|
|
50
50
|
<link rel="modulepreload" crossorigin href="/assets/dist-jROhexoH.js">
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-6JrsGi7P.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/skeleton-BK5ydi_g.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/get-error-message-CCNo4ZY0.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/platforms-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/platforms-Czbg-aTO.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/vendor-table-B6rxzcq0.js">
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/assets/arrow-up-down-Dpy1cI5X.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/download-BP5RD-RZ.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/assets/engine-store-BXfht5ME.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/assets/auth-screen-backdrop-UsGua6Zt.js">
|
|
60
60
|
<link rel="modulepreload" crossorigin href="/assets/combobox-BqGaRFom.js">
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/tags-
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/catalog-source-
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/tags-PUzKpHKV.js">
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/catalog-source-m5FRUDDK.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/runtime-link-ocutSVA8.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-
|
|
65
|
-
<link rel="modulepreload" crossorigin href="/assets/models-
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/assets/validation-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-BHd8IkoT.js">
|
|
65
|
+
<link rel="modulepreload" crossorigin href="/assets/models-CZEVv1PS.js">
|
|
66
|
+
<link rel="modulepreload" crossorigin href="/assets/validation-CEcQWBjy.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/shallow-ODRQsuRf.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/route-preload-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/transition-nav-link-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/control-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/catalog-
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/route-preload-DbQkUHRM.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-My6Q66M2.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/transition-nav-link-OkNLoEe3.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/control-CBwmlJms.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/catalog-D7hkpcg7.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/select-display-items-C6R8SaIm.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/transition-types-BNgNegH3.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/fleet-
|
|
76
|
-
<link rel="modulepreload" crossorigin href="/assets/events-
|
|
77
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/fleet-DvAEc0m4.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="/assets/events-Dn1dw88v.js">
|
|
77
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DDdzUkma.css">
|
|
78
78
|
</head>
|
|
79
79
|
<body>
|
|
80
80
|
<div id="root"></div>
|
package/miravo
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-COnpUsM8.js";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},n=new class extends t{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},r={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},i=new class{#e=r;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function a(e){setTimeout(e,0)}var o=typeof window>`u`||`Deno`in globalThis;function s(){}function c(e,t){return typeof e==`function`?e(t):e}function l(e){return typeof e==`number`&&e>=0&&e!==1/0}function u(e,t){return Math.max(e+(t||0)-Date.now(),0)}function d(e,t){return typeof e==`function`?e(t):e}function f(e,t){return typeof e==`function`?e(t):e}function p(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!ne(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function m(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(te(t.options.mutationKey)!==te(a))return!1}else if(!ne(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||te)(e)}function te(e){return JSON.stringify(e,(e,t)=>se(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ne(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>ne(e[n],t[n])):!1}var re=Object.prototype.hasOwnProperty;function ie(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=oe(e)&&oe(t);if(!r&&!(se(e)&&se(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:re.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ie(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ae(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function se(e){if(!ce(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ce(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{i.setTimeout(t,e)})}function ue(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ie(e,t)}function de(e){return e}function fe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var me=Symbol();function he(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ge(e,t){return typeof e==`function`?e(...t):!!e}function _e(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ve=(()=>{let e=()=>o;return{isServer(){return e()},setIsServer(t){e=t}}})();function ye(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function be(e){let t;if(e.then(e=>(t=e,e),s)?.catch(s),t!==void 0)return{data:t}}function xe(e){return e}function Se(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function Ce(e,t,n){let r=()=>{let r=e.promise?.then(t).catch(e=>n(e)?Promise.reject(Error(`redacted`)):Promise.reject(e));return r?.catch(s),r};return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:r()},...e.meta&&{meta:e.meta}}}function we(e){return e.state.isPaused}function Te(e){return e.state.status===`success`}function Ee(e){return!0}function De(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??we,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[Se(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??Te,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors??Ee,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData??xe;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[Ce(e,o,a)]:[])}}function Oe(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??xe,o=t.mutations||[],c=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),c.forEach(({queryKey:t,state:r,queryHash:o,meta:c,promise:l,dehydratedAt:u})=>{let d=l?be(l):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),ee=m?.state.status===`pending`,te=m?.state.fetchStatus===`fetching`;if(m){let e=d&&u!==void 0&&u>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:c},{...r,data:p,fetchStatus:`idle`,status:p===void 0?r.status:`success`});l&&!ee&&!te&&(u===void 0||u>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(l).then(a)}).catch(s)})}var ke=a;function Ae(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ke,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var h=Ae(),je=new class extends t{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Me(e){return Math.min(1e3*2**e,3e4)}function Ne(e){return(e??`online`)===`online`?je.isOnline():!0}var Pe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Fe(e){let t=!1,r=0,i,a=ye(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new Pe(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>n.isFocused()&&(e.networkMode===`always`||je.isOnline())&&e.canRun(),d=()=>Ne(e.networkMode)&&e.canRun(),f=e=>{o()||(i?.(),a.resolve(e))},p=e=>{o()||(i?.(),a.reject(e))},m=()=>new Promise(t=>{i=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{i=void 0,o()||e.onContinue?.()}),ee=()=>{if(o())return;let n,i=r===0?e.initialPromise:void 0;try{n=i??e.fn()}catch(e){n=Promise.reject(e)}Promise.resolve(n).then(f).catch(n=>{if(o())return;let i=e.retry??(ve.isServer()?0:3),a=e.retryDelay??Me,s=typeof a==`function`?a(r,n):a,c=i===!0||typeof i==`number`&&r<i||typeof i==`function`&&i(r,n);if(t||!c){p(n);return}r++,e.onFail?.(r,n),le(s).then(()=>u()?void 0:m()).then(()=>{t?p(n):ee()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(i?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?ee():m().then(ee),a)}}var Ie=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),l(this.gcTime)&&(this.#e=i.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ve.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(i.clearTimeout(this.#e),this.#e=void 0)}},Le=class extends Ie{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Be(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Be(this.options);e.data!==void 0&&(this.setState(ze(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ue(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(s).catch(s):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>f(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>d(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!u(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=he(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Fe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Pe&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Pe){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Re(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ze(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),h.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Re(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ne(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ze(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Be(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}function Ve(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_e(e,()=>t.signal,()=>n=!0)},u=he(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?pe:fe;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ue:He,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:He(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function He(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ue(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function We(e,t){return t?He(e,t)!=null:!1}function Ge(e,t){return!t||!e.getPreviousPageParam?!1:Ue(e,t)!=null}var Ke=class extends Ie{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Fe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),h.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function qe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Je=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ke({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ye(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){h.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>m(t,e))}findAll(e={}){return this.getAll().filter(t=>m(e,t))}notify(e){h.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return h.batch(()=>Promise.all(e.map(e=>e.continue().catch(s))))}};function Ye(e){return e.options.scope?.id}var Xe=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new Le({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){h.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>p(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>p(e,t)):t}notify(e){h.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){h.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){h.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ze=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Xe,this.#t=e.mutationCache||new Je,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=n.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=je.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(d(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=c(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return h.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;h.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return h.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=h.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(s).catch(s)}invalidateQueries(e,t={}){return h.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=h.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(s)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(s)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(d(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(s).catch(s)}fetchInfiniteQuery(e){return e.behavior=Ve(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(s).catch(s)}ensureInfiniteQueryData(e){return e.behavior=Ve(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return je.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(te(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ne(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(te(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ne(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ee(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===me&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},g;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(g||={});var Qe;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Qe||={});var _=g.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),v=e=>{switch(typeof e){case`undefined`:return _.undefined;case`string`:return _.string;case`number`:return Number.isNaN(e)?_.nan:_.number;case`boolean`:return _.boolean;case`function`:return _.function;case`bigint`:return _.bigint;case`symbol`:return _.symbol;case`object`:return Array.isArray(e)?_.array:e===null?_.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?_.promise:typeof Map<`u`&&e instanceof Map?_.map:typeof Set<`u`&&e instanceof Set?_.set:typeof Date<`u`&&e instanceof Date?_.date:_.object;default:return _.unknown}},y=g.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),$e=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`),b=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};b.create=e=>new b(e);var et=(e,t)=>{let n;switch(e.code){case y.invalid_type:n=e.received===_.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,g.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:n=`Unrecognized key(s) in object: ${g.joinValues(e.keys,`, `)}`;break;case y.invalid_union:n=`Invalid input`;break;case y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${g.joinValues(e.options)}`;break;case y.invalid_enum_value:n=`Invalid enum value. Expected ${g.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:n=`Invalid function arguments`;break;case y.invalid_return_type:n=`Invalid function return type`;break;case y.invalid_date:n=`Invalid date`;break;case y.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:g.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case y.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case y.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case y.custom:n=`Invalid input`;break;case y.invalid_intersection_types:n=`Intersection results could not be merged`;break;case y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,g.assertNever(e)}return{message:n}},tt=et;function nt(e){tt=e}function rt(){return tt}var it=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},at=[];function x(e,t){let n=rt(),r=it({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===et?void 0:et].filter(e=>!!e)});e.common.issues.push(r)}var S=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return C;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return C;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},C=Object.freeze({status:`aborted`}),ot=e=>({status:`dirty`,value:e}),w=e=>({status:`valid`,value:e}),st=e=>e.status===`aborted`,ct=e=>e.status===`dirty`,T=e=>e.status===`valid`,lt=e=>typeof Promise<`u`&&e instanceof Promise,E;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(E||={});var D=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ut=(e,t)=>{if(T(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new b(e.common.issues),this._error}}};function O(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var k=class{get description(){return this._def.description}_getType(e){return v(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lt(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};return ut(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return T(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>T(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},r=this._parse({data:e,path:n.path,parent:n});return ut(n,await(lt(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:y.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new P({schema:this,typeName:L.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return F.create(this,this._def)}nullable(){return I.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qt.create(this)}promise(){return ln.create(this,this._def)}or(e){return Yt.create([this,e],this._def)}and(e){return Qt.create(this,e,this._def)}transform(e){return new P({...O(this._def),schema:this,typeName:L.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new un({...O(this._def),innerType:this,defaultValue:t,typeName:L.ZodDefault})}brand(){return new mn({typeName:L.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new dn({...O(this._def),innerType:this,catchValue:t,typeName:L.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hn.create(this,e)}readonly(){return gn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dt=/^c[^\s-]{8,}$/i,ft=/^[0-9a-z]+$/,pt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ht=/^[a-z0-9_-]{21}$/i,gt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,bt,xt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,St=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ct=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,wt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dt=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Ot=RegExp(`^${Dt}$`);function kt(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function At(e){return RegExp(`^${kt(e)}$`)}function jt(e){let t=`${Dt}T${kt(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Mt(e,t){return!!((t===`v4`||!t)&&xt.test(e)||(t===`v6`||!t)&&Ct.test(e))}function Nt(e,t){if(!gt.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Pt(e,t){return!!((t===`v4`||!t)&&St.test(e)||(t===`v6`||!t)&&wt.test(e))}var Ft=class e extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.string,received:t.parsedType}),C}let t=new S,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?x(n,{code:y.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&x(n,{code:y.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)vt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`email`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)bt||=new RegExp(yt,`u`),bt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`emoji`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)mt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`uuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ht.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`nanoid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)dt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ft.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid2`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)pt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ulid`,code:y.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),x(n,{validation:`url`,code:y.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`regex`,code:y.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?jt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?At(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?_t.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`duration`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Mt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ip`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Nt(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`jwt`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Pt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cidr`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64`,code:y.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64url`,code:y.invalid_string,message:r.message}),t.dirty()):g.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:y.invalid_string,...E.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...E.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...E.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...E.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...E.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...E.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...E.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...E.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...E.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...E.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...E.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...E.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...E.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ft.create=e=>new Ft({checks:[],typeName:L.ZodString,coerce:e?.coerce??!1,...O(e)});function It(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Lt=class e extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.number){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.number,received:t.parsedType}),C}let t,n=new S;for(let r of this._def.checks)r.kind===`int`?g.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?It(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_finite,message:r.message}),n.dirty()):g.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,E.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,E.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,E.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,E.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:E.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:E.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:E.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:E.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:E.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Lt.create=e=>new Lt({checks:[],typeName:L.ZodNumber,coerce:e?.coerce||!1,...O(e)});var Rt=class e extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let t,n=new S;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:y.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):g.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.bigint,received:t.parsedType}),C}gte(e,t){return this.setLimit(`min`,e,!0,E.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,E.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,E.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,E.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:E.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:E.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Rt.create=e=>new Rt({checks:[],typeName:L.ZodBigInt,coerce:e?.coerce??!1,...O(e)});var zt=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.boolean,received:t.parsedType}),C}return w(e.data)}};zt.create=e=>new zt({typeName:L.ZodBoolean,coerce:e?.coerce||!1,...O(e)});var Bt=class e extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.date,received:t.parsedType}),C}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:y.invalid_date}),C;let t=new S,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):g.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Bt.create=e=>new Bt({checks:[],coerce:e?.coerce||!1,typeName:L.ZodDate,...O(e)});var Vt=class extends k{_parse(e){if(this._getType(e)!==_.symbol){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.symbol,received:t.parsedType}),C}return w(e.data)}};Vt.create=e=>new Vt({typeName:L.ZodSymbol,...O(e)});var Ht=class extends k{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.undefined,received:t.parsedType}),C}return w(e.data)}};Ht.create=e=>new Ht({typeName:L.ZodUndefined,...O(e)});var Ut=class extends k{_parse(e){if(this._getType(e)!==_.null){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.null,received:t.parsedType}),C}return w(e.data)}};Ut.create=e=>new Ut({typeName:L.ZodNull,...O(e)});var Wt=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};Wt.create=e=>new Wt({typeName:L.ZodAny,...O(e)});var Gt=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};Gt.create=e=>new Gt({typeName:L.ZodUnknown,...O(e)});var A=class extends k{_parse(e){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.never,received:t.parsedType}),C}};A.create=e=>new A({typeName:L.ZodNever,...O(e)});var Kt=class extends k{_parse(e){if(this._getType(e)!==_.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.void,received:t.parsedType}),C}return w(e.data)}};Kt.create=e=>new Kt({typeName:L.ZodVoid,...O(e)});var qt=class e extends k{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==_.array)return x(t,{code:y.invalid_type,expected:_.array,received:t.parsedType}),C;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(x(t,{code:e?y.too_big:y.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(x(t,{code:y.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(x(t,{code:y.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new D(t,e,t.path,n)))).then(e=>S.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new D(t,e,t.path,n)));return S.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:E.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:E.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:E.toString(n)}})}nonempty(e){return this.min(1,e)}};qt.create=(e,t)=>new qt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...O(t)});function Jt(e){if(e instanceof j){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=F.create(Jt(r))}return new j({...e._def,shape:()=>t})}else if(e instanceof qt)return new qt({...e._def,type:Jt(e.element)});else if(e instanceof F)return F.create(Jt(e.unwrap()));else if(e instanceof I)return I.create(Jt(e.unwrap()));else if(e instanceof N)return N.create(e.items.map(e=>Jt(e)));else return e}var j=class e extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:g.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==_.object){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof A&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new D(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof A){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(x(n,{code:y.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new D(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>S.mergeObjectSync(t,e)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return E.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:E.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:L.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of g.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of g.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Jt(this)}partial(t){let n={};for(let e of g.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of g.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof F;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return on(g.objectKeys(this.shape))}};j.create=(e,t)=>new j({shape:()=>e,unknownKeys:`strip`,catchall:A.create(),typeName:L.ZodObject,...O(t)}),j.strictCreate=(e,t)=>new j({shape:()=>e,unknownKeys:`strict`,catchall:A.create(),typeName:L.ZodObject,...O(t)}),j.lazycreate=(e,t)=>new j({shape:e,unknownKeys:`strip`,catchall:A.create(),typeName:L.ZodObject,...O(t)});var Yt=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new b(e.ctx.common.issues));return x(t,{code:y.invalid_union,unionErrors:n}),C}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new b(e));return x(t,{code:y.invalid_union,unionErrors:i}),C}}get options(){return this._def.options}};Yt.create=(e,t)=>new Yt({options:e,typeName:L.ZodUnion,...O(t)});var M=e=>e instanceof rn?M(e.schema):e instanceof P?M(e.innerType()):e instanceof an?[e.value]:e instanceof sn?e.options:e instanceof cn?g.objectValues(e.enum):e instanceof un?M(e._def.innerType):e instanceof Ht?[void 0]:e instanceof Ut?[null]:e instanceof F?[void 0,...M(e.unwrap())]:e instanceof I?[null,...M(e.unwrap())]:e instanceof mn||e instanceof gn?M(e.unwrap()):e instanceof dn?M(e._def.innerType):[],Xt=class e extends k{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return x(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),C;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=M(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:L.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...O(r)})}};function Zt(e,t){let n=v(e),r=v(t);if(e===t)return{valid:!0,data:e};if(n===_.object&&r===_.object){let n=g.objectKeys(t),r=g.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Zt(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Zt(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===_.date&&r===_.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Qt=class extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(st(e)||st(r))return C;let i=Zt(e.value,r.value);return i.valid?((ct(e)||ct(r))&&t.dirty(),{status:t.value,value:i.data}):(x(n,{code:y.invalid_intersection_types}),C)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Qt.create=(e,t,n)=>new Qt({left:e,right:t,typeName:L.ZodIntersection,...O(n)});var N=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return x(n,{code:y.invalid_type,expected:_.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return x(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),C;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new D(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>S.mergeArray(t,e)):S.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};N.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new N({items:e,typeName:L.ZodTuple,rest:null,...O(t)})};var $t=class e extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return x(n,{code:y.invalid_type,expected:_.object,received:n.parsedType}),C;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new D(n,e,n.path,e)),value:a._parse(new D(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?S.mergeObjectAsync(t,r):S.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof k?new e({keyType:t,valueType:n,typeName:L.ZodRecord,...O(r)}):new e({keyType:Ft.create(),valueType:t,typeName:L.ZodRecord,...O(n)})}},en=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return x(n,{code:y.invalid_type,expected:_.map,received:n.parsedType}),C;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new D(n,e,n.path,[a,`key`])),value:i._parse(new D(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};en.create=(e,t,n)=>new en({valueType:t,keyType:e,typeName:L.ZodMap,...O(n)});var tn=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return x(n,{code:y.invalid_type,expected:_.set,received:n.parsedType}),C;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(x(n,{code:y.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(x(n,{code:y.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return C;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new D(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:E.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:E.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};tn.create=(e,t)=>new tn({valueType:e,minSize:null,maxSize:null,typeName:L.ZodSet,...O(t)});var nn=class e extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return x(t,{code:y.invalid_type,expected:_.function,received:t.parsedType}),C;function n(e,n){return it({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rt(),et].filter(e=>!!e),issueData:{code:y.invalid_arguments,argumentsError:n}})}function r(e,n){return it({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rt(),et].filter(e=>!!e),issueData:{code:y.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ln){let e=this;return w(async function(...t){let o=new b([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return w(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new b([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new b([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:N.create(t).rest(Gt.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||N.create([]).rest(Gt.create()),returns:n||Gt.create(),typeName:L.ZodFunction,...O(r)})}},rn=class extends k{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};rn.create=(e,t)=>new rn({getter:e,typeName:L.ZodLazy,...O(t)});var an=class extends k{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:`valid`,value:e.data}}get value(){return this._def.value}};an.create=(e,t)=>new an({value:e,typeName:L.ZodLiteral,...O(t)});function on(e,t){return new sn({values:e,typeName:L.ZodEnum,...O(t)})}var sn=class e extends k{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:g.joinValues(n),received:t.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:y.invalid_enum_value,options:n}),C}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};sn.create=on;var cn=class extends k{_parse(e){let t=g.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let e=g.objectValues(t);return x(n,{expected:g.joinValues(e),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||=new Set(g.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=g.objectValues(t);return x(n,{received:n.data,code:y.invalid_enum_value,options:e}),C}return w(e.data)}get enum(){return this._def.values}};cn.create=(e,t)=>new cn({values:e,typeName:L.ZodNativeEnum,...O(t)});var ln=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==_.promise&&t.common.async===!1?(x(t,{code:y.invalid_type,expected:_.promise,received:t.parsedType}),C):w((t.parsedType===_.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ln.create=(e,t)=>new ln({type:e,typeName:L.ZodPromise,...O(t)});var P=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{x(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return C;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ot(r.value):r});{if(t.value===`aborted`)return C;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?ot(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?C:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?C:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!T(e))return C;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>T(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):C);g.assertNever(r)}};P.create=(e,t,n)=>new P({schema:e,typeName:L.ZodEffects,effect:t,...O(n)}),P.createWithPreprocess=(e,t,n)=>new P({schema:t,effect:{type:`preprocess`,transform:e},typeName:L.ZodEffects,...O(n)});var F=class extends k{_parse(e){return this._getType(e)===_.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};F.create=(e,t)=>new F({innerType:e,typeName:L.ZodOptional,...O(t)});var I=class extends k{_parse(e){return this._getType(e)===_.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(e,t)=>new I({innerType:e,typeName:L.ZodNullable,...O(t)});var un=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};un.create=(e,t)=>new un({innerType:e,typeName:L.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...O(t)});var dn=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return lt(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};dn.create=(e,t)=>new dn({innerType:e,typeName:L.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...O(t)});var fn=class extends k{_parse(e){if(this._getType(e)!==_.nan){let t=this._getOrReturnCtx(e);return x(t,{code:y.invalid_type,expected:_.nan,received:t.parsedType}),C}return{status:`valid`,value:e.data}}};fn.create=e=>new fn({typeName:L.ZodNaN,...O(e)});var pn=Symbol(`zod_brand`),mn=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hn=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),ot(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:L.ZodPipeline})}},gn=class extends k{_parse(e){let t=this._def.innerType._parse(e),n=e=>(T(e)&&(e.value=Object.freeze(e.value)),e);return lt(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};gn.create=(e,t)=>new gn({innerType:e,typeName:L.ZodReadonly,...O(t)});function _n(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function vn(e,t={},n){return e?Wt.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=_n(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=_n(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):Wt.create()}var yn={object:j.lazycreate},L;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(L||={});var bn=(e,t={message:`Input not instance of ${e.name}`})=>vn(t=>t instanceof e,t),R=Ft.create,z=Lt.create,xn=fn.create,Sn=Rt.create,B=zt.create,Cn=Bt.create,wn=Vt.create,Tn=Ht.create,En=Ut.create,Dn=Wt.create,V=Gt.create,On=A.create,kn=Kt.create,H=qt.create,U=j.create,An=j.strictCreate,jn=Yt.create,W=Xt.create,Mn=Qt.create,Nn=N.create,G=$t.create,Pn=en.create,Fn=tn.create,In=nn.create,Ln=rn.create,K=an.create,q=sn.create,Rn=cn.create,zn=ln.create,Bn=P.create,Vn=F.create,Hn=I.create,Un=P.createWithPreprocess,Wn=hn.create,Gn=()=>R().optional(),Kn=()=>z().optional(),qn=()=>B().optional(),Jn={string:(e=>Ft.create({...e,coerce:!0})),number:(e=>Lt.create({...e,coerce:!0})),boolean:(e=>zt.create({...e,coerce:!0})),bigint:(e=>Rt.create({...e,coerce:!0})),date:(e=>Bt.create({...e,coerce:!0}))},Yn=C,Xn=e({BRAND:()=>pn,DIRTY:()=>ot,EMPTY_PATH:()=>at,INVALID:()=>C,NEVER:()=>Yn,OK:()=>w,ParseStatus:()=>S,Schema:()=>k,ZodAny:()=>Wt,ZodArray:()=>qt,ZodBigInt:()=>Rt,ZodBoolean:()=>zt,ZodBranded:()=>mn,ZodCatch:()=>dn,ZodDate:()=>Bt,ZodDefault:()=>un,ZodDiscriminatedUnion:()=>Xt,ZodEffects:()=>P,ZodEnum:()=>sn,ZodError:()=>b,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>nn,ZodIntersection:()=>Qt,ZodIssueCode:()=>y,ZodLazy:()=>rn,ZodLiteral:()=>an,ZodMap:()=>en,ZodNaN:()=>fn,ZodNativeEnum:()=>cn,ZodNever:()=>A,ZodNull:()=>Ut,ZodNullable:()=>I,ZodNumber:()=>Lt,ZodObject:()=>j,ZodOptional:()=>F,ZodParsedType:()=>_,ZodPipeline:()=>hn,ZodPromise:()=>ln,ZodReadonly:()=>gn,ZodRecord:()=>$t,ZodSchema:()=>k,ZodSet:()=>tn,ZodString:()=>Ft,ZodSymbol:()=>Vt,ZodTransformer:()=>P,ZodTuple:()=>N,ZodType:()=>k,ZodUndefined:()=>Ht,ZodUnion:()=>Yt,ZodUnknown:()=>Gt,ZodVoid:()=>Kt,addIssueToContext:()=>x,any:()=>Dn,array:()=>H,bigint:()=>Sn,boolean:()=>B,coerce:()=>Jn,custom:()=>vn,date:()=>Cn,datetimeRegex:()=>jt,defaultErrorMap:()=>et,discriminatedUnion:()=>W,effect:()=>Bn,enum:()=>q,function:()=>In,getErrorMap:()=>rt,getParsedType:()=>v,instanceof:()=>bn,intersection:()=>Mn,isAborted:()=>st,isAsync:()=>lt,isDirty:()=>ct,isValid:()=>T,late:()=>yn,lazy:()=>Ln,literal:()=>K,makeIssue:()=>it,map:()=>Pn,nan:()=>xn,nativeEnum:()=>Rn,never:()=>On,null:()=>En,nullable:()=>Hn,number:()=>z,object:()=>U,objectUtil:()=>Qe,oboolean:()=>qn,onumber:()=>Kn,optional:()=>Vn,ostring:()=>Gn,pipeline:()=>Wn,preprocess:()=>Un,promise:()=>zn,quotelessJson:()=>$e,record:()=>G,set:()=>Fn,setErrorMap:()=>nt,strictObject:()=>An,string:()=>R,symbol:()=>wn,transformer:()=>Bn,tuple:()=>Nn,undefined:()=>Tn,union:()=>jn,unknown:()=>V,util:()=>g,void:()=>kn}),Zn=U({username:R().min(1),password:R().min(1)}),Qn=U({ok:K(!0),changePassword:B()}),$n=U({oldPassword:R().min(1),newPassword:R().min(6)}),er=U({ok:K(!0)}),tr=U({authenticated:B(),username:R().optional()});U({username:R(),passwordHash:R()});var nr=1883,rr=4840,ir=1502,ar=65535,or=1e4,sr=/^[a-zA-Z0-9_-]{1,64}$/,cr=/^\$param\.(\S+)$/,lr=z().int().min(1).max(ar),ur=U({state:q([`healthy`,`busy`,`saturated`]),pendingWorkCount:z().finite().int().nonnegative(),completedLastTick:z().finite().int().nonnegative()}),dr=U({connected:B(),messagesPublished:z().finite().int().nonnegative(),messagesAttempted:z().finite().int().nonnegative(),messagesFiltered:z().finite().int().nonnegative(),errorsCount:z().finite().int().nonnegative(),lastPublishMs:z().finite().nonnegative(),health:ur.optional()});U({name:R().min(1),enabled:B().default(!0)}).passthrough();var fr=U({name:R().min(1),enabled:B(),pending:B().optional(),endpoint:R().optional(),boundPort:lr.optional(),config:G(R(),V())}),J=U({environmentName:R().min(1).optional(),core:U({state:q([`idle`,`running`,`paused`,`stopped`]),tickCount:z().int().nonnegative(),simulationTimeSeconds:z().finite().nonnegative(),instanceCount:z().int().nonnegative(),memberValueCount:z().int().nonnegative(),quarantinedInstanceCount:z().int().nonnegative(),engineErrorsCount:z().int().nonnegative(),tickOverrunsCount:z().int().nonnegative(),circuitBreakerTripsCount:z().int().nonnegative(),uptimeMs:z().finite().nonnegative(),actualTicksPerSecond:z().finite().nonnegative()}),fleet:U({modelBreakdown:H(U({model:R().min(1),count:z().int().nonnegative()})),lifecycleBreakdown:G(R(),z().int().nonnegative()),activeFaultCount:z().int().nonnegative(),faultBreakdown:H(U({fault:R().min(1),count:z().int().nonnegative()}))}),adapters:H(U({name:R().min(1),metrics:dr}))}),pr=U({environmentName:R().min(1).optional(),models:H(U({name:R().min(1),memberCount:z().int().nonnegative(),faultCount:z().int().nonnegative(),faultNames:H(R().min(1)),hasLifecycle:B()})),instances:H(U({id:R().min(1),model:R().min(1),browsePath:H(R().min(1)),lifecycleStage:R().min(1),operatingHours:z().finite().nonnegative(),activeFaults:H(R().min(1)),isQuarantined:B()})),config:U({seed:z().int().nonnegative(),tickIntervalMs:z().int().positive(),timeMultiplier:z().finite().positive(),adapters:H(R().min(1)),template:U({name:R().min(1),path:R().min(1)}).optional()}),availableAdapters:H(fr).optional()}),mr=U({templateRunId:z().int().nonnegative(),templateName:R().min(1),prefix:R().min(1),instanceIds:H(R().min(1)),models:H(R().min(1)),templatePath:R().min(1).optional()}),hr=U({state:pr,metrics:J,runningTemplates:H(mr),revision:z().int().nonnegative()}),gr=W(`authenticated`,[U({authenticated:K(!1)}),U({authenticated:K(!0),username:R().min(1),runtime:hr})]),_r=U({instanceId:R().min(1),memberName:R().min(1),value:jn([z().finite(),R(),B()]),quality:q([`good`,`bad`,`uncertain`]),timestamp:z().finite().optional()}),vr=W(`kind`,[U({kind:K(`fault:triggered`),instanceId:R().min(1),fault:R().min(1),effects:G(R(),V())}),U({kind:K(`fault:cleared`),instanceId:R().min(1),fault:R().min(1)}),U({kind:K(`lifecycle:changed`),instanceId:R().min(1),from:R().min(1),to:R().min(1),operatingHours:z().finite().nonnegative()}),U({kind:K(`instance:created`),id:R().min(1),assetType:R().min(1),browsePath:H(R().min(1))}),U({kind:K(`instance:removed`),id:R().min(1)}),U({kind:K(`engine:state`),from:J.shape.core.shape.state,to:J.shape.core.shape.state}),U({kind:K(`adapter:enabled`),name:R().min(1),endpoint:R().min(1)}),U({kind:K(`adapter:disabled`),name:R().min(1)})]),yr=U({core:U({memberValueCount:J.shape.core.shape.memberValueCount,quarantinedInstanceCount:J.shape.core.shape.quarantinedInstanceCount,engineErrorsCount:J.shape.core.shape.engineErrorsCount,tickOverrunsCount:J.shape.core.shape.tickOverrunsCount,circuitBreakerTripsCount:J.shape.core.shape.circuitBreakerTripsCount,uptimeMs:J.shape.core.shape.uptimeMs,actualTicksPerSecond:J.shape.core.shape.actualTicksPerSecond}),adapters:J.shape.adapters}),br=W(`type`,[U({type:K(`runtime:snapshot`),snapshot:hr}),U({type:K(`runtime:tick`),revision:z().int().nonnegative(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),delta:H(_r),instanceCount:z().int().nonnegative(),metrics:yr}),U({type:K(`runtime:event`),revision:z().int().nonnegative(),event:vr}),U({type:K(`runtime:resync-required`),revision:z().int().nonnegative(),reason:R().min(1)})]),xr=1e3,Y=U({correlationId:R().optional()}),Sr=Y.extend({type:K(`spawn`),model:R().min(1),count:z().int().positive().max(or),variation:z().min(0).max(1).optional(),unsBasePath:R().min(1).optional(),parameterOverrides:G(R(),z().finite()).optional(),startingHours:z().nonnegative().finite().optional()}),Cr=Y.extend({type:K(`removeInstance`),instanceId:R().min(1)}),wr=Y.extend({type:K(`setParameter`),instanceId:R().min(1),parameter:R().min(1),value:z().finite()}),Tr=Y.extend({type:K(`triggerFault`),instanceId:R().min(1),fault:R().min(1)}),Er=Y.extend({type:K(`clearFault`),instanceId:R().min(1),fault:R().min(1)}),Dr=Y.extend({type:K(`pause`)}),Or=Y.extend({type:K(`resume`)}),kr=Y.extend({type:K(`setSpeed`),multiplier:z().positive().finite().max(xr)}),Ar=Y.extend({type:K(`unquarantine`),instanceId:R().min(1)}),jr=Y.extend({type:K(`invokeMethod`),instanceId:R().min(1),method:R().min(1),arguments:G(R().min(1),jn([z().finite(),R(),B()])).optional()}),Mr=Y.extend({type:K(`loadTemplate`),templatePath:R().min(1),count:z().int().positive().default(1)}),Nr=Y.extend({type:K(`unloadTemplateRun`),templateRunId:z().int().positive()}),Pr=Y.extend({type:K(`resetEnvironment`),clearPersistence:B().optional()}),Fr=Y.extend({type:K(`enableAdapter`),adapter:R().min(1),config:G(R(),V()).optional()}),Ir=Y.extend({type:K(`disableAdapter`),adapter:R().min(1)}),Lr=W(`type`,[Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir]),Rr=U({success:B(),command:R(),correlationId:R().optional(),message:R(),data:V().optional(),error:R().optional()}),zr=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,X=q([`mqtt`,`opcua`,`modbus`]),Br=H(X).min(1),Vr=U({model:R().min(1),count:z().int().positive().max(or).default(1),variation:z().min(0).max(1).default(0),parameters:G(R(),z().finite()).optional(),starting_hours:z().finite().nonnegative().optional(),protocol_scope:Br.optional()}).strict(),Hr=U({name:R().regex(sr,zr),twins:H(Vr).min(1),protocol_scope:Br.optional()}).strict(),Ur=U({name:R().regex(sr,zr),lines:H(Hr).min(1),protocol_scope:Br.optional()}).strict(),Wr=jn([U({enterprise:R().regex(sr,zr),site:R().regex(sr,zr)}).strict(),U({prefix:R().regex(sr,zr)}).strict()]),Gr=U({maxAttempts:z().finite().int().min(0).default(0),initialDelayMs:z().finite().int().positive().default(1e3),maxDelayMs:z().finite().int().positive().default(3e4)}).strict(),Kr=U({enabled:B().default(!1),deadband:z().finite().nonnegative().default(0)}).strict(),qr=q([`base`,`full`]),Jr=U({embedded:B().default(!0),port:z().int().min(0).max(65535).default(1883),external:R().optional(),retain:B().default(!1),username:R().optional(),password:R().optional(),reconnect:Gr.optional(),rbe:Kr.optional(),metadata:qr.default(`base`),drain_budget:z().int().min(512).max(65536).optional(),batch_size:z().int().min(64).max(16384).optional(),broker_concurrency:z().int().min(10).max(5e3).optional()}).refine(e=>!(e.embedded&&e.external),{message:`Cannot use both 'embedded: true' and 'external' URL. Set 'embedded: false' when using an external broker.`}).refine(e=>!e.password||e.username,{message:`Cannot set 'password' without 'username'.`}),Yr=U({port:z().int().min(0).max(65535).default(rr),host:R().default(`0.0.0.0`),security:q([`none`]).default(`none`),buildInfo:U({productName:R().default(`Miravo`)}).strict().optional(),write_budget:z().int().min(512).max(65536).optional()}),Xr=U({port:z().int().min(0).max(65535).default(ir),host:R().default(`0.0.0.0`)}),Zr=U({mqtt:Jr.optional(),opcua:Yr.optional(),modbus:Xr.optional()}).strict(),Qr=q([`real-time`,`accelerated`]),$r=U({tick_interval_ms:z().int().positive().default(1e3),time_mode:Qr.default(`real-time`),time_multiplier:z().positive().default(1),seed:z().int().optional(),overrun_threshold_multiplier:z().min(1).max(10).optional()}).strict();U({kind:K(`MiravoTemplate`),version:K(`1`),name:R().min(1),description:R().optional(),namespace:Wr.optional(),areas:H(Ur).min(1),protocols:Zr.optional(),settings:$r.optional()}).strict();var ei=U({name:R().min(1),description:R().nullable(),memberCount:z().int().nonnegative(),methodCount:z().int().nonnegative(),faultCount:z().int().nonnegative(),hasLifecycle:B(),lifecycleStageCount:z().int().nonnegative(),source:R().min(1)}),ti=U({model:R().min(1),count:z().int().nonnegative(),variation:z().finite().nonnegative(),parameters:G(R().min(1),z().finite()).optional(),protocol_scope:H(X).optional()}),ni=U({name:R().min(1),twins:H(ti),protocol_scope:H(X).optional()}),ri=U({name:R().min(1),lines:H(ni),protocol_scope:H(X).optional()}),ii=U({id:R().min(1),name:R().min(1),description:R().nullable(),category:R().min(1),models:H(R().min(1)),instanceCount:z().int().nonnegative(),memberCount:z().int().nonnegative(),source:R().min(1)}),ai=ii,oi=ii.extend({topology:H(ri),namespace:U({enterprise:R().min(1).optional(),site:R().min(1).optional(),prefix:R().min(1).optional()}).optional(),settings:U({tickIntervalMs:z().int().positive().optional(),timeMultiplier:z().finite().positive().optional()}).optional()}),si=q([`idle`,`running`,`paused`,`stopped`]),ci=U({events:H(W(`type`,[U({id:z().int().nonnegative(),type:K(`fault:triggered`),instanceId:R().min(1),fault:R().min(1),effects:G(R(),V()),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`fault:cleared`),instanceId:R().min(1),fault:R().min(1),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`lifecycle:changed`),instanceId:R().min(1),from:R().min(1),to:R().min(1),operatingHours:z().finite().nonnegative(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`instance:created`),instanceId:R().min(1),assetType:R().min(1),browsePath:H(R().min(1)),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`instance:removed`),instanceId:R().min(1),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`engine:state-changed`),from:si,to:si,tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`platform:resource`),operationId:R().min(1),operationType:q([`apply`,`cleanup`]),templateId:R().min(1),targetLabel:R().min(1),hostname:R().min(1),phase:R().min(1),resourceType:R().min(1),resourceName:R().min(1),action:R().min(1),status:q([`success`,`failed`]),error:R().optional(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()}),U({id:z().int().nonnegative(),type:K(`platform:operation`),operationId:R().min(1),operationType:q([`apply`,`cleanup`]),templateId:R().min(1),targetLabel:R().min(1),hostname:R().min(1),applied:z().int().nonnegative(),failed:z().int().nonnegative(),duration:z().int().nonnegative(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),timestamp:z().finite().nonnegative()})])),nextCursor:z().int().nonnegative().nullable(),hasMore:B()}),li=jn([z().finite(),R(),B()]),ui=Nn([z().finite(),z().finite()]),di=U({name:R().min(1),dataType:R().min(1),description:R().nullable()}),fi=U({description:R().nullable(),inputArguments:H(di),outputArguments:H(di)}),pi=U({id:R().min(1),assetType:R().min(1),browsePath:H(R().min(1)),lifecycleStage:R().min(1),operatingHours:z().finite().nonnegative(),activeFaults:H(R().min(1)),isQuarantined:B(),parameters:G(R().min(1),U({value:li,type:R().min(1),unit:R().optional()})),members:G(R().min(1),U({value:li,quality:q([`good`,`bad`,`uncertain`]),timestamp:z().finite(),meta:U({kind:R().min(1),dataType:R().min(1),access:R().min(1),unit:R().nullable(),euRange:ui.nullable()})})),methods:G(R().min(1),fi)}),mi=U({enabled:B(),port:z().int().positive().optional()}),hi=U({instance:R().min(1),browsePath:R(),member:R().min(1),model:R().min(1),dataType:R().min(1),unit:R().optional(),euRange:Nn([z().finite(),z().finite()]).optional(),access:R().min(1),kind:q([`variable`,`property`]),protocols:G(R(),G(R(),V()))}),gi=U({template:R().min(1).optional(),generatedAt:R().datetime(),protocols:G(R(),mi),tags:H(hi),summary:U({totalTags:z().int().nonnegative(),totalInstances:z().int().nonnegative(),enabledProtocols:H(R().min(1))})}),_i=U({name:R().min(1),description:R().nullable(),parameters:G(R().min(1),U({type:R().min(1),default:li,unit:R().optional()})),members:G(R().min(1),U({kind:R().min(1),dataType:R().min(1),access:R().min(1),unit:R().nullable(),euRange:ui.nullable(),default:li.nullable()})),methods:G(R().min(1),fi),faults:H(R().min(1)),lifecycle:U({stages:H(R().min(1)),totalHours:z().finite().nonnegative()}).nullable()}),vi=q([`devices`,`models`,`instances`]),yi=q([`create`,`update`,`replace`,`delete`,`blocked`]),bi=q([`device`,`model`,`instance`,`param-sync`]),xi=q([`apply`,`cleanup`]),Si=q([`success`,`partial`,`blocked`,`noop`,`failed`]);q([`device`,`model`,`instance`,`param-sync`]),q([`create`,`update`,`replace`,`delete`]);var Ci=U({area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),wi=U({action:yi,resourceType:bi,name:R().min(1),resourceId:R().min(1).optional(),protocol:X.optional(),endpoint:R().min(1).optional(),detail:R().min(1).optional(),blockReason:R().min(1).optional()}),Ti=U({sourceMode:q([`static`,`managed`]),targetHost:R().min(1),sourceHostname:R().min(1).optional(),scope:H(vi),filters:Ci,entries:H(wi)}),Ei=U({plan:Ti}),Di=U({targetId:R().min(1),template:R().min(1).optional(),model:R().min(1).optional(),protocol:X.optional(),scope:H(vi).optional(),area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional(),ifUnmanaged:q([`fail`,`skip`]).optional(),deviceName:R().min(1).optional()}),Oi=U({plan:Ti,applied:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),ki=U({targetId:R().min(1),template:R().min(1).optional(),allManaged:B().optional(),scope:H(vi).optional(),area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),Ai=U({plan:Ti,deleted:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),ji=U({create:z().int().nonnegative(),update:z().int().nonnegative(),replace:z().int().nonnegative(),delete:z().int().nonnegative(),failed:z().int().nonnegative(),total:z().int().nonnegative()}),Mi=U({device:ji,model:ji,instance:ji,"param-sync":ji}),Ni=U({operations:H(U({schemaVersion:K(1),operationId:R().min(1),operationType:xi,status:Si,templateId:R().min(1),targetId:R().min(1),targetLabel:R().min(1),hostname:R().min(1),scope:H(R().min(1)),filters:Ci,successCount:z().int().nonnegative(),failedCount:z().int().nonnegative(),blockedCount:z().int().nonnegative(),startedAt:z().int().nonnegative(),completedAt:z().int().nonnegative(),durationMs:z().int().nonnegative(),resourceCounts:Mi,error:R().min(1).optional()})),total:z().int().nonnegative(),hasMore:B()}),Pi=U({type:xi.optional(),targetId:R().min(1).optional(),limit:Jn.number().int().positive().max(500).optional(),offset:Jn.number().int().nonnegative().optional()}),Fi=U({cancelled:K(!0)}),Ii=U({operationId:R().min(1),type:xi,template:R().min(1).optional(),model:R().min(1).optional(),environment:R().min(1),totalPlanned:z().int().nonnegative(),attempt:z().int().positive().optional(),maxAttempts:z().int().positive().optional()}),Li=U({operationId:R().min(1),type:xi,targetId:R().min(1).optional(),template:R().min(1).optional(),model:R().min(1).optional()}),Ri=U({operationId:R().min(1),phase:bi,total:z().int().nonnegative()}),zi=U({operationId:R().min(1),phase:bi,name:R().min(1),action:yi,status:q([`success`,`failed`]),error:R().min(1).optional(),index:z().int().positive(),of:z().int().positive()}),Bi=U({operationId:R().min(1),applied:z().int().nonnegative().optional(),deleted:z().int().nonnegative().optional(),failed:z().int().nonnegative(),duration:z().int().nonnegative(),plan:Ti}),Vi=Bi,Hi=Bi,Ui=U({operationId:R().min(1),attempt:z().int().positive(),maxAttempts:z().int().positive(),delayMs:z().int().nonnegative(),error:R().min(1)}),Wi=U({message:R().min(1)}),Gi=U({level:q([`info`,`warn`,`error`]),message:R().min(1),protocol:X.optional(),port:lr.optional(),templatePort:lr.optional()}),Ki=W(`event`,[U({event:K(`log`),data:Gi}),U({event:K(`started`),data:Ii}),U({event:K(`accepted`),data:Li}),U({event:K(`phase`),data:Ri}),U({event:K(`resource`),data:zi}),U({event:K(`complete`),data:Vi}),U({event:K(`cancelled`),data:Hi}),U({event:K(`retrying`),data:Ui}),U({event:K(`error`),data:Wi})]),qi=`litmus-edge`,Ji=U({id:R().min(1),platformId:R().min(1),label:R().min(1),hostname:R().min(1),apiTokenSet:B(),sourceHostname:R().min(1),lastUsedAt:z().int().nonnegative().optional()}).strict(),Yi=U({targets:H(Ji)}).strict(),Xi=U({platformId:R().min(1).default(qi),label:R().min(1),hostname:R().min(1),apiToken:R().min(1),sourceHostname:R().min(1)}),Zi=U({platformId:R().min(1).optional(),label:R().min(1).optional(),hostname:R().min(1).optional(),apiToken:R().min(1).optional(),sourceHostname:R().min(1).optional()}),Qi=U({targetId:R().min(1).optional(),hostname:R().min(1),apiToken:R().min(1).optional(),sourceHostname:R().min(1)}).superRefine((e,t)=>{!e.targetId&&!e.apiToken&&t.addIssue({code:y.custom,message:`apiToken is required when targetId is omitted.`,path:[`apiToken`]})}),$i=W(`connected`,[U({connected:K(!0),hostname:R().min(1),sourceHostname:R().min(1)}),U({connected:K(!1),error:R().min(1)})]),ea=U({status:q([`ok`,`fail`]),environmentState:J.shape.core.shape.state,tickCount:z().int().nonnegative(),mqttEnabled:B(),mqttConnected:B().nullable(),opcuaEnabled:B(),opcuaConnected:B().nullable(),modbusEnabled:B(),modbusConnected:B().nullable(),stalled:B(),reason:R().optional(),environmentName:R().min(1).optional(),runId:R().min(1).optional()}),ta=U({reason:R().min(1).optional()}),na=U({status:K(`shutting_down`)}),ra=U({id:R().min(1)}),ia=U({name:R().min(1)}),aa=U({id:R().min(1)}),oa=U({operationId:R().min(1)}),sa=U({id:R().min(1)}),ca=U({type:q([`fault:triggered`,`fault:cleared`,`lifecycle:changed`,`instance:created`,`instance:removed`,`engine:state-changed`,`platform:resource`,`platform:operation`]).optional(),instanceId:R().min(1).optional(),limit:Jn.number().int().positive().max(1e3).optional(),cursor:Jn.number().int().nonnegative().optional()}),la=U({host:R().min(1),protocol:X.optional()}),ua=G(R(),V()),da=[{method:`GET`,path:`/openapi.json`,operationId:`openApiDocument`,auth:`none`,response:{kind:`json`,schema:G(R(),V())},description:`Generated OpenAPI document for the Miravo admin API.`},{method:`GET`,path:`/healthz`,operationId:`health`,auth:`none`,response:{kind:`json`,schema:ea},description:`Liveness probe for the Miravo admin server.`},{method:`GET`,path:`/readyz`,operationId:`readiness`,auth:`none`,response:{kind:`json`,schema:ea},description:`Readiness probe for the Miravo admin server.`},{method:`GET`,path:`/metrics`,operationId:`metrics`,auth:`required`,response:{kind:`json`,schema:J},description:`Engine metrics snapshot.`},{method:`GET`,path:`/state`,operationId:`state`,auth:`required`,response:{kind:`json`,schema:pr},description:`Engine state snapshot.`},{method:`GET`,path:`/bootstrap`,operationId:`bootstrap`,auth:`none`,response:{kind:`json`,schema:gr},description:`Console bootstrap payload.`},{method:`POST`,path:`/commands`,operationId:`commands`,auth:`required`,body:Lr,response:{kind:`json`,schema:Rr},description:`Execute an engine command.`},{method:`POST`,path:`/shutdown`,operationId:`shutdown`,auth:`required`,body:ta,response:{kind:`json`,schema:na},description:`Request graceful shutdown.`},{method:`GET`,path:`/instances/:id`,operationId:`instanceDetail`,auth:`required`,params:ra,response:{kind:`json`,schema:pi},description:`Inspect a running instance.`},{method:`GET`,path:`/models/:name`,operationId:`modelDetail`,auth:`required`,params:ia,response:{kind:`json`,schema:_i},description:`Inspect a registered model schema.`},{method:`GET`,path:`/events`,operationId:`events`,auth:`required`,query:ca,response:{kind:`json`,schema:ci},description:`Read paginated event log entries.`},{method:`GET`,path:`/catalog/models`,operationId:`catalogModels`,auth:`required`,response:{kind:`json`,schema:H(ei)},description:`List catalog models.`},{method:`GET`,path:`/catalog/models/:name/le-dt.json`,operationId:`catalogModelLeDt`,auth:`required`,params:ia,response:{kind:`json`,schema:ua},description:`Download LE Digital Twin JSON for a catalog model.`},{method:`GET`,path:`/catalog/models/:name/yaml`,operationId:`catalogModelYaml`,auth:`required`,params:ia,response:{kind:`yaml`},description:`Read raw YAML for a catalog model.`},{method:`GET`,path:`/catalog/models/:name`,operationId:`catalogModelDetail`,auth:`required`,params:ia,response:{kind:`json`,schema:_i},description:`Read catalog model schema.`},{method:`GET`,path:`/catalog/templates/:id/le-template.json`,operationId:`catalogTemplateLeTemplateJson`,auth:`required`,params:aa,query:la,response:{kind:`passthrough`},description:`Download LE template JSON export.`},{method:`GET`,path:`/catalog/templates/:id/le-tags.csv`,operationId:`catalogTemplateLeTagsCsv`,auth:`required`,params:aa,query:la,response:{kind:`passthrough`},description:`Download LE tags CSV export.`},{method:`GET`,path:`/catalog/templates/:id/yaml`,operationId:`catalogTemplateYaml`,auth:`required`,params:aa,response:{kind:`yaml`},description:`Read raw YAML for a catalog template.`},{method:`GET`,path:`/catalog/templates/:id`,operationId:`catalogTemplateDetail`,auth:`required`,params:aa,response:{kind:`json`,schema:oi},description:`Read catalog template detail.`},{method:`GET`,path:`/catalog/templates`,operationId:`catalogTemplates`,auth:`required`,response:{kind:`json`,schema:H(ai)},description:`List catalog templates.`},{method:`GET`,path:`/running-templates`,operationId:`runningTemplates`,auth:`required`,response:{kind:`json`,schema:H(mr)},description:`List running template runs.`},{method:`GET`,path:`/manifest`,operationId:`manifest`,auth:`required`,response:{kind:`json`,schema:gi},description:`Read unified protocol manifest.`},{method:`POST`,path:`/auth/login`,operationId:`authLogin`,auth:`none`,body:Zn,response:{kind:`json`,schema:Qn},description:`Authenticate and create an admin session.`},{method:`POST`,path:`/auth/logout`,operationId:`authLogout`,auth:`none`,response:{kind:`json`,schema:er},description:`Destroy the current admin session.`},{method:`PUT`,path:`/auth/password`,operationId:`authPassword`,auth:`required`,body:$n,response:{kind:`json`,schema:er},description:`Change the admin password.`},{method:`GET`,path:`/auth/status`,operationId:`authStatus`,auth:`none`,response:{kind:`json`,schema:tr},description:`Check the current session status.`},{method:`GET`,path:`/ws`,operationId:`runtimeWebSocket`,auth:`required`,response:{kind:`passthrough`},description:`Upgrade to the runtime WebSocket stream.`},{method:`GET`,path:`/platforms/le/operations`,operationId:`platformOperations`,auth:`required`,query:Pi,response:{kind:`json`,schema:Ni},description:`List persisted platform operation summaries.`},{method:`GET`,path:`/platforms/le/targets`,operationId:`platformTargets`,auth:`required`,response:{kind:`json`,schema:Yi},description:`List saved LE targets.`},{method:`POST`,path:`/platforms/le/targets`,operationId:`platformTargetCreate`,auth:`required`,body:Xi,response:{kind:`json`,schema:Ji},description:`Create an LE target.`},{method:`POST`,path:`/platforms/le/targets/test`,operationId:`platformConnectionTest`,auth:`required`,body:Qi,response:{kind:`json`,schema:$i},description:`Test LE target connectivity.`},{method:`GET`,path:`/platforms/le/targets/:id`,operationId:`platformTargetDetail`,auth:`required`,params:sa,response:{kind:`json`,schema:Ji},description:`Read one LE target.`},{method:`PUT`,path:`/platforms/le/targets/:id`,operationId:`platformTargetById`,auth:`required`,params:sa,body:Zi,response:{kind:`json`,schema:Ji},description:`Update one LE target.`},{method:`DELETE`,path:`/platforms/le/targets/:id`,operationId:`platformTargetDelete`,auth:`required`,params:sa,response:{kind:`json`,schema:U({message:R().min(1)})},description:`Delete one LE target.`},{method:`POST`,path:`/platforms/le/plan`,operationId:`platformPlan`,auth:`required`,body:Di,response:{kind:`json`,schema:Ei},description:`Preview an LE apply plan.`},{method:`POST`,path:`/platforms/le/apply`,operationId:`platformApply`,auth:`required`,body:Di,response:{kind:`json`,schema:Oi},additionalSuccessResponses:{207:Oi},description:`Apply a platform plan.`},{method:`POST`,path:`/platforms/le/cleanup/plan`,operationId:`platformCleanupPlan`,auth:`required`,body:ki,response:{kind:`json`,schema:Ei},description:`Preview an LE cleanup plan.`},{method:`POST`,path:`/platforms/le/cleanup`,operationId:`platformCleanup`,auth:`required`,body:ki,response:{kind:`json`,schema:Ai},additionalSuccessResponses:{207:Ai},description:`Execute LE cleanup.`},{method:`POST`,path:`/platforms/le/operations/:operationId/cancel`,operationId:`platformOperationCancel`,auth:`required`,params:oa,response:{kind:`json`,schema:Fi},description:`Cancel an in-flight streaming LE operation.`},{method:`POST`,path:`/platforms/le/apply/stream`,operationId:`platformApplyStream`,auth:`required`,body:Di,response:{kind:`passthrough`},description:`Stream LE apply progress over SSE.`},{method:`POST`,path:`/platforms/le/cleanup/stream`,operationId:`platformCleanupStream`,auth:`required`,body:ki,response:{kind:`passthrough`},description:`Stream LE cleanup progress over SSE.`}],fa=U({code:q([`UNAUTHORIZED`,`NOT_FOUND`,`INVALID_REQUEST`,`INTERNAL_ERROR`]),message:R(),hint:R().optional()}),pa={UNAUTHORIZED:401,NOT_FOUND:404,INVALID_REQUEST:400,INTERNAL_ERROR:500},ma=class extends Error{code;status;hint;constructor(e){super(e.message),this.name=`ApiError`,this.code=e.code,this.status=e.status??pa[e.code],this.hint=e.hint}static is(e){return e instanceof Error&&e.name===`ApiError`}};function ha(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ga(e,t){return e?._def?.typeName===t}function _a(e,t){let n=e.ZodType.prototype[t];e.ZodType.prototype[t]=function(...e){let t=n.apply(this,e);return t._def.openapi=this._def.openapi,t}}function va(e){if(e.ZodType.prototype.openapi!==void 0)return;e.ZodType.prototype.openapi=function(e,t){let n=(typeof e==`string`?t:e)??{},{param:r}=n,i=ha(n,[`param`]),a=Object.assign(Object.assign({},this._def.openapi?._internal),typeof e==`string`?{refId:e}:void 0),o=Object.assign(Object.assign(Object.assign({},this._def.openapi?.metadata),i),this._def.openapi?.metadata?.param||r?{param:Object.assign(Object.assign({},this._def.openapi?.metadata?.param),r)}:void 0),s=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys(a).length>0?{_internal:a}:void 0),Object.keys(o).length>0?{metadata:o}:void 0)}));if(ga(this,`ZodObject`)){let e=this.extend;s.extend=function(...t){let n=e.apply(this,t);return n._def.openapi={_internal:{extendedFrom:this._def.openapi?._internal?.refId?{refId:this._def.openapi?._internal?.refId,schema:this}:this._def.openapi?._internal?.extendedFrom},metadata:n._def.openapi?.metadata},n}}return s},_a(e,`optional`),_a(e,`nullable`),_a(e,`default`),_a(e,`transform`),_a(e,`refine`);let t=e.ZodObject.prototype.deepPartial;e.ZodObject.prototype.deepPartial=function(){let e=this._def.shape(),n=t.apply(this),r=n._def.shape();return Object.entries(r).forEach(([t,n])=>{n._def.openapi=e[t]?._def?.openapi}),n._def.openapi=void 0,n};let n=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...e){let t=n.apply(this,e);return t._def.openapi=void 0,t};let r=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...e){let t=r.apply(this,e);return t._def.openapi=void 0,t}}var ya=class{constructor(e){this.parents=e,this._definitions=[]}get definitions(){return[...this.parents?.flatMap(e=>e.definitions)??[],...this._definitions]}register(e,t){let n=this.schemaWithRefId(e,t);return this._definitions.push({type:`schema`,schema:n}),n}registerParameter(e,t){let n=this.schemaWithRefId(e,t),r=n._def.openapi?.metadata,i=n.openapi(Object.assign(Object.assign({},r),{param:Object.assign(Object.assign({},r?.param),{name:r?.param?.name??e})}));return this._definitions.push({type:`parameter`,schema:i}),i}registerPath(e){this._definitions.push({type:`route`,route:e})}registerWebhook(e){this._definitions.push({type:`webhook`,webhook:e})}registerComponent(e,t,n){return this._definitions.push({type:`component`,componentType:e,name:t,component:n}),{name:t,ref:{$ref:`#/components/${e}/${t}`}}}schemaWithRefId(e,t){return t.openapi(e)}};va(Xn),new ya,W(`type`,[Sr.openapi(`SpawnCommand`),Cr.openapi(`RemoveInstanceCommand`),wr.openapi(`SetParameterCommand`),Tr.openapi(`TriggerFaultCommand`),Er.openapi(`ClearFaultCommand`),Dr.openapi(`PauseCommand`),Or.openapi(`ResumeCommand`),kr.openapi(`SetSpeedCommand`),Ar.openapi(`UnquarantineCommand`),jr.openapi(`InvokeMethodCommand`),Mr.openapi(`LoadTemplateCommand`),Nr.openapi(`UnloadTemplateRunCommand`),Pr.openapi(`ResetEnvironmentCommand`),Fr.openapi(`EnableAdapterCommand`),Ir.openapi(`DisableAdapterCommand`)]).openapi(`EngineCommand`);var ba=new Map(da.map(e=>[`${e.method} ${e.path}`,e]));function Z(e,t){let n=ba.get(`${e} ${t}`);if(!n)throw Error(`Missing admin route definition for ${e} ${t}`);return n}var Q={authLogin:Z(`POST`,`/auth/login`),authLogout:Z(`POST`,`/auth/logout`),authPassword:Z(`PUT`,`/auth/password`),authStatus:Z(`GET`,`/auth/status`),bootstrap:Z(`GET`,`/bootstrap`),catalogModelDetail:Z(`GET`,`/catalog/models/:name`),catalogModelLeDt:Z(`GET`,`/catalog/models/:name/le-dt.json`),catalogModels:Z(`GET`,`/catalog/models`),catalogModelYaml:Z(`GET`,`/catalog/models/:name/yaml`),catalogTemplateDetail:Z(`GET`,`/catalog/templates/:id`),catalogTemplateLeTagsCsv:Z(`GET`,`/catalog/templates/:id/le-tags.csv`),catalogTemplateLeTemplateJson:Z(`GET`,`/catalog/templates/:id/le-template.json`),catalogTemplates:Z(`GET`,`/catalog/templates`),catalogTemplateYaml:Z(`GET`,`/catalog/templates/:id/yaml`),commands:Z(`POST`,`/commands`),events:Z(`GET`,`/events`),health:Z(`GET`,`/healthz`),instanceDetail:Z(`GET`,`/instances/:id`),manifest:Z(`GET`,`/manifest`),metrics:Z(`GET`,`/metrics`),modelDetail:Z(`GET`,`/models/:name`),openApiDocument:Z(`GET`,`/openapi.json`),platformApply:Z(`POST`,`/platforms/le/apply`),platformApplyStream:Z(`POST`,`/platforms/le/apply/stream`),platformCleanup:Z(`POST`,`/platforms/le/cleanup`),platformCleanupPlan:Z(`POST`,`/platforms/le/cleanup/plan`),platformCleanupStream:Z(`POST`,`/platforms/le/cleanup/stream`),platformConnectionTest:Z(`POST`,`/platforms/le/targets/test`),platformOperationCancel:Z(`POST`,`/platforms/le/operations/:operationId/cancel`),platformOperations:Z(`GET`,`/platforms/le/operations`),platformPlan:Z(`POST`,`/platforms/le/plan`),platformTargetById:Z(`PUT`,`/platforms/le/targets/:id`),platformTargetCreate:Z(`POST`,`/platforms/le/targets`),platformTargetDelete:Z(`DELETE`,`/platforms/le/targets/:id`),platformTargetDetail:Z(`GET`,`/platforms/le/targets/:id`),platformTargets:Z(`GET`,`/platforms/le/targets`),readiness:Z(`GET`,`/readyz`),runningTemplates:Z(`GET`,`/running-templates`),runtimeWebSocket:Z(`GET`,`/ws`),shutdown:Z(`POST`,`/shutdown`),state:Z(`GET`,`/state`)},xa=new Ze({defaultOptions:{queries:{staleTime:3e4,gcTime:10*6e4,retry:(e,t)=>{if(t instanceof Error&&t.message===`Session expired`)return!1;if(ma.is(t)){let e=t.status;if(e>=400&&e<500)return!1}return e<2},refetchOnWindowFocus:!1}}}),Sa={catalog:{templates:()=>[`catalog`,`templates`],models:()=>[`catalog`,`models`],templateDetail:e=>[`catalog`,`template`,e],modelSchema:e=>[`catalog`,`model-schema`,e],modelSchemasBatch:e=>[`catalog`,`model-schemas-batch`,e]},events:(e,t)=>[`events`,e,t],tags:{manifest:e=>[`tags`,`manifest`,e]},platforms:{targets:()=>[`platforms`,`targets`],operationsList:()=>[`platforms`,`operations`,`list`]},instances:{detail:e=>[`instances`,e]}},Ca=`miravo:query-cache:v1`,wa=5*6e4,Ta=Sa.platforms.targets(),Ea=!0;function Da(e){try{let t=sessionStorage.getItem(Ca);if(!t)return;let n=JSON.parse(t);if(typeof n!=`object`||!n)return;let r=n;if(typeof r.timestamp!=`number`)return;if(Date.now()-r.timestamp>wa){sessionStorage.removeItem(Ca);return}Oe(e,r.state)}catch{}}function Oa(e){try{let t=De(e,{shouldDehydrateQuery:e=>e.state.status===`success`&&!(e.queryKey[0]===Ta[0]&&e.queryKey[1]===Ta[1])}),n={timestamp:Date.now(),state:t};sessionStorage.setItem(Ca,JSON.stringify(n))}catch{}}function ka(e){let t=null,n=e.getQueryCache().subscribe(()=>{Ea&&(t&&clearTimeout(t),t=setTimeout(()=>{Ea&&Oa(e)},500))});return()=>{t&&clearTimeout(t),n()}}function Aa(){try{sessionStorage.removeItem(Ca)}catch{}}function ja(){Ea=!0}function Ma(){Ea=!1}var Na=e({AdminRoutes:()=>Q,BASE_URL:()=>``,CommandError:()=>Fa,changePassword:()=>Va,fetchBlob:()=>Ga,fetchJSON:()=>Ua,fetchText:()=>Ka,getBootstrap:()=>Ha,login:()=>Ra,logout:()=>za,postCommand:()=>Wa,redirectToLoginInApp:()=>Pa,requestJSON:()=>$});function Pa(){typeof window>`u`||(xa.removeQueries({queryKey:[`bootstrap`]}),Aa(),window.location.pathname!==`/login`&&(window.history.pushState({},``,`/login`),window.dispatchEvent(new PopStateEvent(`popstate`))))}var Fa=class extends Error{result;constructor(e){super(e.message),this.name=`CommandError`,this.result=e}};function Ia(e,t){let n=`${e} ${t}`;return e===502||e===503||e===504?`${n} — the Miravo server may not be running, or a reverse proxy cannot reach it.`:n}async function La(e){try{let t=await e.json(),n=fa.safeParse(t);if(n.success)return new ma({code:n.data.code,status:e.status,message:n.data.message,hint:n.data.hint})}catch{}return Error(Ia(e.status,e.statusText))}async function Ra(e,t){return $(`/auth/login`,Q.authLogin,{body:{username:e,password:t}})}async function za(){await $(`/auth/logout`,Q.authLogout)}function Ba(e,t){if(e.response.kind!==`json`)throw Error(`requestJSON requires a JSON route definition for ${e.method} ${e.path}`);return e.additionalSuccessResponses?.[t]??e.response.schema}async function $(e,t,n={}){let{body:r,init:i}=n,a={method:t.method,credentials:`include`,...i};if(t.body){let e=t.body.safeParse(r);if(!e.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${e.error.message}`);a.headers={"content-type":`application/json`,...i?.headers??{}},a.body=JSON.stringify(e.data)}else if(r!==void 0)throw Error(`Route ${t.method} ${t.path} does not accept a JSON body.`);let o=await fetch(`${e}`,a);if(o.status===401&&t.auth===`required`)throw Pa(),Error(`Session expired`);if(!o.ok)throw await La(o);let s;try{s=await o.json()}catch{throw Error(`Invalid JSON response for ${t.method} ${t.path}`)}let c=Ba(t,o.status).safeParse(s);if(!c.success)throw Error(`Invalid response for ${t.method} ${t.path}: ${c.error.message}`);return c.data}async function Va(e,t){return $(`/auth/password`,Q.authPassword,{body:{oldPassword:e,newPassword:t}})}async function Ha(){return $(`/bootstrap`,Q.bootstrap)}async function Ua(e,t){return $(e,t)}async function Wa(e){let t=await $(`/commands`,Q.commands,{body:e});if(!t.success)throw new Fa(t);return t}async function Ga(e,t){if(t.response.kind!==`passthrough`)throw Error(`fetchBlob requires a passthrough route definition for ${t.method} ${t.path}`);let n=await fetch(`${e}`,{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Pa(),Error(`Session expired`);if(!n.ok)throw Error(Ia(n.status,n.statusText));return n.blob()}async function Ka(e,t){if(t.response.kind!==`yaml`)throw Error(`fetchText requires a YAML route definition for ${t.method} ${t.path}`);let n=await fetch(`${e}`,{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Pa(),Error(`Session expired`);if(!n.ok)throw Error(Ia(n.status,n.statusText));return n.text()}export{s as $,H as A,Nn as B,Ki as C,rr as D,nr as E,K as F,Ge as G,V as H,z as I,h as J,Ve as K,U as L,W as M,q as N,sr as O,Ln as P,de as Q,G as R,fa as S,ir as T,y as U,jn as V,We as W,ve as X,ye as Y,l as Z,ka as _,Ua as a,u as at,Q as b,Ra as c,t as ct,Pa as d,ue as et,$ as f,Da as g,ja as h,Ga as i,ge as it,B as j,cr as k,za as l,Ma as m,Na as n,d as nt,Ka as o,i as ot,Aa as p,Re as q,Va as r,ae as rt,Ha as s,n as st,Fa as t,f as tt,Wa as u,Sa as v,br as w,ma as x,xa as y,R as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./catalog-BpH3Cu8D.js";export{e as CatalogPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-BcvPjvmT.js";import{A as r,B as i,D as a,E as o,F as s,H as c,I as l,L as u,M as d,N as f,O as p,P as ee,R as m,T as te,U as h,V as g,j as _,k as ne,z as v}from"./api-Dr74arfP.js";import{t as y}from"./proxy-Dd7NWn5E.js";import{t as b}from"./AnimatePresence-DOKfbxUr.js";import{i as re,r as ie}from"./dist-jROhexoH.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./copy-button-BYq-qqmM.js";import{t as x}from"./shallow-ODRQsuRf.js";import{S,d as fe,l as C,u as pe,w as me,x as he}from"./format-B243kebG.js";import{n as w,t as T}from"./utils-CH98NBUe.js";import{t as ge}from"./activity-CHJbwIn_.js";import{t as _e}from"./arrow-right-DzTjpAuX.js";import{c as ve,i as ye,l as be,n as xe,s as Se,t as Ce}from"./select-TsdpHrOx.js";import{a as we,c as E,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./tabs-CrmZxWmX.js";import{a as D,c as je,i as Me,l as Ne,n as Pe,r as Fe,s as O,t as Ie}from"./validation-DELUYyVZ.js";import{i as Le,n as Re,r as ze,t as Be}from"./checkbox-_saaQAja.js";import{t as Ve}from"./layers-Cg3yeSqL.js";import{c as He,r as Ue,t as k}from"./use-engine-command-mutation-Bc3iCawV.js";import{t as We}from"./triangle-alert-B7bgkvtE.js";import{i as Ge,n as Ke,t as qe}from"./tooltip-5y0snV5M.js";import{r as A}from"./engine-store-BXfht5ME.js";import{t as Je}from"./transition-nav-link-D6yUsYsK.js";import{t as j}from"./badge-Dl0qmCnt.js";import{t as Ye}from"./label-CM_MIru8.js";import{a as M,c as N,i as P,l as F,n as Xe,o as I,r as Ze,s as L,t as Qe}from"./combobox-BqGaRFom.js";var $e=w(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),et=w(`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`}]]),tt=w(`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`}]]),nt=w(`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`}]]),rt=w(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),it=w(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),at=w(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),ot=w(`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`}]]),st=w(`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`}]]),ct=w(`trash`,[[`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`}]]),R=e(t(),1);u({path:v().min(1),name:v().min(1),description:v().optional(),memberCount:l().int().nonnegative(),methodCount:l().int().nonnegative(),faultCount:l().int().nonnegative(),hasLifecycle:_(),lifecycleStageCount:l().int().nonnegative()}),u({path:v().min(1),id:v().min(1),name:v().min(1),description:v().optional(),areaCount:l().int().nonnegative(),twinAssignmentCount:l().int().nonnegative(),uniqueModelCount:l().int().nonnegative(),modelNames:r(v().min(1)),totalTwinCount:l().int().nonnegative()});var lt=u({severity:f([`error`,`warning`]),message:v(),fix:v()});u({valid:_(),templatePath:v(),issues:r(lt)});var ut=`%.A.Hz.L.L/h.L/min.L/s.N.V.bar.cfm.count.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),z=f(ut);new Set(ut);var dt=v().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),B=f([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);f([`variable`,`property`]);var ft=f([`read`,`readwrite`,`write`]),pt=f([`>`,`>=`,`<`,`<=`,`==`,`!=`]),mt=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,ht=d(`type`,[u({type:s(`threshold`),member:v().regex(p,mt),operator:pt,threshold:l().finite()}).strict(),u({type:s(`lifecycle-stage`)}).strict(),u({type:s(`health-state`)}).strict(),u({type:s(`fault-active`)}).strict(),u({type:s(`fault-count`)}).strict(),u({type:s(`active-fault-code`),fallback:v().default(``)}).strict(),u({type:s(`availability-state`),member:v().regex(p,mt),operator:pt.default(`>`),threshold:l().finite().default(0),running_state:v().default(`running`),stopped_state:v().default(`stopped`),faulted_state:v().default(`faulted`)}).strict()]),V=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,H=r(v().min(1)).min(1),gt=u({data_type:B,unit:z.optional(),description:v().optional(),enum_values:H.optional()}).strict(),_t=g([u({member:v().regex(p,V),value:g([l(),v(),_()])}).strict(),u({member:v().regex(p,V),argument:v().regex(p,V)}).strict()]),vt=u({type:s(`set-members`),writes:r(_t).min(1)}).strict(),yt=g([u({parameter:v().regex(p,V),value:l().finite()}).strict(),u({parameter:v().regex(p,V),argument:v().regex(p,V)}).strict()]),bt=d(`type`,[vt,u({type:s(`set-parameters`),writes:r(yt).min(1)}).strict(),u({type:s(`clear-faults`)}).strict()]),xt=u({description:v().optional(),input_arguments:m(v().regex(p,V),gt).optional(),output_arguments:m(v().regex(p,V),gt).optional(),runtime:bt.optional()}).strict(),St=m(v().regex(p,V),xt);function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ct(e){if(typeof e==`string`)return ne.exec(e)?.[1]}function wt(e,t,n){if(!U(e)||e.type!==`weighted-sum`)return;let r=e.terms;if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=r[e];U(i)&&n(i,[...t,`terms`,e])}}function Tt(e,t,n){if(!U(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`generator`];typeof e.member==`string`&&n.onMember?.(e.member,r),typeof e.previous_member==`string`&&n.onPreviousMember?.(e.previous_member,i),typeof e.param==`string`&&n.onParam?.(e.param,a),`generator`in e&&n.onGenerator?.(e.generator,o)}function Et(e,t,n,r){return{onMember:e,onPreviousMember:t,onParam:n,onGenerator:r}}function Dt(e,t,n,r,i,a){Tt(e,t,Et(n,r,i,a))}function W(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function Ot(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function G(e,t){switch(t){case`Boolean`:return typeof e==`boolean`;case`String`:return typeof e==`string`;case`Double`:case`Float`:return typeof e==`number`&&Number.isFinite(e);case`Int32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=-2147483648&&e<=2147483647;case`UInt16`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=65535;case`UInt32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=4294967295;default:return!1}}function kt(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:h.custom,path:[...n,`unit`],message:`Members with data_type "${e.data_type}" must not declare engineering units. Fix: remove the unit or use a numeric data_type.`}),e.enum_values&&e.data_type!==`String`&&t.addIssue({code:h.custom,path:[...n,`enum_values`],message:`enum_values is only valid for String members. Fix: remove enum_values or change data_type to "String".`})}function At(e,t,n,r){if(U(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),q(e.factor,[...t,`factor`],r),q(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:q(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:q(e.mean,[...t,`mean`],r);return;case`first-order-lag`:case`second-order`:q(e.gain,[...t,`gain`],r),q(e.bias,[...t,`bias`],r),K(e.input,[...t,`input`],n,r);return;case`transport-delay`:q(e.delay,[...t,`delay`],r),K(e.input,[...t,`input`],n,r);return;case`slew-rate-limiter`:case`integrator`:K(e.input,[...t,`input`],n,r);return;case`hysteresis-relay`:q(e.on_threshold,[...t,`on_threshold`],r),q(e.off_threshold,[...t,`off_threshold`],r),K(e.input,[...t,`input`],n,r);return;case`weighted-sum`:q(e.bias,[...t,`bias`],r),wt(e,t,(e,t)=>{q(e.weight,[...t,`weight`],r),K(e.input,[...t,`input`],n,r)});return;case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),K(e.input,[...t,`input`],n,r);return;case`health-dependent`:{let i=e.stages;if(!U(i))return;for(let[e,a]of Object.entries(i))At(a,[...t,`stages`,e],n,r);return}default:return}}function K(e,t,n,r){Dt(e,t,(e,t)=>n.push({member:e,path:t,previousTick:!1}),(e,t)=>n.push({member:e,path:t,previousTick:!0}),(e,t)=>r.push({param:e,path:t}),(e,t)=>At(e,t,n,r))}function q(e,t,n){let r=Ct(e);r!==void 0&&n.push({param:r,path:t})}function jt(e,t,n){if(!U(e))return;let r=e.type;(r===`threshold`||r===`availability-state`)&&typeof e.member==`string`&&n.push({member:e.member,path:[...t,`member`],previousTick:!1})}function Mt(e,t,n){if(!U(e))return;let r=e.type;if(typeof r!=`string`)return;if(r===`integrator`&&e.wrap===!0&&(typeof e.wrap_at!=`number`||!Number.isFinite(e.wrap_at)||e.wrap_at<=0)&&n.addIssue({code:h.custom,path:[...t,`wrap_at`],message:`wrap_at must be a finite number greater than 0 when wrap is true. Fix: Set wrap_at to a positive number, or set wrap to false.`}),r===`health-dependent`){let r=e.stages;if(U(r))for(let[e,i]of Object.entries(r))Mt(i,[...t,`stages`,e],n)}function i(e,t){!U(e)||!(`generator`in e)||Mt(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),wt(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function Nt(e){switch(e){case`Boolean`:return!1;case`String`:return``;case`Double`:case`Float`:case`Int32`:case`UInt16`:case`UInt32`:return 0;default:return 0}}var Pt=r(d(`type`,[u({type:s(`white_noise`),strength:l().min(0).max(1),scale:l().positive().optional()}).strict(),u({type:s(`drift`),tau:l().positive(),sigma:l().min(0).max(1),scale:l().positive().optional()}).strict(),u({type:s(`outlier`),probability:l().min(0).max(1),magnitude:l().positive(),scale:l().positive().optional()}).strict(),u({type:s(`gap`),probability:l().min(0).max(1),duration:l().int().positive().default(10)}).strict(),u({type:s(`noise_burst`),probability:l().min(0).max(1),duration:l().int().positive().default(5),strength:l().min(0).max(1),scale:l().positive().optional()}).strict()])).min(1).optional(),Ft=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;f([`float`,`int`,`string`,`bool`]);var It=d(`type`,[u({type:s(`float`),default:l().finite(),min:l().finite().optional(),max:l().finite().optional(),unit:z.optional()}),u({type:s(`int`),default:l().int().safe(),min:l().int().safe().optional(),max:l().int().safe().optional(),unit:z.optional()}),u({type:s(`string`),default:v(),unit:z.optional()}),u({type:s(`bool`),default:_(),unit:z.optional()})]),J=g([u({member:v()}).strict(),u({previous_member:v()}).strict(),u({param:v()}).strict(),u({generator:ee(()=>fn)}).strict()]),Lt=v().regex(ne,`Must be a $param.X parameter reference`),Y=g([l(),Lt]),Rt=g([l().finite(),Lt]),zt={initial_value:l().default(0),gain:Y.default(1),bias:Y.default(0),min:l().nullable().default(null),max:l().nullable().default(null),input:J},Bt=u({type:s(`sine`),center:Y,amplitude:l().positive(),period:l().positive()}).strict(),Vt=u({type:s(`random-walk`),min:l(),max:l(),step:l().positive()}).strict(),Ht=u({type:s(`noise`),center:Y,stddev:l().positive()}).strict(),Ut=u({type:s(`step`),values:r(l()).min(1),interval:l().positive()}).strict(),Wt=u({type:s(`correlated`),source:v().regex(p,Ft),factor:Rt,offset:Rt,power:l().int().positive().optional()}).strict(),Gt=u({from:v(),to:v(),probability:l().min(0).max(1).optional(),on:v().optional()}).strict(),Kt=u({type:s(`state-machine`),states:r(v()).min(1),initial:v(),transitions:r(Gt).min(1)}).strict();function X(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:h.custom,path:[`initial`],message:`State machine initial state "${e.initial}" is not in states. Fix: Set initial to one of: ${e.states.join(`, `)}.`});for(let r=0;r<e.transitions.length;r++){let i=e.transitions[r];i&&(n.has(i.from)||t.addIssue({code:h.custom,path:[`transitions`,r,`from`],message:`State machine transition from "${i.from}" references a state that is not in states. Fix: Add "${i.from}" to states or change transition.from to one of: ${e.states.join(`, `)}.`}),n.has(i.to)||t.addIssue({code:h.custom,path:[`transitions`,r,`to`],message:`State machine transition to "${i.to}" references a state that is not in states. Fix: Add "${i.to}" to states or change transition.to to one of: ${e.states.join(`, `)}.`}))}}Kt.superRefine(X);var qt=u({type:s(`ramp`),start_value:l().default(0),rate:l(),duration:l().nonnegative(),start_time:l().default(0),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),Jt=u({type:s(`mean-reverting-noise`),mean:Y,tau:l().positive(),sigma:l().positive(),initial_value:l().optional(),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),Yt=u({time:l().nonnegative(),value:l()}),Xt=u({type:s(`timetable`),points:r(Yt).min(2),repeat:_().default(!1),interpolation:f([`linear`,`step`]).default(`linear`)}).strict(),Zt=u({type:s(`waveform`),shape:f([`sawtooth`,`triangle`,`square`,`pulse`]),center:Y,amplitude:l().positive(),period:l().positive(),duty_cycle:l().min(0).max(1).default(.5)}).strict(),Qt=u({type:s(`chirp`),center:Y,amplitude:l().positive(),start_freq_hz:l().positive(),end_freq_hz:l().positive(),sweep_duration:l().positive(),sweep:f([`linear`,`exponential`]).default(`linear`),repeat:_().default(!0)}).strict(),$t=u({type:s(`impulse`),baseline:l().default(0),amplitude:l(),probability:l().min(0).max(1).optional(),interval:l().positive().optional(),decay:l().min(0).max(1).optional(),duration:l().int().positive().default(1)}).strict();function en(e,t){e.probability===void 0&&e.interval===void 0&&t.addIssue({code:h.custom,path:[`probability`],message:`Impulse generator requires either probability or interval. Fix: Add probability: 0.01 (per-tick chance) or interval: 60 (seconds between triggers).`}),e.probability!==void 0&&e.interval!==void 0&&t.addIssue({code:h.custom,path:[`interval`],message:`Impulse generator cannot have both probability and interval. Fix: Remove one: use probability for random triggers, or interval for periodic triggers.`})}$t.superRefine(en);var tn=u({type:s(`first-order-lag`),tau:l().positive(),...zt}).strict(),nn=u({type:s(`integrator`),initial_value:l().default(0),gain:l().default(1),bias_rate:l().default(0),min:l().default(-1/0),max:l().default(1/0),wrap:_().default(!1),wrap_at:l().nullable().default(null),input:J}).strict(),rn=u({type:s(`transport-delay`),delay:g([l().nonnegative(),Lt]),initial_value:l().default(0),interpolation:f([`linear`,`zoh`]).default(`linear`),input:J}).strict(),an=u({type:s(`slew-rate-limiter`),rate_up:l().positive(),rate_down:l().positive().optional(),initial_value:l().default(0),min:l().nullable().default(null),max:l().nullable().default(null),input:J}).strict(),on=u({type:s(`second-order`),natural_freq_hz:l().positive(),damping_ratio:l().positive(),initial_velocity:l().default(0),...zt}).strict(),sn=u({type:s(`hysteresis-relay`),on_threshold:Y,off_threshold:Y,output_on:g([l(),v()]).default(1),output_off:g([l(),v()]).default(0),initial_state:f([`on`,`off`]).default(`off`),mode:f([`rising`,`falling`]).default(`rising`),input:J}).strict(),cn=u({weight:Y.default(1),input:J}),ln=u({type:s(`weighted-sum`),bias:Y.default(0),terms:r(cn).min(1),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),un=u({type:s(`gate`),enabled_member:v().regex(p,Ft),input:J,disabled_value:g([l(),v(),_()])}).strict(),dn=d(`type`,[Bt,Vt,Ht,Ut,Wt,Kt,qt,Jt,Xt,Zt,Qt,$t]).superRefine((e,t)=>{e.type===`state-machine`&&X(e,t),e.type===`impulse`&&en(e,t)}),fn=d(`type`,[Bt,Vt,Ht,Ut,Wt,Kt,qt,Jt,Xt,Zt,Qt,$t,u({type:s(`health-dependent`),stages:m(v(),dn)}).strict(),tn,nn,rn,an,on,sn,ln,un]).superRefine((e,t)=>{e.type===`state-machine`&&X(e,t),e.type===`impulse`&&en(e,t)}),pn=u({multiplier:l().finite().optional(),offset:l().finite().optional()}).strict(),mn=u({stages:r(u({name:v().min(1),duration_hours:i([l().nonnegative(),l().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:m(v(),pn)})).min(1)}).superRefine((e,t)=>{let n=new Set;for(let r=0;r<e.stages.length;r++){let i=e.stages[r];i&&(n.has(i.name)&&t.addIssue({code:h.custom,path:[`stages`,r,`name`],message:`Lifecycle stage names must be unique. Duplicate "${i.name}". Fix: Rename one stage so each lifecycle stage has a unique name.`}),n.add(i.name))}}),hn=u({multiplier:l().finite().optional(),offset:l().finite().optional(),spike:l().finite().optional(),duration_ticks:l().int().positive().optional(),onset_ticks:l().int().positive().optional(),recovery_ticks:l().int().positive().optional()}).strict(),gn=u({condition:v().optional(),lifecycle_stage:v().optional(),probability:l().min(0).max(1)}),_n=u({name:v().regex(p,Ft),trigger:gn,effects:m(v(),g([hn,v()]))}),vn=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,yn=v().regex(ne,`Must be a $param.X parameter reference`),bn=g([l(),v(),_()]),xn=u({name:v().regex(p,vn),description:v().optional(),namespace:v().optional()}).strict(),Sn=d(`kind`,[u({kind:s(`variable`),data_type:B,access:ft,unit:z.optional(),enum_values:H.optional(),eu_range:i([l(),l()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:fn.optional(),binding:ht.optional(),default:bn.optional(),observation_effects:Pt}).strict(),u({kind:s(`property`),data_type:B,access:ft,unit:z.optional(),enum_values:H.optional(),default:g([bn,yn]).optional()}).strict()]),Cn=m(v().regex(p,vn),Sn).refine(e=>Object.keys(e).length>=1,{message:`Members map must have at least 1 member.`}).refine(e=>Object.keys(e).length<=256,{message:`Members map must have at most 256 members.`});u({schema_version:s(`2`),model:xn,parameters:m(v(),It).optional(),members:Cn,methods:St.optional(),lifecycle:mn.optional(),faults:r(_n).optional()}).strict().superRefine((e,t)=>{let n=Object.keys(e.members),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t!==void 0&&r.set(t,e)}let i=new Set(Object.keys(e.parameters??{})),a=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e));for(let o=0;o<n.length;o++){let s=n[o];if(s===void 0)continue;let c=e.members[s];if(!c||(kt(c,t,[`members`,s]),c.kind===`variable`&&c.generator!==void 0&&c.binding!==void 0&&t.addIssue({code:h.custom,path:[`members`,s,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),c.kind===`variable`&&c.binding!==void 0&&c.access!==`read`&&t.addIssue({code:h.custom,path:[`members`,s,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),c.kind!==`variable`||!c.generator&&!c.binding))continue;let l=[],u=[],d=[`members`,s,`generator`];if(c.generator&&At(c.generator,d,l,u),c.binding&&jt(c.binding,[`members`,s,`binding`],l),c.generator&&(Mt(c.generator,d,t),c.generator.type===`gate`)){let n=e.members[c.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:h.custom,path:[`members`,s,`generator`,`enabled_member`],message:`Gate generator for "${s}" references "${c.generator.enabled_member}", but "${c.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),G(c.generator.disabled_value,c.data_type)||t.addIssue({code:h.custom,path:[`members`,s,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${s}" does not match data_type "${c.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of l){let n=r.get(e.member);if(n===void 0){t.addIssue({code:h.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}", but "${e.member}" is not defined. Fix: Define "${e.member}" in members, or change the reference to a parameter.`});continue}!e.previousTick&&n>=o&&t.addIssue({code:h.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${s}".`})}for(let n of u)i.has(n.param)?a.has(n.param)||t.addIssue({code:h.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}" in a numeric position, but "${n.param}" has type "${e.parameters?.[n.param]?.type}". Only float and int parameters can be used as generator coefficients or inputs. Fix: Change "${n.param}" to type "float" or "int".`}):t.addIssue({code:h.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}", but "${n.param}" is not defined. Fix: Define "${n.param}" under parameters, or replace "$param.${n.param}" with a literal value.`});if(c.binding)switch(c.binding.type){case`threshold`:c.data_type!==`Boolean`&&t.addIssue({code:h.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),wn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`availability-state`:c.data_type!==`String`&&t.addIssue({code:h.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),wn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:c.data_type!==`String`&&t.addIssue({code:h.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "${c.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:c.data_type!==`Boolean`&&t.addIssue({code:h.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:c.data_type!==`Int32`&&c.data_type!==`UInt16`&&c.data_type!==`UInt32`&&t.addIssue({code:h.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-count" must use an integer data_type (Int32, UInt16, or UInt32). Fix: change data_type to an integer type.`});break;default:c.binding}if(c.kind===`variable`&&c.observation_effects){W(c.data_type)||t.addIssue({code:h.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${c.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),c.access!==`read`&&t.addIssue({code:h.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require access "read". Observation effects corrupt values — they must not be applied to command targets or setpoints. Fix: change access to "read" or remove observation_effects.`});for(let e=0;e<c.observation_effects.length;e++){let n=c.observation_effects[e];n&&(n.type===`white_noise`||n.type===`drift`||n.type===`outlier`||n.type===`noise_burst`)&&!(`scale`in n&&n.scale!==void 0)&&!c.eu_range&&t.addIssue({code:h.custom,path:[`members`,s,`observation_effects`,e],message:`Member "${s}" uses relative observation effect "${n.type}" but has no eu_range and no explicit scale. Fix: add eu_range: [min, max] to the member, or add scale: <number> to the effect.`})}}}function o(n,i,a){if(!r.has(n)){t.addIssue({code:h.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is not a defined member. Fix: Change "${n}" to a valid member name.`});return}let o=e.members[n];o&&o.kind!==`variable`&&t.addIssue({code:h.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is a property (kind: "property"). Effects can only target variable members.`})}if(e.lifecycle){let t=[`lifecycle`,`stages`];for(let n of e.lifecycle.stages)for(let e of Object.keys(n.effects))o(e,t,`Lifecycle stage "${n.name}"`)}if(e.faults){let n=new Set;for(let r=0;r<e.faults.length;r++){let i=e.faults[r];if(!i)continue;n.has(i.name)&&t.addIssue({code:h.custom,path:[`faults`,r,`name`],message:`Fault names must be unique. Duplicate "${i.name}". Fix: Rename one fault so each fault has a unique name.`}),n.add(i.name);let a=[`faults`,r,`effects`];for(let e of Object.keys(i.effects))o(e,a,`Fault "${i.name}"`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let a=Ct(n.default);a!==void 0&&!i.has(a)&&t.addIssue({code:h.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${a}", but "${a}" is not defined. Fix: Define "${a}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))Tn(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),Tn(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),En(n,r,e,t,[`methods`,n,`runtime`])});function wn(e,t,n,r,i){let a=n.members[t];a&&(W(a.data_type)||r.addIssue({code:h.custom,path:[...i],message:`Member "${e}" binding references "${t}", but "${t}" is not numeric. Fix: bind to a numeric member or change the source member data_type.`}))}function Tn(e,t,n,r){if(t)for(let[i,a]of Object.entries(t))a.unit!==void 0&&(a.data_type===`Boolean`||a.data_type===`String`)&&n.addIssue({code:h.custom,path:[...r,i,`unit`],message:`Method "${e}" argument "${i}" uses data_type "${a.data_type}" and must not declare an engineering unit. Fix: remove the unit or use a numeric data_type.`}),a.enum_values&&a.data_type!==`String`&&n.addIssue({code:h.custom,path:[...r,i,`enum_values`],message:`Method "${e}" argument "${i}" can only use enum_values with data_type "String". Fix: remove enum_values or change the data_type.`})}function En(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`set-parameters`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.parameters?.[s.parameter];if(!l){r.addIssue({code:h.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}", but "${s.parameter}" is not defined. Fix: target a declared parameter.`});continue}if(l.type!==`float`&&l.type!==`int`){r.addIssue({code:h.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}" of type "${l.type}". Fix: use set-parameters only with float or int parameters.`});continue}if(`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}W(n.data_type)||r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" must be numeric to write parameter "${s.parameter}". Fix: use Double, Float, Int32, UInt16, or UInt32.`}),l.type===`int`&&!Ot(n.data_type)&&r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" but parameter "${s.parameter}" is type "int". Fix: use Int32, UInt16, or UInt32 so runtime writes stay integer-safe.`});continue}l.type===`int`&&!Number.isSafeInteger(s.value)&&r.addIssue({code:h.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for integer parameter "${s.parameter}" must be a safe integer. Fix: use a whole-number literal.`})}return;case`set-members`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.members[s.member];if(!l){r.addIssue({code:h.custom,path:[...c,`member`],message:`Method "${e}" runtime targets member "${s.member}", but "${s.member}" is not defined. Fix: target a declared member.`});continue}if(l.kind!==`variable`&&r.addIssue({code:h.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is a property. Fix: target a writable variable member.`}),l.access!==`readwrite`&&l.access!==`write`&&r.addIssue({code:h.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is not writable. Fix: set access to "readwrite" or "write".`}),l.kind===`variable`&&l.binding&&r.addIssue({code:h.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but bound members are computed at runtime. Fix: write to a command/setpoint member without a binding.`}),`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}if(G(Nt(n.data_type),l.data_type)||r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" which does not match target member "${s.member}" data_type "${l.data_type}". Fix: align the argument and target member data types.`}),n.enum_values&&l.enum_values){let t=n.enum_values.filter(e=>!l.enum_values?.includes(e));t.length>0&&r.addIssue({code:h.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" allows values [${t.join(`, `)}] that are not valid for target member "${s.member}". Fix: align enum_values between the argument and target member.`})}continue}G(s.value,l.data_type)||r.addIssue({code:h.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for "${s.member}" does not match data_type "${l.data_type}". Fix: use a compatible literal value.`}),l.enum_values&&typeof s.value==`string`&&!l.enum_values.includes(s.value)&&r.addIssue({code:h.custom,path:[...c,`value`],message:`Method "${e}" runtime literal "${s.value}" is not allowed for member "${s.member}". Fix: use one of [${l.enum_values.join(`, `)}].`})}return;default:}}var Dn=g([l().finite(),v(),_()]),On=v().regex(/^[a-f0-9]{64}$/),kn=u({id:v().min(1),model:v().min(1),browsePath:r(v().min(1)).min(1),parameters:m(v(),Dn),lifecycleStage:v().min(1),operatingHours:l().finite().nonnegative(),activeFaults:r(v().min(1)),templateRunId:l().int().positive().optional(),observationState:m(v(),m(v(),c())).optional().default({}),faultState:m(v(),u({remaining:l().int(),elapsed:l().int(),recovering:_(),recoveryElapsed:l().int(),recoveryTicks:l().int()})).optional().default({})}),An=u({templateRunId:l().int().positive(),templateName:v().min(1),templatePath:v(),entryHash:On.optional()}),jn=u({name:v().min(1),enabled:_(),config:m(v(),c())});u({version:s(1),savedAt:v().min(1),environmentName:dt,models:r(v().min(1)),instances:r(kn),templateRuns:r(An),adapters:r(jn).default([])});var Z=n(),Mn={mqtt:we,opcua:Re,modbus:et},Nn={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},Pn={mqtt:o,opcua:a,modbus:te};function Fn({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:(0,Z.jsx)(y.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,Z.jsxs)(j,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,Z.jsx)(De,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,Z.jsxs)(j,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(E,{className:`size-3`}),`Enabled`]}):(0,Z.jsxs)(j,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,Z.jsx)($e,{className:`size-2`}),`Disabled`]})},t)})}function In({metrics:e}){return e?e.connected?null:(0,Z.jsxs)(j,{variant:`destructive`,className:`gap-1`,children:[(0,Z.jsx)(ke,{className:`size-3`}),`Disconnected`]}):null}function Ln({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,Z.jsx)(E,{className:r,"aria-hidden":!0}):n===`busy`?(0,Z.jsx)(ge,{className:r,"aria-hidden":!0}):n===`saturated`?(0,Z.jsx)(We,{className:r,"aria-hidden":!0}):null;return(0,Z.jsxs)(j,{className:T(`gap-1`,t[n]??``),children:[i,n]})}function Q({label:e,value:t,valueClassName:n}){return(0,Z.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsx)(`span`,{className:T(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function Rn({metrics:e}){return(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,Z.jsx)(Q,{label:`Messages sent`,value:C(e.messagesPublished)}),(0,Z.jsx)(Q,{label:`Attempted`,value:C(e.messagesAttempted)}),(0,Z.jsx)(Q,{label:`Skipped (unchanged)`,value:C(e.messagesFiltered)}),(0,Z.jsx)(Q,{label:`Errors`,value:C(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,Z.jsx)(Q,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,Z.jsx)(Q,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function zn({port:e}){return(0,Z.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,Z.jsx)(We,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,Z.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function Bn({adapter:e,metrics:t}){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),c=k(),l=Mn[e.name]??Re,u=Nn[e.name]??e.name,d=Pn[e.name]??0,f=o||e.pending===!0,p=(0,R.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:d},[e.config,d]);return(0,Z.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,Z.jsxs)(`div`,{className:`relative z-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,Z.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,Z.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:u}),(0,Z.jsx)(Fn,{adapter:e}),e.enabled&&!e.pending&&t&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(In,{metrics:t}),t.health?(0,Z.jsx)(Ln,{health:t.health}):(0,Z.jsxs)(j,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(E,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,Z.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,Z.jsx)(`span`,{className:`text-foreground`,children:C(t.messagesPublished)}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,Z.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,Z.jsx)(be,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,Z.jsx)(de,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,Z.jsx)(b,{initial:!1,children:n&&(0,Z.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,Z.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,Z.jsxs)(Je,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,Z.jsx)(_e,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,Z.jsx)(Rn,{metrics:t})]}),(0,Z.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(S,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{await c.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(De,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(rt,{className:`size-3.5`}),f?`Disabling...`:`Disable ${u}`]}),!f&&(0,Z.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!f&&(0,Z.jsx)(zn,{port:i&&Number(i)||p}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Ye,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,Z.jsx)(he,{id:`port-${e.name}`,type:`number`,placeholder:String(p),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:f})]}),(0,Z.jsxs)(S,{size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await c.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(De,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(it,{className:`size-3.5`}),f?`Enabling...`:`Enable ${u}`]})]})]})})},`panel`)})]})}function Vn(){let{instances:e,models:t,templateRuns:n}=A(x(e=>({instances:e.instances,models:e.models,templateRuns:e.templateRuns}))),r=k(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(`1`),[c,l]=(0,R.useState)(``),u=(0,R.useMemo)(()=>c?t.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())):t,[t,c]);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(N,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Ve,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Fleet Management`]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Spawn Instances`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)(Qe,{value:i||null,onValueChange:e=>a(e??``),onInputValueChange:l,children:[(0,Z.jsx)(Ze,{placeholder:`Select model`,className:`h-8 w-full min-w-0`,showClear:!!i}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(M,{children:[u.map(e=>(0,Z.jsx)(P,{value:e.name,children:e.name},e.name)),u.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(he,{type:`number`,value:o,onChange:e=>s(e.target.value),className:`h-8 w-16 text-xs`,min:`1`,"aria-label":`Number of instances to spawn`}),(0,Z.jsx)(S,{size:`sm`,className:`h-8`,onClick:()=>{let e=D(Me,{model:i,count:Number(o)});e&&r.mutate({type:`spawn`,...e})},children:`Spawn`})]})]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` models · `,e.length,` running`]})]}),n.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Environment Runs`}),(0,Z.jsx)(b,{initial:!1,children:n.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.12}},transition:{type:`spring`,stiffness:400,damping:30},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border px-2.5 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[(0,Z.jsx)(`span`,{className:`truncate text-xs font-medium`,children:pe(e.templateName)}),(0,Z.jsxs)(j,{variant:`secondary`,className:`shrink-0 text-[10px]`,children:[e.instanceIds.length,` inst`]})]}),(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-destructive hover:text-destructive`,"aria-label":`Unload environment run`,onClick:()=>r.mutate({type:`unloadTemplateRun`,templateRunId:e.templateRunId}),children:(0,Z.jsx)(me,{className:`size-3`})})]})},e.templateRunId))})]})]})]})]})}function Hn(){let{instances:e,models:t}=A(x(e=>({instances:e.instances,models:e.models}))),n=k(),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),l=(0,R.useMemo)(()=>s?e.filter(e=>e.id.toLowerCase().includes(s.toLowerCase())):e,[e,s]),u=(0,R.useMemo)(()=>{let n=e.find(e=>e.id===r);return n?t.find(e=>e.name===n.model)?.faultNames??[]:[]},[r,e,t]),d=(0,R.useMemo)(()=>e.filter(e=>e.activeFaults.length>0),[e]),f=d.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(N,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(We,{className:`size-3.5 ${f>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(b,{children:f>0&&(0,Z.jsx)(y.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Z.jsxs)(j,{variant:`destructive`,className:`text-[10px]`,children:[f,` active`]})},`fault-count`)})]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(Qe,{value:r||null,onValueChange:e=>{i(e??``),o(``)},onInputValueChange:c,children:[(0,Z.jsx)(Ze,{placeholder:`Select instance`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(M,{children:[l.map(e=>(0,Z.jsxs)(P,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(j,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),l.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,Z.jsxs)(Ce,{value:a,onValueChange:e=>o(e??``),children:[(0,Z.jsx)(Se,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(ve,{placeholder:r?`Select fault`:`Pick instance first`})}),(0,Z.jsx)(xe,{alignItemWithTrigger:!1,align:`start`,children:u.map(e=>(0,Z.jsx)(ye,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(S,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=D(Ie,{instanceId:r,fault:a});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(S,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=D(Ie,{instanceId:r,fault:a});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(O,{}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:d.length>0?(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Faulted Instances`}),(0,Z.jsx)(b,{initial:!1,children:d.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:6,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full touch-manipulation items-center justify-between rounded-[var(--miravo-radius-tight)] border border-destructive/20 bg-destructive/5 px-2.5 py-1.5 text-left transition-colors hover:bg-destructive/10 sm:min-h-0`,onClick:()=>{i(e.id),o(``)},children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-destructive`,children:e.activeFaults.join(`, `)})]})},e.id))})]},`faulted`):(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex items-center gap-2 py-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(E,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function Un(){let e=A(e=>e.instances),t=k(),[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``),c=(0,R.useMemo)(()=>o?e.filter(e=>e.id.toLowerCase().includes(o.toLowerCase())):e,[e,o]),l=(0,R.useMemo)(()=>e.filter(e=>e.isQuarantined),[e]),u=(0,R.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,[e]),d=(0,R.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,[e]);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(N,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(ot,{className:`size-3.5 text-muted-foreground`}),`Instance Actions`]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Remove Instance`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)(Qe,{value:n||null,onValueChange:e=>{r(e??``),a(!1)},onInputValueChange:s,children:[(0,Z.jsx)(Ze,{placeholder:`Select instance`,className:`h-8 w-full min-w-0`,showClear:!!n}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(M,{children:[c.map(e=>(0,Z.jsx)(P,{value:e.id,children:(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),c.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),i&&n?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] text-destructive`,children:`Remove?`}),(0,Z.jsx)(S,{size:`sm`,variant:`destructive`,className:`h-7 text-xs`,onClick:()=>{t.mutate({type:`removeInstance`,instanceId:n}),a(!1),r(``)},children:`Confirm`}),(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>a(!1),children:`Cancel`})]}):(0,Z.jsxs)(S,{className:`h-8 w-full shrink-0 gap-1.5 sm:w-auto`,variant:`destructive`,size:`sm`,disabled:!n,onClick:()=>{D(Pe,{instanceId:n})&&a(!0)},children:[(0,Z.jsx)(ct,{className:`size-3`}),`Remove`]})]})]}),(0,Z.jsx)(O,{}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:l.length>0?(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-warning`,children:[`Quarantined`,(0,Z.jsx)(j,{variant:`secondary`,className:`text-[10px] text-warning`,children:l.length})]}),(0,Z.jsx)(b,{initial:!1,children:l.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(S,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 text-[10px]`,onClick:()=>t.mutate({type:`unquarantine`,instanceId:e.id}),children:`Unquarantine`})]})},e.id))})]},`quarantined`):(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Fleet Health`}),(0,Z.jsx)(`div`,{className:`flex items-center gap-4 text-xs`,children:e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-success`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:u}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`healthy`})]}),d>0&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-warning`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:d}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`faulted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(st,{className:`size-3 text-success`}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`0 quarantined`})]})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No instances running`})})]},`fleet-health`)})]})]})}function Wn(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Gn(e){if(!Number.isFinite(e)||e<=0)return`0s`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:i>0?`${n}d ${i}m`:`${n}d`:r>0?`${r}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function Kn({data:e}){let t=(0,R.useMemo)(()=>{if(e.length<2)return null;let t=e.map(e=>e.tps),n=Math.max(...t,.1),r=Math.min(...t,0),i=n-r||1;return{points:t.map((e,n)=>{let a=n/(t.length-1)*200,o=2+(1-(e-r)/i)*28;return`${n===0?`M`:`L`}${a.toFixed(1)},${o.toFixed(1)}`}).join(` `),min:r,max:n}},[e]);return t?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 32`,className:`h-8 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":`TPS trend sparkline`,children:[(0,Z.jsx)(`line`,{x1:`0`,y1:`10.7`,x2:`200`,y2:`10.7`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`line`,{x1:`0`,y1:`21.3`,x2:`200`,y2:`21.3`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`path`,{d:t.points,fill:`none`,stroke:`var(--primary)`,strokeWidth:`1.5`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between text-[9px] text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`60s ago · `,t.min.toFixed(1)]}),(0,Z.jsxs)(`span`,{children:[t.max.toFixed(1),` · now`]})]})]}):(0,Z.jsx)(`div`,{className:`flex h-8 items-center text-[10px] text-muted-foreground`,children:`Collecting...`})}var qn={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function Jn({state:e}){let t=qn[e]??`bg-muted-foreground`,n=e===`running`;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:`size-2.5 rounded-full ${t}`}),n&&(0,Z.jsx)(`span`,{className:`absolute size-2.5 animate-ping rounded-full ${t} opacity-40`})]}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:(0,Z.jsx)(y.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:`spring`,stiffness:500,damping:30},className:`font-mono text-lg font-bold uppercase tracking-wider`,children:e},e)})]})}function $({label:e,tooltip:t,tooltipClassName:n}){return(0,Z.jsxs)(`div`,{className:`inline-flex w-fit min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title min-w-0 shrink text-[11px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsxs)(qe,{children:[(0,Z.jsx)(Ge,{className:`inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border-0 bg-transparent p-0 text-muted-foreground shadow-none outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring`,render:(0,Z.jsx)(`button`,{type:`button`}),"aria-label":`About ${e}`,children:(0,Z.jsx)(Le,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(Ke,{side:`top`,className:T(`max-w-xs`,n),children:t})]})]})}function Yn(){let{engineState:e,connectionState:t}=A(x(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=k();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Run state`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Whether the scheduler is running, paused, idle, or stopped. Pause freezes simulated time; resume continues from the same tick.`})}),(0,Z.jsx)(Jn,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(S,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:T(`h-8 min-h-11 w-fit touch-manipulation gap-1.5 px-3 text-xs sm:min-h-8`,e===`running`&&`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20 hover:text-warning focus-visible:border-warning/50 focus-visible:ring-warning/25 border-warning/35`),onClick:()=>n.mutate({type:e===`paused`?`resume`:`pause`}),children:[e===`paused`?(0,Z.jsx)(He,{className:`size-3`}):(0,Z.jsx)(nt,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function Xn(){let{speedMultiplier:e,connectionState:t}=A(x(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=k(),[r,i]=(0,R.useState)(String(e)),a=t===`live`;return(0,R.useEffect)(()=>{i(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the environment at this multiple of real time. 1× is real time; higher values speed up the model. Change it with the field and Set.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[e,`x`]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ye,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(he,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>i(e.target.value),className:`h-8 min-h-11 w-[4.75rem] touch-manipulation font-mono text-xs tabular-nums sm:min-h-8`,min:`1`,max:`1000`,disabled:!a}),(0,Z.jsx)(S,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!a,onClick:()=>{let e=D(Fe,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function Zn(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:i,instanceCount:a,memberValueCount:o}=A(x(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,instanceCount:e.instanceCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:T(Ue,`px-4 py-3`),children:[(0,Z.jsxs)(`header`,{className:`mb-3 border-b border-border/60 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Engine vitals`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Scheduler, speed, cycle count, and throughput for this session.`})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-2 gap-3 @2xl/main:gap-4 @3xl/main:grid-cols-3 @5xl/main:grid-cols-6`,children:[(0,Z.jsx)(Yn,{}),(0,Z.jsx)(Xn,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Cycle`,tooltipClassName:`flex flex-col items-start gap-2 text-left`,tooltip:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Cycle`}),` compares simulated progress with wall time: how many steps ran, how much model time advanced, and how long this session has been open.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[`The number is `,(0,Z.jsx)(`span`,{className:`font-medium`,children:`tick`}),` count — completed scheduler steps since this run. Each tick refreshes the plant model and live tags.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Sim`}),` is simulated elapsed time. Each tick adds (tick interval × speed) to this clock. Generators, lifecycle, and in-model timestamps use Sim, not your system clock. It stops advancing while paused.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Real`}),` is wall-clock uptime since the run started (real time).`]})]})}),(0,Z.jsx)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:C(e)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex w-full min-w-0 flex-col gap-0.5 leading-tight`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Sim`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Gn(t)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Real`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Wn(i)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Throughput`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Ticks per second: how fast the engine is stepping. Rises and falls with workload, speed setting, and CPU headroom.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[n.toFixed(1),` tps`]}),(0,Z.jsxs)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[a,` inst · `,fe(o),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`TPS Trend`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Recent ticks-per-second samples over about the last minute. Flat or noisy lines usually mean load or speed changes.`})}),(0,Z.jsx)(Kn,{data:r})]})]})]})}var Qn=[`MQTT Sparkplug B`,`EtherNet/IP`,`Siemens S7`];function $n({enabled:e,total:t}){let n=t===0?`empty`:e===0?`idle`:`live`;return(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,children:[(0,Z.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:T(`size-1.5 rounded-full`,n===`live`?`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`:n===`idle`?`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`:`bg-muted-foreground/55`)}),n===`live`&&(0,Z.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,Z.jsxs)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-semibold tabular-nums text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`mx-1 text-muted-foreground/60`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:t}),(0,Z.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-[0.14em]`,children:`active`})]})]})}function er(){let{availableAdapters:e,adapterMetrics:t}=A(x(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(`section`,{className:T(Ue,`flex min-w-0 flex-col hover:border-border`),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,Z.jsx)(at,{className:`size-3.5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Protocol Gateway`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:`Northbound adapters publishing engine telemetry to external systems.`})]})]}),(0,Z.jsx)($n,{enabled:n,total:e.length})]}),e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(b,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(y.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{type:`spring`,stiffness:380,damping:30,delay:n*.05},children:(0,Z.jsx)(Bn,{adapter:e,metrics:r})},e.name)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5`,role:`status`,"aria-label":`Upcoming protocol adapters: ${Qn.join(`, `)}, and more`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(ze,{className:`size-3 text-muted-foreground/70`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Roadmap`})]}),(0,Z.jsxs)(`ul`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Qn.map(e=>(0,Z.jsx)(`li`,{className:`rounded-[var(--miravo-radius-tight)] border border-dashed border-border/70 bg-background/40 px-2 py-0.5 font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:e},e)),(0,Z.jsx)(`li`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground/75`,children:`+ more`})]})]})]})}function tr(){let e=A(e=>e.instances),t=k(),[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col`,children:[(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(N,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(tt,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Danger Zone`]})}),(0,Z.jsx)(L,{className:`flex flex-1 flex-col`,children:(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-3 @2xl/main:flex-row @2xl/main:items-center @2xl/main:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Reset environment`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Removes `,e.length,` running instance`,e.length===1?``:`s`,` and all loaded environments.`]})]}),(0,Z.jsx)(S,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>r(!0),children:`Reset`})]})})]}),(0,Z.jsx)(se,{open:n,onOpenChange:e=>{r(e),e||a(!1)},children:(0,Z.jsxs)(le,{children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(ue,{children:`Reset Environment`}),(0,Z.jsx)(oe,{children:`Removes all running instances and loaded environments.`})]}),(0,Z.jsx)(`div`,{className:`space-y-3 text-sm`,children:(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border p-3`,children:(0,Z.jsxs)(Ye,{htmlFor:`clear-persisted-state`,className:`items-start`,children:[(0,Z.jsx)(Be,{id:`clear-persisted-state`,checked:i,onCheckedChange:e=>a(e===!0)}),(0,Z.jsxs)(`span`,{className:`space-y-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-foreground`,children:`Also clear persisted state`}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Start empty on the next restart.`})]})]})})}),(0,Z.jsxs)(ae,{children:[(0,Z.jsx)(S,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>{r(!1),a(!1)},disabled:o,children:`Cancel`}),(0,Z.jsx)(S,{variant:`destructive`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,disabled:o,onClick:async()=>{s(!0);try{await t.mutateAsync({type:`resetEnvironment`,...i?{clearPersistence:!0}:{}}),r(!1),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function nr(){let[e,t]=re(`tab`,ie([`monitor`,`operate`]).withDefault(`monitor`));return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Mission Control`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fleet operations.`})]}),(0,Z.jsxs)(Ae,{value:e,onValueChange:e=>{t(e)},className:`min-h-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Z.jsxs)(Oe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(Te,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Ne,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(Te,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(je,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(Ee,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(y.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col gap-5 sm:gap-6`,children:[(0,Z.jsx)(Zn,{}),(0,Z.jsx)(er,{})]},`monitor`)}),(0,Z.jsx)(Ee,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(y.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`grid min-h-0 min-w-0 grid-cols-1 items-stretch gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(Vn,{}),(0,Z.jsx)(Un,{}),(0,Z.jsx)(Hn,{}),(0,Z.jsx)(tr,{})]},`operate`)})]})]})}export{at as n,nr as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./control-Cs6l0S42.js";export{e as ControlPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./events-DWA1VT_k.js";export{e as EventsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./fleet-BFlqrO3Q.js";export{e as FleetPage};
|