@miravo/cli-linux-arm64-musl 0.7.3 → 0.7.5
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-B8Cqrm2G.js → api-D8oAzcVE.js} +1 -1
- package/console-dist/assets/catalog-B70TugE6.js +1 -0
- package/console-dist/assets/{catalog-C4iFSXl0.js → catalog-B_wh8kje.js} +1 -1
- package/console-dist/assets/{catalog-source-B_3_Upeh.js → catalog-source-BU77f8QO.js} +1 -1
- package/console-dist/assets/control-CaFfl-Mp.js +1 -0
- package/console-dist/assets/control-DCNd1A3U.js +1 -0
- package/console-dist/assets/events-BjMeLN1K.js +1 -0
- package/console-dist/assets/{events-BZaBqF9J.js → events-CeR9wTII.js} +1 -1
- package/console-dist/assets/fleet-C9wGf070.js +1 -0
- package/console-dist/assets/{fleet-efugggyV.js → fleet-CH141gbg.js} +1 -1
- package/console-dist/assets/{index-DWUbVyod.js → index-ClSUHPGP.js} +3 -3
- package/console-dist/assets/{instance-detail-CmF_Rznd.js → instance-detail-DWELGCE1.js} +1 -1
- package/console-dist/assets/{login-KqoOCjoH.js → login-C5dQKX2Y.js} +1 -1
- package/console-dist/assets/{models-Dn9__adB.js → models-CFdqSxB3.js} +1 -1
- package/console-dist/assets/models-hAhKpuYB.js +1 -0
- package/console-dist/assets/platforms-Bh63oQIi.js +1 -0
- package/console-dist/assets/{platforms-B52boh2S.js → platforms-BwYPf2Sg.js} +1 -1
- package/console-dist/assets/{query-fetch-error-B6y_Rlj9.js → query-fetch-error-NbPqVPRR.js} +1 -1
- package/console-dist/assets/{route-preload-BOrx0jh2.js → route-preload-DQgHHtBj.js} +2 -2
- package/console-dist/assets/{tags-C6UILCQv.js → tags-BI93Dvh2.js} +1 -1
- package/console-dist/assets/tags-_ufsHpn5.js +1 -0
- package/console-dist/assets/{transition-nav-link-LpMCFklr.js → transition-nav-link-Ct6VIy2S.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-dw_B-1qa.js → use-engine-command-mutation-CcfqRB7j.js} +1 -1
- package/console-dist/assets/{use-platform-stream-DAr3QTPE.js → use-platform-stream-DBZo6HMM.js} +1 -1
- package/console-dist/assets/{use-transition-navigate-Fgz_LNAd.js → use-transition-navigate-jTHkLHMS.js} +1 -1
- package/console-dist/assets/{validation-eLNuMo9E.js → validation-DRj8OKvB.js} +1 -1
- package/console-dist/index.html +17 -17
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/catalog-CvtaOpMA.js +0 -1
- package/console-dist/assets/control-CvQvIf00.js +0 -1
- package/console-dist/assets/control-DL1KRHz-.js +0 -1
- package/console-dist/assets/events-BdFbWiaW.js +0 -1
- package/console-dist/assets/fleet-B7pD7lbL.js +0 -1
- package/console-dist/assets/models-IiGAU-LZ.js +0 -1
- package/console-dist/assets/platforms-CleAbZI5.js +0 -1
- package/console-dist/assets/tags-CFcLbtJE.js +0 -1
|
@@ -1 +1 @@
|
|
|
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!==h(o,t.options))return!1}else if(!te(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(ee(t.options.mutationKey)!==ee(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function h(e,t){return(t?.queryKeyHashFn||ee)(e)}function ee(e){return JSON.stringify(e,(e,t)=>oe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function re(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ae(e)&&ae(t);if(!r&&!(oe(e)&&oe(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:ne.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=re(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ie(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 ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oe(e){if(!se(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!se(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function se(e){return Object.prototype.toString.call(e)===`[object Object]`}function ce(e){return new Promise(t=>{i.setTimeout(t,e)})}function le(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:re(e,t)}function ue(e){return e}function de(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function fe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pe=Symbol();function me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function he(e,t){return typeof e==`function`?e(...t):!!e}function ge(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 _e=(()=>{let e=()=>o;return{isServer(){return e()},setIsServer(t){e=t}}})();function ve(){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 ye(e){let t;if(e.then(e=>(t=e,e),s)?.catch(s),t!==void 0)return{data:t}}function be(e){return e}function xe(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function Se(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 Ce(e){return e.state.isPaused}function we(e){return e.state.status===`success`}function Te(e){return!0}function Ee(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??Ce,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[xe(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??we,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors??Te,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData??be;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[Se(e,o,a)]:[])}}function De(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??be,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?ye(l):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,ee=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&&!h&&!ee&&(u===void 0||u>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(l).then(a)}).catch(s)})}var Oe=a;function ke(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Oe,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 g=ke(),Ae=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 je(e){return Math.min(1e3*2**e,3e4)}function Me(e){return(e??`online`)===`online`?Ae.isOnline():!0}var Ne=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Pe(e){let t=!1,r=0,i,a=ve(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new Ne(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>n.isFocused()&&(e.networkMode===`always`||Ae.isOnline())&&e.canRun(),d=()=>Me(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?.()}),h=()=>{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??(_e.isServer()?0:3),a=e.retryDelay??je,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),ce(s).then(()=>u()?void 0:m()).then(()=>{t?p(n):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(i?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var Fe=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??(_e.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(i.clearTimeout(this.#e),this.#e=void 0)}},Ie=class extends Fe{#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=ze(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=ze(this.options);e.data!==void 0&&(this.setState(Re(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=le(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===pe||!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=me(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=Pe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ne&&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 Ne){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,...Le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Re(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),g.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Me(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Re(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ze(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 Be(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=>{ge(e,()=>t.signal,()=>n=!0)},u=me(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?fe:de;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?He:Ve,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:Ve(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 Ve(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 He(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ue(e,t){return t?Ve(e,t)!=null:!1}function We(e,t){return!t||!e.getPreviousPageParam?!1:He(e,t)!=null}var Ge=class extends Fe{#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||Ke(),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=Pe({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),g.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ke(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qe=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 Ge({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=Je(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=Je(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=Je(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=Je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){g.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){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return g.batch(()=>Promise.all(e.map(e=>e.continue().catch(s))))}};function Je(e){return e.options.scope?.id}var Ye=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??h(r,t),a=this.get(i);return a||(a=new Ie({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(){g.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){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){g.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){g.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ye,this.#t=e.mutationCache||new qe,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=Ae.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 g.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;g.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return g.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=g.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(s).catch(s)}invalidateQueries(e,t={}){return g.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=g.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=Be(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(s).catch(s)}ensureInfiniteQueryData(e){return e.behavior=Be(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ae.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(ee(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ee(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(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||=h(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===pe&&(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()}},_;(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})(_||={});var Ze;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ze||={});var v=_.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),y=e=>{switch(typeof e){case`undefined`:return v.undefined;case`string`:return v.string;case`number`:return Number.isNaN(e)?v.nan:v.number;case`boolean`:return v.boolean;case`function`:return v.function;case`bigint`:return v.bigint;case`symbol`:return v.symbol;case`object`:return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?v.promise:typeof Map<`u`&&e instanceof Map?v.map:typeof Set<`u`&&e instanceof Set?v.set:typeof Date<`u`&&e instanceof Date?v.date:v.object;default:return v.unknown}},b=_.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`]),Qe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`),x=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,_.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()}};x.create=e=>new x(e);var $e=(e,t)=>{let n;switch(e.code){case b.invalid_type:n=e.received===v.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,_.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${_.joinValues(e.keys,`, `)}`;break;case b.invalid_union:n=`Invalid input`;break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${_.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n=`Invalid function arguments`;break;case b.invalid_return_type:n=`Invalid function return type`;break;case b.invalid_date:n=`Invalid date`;break;case b.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}"`:_.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case b.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 b.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 b.custom:n=`Invalid input`;break;case b.invalid_intersection_types:n=`Intersection results could not be merged`;break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,_.assertNever(e)}return{message:n}},et=$e;function tt(e){et=e}function nt(){return et}var rt=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}},it=[];function S(e,t){let n=nt(),r=rt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===$e?void 0:$e].filter(e=>!!e)});e.common.issues.push(r)}var C=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 w;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 w;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}}},w=Object.freeze({status:`aborted`}),at=e=>({status:`dirty`,value:e}),T=e=>({status:`valid`,value:e}),ot=e=>e.status===`aborted`,st=e=>e.status===`dirty`,ct=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(ct(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 x(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 y(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:y(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:y(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:y(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ct(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=>ct(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:y(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:b.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)!==v.string){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.string,received:t.parsedType}),w}let t=new C,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:b.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),S(n,{code:b.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?S(n,{code:b.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&S(n,{code:b.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),S(n,{validation:`email`,code:b.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),S(n,{validation:`emoji`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)mt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`uuid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ht.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`nanoid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)dt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cuid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ft.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cuid2`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)pt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`ulid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:`url`,code:b.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),S(n,{validation:`regex`,code:b.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),S(n,{code:b.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),S(n,{code:b.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?jt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?At(r).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?_t.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`duration`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Mt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`ip`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Nt(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`jwt`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Pt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cidr`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`base64`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`base64url`,code:b.invalid_string,message:r.message}),t.dirty()):_.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:b.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)!==v.number){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.number,received:t.parsedType}),w}let t,n=new C;for(let r of this._def.checks)r.kind===`int`?_.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:b.not_finite,message:r.message}),n.dirty()):_.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`&&_.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)!==v.bigint)return this._getInvalidInput(e);let t,n=new C;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),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):_.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.bigint,received:t.parsedType}),w}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)!==v.boolean){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.boolean,received:t.parsedType}),w}return T(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)!==v.date){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.date,received:t.parsedType}),w}if(Number.isNaN(e.data.getTime()))return S(this._getOrReturnCtx(e),{code:b.invalid_date}),w;let t=new C,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:b.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),S(n,{code:b.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):_.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)!==v.symbol){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.symbol,received:t.parsedType}),w}return T(e.data)}};Vt.create=e=>new Vt({typeName:L.ZodSymbol,...O(e)});var Ht=class extends k{_parse(e){if(this._getType(e)!==v.undefined){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.undefined,received:t.parsedType}),w}return T(e.data)}};Ht.create=e=>new Ht({typeName:L.ZodUndefined,...O(e)});var Ut=class extends k{_parse(e){if(this._getType(e)!==v.null){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.null,received:t.parsedType}),w}return T(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 T(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 T(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 S(t,{code:b.invalid_type,expected:v.never,received:t.parsedType}),w}};A.create=e=>new A({typeName:L.ZodNever,...O(e)});var Kt=class extends k{_parse(e){if(this._getType(e)!==v.undefined){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.void,received:t.parsedType}),w}return T(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!==v.array)return S(t,{code:b.invalid_type,expected:v.array,received:t.parsedType}),w;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(S(t,{code:e?b.too_big:b.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&&(S(t,{code:b.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&&(S(t,{code:b.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=>C.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new D(t,e,t.path,n)));return C.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:_.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==v.object){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),w}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&&(S(n,{code:b.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=>C.mergeObjectSync(t,e)):C.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 _.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 _.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 _.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 _.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(_.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 x(e.ctx.common.issues));return S(t,{code:b.invalid_union,unionErrors:n}),w}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 x(e));return S(t,{code:b.invalid_union,unionErrors:i}),w}}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?_.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!==v.object)return S(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),w;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}):(S(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}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=y(e),r=y(t);if(e===t)return{valid:!0,data:e};if(n===v.object&&r===v.object){let n=_.objectKeys(t),r=_.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===v.array&&r===v.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===v.date&&r===v.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(ot(e)||ot(r))return w;let i=Zt(e.value,r.value);return i.valid?((st(e)||st(r))&&t.dirty(),{status:t.value,value:i.data}):(S(n,{code:b.invalid_intersection_types}),w)};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!==v.array)return S(n,{code:b.invalid_type,expected:v.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return S(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),w;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:b.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=>C.mergeArray(t,e)):C.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!==v.object)return S(n,{code:b.invalid_type,expected:v.object,received:n.parsedType}),w;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?C.mergeObjectAsync(t,r):C.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!==v.map)return S(n,{code:b.invalid_type,expected:v.map,received:n.parsedType}),w;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 w;(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 w;(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!==v.set)return S(n,{code:b.invalid_type,expected:v.set,received:n.parsedType}),w;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(S(n,{code:b.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&&(S(n,{code:b.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 w;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!==v.function)return S(t,{code:b.invalid_type,expected:v.function,received:t.parsedType}),w;function n(e,n){return rt({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),$e].filter(e=>!!e),issueData:{code:b.invalid_arguments,argumentsError:n}})}function r(e,n){return rt({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),$e].filter(e=>!!e),issueData:{code:b.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ln){let e=this;return T(async function(...t){let o=new x([]),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 T(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new x([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new x([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 S(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),w}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 S(t,{expected:_.joinValues(n),received:t.parsedType,code:b.invalid_type}),w}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:b.invalid_enum_value,options:n}),w}return T(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=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){let e=_.objectValues(t);return S(n,{expected:_.joinValues(e),received:n.parsedType,code:b.invalid_type}),w}if(this._cache||=new Set(_.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=_.objectValues(t);return S(n,{received:n.data,code:b.invalid_enum_value,options:e}),w}return T(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!==v.promise&&t.common.async===!1?(S(t,{code:b.invalid_type,expected:v.promise,received:t.parsedType}),w):T((t.parsedType===v.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=>{S(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 w;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?w:r.status===`dirty`||t.value===`dirty`?at(r.value):r});{if(t.value===`aborted`)return w;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?w:r.status===`dirty`||t.value===`dirty`?at(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`?w:(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`?w:(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(!ct(e))return w;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=>ct(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):w);_.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)===v.undefined?T(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)===v.null?T(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===v.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 x(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new x(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)!==v.nan){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.nan,received:t.parsedType}),w}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`?w:e.status===`dirty`?(t.dirty(),at(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`?w: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=>(ct(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=w,Xn=e({BRAND:()=>pn,DIRTY:()=>at,EMPTY_PATH:()=>it,INVALID:()=>w,NEVER:()=>Yn,OK:()=>T,ParseStatus:()=>C,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:()=>x,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>nn,ZodIntersection:()=>Qt,ZodIssueCode:()=>b,ZodLazy:()=>rn,ZodLiteral:()=>an,ZodMap:()=>en,ZodNaN:()=>fn,ZodNativeEnum:()=>cn,ZodNever:()=>A,ZodNull:()=>Ut,ZodNullable:()=>I,ZodNumber:()=>Lt,ZodObject:()=>j,ZodOptional:()=>F,ZodParsedType:()=>v,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:()=>S,any:()=>Dn,array:()=>H,bigint:()=>Sn,boolean:()=>B,coerce:()=>Jn,custom:()=>vn,date:()=>Cn,datetimeRegex:()=>jt,defaultErrorMap:()=>$e,discriminatedUnion:()=>W,effect:()=>Bn,enum:()=>q,function:()=>In,getErrorMap:()=>nt,getParsedType:()=>y,instanceof:()=>bn,intersection:()=>Mn,isAborted:()=>ot,isAsync:()=>lt,isDirty:()=>st,isValid:()=>ct,late:()=>yn,lazy:()=>Ln,literal:()=>K,makeIssue:()=>rt,map:()=>Pn,nan:()=>xn,nativeEnum:()=>Rn,never:()=>On,null:()=>En,nullable:()=>Hn,number:()=>z,object:()=>U,objectUtil:()=>Ze,oboolean:()=>qn,onumber:()=>Kn,optional:()=>Vn,ostring:()=>Gn,pipeline:()=>Wn,preprocess:()=>Un,promise:()=>zn,quotelessJson:()=>Qe,record:()=>G,set:()=>Fn,setErrorMap:()=>tt,strictObject:()=>An,string:()=>R,symbol:()=>wn,transformer:()=>Bn,tuple:()=>Nn,undefined:()=>Tn,union:()=>jn,unknown:()=>V,util:()=>_,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({password:R().min(1)});var nr=`0.7.3`,rr=1883,ir=4840,ar=1502,or=65535,sr=1e4,cr=/^[a-zA-Z0-9_-]{1,64}$/,lr=/^\$param\.(\S+)$/,ur=z().int().min(1).max(or),dr=U({state:q([`healthy`,`busy`,`saturated`]),pendingWorkCount:z().finite().int().nonnegative(),completedLastTick:z().finite().int().nonnegative()}),fr=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:dr.optional()});U({name:R().min(1),enabled:B().default(!0)}).passthrough();var pr=U({name:R().min(1),enabled:B(),pending:B().optional(),endpoint:R().optional(),boundPort:ur.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:fr}))}),mr=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(pr).optional()}),hr=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()}),gr=U({state:mr,metrics:J,runningTemplates:H(hr),revision:z().int().nonnegative()}),_r=W(`authenticated`,[U({authenticated:K(!1)}),U({authenticated:K(!0),username:R().min(1),runtime:gr})]),vr=U({instanceId:R().min(1),memberName:R().min(1),value:jn([z().finite(),R(),B()]),quality:q([`good`,`bad`,`uncertain`]),timestamp:z().finite().optional()}),yr=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)})]),br=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}),xr=W(`type`,[U({type:K(`runtime:snapshot`),snapshot:gr}),U({type:K(`runtime:tick`),revision:z().int().nonnegative(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),delta:H(vr),instanceCount:z().int().nonnegative(),metrics:br}),U({type:K(`runtime:event`),revision:z().int().nonnegative(),event:yr}),U({type:K(`runtime:resync-required`),revision:z().int().nonnegative(),reason:R().min(1)})]),Sr=1e3,Y=U({correlationId:R().optional()}),Cr=Y.extend({type:K(`spawn`),model:R().min(1),count:z().int().positive().max(sr),variation:z().min(0).max(1).optional(),unsBasePath:R().min(1).optional(),parameterOverrides:G(R(),z().finite()).optional(),startingHours:z().nonnegative().finite().optional()}),wr=Y.extend({type:K(`removeInstance`),instanceId:R().min(1)}),Tr=Y.extend({type:K(`setParameter`),instanceId:R().min(1),parameter:R().min(1),value:z().finite()}),Er=Y.extend({type:K(`triggerFault`),instanceId:R().min(1),fault:R().min(1)}),Dr=Y.extend({type:K(`clearFault`),instanceId:R().min(1),fault:R().min(1)}),Or=Y.extend({type:K(`pause`)}),kr=Y.extend({type:K(`resume`)}),Ar=Y.extend({type:K(`setSpeed`),multiplier:z().positive().finite().max(Sr)}),jr=Y.extend({type:K(`unquarantine`),instanceId:R().min(1)}),Mr=Y.extend({type:K(`invokeMethod`),instanceId:R().min(1),method:R().min(1),arguments:G(R().min(1),jn([z().finite(),R(),B()])).optional()}),Nr=Y.extend({type:K(`loadTemplate`),templatePath:R().min(1),count:z().int().positive().default(1)}),Pr=Y.extend({type:K(`unloadTemplateRun`),templateRunId:z().int().positive()}),Fr=Y.extend({type:K(`resetEnvironment`),clearPersistence:B().optional()}),Ir=Y.extend({type:K(`enableAdapter`),adapter:R().min(1),config:G(R(),V()).optional()}),Lr=Y.extend({type:K(`disableAdapter`),adapter:R().min(1)}),Rr=W(`type`,[Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr]),zr=U({success:B(),command:R(),correlationId:R().optional(),message:R(),data:V().optional(),error:R().optional()}),Br=`/api`,Vr=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,X=q([`mqtt`,`opcua`,`modbus`]),Hr=H(X).min(1),Ur=U({model:R().min(1),count:z().int().positive().max(sr).default(1),variation:z().min(0).max(1).default(0),parameters:G(R(),z().finite()).optional(),starting_hours:z().finite().nonnegative().optional(),protocol_scope:Hr.optional()}).strict(),Wr=U({name:R().regex(cr,Vr),twins:H(Ur).min(1),protocol_scope:Hr.optional()}).strict(),Gr=U({name:R().regex(cr,Vr),lines:H(Wr).min(1),protocol_scope:Hr.optional()}).strict(),Kr=jn([U({enterprise:R().regex(cr,Vr),site:R().regex(cr,Vr)}).strict(),U({prefix:R().regex(cr,Vr)}).strict()]),qr=U({maxAttempts:z().finite().int().min(0).default(0),initialDelayMs:z().finite().int().positive().default(1e3),maxDelayMs:z().finite().int().positive().default(3e4)}).strict(),Jr=U({enabled:B().default(!1),deadband:z().finite().nonnegative().default(0)}).strict(),Yr=q([`base`,`full`]),Xr=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:qr.optional(),rbe:Jr.optional(),metadata:Yr.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'.`}),Zr=U({port:z().int().min(0).max(65535).default(ir),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()}),Qr=U({port:z().int().min(0).max(65535).default(ar),host:R().default(`0.0.0.0`)}),$r=U({mqtt:Xr.optional(),opcua:Zr.optional(),modbus:Qr.optional()}).strict(),ei=q([`real-time`,`accelerated`]),ti=U({tick_interval_ms:z().int().positive().default(1e3),time_mode:ei.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:Kr.optional(),areas:H(Gr).min(1),protocols:$r.optional(),settings:ti.optional()}).strict();var ni=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)}),ri=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()}),ii=U({name:R().min(1),twins:H(ri),protocol_scope:H(X).optional()}),ai=U({name:R().min(1),lines:H(ii),protocol_scope:H(X).optional()}),oi=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)}),si=oi,ci=oi.extend({topology:H(ai),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()}),li=q([`idle`,`running`,`paused`,`stopped`]),ui=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:li,to:li,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()}),di=jn([z().finite(),R(),B()]),fi=Nn([z().finite(),z().finite()]),pi=U({name:R().min(1),dataType:R().min(1),description:R().nullable()}),mi=U({description:R().nullable(),inputArguments:H(pi),outputArguments:H(pi)}),hi=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:di,type:R().min(1),unit:R().optional()})),members:G(R().min(1),U({value:di,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:fi.nullable()})})),methods:G(R().min(1),mi)}),gi=U({enabled:B(),port:z().int().positive().optional()}),_i=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()))}),vi=U({template:R().min(1).optional(),generatedAt:R().datetime(),protocols:G(R(),gi),tags:H(_i),summary:U({totalTags:z().int().nonnegative(),totalInstances:z().int().nonnegative(),enabledProtocols:H(R().min(1))})}),yi=U({name:R().min(1),description:R().nullable(),parameters:G(R().min(1),U({type:R().min(1),default:di,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:fi.nullable(),default:di.nullable()})),methods:G(R().min(1),mi),faults:H(R().min(1)),lifecycle:U({stages:H(R().min(1)),totalHours:z().finite().nonnegative()}).nullable()}),bi=q([`devices`,`models`,`instances`]),xi=q([`create`,`update`,`replace`,`delete`,`noop`,`blocked`]),Si=q([`device`,`model`,`instance`,`param-sync`]),Ci=q([`apply`,`cleanup`]),wi=q([`success`,`partial`,`blocked`,`noop`,`failed`]);q([`device`,`model`,`instance`,`param-sync`]),q([`create`,`update`,`replace`,`delete`]);var Ti=U({area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),Ei=U({action:xi,resourceType:Si,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()}),Di=U({sourceMode:q([`static`,`managed`]),targetHost:R().min(1),sourceHostname:R().min(1).optional(),scope:H(bi),filters:Ti,entries:H(Ei)}),Oi=U({plan:Di}),ki=U({targetId:R().min(1),template:R().min(1).optional(),model:R().min(1).optional(),protocol:X.optional(),scope:H(bi).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()}),Ai=U({plan:Di,applied:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),ji=U({targetId:R().min(1),template:R().min(1).optional(),allManaged:B().optional(),scope:H(bi).optional(),area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),Mi=U({plan:Di,deleted:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),Ni=U({create:z().int().nonnegative(),update:z().int().nonnegative(),replace:z().int().nonnegative(),delete:z().int().nonnegative(),noop:z().int().nonnegative(),failed:z().int().nonnegative(),total:z().int().nonnegative()}),Pi=U({device:Ni,model:Ni,instance:Ni,"param-sync":Ni}),Fi=U({operations:H(U({schemaVersion:K(1),operationId:R().min(1),operationType:Ci,status:wi,templateId:R().min(1),targetId:R().min(1),targetLabel:R().min(1),hostname:R().min(1),scope:H(R().min(1)),filters:Ti,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:Pi,error:R().min(1).optional()})),total:z().int().nonnegative(),hasMore:B()}),Ii=U({type:Ci.optional(),targetId:R().min(1).optional(),limit:Jn.number().int().positive().max(500).optional(),offset:Jn.number().int().nonnegative().optional()}),Li=U({cancelled:K(!0)}),Ri=U({operationId:R().min(1),type:Ci,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()}),zi=U({operationId:R().min(1),type:Ci,targetId:R().min(1).optional(),template:R().min(1).optional(),model:R().min(1).optional()}),Bi=U({operationId:R().min(1),phase:Si,total:z().int().nonnegative()}),Vi=U({operationId:R().min(1),phase:Si,name:R().min(1),action:xi,status:q([`success`,`failed`]),error:R().min(1).optional(),index:z().int().positive(),of:z().int().positive()}),Hi=U({operationId:R().min(1),applied:z().int().nonnegative().optional(),deleted:z().int().nonnegative().optional(),failed:z().int().nonnegative(),duration:z().int().nonnegative(),plan:Di}),Ui=Hi,Wi=Hi,Gi=U({operationId:R().min(1),attempt:z().int().positive(),maxAttempts:z().int().positive(),delayMs:z().int().nonnegative(),error:R().min(1)}),Ki=U({message:R().min(1)}),qi=U({level:q([`info`,`warn`,`error`]),message:R().min(1),protocol:X.optional(),port:ur.optional(),templatePort:ur.optional()}),Ji=W(`event`,[U({event:K(`log`),data:qi}),U({event:K(`started`),data:Ri}),U({event:K(`accepted`),data:zi}),U({event:K(`phase`),data:Bi}),U({event:K(`resource`),data:Vi}),U({event:K(`complete`),data:Ui}),U({event:K(`cancelled`),data:Wi}),U({event:K(`retrying`),data:Gi}),U({event:K(`error`),data:Ki})]),Yi=`litmus-edge`,Xi=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(),Zi=U({targets:H(Xi)}).strict(),Qi=U({platformId:R().min(1).default(Yi),label:R().min(1),hostname:R().min(1),apiToken:R().min(1),sourceHostname:R().min(1)}),$i=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()}),ea=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:b.custom,message:`apiToken is required when targetId is omitted.`,path:[`apiToken`]})}),ta=W(`connected`,[U({connected:K(!0),hostname:R().min(1),sourceHostname:R().min(1),litmusEdgeVersion:R().min(1).optional(),warning:R().min(1).optional()}),U({connected:K(!1),error:R().min(1)})]),na=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()}),ra=U({reason:R().min(1).optional()}),ia=U({status:K(`shutting_down`)}),aa=U({id:R().min(1)}),oa=U({name:R().min(1)}),sa=U({id:R().min(1)}),ca=U({operationId:R().min(1)}),la=U({id:R().min(1)}),ua=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()}),da=U({host:R().min(1),protocol:X.optional()}),fa=G(R(),V()),pa=G(R(),V());function Z(e){return`${Br}${e}`}var ma=[{method:`GET`,path:Z(`/openapi.json`),operationId:`openApiDocument`,auth:`none`,response:{kind:`json`,schema:pa},description:`Generated OpenAPI document for the Miravo admin API.`},{method:`GET`,path:Z(`/healthz`),operationId:`health`,auth:`none`,response:{kind:`json`,schema:na},description:`Liveness probe for the Miravo admin server.`},{method:`GET`,path:Z(`/readyz`),operationId:`readiness`,auth:`none`,response:{kind:`json`,schema:na},description:`Readiness probe for the Miravo admin server.`},{method:`GET`,path:Z(`/metrics`),operationId:`metrics`,auth:`required`,response:{kind:`json`,schema:J},description:`Engine metrics snapshot.`},{method:`GET`,path:Z(`/state`),operationId:`state`,auth:`required`,response:{kind:`json`,schema:mr},description:`Engine state snapshot.`},{method:`GET`,path:Z(`/bootstrap`),operationId:`bootstrap`,auth:`none`,response:{kind:`json`,schema:_r},description:`Console bootstrap payload.`},{method:`POST`,path:Z(`/commands`),operationId:`commands`,auth:`required`,body:Rr,response:{kind:`json`,schema:zr},description:`Execute an engine command.`},{method:`POST`,path:Z(`/shutdown`),operationId:`shutdown`,auth:`required`,body:ra,response:{kind:`json`,schema:ia},description:`Request graceful shutdown.`},{method:`GET`,path:Z(`/instances/:id`),operationId:`instanceDetail`,auth:`required`,params:aa,response:{kind:`json`,schema:hi},description:`Inspect a running instance.`},{method:`GET`,path:Z(`/models/:name`),operationId:`modelDetail`,auth:`required`,params:oa,response:{kind:`json`,schema:yi},description:`Inspect a registered model schema.`},{method:`GET`,path:Z(`/events`),operationId:`events`,auth:`required`,query:ua,response:{kind:`json`,schema:ui},description:`Read paginated event log entries.`},{method:`GET`,path:Z(`/catalog/models`),operationId:`catalogModels`,auth:`required`,response:{kind:`json`,schema:H(ni)},description:`List catalog models.`},{method:`GET`,path:Z(`/catalog/models/:name/le-dt.json`),operationId:`catalogModelLeDt`,auth:`required`,params:oa,response:{kind:`json`,schema:fa},description:`Download LE Digital Twin JSON for a catalog model.`},{method:`GET`,path:Z(`/catalog/models/:name/yaml`),operationId:`catalogModelYaml`,auth:`required`,params:oa,response:{kind:`yaml`},description:`Read raw YAML for a catalog model.`},{method:`GET`,path:Z(`/catalog/models/:name`),operationId:`catalogModelDetail`,auth:`required`,params:oa,response:{kind:`json`,schema:yi},description:`Read catalog model schema.`},{method:`GET`,path:Z(`/catalog/templates/:id/le-template.json`),operationId:`catalogTemplateLeTemplateJson`,auth:`required`,params:sa,query:da,response:{kind:`passthrough`},description:`Download LE template JSON export.`},{method:`GET`,path:Z(`/catalog/templates/:id/le-tags.csv`),operationId:`catalogTemplateLeTagsCsv`,auth:`required`,params:sa,query:da,response:{kind:`passthrough`},description:`Download LE tags CSV export.`},{method:`GET`,path:Z(`/catalog/templates/:id/yaml`),operationId:`catalogTemplateYaml`,auth:`required`,params:sa,response:{kind:`yaml`},description:`Read raw YAML for a catalog template.`},{method:`GET`,path:Z(`/catalog/templates/:id`),operationId:`catalogTemplateDetail`,auth:`required`,params:sa,response:{kind:`json`,schema:ci},description:`Read catalog template detail.`},{method:`GET`,path:Z(`/catalog/templates`),operationId:`catalogTemplates`,auth:`required`,response:{kind:`json`,schema:H(si)},description:`List catalog templates.`},{method:`GET`,path:Z(`/running-templates`),operationId:`runningTemplates`,auth:`required`,response:{kind:`json`,schema:H(hr)},description:`List running template runs.`},{method:`GET`,path:Z(`/manifest`),operationId:`manifest`,auth:`required`,response:{kind:`json`,schema:vi},description:`Read unified protocol manifest.`},{method:`POST`,path:Z(`/auth/login`),operationId:`authLogin`,auth:`none`,body:Zn,response:{kind:`json`,schema:Qn},description:`Authenticate and create an admin session.`},{method:`POST`,path:Z(`/auth/logout`),operationId:`authLogout`,auth:`none`,response:{kind:`json`,schema:er},description:`Destroy the current admin session.`},{method:`PUT`,path:Z(`/auth/password`),operationId:`authPassword`,auth:`required`,body:$n,response:{kind:`json`,schema:er},description:`Change the admin password.`},{method:`GET`,path:Z(`/auth/status`),operationId:`authStatus`,auth:`none`,response:{kind:`json`,schema:tr},description:`Check the current auth status.`},{method:`GET`,path:Z(`/ws`),operationId:`runtimeWebSocket`,auth:`required`,response:{kind:`passthrough`},description:`Upgrade to the runtime WebSocket stream.`},{method:`GET`,path:Z(`/platforms/le/operations`),operationId:`platformOperations`,auth:`required`,query:Ii,response:{kind:`json`,schema:Fi},description:`List persisted platform operation summaries.`},{method:`GET`,path:Z(`/platforms/le/targets`),operationId:`platformTargets`,auth:`required`,response:{kind:`json`,schema:Zi},description:`List saved LE targets.`},{method:`POST`,path:Z(`/platforms/le/targets`),operationId:`platformTargetCreate`,auth:`required`,body:Qi,response:{kind:`json`,schema:Xi},description:`Create an LE target.`},{method:`POST`,path:Z(`/platforms/le/targets/test`),operationId:`platformConnectionTest`,auth:`required`,body:ea,response:{kind:`json`,schema:ta},description:`Test LE target connectivity.`},{method:`GET`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetDetail`,auth:`required`,params:la,response:{kind:`json`,schema:Xi},description:`Read one LE target.`},{method:`PUT`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetById`,auth:`required`,params:la,body:$i,response:{kind:`json`,schema:Xi},description:`Update one LE target.`},{method:`DELETE`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetDelete`,auth:`required`,params:la,response:{kind:`json`,schema:U({message:R().min(1)})},description:`Delete one LE target.`},{method:`POST`,path:Z(`/platforms/le/plan`),operationId:`platformPlan`,auth:`required`,body:ki,response:{kind:`json`,schema:Oi},description:`Preview an LE apply plan.`},{method:`POST`,path:Z(`/platforms/le/apply`),operationId:`platformApply`,auth:`required`,body:ki,response:{kind:`json`,schema:Ai},additionalSuccessResponses:{207:Ai},description:`Apply a platform plan.`},{method:`POST`,path:Z(`/platforms/le/cleanup/plan`),operationId:`platformCleanupPlan`,auth:`required`,body:ji,response:{kind:`json`,schema:Oi},description:`Preview an LE cleanup plan.`},{method:`POST`,path:Z(`/platforms/le/cleanup`),operationId:`platformCleanup`,auth:`required`,body:ji,response:{kind:`json`,schema:Mi},additionalSuccessResponses:{207:Mi},description:`Execute LE cleanup.`},{method:`POST`,path:Z(`/platforms/le/operations/:operationId/cancel`),operationId:`platformOperationCancel`,auth:`required`,params:ca,response:{kind:`json`,schema:Li},description:`Cancel an in-flight streaming LE operation.`},{method:`POST`,path:Z(`/platforms/le/apply/stream`),operationId:`platformApplyStream`,auth:`required`,body:ki,response:{kind:`passthrough`},description:`Stream LE apply progress over SSE.`},{method:`POST`,path:Z(`/platforms/le/cleanup/stream`),operationId:`platformCleanupStream`,auth:`required`,body:ji,response:{kind:`passthrough`},description:`Stream LE cleanup progress over SSE.`}],ha=U({code:q([`UNAUTHORIZED`,`NOT_FOUND`,`INVALID_REQUEST`,`INTERNAL_ERROR`]),message:R(),hint:R().optional()}),ga={UNAUTHORIZED:401,NOT_FOUND:404,INVALID_REQUEST:400,INTERNAL_ERROR:500},_a=class extends Error{code;status;hint;constructor(e){super(e.message),this.name=`ApiError`,this.code=e.code,this.status=e.status??ga[e.code],this.hint=e.hint}static is(e){return e instanceof Error&&e.name===`ApiError`}};function va(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 ya(e,t){return e?._def?.typeName===t}function ba(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 xa(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=va(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(ya(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},ba(e,`optional`),ba(e,`nullable`),ba(e,`default`),ba(e,`transform`),ba(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 Sa=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)}};xa(Xn),new Sa,W(`type`,[Cr.openapi(`SpawnCommand`),wr.openapi(`RemoveInstanceCommand`),Tr.openapi(`SetParameterCommand`),Er.openapi(`TriggerFaultCommand`),Dr.openapi(`ClearFaultCommand`),Or.openapi(`PauseCommand`),kr.openapi(`ResumeCommand`),Ar.openapi(`SetSpeedCommand`),jr.openapi(`UnquarantineCommand`),Mr.openapi(`InvokeMethodCommand`),Nr.openapi(`LoadTemplateCommand`),Pr.openapi(`UnloadTemplateRunCommand`),Fr.openapi(`ResetEnvironmentCommand`),Ir.openapi(`EnableAdapterCommand`),Lr.openapi(`DisableAdapterCommand`)]).openapi(`EngineCommand`);var Ca=new Map(ma.map(e=>[`${e.method} ${e.path}`,e]));function Q(e,t){let n=Ca.get(`${e} ${t}`);if(!n)throw Error(`Missing admin route definition for ${e} ${t}`);return n}var wa={authLogin:Q(`POST`,`/api/auth/login`),authLogout:Q(`POST`,`/api/auth/logout`),authPassword:Q(`PUT`,`/api/auth/password`),authStatus:Q(`GET`,`/api/auth/status`),bootstrap:Q(`GET`,`/api/bootstrap`),catalogModelDetail:Q(`GET`,`/api/catalog/models/:name`),catalogModelLeDt:Q(`GET`,`/api/catalog/models/:name/le-dt.json`),catalogModels:Q(`GET`,`/api/catalog/models`),catalogModelYaml:Q(`GET`,`/api/catalog/models/:name/yaml`),catalogTemplateDetail:Q(`GET`,`/api/catalog/templates/:id`),catalogTemplateLeTagsCsv:Q(`GET`,`/api/catalog/templates/:id/le-tags.csv`),catalogTemplateLeTemplateJson:Q(`GET`,`/api/catalog/templates/:id/le-template.json`),catalogTemplates:Q(`GET`,`/api/catalog/templates`),catalogTemplateYaml:Q(`GET`,`/api/catalog/templates/:id/yaml`),commands:Q(`POST`,`/api/commands`),events:Q(`GET`,`/api/events`),health:Q(`GET`,`/api/healthz`),instanceDetail:Q(`GET`,`/api/instances/:id`),manifest:Q(`GET`,`/api/manifest`),metrics:Q(`GET`,`/api/metrics`),modelDetail:Q(`GET`,`/api/models/:name`),openApiDocument:Q(`GET`,`/api/openapi.json`),platformApply:Q(`POST`,`/api/platforms/le/apply`),platformApplyStream:Q(`POST`,`/api/platforms/le/apply/stream`),platformCleanup:Q(`POST`,`/api/platforms/le/cleanup`),platformCleanupPlan:Q(`POST`,`/api/platforms/le/cleanup/plan`),platformCleanupStream:Q(`POST`,`/api/platforms/le/cleanup/stream`),platformConnectionTest:Q(`POST`,`/api/platforms/le/targets/test`),platformOperationCancel:Q(`POST`,`/api/platforms/le/operations/:operationId/cancel`),platformOperations:Q(`GET`,`/api/platforms/le/operations`),platformPlan:Q(`POST`,`/api/platforms/le/plan`),platformTargetById:Q(`PUT`,`/api/platforms/le/targets/:id`),platformTargetCreate:Q(`POST`,`/api/platforms/le/targets`),platformTargetDelete:Q(`DELETE`,`/api/platforms/le/targets/:id`),platformTargetDetail:Q(`GET`,`/api/platforms/le/targets/:id`),platformTargets:Q(`GET`,`/api/platforms/le/targets`),readiness:Q(`GET`,`/api/readyz`),runningTemplates:Q(`GET`,`/api/running-templates`),runtimeWebSocket:Q(`GET`,`/api/ws`),shutdown:Q(`POST`,`/api/shutdown`),state:Q(`GET`,`/api/state`)},Ta=new Xe({defaultOptions:{queries:{staleTime:3e4,gcTime:10*6e4,retry:(e,t)=>{if(t instanceof Error&&t.message===`Session expired`)return!1;if(_a.is(t)){let e=t.status;if(e>=400&&e<500)return!1}return e<2},refetchOnWindowFocus:!1}}}),Ea={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]}},Da=`miravo:query-cache:v1`,Oa=5*6e4,ka=Ea.platforms.targets(),Aa=!0;function ja(e){try{let t=sessionStorage.getItem(Da);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>Oa){sessionStorage.removeItem(Da);return}De(e,r.state)}catch{}}function Ma(e){try{let t=Ee(e,{shouldDehydrateQuery:e=>e.state.status===`success`&&!(e.queryKey[0]===ka[0]&&e.queryKey[1]===ka[1])}),n={timestamp:Date.now(),state:t};sessionStorage.setItem(Da,JSON.stringify(n))}catch{}}function Na(e){let t=null,n=e.getQueryCache().subscribe(()=>{Aa&&(t&&clearTimeout(t),t=setTimeout(()=>{Aa&&Ma(e)},500))});return()=>{t&&clearTimeout(t),n()}}function Pa(){try{sessionStorage.removeItem(Da)}catch{}}function Fa(){Aa=!0}function Ia(){Aa=!1}var La=e({AdminRoutes:()=>wa,BASE_URL:()=>Ra,CommandError:()=>Va,changePassword:()=>qa,fetchBlob:()=>Za,fetchJSON:()=>Ya,fetchText:()=>Qa,getBootstrap:()=>Ja,login:()=>Wa,logout:()=>Ga,postCommand:()=>Xa,redirectToLoginInApp:()=>Ba,requestJSON:()=>$,resolveApiUrl:()=>za}),Ra=(void 0)?.trim()||`/api`;function za(e,t){return`${e.trim().replace(/\/+$/,``)||`/api`}${t.startsWith(`/`)?t:`/${t}`}`}function Ba(){typeof window>`u`||(Ta.removeQueries({queryKey:[`bootstrap`]}),Pa(),window.location.pathname!==`/login`&&(window.history.pushState({},``,`/login`),window.dispatchEvent(new PopStateEvent(`popstate`))))}var Va=class extends Error{result;constructor(e){super(e.message),this.name=`CommandError`,this.result=e}};function Ha(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 Ua(e){try{let t=await e.json(),n=ha.safeParse(t);if(n.success)return new _a({code:n.data.code,status:e.status,message:n.data.message,hint:n.data.hint})}catch{}return Error(Ha(e.status,e.statusText))}async function Wa(e,t){return $(`/auth/login`,wa.authLogin,{body:{username:e,password:t}})}async function Ga(){await $(`/auth/logout`,wa.authLogout)}function Ka(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(za(Ra,e),a);if(o.status===401&&t.auth===`required`)throw Ba(),Error(`Session expired`);if(!o.ok)throw await Ua(o);let s;try{s=await o.json()}catch{throw Error(`Invalid JSON response for ${t.method} ${t.path}`)}let c=Ka(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 qa(e,t){return $(`/auth/password`,wa.authPassword,{body:{oldPassword:e,newPassword:t}})}async function Ja(){return $(`/bootstrap`,wa.bootstrap)}async function Ya(e,t){return $(e,t)}async function Xa(e){let t=await $(`/commands`,wa.commands,{body:e});if(!t.success)throw new Va(t);return t}async function Za(e,t){if(t.response.kind!==`passthrough`)throw Error(`fetchBlob requires a passthrough route definition for ${t.method} ${t.path}`);let n=await fetch(za(Ra,e),{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Ba(),Error(`Session expired`);if(!n.ok)throw Error(Ha(n.status,n.statusText));return n.blob()}async function Qa(e,t){if(t.response.kind!==`yaml`)throw Error(`fetchText requires a YAML route definition for ${t.method} ${t.path}`);let n=await fetch(za(Ra,e),{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Ba(),Error(`Session expired`);if(!n.ok)throw Error(Ha(n.status,n.statusText));return n.text()}export{ve as $,ir as A,z as B,_a as C,xr as D,Br as E,B as F,jn as G,G as H,W as I,Ue as J,V as K,q as L,nr as M,lr as N,ar as O,H as P,g as Q,Ln as R,wa as S,Ji as T,R as U,U as V,Nn as W,Be as X,We as Y,Le as Z,Fa as _,Za as a,f as at,Ea as b,Ja as c,he as ct,Xa as d,n as dt,_e as et,Ba as f,t as ft,Ia as g,Pa as h,qa as i,le as it,cr as j,rr as k,Wa as l,u as lt,za as m,Va as n,ue as nt,Ya as o,d as ot,$ as p,b as q,La as r,s as rt,Qa as s,ie as st,Ra as t,l as tt,Ga as u,i as ut,ja as v,ha as w,Ta as x,Na as y,K as z};
|
|
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!==h(o,t.options))return!1}else if(!te(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(ee(t.options.mutationKey)!==ee(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function h(e,t){return(t?.queryKeyHashFn||ee)(e)}function ee(e){return JSON.stringify(e,(e,t)=>oe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function re(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ae(e)&&ae(t);if(!r&&!(oe(e)&&oe(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:ne.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=re(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ie(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 ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oe(e){if(!se(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!se(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function se(e){return Object.prototype.toString.call(e)===`[object Object]`}function ce(e){return new Promise(t=>{i.setTimeout(t,e)})}function le(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:re(e,t)}function ue(e){return e}function de(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function fe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pe=Symbol();function me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function he(e,t){return typeof e==`function`?e(...t):!!e}function ge(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 _e=(()=>{let e=()=>o;return{isServer(){return e()},setIsServer(t){e=t}}})();function ve(){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 ye(e){let t;if(e.then(e=>(t=e,e),s)?.catch(s),t!==void 0)return{data:t}}function be(e){return e}function xe(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function Se(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 Ce(e){return e.state.isPaused}function we(e){return e.state.status===`success`}function Te(e){return!0}function Ee(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??Ce,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[xe(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??we,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors??Te,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData??be;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[Se(e,o,a)]:[])}}function De(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??be,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?ye(l):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,ee=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&&!h&&!ee&&(u===void 0||u>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(l).then(a)}).catch(s)})}var Oe=a;function ke(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Oe,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 g=ke(),Ae=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 je(e){return Math.min(1e3*2**e,3e4)}function Me(e){return(e??`online`)===`online`?Ae.isOnline():!0}var Ne=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Pe(e){let t=!1,r=0,i,a=ve(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new Ne(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>n.isFocused()&&(e.networkMode===`always`||Ae.isOnline())&&e.canRun(),d=()=>Me(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?.()}),h=()=>{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??(_e.isServer()?0:3),a=e.retryDelay??je,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),ce(s).then(()=>u()?void 0:m()).then(()=>{t?p(n):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(i?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var Fe=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??(_e.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(i.clearTimeout(this.#e),this.#e=void 0)}},Ie=class extends Fe{#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=ze(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=ze(this.options);e.data!==void 0&&(this.setState(Re(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=le(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===pe||!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=me(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=Pe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ne&&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 Ne){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,...Le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Re(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),g.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Me(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Re(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ze(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 Be(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=>{ge(e,()=>t.signal,()=>n=!0)},u=me(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?fe:de;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?He:Ve,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:Ve(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 Ve(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 He(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ue(e,t){return t?Ve(e,t)!=null:!1}function We(e,t){return!t||!e.getPreviousPageParam?!1:He(e,t)!=null}var Ge=class extends Fe{#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||Ke(),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=Pe({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),g.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ke(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qe=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 Ge({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=Je(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=Je(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=Je(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=Je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){g.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){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return g.batch(()=>Promise.all(e.map(e=>e.continue().catch(s))))}};function Je(e){return e.options.scope?.id}var Ye=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??h(r,t),a=this.get(i);return a||(a=new Ie({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(){g.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){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){g.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){g.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ye,this.#t=e.mutationCache||new qe,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=Ae.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 g.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;g.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return g.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=g.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(s).catch(s)}invalidateQueries(e,t={}){return g.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=g.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=Be(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(s).catch(s)}ensureInfiniteQueryData(e){return e.behavior=Be(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ae.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(ee(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ee(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(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||=h(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===pe&&(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()}},_;(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})(_||={});var Ze;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ze||={});var v=_.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),y=e=>{switch(typeof e){case`undefined`:return v.undefined;case`string`:return v.string;case`number`:return Number.isNaN(e)?v.nan:v.number;case`boolean`:return v.boolean;case`function`:return v.function;case`bigint`:return v.bigint;case`symbol`:return v.symbol;case`object`:return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?v.promise:typeof Map<`u`&&e instanceof Map?v.map:typeof Set<`u`&&e instanceof Set?v.set:typeof Date<`u`&&e instanceof Date?v.date:v.object;default:return v.unknown}},b=_.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`]),Qe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`),x=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,_.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()}};x.create=e=>new x(e);var $e=(e,t)=>{let n;switch(e.code){case b.invalid_type:n=e.received===v.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,_.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${_.joinValues(e.keys,`, `)}`;break;case b.invalid_union:n=`Invalid input`;break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${_.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n=`Invalid function arguments`;break;case b.invalid_return_type:n=`Invalid function return type`;break;case b.invalid_date:n=`Invalid date`;break;case b.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}"`:_.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case b.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 b.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 b.custom:n=`Invalid input`;break;case b.invalid_intersection_types:n=`Intersection results could not be merged`;break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,_.assertNever(e)}return{message:n}},et=$e;function tt(e){et=e}function nt(){return et}var rt=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}},it=[];function S(e,t){let n=nt(),r=rt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===$e?void 0:$e].filter(e=>!!e)});e.common.issues.push(r)}var C=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 w;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 w;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}}},w=Object.freeze({status:`aborted`}),at=e=>({status:`dirty`,value:e}),T=e=>({status:`valid`,value:e}),ot=e=>e.status===`aborted`,st=e=>e.status===`dirty`,ct=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(ct(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 x(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 y(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:y(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:y(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:y(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ct(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=>ct(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:y(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:b.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)!==v.string){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.string,received:t.parsedType}),w}let t=new C,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:b.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),S(n,{code:b.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?S(n,{code:b.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&S(n,{code:b.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),S(n,{validation:`email`,code:b.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),S(n,{validation:`emoji`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)mt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`uuid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ht.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`nanoid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)dt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cuid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ft.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cuid2`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)pt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`ulid`,code:b.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:`url`,code:b.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),S(n,{validation:`regex`,code:b.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),S(n,{code:b.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),S(n,{code:b.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?jt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?At(r).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?_t.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`duration`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Mt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`ip`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Nt(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`jwt`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Pt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`cidr`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`base64`,code:b.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:`base64url`,code:b.invalid_string,message:r.message}),t.dirty()):_.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:b.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)!==v.number){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.number,received:t.parsedType}),w}let t,n=new C;for(let r of this._def.checks)r.kind===`int`?_.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:b.not_finite,message:r.message}),n.dirty()):_.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`&&_.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)!==v.bigint)return this._getInvalidInput(e);let t,n=new C;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),S(t,{code:b.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),S(t,{code:b.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),S(t,{code:b.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):_.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.bigint,received:t.parsedType}),w}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)!==v.boolean){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.boolean,received:t.parsedType}),w}return T(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)!==v.date){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.date,received:t.parsedType}),w}if(Number.isNaN(e.data.getTime()))return S(this._getOrReturnCtx(e),{code:b.invalid_date}),w;let t=new C,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:b.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),S(n,{code:b.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):_.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)!==v.symbol){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.symbol,received:t.parsedType}),w}return T(e.data)}};Vt.create=e=>new Vt({typeName:L.ZodSymbol,...O(e)});var Ht=class extends k{_parse(e){if(this._getType(e)!==v.undefined){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.undefined,received:t.parsedType}),w}return T(e.data)}};Ht.create=e=>new Ht({typeName:L.ZodUndefined,...O(e)});var Ut=class extends k{_parse(e){if(this._getType(e)!==v.null){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.null,received:t.parsedType}),w}return T(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 T(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 T(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 S(t,{code:b.invalid_type,expected:v.never,received:t.parsedType}),w}};A.create=e=>new A({typeName:L.ZodNever,...O(e)});var Kt=class extends k{_parse(e){if(this._getType(e)!==v.undefined){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.void,received:t.parsedType}),w}return T(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!==v.array)return S(t,{code:b.invalid_type,expected:v.array,received:t.parsedType}),w;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(S(t,{code:e?b.too_big:b.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&&(S(t,{code:b.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&&(S(t,{code:b.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=>C.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new D(t,e,t.path,n)));return C.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:_.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==v.object){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),w}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&&(S(n,{code:b.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=>C.mergeObjectSync(t,e)):C.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 _.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 _.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 _.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 _.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(_.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 x(e.ctx.common.issues));return S(t,{code:b.invalid_union,unionErrors:n}),w}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 x(e));return S(t,{code:b.invalid_union,unionErrors:i}),w}}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?_.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!==v.object)return S(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),w;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}):(S(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}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=y(e),r=y(t);if(e===t)return{valid:!0,data:e};if(n===v.object&&r===v.object){let n=_.objectKeys(t),r=_.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===v.array&&r===v.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===v.date&&r===v.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(ot(e)||ot(r))return w;let i=Zt(e.value,r.value);return i.valid?((st(e)||st(r))&&t.dirty(),{status:t.value,value:i.data}):(S(n,{code:b.invalid_intersection_types}),w)};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!==v.array)return S(n,{code:b.invalid_type,expected:v.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return S(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),w;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:b.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=>C.mergeArray(t,e)):C.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!==v.object)return S(n,{code:b.invalid_type,expected:v.object,received:n.parsedType}),w;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?C.mergeObjectAsync(t,r):C.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!==v.map)return S(n,{code:b.invalid_type,expected:v.map,received:n.parsedType}),w;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 w;(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 w;(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!==v.set)return S(n,{code:b.invalid_type,expected:v.set,received:n.parsedType}),w;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(S(n,{code:b.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&&(S(n,{code:b.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 w;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!==v.function)return S(t,{code:b.invalid_type,expected:v.function,received:t.parsedType}),w;function n(e,n){return rt({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),$e].filter(e=>!!e),issueData:{code:b.invalid_arguments,argumentsError:n}})}function r(e,n){return rt({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),$e].filter(e=>!!e),issueData:{code:b.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ln){let e=this;return T(async function(...t){let o=new x([]),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 T(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new x([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new x([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 S(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),w}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 S(t,{expected:_.joinValues(n),received:t.parsedType,code:b.invalid_type}),w}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:b.invalid_enum_value,options:n}),w}return T(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=_.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){let e=_.objectValues(t);return S(n,{expected:_.joinValues(e),received:n.parsedType,code:b.invalid_type}),w}if(this._cache||=new Set(_.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=_.objectValues(t);return S(n,{received:n.data,code:b.invalid_enum_value,options:e}),w}return T(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!==v.promise&&t.common.async===!1?(S(t,{code:b.invalid_type,expected:v.promise,received:t.parsedType}),w):T((t.parsedType===v.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=>{S(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 w;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?w:r.status===`dirty`||t.value===`dirty`?at(r.value):r});{if(t.value===`aborted`)return w;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?w:r.status===`dirty`||t.value===`dirty`?at(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`?w:(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`?w:(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(!ct(e))return w;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=>ct(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):w);_.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)===v.undefined?T(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)===v.null?T(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===v.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 x(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new x(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)!==v.nan){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:v.nan,received:t.parsedType}),w}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`?w:e.status===`dirty`?(t.dirty(),at(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`?w: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=>(ct(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=w,Xn=e({BRAND:()=>pn,DIRTY:()=>at,EMPTY_PATH:()=>it,INVALID:()=>w,NEVER:()=>Yn,OK:()=>T,ParseStatus:()=>C,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:()=>x,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>nn,ZodIntersection:()=>Qt,ZodIssueCode:()=>b,ZodLazy:()=>rn,ZodLiteral:()=>an,ZodMap:()=>en,ZodNaN:()=>fn,ZodNativeEnum:()=>cn,ZodNever:()=>A,ZodNull:()=>Ut,ZodNullable:()=>I,ZodNumber:()=>Lt,ZodObject:()=>j,ZodOptional:()=>F,ZodParsedType:()=>v,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:()=>S,any:()=>Dn,array:()=>H,bigint:()=>Sn,boolean:()=>B,coerce:()=>Jn,custom:()=>vn,date:()=>Cn,datetimeRegex:()=>jt,defaultErrorMap:()=>$e,discriminatedUnion:()=>W,effect:()=>Bn,enum:()=>q,function:()=>In,getErrorMap:()=>nt,getParsedType:()=>y,instanceof:()=>bn,intersection:()=>Mn,isAborted:()=>ot,isAsync:()=>lt,isDirty:()=>st,isValid:()=>ct,late:()=>yn,lazy:()=>Ln,literal:()=>K,makeIssue:()=>rt,map:()=>Pn,nan:()=>xn,nativeEnum:()=>Rn,never:()=>On,null:()=>En,nullable:()=>Hn,number:()=>z,object:()=>U,objectUtil:()=>Ze,oboolean:()=>qn,onumber:()=>Kn,optional:()=>Vn,ostring:()=>Gn,pipeline:()=>Wn,preprocess:()=>Un,promise:()=>zn,quotelessJson:()=>Qe,record:()=>G,set:()=>Fn,setErrorMap:()=>tt,strictObject:()=>An,string:()=>R,symbol:()=>wn,transformer:()=>Bn,tuple:()=>Nn,undefined:()=>Tn,union:()=>jn,unknown:()=>V,util:()=>_,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({password:R().min(1)});var nr=`0.7.5`,rr=1883,ir=4840,ar=1502,or=65535,sr=1e4,cr=1e6,lr=1e5,ur=/^[a-zA-Z0-9_-]{1,64}$/,dr=/^\$param\.(\S+)$/,fr=z().int().min(1).max(or),pr=U({state:q([`healthy`,`busy`,`saturated`]),pendingWorkCount:z().finite().int().nonnegative(),completedLastTick:z().finite().int().nonnegative()}),mr=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:pr.optional()});U({name:R().min(1),enabled:B().default(!0)}).passthrough();var hr=U({name:R().min(1),enabled:B(),pending:B().optional(),endpoint:R().optional(),boundPort:fr.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:mr}))}),gr=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(hr).optional()}),_r=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()}),vr=U({state:gr,metrics:J,runningTemplates:H(_r),revision:z().int().nonnegative()}),yr=W(`authenticated`,[U({authenticated:K(!1)}),U({authenticated:K(!0),username:R().min(1),runtime:vr})]),br=U({instanceId:R().min(1),memberName:R().min(1),value:jn([z().finite(),R(),B()]),quality:q([`good`,`bad`,`uncertain`]),timestamp:z().finite().optional()}),xr=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)})]),Sr=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}),Cr=W(`type`,[U({type:K(`runtime:snapshot`),snapshot:vr}),U({type:K(`runtime:tick`),revision:z().int().nonnegative(),tick:z().int().nonnegative(),simulationTime:z().finite().nonnegative(),delta:H(br),instanceCount:z().int().nonnegative(),metrics:Sr}),U({type:K(`runtime:event`),revision:z().int().nonnegative(),event:xr}),U({type:K(`runtime:resync-required`),revision:z().int().nonnegative(),reason:R().min(1)})]),wr=1e3,Y=U({correlationId:R().optional()}),Tr=Y.extend({type:K(`spawn`),model:R().min(1),count:z().int().positive().max(sr),variation:z().min(0).max(1).optional(),unsBasePath:R().min(1).optional(),parameterOverrides:G(R(),z().finite()).optional(),startingHours:z().nonnegative().finite().optional()}),Er=Y.extend({type:K(`removeInstance`),instanceId:R().min(1)}),Dr=Y.extend({type:K(`setParameter`),instanceId:R().min(1),parameter:R().min(1),value:z().finite()}),Or=Y.extend({type:K(`triggerFault`),instanceId:R().min(1),fault:R().min(1)}),kr=Y.extend({type:K(`clearFault`),instanceId:R().min(1),fault:R().min(1)}),Ar=Y.extend({type:K(`pause`)}),jr=Y.extend({type:K(`resume`)}),Mr=Y.extend({type:K(`setSpeed`),multiplier:z().positive().finite().max(wr)}),Nr=Y.extend({type:K(`unquarantine`),instanceId:R().min(1)}),Pr=Y.extend({type:K(`invokeMethod`),instanceId:R().min(1),method:R().min(1),arguments:G(R().min(1),jn([z().finite(),R(),B()])).optional()}),Fr=Y.extend({type:K(`loadTemplate`),templatePath:R().min(1),count:z().int().positive().default(1)}),Ir=Y.extend({type:K(`unloadTemplateRun`),templateRunId:z().int().positive()}),Lr=Y.extend({type:K(`resetEnvironment`),clearPersistence:B().optional()}),Rr=Y.extend({type:K(`enableAdapter`),adapter:R().min(1),config:G(R(),V()).optional()}),zr=Y.extend({type:K(`disableAdapter`),adapter:R().min(1)}),Br=W(`type`,[Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr]),Vr=U({success:B(),command:R(),correlationId:R().optional(),message:R(),data:V().optional(),error:R().optional()}),Hr=`/api`,Ur=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,X=q([`mqtt`,`opcua`,`modbus`]),Wr=H(X).min(1),Gr=U({model:R().min(1),count:z().int().positive().default(1),variation:z().min(0).max(1).default(0),parameters:G(R(),z().finite()).optional(),starting_hours:z().finite().nonnegative().optional(),protocol_scope:Wr.optional()}).strict(),Kr=U({name:R().regex(ur,Ur),twins:H(Gr).min(1),protocol_scope:Wr.optional()}).strict(),qr=U({name:R().regex(ur,Ur),lines:H(Kr).min(1),protocol_scope:Wr.optional()}).strict(),Jr=jn([U({enterprise:R().regex(ur,Ur),site:R().regex(ur,Ur)}).strict(),U({prefix:R().regex(ur,Ur)}).strict()]),Yr=U({maxAttempts:z().finite().int().min(0).default(0),initialDelayMs:z().finite().int().positive().default(1e3),maxDelayMs:z().finite().int().positive().default(3e4)}).strict(),Xr=U({enabled:B().default(!1),deadband:z().finite().nonnegative().default(0)}).strict(),Zr=q([`base`,`full`]),Qr=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:Yr.optional(),rbe:Xr.optional(),metadata:Zr.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'.`}),$r=U({port:z().int().min(0).max(65535).default(ir),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()}),ei=U({port:z().int().min(0).max(65535).default(ar),host:R().default(`0.0.0.0`)}),ti=U({mqtt:Qr.optional(),opcua:$r.optional(),modbus:ei.optional()}).strict(),ni=q([`real-time`,`accelerated`]),ri=U({max_members_per_model:z().int().positive().max(lr).default(256),max_twin_count:z().int().positive().max(cr).default(sr)}).strict(),ii=U({tick_interval_ms:z().int().positive().default(1e3),time_mode:ni.default(`real-time`),time_multiplier:z().positive().default(1),seed:z().int().optional(),overrun_threshold_multiplier:z().min(1).max(10).optional(),limits:ri.optional()}).strict();U({kind:K(`MiravoTemplate`),version:K(`1`),name:R().min(1),description:R().optional(),namespace:Jr.optional(),areas:H(qr).min(1),protocols:ti.optional(),settings:ii.optional()}).strict().superRefine((e,t)=>{let n=e.settings?.limits?.max_twin_count??1e4;for(let r=0;r<e.areas.length;r++){let i=e.areas[r];if(i)for(let e=0;e<i.lines.length;e++){let a=i.lines[e];if(a)for(let i=0;i<a.twins.length;i++){let o=a.twins[i];!o||o.count<=n||t.addIssue({code:b.custom,path:[`areas`,r,`lines`,e,`twins`,i,`count`],message:`Twin assignment count must be at most ${n}. Fix: reduce count or set settings.limits.max_twin_count higher.`})}}}});var ai=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)}),oi=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()}),si=U({name:R().min(1),twins:H(oi),protocol_scope:H(X).optional()}),ci=U({name:R().min(1),lines:H(si),protocol_scope:H(X).optional()}),li=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)}),ui=li,di=li.extend({topology:H(ci),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(),limits:U({maxMembersPerModel:z().int().positive().optional(),maxTwinCount:z().int().positive().optional()}).optional()}).optional()}),fi=q([`idle`,`running`,`paused`,`stopped`]),pi=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:fi,to:fi,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()}),mi=jn([z().finite(),R(),B()]),hi=Nn([z().finite(),z().finite()]),gi=U({name:R().min(1),dataType:R().min(1),description:R().nullable()}),_i=U({description:R().nullable(),inputArguments:H(gi),outputArguments:H(gi)}),vi=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:mi,type:R().min(1),unit:R().optional()})),members:G(R().min(1),U({value:mi,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:hi.nullable()})})),methods:G(R().min(1),_i)}),yi=U({enabled:B(),port:z().int().positive().optional()}),bi=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()))}),xi=U({template:R().min(1).optional(),generatedAt:R().datetime(),protocols:G(R(),yi),tags:H(bi),summary:U({totalTags:z().int().nonnegative(),totalInstances:z().int().nonnegative(),enabledProtocols:H(R().min(1))})}),Si=U({name:R().min(1),description:R().nullable(),parameters:G(R().min(1),U({type:R().min(1),default:mi,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:hi.nullable(),default:mi.nullable()})),methods:G(R().min(1),_i),faults:H(R().min(1)),lifecycle:U({stages:H(R().min(1)),totalHours:z().finite().nonnegative()}).nullable()}),Ci=q([`devices`,`models`,`instances`]),wi=q([`create`,`update`,`replace`,`delete`,`noop`,`blocked`]),Ti=q([`device`,`model`,`instance`,`param-sync`]),Ei=q([`apply`,`cleanup`]),Di=q([`success`,`partial`,`blocked`,`noop`,`failed`]);q([`device`,`model`,`instance`,`param-sync`]),q([`create`,`update`,`replace`,`delete`]);var Oi=U({area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),ki=U({action:wi,resourceType:Ti,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()}),Ai=U({sourceMode:q([`static`,`managed`]),targetHost:R().min(1),sourceHostname:R().min(1).optional(),scope:H(Ci),filters:Oi,entries:H(ki)}),ji=U({plan:Ai}),Mi=U({targetId:R().min(1),template:R().min(1).optional(),model:R().min(1).optional(),protocol:X.optional(),scope:H(Ci).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()}),Ni=U({plan:Ai,applied:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),Pi=U({targetId:R().min(1),template:R().min(1).optional(),allManaged:B().optional(),scope:H(Ci).optional(),area:R().min(1).optional(),line:R().min(1).optional(),instance:R().min(1).optional()}),Fi=U({plan:Ai,deleted:z().int().nonnegative(),failed:z().int().nonnegative(),error:R().min(1).optional()}),Ii=U({create:z().int().nonnegative(),update:z().int().nonnegative(),replace:z().int().nonnegative(),delete:z().int().nonnegative(),noop:z().int().nonnegative(),failed:z().int().nonnegative(),total:z().int().nonnegative()}),Li=U({device:Ii,model:Ii,instance:Ii,"param-sync":Ii}),Ri=U({operations:H(U({schemaVersion:K(1),operationId:R().min(1),operationType:Ei,status:Di,templateId:R().min(1),targetId:R().min(1),targetLabel:R().min(1),hostname:R().min(1),scope:H(R().min(1)),filters:Oi,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:Li,error:R().min(1).optional()})),total:z().int().nonnegative(),hasMore:B()}),zi=U({type:Ei.optional(),targetId:R().min(1).optional(),limit:Jn.number().int().positive().max(500).optional(),offset:Jn.number().int().nonnegative().optional()}),Bi=U({cancelled:K(!0)}),Vi=U({operationId:R().min(1),type:Ei,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()}),Hi=U({operationId:R().min(1),type:Ei,targetId:R().min(1).optional(),template:R().min(1).optional(),model:R().min(1).optional()}),Ui=U({operationId:R().min(1),phase:Ti,total:z().int().nonnegative()}),Wi=U({operationId:R().min(1),phase:Ti,name:R().min(1),action:wi,status:q([`success`,`failed`]),error:R().min(1).optional(),index:z().int().positive(),of:z().int().positive()}),Gi=U({operationId:R().min(1),applied:z().int().nonnegative().optional(),deleted:z().int().nonnegative().optional(),failed:z().int().nonnegative(),duration:z().int().nonnegative(),plan:Ai}),Ki=Gi,qi=Gi,Ji=U({operationId:R().min(1),attempt:z().int().positive(),maxAttempts:z().int().positive(),delayMs:z().int().nonnegative(),error:R().min(1)}),Yi=U({message:R().min(1)}),Xi=U({level:q([`info`,`warn`,`error`]),message:R().min(1),protocol:X.optional(),port:fr.optional(),templatePort:fr.optional()}),Zi=W(`event`,[U({event:K(`log`),data:Xi}),U({event:K(`started`),data:Vi}),U({event:K(`accepted`),data:Hi}),U({event:K(`phase`),data:Ui}),U({event:K(`resource`),data:Wi}),U({event:K(`complete`),data:Ki}),U({event:K(`cancelled`),data:qi}),U({event:K(`retrying`),data:Ji}),U({event:K(`error`),data:Yi})]),Qi=`litmus-edge`,$i=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(),ea=U({targets:H($i)}).strict(),ta=U({platformId:R().min(1).default(Qi),label:R().min(1),hostname:R().min(1),apiToken:R().min(1),sourceHostname:R().min(1)}),na=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()}),ra=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:b.custom,message:`apiToken is required when targetId is omitted.`,path:[`apiToken`]})}),ia=W(`connected`,[U({connected:K(!0),hostname:R().min(1),sourceHostname:R().min(1),litmusEdgeVersion:R().min(1).optional(),warning:R().min(1).optional()}),U({connected:K(!1),error:R().min(1)})]),aa=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()}),oa=U({reason:R().min(1).optional()}),sa=U({status:K(`shutting_down`)}),ca=U({id:R().min(1)}),la=U({name:R().min(1)}),ua=U({id:R().min(1)}),da=U({operationId:R().min(1)}),fa=U({id:R().min(1)}),pa=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()}),ma=U({host:R().min(1),protocol:X.optional()}),ha=G(R(),V()),ga=G(R(),V());function Z(e){return`${Hr}${e}`}var _a=[{method:`GET`,path:Z(`/openapi.json`),operationId:`openApiDocument`,auth:`none`,response:{kind:`json`,schema:ga},description:`Generated OpenAPI document for the Miravo admin API.`},{method:`GET`,path:Z(`/healthz`),operationId:`health`,auth:`none`,response:{kind:`json`,schema:aa},description:`Liveness probe for the Miravo admin server.`},{method:`GET`,path:Z(`/readyz`),operationId:`readiness`,auth:`none`,response:{kind:`json`,schema:aa},description:`Readiness probe for the Miravo admin server.`},{method:`GET`,path:Z(`/metrics`),operationId:`metrics`,auth:`required`,response:{kind:`json`,schema:J},description:`Engine metrics snapshot.`},{method:`GET`,path:Z(`/state`),operationId:`state`,auth:`required`,response:{kind:`json`,schema:gr},description:`Engine state snapshot.`},{method:`GET`,path:Z(`/bootstrap`),operationId:`bootstrap`,auth:`none`,response:{kind:`json`,schema:yr},description:`Console bootstrap payload.`},{method:`POST`,path:Z(`/commands`),operationId:`commands`,auth:`required`,body:Br,response:{kind:`json`,schema:Vr},description:`Execute an engine command.`},{method:`POST`,path:Z(`/shutdown`),operationId:`shutdown`,auth:`required`,body:oa,response:{kind:`json`,schema:sa},description:`Request graceful shutdown.`},{method:`GET`,path:Z(`/instances/:id`),operationId:`instanceDetail`,auth:`required`,params:ca,response:{kind:`json`,schema:vi},description:`Inspect a running instance.`},{method:`GET`,path:Z(`/models/:name`),operationId:`modelDetail`,auth:`required`,params:la,response:{kind:`json`,schema:Si},description:`Inspect a registered model schema.`},{method:`GET`,path:Z(`/events`),operationId:`events`,auth:`required`,query:pa,response:{kind:`json`,schema:pi},description:`Read paginated event log entries.`},{method:`GET`,path:Z(`/catalog/models`),operationId:`catalogModels`,auth:`required`,response:{kind:`json`,schema:H(ai)},description:`List catalog models.`},{method:`GET`,path:Z(`/catalog/models/:name/le-dt.json`),operationId:`catalogModelLeDt`,auth:`required`,params:la,response:{kind:`json`,schema:ha},description:`Download LE Digital Twin JSON for a catalog model.`},{method:`GET`,path:Z(`/catalog/models/:name/yaml`),operationId:`catalogModelYaml`,auth:`required`,params:la,response:{kind:`yaml`},description:`Read raw YAML for a catalog model.`},{method:`GET`,path:Z(`/catalog/models/:name`),operationId:`catalogModelDetail`,auth:`required`,params:la,response:{kind:`json`,schema:Si},description:`Read catalog model schema.`},{method:`GET`,path:Z(`/catalog/templates/:id/le-template.json`),operationId:`catalogTemplateLeTemplateJson`,auth:`required`,params:ua,query:ma,response:{kind:`passthrough`},description:`Download LE template JSON export.`},{method:`GET`,path:Z(`/catalog/templates/:id/le-tags.csv`),operationId:`catalogTemplateLeTagsCsv`,auth:`required`,params:ua,query:ma,response:{kind:`passthrough`},description:`Download LE tags CSV export.`},{method:`GET`,path:Z(`/catalog/templates/:id/yaml`),operationId:`catalogTemplateYaml`,auth:`required`,params:ua,response:{kind:`yaml`},description:`Read raw YAML for a catalog template.`},{method:`GET`,path:Z(`/catalog/templates/:id`),operationId:`catalogTemplateDetail`,auth:`required`,params:ua,response:{kind:`json`,schema:di},description:`Read catalog template detail.`},{method:`GET`,path:Z(`/catalog/templates`),operationId:`catalogTemplates`,auth:`required`,response:{kind:`json`,schema:H(ui)},description:`List catalog templates.`},{method:`GET`,path:Z(`/running-templates`),operationId:`runningTemplates`,auth:`required`,response:{kind:`json`,schema:H(_r)},description:`List running template runs.`},{method:`GET`,path:Z(`/manifest`),operationId:`manifest`,auth:`required`,response:{kind:`json`,schema:xi},description:`Read unified protocol manifest.`},{method:`POST`,path:Z(`/auth/login`),operationId:`authLogin`,auth:`none`,body:Zn,response:{kind:`json`,schema:Qn},description:`Authenticate and create an admin session.`},{method:`POST`,path:Z(`/auth/logout`),operationId:`authLogout`,auth:`none`,response:{kind:`json`,schema:er},description:`Destroy the current admin session.`},{method:`PUT`,path:Z(`/auth/password`),operationId:`authPassword`,auth:`required`,body:$n,response:{kind:`json`,schema:er},description:`Change the admin password.`},{method:`GET`,path:Z(`/auth/status`),operationId:`authStatus`,auth:`none`,response:{kind:`json`,schema:tr},description:`Check the current auth status.`},{method:`GET`,path:Z(`/ws`),operationId:`runtimeWebSocket`,auth:`required`,response:{kind:`passthrough`},description:`Upgrade to the runtime WebSocket stream.`},{method:`GET`,path:Z(`/platforms/le/operations`),operationId:`platformOperations`,auth:`required`,query:zi,response:{kind:`json`,schema:Ri},description:`List persisted platform operation summaries.`},{method:`GET`,path:Z(`/platforms/le/targets`),operationId:`platformTargets`,auth:`required`,response:{kind:`json`,schema:ea},description:`List saved LE targets.`},{method:`POST`,path:Z(`/platforms/le/targets`),operationId:`platformTargetCreate`,auth:`required`,body:ta,response:{kind:`json`,schema:$i},description:`Create an LE target.`},{method:`POST`,path:Z(`/platforms/le/targets/test`),operationId:`platformConnectionTest`,auth:`required`,body:ra,response:{kind:`json`,schema:ia},description:`Test LE target connectivity.`},{method:`GET`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetDetail`,auth:`required`,params:fa,response:{kind:`json`,schema:$i},description:`Read one LE target.`},{method:`PUT`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetById`,auth:`required`,params:fa,body:na,response:{kind:`json`,schema:$i},description:`Update one LE target.`},{method:`DELETE`,path:Z(`/platforms/le/targets/:id`),operationId:`platformTargetDelete`,auth:`required`,params:fa,response:{kind:`json`,schema:U({message:R().min(1)})},description:`Delete one LE target.`},{method:`POST`,path:Z(`/platforms/le/plan`),operationId:`platformPlan`,auth:`required`,body:Mi,response:{kind:`json`,schema:ji},description:`Preview an LE apply plan.`},{method:`POST`,path:Z(`/platforms/le/apply`),operationId:`platformApply`,auth:`required`,body:Mi,response:{kind:`json`,schema:Ni},additionalSuccessResponses:{207:Ni},description:`Apply a platform plan.`},{method:`POST`,path:Z(`/platforms/le/cleanup/plan`),operationId:`platformCleanupPlan`,auth:`required`,body:Pi,response:{kind:`json`,schema:ji},description:`Preview an LE cleanup plan.`},{method:`POST`,path:Z(`/platforms/le/cleanup`),operationId:`platformCleanup`,auth:`required`,body:Pi,response:{kind:`json`,schema:Fi},additionalSuccessResponses:{207:Fi},description:`Execute LE cleanup.`},{method:`POST`,path:Z(`/platforms/le/operations/:operationId/cancel`),operationId:`platformOperationCancel`,auth:`required`,params:da,response:{kind:`json`,schema:Bi},description:`Cancel an in-flight streaming LE operation.`},{method:`POST`,path:Z(`/platforms/le/apply/stream`),operationId:`platformApplyStream`,auth:`required`,body:Mi,response:{kind:`passthrough`},description:`Stream LE apply progress over SSE.`},{method:`POST`,path:Z(`/platforms/le/cleanup/stream`),operationId:`platformCleanupStream`,auth:`required`,body:Pi,response:{kind:`passthrough`},description:`Stream LE cleanup progress over SSE.`}],va=U({code:q([`UNAUTHORIZED`,`NOT_FOUND`,`INVALID_REQUEST`,`INTERNAL_ERROR`]),message:R(),hint:R().optional()}),ya={UNAUTHORIZED:401,NOT_FOUND:404,INVALID_REQUEST:400,INTERNAL_ERROR:500},ba=class extends Error{code;status;hint;constructor(e){super(e.message),this.name=`ApiError`,this.code=e.code,this.status=e.status??ya[e.code],this.hint=e.hint}static is(e){return e instanceof Error&&e.name===`ApiError`}};function xa(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 Sa(e,t){return e?._def?.typeName===t}function Ca(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 wa(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=xa(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(Sa(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},Ca(e,`optional`),Ca(e,`nullable`),Ca(e,`default`),Ca(e,`transform`),Ca(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 Ta=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)}};wa(Xn),new Ta,W(`type`,[Tr.openapi(`SpawnCommand`),Er.openapi(`RemoveInstanceCommand`),Dr.openapi(`SetParameterCommand`),Or.openapi(`TriggerFaultCommand`),kr.openapi(`ClearFaultCommand`),Ar.openapi(`PauseCommand`),jr.openapi(`ResumeCommand`),Mr.openapi(`SetSpeedCommand`),Nr.openapi(`UnquarantineCommand`),Pr.openapi(`InvokeMethodCommand`),Fr.openapi(`LoadTemplateCommand`),Ir.openapi(`UnloadTemplateRunCommand`),Lr.openapi(`ResetEnvironmentCommand`),Rr.openapi(`EnableAdapterCommand`),zr.openapi(`DisableAdapterCommand`)]).openapi(`EngineCommand`);var Ea=new Map(_a.map(e=>[`${e.method} ${e.path}`,e]));function Q(e,t){let n=Ea.get(`${e} ${t}`);if(!n)throw Error(`Missing admin route definition for ${e} ${t}`);return n}var Da={authLogin:Q(`POST`,`/api/auth/login`),authLogout:Q(`POST`,`/api/auth/logout`),authPassword:Q(`PUT`,`/api/auth/password`),authStatus:Q(`GET`,`/api/auth/status`),bootstrap:Q(`GET`,`/api/bootstrap`),catalogModelDetail:Q(`GET`,`/api/catalog/models/:name`),catalogModelLeDt:Q(`GET`,`/api/catalog/models/:name/le-dt.json`),catalogModels:Q(`GET`,`/api/catalog/models`),catalogModelYaml:Q(`GET`,`/api/catalog/models/:name/yaml`),catalogTemplateDetail:Q(`GET`,`/api/catalog/templates/:id`),catalogTemplateLeTagsCsv:Q(`GET`,`/api/catalog/templates/:id/le-tags.csv`),catalogTemplateLeTemplateJson:Q(`GET`,`/api/catalog/templates/:id/le-template.json`),catalogTemplates:Q(`GET`,`/api/catalog/templates`),catalogTemplateYaml:Q(`GET`,`/api/catalog/templates/:id/yaml`),commands:Q(`POST`,`/api/commands`),events:Q(`GET`,`/api/events`),health:Q(`GET`,`/api/healthz`),instanceDetail:Q(`GET`,`/api/instances/:id`),manifest:Q(`GET`,`/api/manifest`),metrics:Q(`GET`,`/api/metrics`),modelDetail:Q(`GET`,`/api/models/:name`),openApiDocument:Q(`GET`,`/api/openapi.json`),platformApply:Q(`POST`,`/api/platforms/le/apply`),platformApplyStream:Q(`POST`,`/api/platforms/le/apply/stream`),platformCleanup:Q(`POST`,`/api/platforms/le/cleanup`),platformCleanupPlan:Q(`POST`,`/api/platforms/le/cleanup/plan`),platformCleanupStream:Q(`POST`,`/api/platforms/le/cleanup/stream`),platformConnectionTest:Q(`POST`,`/api/platforms/le/targets/test`),platformOperationCancel:Q(`POST`,`/api/platforms/le/operations/:operationId/cancel`),platformOperations:Q(`GET`,`/api/platforms/le/operations`),platformPlan:Q(`POST`,`/api/platforms/le/plan`),platformTargetById:Q(`PUT`,`/api/platforms/le/targets/:id`),platformTargetCreate:Q(`POST`,`/api/platforms/le/targets`),platformTargetDelete:Q(`DELETE`,`/api/platforms/le/targets/:id`),platformTargetDetail:Q(`GET`,`/api/platforms/le/targets/:id`),platformTargets:Q(`GET`,`/api/platforms/le/targets`),readiness:Q(`GET`,`/api/readyz`),runningTemplates:Q(`GET`,`/api/running-templates`),runtimeWebSocket:Q(`GET`,`/api/ws`),shutdown:Q(`POST`,`/api/shutdown`),state:Q(`GET`,`/api/state`)},Oa=new Xe({defaultOptions:{queries:{staleTime:3e4,gcTime:10*6e4,retry:(e,t)=>{if(t instanceof Error&&t.message===`Session expired`)return!1;if(ba.is(t)){let e=t.status;if(e>=400&&e<500)return!1}return e<2},refetchOnWindowFocus:!1}}}),ka={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]}},Aa=`miravo:query-cache:v1`,ja=5*6e4,Ma=ka.platforms.targets(),Na=!0;function Pa(e){try{let t=sessionStorage.getItem(Aa);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>ja){sessionStorage.removeItem(Aa);return}De(e,r.state)}catch{}}function Fa(e){try{let t=Ee(e,{shouldDehydrateQuery:e=>e.state.status===`success`&&!(e.queryKey[0]===Ma[0]&&e.queryKey[1]===Ma[1])}),n={timestamp:Date.now(),state:t};sessionStorage.setItem(Aa,JSON.stringify(n))}catch{}}function Ia(e){let t=null,n=e.getQueryCache().subscribe(()=>{Na&&(t&&clearTimeout(t),t=setTimeout(()=>{Na&&Fa(e)},500))});return()=>{t&&clearTimeout(t),n()}}function La(){try{sessionStorage.removeItem(Aa)}catch{}}function Ra(){Na=!0}function za(){Na=!1}var Ba=e({AdminRoutes:()=>Da,BASE_URL:()=>Va,CommandError:()=>Wa,changePassword:()=>Xa,fetchBlob:()=>eo,fetchJSON:()=>Qa,fetchText:()=>to,getBootstrap:()=>Za,login:()=>qa,logout:()=>Ja,postCommand:()=>$a,redirectToLoginInApp:()=>Ua,requestJSON:()=>$,resolveApiUrl:()=>Ha}),Va=(void 0)?.trim()||`/api`;function Ha(e,t){return`${e.trim().replace(/\/+$/,``)||`/api`}${t.startsWith(`/`)?t:`/${t}`}`}function Ua(){typeof window>`u`||(Oa.removeQueries({queryKey:[`bootstrap`]}),La(),window.location.pathname!==`/login`&&(window.history.pushState({},``,`/login`),window.dispatchEvent(new PopStateEvent(`popstate`))))}var Wa=class extends Error{result;constructor(e){super(e.message),this.name=`CommandError`,this.result=e}};function Ga(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 Ka(e){try{let t=await e.json(),n=va.safeParse(t);if(n.success)return new ba({code:n.data.code,status:e.status,message:n.data.message,hint:n.data.hint})}catch{}return Error(Ga(e.status,e.statusText))}async function qa(e,t){return $(`/auth/login`,Da.authLogin,{body:{username:e,password:t}})}async function Ja(){await $(`/auth/logout`,Da.authLogout)}function Ya(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(Ha(Va,e),a);if(o.status===401&&t.auth===`required`)throw Ua(),Error(`Session expired`);if(!o.ok)throw await Ka(o);let s;try{s=await o.json()}catch{throw Error(`Invalid JSON response for ${t.method} ${t.path}`)}let c=Ya(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 Xa(e,t){return $(`/auth/password`,Da.authPassword,{body:{oldPassword:e,newPassword:t}})}async function Za(){return $(`/bootstrap`,Da.bootstrap)}async function Qa(e,t){return $(e,t)}async function $a(e){let t=await $(`/commands`,Da.commands,{body:e});if(!t.success)throw new Wa(t);return t}async function eo(e,t){if(t.response.kind!==`passthrough`)throw Error(`fetchBlob requires a passthrough route definition for ${t.method} ${t.path}`);let n=await fetch(Ha(Va,e),{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Ua(),Error(`Session expired`);if(!n.ok)throw Error(Ga(n.status,n.statusText));return n.blob()}async function to(e,t){if(t.response.kind!==`yaml`)throw Error(`fetchText requires a YAML route definition for ${t.method} ${t.path}`);let n=await fetch(Ha(Va,e),{credentials:`include`});if(n.status===401&&t.auth===`required`)throw Ua(),Error(`Session expired`);if(!n.ok)throw Error(Ga(n.status,n.statusText));return n.text()}export{ve as $,ir as A,z as B,ba as C,Cr as D,Hr as E,B as F,jn as G,G as H,W as I,Ue as J,V as K,q as L,nr as M,dr as N,ar as O,H as P,g as Q,Ln as R,Da as S,Zi as T,R as U,U as V,Nn as W,Be as X,We as Y,Le as Z,Ra as _,eo as a,f as at,ka as b,Za as c,he as ct,$a as d,n as dt,_e as et,Ua as f,t as ft,za as g,La as h,Xa as i,le as it,ur as j,rr as k,qa as l,u as lt,Ha as m,Wa as n,ue as nt,Qa as o,d as ot,$ as p,b as q,Ba as r,s as rt,to as s,ie as st,Va as t,l as tt,Ja as u,i as ut,Pa as v,va as w,Oa as x,Ia as y,K as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./catalog-B_wh8kje.js";export{e as CatalogPage};
|