@kubitnodes/stellaris 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cli/index.js +86 -4
  2. package/dist/server/index.js +403 -27
  3. package/package.json +1 -1
  4. package/web/dist/assets/ChannelView-UppsahaH.js +1 -0
  5. package/web/dist/assets/CitizenView-CvZ5sEqw.js +2 -0
  6. package/web/dist/assets/{CitizensView-DB2TlGxn.js → CitizensView-D7VztzDL.js} +1 -1
  7. package/web/dist/assets/{KnowledgeView-l0I_R5Zd.js → KnowledgeView-D2jzcn4S.js} +1 -1
  8. package/web/dist/assets/{Markdown-C6mhAmbQ.js → Markdown-Dc8gCFZz.js} +4 -4
  9. package/web/dist/assets/{MessageItem-BR30twQh.js → MessageItem-BcDf-lgD.js} +1 -1
  10. package/web/dist/assets/MetricsView-lRYbAJSl.js +1 -0
  11. package/web/dist/assets/NeedsYouView-C-2cU-C5.js +1 -0
  12. package/web/dist/assets/{Overview-D47FfDDO.js → Overview-lKNZgZg_.js} +1 -1
  13. package/web/dist/assets/{Pane-BXpuXst6.js → Pane-DKfOLaXj.js} +1 -1
  14. package/web/dist/assets/{ProjectView-CxUA5nFw.js → ProjectView-CSoD4RFx.js} +1 -1
  15. package/web/dist/assets/ProposalView-BkcPia8W.js +1 -0
  16. package/web/dist/assets/{ProposalsView-BscIGUTT.js → ProposalsView-BQucmpBt.js} +1 -1
  17. package/web/dist/assets/{RunnersView-BypVHvzI.js → RunnersView-FbbPyu3y.js} +1 -1
  18. package/web/dist/assets/{SocietyView-C403e1uR.js → SocietyView-rpbJ_PcL.js} +1 -1
  19. package/web/dist/assets/SubjectThread-DQHf-MWF.js +1 -0
  20. package/web/dist/assets/{TaskView-B-4WGLWK.js → TaskView-6_oFPNkL.js} +1 -1
  21. package/web/dist/assets/{TasksView-CA02-WIW.js → TasksView-CJkLuWGV.js} +1 -1
  22. package/web/dist/assets/{ThreadCard-C4rb-53v.js → ThreadCard-Cjwceioc.js} +1 -1
  23. package/web/dist/assets/ThreadForms-CE9t-rVz.js +1 -0
  24. package/web/dist/assets/{ThreadView-CAdCu-y_.js → ThreadView-D09wIsYl.js} +1 -1
  25. package/web/dist/assets/citizen-BPzyDHNO.js +1 -0
  26. package/web/dist/assets/format-CRfcN5Lw.js +55 -0
  27. package/web/dist/assets/index-Ch3gW4_Z.js +23 -0
  28. package/web/dist/assets/index-NUcot4yn.css +2 -0
  29. package/web/dist/assets/{tasks-DZgkXWwu.js → tasks-DcMvT5ru.js} +1 -1
  30. package/web/dist/assets/{useStickyScroll-CVTdIoKj.js → useStickyScroll-B3_nksqI.js} +1 -1
  31. package/web/dist/index.html +4 -4
  32. package/web/dist/assets/ChannelView-B4rv0TMD.js +0 -1
  33. package/web/dist/assets/CitizenView-DfBiP1Jw.js +0 -2
  34. package/web/dist/assets/MetricsView-BZ0WW2Do.js +0 -1
  35. package/web/dist/assets/NeedsYouView-C6CZNnJn.js +0 -1
  36. package/web/dist/assets/ProposalView-C0oLBLQD.js +0 -1
  37. package/web/dist/assets/SubjectThread-irSHRJpB.js +0 -1
  38. package/web/dist/assets/ThreadForms-Dh9ky_aU.js +0 -1
  39. package/web/dist/assets/citizen-BWGATcew.js +0 -1
  40. package/web/dist/assets/format-DZLzLk7S.js +0 -55
  41. package/web/dist/assets/index-D-wuKd9C.js +0 -21
  42. package/web/dist/assets/index-HwY3AK-1.css +0 -2
@@ -0,0 +1,55 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var ee={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,te={};function ne(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}ne.prototype.isReactComponent={},ne.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},ne.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function _(){}_.prototype=ne.prototype;function re(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}var ie=re.prototype=new _;ie.constructor=re,g(ie,ne.prototype),ie.isPureReactComponent=!0;var ae=Array.isArray;function oe(){}var v={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function y(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ce(e,t){return y(e.type,t,e.props)}function b(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function le(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ue=/\/+/g;function x(e,t){return typeof e==`object`&&e&&e.key!=null?le(``+e.key):t.toString(36)}function de(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(oe,oe):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function S(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,S(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+x(e,0):a,ae(o)?(i=``,c!=null&&(i=c.replace(ue,`$&/`)+`/`),S(o,r,i,``,function(e){return e})):o!=null&&(b(o)&&(o=ce(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ue,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ae(e))for(var u=0;u<e.length;u++)a=e[u],s=l+x(a,u),c+=S(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+x(a,u++),c+=S(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return S(de(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function C(e,t,n){if(e==null)return e;var r=[],i=0;return S(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function fe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var w=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function pe(e){var t=v.T,n={};n.types=t===null?null:t.types,v.T=n;try{var r=e(),i=v.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(oe,w)}catch(e){w(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),v.T=t}}function me(e){var t=v.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else pe(me.bind(null,e))}var T={map:C,forEach:function(e,t,n){C(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return C(e,function(){t++}),t},toArray:function(e){return C(e,function(e){return e})||[]},only:function(e){if(!b(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=T,e.Component=ne,e.Fragment=r,e.Profiler=a,e.PureComponent=re,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=v,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return v.H.useMemoCache(e)}},e.addTransitionType=me,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!se.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return y(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)se.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return y(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=b,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:fe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=pe,e.unstable_useCacheRefresh=function(){return v.H.useCacheRefresh()},e.use=function(e){return v.H.use(e)},e.useActionState=function(e,t,n){return v.H.useActionState(e,t,n)},e.useCallback=function(e,t){return v.H.useCallback(e,t)},e.useContext=function(e){return v.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return v.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return v.H.useEffect(e,t)},e.useEffectEvent=function(e){return v.H.useEffectEvent(e)},e.useId=function(){return v.H.useId()},e.useImperativeHandle=function(e,t,n){return v.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return v.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return v.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return v.H.useMemo(e,t)},e.useOptimistic=function(e,t){return v.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return v.H.useReducer(e,t,n)},e.useRef=function(e){return v.H.useRef(e)},e.useState=function(e){return v.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return v.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return v.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),p=o(((e,t)=>{t.exports=f()})),m=l(d(),1),h=p(),ee=m.createContext(void 0),g=e=>{let t=m.useContext(ee);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},te=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,h.jsx)(ee.Provider,{value:e,children:t})),ne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=ne;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 re(e){setTimeout(e,0)}var ie=typeof window>`u`||`Deno`in globalThis;function ae(){}function oe(e,t){return typeof e==`function`?e(t):e}function v(e){return typeof e==`number`&&e>=0&&e!==1/0}function se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function y(e,t){return typeof e==`function`?e(t):e}function ce(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==le(o,t.options))return!1}else if(!x(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 b(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ue(t.options.mutationKey)!==ue(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function le(e,t){return(t?.queryKeyHashFn||ue)(e)}function ue(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var de=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=fe(e)&&fe(t);if(!r&&!(w(e)&&w(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:de.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(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 fe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!pe(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!pe(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function pe(e){return Object.prototype.toString.call(e)===`[object Object]`}function me(e){return new Promise(t=>{_.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function he(e){return e}function ge(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function _e(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ve=Symbol();function ye(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ve?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function be(e,t){return typeof e==`function`?e(...t):!!e}function xe(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 Se=()=>ie,Ce=()=>Se(),we=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(){}},Te=new class extends we{#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`}},Ee=re;function De(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ee,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 Oe=De(),ke=new class extends we{#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 Ae(e){return Math.min(1e3*2**e,3e4)}function je(e){return(e??`online`)!==`online`||ke.isOnline()}var Me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ne(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ae);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Me(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Te.isFocused()&&(e.networkMode===`always`||ke.isOnline())&&e.canRun(),p=()=>je(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},ee=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),g=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Ce()?0:3),a=e.retryDelay??Ae,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),me(o).then(()=>f()?void 0:ee()).then(()=>{t?h(r):g()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?g():ee().then(g),s)}}var Pe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),v(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ce()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function Fe(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=>{xe(e,()=>t.signal,()=>n=!0)},u=ye(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?_e:ge;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Le:Ie,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:Ie(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ie(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 Le(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Re=class extends Pe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ve(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ve(this.options);e.data!==void 0&&(this.setState(Be(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ve||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>y(e.options.staleTime,this)===`static`)}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:!se(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.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.#s=!0,n.signal)})},i=()=>{let e=ye(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!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.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Fe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Ne({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Me&&e.revert&&this.setState({...this.#n,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 o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=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,...ze(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Be(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=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=t(this.state),Oe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ze(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:je(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Be(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ve(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`}}var He=class extends we{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),We(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ge(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ge(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof y(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ke(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return C(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#h(e){return!Ce()&&y(this.options.enabled,this.#t)!==!1&&v(e)}#g(){this.#b();let e=y(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=se(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return y(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||Te.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&We(e,t),o=i&&Ke(e,n,t,r);(a||o)&&(l={...l,...ze(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=T(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:qe(e,t),refetch:this.refetch,isEnabled:y(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),C(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Oe.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ue(e,t){return y(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||y(t.retryOnMount,e)!==!1)}function We(e,t){return Ue(e,t)||e.state.data!==void 0&&Ge(e,t,t.refetchOnMount)}function Ge(e,t,n){if(y(t.enabled,e)!==!1&&y(t.staleTime,e)!==`static`){let r=y(n,e);return r===`always`||r!==!1&&qe(e,t)}return!1}function Ke(e,t,n,r){return(e!==t||y(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&qe(e,n)}function qe(e,t){return y(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function Je(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Ye=class extends we{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Oe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!C(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Je(e,n).forEach(e=>{e.destroy()}),Je(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=S(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new He(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Oe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Xe=m.createContext(!1),Ze=()=>m.useContext(Xe);Xe.Provider;function Qe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $e=m.createContext(Qe()),et=()=>m.useContext($e),tt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},nt=e=>{m.useEffect(()=>{e.clearReset()},[e])},rt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||be(n,[e.error,r])),it=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},at=(e,t)=>e?.suspense&&t.isPending,ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function st({queries:e,...t},n){let r=g(n),i=Ze(),a=et(),o=t.subscribed!==!1,s=m.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{it(e);let t=r.getQueryCache().get(e.queryHash);tt(e,a,t)}),nt(a);let[c]=m.useState(()=>new Ye(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;m.useSyncExternalStore(m.useCallback(e=>f?c.subscribe(Oe.batchCalls(e)):ae,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>at(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&at(n,e)?ot(n,new He(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let h=l.find((e,t)=>{let n=s[t];return n&&rt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function ct(e,t,n){let r=Ze(),i=et(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,it(o),tt(o,i,s),nt(i);let[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(m.useSyncExternalStore(m.useCallback(e=>{let t=d?l.subscribe(Oe.batchCalls(e)):ae;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),at(o,u))throw ot(o,l,i);if(rt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function E(e,t){return ct(e,He,t)}function lt(e){return e[e.length-1]}function ut(e,t){return typeof e==`function`?e(t):e}var dt=Object.prototype.hasOwnProperty;function ft(e){for(let t in e)if(dt.call(e,t))return!0;return!1}var pt=()=>Object.create(null),mt=(e,t)=>ht(e,t,!0);function ht(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(gt(e)&&gt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&lt(a)!==`${o-1}`||c&&lt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?ht(d,o,n,r):o,i&&=u===d&&(a[l]===f||dt.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?pt():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function gt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function _t(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!_t(a,o,n,r))return!1}return!0}if(gt(e)&&gt(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!_t(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!_t(e[a],t[a],n,r)))return!1;return i===0}return!1}function vt(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var yt=/[\x00-\x1f\x7f"<>`{}]/g;function bt(e){return e.replace(yt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function xt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return bt(t)}var St=[`http:`,`https:`,`mailto:`,`tel:`];function Ct(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var wt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Tt(e,t){if(!e)return!1;if(wt.test(e))return!0;let n=Ct(e);return n?!t.has(n):!1}function Et(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=xt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=xt(r?e.slice(r):e)}return t}function Dt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ot(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function kt(e){return e.replace(/\/{2,}/g,`/`)}function At(e){return e===`/`?e:e.replace(/^\/+/,``)}function jt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Mt(e){return jt(At(e))}function Nt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Pt(e,t,n=`never`,r){if(t.includes(`//`)&&(t=kt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=kt(e)),o=e.split(`/`);o.length>1&&lt(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(lt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?kt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Ft(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function It(e){return e==null||e===``}function Lt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Rt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&It(f)){if(c===`/`&&!d)continue;f=``}o+=c+Lt(s,f,r)+(d||``)}}return o+a||`/`}var zt=`Error preloading route! ☝️`,Bt=()=>!0,Vt=()=>!1;function Ht({children:e,fallback:t=null}){return(0,h.jsx)(m.Fragment,{children:Ut()?e:t})}function Ut(e=!0){return m.useSyncExternalStore(Wt,Bt,e?Vt:Bt)}function Wt(){return()=>{}}var Gt=m.createContext(null);function Kt(e){return m.useContext(Gt)}var qt=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Jt=o(((e,t)=>{t.exports=qt()})),Yt=o((e=>{var t=d(),n=Jt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Xt=o(((e,t)=>{t.exports=Yt()}))();function Zt(e,t){return e===t}function Qt(e,t=e=>e,n){let r=n?.compare??Zt,i=(0,m.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,m.useCallback)(()=>e.get(),[e]);return(0,Xt.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function $t(...e){let t=m.useRef(e),n=t.current;return e.forEach((e,t)=>{_t(n[t],e,!1,!0)||(n[t]=e)}),t.current}function en(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(zt)})}var tn={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function nn(e,t){let n=typeof e==`string`&&Ct(e);if(n)return t.has(n)?e:null}function rn(e,t,n,r,i){let a=Nt(e.pathname,r),o=Nt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!_t(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function an(e,t,n){let r=Kt(),i=m.useRef(null),a=m.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:h,ignoreBlocker:ee,disabled:g,target:te,onClick:ne,onBlur:_,onFocus:re,onMouseEnter:ie,onMouseLeave:ae,onTouchStart:oe}=e,v=Ut(!!o?.includeHash),[se,y,ce]=$t(e.search,e.params,o),[b,le]=m.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,se,y,e.state,e.mask,e.unsafeRelative]),ue=m.useCallback(e=>{let t=nn(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];b._fromLocation||(le._fromLocation=e);let n=r.buildLocation(le),i=mn(n,r,g);return[i,!g&&(!i||Ct(i))?void 0:rn(e,n,ce,r.basepath,v)]},[ce,g,v,b,le,r,s]),[x,de]=Qt(r.stores.location,ue,tn),S=de===void 0?x:void 0,C=g||x===void 0,fe=m.useRef(!1),w=e.reloadDocument||S||C?!1:c??r.options.defaultPreload,pe=l??r.options.defaultPreloadDelay??0,me=m.useCallback(e=>{let t=e?.isIntersecting;if(!(t??w===`intent`)){t===!1&&fn(i);return}if(!pe){en(r,b);return}dn.has(i)||dn.set(i,setTimeout(()=>{dn.delete(i),en(r,b)},pe))},[r,b,i,w,pe]);m.useEffect(()=>{if(!w)return;w===`render`&&!fe.current&&(fe.current=!0,en(r,b));let e=!0,t;return w===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&me(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),fn(i)}},[r,b,w,me,i]);let T=ln(e,n);if(T.ref=t?a:i,S)return T.href=S,T;let he=e=>{let t=te??e.currentTarget.getAttribute(`target`);!C&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...b,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:h,ignoreBlocker:ee}))},ge=()=>{w===`intent`&&en(r,b)},_e=()=>{w===`intent`&&fn(i)};return T.onClick=pn(ne,he),T.onBlur=pn(_,_e),T.onFocus=pn(re,me),T.onMouseEnter=pn(ie,me),T.onMouseLeave=pn(ae,_e),T.onTouchStart=pn(oe,ge),un(T,e,de,x,C,n)}var on={},sn={className:`active`},cn=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function ln(e,t){let n={};for(let r in e)cn.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function un(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=ut(n?o:s,{})??(n?sn:on);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var dn=new WeakMap,fn=e=>{clearTimeout(dn.get(e)),dn.delete(e)},pn=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function mn(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!Tt(i,t.protocolAllowlist))return i}var hn=m.memo(m.forwardRef((e,t)=>{let n=e._asChild||`a`,r=an(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return m.createElement(n,r,i)}),gn);function gn(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!cn.has(r)||!_t(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}function _n(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function vn(e,t=`|`){return e.map(e=>Hn(e)).join(t)}function yn(e,t){return typeof t==`bigint`?t.toString():t}var bn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function xn(e){return new bn(e)}function Sn(e){return e==null}function Cn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function wn(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Tn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function En(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Dn(e){return En(e._zod.def)??e._zod.def.shape}function On(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Tn(this,t,e),e},enumerable:!0,configurable:!0})}function kn(e,t,n){t in e?Tn(e,t,n):e[t]=n}function An(e,t,n,r){let i=Dn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?On(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):kn(e,a,r?r(n.value,a):n.value))}}function jn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?On(e,n,()=>t[n]):kn(e,n,r.value))}}function D(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Mn(e){return JSON.stringify(e)}function Nn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Pn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Fn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var In=xn(()=>{if(Ar.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ln(e){if(Fn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Fn(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Rn(e){return Ln(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zn=new Set([`string`,`number`,`symbol`]);function Bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Hn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Un(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Wn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Kn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return An(i,e,qn(e,t)),Vn(e,D(n,{shape:i,checks:[]}))}function qn(e,t){let n=Dn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Jn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(qn(e,t)),a={};return An(a,e,Reflect.ownKeys(Dn(e)).filter(e=>!i.has(e))),Vn(e,D(n,{shape:a,checks:[]}))}function Yn(e,t){if(!Ln(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Dn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vn(e,D(e._zod.def,{shape:Xn(e,t)}))}function Xn(e,t){let n={};return An(n,e,Reflect.ownKeys(Dn(e))),jn(n,t),n}function Zn(e,t){if(!Ln(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vn(e,D(e._zod.def,{shape:Xn(e,t)}))}function Qn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return An(n,e,Reflect.ownKeys(Dn(e))),An(n,t,Reflect.ownKeys(Dn(t))),Vn(e,D(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $n(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(qn(t,n)):void 0,o={};return An(o,t,Reflect.ownKeys(Dn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Vn(t,D(t._zod.def,{shape:o,checks:[]}))}function er(e,t,n){let r=n?new Set(qn(t,n)):void 0,i={};return An(i,t,Reflect.ownKeys(Dn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Vn(t,D(t._zod.def,{shape:i}))}function tr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ir(e){return typeof e==`string`?e:e?.message}function ar(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function or(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ir(e.inst?._zod.def?.error?.(e))??ir(a?.(e))??ir(t?.error?.(e))??ir(n.customError?.(e))??ir(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var sr=/[\uD800-\uDBFF]/;function cr(e){let t=e.length;if(!sr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function lr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ur(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function dr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function fr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):gr(e,n,r.value)}}function pr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function mr(e,t,n){return pr(e,t,n,!1)}function hr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return pr(this,n,r(this))},set(e){pr(this,n,e)}})}return t}function gr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:pr(this,t,n.bind(this))},set(e){pr(this,t,e)}})}function _r(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var vr,yr=!1,br={configurable:!0,get(){yr=!0}};function k(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&vr!==e._zod){vr=void 0;return}vr=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,br);let e=yr;yr=!1;try{let r=n(this);return yr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),yr||=e,r}catch(n){throw delete this[t],yr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function xr(e,t,n,r){let i=_r(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Sr=`~constantCatch`;function Cr(e){let t=()=>e;return t[Sr]=!0,t}var wr,Tr={value:void 0,enumerable:!1},Er=`captureStackTrace`in Error?Error:null;function Dr(e){let t=Er;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Er=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function A(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Tr.value=new a(r);try{Object.defineProperty(n,"_zod",Tr)}finally{Tr.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),fr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Dr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Or=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wr=globalThis).__zod_globalConfig??(wr.__zod_globalConfig={});var Ar=globalThis.__zod_globalConfig;function jr(e){return e&&Object.assign(Ar,e),Ar}function Mr(){let e=this._zod;return e.message??=JSON.stringify(e.def,yn,2),e.message}function Nr(e){this._zod.message=e}var Pr={get:Mr,set:Nr,enumerable:!0,configurable:!0},Fr={value:void 0,enumerable:!1},Ir=new WeakSet([Object.prototype,Error.prototype]),Lr=(e,t)=>{e.name=`$ZodError`,Fr.value=t,Object.defineProperty(e,"issues",Fr),Fr.value=void 0,Object.defineProperty(e,"message",Pr);let n=Object.getPrototypeOf(e);Ir.has(n)||(Ir.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Rr=A(`$ZodError`,Lr);A(`$ZodError`,Lr,void 0,{Parent:Error});function zr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Br(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?zr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Vr(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Hr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ur=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Or;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>or(e,o,jr())));throw Pn(n,a?.callee??t),n}return s.value};return t},Wr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>or(e,o,jr())));throw Pn(n,a?.callee??t),n}return s.value};return t},Gr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Or;return a.issues.length?Kr(e,a.issues,i):{success:!0,data:a.value}};function Kr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>or(e,n,jr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var qr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Kr(e,a.issues,i):{success:!0,data:a.value}},Jr=Symbol.for(`zod.compile.invalid`),Yr=Symbol.for(`zod.compile.fallback`),Xr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Jr)return!0;if(r.definite===!0&&n===void 0)return!1}return Zr(e,t,n)});function Zr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Yr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Or;return a.issues.length===0}var Qr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},$r=e=>{let t=Ur(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Hr(n,a))};return n},ei=e=>{let t=Ur(e),n=(e,r,i,a)=>t(e,r,i,Hr(n,a));return n},ti=e=>{let t=Wr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Hr(n,a))};return n},ni=e=>{let t=Wr(e),n=async(e,r,i,a)=>await t(e,r,i,Hr(n,a));return n},ri=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gr(e)(t,n,i)},ii=e=>(t,n,r)=>Gr(e)(t,n,r),ai=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qr(e)(t,n,i)},oi=e=>async(t,n,r)=>qr(e)(t,n,r),si=/^[cC][0-9a-z]{6,}$/,ci=/^[0-9a-z]+$/,li=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ui=/^[0-9a-vA-V]{20}$/,di=/^[A-Za-z0-9]{27}$/,fi=/^[a-zA-Z0-9_-]{21}$/;function pi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var mi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_i=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vi=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function yi(){return new RegExp(vi,`u`)}var bi=/^(?:(?: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])$/,xi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Si=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ci=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ti=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ei=/^https?$/,Di=/^\+[1-9]\d{6,14}$/,Oi=`(?:(?:\\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])))`;function ki(e){return RegExp(`^${e}$`)}var Ai=ki(Oi);function ji(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Mi(e){return RegExp(`^${ji(e)}$`)}function Ni(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ji({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ji({precision:e.precision})}`:n;return RegExp(`^${Oi}T(?:${r})$`)}var Pi=/^[\s\S]{0,}$/,Fi=/^-?\d+$/,Ii=/^-?\d+(?:\.\d+)?$/,Li=/^(?:true|false)$/i,Ri=/^[^A-Z]*$/,zi=/^[^a-z]*$/,j=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Bi=e=>{let t=e.value;return!Sn(t)&&t.length!==void 0},Vi={number:`number`,bigint:`bigint`,object:`date`},Hi=A(`$ZodCheckLessThan`,(e,t)=>{j.init(e,t);let n=Vi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Vi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=A(`$ZodCheckGreaterThan`,(e,t)=>{j.init(e,t);let n=Vi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Vi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wi=A(`$ZodCheckMultipleOf`,(e,t)=>{j.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gi=A(`$ZodCheckNumberFormat`,(e,t)=>{j.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Wn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ki=A(`$ZodCheckMaxLength`,(e,t)=>{var n;j.init(e,t),(n=e._zod.def).when??(n.when=Bi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?cr(r):i)<=t.maximum)return;let a=lr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qi=A(`$ZodCheckMinLength`,(e,t)=>{var n;j.init(e,t),(n=e._zod.def).when??(n.when=Bi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?cr(r):i)>=t.minimum)return;let a=lr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ji=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;j.init(e,t),(n=e._zod.def).when??(n.when=Bi),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?cr(r):i;if(a===t.length)return;let o=lr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yi=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;j.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xi=A(`$ZodCheckRegex`,(e,t)=>{Yi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zi=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ri,Yi.init(e,t)}),Qi=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=zi,Yi.init(e,t)}),$i=A(`$ZodCheckIncludes`,(e,t)=>{j.init(e,t);let n=Bn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ea=A(`$ZodCheckStartsWith`,(e,t)=>{j.init(e,t);let n=RegExp(`^${Bn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ta=A(`$ZodCheckEndsWith`,(e,t)=>{j.init(e,t);let n=RegExp(`.*${Bn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),na=A(`$ZodCheckOverwrite`,(e,t)=>{j.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ra=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},ia={major:4,minor:6,patch:5},M=A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ia;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tr(t),a;for(let o of n){if(o._zod.def.when){if(nr(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Or;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(ar(t.issues,n,e),i||=tr(t,n))});else{if(t.issues.length===n)continue;ar(t.issues,n,e),i||=tr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Or;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Or;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return mr(this,`~standard`,sa(this))},set"~standard"(e){pr(this,`~standard`,e)}}),aa=(e,t)=>e.issues.length?{issues:e.issues.map(e=>or(e,t,jr()))}:{value:e.value};async function oa(e,t){let n={async:!0};return aa(await e._zod.run({value:t,issues:[]},n),n)}function sa(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return aa(r,n)}catch{}return oa(e,t)},vendor:`zod`,version:1}}var ca=A(`$ZodString`,(e,t)=>{M.init(e,t),e._zod.pattern=t.pattern??Pi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),N=A(`$ZodStringFormat`,(e,t)=>{Yi.init(e,t),ca.init(e,t)}),la=A(`$ZodGUID`,(e,t)=>{t.pattern??=hi,N.init(e,t)}),ua=A(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=gi(e)}else t.pattern??=gi();N.init(e,t)}),da=A(`$ZodEmail`,(e,t)=>{t.pattern??=_i,N.init(e,t)});function fa(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function pa(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?fa(e)||2:ma(e,t)}function ma(e,t){if(!t.normalize&&t.protocol?.source===Ei.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var ha=/[\t\n\r]/g;function ga(e){return e.replace(ha,``)}function _a(e,t){return t.lastIndex=0,t.test(e.hostname)}function va(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ya=A(`$ZodURL`,(e,t)=>{N.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=pa(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ga(r);return}t.hostname&&!_a(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!va(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ga(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ba=A(`$ZodEmoji`,(e,t)=>{t.pattern??=yi(),N.init(e,t)}),xa=A(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?fi:pi(t.length),N.init(e,t)}),Sa=A(`$ZodCUID`,(e,t)=>{t.pattern??=si,N.init(e,t)}),Ca=A(`$ZodCUID2`,(e,t)=>{t.pattern??=ci,N.init(e,t)}),wa=A(`$ZodULID`,(e,t)=>{t.pattern??=li,N.init(e,t)}),Ta=A(`$ZodXID`,(e,t)=>{t.pattern??=ui,N.init(e,t)}),Ea=A(`$ZodKSUID`,(e,t)=>{t.pattern??=di,N.init(e,t)}),Da=A(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ni(t),N.init(e,t)}),Oa=A(`$ZodISODate`,(e,t)=>{t.pattern??=Ai,N.init(e,t)}),ka=A(`$ZodISOTime`,(e,t)=>{t.pattern??=Mi(t),N.init(e,t)}),Aa=A(`$ZodISODuration`,(e,t)=>{t.pattern??=mi,N.init(e,t)}),ja=A(`$ZodIPv4`,(e,t)=>{t.pattern??=bi,N.init(e,t)}),Ma=/^[0-9a-fA-F:.]+$/;function Na(e){return Ma.test(e)?fa(`http://[${e}]`):!1}var Pa=A(`$ZodIPv6`,(e,t)=>{t.pattern??=xi,N.init(e,t),e._zod.check=n=>{Na(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Fa=A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Si,N.init(e,t)});function Ia(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Na(n)}var La=A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ci,N.init(e,t),e._zod.check=n=>{Ia(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Ra(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var za=/^[0-9a-zA-Z+/]*={0,2}$/,Ba=A(`$ZodBase64`,(e,t)=>{t.pattern??=za,N.init(e,t),e._zod.check=n=>{Ra(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Va=/^[A-Za-z0-9_-]*$/;function Ha(e){if(!Va.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ra(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ua=A(`$ZodBase64URL`,(e,t)=>{t.pattern??=Va,N.init(e,t),e._zod.check=n=>{Ha(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Wa=A(`$ZodE164`,(e,t)=>{t.pattern??=Di,N.init(e,t)});function Ga(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ka=A(`$ZodJWT`,(e,t)=>{N.init(e,t),e._zod.check=n=>{Ga(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),qa=A(`$ZodNumber`,(e,t)=>{M.init(e,t),e._zod.pattern=Ii,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ja=A(`$ZodNumberFormat`,(e,t)=>{Gi.init(e,t),qa.init(e,t)}),Ya=A(`$ZodBoolean`,(e,t)=>{M.init(e,t),e._zod.pattern=Li,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Xa=A(`$ZodUnknown`,(e,t)=>{M.init(e,t),e._zod.parse=e=>e}),Za=A(`$ZodNever`,(e,t)=>{M.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Qa(e,t,n){e.issues.length&&t.issues.push(...rr(n,e.issues)),t.value[n]=e.value}var $a=A(`$ZodArray`,(e,t)=>{M.init(e,t);let n=Ar.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Qa(t,r,e)));else if(Qa(c,r,e),s&&c.issues.length!==0&&tr(c))break}return o.length?Promise.all(o).then(()=>r):r}});function eo(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...rr(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var to=[];function no(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:to,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Un(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ro(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(tr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>eo(e,n,i,t,d,f))):eo(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var io=A(`$ZodObject`,(e,t)=>{M.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=xn(()=>no(t));k(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Tn(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Fn,o=t.catchall,s,c=Ar.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(tr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>eo(n,t,e,r,a,o))):eo(s,t,e,r,a,o)}return o?ro(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),ao=A(`$ZodObjectJIT`,(e,t)=>{io.init(e,t);let n=e._zod.parse,r=xn(()=>no(t)),i=Ar.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new ra([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Mn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${i};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${i}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${i};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Fn,c=!Ar.jitless,l=c&&In.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ro([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function oo(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!tr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>or(e,r,jr())))}),t)}var so=A(`$ZodUnion`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),k(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),k(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Cn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>oo(t,r,e,i)):oo(o,r,e,i)}});function co(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var lo=A(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,so.init(e,t);let n=e._zod.parse;k(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Tn(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=En(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=xn(()=>co(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Fn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),uo=A(`$ZodIntersection`,(e,t)=>{M.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>po(e,t,n)):po(e,i,a)}});function fo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ln(e)&&Ln(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=fo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function po(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=fo(t.value,n.value);if(!c.valid){if(tr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var mo=A(`$ZodRecord`,(e,t)=>{M.init(e,t);let n=Ar.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Ln(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>or(e,i,jr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...rr(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...rr(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ii.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>or(e,i,jr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...rr(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...rr(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ho=A(`$ZodEnum`,(e,t)=>{M.init(e,t);let n=_n(t.entries),r=new Set(n);e._zod.values=r,k(e,`pattern`,e=>{let t=_n(e.def.entries).filter(e=>zn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Bn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),go=A(`$ZodLiteral`,(e,t)=>{M.init(e,t);let n=new Set(t.values);e._zod.values=n,k(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Bn(e):e?Bn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),_o=A(`$ZodTransform`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,Ar.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Or;return n.value=i,n}});function vo(e,t){return e.value=t.issues.length?void 0:t.value,e}var yo=A(`$ZodOptional`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Cn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>vo(e,t)):vo(e,r)}return t.innerType._zod.run(e,n)}}),bo=A(`$ZodExactOptional`,(e,t)=>{yo.init(e,t),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),xo=A(`$ZodNullable`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Cn(t.source)}|null)$`):void 0}),k(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),So=A(`$ZodDefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Co(e,t)):Co(r,t)}});function Co(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wo=A(`$ZodPrefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),To=A(`$ZodNonOptional`,(e,t)=>{M.init(e,t),k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Eo(t,e)):Eo(i,e)}});function Eo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Do(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>or(e,r,jr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Oo=A(`$ZodCatch`,(e,t)=>{M.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Do(e,r,t,n)):Do(e,r,t,n)}}),ko=A(`$ZodPipe`,(e,t)=>{M.init(e,t),k(e,`values`,e=>e.def.in._zod.values),k(e,`optin`,e=>e.def.in._zod.optin),k(e,`optout`,e=>e.def.out._zod.optout),k(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ao(e,t.in,n)):Ao(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ao(e,t.out,n)):Ao(r,t.out,n)}});function Ao(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var jo=A(`$ZodPreprocess`,(e,t)=>{ko.init(e,t)}),Mo=A(`$ZodReadonly`,(e,t)=>{M.init(e,t),k(e,`propValues`,e=>e.def.innerType._zod.propValues),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`optin`,e=>e.def.innerType?._zod?.optin),k(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(No):No(r)}});function No(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Po=A(`$ZodCustom`,(e,t)=>{j.init(e,t),M.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fo(t,n,r,e));Fo(i,n,r,e)}});function Fo(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(dr(e))}}var Io=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Lo=`~memo`,Ro=[];function zo(e){return typeof e==`object`&&!!e}function Bo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Vo=new WeakMap,Ho=0,Uo=1,Wo=2;function Go(e,t,n){let r=Vo.get(e);if(r!==void 0)return r?Wo:Ho;if(t.has(e))return Wo;t.add(e);let i=Ho,a=e=>{if(i!==Wo&&e?._zod){let r=Go(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ho;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Uo:o.value?._zod?Go(o.value,t,n):Ho;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=En(c);s(e?o(e,!0):Uo),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Go(r,t,!1):Uo);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ko(e,i)}function Ko(e,t){return t!==Uo&&Vo.set(e,t===Wo),t}function qo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Jo,Yo=[],Xo={alloc(e,t,n){let r=Jo;if(!r)return n;Jo=void 0;let i={value:n,issues:null};return r.set(t.value,i),Yo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Qo(n,e.value))throw new Io;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Go(e,new Set,!1);if(i===Ho)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Wo||r?n=!0:r=!0}let l=s.value;if(!zo(l))return t(s,c);let u=c[Lo];u||(u={buckets:new WeakMap,backEdges:void 0},c[Lo]=u);let d;i===c?d=a:(d=qo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Bo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Jo=d;let p=Yo.length,m=t(s,c);Jo=void 0;let h=Yo.length>p?Yo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Bo(e.issues):Ro),e)):(h&&(h.issues=m.issues.length?Bo(m.issues):Ro),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Zo(){return Xo}function Qo(e,t){let n=e[Lo]?.backEdges;return n!==void 0&&zo(t)&&n.has(t)}var $o=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(ur(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Hn(e.values[0])}`:`Invalid option: expected one of ${vn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${vn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function es(){return{localeError:$o()}}var ts,ns=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function rs(){return new ns}(ts=globalThis).__zod_globalRegistry??(ts.__zod_globalRegistry=rs());var is=globalThis.__zod_globalRegistry;function as(e){return e.checks&&=[...e.checks],e}function os(e,t){return new e(as({type:`string`,...O(t)}))}function ss(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}function cs(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}function ls(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}function us(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}function ds(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}function fs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}function ps(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}function ms(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}function hs(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}function gs(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}function _s(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}function vs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}function ys(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}function bs(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}function xs(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}function Ss(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}function Cs(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}function ws(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}function Ts(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}function Es(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}function Ds(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}function Os(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}function ks(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}function As(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}function js(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}function Ms(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}function Ns(e,t){return new e(as({type:`number`,checks:[],...O(t)}))}function Ps(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}function Fs(e,t){return new e({type:`boolean`,...O(t)})}function Is(e){return new e({type:`unknown`})}function Ls(e,t){return new e({type:`never`,...O(t)})}function Rs(e,t){return new Hi({check:`less_than`,...O(t),value:e,inclusive:!1})}function zs(e,t){return new Hi({check:`less_than`,...O(t),value:e,inclusive:!0})}function Bs(e,t){return new Ui({check:`greater_than`,...O(t),value:e,inclusive:!1})}function Vs(e,t){return new Ui({check:`greater_than`,...O(t),value:e,inclusive:!0})}function Hs(e,t){return new Wi({check:`multiple_of`,...O(t),value:e})}function Us(e,t){return new Ki({check:`max_length`,...O(t),maximum:e})}function Ws(e,t){return new qi({check:`min_length`,...O(t),minimum:e})}function Gs(e,t){return new Ji({check:`length_equals`,...O(t),length:e})}function Ks(e,t){return new Xi({check:`string_format`,format:`regex`,...O(t),pattern:e})}function qs(e){return new Zi({check:`string_format`,format:`lowercase`,...O(e)})}function Js(e){return new Qi({check:`string_format`,format:`uppercase`,...O(e)})}function Ys(e,t){return new $i({check:`string_format`,format:`includes`,...O(t),includes:e})}function Xs(e,t){return new ea({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}function Zs(e,t){return new ta({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}function Qs(e){return new na({check:`overwrite`,tx:e})}function $s(e){return Qs(t=>t.normalize(e))}function ec(){return Qs(e=>e.trim())}function tc(){return Qs(e=>e.toLowerCase())}function nc(){return Qs(e=>e.toUpperCase())}function rc(){return Qs(e=>Nn(e))}function ic(e,t,n){return new e({type:`array`,element:t,...O(n)})}function ac(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}function oc(e,t){let n=sc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(dr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(dr(r))}},e(t.value,t)),t);return n}function sc(e,t){let n=new j({check:`custom`,...O(t)});return n._zod.check=e,n}function cc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Tn(e,t,n[t]);return e}function lc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??is,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function uc(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function P(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,P(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&cc(o.schema,c),t.io===`input`&&F(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function dc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function fc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${dc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+dc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function pc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;pc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var mc=new Set([`type`,`properties`,`required`,`additionalProperties`]),hc=[`oneOf`,`anyOf`];function gc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function _c(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!mc.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??gc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Tn(n,r,e.length===1?e[0]:_c(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=gc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function vc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of mc)if(t in e)return;let n=t.filter(e=>hc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=_c(t);else{let e=n[0],i=hc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>_c([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,cc(e,r))}function yc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):cc(i,s),cc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())pc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])vc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}cc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Tn(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:xc(t,`input`,e.processors),output:xc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function F(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return F(r.element,n);if(r.type===`set`)return F(r.valueType,n);if(r.type===`lazy`)return F(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return F(r.innerType,n);if(r.type===`intersection`)return F(r.left,n)||F(r.right,n);if(r.type===`record`||r.type===`map`)return F(r.keyType,n)||F(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:F(r.in,n)||F(r.out,n);if(r.type===`object`){for(let e in r.shape)if(F(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(F(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(F(e,n))return!0;return!!(r.rest&&F(r.rest,n))}return!1}var bc=(e,t={})=>n=>{let r=lc({...n,processors:t});return P(e,r),fc(r,e),yc(r,e)},xc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=lc({...i??{},target:a,io:t,processors:n});return P(e,o),fc(o,e),yc(o,e)},Sc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Cc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},wc=(e,t)=>{Sc(e,`minimum`,t),Cc(e,`maximum`,t)},Tc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Ec=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Dc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Oc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},kc=(e,t)=>Sc(e,`minimum`,t.minimum),Ac=(e,t)=>Cc(e,`maximum`,t.maximum),jc=e=>(t,n)=>{Oc(t,n.format);let[r,i]=e[n.format];Sc(t,`minimum`,r),Cc(t,`maximum`,i)},Mc={greater_than:(e,t)=>Sc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Cc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Tc(e,t.value),number_format:jc(Wn),bigint_format:jc(Gn),min_length:kc,max_length:Ac,length_equals:(e,t)=>wc(e,t.length),min_size:kc,max_size:Ac,size_equals:(e,t)=>wc(e,t.size),string_format:(e,t)=>{Oc(e,t.format),t.pattern&&Ec(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Dc(e,t.mime)};function I(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Mc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Sc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Sc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Cc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Cc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Tc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Dc(t,i.mime);for(let e of i.patterns??[])Ec(t,e);return t}var Nc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Pc=new Map([[za,wi],[Va,Ti]]),Fc=e=>Pc.get(e)??e,Ic=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=I(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Nc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Fc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Lc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=I(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):uc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Rc=(e,t,n,r)=>{n.type=`boolean`},zc=(e,t,n,r)=>{n.not={}},Bc=(e,t,n,r)=>{let i=e._zod.def,a=_n(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Vc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(uc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(uc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Hc=(e,t,n,r)=>{uc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Uc=(e,t,n,r)=>{uc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Wc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=I(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=P(a.element,t,{...r,path:[...r.path,`items`]})};function Gc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Gc(t.out):t.type===`catch`?Gc(t.innerType):e._zod.optin}var Kc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&uc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Tn(i.properties,e,P(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Gc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=P(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>P(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Jc=(e,t,n,r)=>{let i=e._zod.def,a=P(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=P(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Yc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Yc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Yc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Ii:Fi).source),p):p}var Xc=new WeakMap;function Zc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Xc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Yc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Qc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=I(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=P(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Tn(i.patternProperties,Fc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=P(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xc.get(t);n||(n=[],Xc.set(t,n),t.deferred.push(()=>Zc(t))),n.push(e)}i.additionalProperties=P(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Gc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},$c=(e,t,n,r)=>{let i=e._zod.def,a=P(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},el=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},tl=Symbol();function nl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(uc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),tl):JSON.parse(o)}var rl=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=nl(i.defaultValue,e,t,n,r);o!==tl&&(n.default=o)},il=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=nl(i.defaultValue,e,t,n,r);o!==tl&&(n._prefault=o)},al=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{uc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ol=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;P(o,t,r);let s=t.seen.get(e);s.ref=o},sl=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cl=(e,t,n,r)=>{let i=e._zod.def;P(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ll=new WeakSet([Object.prototype,Error.prototype]);function ul(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var L=A(`ZodError`,(e,t)=>{Rr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ll.has(n)||(ll.add(n),ul(n,`format`,e=>t=>Vr(e,t)),ul(n,`flatten`,e=>t=>Br(e,t)),ul(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yn,2)}),ul(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),dl=Ur(L),fl=Wr(L),pl=Gr(L),ml=qr(L),hl=$r(L),gl=ei(L),_l=ti(L),vl=ni(L),yl=ri(L),bl=ii(L),xl=ai(L),Sl=oi(L);function Cl(){Ar.localeError||jr(es())}function wl(){Ar.memoizer||jr({memoizer:Zo()})}var R=A(`ZodType`,(e,t)=>(Cl(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(D(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Vn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(zu(e,t))},superRefine(e,t){return this.check(Bu(e,t))},overwrite(e){return this.check(Qs(e))},optional(){return bu(this)},exactOptional(){return Su(this)},nullable(){return wu(this)},nullish(){return bu(wu(this))},nonoptional(e){return Au(this,e)},array(){return U(this)},or(e){return cu([this,e])},and(e){return fu(this,e)},transform(e){return Pu(this,vu(e))},default(e){return Eu(this,e)},prefault(e){return Ou(this,e)},catch(e){return Mu(this,e)},pipe(e){return Pu(this,e)},readonly(){return Lu(this)},describe(e){let t=this.clone();return is.add(t,{description:e}),t},meta(...e){if(e.length===0)return is.get(this);let t=this.clone();return is.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return mr(this,`~standard`,{...sa(this),jsonSchema:{input:xc(this,`input`),output:xc(this,`output`)}})},set"~standard"(e){pr(this,`~standard`,e)},parse:function e(t,n){return dl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await fl(this,t,n,{callee:e})},safeParse(e,t){return pl(this,e,t)},async safeParseAsync(e,t){return ml(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){pr(this,`spa`,e)},validate(e,t){return Xr(this,e,t)},validateAsync(e,t){return Qr(this,e,t)},encode:function e(t,n){return hl(this,t,n,{callee:e})},decode:function e(t,n){return gl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vl(this,t,n,{callee:e})},safeEncode(e,t){return yl(this,e,t)},safeDecode(e,t){return bl(this,e,t)},async safeEncodeAsync(e,t){return xl(this,e,t)},async safeDecodeAsync(e,t){return Sl(this,e,t)},toJSONSchema(e){return bc(this,{})(e)},get description(){return is.get(this)?.description},get _def(){return this._zod.def}}),Tl=A(`_ZodString`,(e,t)=>{ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r)},hr({format:e=>I(e).format??null,minLength:e=>I(e).minimum??null,maxLength:e=>I(e).maximum??null},{regex(...e){return this.check(Ks(...e))},includes(...e){return this.check(Ys(...e))},startsWith(...e){return this.check(Xs(...e))},endsWith(...e){return this.check(Zs(...e))},min(...e){return this.check(Ws(...e))},max(...e){return this.check(Us(...e))},length(...e){return this.check(Gs(...e))},nonempty(...e){return this.check(Ws(1,...e))},lowercase(e){return this.check(qs(e))},uppercase(e){return this.check(Js(e))},trim(){return this.check(ec())},normalize(...e){return this.check($s(...e))},toLowerCase(){return this.check(tc())},toUpperCase(){return this.check(nc())},slugify(){return this.check(rc())}})),El=A(`ZodString`,(e,t)=>{ca.init(e,t),Tl.init(e,t)},{email(e){return this.check(ss(jl,e))},url(e){return this.check(ps(Fl,e))},jwt(e){return this.check(Os(Xl,e))},emoji(e){return this.check(ms(Il,e))},guid(e){return this.check(cs(Ml,e))},uuid(e){return this.check(ls(Nl,e))},uuidv4(e){return this.check(us(Nl,e))},uuidv6(e){return this.check(ds(Nl,e))},uuidv7(e){return this.check(fs(Nl,e))},nanoid(e){return this.check(hs(Ll,e))},cuid(e){return this.check(gs(Rl,e))},cuid2(e){return this.check(_s(zl,e))},ulid(e){return this.check(vs(Bl,e))},base64(e){return this.check(Ts(ql,e))},base64url(e){return this.check(Es(Jl,e))},xid(e){return this.check(ys(Vl,e))},ksuid(e){return this.check(bs(Hl,e))},ipv4(e){return this.check(xs(Ul,e))},ipv6(e){return this.check(Ss(Wl,e))},cidrv4(e){return this.check(Cs(Gl,e))},cidrv6(e){return this.check(ws(Kl,e))},e164(e){return this.check(Ds(Yl,e))},datetime(e){return this.check(ks(Dl,e))},date(e){return this.check(As(Ol,e))},time(e){return this.check(js(kl,e))},duration(e){return this.check(Ms(Al,e))}});function z(e){return os(El,e)}var B=A(`ZodStringFormat`,(e,t)=>{N.init(e,t),Tl.init(e,t)}),Dl=A(`ZodISODateTime`,(e,t)=>{Da.init(e,t),B.init(e,t)}),Ol=A(`ZodISODate`,(e,t)=>{Oa.init(e,t),B.init(e,t)}),kl=A(`ZodISOTime`,(e,t)=>{ka.init(e,t),B.init(e,t)}),Al=A(`ZodISODuration`,(e,t)=>{Aa.init(e,t),B.init(e,t)}),jl=A(`ZodEmail`,(e,t)=>{da.init(e,t),B.init(e,t)}),Ml=A(`ZodGUID`,(e,t)=>{la.init(e,t),B.init(e,t)}),Nl=A(`ZodUUID`,(e,t)=>{ua.init(e,t),B.init(e,t)});function Pl(e){return ls(Nl,e)}var Fl=A(`ZodURL`,(e,t)=>{ya.init(e,t),B.init(e,t)}),Il=A(`ZodEmoji`,(e,t)=>{ba.init(e,t),B.init(e,t)}),Ll=A(`ZodNanoID`,(e,t)=>{xa.init(e,t),B.init(e,t)}),Rl=A(`ZodCUID`,(e,t)=>{Sa.init(e,t),B.init(e,t)}),zl=A(`ZodCUID2`,(e,t)=>{Ca.init(e,t),B.init(e,t)}),Bl=A(`ZodULID`,(e,t)=>{wa.init(e,t),B.init(e,t)}),Vl=A(`ZodXID`,(e,t)=>{Ta.init(e,t),B.init(e,t)}),Hl=A(`ZodKSUID`,(e,t)=>{Ea.init(e,t),B.init(e,t)}),Ul=A(`ZodIPv4`,(e,t)=>{ja.init(e,t),B.init(e,t)}),Wl=A(`ZodIPv6`,(e,t)=>{Pa.init(e,t),B.init(e,t)}),Gl=A(`ZodCIDRv4`,(e,t)=>{Fa.init(e,t),B.init(e,t)}),Kl=A(`ZodCIDRv6`,(e,t)=>{La.init(e,t),B.init(e,t)}),ql=A(`ZodBase64`,(e,t)=>{Ba.init(e,t),B.init(e,t)}),Jl=A(`ZodBase64URL`,(e,t)=>{Ua.init(e,t),B.init(e,t)}),Yl=A(`ZodE164`,(e,t)=>{Wa.init(e,t),B.init(e,t)}),Xl=A(`ZodJWT`,(e,t)=>{Ka.init(e,t),B.init(e,t)}),Zl=A(`ZodNumber`,(e,t)=>{qa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.isFinite=!0},hr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=I(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=I(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=I(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>I(e).format??null},{gt(e,t){return this.check(Bs(e,t))},gte(e,t){return this.check(Vs(e,t))},min(e,t){return this.check(Vs(e,t))},lt(e,t){return this.check(Rs(e,t))},lte(e,t){return this.check(zs(e,t))},max(e,t){return this.check(zs(e,t))},int(e){return this.check($l(e))},safe(e){return this.check($l(e))},positive(e){return this.check(Bs(0,e))},nonnegative(e){return this.check(Vs(0,e))},negative(e){return this.check(Rs(0,e))},nonpositive(e){return this.check(zs(0,e))},multipleOf(e,t){return this.check(Hs(e,t))},step(e,t){return this.check(Hs(e,t))},finite(){return this}}));function V(e){return Ns(Zl,e)}var Ql=A(`ZodNumberFormat`,(e,t)=>{Ja.init(e,t),Zl.init(e,t)});function $l(e){return Ps(Ql,e)}var eu=A(`ZodBoolean`,(e,t)=>{Ya.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r)});function H(e){return Fs(eu,e)}var tu=A(`ZodUnknown`,(e,t)=>{Xa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function nu(){return Is(tu)}var ru=A(`ZodNever`,(e,t)=>{Za.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r)});function iu(e){return Ls(ru,e)}var au=A(`ZodArray`,(e,t)=>{wl(),$a.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ws(e,t))},nonempty(e){return this.check(Ws(1,e))},max(e,t){return this.check(Us(e,t))},length(e,t){return this.check(Gs(e,t))},unwrap(){return this.element}});function U(e,t){return ic(au,e,t)}var ou=A(`ZodObject`,(e,t)=>{wl(),ao.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),xr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return G(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(D(this._zod.def,{catchall:e}))},passthrough(){return this.clone(D(this._zod.def,{catchall:nu()}))},loose(){return this.clone(D(this._zod.def,{catchall:nu()}))},strict(){return this.clone(D(this._zod.def,{catchall:iu()}))},strip(){return this.clone(D(this._zod.def,{catchall:void 0}))},extend(e){return Yn(this,e)},safeExtend(e){return Zn(this,e)},merge(e){return Qn(this,e)},pick(e){return Kn(this,e)},omit(e){return Jn(this,e)},partial(...e){return $n(yu,this,e[0])},exactPartial(...e){return $n(xu,this,e[0],`exactPartial`)},required(...e){return er(ku,this,e[0])}});function W(e,t){return new ou({type:`object`,shape:e??{},...O(t)})}var su=A(`ZodUnion`,(e,t)=>{so.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.options=t.options});function cu(e,t){return new su({type:`union`,options:e,...O(t)})}var lu=A(`ZodDiscriminatedUnion`,(e,t)=>{su.init(e,t),lo.init(e,t)});function uu(e,t,n){return new lu({type:`union`,options:t,discriminator:e,...O(n)})}var du=A(`ZodIntersection`,(e,t)=>{uo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r)});function fu(e,t){return new du({type:`intersection`,left:e,right:t})}var pu=A(`ZodRecord`,(e,t)=>{wl(),mo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function mu(e,t,n){return!t||!t._zod?new pu({type:`record`,keyType:z(),valueType:e,...O(t)}):new pu({type:`record`,keyType:e,valueType:t,...O(n)})}var hu=A(`ZodEnum`,(e,t)=>{ho.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new hu({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new hu({...t,checks:[],...O(r),entries:i})}});function G(e,t){return new hu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}var gu=A(`ZodLiteral`,(e,t)=>{go.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new gu({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}var _u=A(`ZodTransform`,(e,t)=>{wl(),_o.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(dr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(dr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function vu(e){return new _u({type:`transform`,transform:e})}var yu=A(`ZodOptional`,(e,t)=>{yo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bu(e){return new yu({type:`optional`,innerType:e})}var xu=A(`ZodExactOptional`,(e,t)=>{bo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Su(e){return new xu({type:`optional`,innerType:e})}var Cu=A(`ZodNullable`,(e,t)=>{xo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wu(e){return new Cu({type:`nullable`,innerType:e})}var Tu=A(`ZodDefault`,(e,t)=>{So.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eu(e,t){return new Tu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rn(t)}})}var Du=A(`ZodPrefault`,(e,t)=>{wo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ou(e,t){return new Du({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rn(t)}})}var ku=A(`ZodNonOptional`,(e,t)=>{To.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Au(e,t){return new ku({type:`nonoptional`,innerType:e,...O(t)})}var ju=A(`ZodCatch`,(e,t)=>{Oo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mu(e,t){return new ju({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Cr(t)})}var Nu=A(`ZodPipe`,(e,t)=>{ko.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ol(e,t,n,r),e.in=t.in,e.out=t.out});function Pu(e,t){return new Nu({type:`pipe`,in:e,out:t})}var Fu=A(`ZodPreprocess`,(e,t)=>{Nu.init(e,t),jo.init(e,t)}),Iu=A(`ZodReadonly`,(e,t)=>{Mo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new Iu({type:`readonly`,innerType:e})}var Ru=A(`ZodCustom`,(e,t)=>{Po.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r)});function zu(e,t={}){return ac(Ru,e,t)}function Bu(e,t){return oc(e,t)}function Vu(e,t){return new Fu({type:`pipe`,in:vu(e),out:t})}function Hu(e){return ks(Dl,e)}var q=z().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),J=z().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),Y=z().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function Uu(e){let t=e.indexOf(`/`);return t===-1?{project:null,channel:e}:{project:e.slice(0,t),channel:e.slice(t+1)}}function Wu(e,t){return e===null?t:`${e}/${t}`}var X=Vu(e=>e instanceof Date?e.toISOString():e,Hu()),Gu=G([`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`approve`,`reject`,`create_project`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`,`configure_project`,`archive_project`]),Ku=G([`user_post`,`ops_event`,`heartbeat`]),qu=W({name:q,purpose:z().min(1),verbs:U(Gu),wakeTriggers:U(Ku).default([`heartbeat`]),reviewDate:z().optional(),maxReplicas:V().int().min(1).default(1),backlogThreshold:V().positive().default(3),resident:H().default(!1),societyScope:H().default(!1),reflects:H().default(!0)}),Ju=`user`,Yu=`user`,Xu=[`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`],Zu=[`approve`,`reject`],Qu=[`create_project`],$u=[`configure_project`],ed=[`archive_project`];[...Xu,...Zu,...Qu,...$u,...ed],[...Xu,...Zu,...$u],[...Xu,...Qu,...$u];var td=`asks`,nd=`society`;function rd(e,t){return t!==null&&e.memberships.includes(t)?t:nd}var Z=G([`claude`,`codex`]),id=W({name:z().min(1),version:K(1),createdAt:X,channels:U(q)}),ad=G([`none`,`merge`]),od=z().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),sd={name:z().trim().min(1).max(120),role:q.optional(),agent:q.optional(),gate:H().default(!1)};function cd(e){return e.role===void 0||e.agent===void 0}var ld={message:`a stage names a role or an agent, not both`},ud=W(sd).refine(cd,ld),dd=W({id:od.optional(),...sd}).refine(cd,ld),fd=W({slug:q,name:z().min(1),repo:z().nullable(),defaultBranch:z().min(1),channels:U(q),members:U(q),approvers:U(q),requiredCapabilities:U(z()),createdAt:X,onDone:ad.default(`none`),runner:q.optional(),archived:W({at:X,by:q,reason:z().min(1)}).optional()}),pd=cu([W({action:G([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:od,to:od.nullable()}),W({action:G([`approved`,`rejected`])})]);function md(e){return`stage`in e}var hd=W({id:J,author:q,channel:Y,thread:J.optional(),task:J.optional(),closes:J.optional(),step:pd.optional(),ts:X,mentions:U(q)}),gd=G([`open`,`claimed`,`done`,`abandoned`]),_d=G([`open`,`closed`]),vd=W({kind:G([`task`,`proposal`]),id:J}),yd=W({id:J,channel:Y,title:z().min(1).max(200),subject:vd.optional(),state:_d,openedBy:q,openedAt:X,closedBy:q.optional(),closedAt:X.optional()}),bd=W({id:od,name:z().min(1),role:q.optional(),agent:q.optional(),gate:H().default(!1),holders:U(q).default([]),completedBy:q.optional(),completedAt:X.optional()}),xd=W({from:od,by:q,at:X}),Sd=W({id:J,project:q,title:z().min(1),status:gd,createdBy:q,createdAt:X,updatedAt:X,claimedBy:q.optional(),leaseExpiresAt:X.optional(),parentId:J.optional(),blockedBy:U(J),requiredCapabilities:U(z()),stages:U(bd).min(1),stage:od,stageSince:X,stageSeq:V().int().positive(),onDone:ad.default(`none`),completing:H().default(!1),returned:xd.optional()});function Cd(e,t){return e.stages.findIndex(e=>e.id===t)}function wd(e){return e.stages.find(t=>t.id===e.stage)}var Td=W({id:z().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),name:z(),description:z().default(``),isDefault:H().default(!1)}),Ed=G([`active`,`retired`]),Dd=W({name:q,role:q,cli:Z.nullable(),model:z().optional(),homeRunner:q.optional(),memberships:U(q),subscriptions:U(Y),status:Ed,createdAt:X,tokenHash:z().min(1),retiredAt:X.optional(),retiredReason:z().optional()}),Od=W({name:q,role:q,cli:Z.nullable(),homeRunner:q.optional(),status:Ed,resident:H().default(!1),model:z().optional(),lastModel:z().optional(),skills:U(q).default([]),memberships:U(q),subscriptions:U(Y),claimsHeld:V().int().nonnegative().default(0),tasksDone:V().int().nonnegative().default(0),lastTurnAt:X.optional(),lastTurnOutcome:z().optional(),createdAt:X,retiredAt:X.optional()}),kd=G([`linux`,`windows`,`darwin`]),Ad=W({name:q,os:kd,clis:U(Z),capabilities:U(z()),status:G([`connected`,`disconnected`]),lastSeen:X.optional()}),jd=G([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),Md=G([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),Nd=W({name:q,role:q,cli:Z,model:z().optional(),homeRunner:q.optional(),memberships:U(q).default([]),subscriptions:U(Y).default([]),seedInstructions:z().optional()}),Pd=W({project:q.nullable().default(null),name:q,purpose:z().min(1)}),Fd=W({description:z().min(1)}),Id=W({agent:q,reason:z().min(1)}),Ld=W({project:q,reason:z().min(1)}),Rd=W({name:q,summary:z().min(1).max(200),body:z().min(1)}),zd={role:[Ju],member:[Ju],retirement:[Ju],archive:[Ju],channel:[Ju,`steward`],reallocation:[Ju,`steward`],skill:[Ju,`steward`]};function Bd(e,t){switch(e){case`member`:{let e=Nd.safeParse(t);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`member ${n} as ${r} on ${i}${a.length===0?``:` for ${a.join(`, `)}`}`}case`role`:{let e=qu.safeParse(t);if(!e.success)break;let{name:n,verbs:r,maxReplicas:i}=e.data;return`role ${n} (${r.length} verbs, up to ${i} per project)`}case`channel`:{let e=Pd.safeParse(t);if(!e.success)break;return`channel ${Wu(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=Id.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=Fd.safeParse(t);if(!e.success)break;return`reallocation: ${e.data.description}`}case`skill`:{let e=Rd.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=Ld.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var Vd=W({name:q,summary:z().default(``),scope:G([`own`,`society`]),path:z().min(1)}),Hd=W({path:z().min(1),file:z().min(1),since:X}),Ud=z().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),Wd=W({path:z().min(1),status:G([`added`,`modified`,`deleted`]),added:V().int().nonnegative().nullable(),removed:V().int().nonnegative().nullable()}),Gd=W({changes:U(W({commit:Ud,at:X,kind:G([`turn`,`board`,`merge`]),author:z(),turnId:J.optional(),subject:z(),files:U(Wd)})),more:H()}),Kd=Wd.pick({path:!0,status:!0}).extend({patch:z().nullable(),truncated:H()}),qd=W({topic:q,project:q.nullable(),updatedBy:q,updatedAt:X}),Jd=W({id:J,kind:jd,proposedBy:q,status:Md,createdAt:X,decidedBy:q.optional(),decidedAt:X.optional(),reason:z().optional(),charter:mu(z(),nu()),provisionedAt:X.optional(),provision:mu(z(),nu()).optional()}),Yd=W({id:J,proposalId:J,decidedBy:q,outcome:G([`approved`,`rejected`]),reason:z().optional(),ts:X});W({channel:Y.optional(),body:z().min(1),thread_id:J.optional()}),W({since_cursor:J.nullable().optional(),limit:V().int().positive().max(200).default(50),advance:H().default(!0)}),W({query:z().min(1),project:q.optional(),channel:Y.optional(),limit:V().int().positive().max(100).default(20)}),W({task_id:J.optional(),proposal_id:J.optional(),channel:Y.optional(),title:z().min(1).max(200).optional()}),W({thread_id:J,summary:z().min(1)}),W({project:q,title:z().min(1).max(200),body:z().default(``),parent_id:J.optional(),required_capabilities:U(z()).default([]),stages:U(ud).min(1).optional()}),W({task_id:J}),W({task_id:J}),W({task_id:J,stage:od.optional(),status:G([`abandoned`]).optional(),note:z().min(1).optional(),blocked_by:U(J).optional()}),W({task_id:J}),W({channel:Y}),W({channel:Y}),W({kind:jd,charter:mu(z(),nu()),rationale:z().default(``)}),W({proposal_id:J,reason:z().optional()}),W({proposal_id:J,reason:z().min(1)}),W({slug:q,name:z().min(1).optional(),repo:z().min(1).nullable().default(null),default_branch:z().min(1).default(`main`),on_done:ad.optional()}),W({project:q,agent:q.optional()}),W({project:q,agent:q.optional()}),W({project:q.nullable().default(null),topic:q,body:z().min(1)}),W({task_id:J,stages:U(dd),on_done:ad.optional()}),W({task_id:J,note:z().min(1).optional()}),W({project:q,on_done:ad}),W({project:q,reason:z().min(1)});var Xd=W({id:J,ts:X,type:G(`society.initialized,project.added,project.configured,project.archived,project.placed,agent.added,agent.configured,agent.placed,message.posted,thread.opened,thread.closed,task.created,task.claimed,task.released,task.updated,task.planned,task.advanced,task.moved,task.completing,task.completed,task.reopened,lease.expired,subscription.changed,proposal.created,proposal.decided,proposal.provisioned,channel.added,role.added,agent.retired,agent.joined,agent.left,knowledge.written,skill.promoted,runner.added,user.signed_in,user.signed_out,user.token_rotated,runner.changed,ops.signal,paused.changed,wake.requested,turn.started,turn.steered,turn.stopped,turn.completed,turn.failed,merge.completed,merge.failed`.split(`,`)),actor:q,payload:mu(z(),nu())}),Zd=W({inputTokens:V().int().nonnegative(),outputTokens:V().int().nonnegative(),cacheReadTokens:V().int().nonnegative().default(0),cacheWriteTokens:V().int().nonnegative().default(0)}),Qd=W({summary:z().min(1),claimsHeld:U(J).default([]),blockedOn:U(z()).default([]),needsUserDecision:H().default(!1),memoryUpdated:H().default(!1)}),$d=G([`completed`,`timeout`,`error`,`interrupted`,`blocked`,`stopped`]),ef=uu(`type`,[W({type:K(`turn_started`),agent:q,session:z(),runner:q,model:z().optional()}),W({type:K(`steered`),steer:z().min(1),messages:U(J).optional(),text:z().optional()}),W({type:K(`text`),delta:z()}),W({type:K(`tool_call`),name:z(),input:nu()}),W({type:K(`tool_result`),name:z(),ok:H(),output:z().optional()}),W({type:K(`approval_requested`),kind:z(),detail:nu()}),W({type:K(`turn_completed`),usage:Zd,costUsd:V().nonnegative(),status:Qd.nullable(),exitReason:$d}),W({type:K(`error`),message:z()})]),tf=W({ts:X,event:ef}),nf=W({seq:V().int().positive(),ts:X,agent:q,project:q,thread:J.optional(),event:ef});W({protocol:V().int().positive(),version:z().min(1),os:kd,clis:U(Z),residentClis:U(Z).default([]),steerableClis:U(Z).default([]),stoppableClis:U(Z).default([]),capabilities:U(z()).default([]),slots:V().int().positive().nullable(),turns:U(J).default([])}),W({name:q,version:z()}),W({protocol:V().int().positive(),version:z().min(1).max(64),hostname:z().min(1).max(253),os:kd,clis:U(Z).max(8),capabilities:U(z().min(1).max(64)).max(32).default([])}),W({deviceCode:z().min(1),userCode:z().min(1),expiresAt:X,intervalMs:V().int().positive()}),W({deviceCode:z().min(1)}),uu(`status`,[W({status:K(`pending`)}),W({status:K(`approved`),name:q,token:z().min(1)}),W({status:K(`denied`)})]);var rf=W({userCode:z().min(1),hostname:z(),os:kd,clis:U(Z),capabilities:U(z()),version:z(),requestedAt:X,expiresAt:X}),af=W({slug:q,origin:z().nullable(),defaultBranch:z().min(1)}),of=uu(`kind`,[W({kind:K(`home`)}),W({kind:K(`project`),repo:af,branches:U(z().min(1))}),W({kind:K(`task`),repo:af,taskId:J})]),sf=W({turnId:J,agent:q,role:q,cli:Z,model:z().optional(),scope:q,thread:J.optional(),session:z().min(1).nullable(),costSoFarUsd:V().nonnegative(),instructions:z(),prompt:z(),mcp:W({url:z().min(1),token:z().min(1)}),limits:W({timeoutMs:V().int().positive().nullable(),maxTurns:V().int().positive().nullable()}),resident:W({key:z().min(1),idleMs:V().int().positive()}).optional(),workspace:of}),cf=W({branch:z().min(1),head:z().min(1)});W({entries:U(tf)}),W({exitReason:$d,status:Qd.nullable(),error:z().nullable(),usage:Zd,costUsd:V().nonnegative(),sessionCostUsd:V().nonnegative().optional(),session:z().min(1),model:z().nullable(),work:cf.nullable()}),W({dropWorktree:H()});var lf=W({repo:af,branch:z().min(1)});W({ok:H(),detail:z()});var uf=W({id:Pl(),text:z().min(1)});uu(`type`,[W({type:K(`turn`),job:sf}),W({type:K(`land`),request:z().min(1),land:lf}),W({type:K(`models`),request:z().min(1),cli:Z}),W({type:K(`steer`),request:z().min(1),turnId:J,steer:uf}),W({type:K(`stop`),request:z().min(1),turnId:J})]),uu(`ok`,[W({ok:K(!0),value:nu()}),W({ok:K(!1),error:z()})]),W({warm:U(z())}),W({files:mu(z(),z())}),W({paths:U(z())}),W({files:mu(z(),z())});var df=W({kind:G([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`]),from:q.optional(),fromUser:H().default(!1),reason:z().default(``),taskId:J.optional(),messageId:J.optional(),channel:Y.optional()});W({agent:q,project:q,thread:W({id:J,task:H()}).optional(),trigger:df,priority:V().int().min(0).max(2),onboarding:H().default(!1)});function ff(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function pf(e){let[t,n,r,i]=e.split(`/`);return t===void 0||n===void 0||i!==void 0?null:r===void 0?{agent:t,scope:n}:{agent:t,scope:n,thread:r}}W({id:J.optional(),agent:q,project:q,thread:J.optional(),runner:q,cli:Z.nullable(),session:z().nullable(),trigger:df,startedAt:X,endedAt:X.nullable(),exitReason:$d.nullable(),status:Qd.nullable(),error:z().nullable(),usage:Zd.nullable(),costUsd:V().nonnegative().default(0),sessionCostUsd:V().nonnegative().optional(),toolCalls:V().int().nonnegative().default(0),model:z().nullable().default(null),work:cf.optional(),stoppedBy:q.optional()});var mf=W({turnId:J,agent:q,scope:q,thread:J.optional(),cli:Z,channel:Y.optional(),steerable:H(),stoppable:H()});W({claude:z().optional(),codex:z().optional(),runner:q.optional()}),W({agent:q,project:q,reason:z().default(`manual wake`),kind:G([`manual`,`reflection`]).default(`manual`)});var hf=W({id:J,turnId:J.optional(),ts:X,outcome:G([`completed`,`failed`]),project:q,thread:J.optional(),trigger:z(),exitReason:z().nullable(),costUsd:V(),model:z().nullable(),summary:z().nullable(),error:z().nullable(),startedAt:X.optional(),toolCalls:V().int().nonnegative().optional()}),gf=G([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`]),_f=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],vf=W({kind:gf,key:z().min(1),summary:z().min(1),value:V(),threshold:V().optional(),project:q.optional(),agent:q.optional(),role:q.optional(),taskId:J.optional()}),yf=G([`24h`,`7d`,`all`]),Q=V().int().nonnegative(),bf=V().nonnegative(),xf=W({window:yf,since:X.nullable(),until:X,idle:W({turns:Q,idle:Q,unknown:Q,byTrigger:U(W({trigger:z(),turns:Q,idle:Q})),byAgent:U(W({agent:q,role:q.nullable(),turns:Q,idle:Q}))}),sentBack:W({finished:Q,sendBacks:Q,tasksSentBack:Q,byStage:U(W({project:q,stage:z(),count:Q})),bySender:U(W({agent:q,count:Q}))}),messages:W({finished:Q,messages:Q,byProject:U(W({project:q,finished:Q,messages:Q})),busiest:U(W({taskId:J,title:z(),project:q,messages:Q}))}),latency:W({mentions:Q,unanswered:Q,medianMs:bf.nullable(),slowestMs:bf.nullable(),byAgent:U(W({agent:q,mentions:Q,medianMs:bf,slowestMs:bf}))}),decisions:W({total:Q,byDay:U(W({day:z(),proposals:Q,answers:Q,stages:Q}))}),blocked:U(W({taskId:J,title:z().nullable(),project:q.nullable(),summary:z(),firstAt:X,lastAt:X,holds:H()}))}),Sf=G([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),Cf=W({clientId:z().min(1),clientSecret:z().min(1),users:U(z().min(1)).min(1)});W({dataDir:z().min(1),host:z().min(1),port:V().int().positive().max(65535),publicUrl:z().min(1).nullable(),logLevel:Sf,concurrency:V().int().positive().nullable(),turnTimeoutMs:V().int().positive().nullable(),toolRounds:V().int().positive().nullable(),residentIdleMs:V().int().positive(),github:Cf.nullable(),trustedProxies:V().int().min(0).max(16)}),W({serverUrl:z().url(),token:z().min(1).nullable(),dataDir:z().min(1),logLevel:Sf,slots:V().int().positive().nullable(),clis:U(Z).min(1),capabilities:U(z())});var wf=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(wf);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function Tf(){let{api:e}=$();return E({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function Ef(){let{api:e}=$();return E({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function Df(){let{api:e}=$();return E({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function Of(){let{api:e}=$();return E({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function kf(){let{api:e}=$();return E({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function Af(){let{api:e}=$();return E({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function jf(e){let{api:t}=$();return E({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function Mf(e){let{api:t}=$();return E({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function Nf(){let{api:e}=$();return E({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function Pf(){let{api:e}=$();return E({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function Ff(e){let{api:t}=$();return E({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function If(e){return e.flatMap(e=>e.data??[])}function Lf(){let{api:e}=$();return st({queries:(Df().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:If})}function Rf(e){let{api:t}=$();return E({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function zf(){let{api:e}=$();return E({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function Bf(e){let{api:t}=$();return E({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function Vf(){let{api:e}=$();return E({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function Hf(e,t){let{api:n}=$();return E({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function Uf(e,t){let{api:n}=$();return E({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function Wf(e){let{api:t}=$();return E({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function Gf(e){let{api:t}=$();return E({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function Kf(e,t){let{api:n}=$();return E({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:he})}function qf(e,t,n){let{api:r}=$();return E({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function Jf(e){let{api:t}=$();return E({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function Yf(e){let{api:t}=$();return E({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:6e4})}function Xf(e){let{api:t}=$();return E({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function Zf(){let{api:e}=$();return E({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function Qf(){let{api:e}=$();return E({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function $f(e){let{api:t}=$();return E({queryKey:[`models`,e],queryFn:()=>t.models(e??`claude`),enabled:e!==null,staleTime:6e5,retry:!1})}function ep(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var tp=[[`day`,86400],[`hour`,3600],[`minute`,60]],np=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function rp(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of tp)if(Math.abs(n)>=t)return np.format(Math.round(n/t),e);return`just now`}function ip(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function ap(e,t=220){let n=(e.split(/\n\s*\n/).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))??``).replaceAll(/[*_`>]/g,``).replaceAll(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}export{Kd as $,Et as $t,Rf as A,ve as An,Uu as At,hf as B,Kt as Bt,Of as C,b as Cn,qu as Ct,jf as D,y as Dn,q as Dt,$ as E,x as En,Y as Et,xf as F,o as Fn,mu as Ft,nf as G,Rt as Gt,ff as H,Ht,yf as I,s as In,z as It,Dd as J,At as Jt,tf as K,Pt as Kt,vf as L,l as Ln,nu as Lt,Pf as M,g as Mn,H as Mt,Uf as N,p as Nn,V as Nt,Vf as O,C as On,J as Ot,Hf as P,d as Pn,W as Pt,Hd as Q,pt as Qt,_f as R,hn as Rt,Af as S,le as Sn,rd as St,kf as T,ae as Tn,Ju as Tt,rf as U,kt as Ut,pf as V,Gt as Vt,Xd as W,Ft as Wt,Pd as X,St as Xt,Ld as Y,jt as Yt,Yd as Z,Ot as Zt,$f as _,Oe as _n,yd as _t,Gf as a,dt as an,Td as at,Bf as b,oe as bn,md as bt,Yf as c,lt as cn,zd as ct,Jf as d,ht as dn,Ad as dt,_t as en,Gd as et,Kf as f,E as fn,nd as ft,Mf as g,ke as gn,Sd as gt,Wf as h,Ne as hn,id as ht,wf as i,ft as in,hd as it,Ff as j,te as jn,U as jt,Tf as k,be as kn,Wu as kt,Qf as l,mt as ln,Fd as lt,Ef as m,Pe as mn,Vd as mt,ap as n,ut as nn,Nd as nt,Lf as o,Tt as on,fd as ot,Xf as p,Re as pn,Rd as pt,td as q,Mt as qt,ip as r,Ct as rn,Od as rt,Nf as s,vt as sn,Jd as st,rp as t,Dt as tn,qd as tt,qf as u,wt as un,Id as ut,ep as v,Te as vn,wd as vt,Zf as w,ce as wn,Yu as wt,zf as x,ue as xn,Cd as xt,Df as y,we as yn,Bd as yt,mf as z,Qt as zt};