@botpress/sdk 4.8.2 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/dist/index.cjs +30 -74
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +48 -59
- package/dist/index.mjs.map +4 -4
- package/dist/message.d.ts +31 -31
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,44 +1,22 @@
|
|
|
1
|
-
"use strict";var mg=Object.create;var Hr=Object.defineProperty;var yg=Object.getOwnPropertyDescriptor;var vg=Object.getOwnPropertyNames;var _g=Object.getPrototypeOf,Tg=Object.prototype.hasOwnProperty;var Ma=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),er=(t,e)=>{for(var r in e)Hr(t,r,{get:e[r],enumerable:!0})},Vi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of vg(e))!Tg.call(t,a)&&a!==r&&Hr(t,a,{get:()=>e[a],enumerable:!(n=yg(e,a))||n.enumerable});return t};var at=(t,e,r)=>(r=t!=null?mg(_g(t)):{},Vi(e||!t||!t.__esModule?Hr(r,"default",{value:t,enumerable:!0}):r,t)),bg=t=>Vi(Hr({},"__esModule",{value:!0}),t);var so=Ma($=>{"use strict";var tr=Symbol.for("react.element"),wg=Symbol.for("react.portal"),Pg=Symbol.for("react.fragment"),kg=Symbol.for("react.strict_mode"),Eg=Symbol.for("react.profiler"),xg=Symbol.for("react.provider"),Sg=Symbol.for("react.context"),Og=Symbol.for("react.forward_ref"),Cg=Symbol.for("react.suspense"),Ig=Symbol.for("react.memo"),Bg=Symbol.for("react.lazy"),qi=Symbol.iterator;function Rg(t){return t===null||typeof t!="object"?null:(t=qi&&t[qi]||t["@@iterator"],typeof t=="function"?t:null)}var Yi={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xi=Object.assign,Qi={};function Ot(t,e,r){this.props=t,this.context=e,this.refs=Qi,this.updater=r||Yi}Ot.prototype.isReactComponent={};Ot.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ot.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function eo(){}eo.prototype=Ot.prototype;function ja(t,e,r){this.props=t,this.context=e,this.refs=Qi,this.updater=r||Yi}var $a=ja.prototype=new eo;$a.constructor=ja;Xi($a,Ot.prototype);$a.isPureReactComponent=!0;var Gi=Array.isArray,to=Object.prototype.hasOwnProperty,Ua={current:null},ro={key:!0,ref:!0,__self:!0,__source:!0};function no(t,e,r){var n,a={},s=null,i=null;if(e!=null)for(n in e.ref!==void 0&&(i=e.ref),e.key!==void 0&&(s=""+e.key),e)to.call(e,n)&&!ro.hasOwnProperty(n)&&(a[n]=e[n]);var o=arguments.length-2;if(o===1)a.children=r;else if(1<o){for(var c=Array(o),p=0;p<o;p++)c[p]=arguments[p+2];a.children=c}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)a[n]===void 0&&(a[n]=o[n]);return{$$typeof:tr,type:t,key:s,ref:i,props:a,_owner:Ua.current}}function Ag(t,e){return{$$typeof:tr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ka(t){return typeof t=="object"&&t!==null&&t.$$typeof===tr}function Zg(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Ji=/\/+/g;function Na(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Zg(""+t.key):e.toString(36)}function Nr(t,e,r,n,a){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var i=!1;if(t===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(t.$$typeof){case tr:case wg:i=!0}}if(i)return i=t,a=a(i),t=n===""?"."+Na(i,0):n,Gi(a)?(r="",t!=null&&(r=t.replace(Ji,"$&/")+"/"),Nr(a,e,r,"",function(p){return p})):a!=null&&(Ka(a)&&(a=Ag(a,r+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(Ji,"$&/")+"/")+t)),e.push(a)),1;if(i=0,n=n===""?".":n+":",Gi(t))for(var o=0;o<t.length;o++){s=t[o];var c=n+Na(s,o);i+=Nr(s,e,r,c,a)}else if(c=Rg(t),typeof c=="function")for(t=c.call(t),o=0;!(s=t.next()).done;)s=s.value,c=n+Na(s,o++),i+=Nr(s,e,r,c,a);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return i}function Mr(t,e,r){if(t==null)return t;var n=[],a=0;return Nr(t,n,"","",function(s){return e.call(r,s,a++)}),n}function Dg(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var ye={current:null},jr={transition:null},Hg={ReactCurrentDispatcher:ye,ReactCurrentBatchConfig:jr,ReactCurrentOwner:Ua};function ao(){throw Error("act(...) is not supported in production builds of React.")}$.Children={map:Mr,forEach:function(t,e,r){Mr(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Mr(t,function(){e++}),e},toArray:function(t){return Mr(t,function(e){return e})||[]},only:function(t){if(!Ka(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};$.Component=Ot;$.Fragment=Pg;$.Profiler=Eg;$.PureComponent=ja;$.StrictMode=kg;$.Suspense=Cg;$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hg;$.act=ao;$.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Xi({},t.props),a=t.key,s=t.ref,i=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,i=Ua.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(c in e)to.call(e,c)&&!ro.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&o!==void 0?o[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){o=Array(c);for(var p=0;p<c;p++)o[p]=arguments[p+2];n.children=o}return{$$typeof:tr,type:t.type,key:a,ref:s,props:n,_owner:i}};$.createContext=function(t){return t={$$typeof:Sg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:xg,_context:t},t.Consumer=t};$.createElement=no;$.createFactory=function(t){var e=no.bind(null,t);return e.type=t,e};$.createRef=function(){return{current:null}};$.forwardRef=function(t){return{$$typeof:Og,render:t}};$.isValidElement=Ka;$.lazy=function(t){return{$$typeof:Bg,_payload:{_status:-1,_result:t},_init:Dg}};$.memo=function(t,e){return{$$typeof:Ig,type:t,compare:e===void 0?null:e}};$.startTransition=function(t){var e=jr.transition;jr.transition={};try{t()}finally{jr.transition=e}};$.unstable_act=ao;$.useCallback=function(t,e){return ye.current.useCallback(t,e)};$.useContext=function(t){return ye.current.useContext(t)};$.useDebugValue=function(){};$.useDeferredValue=function(t){return ye.current.useDeferredValue(t)};$.useEffect=function(t,e){return ye.current.useEffect(t,e)};$.useId=function(){return ye.current.useId()};$.useImperativeHandle=function(t,e,r){return ye.current.useImperativeHandle(t,e,r)};$.useInsertionEffect=function(t,e){return ye.current.useInsertionEffect(t,e)};$.useLayoutEffect=function(t,e){return ye.current.useLayoutEffect(t,e)};$.useMemo=function(t,e){return ye.current.useMemo(t,e)};$.useReducer=function(t,e,r){return ye.current.useReducer(t,e,r)};$.useRef=function(t){return ye.current.useRef(t)};$.useState=function(t){return ye.current.useState(t)};$.useSyncExternalStore=function(t,e,r){return ye.current.useSyncExternalStore(t,e,r)};$.useTransition=function(){return ye.current.useTransition()};$.version="18.3.1"});var io=Ma((U,$r)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t="18.3.1",e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),S=Symbol.iterator,W="@@iterator";function q(u){if(u===null||typeof u!="object")return null;var f=S&&u[S]||u[W];return typeof f=="function"?f:null}var re={current:null},J={transition:null},j={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},F={current:null},ue={},Le=null;function rt(u){Le=u}ue.setExtraStackFrame=function(u){Le=u},ue.getCurrentStack=null,ue.getStackAddendum=function(){var u="";Le&&(u+=Le);var f=ue.getCurrentStack;return f&&(u+=f()||""),u};var Ce=!1,we=!1,va=!1,_a=!1,Pe=!1,Te={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:F};Te.ReactDebugCurrentFrame=ue,Te.ReactCurrentActQueue=j;function ke(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Ie("warn",u,g)}}function N(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Ie("error",u,g)}}function Ie(u,f,g){{var y=Te.ReactDebugCurrentFrame,b=y.getStackAddendum();b!==""&&(f+="%s",g=g.concat([b]));var B=g.map(function(x){return String(x)});B.unshift("Warning: "+f),Function.prototype.apply.call(console[u],console,B)}}var Oe={};function ze(u,f){{var g=u.constructor,y=g&&(g.displayName||g.name)||"ReactClass",b=y+"."+f;if(Oe[b])return;N("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",f,y),Oe[b]=!0}}var li={isMounted:function(u){return!1},enqueueForceUpdate:function(u,f,g){ze(u,"forceUpdate")},enqueueReplaceState:function(u,f,g,y){ze(u,"replaceState")},enqueueSetState:function(u,f,g,y){ze(u,"setState")}},Ae=Object.assign,Ta={};Object.freeze(Ta);function nt(u,f,g){this.props=u,this.context=f,this.refs=Ta,this.updater=g||li}nt.prototype.isReactComponent={},nt.prototype.setState=function(u,f){if(typeof u!="object"&&typeof u!="function"&&u!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,u,f,"setState")},nt.prototype.forceUpdate=function(u){this.updater.enqueueForceUpdate(this,u,"forceUpdate")};{var ba={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},up=function(u,f){Object.defineProperty(nt.prototype,u,{get:function(){ke("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var wa in ba)ba.hasOwnProperty(wa)&&up(wa,ba[wa])}function ui(){}ui.prototype=nt.prototype;function Pa(u,f,g){this.props=u,this.context=f,this.refs=Ta,this.updater=g||li}var ka=Pa.prototype=new ui;ka.constructor=Pa,Ae(ka,nt.prototype),ka.isPureReactComponent=!0;function cp(){var u={current:null};return Object.seal(u),u}var dp=Array.isArray;function Er(u){return dp(u)}function fp(u){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&u[Symbol.toStringTag]||u.constructor.name||"Object";return g}}function pp(u){try{return ci(u),!1}catch{return!0}}function ci(u){return""+u}function xr(u){if(pp(u))return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fp(u)),ci(u)}function gp(u,f,g){var y=u.displayName;if(y)return y;var b=f.displayName||f.name||"";return b!==""?g+"("+b+")":g}function di(u){return u.displayName||"Context"}function We(u){if(u==null)return null;if(typeof u.tag=="number"&&N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case m:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case o:var f=u;return di(f)+".Consumer";case i:var g=u;return di(g._context)+".Provider";case c:return gp(u,u.render,"ForwardRef");case T:var y=u.displayName||null;return y!==null?y:We(u.type)||"Memo";case O:{var b=u,B=b._payload,x=b._init;try{return We(x(B))}catch{return null}}}return null}var Yt=Object.prototype.hasOwnProperty,fi={key:!0,ref:!0,__self:!0,__source:!0},pi,gi,Ea;Ea={};function hi(u){if(Yt.call(u,"ref")){var f=Object.getOwnPropertyDescriptor(u,"ref").get;if(f&&f.isReactWarning)return!1}return u.ref!==void 0}function mi(u){if(Yt.call(u,"key")){var f=Object.getOwnPropertyDescriptor(u,"key").get;if(f&&f.isReactWarning)return!1}return u.key!==void 0}function hp(u,f){var g=function(){pi||(pi=!0,N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(u,"key",{get:g,configurable:!0})}function mp(u,f){var g=function(){gi||(gi=!0,N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(u,"ref",{get:g,configurable:!0})}function yp(u){if(typeof u.ref=="string"&&F.current&&u.__self&&F.current.stateNode!==u.__self){var f=We(F.current.type);Ea[f]||(N('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',f,u.ref),Ea[f]=!0)}}var xa=function(u,f,g,y,b,B,x){var D={$$typeof:e,type:u,key:f,ref:g,props:x,_owner:B};return D._store={},Object.defineProperty(D._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(D,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(D,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(D.props),Object.freeze(D)),D};function vp(u,f,g){var y,b={},B=null,x=null,D=null,L=null;if(f!=null){hi(f)&&(x=f.ref,yp(f)),mi(f)&&(xr(f.key),B=""+f.key),D=f.__self===void 0?null:f.__self,L=f.__source===void 0?null:f.__source;for(y in f)Yt.call(f,y)&&!fi.hasOwnProperty(y)&&(b[y]=f[y])}var Y=arguments.length-2;if(Y===1)b.children=g;else if(Y>1){for(var Q=Array(Y),ee=0;ee<Y;ee++)Q[ee]=arguments[ee+2];Object.freeze&&Object.freeze(Q),b.children=Q}if(u&&u.defaultProps){var ne=u.defaultProps;for(y in ne)b[y]===void 0&&(b[y]=ne[y])}if(B||x){var oe=typeof u=="function"?u.displayName||u.name||"Unknown":u;B&&hp(b,oe),x&&mp(b,oe)}return xa(u,B,x,D,L,F.current,b)}function _p(u,f){var g=xa(u.type,f,u.ref,u._self,u._source,u._owner,u.props);return g}function Tp(u,f,g){if(u==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+u+".");var y,b=Ae({},u.props),B=u.key,x=u.ref,D=u._self,L=u._source,Y=u._owner;if(f!=null){hi(f)&&(x=f.ref,Y=F.current),mi(f)&&(xr(f.key),B=""+f.key);var Q;u.type&&u.type.defaultProps&&(Q=u.type.defaultProps);for(y in f)Yt.call(f,y)&&!fi.hasOwnProperty(y)&&(f[y]===void 0&&Q!==void 0?b[y]=Q[y]:b[y]=f[y])}var ee=arguments.length-2;if(ee===1)b.children=g;else if(ee>1){for(var ne=Array(ee),oe=0;oe<ee;oe++)ne[oe]=arguments[oe+2];b.children=ne}return xa(u.type,B,x,D,L,Y,b)}function Et(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}var yi=".",bp=":";function wp(u){var f=/[=:]/g,g={"=":"=0",":":"=2"},y=u.replace(f,function(b){return g[b]});return"$"+y}var vi=!1,Pp=/\/+/g;function _i(u){return u.replace(Pp,"$&/")}function Sa(u,f){return typeof u=="object"&&u!==null&&u.key!=null?(xr(u.key),wp(""+u.key)):f.toString(36)}function Sr(u,f,g,y,b){var B=typeof u;(B==="undefined"||B==="boolean")&&(u=null);var x=!1;if(u===null)x=!0;else switch(B){case"string":case"number":x=!0;break;case"object":switch(u.$$typeof){case e:case r:x=!0}}if(x){var D=u,L=b(D),Y=y===""?yi+Sa(D,0):y;if(Er(L)){var Q="";Y!=null&&(Q=_i(Y)+"/"),Sr(L,f,Q,"",function(hg){return hg})}else L!=null&&(Et(L)&&(L.key&&(!D||D.key!==L.key)&&xr(L.key),L=_p(L,g+(L.key&&(!D||D.key!==L.key)?_i(""+L.key)+"/":"")+Y)),f.push(L));return 1}var ee,ne,oe=0,de=y===""?yi:y+bp;if(Er(u))for(var Dr=0;Dr<u.length;Dr++)ee=u[Dr],ne=de+Sa(ee,Dr),oe+=Sr(ee,f,g,ne,b);else{var Ha=q(u);if(typeof Ha=="function"){var Li=u;Ha===Li.entries&&(vi||ke("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),vi=!0);for(var pg=Ha.call(Li),zi,gg=0;!(zi=pg.next()).done;)ee=zi.value,ne=de+Sa(ee,gg++),oe+=Sr(ee,f,g,ne,b)}else if(B==="object"){var Wi=String(u);throw new Error("Objects are not valid as a React child (found: "+(Wi==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":Wi)+"). If you meant to render a collection of children, use an array instead.")}}return oe}function Or(u,f,g){if(u==null)return u;var y=[],b=0;return Sr(u,y,"","",function(B){return f.call(g,B,b++)}),y}function kp(u){var f=0;return Or(u,function(){f++}),f}function Ep(u,f,g){Or(u,function(){f.apply(this,arguments)},g)}function xp(u){return Or(u,function(f){return f})||[]}function Sp(u){if(!Et(u))throw new Error("React.Children.only expected to receive a single React element child.");return u}function Op(u){var f={$$typeof:o,_currentValue:u,_currentValue2:u,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};f.Provider={$$typeof:i,_context:f};var g=!1,y=!1,b=!1;{var B={$$typeof:o,_context:f};Object.defineProperties(B,{Provider:{get:function(){return y||(y=!0,N("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),f.Provider},set:function(x){f.Provider=x}},_currentValue:{get:function(){return f._currentValue},set:function(x){f._currentValue=x}},_currentValue2:{get:function(){return f._currentValue2},set:function(x){f._currentValue2=x}},_threadCount:{get:function(){return f._threadCount},set:function(x){f._threadCount=x}},Consumer:{get:function(){return g||(g=!0,N("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),f.Consumer}},displayName:{get:function(){return f.displayName},set:function(x){b||(ke("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",x),b=!0)}}}),f.Consumer=B}return f._currentRenderer=null,f._currentRenderer2=null,f}var Xt=-1,Oa=0,Ti=1,Cp=2;function Ip(u){if(u._status===Xt){var f=u._result,g=f();if(g.then(function(B){if(u._status===Oa||u._status===Xt){var x=u;x._status=Ti,x._result=B}},function(B){if(u._status===Oa||u._status===Xt){var x=u;x._status=Cp,x._result=B}}),u._status===Xt){var y=u;y._status=Oa,y._result=g}}if(u._status===Ti){var b=u._result;return b===void 0&&N(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
-
|
|
3
|
-
Your code should look like:
|
|
4
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
-
|
|
6
|
-
Did you accidentally put curly braces around the import?`,b),"default"in b||N(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
-
|
|
8
|
-
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,b),b.default}else throw u._result}function Bp(u){var f={_status:Xt,_result:u},g={$$typeof:O,_payload:f,_init:Ip};{var y,b;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return y},set:function(B){N("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),y=B,Object.defineProperty(g,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return b},set:function(B){N("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),b=B,Object.defineProperty(g,"propTypes",{enumerable:!0})}}})}return g}function Rp(u){u!=null&&u.$$typeof===T?N("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof u!="function"?N("forwardRef requires a render function but was given %s.",u===null?"null":typeof u):u.length!==0&&u.length!==2&&N("forwardRef render functions accept exactly two parameters: props and ref. %s",u.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),u!=null&&(u.defaultProps!=null||u.propTypes!=null)&&N("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var f={$$typeof:c,render:u};{var g;Object.defineProperty(f,"displayName",{enumerable:!1,configurable:!0,get:function(){return g},set:function(y){g=y,!u.name&&!u.displayName&&(u.displayName=y)}})}return f}var bi;bi=Symbol.for("react.module.reference");function wi(u){return!!(typeof u=="string"||typeof u=="function"||u===n||u===s||Pe||u===a||u===p||u===m||_a||u===w||Ce||we||va||typeof u=="object"&&u!==null&&(u.$$typeof===O||u.$$typeof===T||u.$$typeof===i||u.$$typeof===o||u.$$typeof===c||u.$$typeof===bi||u.getModuleId!==void 0))}function Ap(u,f){wi(u)||N("memo: The first argument must be a component. Instead received: %s",u===null?"null":typeof u);var g={$$typeof:T,type:u,compare:f===void 0?null:f};{var y;Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return y},set:function(b){y=b,!u.name&&!u.displayName&&(u.displayName=b)}})}return g}function me(){var u=re.current;return u===null&&N(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
-
2. You might be breaking the Rules of Hooks
|
|
12
|
-
3. You might have more than one copy of React in the same app
|
|
13
|
-
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),u}function Zp(u){var f=me();if(u._context!==void 0){var g=u._context;g.Consumer===u?N("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):g.Provider===u&&N("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(u)}function Dp(u){var f=me();return f.useState(u)}function Hp(u,f,g){var y=me();return y.useReducer(u,f,g)}function Mp(u){var f=me();return f.useRef(u)}function Np(u,f){var g=me();return g.useEffect(u,f)}function jp(u,f){var g=me();return g.useInsertionEffect(u,f)}function $p(u,f){var g=me();return g.useLayoutEffect(u,f)}function Up(u,f){var g=me();return g.useCallback(u,f)}function Kp(u,f){var g=me();return g.useMemo(u,f)}function Fp(u,f,g){var y=me();return y.useImperativeHandle(u,f,g)}function Lp(u,f){{var g=me();return g.useDebugValue(u,f)}}function zp(){var u=me();return u.useTransition()}function Wp(u){var f=me();return f.useDeferredValue(u)}function Vp(){var u=me();return u.useId()}function qp(u,f,g){var y=me();return y.useSyncExternalStore(u,f,g)}var Qt=0,Pi,ki,Ei,xi,Si,Oi,Ci;function Ii(){}Ii.__reactDisabledLog=!0;function Gp(){{if(Qt===0){Pi=console.log,ki=console.info,Ei=console.warn,xi=console.error,Si=console.group,Oi=console.groupCollapsed,Ci=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Ii,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Qt++}}function Jp(){{if(Qt--,Qt===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ae({},u,{value:Pi}),info:Ae({},u,{value:ki}),warn:Ae({},u,{value:Ei}),error:Ae({},u,{value:xi}),group:Ae({},u,{value:Si}),groupCollapsed:Ae({},u,{value:Oi}),groupEnd:Ae({},u,{value:Ci})})}Qt<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ca=Te.ReactCurrentDispatcher,Ia;function Cr(u,f,g){{if(Ia===void 0)try{throw Error()}catch(b){var y=b.stack.trim().match(/\n( *(at )?)/);Ia=y&&y[1]||""}return`
|
|
14
|
-
`+Ia+u}}var Ba=!1,Ir;{var Yp=typeof WeakMap=="function"?WeakMap:Map;Ir=new Yp}function Bi(u,f){if(!u||Ba)return"";{var g=Ir.get(u);if(g!==void 0)return g}var y;Ba=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=Ca.current,Ca.current=null,Gp();try{if(f){var x=function(){throw Error()};if(Object.defineProperty(x.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(x,[])}catch(de){y=de}Reflect.construct(u,[],x)}else{try{x.call()}catch(de){y=de}u.call(x.prototype)}}else{try{throw Error()}catch(de){y=de}u()}}catch(de){if(de&&y&&typeof de.stack=="string"){for(var D=de.stack.split(`
|
|
15
|
-
`),L=y.stack.split(`
|
|
16
|
-
`),Y=D.length-1,Q=L.length-1;Y>=1&&Q>=0&&D[Y]!==L[Q];)Q--;for(;Y>=1&&Q>=0;Y--,Q--)if(D[Y]!==L[Q]){if(Y!==1||Q!==1)do if(Y--,Q--,Q<0||D[Y]!==L[Q]){var ee=`
|
|
17
|
-
`+D[Y].replace(" at new "," at ");return u.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",u.displayName)),typeof u=="function"&&Ir.set(u,ee),ee}while(Y>=1&&Q>=0);break}}}finally{Ba=!1,Ca.current=B,Jp(),Error.prepareStackTrace=b}var ne=u?u.displayName||u.name:"",oe=ne?Cr(ne):"";return typeof u=="function"&&Ir.set(u,oe),oe}function Xp(u,f,g){return Bi(u,!1)}function Qp(u){var f=u.prototype;return!!(f&&f.isReactComponent)}function Br(u,f,g){if(u==null)return"";if(typeof u=="function")return Bi(u,Qp(u));if(typeof u=="string")return Cr(u);switch(u){case p:return Cr("Suspense");case m:return Cr("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return Xp(u.render);case T:return Br(u.type,f,g);case O:{var y=u,b=y._payload,B=y._init;try{return Br(B(b),f,g)}catch{}}}return""}var Ri={},Ai=Te.ReactDebugCurrentFrame;function Rr(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);Ai.setExtraStackFrame(g)}else Ai.setExtraStackFrame(null)}function eg(u,f,g,y,b){{var B=Function.call.bind(Yt);for(var x in u)if(B(u,x)){var D=void 0;try{if(typeof u[x]!="function"){var L=Error((y||"React class")+": "+g+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw L.name="Invariant Violation",L}D=u[x](f,x,y,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){D=Y}D&&!(D instanceof Error)&&(Rr(b),N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",y||"React class",g,x,typeof D),Rr(null)),D instanceof Error&&!(D.message in Ri)&&(Ri[D.message]=!0,Rr(b),N("Failed %s type: %s",g,D.message),Rr(null))}}}function xt(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);rt(g)}else rt(null)}var Ra;Ra=!1;function Zi(){if(F.current){var u=We(F.current.type);if(u)return`
|
|
18
|
-
|
|
19
|
-
Check the render method of \``+u+"`."}return""}function tg(u){if(u!==void 0){var f=u.fileName.replace(/^.*[\\\/]/,""),g=u.lineNumber;return`
|
|
20
|
-
|
|
21
|
-
Check your code at `+f+":"+g+"."}return""}function rg(u){return u!=null?tg(u.__source):""}var Di={};function ng(u){var f=Zi();if(!f){var g=typeof u=="string"?u:u.displayName||u.name;g&&(f=`
|
|
22
|
-
|
|
23
|
-
Check the top-level render call using <`+g+">.")}return f}function Hi(u,f){if(!(!u._store||u._store.validated||u.key!=null)){u._store.validated=!0;var g=ng(f);if(!Di[g]){Di[g]=!0;var y="";u&&u._owner&&u._owner!==F.current&&(y=" It was passed a child from "+We(u._owner.type)+"."),xt(u),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,y),xt(null)}}}function Mi(u,f){if(typeof u=="object"){if(Er(u))for(var g=0;g<u.length;g++){var y=u[g];Et(y)&&Hi(y,f)}else if(Et(u))u._store&&(u._store.validated=!0);else if(u){var b=q(u);if(typeof b=="function"&&b!==u.entries)for(var B=b.call(u),x;!(x=B.next()).done;)Et(x.value)&&Hi(x.value,f)}}}function Ni(u){{var f=u.type;if(f==null||typeof f=="string")return;var g;if(typeof f=="function")g=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===c||f.$$typeof===T))g=f.propTypes;else return;if(g){var y=We(f);eg(g,u.props,"prop",y,u)}else if(f.PropTypes!==void 0&&!Ra){Ra=!0;var b=We(f);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ag(u){{for(var f=Object.keys(u.props),g=0;g<f.length;g++){var y=f[g];if(y!=="children"&&y!=="key"){xt(u),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),xt(null);break}}u.ref!==null&&(xt(u),N("Invalid attribute `ref` supplied to `React.Fragment`."),xt(null))}}function ji(u,f,g){var y=wi(u);if(!y){var b="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var B=rg(f);B?b+=B:b+=Zi();var x;u===null?x="null":Er(u)?x="array":u!==void 0&&u.$$typeof===e?(x="<"+(We(u.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):x=typeof u,N("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,b)}var D=vp.apply(this,arguments);if(D==null)return D;if(y)for(var L=2;L<arguments.length;L++)Mi(arguments[L],u);return u===n?ag(D):Ni(D),D}var $i=!1;function sg(u){var f=ji.bind(null,u);return f.type=u,$i||($i=!0,ke("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(f,"type",{enumerable:!1,get:function(){return ke("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:u}),u}}),f}function ig(u,f,g){for(var y=Tp.apply(this,arguments),b=2;b<arguments.length;b++)Mi(arguments[b],y.type);return Ni(y),y}function og(u,f){var g=J.transition;J.transition={};var y=J.transition;J.transition._updatedFibers=new Set;try{u()}finally{if(J.transition=g,g===null&&y._updatedFibers){var b=y._updatedFibers.size;b>10&&ke("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),y._updatedFibers.clear()}}}var Ui=!1,Ar=null;function lg(u){if(Ar===null)try{var f=("require"+Math.random()).slice(0,7),g=$r&&$r[f];Ar=g.call($r,"timers").setImmediate}catch{Ar=function(b){Ui===!1&&(Ui=!0,typeof MessageChannel>"u"&&N("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var B=new MessageChannel;B.port1.onmessage=b,B.port2.postMessage(void 0)}}return Ar(u)}var St=0,Ki=!1;function Fi(u){{var f=St;St++,j.current===null&&(j.current=[]);var g=j.isBatchingLegacy,y;try{if(j.isBatchingLegacy=!0,y=u(),!g&&j.didScheduleLegacyUpdate){var b=j.current;b!==null&&(j.didScheduleLegacyUpdate=!1,Da(b))}}catch(ne){throw Zr(f),ne}finally{j.isBatchingLegacy=g}if(y!==null&&typeof y=="object"&&typeof y.then=="function"){var B=y,x=!1,D={then:function(ne,oe){x=!0,B.then(function(de){Zr(f),St===0?Aa(de,ne,oe):ne(de)},function(de){Zr(f),oe(de)})}};return!Ki&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){x||(Ki=!0,N("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),D}else{var L=y;if(Zr(f),St===0){var Y=j.current;Y!==null&&(Da(Y),j.current=null);var Q={then:function(ne,oe){j.current===null?(j.current=[],Aa(L,ne,oe)):ne(L)}};return Q}else{var ee={then:function(ne,oe){ne(L)}};return ee}}}}function Zr(u){u!==St-1&&N("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),St=u}function Aa(u,f,g){{var y=j.current;if(y!==null)try{Da(y),lg(function(){y.length===0?(j.current=null,f(u)):Aa(u,f,g)})}catch(b){g(b)}else f(u)}}var Za=!1;function Da(u){if(!Za){Za=!0;var f=0;try{for(;f<u.length;f++){var g=u[f];do g=g(!0);while(g!==null)}u.length=0}catch(y){throw u=u.slice(f+1),y}finally{Za=!1}}}var ug=ji,cg=ig,dg=sg,fg={map:Or,forEach:Ep,count:kp,toArray:xp,only:Sp};U.Children=fg,U.Component=nt,U.Fragment=n,U.Profiler=s,U.PureComponent=Pa,U.StrictMode=a,U.Suspense=p,U.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Te,U.act=Fi,U.cloneElement=cg,U.createContext=Op,U.createElement=ug,U.createFactory=dg,U.createRef=cp,U.forwardRef=Rp,U.isValidElement=Et,U.lazy=Bp,U.memo=Ap,U.startTransition=og,U.unstable_act=Fi,U.useCallback=Up,U.useContext=Zp,U.useDebugValue=Lp,U.useDeferredValue=Wp,U.useEffect=Np,U.useId=Vp,U.useImperativeHandle=Fp,U.useInsertionEffect=jp,U.useLayoutEffect=$p,U.useMemo=Kp,U.useReducer=Hp,U.useRef=Mp,U.useState=Dp,U.useSyncExternalStore=qp,U.useTransition=zp,U.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var Ct=Ma((CT,Fa)=>{"use strict";process.env.NODE_ENV==="production"?Fa.exports=so():Fa.exports=io()});var xT={};er(xT,{BRAND:()=>Dc,Bot:()=>pa,BotDefinition:()=>fa,BotLogger:()=>Xe,BotSpecificClient:()=>Re,DIRTY:()=>ct,EMPTY_PATH:()=>Cc,ErrorBoundary:()=>Mt,INVALID:()=>I,Integration:()=>da,IntegrationDefinition:()=>oa,IntegrationLogger:()=>Ye,IntegrationSpecificClient:()=>qt,InterfaceDefinition:()=>ga,NEVER:()=>Of,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Plugin:()=>ma,PluginDefinition:()=>ha,RuntimeError:()=>ya.RuntimeError,Schema:()=>H,WELL_KNOWN_ATTRIBUTES:()=>$_,ZodAny:()=>gr,ZodArray:()=>Ut,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>Ss,ZodEffects:()=>Je,ZodEnum:()=>bt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>Ps,ZodFunction:()=>Cs,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Is,ZodNaN:()=>Bs,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>ft,ZodNumber:()=>ea,ZodObject:()=>pt,ZodOptional:()=>Ne,ZodParsedType:()=>k,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Rs,ZodRef:()=>As,ZodSchema:()=>H,ZodSet:()=>Zs,ZodString:()=>ge,ZodSymbol:()=>Fs,ZodTransformer:()=>Je,ZodTuple:()=>gt,ZodType:()=>H,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>Ht,ZodVoid:()=>Ls,ZuiForm:()=>R_,addIssueToContext:()=>P,agent:()=>Ad,aimodel:()=>Nd,any:()=>Gd,array:()=>Qd,bigint:()=>Ld,boolean:()=>Js,botIdHeader:()=>br,botUserIdHeader:()=>Qs,coerce:()=>Sf,configurationHeader:()=>wr,configurationTypeHeader:()=>ri,conversation:()=>Id,createZodEnum:()=>yr,cuid2Regex:()=>Hs,cuidRegex:()=>Ds,custom:()=>xs,datasource:()=>jd,date:()=>zd,datetimeRegex:()=>Ks,defaultComponentDefinitions:()=>A_,discriminatedUnion:()=>nf,effect:()=>fs,emailRegex:()=>js,enum:()=>hf,errorUtil:()=>C,event:()=>Zd,fromJsonSchema:()=>Ef,fromObject:()=>xf,function:()=>ff,getErrorMap:()=>jt,getParsedType:()=>He,instanceof:()=>Kd,integrationIdHeader:()=>ei,intent:()=>Md,intersection:()=>af,ipv4Regex:()=>$s,ipv6Regex:()=>Us,isAborted:()=>rn,isApiError:()=>ya.isApiError,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Xc,isValid:()=>$t,jsonSchemaToZui:()=>Tr,knowledgebase:()=>$d,late:()=>Ud,lazy:()=>pf,literal:()=>gf,makeIssue:()=>fr,map:()=>cf,mergeObjectSchemas:()=>Vt,message:()=>Rd,messages:()=>Xs,nan:()=>Fd,nativeEnum:()=>mf,never:()=>Yd,null:()=>qd,nullable:()=>_f,number:()=>Gs,object:()=>ef,objectToZui:()=>Ft,objectUtil:()=>en,oboolean:()=>kf,onumber:()=>Pf,operationHeader:()=>Pr,optional:()=>vf,ostring:()=>wf,parseBody:()=>Se,pipeline:()=>bf,preprocess:()=>Tf,processCreateParams:()=>A,promise:()=>yf,quotelessJson:()=>xc,readonly:()=>uf,record:()=>of,ref:()=>lf,serve:()=>kr,set:()=>df,setErrorMap:()=>Es,strictObject:()=>tf,string:()=>qs,symbol:()=>Wd,table:()=>Dd,tablerow:()=>Hd,transformer:()=>fs,transforms:()=>Z_,tuple:()=>sf,typeHeader:()=>ni,ulidRegex:()=>Ms,undefined:()=>Vd,union:()=>rf,unknown:()=>Jd,user:()=>Bd,util:()=>M,uuidRegex:()=>Ns,variable:()=>Cd,void:()=>Xd,webhookIdHeader:()=>ti,withErrorBoundary:()=>Rf,z:()=>E,zuiToJsonSchema:()=>aa});module.exports=bg(xT);var Xs={};er(Xs,{defaults:()=>j_,markdown:()=>N_});var Hn=at(Ct(),1),ae=at(Ct(),1),je=at(Ct(),1),Lt=at(Ct(),1),be=at(Ct(),1),ps=Object.defineProperty,Mg=Object.defineProperties,Ng=Object.getOwnPropertyDescriptors,Yr=Object.getOwnPropertySymbols,Ko=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,oo=(t,e,r)=>e in t?ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))Ko.call(e,r)&&oo(t,r,e[r]);if(Yr)for(var r of Yr(e))Fo.call(e,r)&&oo(t,r,e[r]);return t},h=(t,e)=>Mg(t,Ng(e)),l=(t,e)=>ps(t,"name",{value:e,configurable:!0}),Lo=(t,e)=>{var r={};for(var n in t)Ko.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Yr)for(var n of Yr(t))e.indexOf(n)<0&&Fo.call(t,n)&&(r[n]=t[n]);return r},zo=(t,e)=>{for(var r in e)ps(t,r,{get:e[r],enumerable:!0})},E={};zo(E,{BRAND:()=>Dc,DIRTY:()=>ct,EMPTY_PATH:()=>Cc,INVALID:()=>I,NEVER:()=>Of,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Schema:()=>H,ZodAny:()=>gr,ZodArray:()=>Ut,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>Ss,ZodEffects:()=>Je,ZodEnum:()=>bt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>Ps,ZodFunction:()=>Cs,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Is,ZodNaN:()=>Bs,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>ft,ZodNumber:()=>ea,ZodObject:()=>pt,ZodOptional:()=>Ne,ZodParsedType:()=>k,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Rs,ZodRef:()=>As,ZodSchema:()=>H,ZodSet:()=>Zs,ZodString:()=>ge,ZodSymbol:()=>Fs,ZodTransformer:()=>Je,ZodTuple:()=>gt,ZodType:()=>H,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>Ht,ZodVoid:()=>Ls,addIssueToContext:()=>P,agent:()=>Ad,aimodel:()=>Nd,any:()=>Gd,array:()=>Qd,bigint:()=>Ld,boolean:()=>Js,coerce:()=>Sf,conversation:()=>Id,createZodEnum:()=>yr,cuid2Regex:()=>Hs,cuidRegex:()=>Ds,custom:()=>xs,datasource:()=>jd,date:()=>zd,datetimeRegex:()=>Ks,default:()=>l_,discriminatedUnion:()=>nf,effect:()=>fs,emailRegex:()=>js,enum:()=>hf,errorUtil:()=>C,event:()=>Zd,fromJsonSchema:()=>Ef,fromObject:()=>xf,function:()=>ff,getErrorMap:()=>jt,getParsedType:()=>He,instanceof:()=>Kd,intent:()=>Md,intersection:()=>af,ipv4Regex:()=>$s,ipv6Regex:()=>Us,isAborted:()=>rn,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Xc,isValid:()=>$t,jsonSchemaToZui:()=>Tr,knowledgebase:()=>$d,late:()=>Ud,lazy:()=>pf,literal:()=>gf,makeIssue:()=>fr,map:()=>cf,message:()=>Rd,nan:()=>Fd,nativeEnum:()=>mf,never:()=>Yd,null:()=>qd,nullable:()=>_f,number:()=>Gs,object:()=>ef,objectToZui:()=>Ft,objectUtil:()=>en,oboolean:()=>kf,onumber:()=>Pf,optional:()=>vf,ostring:()=>wf,pipeline:()=>bf,preprocess:()=>Tf,processCreateParams:()=>A,promise:()=>yf,quotelessJson:()=>xc,readonly:()=>uf,record:()=>of,ref:()=>lf,set:()=>df,setErrorMap:()=>Es,strictObject:()=>tf,string:()=>qs,symbol:()=>Wd,table:()=>Dd,tablerow:()=>Hd,transformer:()=>fs,tuple:()=>sf,ulidRegex:()=>Ms,undefined:()=>Vd,union:()=>rf,unknown:()=>Jd,user:()=>Bd,util:()=>M,uuidRegex:()=>Ns,variable:()=>Cd,void:()=>Xd,zuiToJsonSchema:()=>aa});var K="x-zui",Wo=(0,ae.createContext)({formData:void 0,formSchema:void 0,setFormData:l(()=>{throw new Error("Must be within a FormDataProvider")},"setFormData"),setHiddenState:l(()=>{throw new Error("Must be within a FormDataProvider")},"setHiddenState"),setDisabledState:l(()=>{throw new Error("Must be within a FormDataProvider")},"setDisabledState"),hiddenState:{},disabledState:{},validation:{formValid:null,formErrors:null}}),lo=l((t,e,r)=>{var n;let a=(n=e[K])==null?void 0:n[t];if(typeof a>"u")return!1;if(typeof a=="boolean")return a;if(typeof a=="string"){if(typeof window>"u")return console.warn("Function evaluation is not supported in server side rendering"),!1;let i=new Function("return "+a)()(r);switch(typeof i){case"object":case"boolean":return i;default:return!1}}return!1},"parseMaskableField"),Vo=l((t,e)=>{let r=(0,ae.useContext)(Wo);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ae.useMemo)(()=>lt(r.formData,e),[r.formData,e]),a=(0,ae.useMemo)(()=>{var w;return r.validation.formValid===null?{formValid:null,formErrors:null}:r.validation.formValid===!1?{formValid:!1,formErrors:((w=r.validation.formErrors)==null?void 0:w.filter(S=>Jo(S.path,e)).map(S=>({message:S.message,code:S.code,path:e})))||null}:{formValid:!0,formErrors:[]}},[r.validation.formValid,r.validation.formErrors,e]),s=r.dataTransform?r.dataTransform(n):n,i=(0,ae.useMemo)(()=>lo("hidden",t,s),[t,s]),o=(0,ae.useMemo)(()=>lo("disabled",t,s),[t,s]);(0,ae.useEffect)(()=>{r.setHiddenState(w=>It(w,e,i||{})),r.setDisabledState(w=>It(w,e,o||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:c,hidden:p}=(0,ae.useMemo)(()=>{let w=i===!0||lt(r.hiddenState,e),S=o===!0||lt(r.disabledState,e);return{hidden:w===!0,disabled:S===!0}},[r.hiddenState,r.disabledState,i,o,e]),m=(0,ae.useCallback)((w,S)=>{r.setFormData(W=>It(W,w,S))},[r.setFormData]),T=(0,ae.useCallback)((w,S=void 0)=>{let W=Dt(t.items);r.setFormData(q=>{let re=lt(q,w)||[];return S===void 0&&(S=W),It(q,w,Array.isArray(re)?[...re,S]:[S])})},[r.setFormData]),O=(0,ae.useCallback)((w,S)=>{r.setFormData(W=>{let q=lt(W,w)||[];return Array.isArray(q)?(q.splice(S,1),It(W,w,q)):W})},[r.setFormData]);return d(h(d({},r),{data:n,disabled:c,hidden:p,handlePropertyChange:m,addArrayItem:T,removeArrayItem:O}),a)},"useFormData");function It(t,e,r){if(e.length===0)return r;let n=e.length;return e.reduce((a,s,i)=>(i===n-1?a[s]=r:a[s]||(a[s]=isNaN(Number(s))?{}:[]),a[s]),t??{}),d({},t)}l(It,"setObjectPath");var Dt=l((t,e)=>{var r,n,a,s;if(Array.isArray(t))return Dt(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return Dt(t.anyOf[0]);if(t.type==="object"&&t.properties){let i={};return Object.entries(t.properties).map(([o,c])=>{var p;i[o]=Dt(c,!((p=t.required)!=null&&p.includes(o))||qo(c)||!1)}),i}if(t.type==="array")return t.minItems&&t.minItems>0?[Dt(t.items)]:[];if(t.type==="string")return(n=t.enum)!=null&&n.length?t.enum[0]:"";if(t.type==="number")return(a=t.enum)!=null&&a.length?t.enum[0]:0;if(t.type==="boolean")return(s=t.enum)!=null&&s.length?t.enum[0]:!1}},"getDefaultValues"),jg=l(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:i})=>{let[o,c]=(0,ae.useState)({}),[p,m]=(0,ae.useState)({}),T=i?i(r):r,O=(0,ae.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let w=Tr(n).safeParse(T);return w.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:w.error.issues}},[JSON.stringify({transformedData:T})]);return(0,ae.useEffect)(()=>{s&&s(O)},[O]),ae.default.createElement(Wo.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:O,hiddenState:o,setHiddenState:c,disabledState:p,setDisabledState:m,dataTransform:i}},t)},"FormDataProvider");function lt(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}l(lt,"getPathData");function qo(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}l(qo,"isOptional");function Xr(t,e){let r=d({},t);for(let n in e)e.hasOwnProperty(n)&&(typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?typeof r[n]=="object"&&r[n]!==null&&!Array.isArray(r[n])?r[n]=Xr(r[n],e[n]):r[n]=Xr({},e[n]):r[n]=e[n]);return r}l(Xr,"deepMerge");var $g=l((t,e)=>{let{handlePropertyChange:r,data:n}=Vo(t,e),{discriminator:a,value:s,discriminatedSchema:i}=(0,Hn.useMemo)(()=>{let o=Go(t.anyOf),c=o?.key?n?.[o.key]:t.default||null,p=Ug(o?.key||null,c,t.anyOf);return{discriminator:o,value:c,discriminatedSchema:p}},[t.anyOf,n]);return(0,Hn.useEffect)(()=>{a?.key&&a?.values.length&&Object.keys(n||{}).length<1&&!t.default&&r(e,{[a.key]:a.values[0]})},[]),{discriminator:a,discriminatorValue:s,discriminatedSchema:i}},"useDiscriminator"),Go=l(t=>{let e=t?.map(r=>r.type!=="object"||!r.properties?null:Object.entries(r.properties).map(([n,a])=>{var s;return a.type==="string"&&((s=a.enum)!=null&&s.length)?{key:n,value:a.enum[0]}:null}).filter(n=>!!n)).flat().reduce((r,n)=>{if(!n)return r;let{key:a,value:s}=n;return r.key===null&&(r.key=a),r.key===a&&r.values.push(s),r},{key:null,values:[]});return e?.key===null||!e?.values.length?null:e},"resolveDiscriminator"),Ug=l((t,e,r)=>{var n,a;if(!r?.length||!t||!e)return null;for(let s of r){if(s.type!=="object")continue;let i=(n=s.properties)==null?void 0:n[t];if(i?.type==="string"&&((a=i.enum)!=null&&a.length)&&i.enum[0]===e)return h(d({},s),{properties:h(d({},s.properties),{[t]:h(d({},i),{[K]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),Kg=l(t=>{var e;return(e=t.anyOf)!=null&&e.length?Go(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),Fg=l((t,e)=>{var r,n,a;let s=Kg(e),i=((r=e[K])==null?void 0:r.displayAs)||null;if(!i||!Array.isArray(i)||i.length<2){let m=(n=t?.[s])==null?void 0:n.default;return m?{Component:m,type:s,id:"default",params:{}}:null}let o=i[0],c=((a=t?.[s])==null?void 0:a[o])||null;if(!c)return console.warn(`Component ${s}.${o} not found`),null;let p=i[1]||{};return{Component:c,type:s,id:o,params:p}},"resolveComponent");function Jo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}l(Jo,"pathMatches");function qa(t,e){return e||(e=new RegExp("/s|-|_| ","g")),Qo(t).split(e).map(Yo).map(el).reduce(Xo)}l(qa,"formatTitle");function Yo(t){return t.charAt(0).toUpperCase()+t.substring(1)}l(Yo,"capitalize");function Xo(t,e){return`${t} ${e}`}l(Xo,"combine");function Qo(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}l(Qo,"decamelize");function el(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of qg)if(s.toLowerCase()===n)return s;return Lg.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:Vg.includes(n)||Wg.includes(n)||zg.includes(n)?n:t}l(el,"handleSpecialWords");var Lg=["2D","3D","4WD","A2O","API","BIOS","CCTV","CC","CCV","CD","CD-ROM","COBOL","CIA","CMS","CSS","CSV","CV","DIY","DVD","DB","DNA","E3","EIN","ESPN","FAQ","FAQs","FTP","FPS","FORTRAN","FBI","HTML","HTTP","ID","IP","ISO","JS","JSON","LASER","M2A","M2M","M2MM","M2O","MMORPG","NAFTA","NASA","NDA","O2M","PDF","PHP","POP","RAM","RNGR","ROM","RPG","RTFM","RTS","SCUBA","SITCOM","SKU","SMTP","SQL","SSN","SWAT","TBS","TTL","TV","TNA","UI","URL","USB","UWP","VIP","W3C","WYSIWYG","WWW","WWE","WWF"],zg=["a","an","the"],Wg=["and","that","but","or","as","if","when","than","because","while","where","after","so","though","since","until","whether","before","although","nor","like","once","unless","now","except"],Vg=["about","above","across","after","against","along","among","around","at","because of","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","despite","down","during","except","excepting","for","from","in","in front of","inside","in spite of","instead of","into","like","near","of","off","on","onto","out","outside","over","past","regarding","since","through","throughout","to","toward","under","underneath","until","up","upon","up to","with","within","without","with regard to","with respect to"],qg=["2FA","3D","4K","5K","8K","AGI","BI","ChatGPT","CTA","DateTime","GitHub","GPT","HD","IBMid","ID","IDs","iMac","IMAX","iOS","IP","iPad","iPhone","iPod","LDAP","LinkedIn","LLM","M2M","M2O","macOS","McDonalds","ML","MySQL","NLG","NLP","NLU","O2M","OpenAI","PDFs","PEFT","pH","PostgreSQL","SEO","TTS","UHD","UUID","XSS","YouTube"];function tl(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:Me(t)}l(tl,"primitiveToTypscriptLiteralType");function Me(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${Me(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}l(Me,"primitiveToTypescriptValue");function rl(t){return typeof t>"u"?"undefined":JSON.stringify(t)}l(rl,"unknownToTypescriptValue");var uo=l(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:Me(t),"toPropertyKey"),Gg=l(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),nl=l(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(Gg).filter(n=>!!n).join("")},"toTypeArgumentName"),R=l(t=>{let e=(t??"").split(`
|
|
1
|
+
"use strict";var cu=Object.create;var Gt=Object.defineProperty;var du=Object.getOwnPropertyDescriptor;var uu=Object.getOwnPropertyNames;var pu=Object.getPrototypeOf,fu=Object.prototype.hasOwnProperty;var ht=(t,e)=>{for(var r in e)Gt(t,r,{get:e[r],enumerable:!0})},Fs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of uu(e))!fu.call(t,s)&&s!==r&&Gt(t,s,{get:()=>e[s],enumerable:!(n=du(e,s))||n.enumerable});return t};var zs=(t,e,r)=>(r=t!=null?cu(pu(t)):{},Fs(e||!t||!t.__esModule?Gt(r,"default",{value:t,enumerable:!0}):r,t)),gu=t=>Fs(Gt({},"__esModule",{value:!0}),t);var Lm={};ht(Lm,{BRAND:()=>$l,Bot:()=>wn,BotDefinition:()=>bn,BotLogger:()=>Pe,BotSpecificClient:()=>ce,DIRTY:()=>Re,EMPTY_PATH:()=>Cl,INVALID:()=>P,Integration:()=>Tn,IntegrationDefinition:()=>hn,IntegrationLogger:()=>we,IntegrationSpecificClient:()=>ft,InterfaceDefinition:()=>Pn,NEVER:()=>td,OK:()=>J,ParseInputLazyPath:()=>ie,ParseStatus:()=>te,Plugin:()=>kn,PluginDefinition:()=>xn,RuntimeError:()=>Sn.RuntimeError,Schema:()=>E,WELL_KNOWN_ATTRIBUTES:()=>am,ZodAny:()=>ot,ZodArray:()=>lt,ZodBigInt:()=>en,ZodBoolean:()=>tn,ZodBranded:()=>rn,ZodCatch:()=>nn,ZodDate:()=>sn,ZodDefault:()=>jt,ZodDiscriminatedUnion:()=>us,ZodEffects:()=>be,ZodEnum:()=>We,ZodError:()=>le,ZodFirstPartyTypeKind:()=>os,ZodFunction:()=>fs,ZodIntersection:()=>an,ZodIssueCode:()=>y,ZodLazy:()=>on,ZodLiteral:()=>ln,ZodMap:()=>gs,ZodNaN:()=>ys,ZodNativeEnum:()=>cn,ZodNever:()=>ut,ZodNull:()=>dn,ZodNullable:()=>De,ZodNumber:()=>un,ZodObject:()=>Me,ZodOptional:()=>fe,ZodParsedType:()=>v,ZodPipeline:()=>pn,ZodPromise:()=>Ut,ZodReadonly:()=>Ft,ZodRecord:()=>hs,ZodRef:()=>ms,ZodSchema:()=>E,ZodSet:()=>vs,ZodString:()=>X,ZodSymbol:()=>Ss,ZodTransformer:()=>be,ZodTuple:()=>Ne,ZodType:()=>E,ZodUndefined:()=>zt,ZodUnion:()=>fn,ZodUnknown:()=>nt,ZodVoid:()=>Es,addIssueToContext:()=>m,agent:()=>cc,aimodel:()=>gc,any:()=>kc,array:()=>Zc,bigint:()=>Tc,boolean:()=>Bs,botIdHeader:()=>Lt,botUserIdHeader:()=>Rs,coerce:()=>ed,configurationHeader:()=>Wt,configurationTypeHeader:()=>Ms,conversation:()=>ic,createZodEnum:()=>Kt,cuid2Regex:()=>Ts,cuidRegex:()=>_s,custom:()=>ds,datasource:()=>yc,date:()=>bc,discriminatedUnion:()=>Ac,effect:()=>Fn,emailRegex:()=>Ps,enum:()=>zc,errorUtil:()=>w,event:()=>dc,function:()=>Kc,getErrorMap:()=>at,getParsedType:()=>pe,instanceof:()=>vc,integrationIdHeader:()=>Hs,intent:()=>fc,intersection:()=>Rc,ipv4Regex:()=>xs,ipv6Regex:()=>ks,isAborted:()=>dr,isApiError:()=>Sn.isApiError,isAsync:()=>Mt,isDirty:()=>ur,isEmojiRegex:()=>Ql,isValid:()=>it,knowledgebase:()=>hc,late:()=>mc,lazy:()=>Uc,literal:()=>Fc,makeIssue:()=>Dt,map:()=>$c,mergeObjectSchemas:()=>pt,message:()=>lc,messages:()=>As,nan:()=>_c,nativeEnum:()=>Lc,never:()=>Ec,null:()=>xc,nullable:()=>Vc,number:()=>Zs,object:()=>Bc,objectUtil:()=>lr,oboolean:()=>Qc,onumber:()=>Yc,operationHeader:()=>qt,optional:()=>qc,ostring:()=>Xc,parseBody:()=>oe,pipeline:()=>Jc,preprocess:()=>Gc,processCreateParams:()=>k,promise:()=>Wc,quotelessJson:()=>Zl,readonly:()=>Nc,record:()=>Dc,ref:()=>Mc,serve:()=>Vt,set:()=>jc,setErrorMap:()=>cs,strictObject:()=>Ic,string:()=>Os,symbol:()=>wc,table:()=>uc,tablerow:()=>pc,transformer:()=>Fn,transforms:()=>Ba,tuple:()=>Hc,typeHeader:()=>Ns,ulidRegex:()=>bs,undefined:()=>Pc,union:()=>Cc,unknown:()=>Sc,user:()=>oc,util:()=>Z,uuidRegex:()=>ws,variable:()=>ac,void:()=>Oc,webhookIdHeader:()=>Ds,z:()=>_});module.exports=gu(Lm);var As={};ht(As,{defaults:()=>sm,markdown:()=>nm});var Wn=Object.defineProperty,yu=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,or=Object.getOwnPropertySymbols,Ea=Object.prototype.hasOwnProperty,Oa=Object.prototype.propertyIsEnumerable,Ls=(t,e,r)=>e in t?Wn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c=(t,e)=>{for(var r in e||(e={}))Ea.call(e,r)&&Ls(t,r,e[r]);if(or)for(var r of or(e))Oa.call(e,r)&&Ls(t,r,e[r]);return t},p=(t,e)=>yu(t,hu(e)),i=(t,e)=>Wn(t,"name",{value:e,configurable:!0}),Za=(t,e)=>{var r={};for(var n in t)Ea.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&or)for(var n of or(t))e.indexOf(n)<0&&Oa.call(t,n)&&(r[n]=t[n]);return r},Fr=(t,e)=>{for(var r in e)Wn(t,r,{get:e[r],enumerable:!0})},Ba={};Fr(Ba,{errors:()=>Ra,fromJSONSchema:()=>ad,fromJSONSchemaLegacy:()=>Eh,fromObject:()=>zn,toJSONSchema:()=>V,toJSONSchemaLegacy:()=>Qh,toTypescriptSchema:()=>ss,toTypescriptType:()=>qn});var _={};Fr(_,{BRAND:()=>$l,DIRTY:()=>Re,EMPTY_PATH:()=>Cl,INVALID:()=>P,NEVER:()=>td,OK:()=>J,ParseInputLazyPath:()=>ie,ParseStatus:()=>te,Schema:()=>E,ZodAny:()=>ot,ZodArray:()=>lt,ZodBigInt:()=>en,ZodBoolean:()=>tn,ZodBranded:()=>rn,ZodCatch:()=>nn,ZodDate:()=>sn,ZodDefault:()=>jt,ZodDiscriminatedUnion:()=>us,ZodEffects:()=>be,ZodEnum:()=>We,ZodError:()=>le,ZodFirstPartyTypeKind:()=>os,ZodFunction:()=>fs,ZodIntersection:()=>an,ZodIssueCode:()=>y,ZodLazy:()=>on,ZodLiteral:()=>ln,ZodMap:()=>gs,ZodNaN:()=>ys,ZodNativeEnum:()=>cn,ZodNever:()=>ut,ZodNull:()=>dn,ZodNullable:()=>De,ZodNumber:()=>un,ZodObject:()=>Me,ZodOptional:()=>fe,ZodParsedType:()=>v,ZodPipeline:()=>pn,ZodPromise:()=>Ut,ZodReadonly:()=>Ft,ZodRecord:()=>hs,ZodRef:()=>ms,ZodSchema:()=>E,ZodSet:()=>vs,ZodString:()=>X,ZodSymbol:()=>Ss,ZodTransformer:()=>be,ZodTuple:()=>Ne,ZodType:()=>E,ZodUndefined:()=>zt,ZodUnion:()=>fn,ZodUnknown:()=>nt,ZodVoid:()=>Es,addIssueToContext:()=>m,agent:()=>cc,aimodel:()=>gc,any:()=>kc,array:()=>Zc,bigint:()=>Tc,boolean:()=>Bs,coerce:()=>ed,conversation:()=>ic,createZodEnum:()=>Kt,cuid2Regex:()=>Ts,cuidRegex:()=>_s,custom:()=>ds,datasource:()=>yc,date:()=>bc,default:()=>nh,discriminatedUnion:()=>Ac,effect:()=>Fn,emailRegex:()=>Ps,enum:()=>zc,errorUtil:()=>w,event:()=>dc,function:()=>Kc,getErrorMap:()=>at,getParsedType:()=>pe,instanceof:()=>vc,intent:()=>fc,intersection:()=>Rc,ipv4Regex:()=>xs,ipv6Regex:()=>ks,isAborted:()=>dr,isAsync:()=>Mt,isDirty:()=>ur,isEmojiRegex:()=>Ql,isValid:()=>it,knowledgebase:()=>hc,late:()=>mc,lazy:()=>Uc,literal:()=>Fc,makeIssue:()=>Dt,map:()=>$c,message:()=>lc,nan:()=>_c,nativeEnum:()=>Lc,never:()=>Ec,null:()=>xc,nullable:()=>Vc,number:()=>Zs,object:()=>Bc,objectUtil:()=>lr,oboolean:()=>Qc,onumber:()=>Yc,optional:()=>qc,ostring:()=>Xc,pipeline:()=>Jc,preprocess:()=>Gc,processCreateParams:()=>k,promise:()=>Wc,quotelessJson:()=>Zl,readonly:()=>Nc,record:()=>Dc,ref:()=>Mc,set:()=>jc,setErrorMap:()=>cs,strictObject:()=>Ic,string:()=>Os,symbol:()=>wc,table:()=>uc,tablerow:()=>pc,transformer:()=>Fn,tuple:()=>Hc,ulidRegex:()=>bs,undefined:()=>Pc,union:()=>Cc,unknown:()=>Sc,user:()=>oc,util:()=>Z,uuidRegex:()=>ws,variable:()=>ac,void:()=>Oc});var b="x-zui";function Ia(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:T(t)}i(Ia,"primitiveToTypscriptLiteralType");function T(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${T(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}i(T,"primitiveToTypescriptValue");function tt(t){return typeof t>"u"?"undefined":JSON.stringify(t)}i(tt,"unknownToTypescriptValue");var Ca=i((t,e)=>{let r=Object.entries(t),n=e?" as const":"";return`{ ${r.map(([s,a])=>`${An(s)}: ${tt(a)}`).join(", ")} }${n}`},"recordOfUnknownToTypescriptRecord"),An=i(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:T(t),"toPropertyKey"),mu=i(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Aa=i(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(mu).filter(n=>!!n).join("")},"toTypeArgumentName"),F=i(t=>{let e=(t??"").split(`
|
|
24
2
|
`).filter(r=>r.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
|
|
25
3
|
* ${e.join(`
|
|
26
4
|
* `)}
|
|
27
|
-
*/`},"getMultilineComment"),
|
|
28
|
-
`:"",
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
(${
|
|
32
|
-
${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(Me).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return z(o.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new yl(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${z(o.innerType,s)} | undefined`;case v.ZodFirstPartyTypeKind.ZodNullable:return`${z(o.innerType,s)} | null`;case v.ZodFirstPartyTypeKind.ZodDefault:return z(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodCatch:return z(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${z(o.type,s)}>`;case v.ZodFirstPartyTypeKind.ZodBranded:return z(o.type,s);case v.ZodFirstPartyTypeKind.ZodPipeline:return z(o.in,s);case v.ZodFirstPartyTypeKind.ZodSymbol:return`${R(o.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${z(o.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return nl(o.uri);default:M.assertNever(o)}}l(z,"sUnwrapZod");var Qg=l((t,e)=>{if(t.props.type==="none")return z(t.props.schema,e);let r=R(t.props.schema.description),n=t.props.schema.describe(""),a=z(n,e);if(t.props.type==="variable")return co(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(nl).join(", ")}>`:"";return co(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),eh=l(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),th=l((t,e)=>{let r=eh(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new Ja;return new Fr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new _l;if(r==="variable"){if(n.length>0)throw new Ja;return new Fr({type:"variable",identifier:a,schema:t})}return new Fr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),rh=typeof global=="object"&&global&&global.Object===Object&&global,xl=rh,nh=typeof self=="object"&&self&&self.Object===Object&&self,ah=xl||nh||Function("return this")(),Ue=ah,sh=Ue.Symbol,Ve=sh,Sl=Object.prototype,ih=Sl.hasOwnProperty,oh=Sl.toString,rr=Ve?Ve.toStringTag:void 0;function Ol(t){var e=ih.call(t,rr),r=t[rr];try{t[rr]=void 0;var n=!0}catch{}var a=oh.call(t);return n&&(e?t[rr]=r:delete t[rr]),a}l(Ol,"getRawTag");var lh=Ol,uh=Object.prototype,ch=uh.toString;function Cl(t){return ch.call(t)}l(Cl,"objectToString");var dh=Cl,fh="[object Null]",ph="[object Undefined]",go=Ve?Ve.toStringTag:void 0;function Il(t){return t==null?t===void 0?ph:fh:go&&go in Object(t)?lh(t):dh(t)}l(Il,"baseGetTag");var Wt=Il;function Bl(t){return t!=null&&typeof t=="object"}l(Bl,"isObjectLike");var Nt=Bl,gh="[object Symbol]";function Rl(t){return typeof t=="symbol"||Nt(t)&&Wt(t)==gh}l(Rl,"isSymbol");var gs=Rl;function Al(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}l(Al,"arrayMap");var hh=Al,mh=Array.isArray,$e=mh,yh=1/0,ho=Ve?Ve.prototype:void 0,mo=ho?ho.toString:void 0;function hs(t){if(typeof t=="string")return t;if($e(t))return hh(t,hs)+"";if(gs(t))return mo?mo.call(t):"";var e=t+"";return e=="0"&&1/t==-yh?"-0":e}l(hs,"baseToString");var vh=hs;function Zl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}l(Zl,"isObject");var ms=Zl;function Dl(t){return t}l(Dl,"identity");var _h=Dl,Th="[object AsyncFunction]",bh="[object Function]",wh="[object GeneratorFunction]",Ph="[object Proxy]";function Hl(t){if(!ms(t))return!1;var e=Wt(t);return e==bh||e==wh||e==Th||e==Ph}l(Hl,"isFunction");var Ml=Hl,kh=Ue["__core-js_shared__"],La=kh,yo=function(){var t=/[^.]+$/.exec(La&&La.keys&&La.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Nl(t){return!!yo&&yo in t}l(Nl,"isMasked");var Eh=Nl,xh=Function.prototype,Sh=xh.toString;function jl(t){if(t!=null){try{return Sh.call(t)}catch{}try{return t+""}catch{}}return""}l(jl,"toSource");var ht=jl,Oh=/[\\^$.*+?()[\]{}|]/g,Ch=/^\[object .+?Constructor\]$/,Ih=Function.prototype,Bh=Object.prototype,Rh=Ih.toString,Ah=Bh.hasOwnProperty,Zh=RegExp("^"+Rh.call(Ah).replace(Oh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $l(t){if(!ms(t)||Eh(t))return!1;var e=Ml(t)?Zh:Ch;return e.test(ht(t))}l($l,"baseIsNative");var Dh=$l;function Ul(t,e){return t?.[e]}l(Ul,"getValue");var Hh=Ul;function Kl(t,e){var r=Hh(t,e);return Dh(r)?r:void 0}l(Kl,"getNative");var mt=Kl,Mh=mt(Ue,"WeakMap"),Ya=Mh,Nh=function(){try{var t=mt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),vo=Nh,jh=9007199254740991,$h=/^(?:0|[1-9]\d*)$/;function Fl(t,e){var r=typeof t;return e=e??jh,!!e&&(r=="number"||r!="symbol"&&$h.test(t))&&t>-1&&t%1==0&&t<e}l(Fl,"isIndex");var Ll=Fl;function zl(t,e,r){e=="__proto__"&&vo?vo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}l(zl,"baseAssignValue");var Uh=zl;function Wl(t,e){return t===e||t!==t&&e!==e}l(Wl,"eq");var Vl=Wl,Kh=9007199254740991;function ql(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Kh}l(ql,"isLength");var ys=ql;function Gl(t){return t!=null&&ys(t.length)&&!Ml(t)}l(Gl,"isArrayLike");var Fh=Gl,Lh=Object.prototype;function Jl(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Lh;return t===r}l(Jl,"isPrototype");var zh=Jl;function Yl(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}l(Yl,"baseTimes");var Wh=Yl,Vh="[object Arguments]";function Xl(t){return Nt(t)&&Wt(t)==Vh}l(Xl,"baseIsArguments");var _o=Xl,Ql=Object.prototype,qh=Ql.hasOwnProperty,Gh=Ql.propertyIsEnumerable,Jh=_o(function(){return arguments}())?_o:function(t){return Nt(t)&&qh.call(t,"callee")&&!Gh.call(t,"callee")},eu=Jh;function tu(){return!1}l(tu,"stubFalse");var Yh=tu,ru=typeof exports=="object"&&exports&&!exports.nodeType&&exports,To=ru&&typeof module=="object"&&module&&!module.nodeType&&module,Xh=To&&To.exports===ru,bo=Xh?Ue.Buffer:void 0,Qh=bo?bo.isBuffer:void 0,em=Qh||Yh,Xa=em,tm="[object Arguments]",rm="[object Array]",nm="[object Boolean]",am="[object Date]",sm="[object Error]",im="[object Function]",om="[object Map]",lm="[object Number]",um="[object Object]",cm="[object RegExp]",dm="[object Set]",fm="[object String]",pm="[object WeakMap]",gm="[object ArrayBuffer]",hm="[object DataView]",mm="[object Float32Array]",ym="[object Float64Array]",vm="[object Int8Array]",_m="[object Int16Array]",Tm="[object Int32Array]",bm="[object Uint8Array]",wm="[object Uint8ClampedArray]",Pm="[object Uint16Array]",km="[object Uint32Array]",X={};X[mm]=X[ym]=X[vm]=X[_m]=X[Tm]=X[bm]=X[wm]=X[Pm]=X[km]=!0;X[tm]=X[rm]=X[gm]=X[nm]=X[hm]=X[am]=X[sm]=X[im]=X[om]=X[lm]=X[um]=X[cm]=X[dm]=X[fm]=X[pm]=!1;function nu(t){return Nt(t)&&ys(t.length)&&!!X[Wt(t)]}l(nu,"baseIsTypedArray");var Em=nu;function au(t){return function(e){return t(e)}}l(au,"baseUnary");var xm=au,su=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lr=su&&typeof module=="object"&&module&&!module.nodeType&&module,Sm=lr&&lr.exports===su,za=Sm&&xl.process,Om=function(){try{var t=lr&&lr.require&&lr.require("util").types;return t||za&&za.binding&&za.binding("util")}catch{}}(),wo=Om,Po=wo&&wo.isTypedArray,Cm=Po?xm(Po):Em,iu=Cm,Im=Object.prototype,Bm=Im.hasOwnProperty;function ou(t,e){var r=$e(t),n=!r&&eu(t),a=!r&&!n&&Xa(t),s=!r&&!n&&!a&&iu(t),i=r||n||a||s,o=i?Wh(t.length,String):[],c=o.length;for(var p in t)(e||Bm.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ll(p,c)))&&o.push(p);return o}l(ou,"arrayLikeKeys");var Rm=ou;function lu(t,e){return function(r){return t(e(r))}}l(lu,"overArg");var Am=lu,Zm=Am(Object.keys,Object),Dm=Zm,Hm=Object.prototype,Mm=Hm.hasOwnProperty;function uu(t){if(!zh(t))return Dm(t);var e=[];for(var r in Object(t))Mm.call(t,r)&&r!="constructor"&&e.push(r);return e}l(uu,"baseKeys");var Nm=uu;function cu(t){return Fh(t)?Rm(t):Nm(t)}l(cu,"keys");var vs=cu,jm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$m=/^\w*$/;function du(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||gs(t)?!0:$m.test(t)||!jm.test(t)||e!=null&&t in Object(e)}l(du,"isKey");var _s=du,Um=mt(Object,"create"),ur=Um;function fu(){this.__data__=ur?ur(null):{},this.size=0}l(fu,"hashClear");var Km=fu;function pu(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}l(pu,"hashDelete");var Fm=pu,Lm="__lodash_hash_undefined__",zm=Object.prototype,Wm=zm.hasOwnProperty;function gu(t){var e=this.__data__;if(ur){var r=e[t];return r===Lm?void 0:r}return Wm.call(e,t)?e[t]:void 0}l(gu,"hashGet");var Vm=gu,qm=Object.prototype,Gm=qm.hasOwnProperty;function hu(t){var e=this.__data__;return ur?e[t]!==void 0:Gm.call(e,t)}l(hu,"hashHas");var Jm=hu,Ym="__lodash_hash_undefined__";function mu(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ur&&e===void 0?Ym:e,this}l(mu,"hashSet");var Xm=mu;function yt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(yt,"Hash");yt.prototype.clear=Km;yt.prototype.delete=Fm;yt.prototype.get=Vm;yt.prototype.has=Jm;yt.prototype.set=Xm;var ko=yt;function yu(){this.__data__=[],this.size=0}l(yu,"listCacheClear");var Qm=yu;function vu(t,e){for(var r=t.length;r--;)if(Vl(t[r][0],e))return r;return-1}l(vu,"assocIndexOf");var Nn=vu,ey=Array.prototype,ty=ey.splice;function _u(t){var e=this.__data__,r=Nn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ty.call(e,r,1),--this.size,!0}l(_u,"listCacheDelete");var ry=_u;function Tu(t){var e=this.__data__,r=Nn(e,t);return r<0?void 0:e[r][1]}l(Tu,"listCacheGet");var ny=Tu;function bu(t){return Nn(this.__data__,t)>-1}l(bu,"listCacheHas");var ay=bu;function wu(t,e){var r=this.__data__,n=Nn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}l(wu,"listCacheSet");var sy=wu;function vt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(vt,"ListCache");vt.prototype.clear=Qm;vt.prototype.delete=ry;vt.prototype.get=ny;vt.prototype.has=ay;vt.prototype.set=sy;var jn=vt,iy=mt(Ue,"Map"),cr=iy;function Pu(){this.size=0,this.__data__={hash:new ko,map:new(cr||jn),string:new ko}}l(Pu,"mapCacheClear");var oy=Pu;function ku(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}l(ku,"isKeyable");var ly=ku;function Eu(t,e){var r=t.__data__;return ly(e)?r[typeof e=="string"?"string":"hash"]:r.map}l(Eu,"getMapData");var $n=Eu;function xu(t){var e=$n(this,t).delete(t);return this.size-=e?1:0,e}l(xu,"mapCacheDelete");var uy=xu;function Su(t){return $n(this,t).get(t)}l(Su,"mapCacheGet");var cy=Su;function Ou(t){return $n(this,t).has(t)}l(Ou,"mapCacheHas");var dy=Ou;function Cu(t,e){var r=$n(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}l(Cu,"mapCacheSet");var fy=Cu;function _t(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(_t,"MapCache");_t.prototype.clear=oy;_t.prototype.delete=uy;_t.prototype.get=cy;_t.prototype.has=dy;_t.prototype.set=fy;var Un=_t,py="Expected a function";function Kn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(py);var r=l(function(){var n=arguments,a=e?e.apply(this,n):n[0],s=r.cache;if(s.has(a))return s.get(a);var i=t.apply(this,n);return r.cache=s.set(a,i)||s,i},"memoized");return r.cache=new(Kn.Cache||Un),r}l(Kn,"memoize");Kn.Cache=Un;var gy=Kn,hy=500;function Iu(t){var e=gy(t,function(n){return r.size===hy&&r.clear(),n}),r=e.cache;return e}l(Iu,"memoizeCapped");var my=Iu,yy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vy=/\\(\\)?/g,_y=my(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(yy,function(r,n,a,s){e.push(a?s.replace(vy,"$1"):n||r)}),e}),Ty=_y;function Bu(t){return t==null?"":vh(t)}l(Bu,"toString");var by=Bu;function Ru(t,e){return $e(t)?t:_s(t,e)?[t]:Ty(by(t))}l(Ru,"castPath");var Au=Ru,wy=1/0;function Zu(t){if(typeof t=="string"||gs(t))return t;var e=t+"";return e=="0"&&1/t==-wy?"-0":e}l(Zu,"toKey");var Fn=Zu;function Du(t,e){e=Au(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Fn(e[r++])];return r&&r==n?t:void 0}l(Du,"baseGet");var Hu=Du;function Mu(t,e,r){var n=t==null?void 0:Hu(t,e);return n===void 0?r:n}l(Mu,"get");var Py=Mu;function Nu(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}l(Nu,"arrayPush");var ky=Nu;function ju(){this.__data__=new jn,this.size=0}l(ju,"stackClear");var Ey=ju;function $u(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}l($u,"stackDelete");var xy=$u;function Uu(t){return this.__data__.get(t)}l(Uu,"stackGet");var Sy=Uu;function Ku(t){return this.__data__.has(t)}l(Ku,"stackHas");var Oy=Ku,Cy=200;function Fu(t,e){var r=this.__data__;if(r instanceof jn){var n=r.__data__;if(!cr||n.length<Cy-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Un(n)}return r.set(t,e),this.size=r.size,this}l(Fu,"stackSet");var Iy=Fu;function Tt(t){var e=this.__data__=new jn(t);this.size=e.size}l(Tt,"Stack");Tt.prototype.clear=Ey;Tt.prototype.delete=xy;Tt.prototype.get=Sy;Tt.prototype.has=Oy;Tt.prototype.set=Iy;var Lr=Tt;function Lu(t,e){for(var r=-1,n=t==null?0:t.length,a=0,s=[];++r<n;){var i=t[r];e(i,r,t)&&(s[a++]=i)}return s}l(Lu,"arrayFilter");var By=Lu;function zu(){return[]}l(zu,"stubArray");var Ry=zu,Ay=Object.prototype,Zy=Ay.propertyIsEnumerable,Eo=Object.getOwnPropertySymbols,Dy=Eo?function(t){return t==null?[]:(t=Object(t),By(Eo(t),function(e){return Zy.call(t,e)}))}:Ry,Hy=Dy;function Wu(t,e,r){var n=e(t);return $e(t)?n:ky(n,r(t))}l(Wu,"baseGetAllKeys");var My=Wu;function Vu(t){return My(t,vs,Hy)}l(Vu,"getAllKeys");var xo=Vu,Ny=mt(Ue,"DataView"),Qa=Ny,jy=mt(Ue,"Promise"),es=jy,$y=mt(Ue,"Set"),ts=$y,So="[object Map]",Uy="[object Object]",Oo="[object Promise]",Co="[object Set]",Io="[object WeakMap]",Bo="[object DataView]",Ky=ht(Qa),Fy=ht(cr),Ly=ht(es),zy=ht(ts),Wy=ht(Ya),ot=Wt;(Qa&&ot(new Qa(new ArrayBuffer(1)))!=Bo||cr&&ot(new cr)!=So||es&&ot(es.resolve())!=Oo||ts&&ot(new ts)!=Co||Ya&&ot(new Ya)!=Io)&&(ot=l(function(t){var e=Wt(t),r=e==Uy?t.constructor:void 0,n=r?ht(r):"";if(n)switch(n){case Ky:return Bo;case Fy:return So;case Ly:return Oo;case zy:return Co;case Wy:return Io}return e},"getTag"));var Ro=ot,Vy=Ue.Uint8Array,Ao=Vy,qy="__lodash_hash_undefined__";function qu(t){return this.__data__.set(t,qy),this}l(qu,"setCacheAdd");var Gy=qu;function Gu(t){return this.__data__.has(t)}l(Gu,"setCacheHas");var Jy=Gu;function dr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Un;++e<r;)this.add(t[e])}l(dr,"SetCache");dr.prototype.add=dr.prototype.push=Gy;dr.prototype.has=Jy;var Yy=dr;function Ju(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}l(Ju,"arraySome");var Xy=Ju;function Yu(t,e){return t.has(e)}l(Yu,"cacheHas");var Qy=Yu,ev=1,tv=2;function Xu(t,e,r,n,a,s){var i=r&ev,o=t.length,c=e.length;if(o!=c&&!(i&&c>o))return!1;var p=s.get(t),m=s.get(e);if(p&&m)return p==e&&m==t;var T=-1,O=!0,w=r&tv?new Yy:void 0;for(s.set(t,e),s.set(e,t);++T<o;){var S=t[T],W=e[T];if(n)var q=i?n(W,S,T,e,t,s):n(S,W,T,t,e,s);if(q!==void 0){if(q)continue;O=!1;break}if(w){if(!Xy(e,function(re,J){if(!Qy(w,J)&&(S===re||a(S,re,r,n,s)))return w.push(J)})){O=!1;break}}else if(!(S===W||a(S,W,r,n,s))){O=!1;break}}return s.delete(t),s.delete(e),O}l(Xu,"equalArrays");var Qu=Xu;function ec(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}l(ec,"mapToArray");var rv=ec;function tc(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}l(tc,"setToArray");var nv=tc,av=1,sv=2,iv="[object Boolean]",ov="[object Date]",lv="[object Error]",uv="[object Map]",cv="[object Number]",dv="[object RegExp]",fv="[object Set]",pv="[object String]",gv="[object Symbol]",hv="[object ArrayBuffer]",mv="[object DataView]",Zo=Ve?Ve.prototype:void 0,Wa=Zo?Zo.valueOf:void 0;function rc(t,e,r,n,a,s,i){switch(r){case mv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hv:return!(t.byteLength!=e.byteLength||!s(new Ao(t),new Ao(e)));case iv:case ov:case cv:return Vl(+t,+e);case lv:return t.name==e.name&&t.message==e.message;case dv:case pv:return t==e+"";case uv:var o=rv;case fv:var c=n&av;if(o||(o=nv),t.size!=e.size&&!c)return!1;var p=i.get(t);if(p)return p==e;n|=sv,i.set(t,e);var m=Qu(o(t),o(e),n,a,s,i);return i.delete(t),m;case gv:if(Wa)return Wa.call(t)==Wa.call(e)}return!1}l(rc,"equalByTag");var yv=rc,vv=1,_v=Object.prototype,Tv=_v.hasOwnProperty;function nc(t,e,r,n,a,s){var i=r&vv,o=xo(t),c=o.length,p=xo(e),m=p.length;if(c!=m&&!i)return!1;for(var T=c;T--;){var O=o[T];if(!(i?O in e:Tv.call(e,O)))return!1}var w=s.get(t),S=s.get(e);if(w&&S)return w==e&&S==t;var W=!0;s.set(t,e),s.set(e,t);for(var q=i;++T<c;){O=o[T];var re=t[O],J=e[O];if(n)var j=i?n(J,re,O,e,t,s):n(re,J,O,t,e,s);if(!(j===void 0?re===J||a(re,J,r,n,s):j)){W=!1;break}q||(q=O=="constructor")}if(W&&!q){var F=t.constructor,ue=e.constructor;F!=ue&&"constructor"in t&&"constructor"in e&&!(typeof F=="function"&&F instanceof F&&typeof ue=="function"&&ue instanceof ue)&&(W=!1)}return s.delete(t),s.delete(e),W}l(nc,"equalObjects");var bv=nc,wv=1,Do="[object Arguments]",Ho="[object Array]",Kr="[object Object]",Pv=Object.prototype,Mo=Pv.hasOwnProperty;function ac(t,e,r,n,a,s){var i=$e(t),o=$e(e),c=i?Ho:Ro(t),p=o?Ho:Ro(e);c=c==Do?Kr:c,p=p==Do?Kr:p;var m=c==Kr,T=p==Kr,O=c==p;if(O&&Xa(t)){if(!Xa(e))return!1;i=!0,m=!1}if(O&&!m)return s||(s=new Lr),i||iu(t)?Qu(t,e,r,n,a,s):yv(t,e,c,r,n,a,s);if(!(r&wv)){var w=m&&Mo.call(t,"__wrapped__"),S=T&&Mo.call(e,"__wrapped__");if(w||S){var W=w?t.value():t,q=S?e.value():e;return s||(s=new Lr),a(W,q,r,n,s)}}return O?(s||(s=new Lr),bv(t,e,r,n,a,s)):!1}l(ac,"baseIsEqualDeep");var kv=ac;function Ts(t,e,r,n,a){return t===e?!0:t==null||e==null||!Nt(t)&&!Nt(e)?t!==t&&e!==e:kv(t,e,r,n,Ts,a)}l(Ts,"baseIsEqual");var bs=Ts,Ev=1,xv=2;function sc(t,e,r,n){var a=r.length,s=a,i=!n;if(t==null)return!s;for(t=Object(t);a--;){var o=r[a];if(i&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++a<s;){o=r[a];var c=o[0],p=t[c],m=o[1];if(i&&o[2]){if(p===void 0&&!(c in t))return!1}else{var T=new Lr;if(n)var O=n(p,m,c,t,e,T);if(!(O===void 0?bs(m,p,Ev|xv,n,T):O))return!1}}return!0}l(sc,"baseIsMatch");var Sv=sc;function ic(t){return t===t&&!ms(t)}l(ic,"isStrictComparable");var oc=ic;function lc(t){for(var e=vs(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,oc(a)]}return e}l(lc,"getMatchData");var Ov=lc;function uc(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}l(uc,"matchesStrictComparable");var cc=uc;function dc(t){var e=Ov(t);return e.length==1&&e[0][2]?cc(e[0][0],e[0][1]):function(r){return r===t||Sv(r,t,e)}}l(dc,"baseMatches");var Cv=dc;function fc(t,e){return t!=null&&e in Object(t)}l(fc,"baseHasIn");var Iv=fc;function pc(t,e,r){e=Au(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var i=Fn(e[n]);if(!(s=t!=null&&r(t,i)))break;t=t[i]}return s||++n!=a?s:(a=t==null?0:t.length,!!a&&ys(a)&&Ll(i,a)&&($e(t)||eu(t)))}l(pc,"hasPath");var Bv=pc;function gc(t,e){return t!=null&&Bv(t,e,Iv)}l(gc,"hasIn");var Rv=gc,Av=1,Zv=2;function hc(t,e){return _s(t)&&oc(e)?cc(Fn(t),e):function(r){var n=Py(r,t);return n===void 0&&n===e?Rv(r,t):bs(e,n,Av|Zv)}}l(hc,"baseMatchesProperty");var Dv=hc;function mc(t){return function(e){return e?.[t]}}l(mc,"baseProperty");var Hv=mc;function yc(t){return function(e){return Hu(e,t)}}l(yc,"basePropertyDeep");var Mv=yc;function vc(t){return _s(t)?Hv(Fn(t)):Mv(t)}l(vc,"property");var Nv=vc;function _c(t){return typeof t=="function"?t:t==null?_h:typeof t=="object"?$e(t)?Dv(t[0],t[1]):Cv(t):Nv(t)}l(_c,"baseIteratee");var jv=_c;function Tc(t){return function(e,r,n){for(var a=-1,s=Object(e),i=n(e),o=i.length;o--;){var c=i[t?o:++a];if(r(s[c],c,s)===!1)break}return e}}l(Tc,"createBaseFor");var $v=Tc,Uv=$v(),Kv=Uv;function bc(t,e){return t&&Kv(t,e,vs)}l(bc,"baseForOwn");var Fv=bc;function wc(t,e){return bs(t,e)}l(wc,"isEqual");var dt=wc;function Pc(t,e){var r={};return e=jv(e,3),Fv(t,function(n,a,s){Uh(r,a,e(n,a,s))}),r}l(Pc,"mapValues");var Lv=Pc;function ws(t){return se(t)}l(ws,"toTypescriptSchema");function se(t){let r=t._def;switch(r.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${R(r.description)}z.string()`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:return`${R(r.description)}z.number()`.trim();case v.ZodFirstPartyTypeKind.ZodNaN:return`${R(r.description)}z.nan()`.trim();case v.ZodFirstPartyTypeKind.ZodBigInt:return`${R(r.description)}z.bigint()`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${R(t._def.description)}z.boolean()`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${R(r.description)}z.date()`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${R(r.description)}z.undefined()`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${R(r.description)}z.null()`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${R(r.description)}z.any()`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${R(r.description)}z.unknown()`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${R(r.description)}z.never()`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${R(r.description)}z.void()`.trim();case v.ZodFirstPartyTypeKind.ZodArray:return`z.array(${se(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=Lv(r.shape(),ue=>ue instanceof v.Schema?se(ue):"z.any()");return[`${R(r.description)}z.object({`,...Object.entries(n).map(([ue,Le])=>` ${ue}: ${Le},`),"})"].join(`
|
|
33
|
-
`).trim();case v.ZodFirstPartyTypeKind.ZodUnion:let a=r.options.map(se);return`${R(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(se),i=Me(r.discriminator);return`${R(r.description)}z.discriminatedUnion(${i}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let o=se(r.left),c=se(r.right);return`${R(r.description)}z.intersection(${o}, ${c})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(se);return`${R(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let m=se(r.keyType),T=se(r.valueType);return`${R(r.description)}z.record(${m}, ${T})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let O=se(r.keyType),w=se(r.valueType);return`${R(r.description)}z.map(${O}, ${w})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${R(r.description)}z.set(${se(r.valueType)})`.trim();case v.ZodFirstPartyTypeKind.ZodFunction:let S=r.args.items.map(se),W=S.length?`.args(${S.join(", ")})`:"",q=se(r.returns);return`${R(r.description)}z.function()${W}.returns(${q})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${R(r.description)}z.lazy(() => ${se(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let re=Me(r.value);return`${R(r.description)}z.literal(${re})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let J=r.values.map(Me);return`${R(r.description)}z.enum([${J.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new it(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new it(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${R(r.description)}z.optional(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${R(r.description)}z.nullable(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let j=rl(r.defaultValue());return`${R(r.description)}${se(r.innerType)}.default(${j})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new it(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${R(r.description)}z.promise(${se(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new it(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new it(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new it(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${R(r.description)}z.readonly(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let F=Me(r.uri);return`${R(r.description)}z.ref(${F})`.trim();default:M.assertNever(r)}}l(se,"sUnwrapZod");var kc=class{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};l(kc,"ParseInputLazyPath");var xe=kc,No=l((t,e)=>{if($t(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Be(t.common.issues);return this._error=r,this._error}}},"handleResult"),Ec=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}dereference(e){return this}getReferences(){return[]}_getType(e){return He(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:He(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:He(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(pr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let a={common:{issues:[],async:(n=r?.async)!=null?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:He(e)},s=this._parseSync({data:e,path:a.path,parent:a});return No(a,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:He(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(pr(a)?a:Promise.resolve(a));return No(n,s)}refine(e,r){let n=l(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let i=e(a),o=l(()=>s.addIssue(d({code:_.custom},n(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Je({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ne.create(this,this._def)}nullable(){return ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ut.create(this,this._def)}promise(){return vr.create(this,this._def)}or(e){return na.create([this,e],this._def)}and(e){return Gn.create(this,e,this._def)}transform(e){return new Je(h(d({},A(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new mr(h(d({},A(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Wn(d({typeName:"ZodBranded",type:this},A(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Vn(h(d({},A(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.constructor;return new r(h(d({},this._def),{description:e}))}pipe(e){return ta.create(this,e)}readonly(){return _r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){for(let[r,n]of Object.entries(e))this._def[K]=h(d({},this._def[K]),{[r]:n});return this}getMetadata(){return d({},this._def[K])}setMetadata(e){this._def[K]=d({},e)}get ui(){let e=this._getMetadataRoot();return d({},e._def[K])}_setZuiMeta(e,r){let n=this._getMetadataRoot();n._def[K]=h(d({},n._def[K]),{[e]:r})}_getMetadataRoot(){let e=this._def;switch(e.typeName){case"ZodNullable":case"ZodDefault":case"ZodOptional":case"ZodReadonly":return e.innerType;case"ZodEffects":return e.schema;default:return this}}displayAs(e){var r,n,a;return(a=(r=this._def)[n=K])!=null||(r[n]={}),this._def[K].displayAs=[e.id,e.params],this}title(e){return this._setZuiMeta("title",e),this}hidden(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("hidden",r),this}disabled(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("disabled",r),this}placeholder(e){return this._setZuiMeta("placeholder",e),this}toJsonSchema(e){return aa(this,e)}toTypescript(e){return Qr(this,e)}toTypescriptSchema(){return ws(this)}async toTypescriptAsync(e){let r=Qr(this,h(d({},e),{formatter:void 0}));return e?.formatter&&(r=await e.formatter(r)),r}static fromObject(e,r){return Ft(e,r)}static fromJsonSchema(e){return Tr(e)}};l(Ec,"ZodType");var H=Ec,Ps=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(Ps||{}),M;(t=>{t.assertEqual=l(a=>a,"assertEqual");function e(a){}t.assertIs=e,l(e,"assertIs");function r(a){throw new Error("assertNever called")}t.assertNever=r,l(r,"assertNever"),t.arrayToEnum=l(a=>{let s={};for(let i of a)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=l(a=>{let s=(0,t.objectKeys)(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=l(a=>(0,t.objectKeys)(a).map(function(s){return a[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=l((a,s)=>{for(let i of a)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,l(n,"joinValues"),t.jsonStringifyReplacer=l((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=l((a,s)=>a.toString()===s.toString(),"compareFunctions")})(M||(M={}));var en;(t=>{t.mergeShapes=l((e,r)=>d(d({},e),r),"mergeShapes")})(en||(en={}));var k=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),He=l(t=>{switch(typeof t){case"undefined":return k.undefined;case"string":return k.string;case"number":return isNaN(t)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(t)?k.array:t===null?k.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.promise:typeof Map<"u"&&t instanceof Map?k.map:typeof Set<"u"&&t instanceof Set?k.set:typeof Date<"u"&&t instanceof Date?k.date:k.object;default:return k.unknown}},"getParsedType");function A(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[K]:t?.[K]}:{errorMap:l((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},"customMap"),description:a,[K]:t?.[K]}}l(A,"processCreateParams");var ks=l((t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===k.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,M.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(t.options)}, received '${t.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:M.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;case _.unresolved_reference:r="Unresolved reference";break;default:r=e.defaultError,M.assertNever(t)}return{message:r}},"errorMap"),jo=ks,_=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite","unresolved_reference"]),xc=l(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),tn=class Sc extends Error{constructor(e){super(),this.issues=[],this.addIssue=l(n=>{this.issues=[...this.issues,n]},"addIssue"),this.addIssues=l((n=[])=>{this.issues=[...this.issues,...n]},"addIssues");let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},a=l(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){let p=i.path[c];c===i.path.length-1?(o[p]=o[p]||{_errors:[]},o[p]._errors.push(r(i))):o[p]=o[p]||{_errors:[]},o=o[p],c++}}},"processError");return a(this),n}static assert(e){if(!(e instanceof Sc))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};l(tn,"ZodError");tn.create=l(t=>new tn(t),"create");var Be=tn,Oc=ks;function Es(t){Oc=t}l(Es,"setErrorMap");function jt(){return Oc}l(jt,"getErrorMap");var fr=l(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,i=[...n,...s.path||[]],o=h(d({},s),{path:i}),c="",p=a.filter(m=>!!m).slice().reverse();for(let m of p)c=m(o,{data:r,defaultError:c}).message;return h(d({},s),{path:i,message:(e=s.message)!=null?e:c})},"makeIssue"),Cc=[];function P(t,e){let r=fr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jt(),ks].filter(n=>!!n)});t.common.issues.push(r)}l(P,"addIssueToContext");var Ic=class Bc{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return I;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return Bc.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return I;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}};l(Ic,"ParseStatus");var ve=Ic,I=Object.freeze({status:"aborted"}),ct=l(t=>({status:"dirty",value:t}),"DIRTY"),pe=l(t=>({status:"valid",value:t}),"OK"),rn=l(t=>t.status==="aborted","isAborted"),nn=l(t=>t.status==="dirty","isDirty"),$t=l(t=>t.status==="valid","isValid"),pr=l(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),C;(t=>{t.errToObj=l(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=l(e=>typeof e=="string"?e:e?.message,"toString")})(C||(C={}));var an=class Rc extends H{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Rc}};l(an,"ZodAny");an.create=l(t=>new an(d({typeName:"ZodAny"},A(t))),"create");var gr=an,sn=class Bt extends H{dereference(e){return new Bt(h(d({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}isEqual(e){var r,n,a,s,i,o;return e instanceof Bt?dt((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&dt((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&dt((i=this._def.minLength)==null?void 0:i.value,(o=e._def.minLength)==null?void 0:o.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==k.array)return P(r,{code:_.invalid_type,expected:k.array,received:r.parsedType}),I;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(P(r,{code:i?_.too_big:_.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(P(r,{code:_.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(P(r,{code:_.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new xe(r,i,r.path,o)))).then(i=>ve.mergeArray(n,i));let s=[...r.data].map((i,o)=>a.type._parseSync(new xe(r,i,r.path,o)));return ve.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Bt(h(d({},this._def),{minLength:{value:e,message:C.toString(r)}}))}max(e,r){return new Bt(h(d({},this._def),{maxLength:{value:e,message:C.toString(r)}}))}length(e,r){return new Bt(h(d({},this._def),{exactLength:{value:e,message:C.toString(r)}}))}nonempty(e){return this.min(1,e)}};l(sn,"ZodArray");sn.create=l((t,e)=>new sn(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},A(e))),"create");var Ut=sn,zv={compare:dt},Ac=class{constructor(e=[],r={}){this._options=d(d({},zv),r),this._items=[];for(let n of e)this.add(n)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(r=>this._options.compare(r,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(r=>e.has(r))}};l(Ac,"CustomSet");var le=Ac,on=class zr extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==k.bigint){let s=this._getOrReturnCtx(e);return P(s,{code:_.invalid_type,expected:k.bigint,received:s.parsedType}),I}let n,a=new ve;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof zr)||this._def.coerce!==e._def.coerce)return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}gte(e,r){return this.setLimit("min",e,!0,C.toString(r))}gt(e,r){return this.setLimit("min",e,!1,C.toString(r))}lte(e,r){return this.setLimit("max",e,!0,C.toString(r))}lt(e,r){return this.setLimit("max",e,!1,C.toString(r))}setLimit(e,r,n,a){return new zr(h(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:C.toString(a)}]}))}_addCheck(e){return new zr(h(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};l(on,"ZodBigInt");on.create=l(t=>{var e;return new on(d({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var Ln=on,ln=class Zc extends H{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==k.boolean){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.boolean,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Zc?this._def.coerce===e._def.coerce:!1}};l(ln,"ZodBoolean");ln.create=l(t=>new ln(d({typeName:"ZodBoolean",coerce:t?.coerce||!1},A(t))),"create");var zn=ln,Dc=Symbol("zod_brand"),Hc=class Mc extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}isEqual(e){return e instanceof Mc?this._def.type.isEqual(e._def.type):!1}};l(Hc,"ZodBranded");var Wn=Hc,un=class Nc extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=h(d({},r),{common:h(d({},r.common),{issues:[]})}),a=this._def.innerType._parse({data:n.data,path:n.path,parent:d({},n)});return pr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Nc?this._def.innerType.isEqual(e._def.innerType)&&M.compareFunctions(this._def.catchValue,e._def.catchValue):!1}};l(un,"ZodCatch");un.create=l((t,e)=>new un(d({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},A(e))),"create");var Vn=un,xs=l((t,e={},r)=>t?gr.create().superRefine((n,a)=>{var s,i;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(s=o.fatal)!=null?s:r)!=null?i:!0,p=typeof o=="string"?{message:o}:o;a.addIssue(h(d({code:"custom"},p),{fatal:c}))}}):gr.create(),"custom"),cn=class rs extends H{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let s=this._getOrReturnCtx(e);return P(s,{code:_.invalid_type,expected:k.date,received:s.parsedType}),I}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return P(s,{code:_.invalid_date}),I}let n=new ve,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:_.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:_.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):M.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rs(h(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof rs))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)&&this._def.coerce===e._def.coerce}};l(cn,"ZodDate");cn.create=l(t=>new cn(d({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},A(t))),"create");var qn=cn,dn=class ns extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===k.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}dereference(e){return new ns(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof ns?this._def.innerType.isEqual(e._def.innerType)&&dt(this._def.defaultValue(),e._def.defaultValue()):!1}};l(dn,"ZodDefault");dn.create=l((t,e,r)=>new dn(d({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},A(r))),"create");var mr=dn,Ke=l(t=>Array.from(new Set(t)),"unique"),De=l(t=>t instanceof Jn?De(t.schema):t instanceof Je?De(t.innerType()):t instanceof Yn?[t.value]:t instanceof bt?t.options:t instanceof Xn?M.objectValues(t.enum):t instanceof mr?De(t._def.innerType):t instanceof ra?[void 0]:t instanceof Qn?[null]:t instanceof Ne?[void 0,...De(t.unwrap())]:t instanceof ft?[null,...De(t.unwrap())]:t instanceof Wn||t instanceof _r?De(t.unwrap()):t instanceof Vn?De(t._def.innerType):[],"getDiscriminator"),jc=class Rt extends H{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=Rt._getOptionsMap(this.discriminator,r);return new Rt(h(d({},this._def),{options:r,optionsMap:n}))}getReferences(){return Ke(this.options.flatMap(e=>e.getReferences()))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.object)return P(r,{code:_.invalid_type,expected:k.object,received:r.parsedType}),I;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(P(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=Rt._getOptionsMap(e,r);return new Rt(d({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},A(n)))}static _getOptionsMap(e,r){let n=new Map;for(let a of r){let s=De(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return n}isEqual(e){if(!(e instanceof Rt)||this._def.discriminator!==e._def.discriminator)return!1;let r=l((s,i)=>s.isEqual(i),"compare"),n=new le(this._def.options,{compare:r}),a=new le(e._def.options,{compare:r});return n.isEqual(a)}};l(jc,"ZodDiscriminatedUnion");var Ss=jc;function yr(t,e){return new bt(d({values:t,typeName:"ZodEnum"},A(e)))}l(yr,"createZodEnum");var Os=class Wr extends H{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:M.joinValues(n),received:r.parsedType,code:_.invalid_type}),I}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:_.invalid_enum_value,options:n}),I}return pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Wr.create(e,d(d({},this._def),r))}exclude(e,r=this._def){return Wr.create(this.options.filter(n=>!e.includes(n)),d(d({},this._def),r))}isEqual(e){if(!(e instanceof Wr))return!1;let r=new le(this._def.values),n=new le(e._def.values);return r.isEqual(n)}};l(Os,"ZodEnum");Os.create=yr;var bt=Os,$c=class At extends H{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new At(h(d({},this._def),{args:r,returns:n}))}getReferences(){return Ke([...this._def.args.getReferences(),...this._def.returns.getReferences()])}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.function)return P(r,{code:_.invalid_type,expected:k.function,received:r.parsedType}),I;function n(o,c){return fr({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jt(),jo].filter(p=>!!p),issueData:{code:_.invalid_arguments,argumentsError:c}})}l(n,"makeArgsIssue");function a(o,c){return fr({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jt(),jo].filter(p=>!!p),issueData:{code:_.invalid_return_type,returnTypeError:c}})}l(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof vr){let o=this;return pe(async function(...c){let p=new Be([]),m=await o._def.args.parseAsync(c,s).catch(w=>{throw p.addIssue(n(c,w)),p}),T=await Reflect.apply(i,this,m);return await o._def.returns._def.type.parseAsync(T,s).catch(w=>{throw p.addIssue(a(T,w)),p})})}else{let o=this;return pe(function(...c){let p=o._def.args.safeParse(c,s);if(!p.success)throw new Be([n(c,p.error)]);let m=Reflect.apply(i,this,p.data),T=o._def.returns.safeParse(m,s);if(!T.success)throw new Be([a(m,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new At(h(d({},this._def),{args:gt.create(e).rest(Ht.create())}))}returns(e){return new At(h(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new At(d({args:e||gt.create([]).rest(Ht.create()),returns:r||Ht.create(),typeName:"ZodFunction"},A(n)))}isEqual(e){return e instanceof At&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};l($c,"ZodFunction");var Cs=$c;function fn(t,e){let r=He(t),n=He(e);if(t===e)return{valid:!0,data:t};if(r===k.object&&n===k.object){let a=M.objectKeys(e),s=M.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i=d(d({},t),e);for(let o of s){let c=fn(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===k.array&&n===k.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=t[s],o=e[s],c=fn(i,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===k.date&&n===k.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}l(fn,"mergeValues");var pn=class as extends H{dereference(e){return new as(h(d({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Ke([...this._def.left.getReferences(),...this._def.right.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=l((s,i)=>{if(rn(s)||rn(i))return I;let o=fn(s.value,i.value);return o.valid?((nn(s)||nn(i))&&r.dirty(),{status:r.value,value:o.data}):(P(n,{code:_.invalid_intersection_types}),I)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}isEqual(e){if(!(e instanceof as))return!1;let r=l((s,i)=>s.isEqual(i),"compare"),n=new le([this._def.left,this._def.right],{compare:r}),a=new le([e._def.left,e._def.right],{compare:r});return n.isEqual(a)}};l(pn,"ZodIntersection");pn.create=l((t,e,r)=>new pn(d({left:t,right:e,typeName:"ZodIntersection"},A(r))),"create");var Gn=pn,gn=class Uc extends H{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}isEqual(e){return e instanceof Uc?this._def.getter().isEqual(e._def.getter()):!1}};l(gn,"ZodLazy");gn.create=l((t,e)=>new gn(d({getter:t,typeName:"ZodLazy"},A(e))),"create");var Jn=gn,hn=class Kc extends H{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Kc?dt(this._def.value,e._def.value):!1}};l(hn,"ZodLiteral");hn.create=l((t,e)=>new hn(d({value:t,typeName:"ZodLiteral"},A(e))),"create");var Yn=hn,mn=class ss extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new ss(h(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Ke([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.map)return P(n,{code:_.invalid_type,expected:k.map,received:n.parsedType}),I;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],p)=>({key:a._parse(new xe(n,o,n.path,[p,"key"])),value:s._parse(new xe(n,c,n.path,[p,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let p=await c.key,m=await c.value;if(p.status==="aborted"||m.status==="aborted")return I;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),o.set(p.value,m.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let p=c.key,m=c.value;if(p.status==="aborted"||m.status==="aborted")return I;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),o.set(p.value,m.value)}return{status:r.value,value:o}}}isEqual(e){return!(!(e instanceof ss)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(mn,"ZodMap");mn.create=l((t,e,r)=>new mn(d({valueType:e,keyType:t,typeName:"ZodMap"},A(r))),"create");var Is=mn,yn=class Fc extends H{_parse(e){if(this._getType(e)!==k.nan){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.nan,received:n.parsedType}),I}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Fc}};l(yn,"ZodNaN");yn.create=l(t=>new yn(d({typeName:"ZodNaN"},A(t))),"create");var Bs=yn,vn=class Lc extends H{_parse(e){let r=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==k.string&&n.parsedType!==k.number){let a=M.objectValues(r);return P(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),I}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return P(n,{received:n.data,code:_.invalid_enum_value,options:a}),I}return pe(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Lc?dt(this._def.values,e._def.values):!1}};l(vn,"ZodNativeEnum");vn.create=l((t,e)=>new vn(d({values:t,typeName:"ZodNativeEnum"},A(e))),"create");var Xn=vn,_n=class zc extends H{_parse(e){let r=this._getOrReturnCtx(e);return P(r,{code:_.invalid_type,expected:k.never,received:r.parsedType}),I}isEqual(e){return e instanceof zc}};l(_n,"ZodNever");_n.create=l(t=>new _n(d({typeName:"ZodNever"},A(t))),"create");var qe=_n,Tn=class Wc extends H{_parse(e){if(this._getType(e)!==k.null){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.null,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Wc}};l(Tn,"ZodNull");Tn.create=l(t=>new Tn(d({typeName:"ZodNull"},A(t))),"create");var Qn=Tn,bn=class is extends H{dereference(e){return new is(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===k.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof is?this._def.innerType.isEqual(e._def.innerType):!1}};l(bn,"ZodNullable");bn.create=l((t,e)=>new bn(d({innerType:t,typeName:"ZodNullable"},A(e))),"create");var ft=bn;function Vc(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return s%i/Math.pow(10,a)}l(Vc,"floatSafeRemainder");var wn=class Vr extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){let s=this._getOrReturnCtx(e);return P(s,{code:_.invalid_type,expected:k.number,received:s.parsedType}),I}let n,a=new ve;for(let s of this._def.checks)s.kind==="int"?M.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:_.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Vc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:_.not_finite,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,C.toString(r))}gt(e,r){return this.setLimit("min",e,!1,C.toString(r))}lte(e,r){return this.setLimit("max",e,!0,C.toString(r))}lt(e,r){return this.setLimit("max",e,!1,C.toString(r))}setLimit(e,r,n,a){return new Vr(h(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:C.toString(a)}]}))}_addCheck(e){return new Vr(h(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&M.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof Vr))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}};l(wn,"ZodNumber");wn.create=l(t=>new wn(d({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},A(t))),"create");var ea=wn;function ut(t){if(t instanceof pt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ne.create(ut(n))}return new pt(h(d({},t._def),{shape:l(()=>e,"shape")}))}else return t instanceof Ut?new Ut(h(d({},t._def),{type:ut(t.element)})):t instanceof Ne?Ne.create(ut(t.unwrap())):t instanceof ft?ft.create(ut(t.unwrap())):t instanceof gt?gt.create(t.items.map(e=>ut(e))):t}l(ut,"deepPartialify");var Ge=class Ee extends H{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=M.objectKeys(e);return this._cached={shape:e,keys:r}}dereference(e){let r=this._def.shape(),n={};for(let a in r)n[a]=r[a].dereference(e);return new Ee(h(d({},this._def),{shape:l(()=>n,"shape")}))}getReferences(){let e=this._def.shape(),r=[];for(let n in e)r.push(...e[n].getReferences());return Ke(r)}_parse(e){if(this._getType(e)!==k.object){let p=this._getOrReturnCtx(e);return P(p,{code:_.invalid_type,expected:k.object,received:p.parsedType}),I}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof qe&&this._def.unknownKeys==="strip"))for(let p in a.data)i.includes(p)||o.push(p);let c=[];for(let p of i){let m=s[p],T=a.data[p];c.push({key:{status:"valid",value:p},value:m._parse(new xe(a,T,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qe){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of o)c.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(p==="strict")o.length>0&&(P(a,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let m of o){let T=a.data[m];c.push({key:{status:"valid",value:m},value:p._parse(new xe(a,T,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of c){let T=await m.key;p.push({key:T,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>ve.mergeObjectSync(n,p)):ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new Ee(d(h(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:l((r,n)=>{var a,s,i,o;let c=(i=(s=(a=this._def).errorMap)==null?void 0:s.call(a,r,n).message)!=null?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=C.errToObj(e).message)!=null?o:c}:{message:c}},"errorMap")}:{}))}strip(){return new Ee(h(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new Ee(h(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new Ee(h(d({},this._def),{shape:l(()=>d(d({},this._def.shape()),e),"shape")}))}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:l(()=>d(d({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ee(h(d({},this._def),{catchall:e}))}pick(e){let r={};return M.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}omit(e){let r={};return M.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}deepPartial(){return ut(this)}partial(e){let r={};return M.objectKeys(this.shape).forEach(n=>{let a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a?.optional()}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}required(e){let r={};return M.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ne;)s=s._def.innerType;r[n]=s}}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}keyof(){return yr(M.objectKeys(this.shape))}isEqual(e){if(!(e instanceof Ee)||!this._def.catchall.isEqual(e._def.catchall)||this._def.unknownKeys!==e._def.unknownKeys)return!1;let r=this._def.shape(),n=e._def.shape(),a=l((o,c)=>o[0]===c[0]&&o[1].isEqual(c[1]),"compare"),s=new le(Object.entries(r),{compare:a}),i=new le(Object.entries(n),{compare:a});return s.isEqual(i)}};l(Ge,"ZodObject");Ge.create=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"create");Ge.strictCreate=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},A(e))),"strictCreate");Ge.lazycreate=l((t,e)=>new Ge(d({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"lazycreate");var pt=Ge,Pn=class os extends H{dereference(e){return new os(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===k.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof os?this._def.innerType.isEqual(e._def.innerType):!1}};l(Pn,"ZodOptional");Pn.create=l((t,e)=>new Pn(d({innerType:t,typeName:"ZodOptional"},A(e))),"create");var Ne=Pn,qc=class qr extends H{dereference(e){return new qr(h(d({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Ke([...this._def.in.getReferences(),...this._def.out.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return l(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?I:s.status==="dirty"?(r.dirty(),ct(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?I:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new qr({in:e,out:r,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof qr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};l(qc,"ZodPipeline");var ta=qc,kn=class ls extends H{unwrap(){return this._def.type}dereference(e){return new ls(h(d({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.promise&&r.common.async===!1)return P(r,{code:_.invalid_type,expected:k.promise,received:r.parsedType}),I;let n=r.parsedType===k.promise?r.data:Promise.resolve(r.data);return pe(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}isEqual(e){return e instanceof ls?this._def.type.isEqual(e._def.type):!1}};l(kn,"ZodPromise");kn.create=l((t,e)=>new kn(d({type:t,typeName:"ZodPromise"},A(e))),"create");var vr=kn,En=class us extends H{dereference(e){return new us(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){let r=this._def.innerType._parse(e);return $t(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof us?this._def.innerType.isEqual(e._def.innerType):!1}};l(En,"ZodReadonly");En.create=l((t,e)=>new En(d({innerType:t,typeName:"ZodReadonly"},A(e))),"create");var _r=En,Gc=class ar extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new ar(h(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Ke([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.object)return P(n,{code:_.invalid_type,expected:k.object,received:n.parsedType}),I;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:s._parse(new xe(n,o,n.path,o)),value:i._parse(new xe(n,n.data[o],n.path,o))});return n.common.async?ve.mergeObjectAsync(r,a):ve.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof H?new ar(d({keyType:e,valueType:r,typeName:"ZodRecord"},A(n))):new ar(d({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},A(r)))}isEqual(e){return!(!(e instanceof ar)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(Gc,"ZodRecord");var Rs=Gc,xn=class Jc extends H{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return P(r,{code:_.unresolved_reference}),I}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Jc?this._def.uri===e._def.uri:!1}};l(xn,"ZodRef");xn.create=l(t=>new xn({typeName:"ZodRef",uri:t}),"create");var As=xn,Sn=class sr extends H{dereference(e){return new sr(h(d({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.set)return P(n,{code:_.invalid_type,expected:k.set,received:n.parsedType}),I;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(P(n,{code:_.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(P(n,{code:_.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let p=new Set;for(let m of c){if(m.status==="aborted")return I;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}l(i,"finalizeSet");let o=[...n.data.values()].map((c,p)=>s._parse(new xe(n,c,n.path,p)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new sr(h(d({},this._def),{minSize:{value:e,message:C.toString(r)}}))}max(e,r){return new sr(h(d({},this._def),{maxSize:{value:e,message:C.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}isEqual(e){var r,n,a,s;if(!(e instanceof sr))return!1;let i=(r=this._def.minSize)==null?void 0:r.value,o=(n=e._def.minSize)==null?void 0:n.value;if(i!==o)return!1;let c=(a=this._def.maxSize)==null?void 0:a.value,p=(s=e._def.maxSize)==null?void 0:s.value;return c!==p?!1:this._def.valueType.isEqual(e._def.valueType)}};l(Sn,"ZodSet");Sn.create=l((t,e)=>new Sn(d({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},A(e))),"create");var Zs=Sn,Ds=/^c[^\s-]{8,}$/i,Hs=/^[a-z][a-z0-9]*$/,Ms=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ns=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,js=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Xc=l(t=>t===Yc,"isEmojiRegex"),Va,$s=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Us=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ks=l(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex");function Qc(t,e){return!!((e==="v4"||!e)&&$s.test(t)||(e==="v6"||!e)&&Us.test(t))}l(Qc,"isValidIP");var On=class Zt extends H{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let s=this._getOrReturnCtx(e);return P(s,{code:_.invalid_type,expected:k.string,received:s.parsedType}),I}let n=new ve,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?P(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&P(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")js.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Va||(Va=new RegExp(Yc,"u")),Va.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"emoji",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Ns.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"uuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Ds.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hs.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid2",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ms.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ulid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),P(a,{validation:"url",code:_.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"regex",code:_.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),P(a,{code:_.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:_.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ks(s).test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?Qc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ip",code:_.invalid_string,message:s.message}),n.dirty()):M.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),d({validation:r,code:_.invalid_string},C.errToObj(n)))}_addCheck(e){return new Zt(h(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},C.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},C.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},C.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},C.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},C.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},C.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},C.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},C.errToObj(e)))}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!=null?r:!1},C.errToObj(e?.message)))}regex(e,r){return this._addCheck(d({kind:"regex",regex:e},C.errToObj(r)))}includes(e,r){return this._addCheck(d({kind:"includes",value:e,position:r?.position},C.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(d({kind:"startsWith",value:e},C.errToObj(r)))}endsWith(e,r){return this._addCheck(d({kind:"endsWith",value:e},C.errToObj(r)))}min(e,r){return this._addCheck(d({kind:"min",value:e},C.errToObj(r)))}max(e,r){return this._addCheck(d({kind:"max",value:e},C.errToObj(r)))}length(e,r){return this._addCheck(d({kind:"length",value:e},C.errToObj(r)))}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[K]=h(d({},this._def[K]),{secret:!0}),this}toLowerCase(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}isEqual(e){if(!(e instanceof Zt))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}};l(On,"ZodString");On.create=l(t=>{var e;return new On(d({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var ge=On,Cn=class ed extends H{_parse(e){if(this._getType(e)!==k.symbol){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.symbol,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof ed}};l(Cn,"ZodSymbol");Cn.create=l(t=>new Cn(d({typeName:"ZodSymbol"},A(t))),"create");var Fs=Cn,Kt=class cs extends H{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new cs(h(d({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l(i=>{P(n,i),i.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return I;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?I:c.status==="dirty"||r.value==="dirty"?ct(c.value):c});{if(r.value==="aborted")return I;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?I:o.status==="dirty"||r.value==="dirty"?ct(o.value):o}}if(a.type==="refinement"){let i=l(o=>{let c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?I:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?I:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$t(i))return i;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>$t(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):i);M.assertNever(a)}isEqual(e){return!(e instanceof cs)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:M.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):(M.assertNever(this._def.effect),!1)}};l(Kt,"ZodEffects");Kt.create=l((t,e,r)=>new Kt(d({schema:t,typeName:"ZodEffects",effect:e},A(r))),"create");Kt.createWithPreprocess=l((t,e,r)=>new Kt(d({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},A(r))),"createWithPreprocess");var Je=Kt,In=class Gr extends H{dereference(e){let r=this._def.items.map(a=>a.dereference(e)),n=this._def.rest?this._def.rest.dereference(e):null;return new Gr(h(d({},this._def),{items:r,rest:n}))}getReferences(){return Ke([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.array)return P(n,{code:_.invalid_type,expected:k.array,received:n.parsedType}),I;if(n.data.length<this._def.items.length)return P(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new xe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>ve.mergeArray(r,i)):ve.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Gr(h(d({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Gr)||!this._restEquals(e))return!1;let r=l((s,i)=>s.isEqual(i),"compare"),n=new le(this._def.items,{compare:r}),a=new le(e._def.items,{compare:r});return n.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};l(In,"ZodTuple");In.create=l((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In(d({items:t,typeName:"ZodTuple",rest:null},A(e)))},"create");var gt=In,Bn=class td extends H{_parse(e){if(this._getType(e)!==k.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.undefined,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof td}};l(Bn,"ZodUndefined");Bn.create=l(t=>new Bn(d({typeName:"ZodUndefined"},A(t))),"create");var ra=Bn,Rn=class ds extends H{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new ds(h(d({},this._def),{options:r}))}getReferences(){return Ke(this._def.options.reduce((e,r)=>[...e,...r.getReferences()],[]))}_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new Be(o.ctx.common.issues));return P(r,{code:_.invalid_union,unionErrors:i}),I}if(l(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let i=h(d({},r),{common:h(d({},r.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s,i=[];for(let c of n){let p=h(d({},r),{common:h(d({},r.common),{issues:[]}),parent:null}),m=c._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(c=>new Be(c));return P(r,{code:_.invalid_union,unionErrors:o}),I}}get options(){return this._def.options}isEqual(e){if(!(e instanceof ds))return!1;let r=l((s,i)=>s.isEqual(i),"compare"),n=new le([...this._def.options],{compare:r}),a=new le([...e._def.options],{compare:r});return n.isEqual(a)}};l(Rn,"ZodUnion");Rn.create=l((t,e)=>new Rn(d({options:t,typeName:"ZodUnion"},A(e))),"create");var na=Rn,An=class rd extends H{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof rd}};l(An,"ZodUnknown");An.create=l(t=>new An(d({typeName:"ZodUnknown"},A(t))),"create");var Ht=An,Zn=class nd extends H{_parse(e){if(this._getType(e)!==k.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:_.invalid_type,expected:k.void,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof nd}};l(Zn,"ZodVoid");Zn.create=l(t=>new Zn(d({typeName:"ZodVoid"},A(t))),"create");var Ls=Zn,Wv=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,Ft=l((t,e,r=!0)=>{if(typeof t!="object")throw new Ga("Input must be an object");let n=l(i=>{let o=i;return e?.nullable&&(o=o.nullable()),e?.optional&&(o=o.optional()),e?.passtrough&&typeof o.passthrough=="function"&&(o=o.passthrough()),o},"applyOptions"),a=Object.entries(t).reduce((i,[o,c])=>{if(c===null)i[o]=n(E.null());else switch(typeof c){case"string":i[o]=Wv.test(c)?n(E.string().datetime()):n(E.string());break;case"number":i[o]=n(E.number());break;case"boolean":i[o]=n(E.boolean());break;case"object":Array.isArray(c)?c.length===0?i[o]=n(E.array(E.unknown())):typeof c[0]=="object"?i[o]=n(E.array(Ft(c[0],e,!1))):["string","number","boolean"].includes(typeof c[0])&&(i[o]=n(E.array(E[typeof c[0]]()))):i[o]=n(Ft(c,e,!1));break;default:throw new Ga(`Unsupported type for key ${o}`)}return i},{}),s=Object.keys(a).length>0;return e?.passtrough||!r&&!s?E.object(a).passthrough():E.object(a)},"objectToZui");function ad(){return{}}l(ad,"parseAnyDef");function zs(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=h(d({},t.errorMessage),{[e]:r}))}l(zs,"addErrorMessage");function G(t,e,r,n,a){t[e]=r,zs(t,e,n,a)}l(G,"setResponseValueAndErrors");function sd(t,e){var r,n;let a={type:"array"};return((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!=="ZodAny"&&(a.items=V(t.type._def,h(d({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&G(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&G(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(G(a,"minItems",t.exactLength.value,t.exactLength.message,e),G(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}l(sd,"parseArrayDef");function id(t,e){let r=d({type:"integer",format:"int64"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}l(id,"parseBigintDef");function od(t){return d({type:"boolean"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(od,"parseBooleanDef");function ld(t,e){return V(t.type._def,e)}l(ld,"parseBrandedDef");var Vv=l((t,e)=>V(t.innerType._def,e),"parseCatchDef");function ud(t,e){return e.dateStrategy=="integer"?qv(t,e):d({type:"string",format:"date-time"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(ud,"parseDateDef");var qv=l((t,e)=>{let r=d({type:"integer",format:"unix-time"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"&&G(r,"minimum",n.value,n.message,e);break;case"max":e.target==="jsonSchema7"&&G(r,"maximum",n.value,n.message,e);break}return r},"integerDateParser");function cd(t,e){return h(d({},V(t.innerType._def,e)),{default:t.defaultValue()})}l(cd,"parseDefaultDef");function dd(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):{}}l(dd,"parseEffectsDef");function fd(t){return{type:"string",enum:t.values}}l(fd,"parseEnumDef");var Gv=l(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function pd(t,e){let r=[V(t.left._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),V(t.right._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return r.forEach(s=>{if(Gv(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let o=s,{additionalProperties:c}=o;i=Lo(o,["additionalProperties"])}else n=void 0;a.push(i)}}),a.length?d({allOf:a},n):void 0}l(pd,"parseIntersectionDef");function gd(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}l(gd,"parseLiteralDef");var nr={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function Ws(t,e){let r=d({type:"string"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?Jv(a):a}if(l(n,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e);break;case"max":G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":st(r,"email",a.message,e);break;case"format:idn-email":st(r,"idn-email",a.message,e);break;case"pattern:zod":Ze(r,nr.email,a.message,e);break}break;case"url":st(r,"uri",a.message,e);break;case"uuid":st(r,"uuid",a.message,e);break;case"regex":Ze(r,a.regex.source,a.message,e);break;case"cuid":Ze(r,nr.cuid,a.message,e);break;case"cuid2":Ze(r,nr.cuid2,a.message,e);break;case"startsWith":Ze(r,"^"+n(a.value),a.message,e);break;case"endsWith":Ze(r,n(a.value)+"$",a.message,e);break;case"datetime":st(r,"date-time",a.message,e);break;case"length":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e),G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"includes":{Ze(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&st(r,"ipv4",a.message,e),a.version!=="v4"&&st(r,"ipv6",a.message,e);break}case"emoji":Ze(r,nr.emoji,a.message,e);break;case"ulid":{Ze(r,nr.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}l(Ws,"parseStringDef");var Jv=l(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),st=l((t,e,r,n)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(d({format:t.format},t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(d({format:e},r&&n.errorMessages&&{errorMessage:{format:r}}))):G(t,"format",e,r,n)},"addFormat"),Ze=l((t,e,r,n)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(d({pattern:t.pattern},t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(d({pattern:e},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):G(t,"pattern",e,r,n)},"addPattern");function Vs(t,e){var r,n,a,s,i;if(e.target==="openApi3"&&((r=t.keyType)==null?void 0:r._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,p)=>{var m;return h(d({},c),{[p]:(m=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"properties",p]})))!=null?m:{}})},{}),additionalProperties:!1};let o={type:"object",additionalProperties:(n=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:{}};if(e.target==="openApi3")return o;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let c=Object.entries(Ws(t.keyType._def,e)).reduce((p,[m,T])=>m==="type"?p:h(d({},p),{[m]:T}),{});return h(d({},o),{propertyNames:c})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return h(d({},o),{propertyNames:{enum:t.keyType._def.values}});return o}l(Vs,"parseRecordDef");function hd(t,e){if(e.mapStrategy==="record")return Vs(t,e);let r=V(t.keyType._def,h(d({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}l(hd,"parseMapDef");function md(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(n.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:n.filter(s=>typeof s=="string"||typeof s=="number")}}l(md,"parseNativeEnumDef");function yd(){return{not:{}}}l(yd,"parseNeverDef");function vd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}l(vd,"parseNullDef");var Dn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function _d(t,e){if(e.target==="openApi3")return $o(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Dn&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((a,s)=>{let i=Dn[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((a,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(n.length===r.length){let a=n.filter((s,i,o)=>o.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,a)=>[...n,...a._def.values.filter(s=>!n.includes(s))],[])};return $o(t,e)}l(_d,"parseUnionDef");var $o=l((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>V(a._def,h(d({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0)),n=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(r.length)return e.unionStrategy==="anyOf"?d({anyOf:r},n):d({oneOf:r},n)},"asUnionOf");function Td(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Dn[t.innerType._def.typeName],nullable:!0}:{type:[Dn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath]}));return n&&h(d({},n),{nullable:!0})}let r=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}l(Td,"parseNullableDef");function bd(t,e){let r=d({type:"number"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",zs(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}l(bd,"parseNumberDef");function wd(t,e){var r;let n=h(d({type:"object"},Object.entries(t.shape()).reduce((a,[s,i])=>{if(i===void 0||i._def===void 0)return a;let o=V(i._def,h(d({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return o===void 0?a:{properties:h(d({},a.properties),{[s]:o}),required:i.isOptional()?a.required:[...a.required,s]}},{properties:{},required:[]})),{additionalProperties:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(r=V(t.catchall._def,h(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0});return n.required.length||delete n.required,n}l(wd,"parseObjectDef");var Yv=l((t,e)=>{var r;if(e.currentPath.toString()===((r=e.propertyPath)==null?void 0:r.toString()))return V(t.innerType._def,e);let n=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),Xv=l((t,e)=>{if(e.pipeStrategy==="input")return V(t.in._def,e);if(e.pipeStrategy==="output")return V(t.out._def,e);let r=V(t.in._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=V(t.out._def,h(d({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(a=>a!==void 0)}},"parsePipelineDef");function Pd(t,e){return V(t.type._def,e)}l(Pd,"parsePromiseDef");function kd(t,e){let n={type:"array",uniqueItems:!0,items:V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&G(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&G(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}l(kd,"parseSetDef");function Ed(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>V(r._def,h(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:V(t.rest._def,h(d({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>V(r._def,h(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}l(Ed,"parseTupleDef");function xd(){return{not:{}}}l(xd,"parseUndefinedDef");function Sd(){return{}}l(Sd,"parseUnknownDef");var Qv=l((t,e)=>V(t.innerType._def,e),"parseReadonlyDef");function Od(t){return{$ref:t.uri}}l(Od,"parseRefDef");function V(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let i=e_(n,e);if(i!==void 0)return i}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=r_(t,t.typeName,e);return s&&n_(t,e,s),a.jsonSchema=s,s}l(V,"parseDef");var e_=l((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:t_(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),t_=l((t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},"getRelativePath"),r_=l((t,e,r)=>{switch(e){case"ZodString":return Ws(t,r);case"ZodNumber":return bd(t,r);case"ZodObject":return wd(t,r);case"ZodBigInt":return id(t,r);case"ZodBoolean":return od(t);case"ZodDate":return ud(t,r);case"ZodUndefined":return xd();case"ZodNull":return vd(r);case"ZodArray":return sd(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return _d(t,r);case"ZodIntersection":return pd(t,r);case"ZodTuple":return Ed(t,r);case"ZodRecord":return Vs(t,r);case"ZodRef":return Od(t);case"ZodLiteral":return gd(t,r);case"ZodEnum":return fd(t);case"ZodNativeEnum":return md(t);case"ZodNullable":return Td(t,r);case"ZodOptional":return Yv(t,r);case"ZodMap":return hd(t,r);case"ZodSet":return kd(t,r);case"ZodLazy":return V(t.getter()._def,r);case"ZodPromise":return Pd(t,r);case"ZodNaN":case"ZodNever":return yd();case"ZodEffects":return dd(t,r);case"ZodAny":return ad();case"ZodUnknown":return Sd();case"ZodDefault":return cd(t,r);case"ZodBranded":return ld(t,r);case"ZodReadonly":return Qv(t,r);case"ZodCatch":return Vv(t,r);case"ZodPipeline":return Xv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),n_=l((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[K]:d(d({},t[K]),r[K])}),r),"addMeta"),Uo={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},a_=l(t=>typeof t=="string"?h(d({},Uo),{name:t}):d(d({},Uo),t),"getDefaultOptions"),s_=l(t=>{let e=a_(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return h(d({},e),{currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))})},"getRefs"),i_=l((t,e)=>{var r;let n=s_(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[p,m])=>{var T;return h(d({},c),{[p]:(T=V(m._def,h(d({},n),{currentPath:[...n.basePath,n.definitionPath,p]}),!0))!=null?T:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(r=V(t._def,s===void 0?n:h(d({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},o=s===void 0?a?h(d({},i),{[n.definitionPath]:a}):i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:h(d({},a),{[s]:i})};return n.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),o},"zodToJsonSchema"),aa=l((t,e={target:"openApi3"})=>{let r=i_(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),o_=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],qT=bt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Cd=l(t=>ge.create().displayAs({id:"variable",params:d({type:t?.type||"any"},t?.params)}),"variable"),Id=l(t=>ge.create().displayAs({id:"conversation",params:d({},t?.params)}),"conversation"),Bd=l(t=>ge.create().displayAs({id:"user",params:d({},t?.params)}),"user"),Rd=l(t=>ge.create().displayAs({id:"message",params:d({},t?.params)}),"message"),Ad=l(t=>ge.create().displayAs({id:"agent",params:d({},t?.params)}),"agent"),Zd=l(t=>ge.create().displayAs({id:"event",params:d({},t?.params)}),"event"),Dd=l(t=>ge.create().displayAs({id:"table",params:d({},t?.params)}),"table"),Hd=l(t=>ge.create().displayAs({id:"tablerow",params:d({},t?.params)}),"tablerow"),Md=l(t=>ge.create().displayAs({id:"intent",params:d({},t?.params)}),"intent"),Nd=l(()=>bt.create(o_).displayAs({id:"dropdown",params:{}}),"aimodel"),jd=l(t=>ge.create().displayAs({id:"datasource",params:d({},t)}),"datasource"),$d=l(t=>ge.create().displayAs({id:"knowledgebase",params:d({},t)}),"knowledgebase"),Ud={object:pt.lazycreate},Kd=l((t,e={message:`Input not instance of ${t.name}`})=>xs(r=>r instanceof t,e),"instanceOfType"),qs=ge.create,Gs=ea.create,Fd=Bs.create,Ld=Ln.create,Js=zn.create,zd=qn.create,Wd=Fs.create,Vd=ra.create,qd=Qn.create,Gd=gr.create,Jd=Ht.create,Yd=qe.create,Xd=Ls.create,Qd=Ut.create,ef=pt.create,tf=pt.strictCreate,rf=na.create,nf=Ss.create,af=Gn.create,sf=gt.create,of=Rs.create,lf=As.create,uf=_r.create,cf=Is.create,df=Zs.create,ff=Cs.create,pf=Jn.create,gf=Yn.create,hf=bt.create,mf=Xn.create,yf=vr.create,fs=Je.create,vf=Ne.create,_f=ft.create,l_=mr.create,Tf=Je.createWithPreprocess,bf=ta.create,wf=l(()=>qs().optional(),"ostring"),Pf=l(()=>Gs().optional(),"onumber"),kf=l(()=>Js().optional(),"oboolean"),Ef=H.fromJsonSchema,xf=H.fromObject,Sf={string:l(t=>ge.create(h(d({},t),{coerce:!0})),"string"),number:l(t=>ea.create(h(d({},t),{coerce:!0})),"number"),boolean:l(t=>zn.create(h(d({},t),{coerce:!0})),"boolean"),bigint:l(t=>Ln.create(h(d({},t),{coerce:!0})),"bigint"),date:l(t=>qn.create(h(d({},t),{coerce:!0})),"date")},Of=I,v=E,Cf=l((t,e)=>t.anyOf.length?t.anyOf.length===1?ce(t.anyOf[0],h(d({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>ce(r,h(d({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),u_=l(t=>{var e;return(e=t[K])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),c_=l(t=>"z.any()","parseDefault"),d_=l((t,e)=>`z.union([${t.type.map(r=>ce(h(d({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),f_=l((t,e)=>`z.any().refine((value) => !${ce(t.not,h(d({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),p_=l(t=>"z.null()","parseNull"),g_=l(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),h_=l((t,...e)=>Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{}),"omit");function fe(t,e,r){var n;let a=t[e],s="";if(a!==void 0){let i=r({value:a,json:JSON.stringify(a)});if(i){let o=i[0],c=i.length===3?i[1]:"",p=i.length===3?i[2]:i[1];s+=o,((n=t.errorMessage)==null?void 0:n[e])!==void 0&&(s+=c+JSON.stringify(t.errorMessage[e])),s+=p}}return s}l(fe,"withMessage");var ir=Symbol("Original index"),m_=l(t=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="boolean")e.push(n?{[ir]:r}:{[ir]:r,not:{}});else{if(ir in n)return t;e.push(h(d({},n),{[ir]:r}))}}return e},"ensureOriginalIndex");function hr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return ce(r,h(d({},e),{path:[...e.path,"allOf",r[ir]]}))}else{let[r,n]=g_(m_(t.allOf));return`z.intersection(${hr({allOf:r},e)}, ${hr({allOf:n},e)})`}}l(hr,"parseAllOf");var y_=l((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,a)=>ce(n,h(d({},e),{path:[...e.path,"items",a]})))}])`;let r=t.items?`z.array(${ce(t.items,h(d({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return r+=fe(t,"minItems",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxItems",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseArray"),v_=l(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),__=l(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),T_=l((t,e)=>{let r=ce(t.if,h(d({},e),{path:[...e.path,"if"]})),n=ce(t.then,h(d({},e),{path:[...e.path,"then"]})),a=ce(t.else,h(d({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${a}]).superRefine((value,ctx) => {
|
|
5
|
+
*/`},"getMultilineComment"),Ra={};Fr(Ra,{JSONSchemaToZuiError:()=>zr,ObjectToZuiError:()=>Rn,UnrepresentableGenericError:()=>Hn,UnsupportedJSONSchemaToZuiError:()=>ve,UnsupportedZuiCheckToJSONSchemaError:()=>Ka,UnsupportedZuiToJSONSchemaError:()=>ee,UnsupportedZuiToTypescriptSchemaError:()=>Oe,UnsupportedZuiToTypescriptTypeError:()=>Va,UntitledDeclarationError:()=>Ja,ZuiToJSONSchemaError:()=>Lr,ZuiToTypescriptSchemaError:()=>za,ZuiToTypescriptTypeError:()=>Wr,ZuiTransformError:()=>dt});var Ha=class extends Error{constructor(e,r){super(r),this.transform=e}};i(Ha,"ZuiTransformError");var dt=Ha,Da=class extends dt{constructor(e){super("json-schema-to-zui",e)}};i(Da,"JSONSchemaToZuiError");var zr=Da,Ma=class extends dt{constructor(e){super("object-to-zui",e)}};i(Ma,"ObjectToZuiError");var Rn=Ma,Na=class extends dt{constructor(e){super("zui-to-json-schema",e)}};i(Na,"ZuiToJSONSchemaError");var Lr=Na,$a=class extends Lr{constructor(e,{suggestedAlternative:r}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(r?` Suggested alternative: ${r}`:""))}};i($a,"UnsupportedZuiToJSONSchemaError");var ee=$a,ja=class extends Lr{constructor({zodType:e,checkKind:r}){super(`Zod check .${r}() of type ${e} cannot be transformed to JSON Schema.`)}};i(ja,"UnsupportedZuiCheckToJSONSchemaError");var Ka=ja,Ua=class extends zr{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};i(Ua,"UnsupportedJSONSchemaToZuiError");var ve=Ua,Fa=class extends dt{constructor(e){super("zui-to-typescript-schema",e)}};i(Fa,"ZuiToTypescriptSchemaError");var za=Fa,La=class extends za{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};i(La,"UnsupportedZuiToTypescriptSchemaError");var Oe=La,Wa=class extends dt{constructor(e){super("zui-to-typescript-type",e)}};i(Wa,"ZuiToTypescriptTypeError");var Wr=Wa,qa=class extends Wr{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};i(qa,"UnsupportedZuiToTypescriptTypeError");var Va=qa,Ga=class extends Wr{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};i(Ga,"UntitledDeclarationError");var Ja=Ga,Xa=class extends Wr{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};i(Xa,"UnrepresentableGenericError");var Hn=Xa,Ya=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],vu=i(t=>Ya.includes(t),"isPrimitive"),_u=i(t=>Ya.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),Ws=i(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Qa=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};i(Qa,"KeyValue");var Jt=Qa,ei=class{constructor(e){this.schema=e}};i(ei,"FnParameters");var qs=ei,ti=class{constructor(e){this.schema=e}};i(ti,"FnReturn");var Vs=ti,ri=class{constructor(e){this.props=e}};i(ri,"Declaration");var Yt=ri;function qn(t,e={}){let r=wu(t,e),n=I(r,{});return e.formatter&&(n=e.formatter(n)),n}i(qn,"toTypescriptType");function I(t,e){var r,n,s;let a=p(c({},e),{parent:t});if(t===null)return"";if(t instanceof Yt)return Tu(t,a);if(t instanceof Jt){if(t.value instanceof u.ZodOptional){let O=t.value._def.innerType;return I(new Jt(t.key,O,!0),a)}let d=F(t.value.description),f=d?.trim().length>0?`
|
|
6
|
+
`:"",g=t.value.describe(""),x=t.optional||t.value.isOptional()?"?":"";return`${f}${d}${f}${t.key}${x}: ${I(g,a)}${f}`}if(t instanceof qs){if(t.schema instanceof u.ZodTuple){let g="";for(let h=0;h<t.schema.items.length;h++){let x=(s=(n=(r=t.schema.items[h])==null?void 0:r.ui)==null?void 0:n.title)!=null?s:`arg${h}`,O=t.schema.items[h];g+=`${I(new Jt(An(x),O),a)}${h<t.schema.items.length-1?", ":""} `}return g}let d=I(t.schema,a);return d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]")||d.startsWith("(")&&d.endsWith(")")||d.startsWith("Array<")&&d.endsWith(">")||d.startsWith("Record<")&&d.endsWith(">")||_u(d)?`args: ${d}`:d}if(t instanceof Vs)return t.schema instanceof u.ZodOptional?`${I(t.schema.unwrap(),a)} | undefined`:I(t.schema,a);let o=t,l=o._def;switch(l.typeName){case u.ZodFirstPartyTypeKind.ZodString:return`${F(o.description)} string`.trim();case u.ZodFirstPartyTypeKind.ZodNumber:case u.ZodFirstPartyTypeKind.ZodNaN:case u.ZodFirstPartyTypeKind.ZodBigInt:return`${F(o.description)} number`.trim();case u.ZodFirstPartyTypeKind.ZodBoolean:return`${F(o.description)} boolean`.trim();case u.ZodFirstPartyTypeKind.ZodDate:return`${F(o.description)} Date`.trim();case u.ZodFirstPartyTypeKind.ZodUndefined:return`${F(o.description)} undefined`.trim();case u.ZodFirstPartyTypeKind.ZodNull:return`${F(o.description)} null`.trim();case u.ZodFirstPartyTypeKind.ZodAny:return`${F(o.description)} any`.trim();case u.ZodFirstPartyTypeKind.ZodUnknown:return`${F(o.description)} unknown`.trim();case u.ZodFirstPartyTypeKind.ZodNever:return`${F(o.description)} never`.trim();case u.ZodFirstPartyTypeKind.ZodVoid:return`${F(o.description)} void`.trim();case u.ZodFirstPartyTypeKind.ZodArray:let d=I(l.type,a);return vu(d)?`${d}[]`:`Array<${d}>`;case u.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(l.shape()).map(([q,se])=>I(new Jt(An(q),se),a)).join("; ")} }`;case u.ZodFirstPartyTypeKind.ZodUnion:let g=l.options.map(q=>I(q,a));return`${F(o.description)}
|
|
7
|
+
${g.join(" | ")}`;case u.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let h=l.options.map(q=>I(q,a));return`${F(o.description)}
|
|
8
|
+
${h.join(" | ")}`;case u.ZodFirstPartyTypeKind.ZodIntersection:return`${I(l.left,a)} & ${I(l.right,a)}`;case u.ZodFirstPartyTypeKind.ZodTuple:return l.items.length===0?"":`[${l.items.map(q=>I(q,a)).join(", ")}]`;case u.ZodFirstPartyTypeKind.ZodRecord:let O=I(l.keyType,a),B=I(l.valueType,a);return`${F(o.description)} { [key: ${O}]: ${B} }`;case u.ZodFirstPartyTypeKind.ZodMap:return`Map<${I(l.keyType,a)}, ${I(l.valueType,a)}>`;case u.ZodFirstPartyTypeKind.ZodSet:return`Set<${I(l.valueType,a)}>`;case u.ZodFirstPartyTypeKind.ZodFunction:let U=I(new qs(l.args),a),W=I(new Vs(l.returns),a);return`${F(o.description)}
|
|
9
|
+
(${U}) => ${W}`;case u.ZodFirstPartyTypeKind.ZodLazy:return I(l.getter(),a);case u.ZodFirstPartyTypeKind.ZodLiteral:let Q=Ia(l.value);return`${F(o.description)}
|
|
10
|
+
${Q}`.trim();case u.ZodFirstPartyTypeKind.ZodEnum:return l.values.map(T).join(" | ");case u.ZodFirstPartyTypeKind.ZodEffects:return I(l.schema,a);case u.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Va(u.ZodFirstPartyTypeKind.ZodNativeEnum);case u.ZodFirstPartyTypeKind.ZodOptional:return`${I(l.innerType,a)} | undefined`;case u.ZodFirstPartyTypeKind.ZodNullable:return`${I(l.innerType,a)} | null`;case u.ZodFirstPartyTypeKind.ZodDefault:return I(l.innerType,a);case u.ZodFirstPartyTypeKind.ZodCatch:return I(l.innerType,a);case u.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${I(l.type,a)}>`;case u.ZodFirstPartyTypeKind.ZodBranded:return I(l.type,a);case u.ZodFirstPartyTypeKind.ZodPipeline:return I(l.in,a);case u.ZodFirstPartyTypeKind.ZodSymbol:return`${F(o.description)} symbol`.trim();case u.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${I(l.innerType,a)}>`;case u.ZodFirstPartyTypeKind.ZodRef:return Aa(l.uri);default:Z.assertNever(l)}}i(I,"sUnwrapZod");var Tu=i((t,e)=>{if(t.props.type==="none")return I(t.props.schema,e);let r=F(t.props.schema.description),n=t.props.schema.describe(""),s=I(n,e);if(t.props.type==="variable")return Ws(`${r}declare const ${t.props.identifier}: ${s};`);let a=t.props.args.length>0?`<${t.props.args.map(Aa).join(", ")}>`:"";return Ws(`${r}type ${t.props.identifier}${a} = ${s};`)},"unwrapDeclaration"),bu=i(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),wu=i((t,e)=>{let r=bu(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new Hn;return new Yt({type:"none",schema:t})}let s="title"in t.ui?t.ui.title:null;if(!s)throw new Ja;if(r==="variable"){if(n.length>0)throw new Hn;return new Yt({type:"variable",identifier:s,schema:t})}return new Yt({type:"type",identifier:s,schema:t,args:n})},"getDeclarationProps"),Pu=typeof global=="object"&&global&&global.Object===Object&&global,ni=Pu,xu=typeof self=="object"&&self&&self.Object===Object&&self,ku=ni||xu||Function("return this")(),ye=ku,Su=ye.Symbol,_e=Su,si=Object.prototype,Eu=si.hasOwnProperty,Ou=si.toString,mt=_e?_e.toStringTag:void 0;function ai(t){var e=Eu.call(t,mt),r=t[mt];try{t[mt]=void 0;var n=!0}catch{}var s=Ou.call(t);return n&&(e?t[mt]=r:delete t[mt]),s}i(ai,"getRawTag");var Zu=ai,Bu=Object.prototype,Iu=Bu.toString;function ii(t){return Iu.call(t)}i(ii,"objectToString");var Cu=ii,Au="[object Null]",Ru="[object Undefined]",Gs=_e?_e.toStringTag:void 0;function oi(t){return t==null?t===void 0?Ru:Au:Gs&&Gs in Object(t)?Zu(t):Cu(t)}i(oi,"baseGetTag");var $e=oi;function li(t){return t!=null&&typeof t=="object"}i(li,"isObjectLike");var He=li,Hu="[object Symbol]";function ci(t){return typeof t=="symbol"||He(t)&&$e(t)==Hu}i(ci,"isSymbol");var Vn=ci;function di(t,e){for(var r=-1,n=t==null?0:t.length,s=Array(n);++r<n;)s[r]=e(t[r],r,t);return s}i(di,"arrayMap");var ui=di,Du=Array.isArray,ge=Du,Mu=1/0,Js=_e?_e.prototype:void 0,Xs=Js?Js.toString:void 0;function Gn(t){if(typeof t=="string")return t;if(ge(t))return ui(t,Gn)+"";if(Vn(t))return Xs?Xs.call(t):"";var e=t+"";return e=="0"&&1/t==-Mu?"-0":e}i(Gn,"baseToString");var Nu=Gn;function pi(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}i(pi,"isObject");var st=pi;function fi(t){return t}i(fi,"identity");var $u=fi,ju="[object AsyncFunction]",Ku="[object Function]",Uu="[object GeneratorFunction]",Fu="[object Proxy]";function gi(t){if(!st(t))return!1;var e=$e(t);return e==Ku||e==Uu||e==ju||e==Fu}i(gi,"isFunction");var yi=gi,zu=ye["__core-js_shared__"],En=zu,Ys=function(){var t=/[^.]+$/.exec(En&&En.keys&&En.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function hi(t){return!!Ys&&Ys in t}i(hi,"isMasked");var Lu=hi,Wu=Function.prototype,qu=Wu.toString;function mi(t){if(t!=null){try{return qu.call(t)}catch{}try{return t+""}catch{}}return""}i(mi,"toSource");var je=mi,Vu=/[\\^$.*+?()[\]{}|]/g,Gu=/^\[object .+?Constructor\]$/,Ju=Function.prototype,Xu=Object.prototype,Yu=Ju.toString,Qu=Xu.hasOwnProperty,ep=RegExp("^"+Yu.call(Qu).replace(Vu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vi(t){if(!st(t)||Lu(t))return!1;var e=yi(t)?ep:Gu;return e.test(je(t))}i(vi,"baseIsNative");var tp=vi;function _i(t,e){return t?.[e]}i(_i,"getValue");var rp=_i;function Ti(t,e){var r=rp(t,e);return tp(r)?r:void 0}i(Ti,"getNative");var Ke=Ti,np=Ke(ye,"WeakMap"),Dn=np,sp=function(){try{var t=Ke(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Qs=sp,ap=9007199254740991,ip=/^(?:0|[1-9]\d*)$/;function bi(t,e){var r=typeof t;return e=e??ap,!!e&&(r=="number"||r!="symbol"&&ip.test(t))&&t>-1&&t%1==0&&t<e}i(bi,"isIndex");var Jn=bi;function wi(t,e,r){e=="__proto__"&&Qs?Qs(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}i(wi,"baseAssignValue");var Pi=wi;function xi(t,e){return t===e||t!==t&&e!==e}i(xi,"eq");var Xn=xi,op=Object.prototype,lp=op.hasOwnProperty;function ki(t,e,r){var n=t[e];(!(lp.call(t,e)&&Xn(n,r))||r===void 0&&!(e in t))&&Pi(t,e,r)}i(ki,"assignValue");var cp=ki,dp=9007199254740991;function Si(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=dp}i(Si,"isLength");var Yn=Si;function Ei(t){return t!=null&&Yn(t.length)&&!yi(t)}i(Ei,"isArrayLike");var Oi=Ei,up=Object.prototype;function Zi(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||up;return t===r}i(Zi,"isPrototype");var Bi=Zi;function Ii(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}i(Ii,"baseTimes");var pp=Ii,fp="[object Arguments]";function Ci(t){return He(t)&&$e(t)==fp}i(Ci,"baseIsArguments");var ea=Ci,Ai=Object.prototype,gp=Ai.hasOwnProperty,yp=Ai.propertyIsEnumerable,hp=ea(function(){return arguments}())?ea:function(t){return He(t)&&gp.call(t,"callee")&&!yp.call(t,"callee")},Ri=hp;function Hi(){return!1}i(Hi,"stubFalse");var mp=Hi,Di=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ta=Di&&typeof module=="object"&&module&&!module.nodeType&&module,vp=ta&&ta.exports===Di,ra=vp?ye.Buffer:void 0,_p=ra?ra.isBuffer:void 0,Tp=_p||mp,Mn=Tp,bp="[object Arguments]",wp="[object Array]",Pp="[object Boolean]",xp="[object Date]",kp="[object Error]",Sp="[object Function]",Ep="[object Map]",Op="[object Number]",Zp="[object Object]",Bp="[object RegExp]",Ip="[object Set]",Cp="[object String]",Ap="[object WeakMap]",Rp="[object ArrayBuffer]",Hp="[object DataView]",Dp="[object Float32Array]",Mp="[object Float64Array]",Np="[object Int8Array]",$p="[object Int16Array]",jp="[object Int32Array]",Kp="[object Uint8Array]",Up="[object Uint8ClampedArray]",Fp="[object Uint16Array]",zp="[object Uint32Array]",D={};D[Dp]=D[Mp]=D[Np]=D[$p]=D[jp]=D[Kp]=D[Up]=D[Fp]=D[zp]=!0;D[bp]=D[wp]=D[Rp]=D[Pp]=D[Hp]=D[xp]=D[kp]=D[Sp]=D[Ep]=D[Op]=D[Zp]=D[Bp]=D[Ip]=D[Cp]=D[Ap]=!1;function Mi(t){return He(t)&&Yn(t.length)&&!!D[$e(t)]}i(Mi,"baseIsTypedArray");var Lp=Mi;function Ni(t){return function(e){return t(e)}}i(Ni,"baseUnary");var Wp=Ni,$i=typeof exports=="object"&&exports&&!exports.nodeType&&exports,It=$i&&typeof module=="object"&&module&&!module.nodeType&&module,qp=It&&It.exports===$i,On=qp&&ni.process,Vp=function(){try{var t=It&&It.require&&It.require("util").types;return t||On&&On.binding&&On.binding("util")}catch{}}(),na=Vp,sa=na&&na.isTypedArray,Gp=sa?Wp(sa):Lp,ji=Gp,Jp=Object.prototype,Xp=Jp.hasOwnProperty;function Ki(t,e){var r=ge(t),n=!r&&Ri(t),s=!r&&!n&&Mn(t),a=!r&&!n&&!s&&ji(t),o=r||n||s||a,l=o?pp(t.length,String):[],d=l.length;for(var f in t)(e||Xp.call(t,f))&&!(o&&(f=="length"||s&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Jn(f,d)))&&l.push(f);return l}i(Ki,"arrayLikeKeys");var Ui=Ki;function Fi(t,e){return function(r){return t(e(r))}}i(Fi,"overArg");var zi=Fi,Yp=zi(Object.keys,Object),Qp=Yp,ef=Object.prototype,tf=ef.hasOwnProperty;function Li(t){if(!Bi(t))return Qp(t);var e=[];for(var r in Object(t))tf.call(t,r)&&r!="constructor"&&e.push(r);return e}i(Li,"baseKeys");var rf=Li;function Wi(t){return Oi(t)?Ui(t):rf(t)}i(Wi,"keys");var Qn=Wi;function qi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}i(qi,"nativeKeysIn");var nf=qi,sf=Object.prototype,af=sf.hasOwnProperty;function Vi(t){if(!st(t))return nf(t);var e=Bi(t),r=[];for(var n in t)n=="constructor"&&(e||!af.call(t,n))||r.push(n);return r}i(Vi,"baseKeysIn");var of=Vi;function Gi(t){return Oi(t)?Ui(t,!0):of(t)}i(Gi,"keysIn");var lf=Gi,cf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,df=/^\w*$/;function Ji(t,e){if(ge(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Vn(t)?!0:df.test(t)||!cf.test(t)||e!=null&&t in Object(e)}i(Ji,"isKey");var es=Ji,uf=Ke(Object,"create"),At=uf;function Xi(){this.__data__=At?At(null):{},this.size=0}i(Xi,"hashClear");var pf=Xi;function Yi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}i(Yi,"hashDelete");var ff=Yi,gf="__lodash_hash_undefined__",yf=Object.prototype,hf=yf.hasOwnProperty;function Qi(t){var e=this.__data__;if(At){var r=e[t];return r===gf?void 0:r}return hf.call(e,t)?e[t]:void 0}i(Qi,"hashGet");var mf=Qi,vf=Object.prototype,_f=vf.hasOwnProperty;function eo(t){var e=this.__data__;return At?e[t]!==void 0:_f.call(e,t)}i(eo,"hashHas");var Tf=eo,bf="__lodash_hash_undefined__";function to(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=At&&e===void 0?bf:e,this}i(to,"hashSet");var wf=to;function Ue(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}i(Ue,"Hash");Ue.prototype.clear=pf;Ue.prototype.delete=ff;Ue.prototype.get=mf;Ue.prototype.has=Tf;Ue.prototype.set=wf;var aa=Ue;function ro(){this.__data__=[],this.size=0}i(ro,"listCacheClear");var Pf=ro;function no(t,e){for(var r=t.length;r--;)if(Xn(t[r][0],e))return r;return-1}i(no,"assocIndexOf");var qr=no,xf=Array.prototype,kf=xf.splice;function so(t){var e=this.__data__,r=qr(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kf.call(e,r,1),--this.size,!0}i(so,"listCacheDelete");var Sf=so;function ao(t){var e=this.__data__,r=qr(e,t);return r<0?void 0:e[r][1]}i(ao,"listCacheGet");var Ef=ao;function io(t){return qr(this.__data__,t)>-1}i(io,"listCacheHas");var Of=io;function oo(t,e){var r=this.__data__,n=qr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}i(oo,"listCacheSet");var Zf=oo;function Fe(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}i(Fe,"ListCache");Fe.prototype.clear=Pf;Fe.prototype.delete=Sf;Fe.prototype.get=Ef;Fe.prototype.has=Of;Fe.prototype.set=Zf;var Vr=Fe,Bf=Ke(ye,"Map"),Rt=Bf;function lo(){this.size=0,this.__data__={hash:new aa,map:new(Rt||Vr),string:new aa}}i(lo,"mapCacheClear");var If=lo;function co(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}i(co,"isKeyable");var Cf=co;function uo(t,e){var r=t.__data__;return Cf(e)?r[typeof e=="string"?"string":"hash"]:r.map}i(uo,"getMapData");var Gr=uo;function po(t){var e=Gr(this,t).delete(t);return this.size-=e?1:0,e}i(po,"mapCacheDelete");var Af=po;function fo(t){return Gr(this,t).get(t)}i(fo,"mapCacheGet");var Rf=fo;function go(t){return Gr(this,t).has(t)}i(go,"mapCacheHas");var Hf=go;function yo(t,e){var r=Gr(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}i(yo,"mapCacheSet");var Df=yo;function ze(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}i(ze,"MapCache");ze.prototype.clear=If;ze.prototype.delete=Af;ze.prototype.get=Rf;ze.prototype.has=Hf;ze.prototype.set=Df;var Jr=ze,Mf="Expected a function";function Xr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Mf);var r=i(function(){var n=arguments,s=e?e.apply(this,n):n[0],a=r.cache;if(a.has(s))return a.get(s);var o=t.apply(this,n);return r.cache=a.set(s,o)||a,o},"memoized");return r.cache=new(Xr.Cache||Jr),r}i(Xr,"memoize");Xr.Cache=Jr;var Nf=Xr,$f=500;function ho(t){var e=Nf(t,function(n){return r.size===$f&&r.clear(),n}),r=e.cache;return e}i(ho,"memoizeCapped");var jf=ho,Kf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Uf=/\\(\\)?/g,Ff=jf(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Kf,function(r,n,s,a){e.push(s?a.replace(Uf,"$1"):n||r)}),e}),zf=Ff;function mo(t){return t==null?"":Nu(t)}i(mo,"toString");var Lf=mo;function vo(t,e){return ge(t)?t:es(t,e)?[t]:zf(Lf(t))}i(vo,"castPath");var Yr=vo,Wf=1/0;function _o(t){if(typeof t=="string"||Vn(t))return t;var e=t+"";return e=="0"&&1/t==-Wf?"-0":e}i(_o,"toKey");var $t=_o;function To(t,e){e=Yr(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[$t(e[r++])];return r&&r==n?t:void 0}i(To,"baseGet");var ts=To;function bo(t,e,r){var n=t==null?void 0:ts(t,e);return n===void 0?r:n}i(bo,"get");var qf=bo;function wo(t,e){for(var r=-1,n=e.length,s=t.length;++r<n;)t[s+r]=e[r];return t}i(wo,"arrayPush");var Po=wo,Vf=zi(Object.getPrototypeOf,Object),xo=Vf,Gf="[object Object]",Jf=Function.prototype,Xf=Object.prototype,ko=Jf.toString,Yf=Xf.hasOwnProperty,Qf=ko.call(Object);function So(t){if(!He(t)||$e(t)!=Gf)return!1;var e=xo(t);if(e===null)return!0;var r=Yf.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ko.call(r)==Qf}i(So,"isPlainObject");var ia=So;function Eo(){this.__data__=new Vr,this.size=0}i(Eo,"stackClear");var eg=Eo;function Oo(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}i(Oo,"stackDelete");var tg=Oo;function Zo(t){return this.__data__.get(t)}i(Zo,"stackGet");var rg=Zo;function Bo(t){return this.__data__.has(t)}i(Bo,"stackHas");var ng=Bo,sg=200;function Io(t,e){var r=this.__data__;if(r instanceof Vr){var n=r.__data__;if(!Rt||n.length<sg-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Jr(n)}return r.set(t,e),this.size=r.size,this}i(Io,"stackSet");var ag=Io;function Le(t){var e=this.__data__=new Vr(t);this.size=e.size}i(Le,"Stack");Le.prototype.clear=eg;Le.prototype.delete=tg;Le.prototype.get=rg;Le.prototype.has=ng;Le.prototype.set=ag;var Qt=Le;function Co(t,e){for(var r=-1,n=t==null?0:t.length,s=0,a=[];++r<n;){var o=t[r];e(o,r,t)&&(a[s++]=o)}return a}i(Co,"arrayFilter");var ig=Co;function Ao(){return[]}i(Ao,"stubArray");var Ro=Ao,og=Object.prototype,lg=og.propertyIsEnumerable,oa=Object.getOwnPropertySymbols,cg=oa?function(t){return t==null?[]:(t=Object(t),ig(oa(t),function(e){return lg.call(t,e)}))}:Ro,Ho=cg,dg=Object.getOwnPropertySymbols,ug=dg?function(t){for(var e=[];t;)Po(e,Ho(t)),t=xo(t);return e}:Ro,pg=ug;function Do(t,e,r){var n=e(t);return ge(t)?n:Po(n,r(t))}i(Do,"baseGetAllKeys");var Mo=Do;function No(t){return Mo(t,Qn,Ho)}i(No,"getAllKeys");var la=No;function $o(t){return Mo(t,lf,pg)}i($o,"getAllKeysIn");var fg=$o,gg=Ke(ye,"DataView"),Nn=gg,yg=Ke(ye,"Promise"),$n=yg,hg=Ke(ye,"Set"),jn=hg,ca="[object Map]",mg="[object Object]",da="[object Promise]",ua="[object Set]",pa="[object WeakMap]",fa="[object DataView]",vg=je(Nn),_g=je(Rt),Tg=je($n),bg=je(jn),wg=je(Dn),Ze=$e;(Nn&&Ze(new Nn(new ArrayBuffer(1)))!=fa||Rt&&Ze(new Rt)!=ca||$n&&Ze($n.resolve())!=da||jn&&Ze(new jn)!=ua||Dn&&Ze(new Dn)!=pa)&&(Ze=i(function(t){var e=$e(t),r=e==mg?t.constructor:void 0,n=r?je(r):"";if(n)switch(n){case vg:return fa;case _g:return ca;case Tg:return da;case bg:return ua;case wg:return pa}return e},"getTag"));var ga=Ze,Pg=ye.Uint8Array,ya=Pg,xg="__lodash_hash_undefined__";function jo(t){return this.__data__.set(t,xg),this}i(jo,"setCacheAdd");var kg=jo;function Ko(t){return this.__data__.has(t)}i(Ko,"setCacheHas");var Sg=Ko;function Ht(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Jr;++e<r;)this.add(t[e])}i(Ht,"SetCache");Ht.prototype.add=Ht.prototype.push=kg;Ht.prototype.has=Sg;var Eg=Ht;function Uo(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}i(Uo,"arraySome");var Og=Uo;function Fo(t,e){return t.has(e)}i(Fo,"cacheHas");var Zg=Fo,Bg=1,Ig=2;function zo(t,e,r,n,s,a){var o=r&Bg,l=t.length,d=e.length;if(l!=d&&!(o&&d>l))return!1;var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var h=-1,x=!0,O=r&Ig?new Eg:void 0;for(a.set(t,e),a.set(e,t);++h<l;){var B=t[h],U=e[h];if(n)var W=o?n(U,B,h,e,t,a):n(B,U,h,t,e,a);if(W!==void 0){if(W)continue;x=!1;break}if(O){if(!Og(e,function(Q,ae){if(!Zg(O,ae)&&(B===Q||s(B,Q,r,n,a)))return O.push(ae)})){x=!1;break}}else if(!(B===U||s(B,U,r,n,a))){x=!1;break}}return a.delete(t),a.delete(e),x}i(zo,"equalArrays");var Lo=zo;function Wo(t){var e=-1,r=Array(t.size);return t.forEach(function(n,s){r[++e]=[s,n]}),r}i(Wo,"mapToArray");var Cg=Wo;function qo(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}i(qo,"setToArray");var Ag=qo,Rg=1,Hg=2,Dg="[object Boolean]",Mg="[object Date]",Ng="[object Error]",$g="[object Map]",jg="[object Number]",Kg="[object RegExp]",Ug="[object Set]",Fg="[object String]",zg="[object Symbol]",Lg="[object ArrayBuffer]",Wg="[object DataView]",ha=_e?_e.prototype:void 0,Zn=ha?ha.valueOf:void 0;function Vo(t,e,r,n,s,a,o){switch(r){case Wg:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Lg:return!(t.byteLength!=e.byteLength||!a(new ya(t),new ya(e)));case Dg:case Mg:case jg:return Xn(+t,+e);case Ng:return t.name==e.name&&t.message==e.message;case Kg:case Fg:return t==e+"";case $g:var l=Cg;case Ug:var d=n&Rg;if(l||(l=Ag),t.size!=e.size&&!d)return!1;var f=o.get(t);if(f)return f==e;n|=Hg,o.set(t,e);var g=Lo(l(t),l(e),n,s,a,o);return o.delete(t),g;case zg:if(Zn)return Zn.call(t)==Zn.call(e)}return!1}i(Vo,"equalByTag");var qg=Vo,Vg=1,Gg=Object.prototype,Jg=Gg.hasOwnProperty;function Go(t,e,r,n,s,a){var o=r&Vg,l=la(t),d=l.length,f=la(e),g=f.length;if(d!=g&&!o)return!1;for(var h=d;h--;){var x=l[h];if(!(o?x in e:Jg.call(e,x)))return!1}var O=a.get(t),B=a.get(e);if(O&&B)return O==e&&B==t;var U=!0;a.set(t,e),a.set(e,t);for(var W=o;++h<d;){x=l[h];var Q=t[x],ae=e[x];if(n)var q=o?n(ae,Q,x,e,t,a):n(Q,ae,x,t,e,a);if(!(q===void 0?Q===ae||s(Q,ae,r,n,a):q)){U=!1;break}W||(W=x=="constructor")}if(U&&!W){var se=t.constructor,Je=e.constructor;se!=Je&&"constructor"in t&&"constructor"in e&&!(typeof se=="function"&&se instanceof se&&typeof Je=="function"&&Je instanceof Je)&&(U=!1)}return a.delete(t),a.delete(e),U}i(Go,"equalObjects");var Xg=Go,Yg=1,ma="[object Arguments]",va="[object Array]",Xt="[object Object]",Qg=Object.prototype,_a=Qg.hasOwnProperty;function Jo(t,e,r,n,s,a){var o=ge(t),l=ge(e),d=o?va:ga(t),f=l?va:ga(e);d=d==ma?Xt:d,f=f==ma?Xt:f;var g=d==Xt,h=f==Xt,x=d==f;if(x&&Mn(t)){if(!Mn(e))return!1;o=!0,g=!1}if(x&&!g)return a||(a=new Qt),o||ji(t)?Lo(t,e,r,n,s,a):qg(t,e,d,r,n,s,a);if(!(r&Yg)){var O=g&&_a.call(t,"__wrapped__"),B=h&&_a.call(e,"__wrapped__");if(O||B){var U=O?t.value():t,W=B?e.value():e;return a||(a=new Qt),s(U,W,r,n,a)}}return x?(a||(a=new Qt),Xg(t,e,r,n,s,a)):!1}i(Jo,"baseIsEqualDeep");var ey=Jo;function rs(t,e,r,n,s){return t===e?!0:t==null||e==null||!He(t)&&!He(e)?t!==t&&e!==e:ey(t,e,r,n,rs,s)}i(rs,"baseIsEqual");var Qr=rs,ty=1,ry=2;function Xo(t,e,r,n){var s=r.length,a=s,o=!n;if(t==null)return!a;for(t=Object(t);s--;){var l=r[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<a;){l=r[s];var d=l[0],f=t[d],g=l[1];if(o&&l[2]){if(f===void 0&&!(d in t))return!1}else{var h=new Qt;if(n)var x=n(f,g,d,t,e,h);if(!(x===void 0?Qr(g,f,ty|ry,n,h):x))return!1}}return!0}i(Xo,"baseIsMatch");var ny=Xo;function Yo(t){return t===t&&!st(t)}i(Yo,"isStrictComparable");var Qo=Yo;function el(t){for(var e=Qn(t),r=e.length;r--;){var n=e[r],s=t[n];e[r]=[n,s,Qo(s)]}return e}i(el,"getMatchData");var sy=el;function tl(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}i(tl,"matchesStrictComparable");var rl=tl;function nl(t){var e=sy(t);return e.length==1&&e[0][2]?rl(e[0][0],e[0][1]):function(r){return r===t||ny(r,t,e)}}i(nl,"baseMatches");var ay=nl;function sl(t,e){return t!=null&&e in Object(t)}i(sl,"baseHasIn");var iy=sl;function al(t,e,r){e=Yr(e,t);for(var n=-1,s=e.length,a=!1;++n<s;){var o=$t(e[n]);if(!(a=t!=null&&r(t,o)))break;t=t[o]}return a||++n!=s?a:(s=t==null?0:t.length,!!s&&Yn(s)&&Jn(o,s)&&(ge(t)||Ri(t)))}i(al,"hasPath");var oy=al;function il(t,e){return t!=null&&oy(t,e,iy)}i(il,"hasIn");var ly=il,cy=1,dy=2;function ol(t,e){return es(t)&&Qo(e)?rl($t(t),e):function(r){var n=qf(r,t);return n===void 0&&n===e?ly(r,t):Qr(e,n,cy|dy)}}i(ol,"baseMatchesProperty");var uy=ol;function ll(t){return function(e){return e?.[t]}}i(ll,"baseProperty");var py=ll;function cl(t){return function(e){return ts(e,t)}}i(cl,"basePropertyDeep");var fy=cl;function dl(t){return es(t)?py($t(t)):fy(t)}i(dl,"property");var gy=dl;function ul(t){return typeof t=="function"?t:t==null?$u:typeof t=="object"?ge(t)?uy(t[0],t[1]):ay(t):gy(t)}i(ul,"baseIteratee");var ns=ul;function pl(t){return function(e,r,n){for(var s=-1,a=Object(e),o=n(e),l=o.length;l--;){var d=o[t?l:++s];if(r(a[d],d,a)===!1)break}return e}}i(pl,"createBaseFor");var yy=pl,hy=yy(),my=hy;function fl(t,e){return t&&my(t,e,Qn)}i(fl,"baseForOwn");var vy=fl;function gl(t,e){return Qr(t,e)}i(gl,"isEqual");var rt=gl;function yl(t,e,r){r=typeof r=="function"?r:void 0;var n=r?r(t,e):void 0;return n===void 0?Qr(t,e,void 0,r):!!n}i(yl,"isEqualWith");var _y=yl;function hl(t){return t===void 0}i(hl,"isUndefined");var Ta=hl;function ml(t,e){var r={};return e=ns(e,3),vy(t,function(n,s,a){Pi(r,s,e(n,s,a))}),r}i(ml,"mapValues");var Ty=ml,by="Expected a function";function vl(t){if(typeof t!="function")throw new TypeError(by);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}i(vl,"negate");var wy=vl;function _l(t,e,r,n){if(!st(t))return t;e=Yr(e,t);for(var s=-1,a=e.length,o=a-1,l=t;l!=null&&++s<a;){var d=$t(e[s]),f=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return t;if(s!=o){var g=l[d];f=n?n(g,d,l):void 0,f===void 0&&(f=st(g)?g:Jn(e[s+1])?[]:{})}cp(l,d,f),l=l[d]}return t}i(_l,"baseSet");var Py=_l;function Tl(t,e,r){for(var n=-1,s=e.length,a={};++n<s;){var o=e[n],l=ts(t,o);r(l,o)&&Py(a,Yr(o,t),l)}return a}i(Tl,"basePickBy");var xy=Tl;function bl(t,e){if(t==null)return{};var r=ui(fg(t),function(n){return[n]});return e=ns(e),xy(t,r,function(n,s){return e(n,s[0])})}i(bl,"pickBy");var ky=bl;function wl(t,e){return ky(t,wy(ns(e)))}i(wl,"omitBy");var ba=wl,Sy=i(t=>{let e=t.checks;return e.length===0?"":e.map(Ey).join("")},"generateStringChecks"),Ey=i(t=>{switch(t.kind){case"min":return`.min(${T(t.value)}, ${T(t.message)})`;case"max":return`.max(${T(t.value)}, ${T(t.message)})`;case"length":return`.length(${T(t.value)}, ${T(t.message)})`;case"email":return`.email(${T(t.message)})`;case"url":return`.url(${T(t.message)})`;case"emoji":return`.emoji(${T(t.message)})`;case"uuid":return`.uuid(${T(t.message)})`;case"cuid":return`.cuid(${T(t.message)})`;case"cuid2":return`.cuid2(${T(t.message)})`;case"ulid":return`.ulid(${T(t.message)})`;case"includes":let e=tt({message:t.message,position:t.position});return`.includes(${T(t.value)}, ${e})`;case"startsWith":return`.startsWith(${T(t.value)}, ${T(t.message)})`;case"endsWith":return`.endsWith(${T(t.value)}, ${T(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${T(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let n=t.precision===null?void 0:t.precision;return`.datetime(${tt({message:t.message,precision:n,offset:t.offset})})`;case"ip":return`.ip(${tt({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),Oy=i(t=>{let e=t.checks;return e.length===0?"":e.map(Zy).join("")},"generateNumberChecks"),Zy=i(t=>{switch(t.kind){case"min":return`.min(${T(t.value)}, ${T(t.message)})`;case"max":return`.max(${T(t.value)}, ${T(t.message)})`;case"int":return`.int(${T(t.message)})`;case"multipleOf":return`.multipleOf(${T(t.value)}, ${T(t.message)})`;case"finite":return`.finite(${T(t.message)})`;default:return""}},"_generateNumberCheck"),By=i(t=>{let e=t.checks;return e.length===0?"":e.map(Iy).join("")},"generateBigIntChecks"),Iy=i(t=>{switch(t.kind){case"min":return`.min(${T(t.value)}, ${T(t.message)})`;case"max":return`.max(${T(t.value)}, ${T(t.message)})`;case"multipleOf":return`.multipleOf(${T(t.value)}, ${T(t.message)})`;default:return""}},"_generateBigIntCheck"),Cy=i(t=>{let e=t.checks;return e.length===0?"":e.map(Ay).join("")},"generateDateChecks"),Ay=i(t=>{switch(t.kind){case"min":return`.min(${wa(t.value)}, ${T(t.message)})`;case"max":return`.max(${wa(t.value)}, ${T(t.message)})`;default:return""}},"_generateDateCheck"),wa=i(t=>`new Date(${t})`,"dateTs"),Ry=i(t=>{let e=[];if(t.exactLength){let{value:r,message:n}=t.exactLength;e.push(`.length(${T(r)}, ${T(n)})`)}if(t.minLength){let{value:r,message:n}=t.minLength;e.push(`.min(${T(r)}, ${T(n)})`)}if(t.maxLength){let{value:r,message:n}=t.maxLength;e.push(`.max(${T(r)}, ${T(n)})`)}return e.join("")},"generateArrayChecks"),Hy=i(t=>{let e=[];if(t.minSize){let{value:r,message:n}=t.minSize;e.push(`.min(${T(r)}, ${T(n)})`)}if(t.maxSize){let{value:r,message:n}=t.maxSize;e.push(`.max(${T(r)}, ${T(n)})`)}return e.join("")},"generateSetChecks");function ss(t){return N(t)}i(ss,"toTypescriptSchema");function N(t){let r=t._def;switch(r.typeName){case u.ZodFirstPartyTypeKind.ZodString:return`z.string()${Sy(r)}${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${Oy(r)}${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${By(r)}${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${R(r)}${A(t._def)}`.trim();case u.ZodFirstPartyTypeKind.ZodDate:return`z.date()${Cy(r)}${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodNull:return`z.null()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodAny:return`z.any()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodNever:return`z.never()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodArray:return`z.array(${N(r.type)})${Ry(r)}${R(r)}${A(r)}`;case u.ZodFirstPartyTypeKind.ZodObject:let n=Ty(r.shape(),N),s=t.additionalProperties(),a=s?`.catchall(${N(s)})`:"";return["z.object({",...Object.entries(n).map(([ou,lu])=>` ${ou}: ${lu},`),`})${a}${R(r)}${A(r)}`].join(`
|
|
11
|
+
`).trim();case u.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${r.options.map(N).join(", ")}])${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let l=r.options.map(N);return`z.discriminatedUnion(${T(r.discriminator)}, [${l.join(", ")}])${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodIntersection:let f=N(r.left),g=N(r.right);return`z.intersection(${f}, ${g})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${r.items.map(N).join(", ")}])${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodRecord:let x=N(r.keyType),O=N(r.valueType);return`z.record(${x}, ${O})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodMap:let B=N(r.keyType),U=N(r.valueType);return`z.map(${B}, ${U})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodSet:return`z.set(${N(r.valueType)})${Hy(r)}${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodFunction:let W=r.args.items.map(N),Q=W.length?`.args(${W.join(", ")})`:"",ae=N(r.returns);return`z.function()${Q}.returns(${ae})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${N(r.getter())})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${T(r.value)})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${r.values.map(T).join(", ")}])${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodEffects:throw new Oe(u.ZodFirstPartyTypeKind.ZodEffects);case u.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Oe(u.ZodFirstPartyTypeKind.ZodNativeEnum);case u.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${N(r.innerType)})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${N(r.innerType)})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodDefault:let Je=tt(r.defaultValue());return`z.default(${N(r.innerType)}, ${Je})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodCatch:throw new Oe(u.ZodFirstPartyTypeKind.ZodCatch);case u.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${N(r.type)})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodBranded:throw new Oe(u.ZodFirstPartyTypeKind.ZodBranded);case u.ZodFirstPartyTypeKind.ZodPipeline:throw new Oe(u.ZodFirstPartyTypeKind.ZodPipeline);case u.ZodFirstPartyTypeKind.ZodSymbol:throw new Oe(u.ZodFirstPartyTypeKind.ZodSymbol);case u.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${N(r.innerType)})${R(r)}${A(r)}`.trim();case u.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${T(r.uri)})${R(r)}${A(r)}`.trim();default:Z.assertNever(r)}}i(N,"sUnwrapZod");var A=i(t=>t.description?`.describe(${T(t.description)})`:"","_maybeDescribe"),R=i(t=>`${Dy(t)}${My(t)}${Ny(t)}${$y(t)}${jy(t)}${Ky(t)}${Uy(t)}`,"_addZuiExtensions"),Dy=i(t=>{var e;return(e=t[b])!=null&&e.title?`.title(${T(t[b].title)})`:""},"_maybeTitle"),My=i(t=>{var e;return(e=t[b])!=null&&e.displayAs?`.displayAs(${Ca({id:t[b].displayAs[0],params:t[b].displayAs[1]})})`:""},"_maybeDisplayAs"),Ny=i(t=>{var e;return(e=t[b])!=null&&e.disabled?`.disabled(${t[b].disabled})`:""},"_maybeDisabled"),$y=i(t=>{var e;return(e=t[b])!=null&&e.hidden?`.hidden(${t[b].hidden})`:""},"_maybeHidden"),jy=i(t=>{var e;return(e=t[b])!=null&&e.placeholder?`.placeholder(${T(t[b].placeholder)})`:""},"_maybePlaceholder"),Ky=i(t=>{var e;return(e=t[b])!=null&&e.secret?".secret()":""},"_maybeSecret"),Uy=i(t=>{var e;let r=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],n=Object.entries((e=t[b])!=null?e:{}).filter(([s])=>!r.includes(s));return n.length>0?`.metadata(${Ca(Object.fromEntries(n))})`:""},"_maybeSetMetadata"),Fy=i(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[b]&&(e[b]=t._def[b]);for(let r of t._def.checks)switch(r.kind){case"min":{let n=r.inclusive?"minimum":"exclusiveMinimum",s=r.inclusive?"exclusiveMinimum":"minimum";e[n]=r.value,delete e[s];break}case"max":{let n=r.inclusive?"maximum":"exclusiveMaximum",s=r.inclusive?"exclusiveMaximum":"maximum";e[n]=r.value,delete e[s];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=r.value;break;default:}return e},"zodNumberToJsonNumber"),Pl="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",xl="(([+-]\\d{2}(:?\\d{2})?)|Z)",zy="Z",kl="(\\.\\d+)?",Kn="\\.\\d{",Ly="}",Sl=i(t=>{let e=t.precision?Kn+t.precision+Ly:t.precision===0?"":kl,r=t.offset?xl:zy;return new RegExp(`^${Pl}${e}${r}$`)},"generateDatetimeRegex"),Wy=i(t=>({precision:qy(t),offset:t.endsWith(`${xl}$`)}),"extractPrecisionAndOffset"),qy=i(t=>{let e=t.slice(1+Pl.length);return e.startsWith(kl)?null:e.startsWith(Kn)?parseInt(e.slice(Kn.length)):0},"_extractPrecision"),Ct={};Fr(Ct,{escapeSpecialChars:()=>Vy});var Vy=i(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function as(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=p(c({},t.errorMessage),{[e]:r}))}i(as,"addErrorMessage");function H(t,e,r,n,s){t[e]=r,as(t,e,n,s)}i(H,"setResponseValueAndErrors");var j={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function is(t,e){let r=c({type:"string"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{});function n(s){return e.patternStrategy==="escape"?Ct.escapeSpecialChars(s):s}if(i(n,"processPattern"),t.checks)for(let s of t.checks)switch(s.kind){case"min":H(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e);break;case"max":H(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ee(r,"email",s.message,e);break;case"format:idn-email":Ee(r,"idn-email",s.message,e);break;case"pattern:zod":de(r,j.email,s.message,e);break}break;case"url":Ee(r,"uri",s.message,e);break;case"uuid":Ee(r,"uuid",s.message,e);break;case"regex":de(r,s.regex.source,s.message,e);break;case"cuid":de(r,j.cuid,s.message,e);break;case"cuid2":de(r,j.cuid2,s.message,e);break;case"startsWith":de(r,"^"+n(s.value),s.message,e);break;case"endsWith":de(r,n(s.value)+"$",s.message,e);break;case"datetime":Ee(r,"date-time",s.message,e);break;case"length":H(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e),H(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"includes":{de(r,n(s.value),s.message,e);break}case"ip":{s.version!=="v6"&&Ee(r,"ipv4",s.message,e),s.version!=="v4"&&Ee(r,"ipv6",s.message,e);break}case"emoji":de(r,j.emoji,s.message,e);break;case"ulid":{de(r,j.ulid,s.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}i(is,"parseStringDef");var Ee=i((t,e,r,n)=>{var s;t.format||(s=t.anyOf)!=null&&s.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(c({format:t.format},t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(c({format:e},r&&n.errorMessages&&{errorMessage:{format:r}}))):H(t,"format",e,r,n)},"addFormat"),de=i((t,e,r,n)=>{var s;t.pattern||(s=t.allOf)!=null&&s.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(c({pattern:t.pattern},t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(c({pattern:e},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):H(t,"pattern",e,r,n)},"addPattern"),Gy=i(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[b]&&(e[b]=t._def[b]);for(let r of t._def.checks)switch(r.kind){case"cuid":e.format="cuid",e.pattern=j.cuid;break;case"cuid2":e.format="cuid2",e.pattern=j.cuid2;break;case"ulid":e.format="ulid",e.pattern=j.ulid;break;case"uuid":e.format="uuid",e.pattern=j.uuid;break;case"emoji":e.format="emoji",e.pattern=j.emoji;break;case"email":e.format="email",e.pattern=j.email;break;case"ip":e.format=r.version==="v6"?"ipv6":"ipv4",e.pattern=r.version==="v6"?j.ipv6:j.ipv4;break;case"datetime":e.format="date-time",e.pattern=Sl(r).source,e[b]=p(c({},e[b]),{precision:r.precision,offset:r.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Ct.escapeSpecialChars(r.value)}$`;break;case"startsWith":e.pattern=`^${Ct.escapeSpecialChars(r.value)}`;break;case"includes":let n=r.position&&r.position>=1?`^(?:.{${r.position}}).*`:"";e.pattern=`${n}${Ct.escapeSpecialChars(r.value)}`;break;case"regex":e.pattern=r.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,r.value);break;case"min":e.minLength=Math.max(0,r.value);break;case"max":e.maxLength=Math.max(0,r.value);break;default:throw new Ka({zodType:u.ZodFirstPartyTypeKind.ZodString,checkKind:r.kind})}return e},"zodStringToJsonString"),Jy=i((t,e)=>{let r={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[b]&&(r[b]=t._def[b]),t._def.minLength&&(r.minItems=t._def.minLength.value),t._def.maxLength&&(r.maxItems=t._def.maxLength.value),t._def.exactLength&&(r.minItems=t._def.exactLength.value,r.maxItems=t._def.exactLength.value),r},"zodArrayToJsonArray"),Xy=i((t,e)=>{let r={type:"array",description:t.description,uniqueItems:!0,items:e(t._def.valueType),"x-zui":t._def["x-zui"]};return t._def[b]&&(r[b]=t._def[b]),t._def.minSize&&(r.minItems=t._def.minSize.value),t._def.maxSize&&(r.maxItems=t._def.maxSize.value),r},"zodSetToJsonSet"),Yy=i((t,e)=>{let r={type:"array",description:t.description,items:t._def.items.map(n=>e(n))};return t._def[b]&&(r[b]=t._def[b]),t._def.rest&&(r.additionalItems=e(t._def.rest)),r},"zodTupleToJsonTuple");function V(t){let e=t,r=e._def;switch(r.typeName){case u.ZodFirstPartyTypeKind.ZodString:return Gy(e);case u.ZodFirstPartyTypeKind.ZodNumber:return Fy(e);case u.ZodFirstPartyTypeKind.ZodNaN:throw new ee(u.ZodFirstPartyTypeKind.ZodNaN);case u.ZodFirstPartyTypeKind.ZodBigInt:throw new ee(u.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case u.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:r.description,"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodDate:throw new ee(u.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case u.ZodFirstPartyTypeKind.ZodUndefined:return Bn(r);case u.ZodFirstPartyTypeKind.ZodNull:return In(r);case u.ZodFirstPartyTypeKind.ZodAny:return{description:r.description,"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodUnknown:return{description:r.description,"x-zui":p(c({},r["x-zui"]),{def:{typeName:u.ZodFirstPartyTypeKind.ZodUnknown}})};case u.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:r.description,"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodVoid:throw new ee(u.ZodFirstPartyTypeKind.ZodVoid);case u.ZodFirstPartyTypeKind.ZodArray:return Jy(e,V);case u.ZodFirstPartyTypeKind.ZodObject:let n=Object.entries(r.shape()),s=n.filter(([g,h])=>!h.isOptional()),a=s.length?s.map(([g])=>g):void 0,o=n.map(([g,h])=>[g,h.mandatory()]).map(([g,h])=>[g,V(h)]),l=!1;return r.unknownKeys instanceof u.ZodType?l=V(r.unknownKeys):r.unknownKeys==="passthrough"&&(l=!0),{type:"object",description:r.description,properties:Object.fromEntries(o),required:a,additionalProperties:l,"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodUnion:return{description:r.description,anyOf:r.options.map(g=>V(g)),"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:r.description,anyOf:r.options.map(g=>V(g)),"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodIntersection:let d=V(r.left),f=V(r.right);return"additionalProperties"in d&&delete d.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:r.description,allOf:[d,f],"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodTuple:return Yy(e,V);case u.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:r.description,additionalProperties:V(r.valueType),"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodMap:throw new ee(u.ZodFirstPartyTypeKind.ZodMap);case u.ZodFirstPartyTypeKind.ZodSet:return Xy(e,V);case u.ZodFirstPartyTypeKind.ZodFunction:throw new ee(u.ZodFirstPartyTypeKind.ZodFunction);case u.ZodFirstPartyTypeKind.ZodLazy:throw new ee(u.ZodFirstPartyTypeKind.ZodLazy);case u.ZodFirstPartyTypeKind.ZodLiteral:if(typeof r.value=="string")return{type:"string",description:r.description,const:r.value,"x-zui":r["x-zui"]};if(typeof r.value=="number")return{type:"number",description:r.description,const:r.value,"x-zui":r["x-zui"]};if(typeof r.value=="boolean")return{type:"boolean",description:r.description,const:r.value,"x-zui":r["x-zui"]};if(r.value===null)return In(r);if(r.value===void 0)return Bn(r);{u.util.assertEqual(!0);let g=typeof r.value;throw new Lr(`Unsupported literal type: "${g}"`)}case u.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:r.description,enum:r.values,"x-zui":r["x-zui"]};case u.ZodFirstPartyTypeKind.ZodEffects:throw new ee(u.ZodFirstPartyTypeKind.ZodEffects);case u.ZodFirstPartyTypeKind.ZodNativeEnum:throw new ee(u.ZodFirstPartyTypeKind.ZodNativeEnum);case u.ZodFirstPartyTypeKind.ZodOptional:return{description:r.description,anyOf:[V(r.innerType),Bn()],"x-zui":p(c({},r["x-zui"]),{def:{typeName:u.ZodFirstPartyTypeKind.ZodOptional}})};case u.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[V(r.innerType),In()],"x-zui":p(c({},r["x-zui"]),{def:{typeName:u.ZodFirstPartyTypeKind.ZodNullable}})};case u.ZodFirstPartyTypeKind.ZodDefault:return p(c({},V(r.innerType)),{default:r.defaultValue()});case u.ZodFirstPartyTypeKind.ZodCatch:throw new ee(u.ZodFirstPartyTypeKind.ZodCatch);case u.ZodFirstPartyTypeKind.ZodPromise:throw new ee(u.ZodFirstPartyTypeKind.ZodPromise);case u.ZodFirstPartyTypeKind.ZodBranded:throw new ee(u.ZodFirstPartyTypeKind.ZodBranded);case u.ZodFirstPartyTypeKind.ZodPipeline:throw new ee(u.ZodFirstPartyTypeKind.ZodPipeline);case u.ZodFirstPartyTypeKind.ZodSymbol:throw new ee(u.ZodFirstPartyTypeKind.ZodPipeline);case u.ZodFirstPartyTypeKind.ZodReadonly:return p(c({},V(r.innerType)),{readOnly:!0});case u.ZodFirstPartyTypeKind.ZodRef:return{$ref:r.uri,description:r.description,"x-zui":r["x-zui"]};default:u.util.assertNever(r)}}i(V,"toJSONSchema");var Bn=i(t=>({not:!0,description:t?.description,"x-zui":p(c({},t?.["x-zui"]),{def:{typeName:u.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),In=i(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),El=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};i(El,"ParseInputLazyPath");var ie=El,Pa=i((t,e)=>{if(it(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new le(t.common.issues);return this._error=r,this._error}}},"handleResult"),Ol=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._metadataRoot._def.description}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(c({},this._def))}_getType(e){return pe(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new te,ctx:{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Mt(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let s={common:{issues:[],async:(n=r?.async)!=null?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Pa(s,a)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Mt(s)?s:Promise.resolve(s));return Pa(n,a)}refine(e,r){let n=i(s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r,"getIssueProperties");return this._refinement((s,a)=>{let o=e(s),l=i(()=>a.addIssue(c({code:y.custom},n(s))),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new be({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return fe.create(this,this._def)}nullable(){return De.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lt.create(this,this._def)}promise(){return Ut.create(this,this._def)}mandatory(){return this}or(e){return fn.create([this,e],this._def)}and(e){return an.create(this,e,this._def)}transform(e){return new be(p(c({},k(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new jt(p(c({},k(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new rn(c({typeName:"ZodBranded",type:this},k(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new nn(p(c({},k(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.clone();return r._metadataRoot._def.description=e,r}pipe(e){return pn.create(this,e)}readonly(){return Ft.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var r,n,s;let a=this.clone(),o=a._metadataRoot;(s=(r=o._def)[n=b])!=null||(r[n]={});for(let[l,d]of Object.entries(e))o._def[b]=p(c({},o._def[b]),{[l]:d});return a}getMetadata(){return c({},this._metadataRoot._def[b])}setMetadata(e){this._metadataRoot._def[b]=c({},e)}get ui(){return c({},this._metadataRoot._def[b])}get _metadataRoot(){return this.naked()}displayAs(e){return this.metadata({displayAs:[e.id,e.params]})}title(e){return this.metadata({title:e})}hidden(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this.metadata({hidden:r})}disabled(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this.metadata({disabled:r})}placeholder(e){return this.metadata({placeholder:e})}toJSONSchema(){return V(this)}toTypescriptType(e){return qn(this,e)}toTypescriptSchema(){return ss(this)}naked(){return this}};i(Ol,"ZodType");var E=Ol,os=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(os||{}),Z;(t=>{t.assertEqual=i(s=>s,"assertEqual");function e(s){}t.assertIs=e,i(e,"assertIs");function r(s){throw new Error("assertNever called")}t.assertNever=r,i(r,"assertNever"),t.arrayToEnum=i(s=>{let a={};for(let o of s)a[o]=o;return a},"arrayToEnum"),t.getValidEnumValues=i(s=>{let a=(0,t.objectKeys)(s).filter(l=>typeof s[s[l]]!="number"),o={};for(let l of a)o[l]=s[l];return(0,t.objectValues)(o)},"getValidEnumValues"),t.objectValues=i(s=>(0,t.objectKeys)(s).map(function(a){return s[a]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},t.find=i((s,a)=>{for(let o of s)if(a(o))return o},"find"),t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,i(n,"joinValues"),t.jsonStringifyReplacer=i((s,a)=>typeof a=="bigint"?a.toString():a,"jsonStringifyReplacer"),t.compareFunctions=i((s,a)=>s.toString()===a.toString(),"compareFunctions"),t.mock=i(()=>({}),"mock")})(Z||(Z={}));var lr;(t=>{t.mergeShapes=i((e,r)=>c(c({},e),r),"mergeShapes")})(lr||(lr={}));var v=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pe=i(t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map<"u"&&t instanceof Map?v.map:typeof Set<"u"&&t instanceof Set?v.set:typeof Date<"u"&&t instanceof Date?v.date:v.object;default:return v.unknown}},"getParsedType");function k(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s,[b]:t?.[b]}:{errorMap:i((o,l)=>o.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:s,[b]:t?.[b]}}i(k,"processCreateParams");var ls=i((t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===v.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Z.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Z.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Z.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${Z.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Z.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;case y.unresolved_reference:r="Unresolved reference";break;default:r=e.defaultError,Z.assertNever(t)}return{message:r}},"errorMap"),xa=ls,y=Z.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite","unresolved_reference"]),Zl=i(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),cr=class Bl extends Error{constructor(e){super(),this.issues=[],this.addIssue=i(n=>{this.issues=[...this.issues,n]},"addIssue"),this.addIssues=i((n=[])=>{this.issues=[...this.issues,...n]},"addIssues");let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(a){return a.message},n={_errors:[]},s=i(a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let l=n,d=0;for(;d<o.path.length;){let f=o.path[d];d===o.path.length-1?(l[f]=l[f]||{_errors:[]},l[f]._errors.push(r(o))):l[f]=l[f]||{_errors:[]},l=l[f],d++}}},"processError");return s(this),n}static assert(e){if(!(e instanceof Bl))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(cr,"ZodError");cr.create=i(t=>new cr(t),"create");var le=cr,Il=ls;function cs(t){Il=t}i(cs,"setErrorMap");function at(){return Il}i(at,"getErrorMap");var Dt=i(t=>{var e;let{data:r,path:n,errorMaps:s,issueData:a}=t,o=[...n,...a.path||[]],l=p(c({},a),{path:o}),d="",f=s.filter(g=>!!g).slice().reverse();for(let g of f)d=g(l,{data:r,defaultError:d}).message;return p(c({},a),{path:o,message:(e=a.message)!=null?e:d})},"makeIssue"),Cl=[];function m(t,e){let r=Dt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,at(),ls].filter(n=>!!n)});t.common.issues.push(r)}i(m,"addIssueToContext");var Al=class Rl{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return P;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r)n.push({key:await s.key,value:await s.value});return Rl.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return P;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}};i(Al,"ParseStatus");var te=Al,P=Object.freeze({status:"aborted"}),Re=i(t=>({status:"dirty",value:t}),"DIRTY"),J=i(t=>({status:"valid",value:t}),"OK"),dr=i(t=>t.status==="aborted","isAborted"),ur=i(t=>t.status==="dirty","isDirty"),it=i(t=>t.status==="valid","isValid"),Mt=i(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),w;(t=>{t.errToObj=i(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=i(e=>typeof e=="string"?e:e?.message,"toString")})(w||(w={}));var pr=class Hl extends E{constructor(){super(...arguments),this._any=!0}_parse(e){return J(e.data)}isEqual(e){return e instanceof Hl}};i(pr,"ZodAny");pr.create=i(t=>new pr(c({typeName:"ZodAny"},k(t))),"create");var ot=pr,fr=class Be extends E{dereference(e){return new Be(p(c({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Be(p(c({},this._def),{type:this._def.type.clone()}))}isEqual(e){var r,n,s,a,o,l;return e instanceof Be?rt((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&rt((s=this._def.maxLength)==null?void 0:s.value,(a=e._def.maxLength)==null?void 0:a.value)&&rt((o=this._def.minLength)==null?void 0:o.value,(l=e._def.minLength)==null?void 0:l.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==v.array)return m(r,{code:y.invalid_type,expected:v.array,received:r.parsedType}),P;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,l=r.data.length<s.exactLength.value;(o||l)&&(m(r,{code:o?y.too_big:y.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(m(r,{code:y.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(m(r,{code:y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,l)=>s.type._parseAsync(new ie(r,o,r.path,l)))).then(o=>te.mergeArray(n,o));let a=[...r.data].map((o,l)=>s.type._parseSync(new ie(r,o,r.path,l)));return te.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new Be(p(c({},this._def),{minLength:{value:e,message:w.toString(r)}}))}max(e,r){return new Be(p(c({},this._def),{maxLength:{value:e,message:w.toString(r)}}))}length(e,r){return new Be(p(c({},this._def),{exactLength:{value:e,message:w.toString(r)}}))}nonempty(e){return this.min(1,e)}};i(fr,"ZodArray");fr.create=i((t,e)=>new fr(c({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},k(e))),"create");var lt=fr,Qy=i((t,e)=>Dl(t,e,new WeakSet),"isEqual"),Dl=i((t,e,r)=>_y(t,e,eh(r)),"_isEqualWithVisitedTracking"),eh=i(t=>(e,r)=>{if(ia(e)&&!t.has(e)&&ia(r)&&!t.has(r)){let n=ba(e,Ta),s=ba(r,Ta);return t.add(n).add(s).add(e).add(r),Dl(n,s,t)}},"_customizerWithVisitedTracking"),th={compare:Qy},Ml=class{constructor(e=[],r={}){this._options=c(c({},th),r),this._items=[];for(let n of e)this.add(n)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(r=>this._options.compare(r,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(r=>e.has(r))}};i(Ml,"CustomSet");var K=Ml,gr=class er extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==v.bigint){let a=this._getOrReturnCtx(e);return m(a,{code:y.invalid_type,expected:v.bigint,received:a.parsedType}),P}let n,s=new te;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Z.assertNever(a);return{status:s.value,value:e.data}}isEqual(e){if(!(e instanceof er)||this._def.coerce!==e._def.coerce)return!1;let r=new K(this._def.checks),n=new K(e._def.checks);return r.isEqual(n)}gte(e,r){return this.setLimit("min",e,!0,w.toString(r))}gt(e,r){return this.setLimit("min",e,!1,w.toString(r))}lte(e,r){return this.setLimit("max",e,!0,w.toString(r))}lt(e,r){return this.setLimit("max",e,!1,w.toString(r))}setLimit(e,r,n,s){return new er(p(c({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:w.toString(s)}]}))}_addCheck(e){return new er(p(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};i(gr,"ZodBigInt");gr.create=i(t=>{var e;return new gr(c({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},k(t)))},"create");var en=gr,yr=class Nl extends E{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==v.boolean){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.boolean,received:n.parsedType}),P}return J(e.data)}isEqual(e){return e instanceof Nl?this._def.coerce===e._def.coerce:!1}};i(yr,"ZodBoolean");yr.create=i(t=>new yr(c({typeName:"ZodBoolean",coerce:t?.coerce||!1},k(t))),"create");var tn=yr,$l=Symbol("zod_brand"),jl=class _t extends E{dereference(e){return new _t(p(c({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new _t(p(c({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}isEqual(e){return e instanceof _t?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new _t(p(c({},this._def),{type:this._def.type.mandatory()}))}};i(jl,"ZodBranded");var rn=jl,hr=class Tt extends E{_parse(e){let{ctx:r}=this._processInputParams(e),n=p(c({},r),{common:p(c({},r.common),{issues:[]})}),s=this._def.innerType._parse({data:n.data,path:n.path,parent:c({},n)});return Mt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new le(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new le(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Tt?this._def.innerType.isEqual(e._def.innerType)&&Z.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Tt(p(c({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Tt(p(c({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Tt(p(c({},this._def),{innerType:this._def.innerType.mandatory()}))}};i(hr,"ZodCatch");hr.create=i((t,e)=>new hr(c({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},k(e))),"create");var nn=hr,ds=i((t,e={},r)=>t?ot.create().superRefine((n,s)=>{var a,o;if(!t(n)){let l=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(o=(a=l.fatal)!=null?a:r)!=null?o:!0,f=typeof l=="string"?{message:l}:l;s.addIssue(p(c({code:"custom"},f),{fatal:d}))}}):ot.create(),"custom"),mr=class Un extends E{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){let a=this._getOrReturnCtx(e);return m(a,{code:y.invalid_type,expected:v.date,received:a.parsedType}),P}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return m(a,{code:y.invalid_date}),P}let n=new te,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:y.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:y.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Z.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Un(p(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof Un))return!1;let r=new K(this._def.checks),n=new K(e._def.checks);return r.isEqual(n)&&this._def.coerce===e._def.coerce}};i(mr,"ZodDate");mr.create=i(t=>new mr(c({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},k(t))),"create");var sn=mr,vr=class bt extends E{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===v.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}dereference(e){return new bt(p(c({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new bt(p(c({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof bt?this._def.innerType.isEqual(e._def.innerType)&&rt(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new bt(p(c({},this._def),{innerType:this._def.innerType.mandatory()}))}};i(vr,"ZodDefault");vr.create=i((t,e,r)=>new vr(c({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},k(r))),"create");var jt=vr,he=i(t=>Array.from(new Set(t)),"unique"),ue=i(t=>t instanceof on?ue(t.schema):t instanceof be?ue(t.innerType()):t instanceof ln?[t.value]:t instanceof We?t.options:t instanceof cn?Z.objectValues(t.enum):t instanceof jt?ue(t._def.innerType):t instanceof zt?[void 0]:t instanceof dn?[null]:t instanceof fe?[void 0,...ue(t.unwrap())]:t instanceof De?[null,...ue(t.unwrap())]:t instanceof rn||t instanceof Ft?ue(t.unwrap()):t instanceof nn?ue(t._def.innerType):[],"getDiscriminator"),Kl=class Ie extends E{dereference(e){let r=this.options.map(s=>s.dereference(e)),n=Ie._getOptionsMap(this.discriminator,r);return new Ie(p(c({},this._def),{options:r,optionsMap:n}))}getReferences(){return he(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(r=>r.clone());return new Ie(p(c({},this._def),{options:e}))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.object)return m(r,{code:y.invalid_type,expected:v.object,received:r.parsedType}),P;let n=this.discriminator,s=r.data[n],a=this.optionsMap.get(s);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(m(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),P)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=Ie._getOptionsMap(e,r);return new Ie(c({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:s},k(n)))}static _getOptionsMap(e,r){let n=new Map;for(let s of r){let a=ue(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,s)}}return n}isEqual(e){if(!(e instanceof Ie)||this._def.discriminator!==e._def.discriminator)return!1;let r=i((a,o)=>a.isEqual(o),"compare"),n=new K(this._def.options,{compare:r}),s=new K(e._def.options,{compare:r});return n.isEqual(s)}};i(Kl,"ZodDiscriminatedUnion");var us=Kl;function Kt(t,e){return new We(c({values:t,typeName:"ZodEnum"},k(e)))}i(Kt,"createZodEnum");var ps=class tr extends E{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return m(r,{expected:Z.joinValues(n),received:r.parsedType,code:y.invalid_type}),P}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return m(r,{received:r.data,code:y.invalid_enum_value,options:n}),P}return J(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return tr.create(e,c(c({},this._def),r))}exclude(e,r=this._def){return tr.create(this.options.filter(n=>!e.includes(n)),c(c({},this._def),r))}isEqual(e){if(!(e instanceof tr))return!1;let r=new K(this._def.values),n=new K(e._def.values);return r.isEqual(n)}};i(ps,"ZodEnum");ps.create=Kt;var We=ps,Ul=class Ce extends E{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new Ce(p(c({},this._def),{args:r,returns:n}))}getReferences(){return he([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new Ce(p(c({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.function)return m(r,{code:y.invalid_type,expected:v.function,received:r.parsedType}),P;function n(l,d){return Dt({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,at(),xa].filter(f=>!!f),issueData:{code:y.invalid_arguments,argumentsError:d}})}i(n,"makeArgsIssue");function s(l,d){return Dt({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,at(),xa].filter(f=>!!f),issueData:{code:y.invalid_return_type,returnTypeError:d}})}i(s,"makeReturnsIssue");let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ut){let l=this;return J(async function(...d){let f=new le([]),g=await l._def.args.parseAsync(d,a).catch(O=>{throw f.addIssue(n(d,O)),f}),h=await Reflect.apply(o,this,g);return await l._def.returns._def.type.parseAsync(h,a).catch(O=>{throw f.addIssue(s(h,O)),f})})}else{let l=this;return J(function(...d){let f=l._def.args.safeParse(d,a);if(!f.success)throw new le([n(d,f.error)]);let g=Reflect.apply(o,this,f.data),h=l._def.returns.safeParse(g,a);if(!h.success)throw new le([s(g,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ce(p(c({},this._def),{args:Ne.create(e).rest(nt.create())}))}returns(e){return new Ce(p(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Ce(c({args:e||Ne.create([]).rest(nt.create()),returns:r||nt.create(),typeName:"ZodFunction"},k(n)))}isEqual(e){return e instanceof Ce&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};i(Ul,"ZodFunction");var fs=Ul;function _r(t,e){let r=pe(t),n=pe(e);if(t===e)return{valid:!0,data:t};if(r===v.object&&n===v.object){let s=Z.objectKeys(e),a=Z.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o=c(c({},t),e);for(let l of a){let d=_r(t[l],e[l]);if(!d.valid)return{valid:!1};o[l]=d.data}return{valid:!0,data:o}}else if(r===v.array&&n===v.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let o=t[a],l=e[a],d=_r(o,l);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return r===v.date&&n===v.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}i(_r,"mergeValues");var Tr=class rr extends E{dereference(e){return new rr(p(c({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return he([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new rr(p(c({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=i((a,o)=>{if(dr(a)||dr(o))return P;let l=_r(a.value,o.value);return l.valid?((ur(a)||ur(o))&&r.dirty(),{status:r.value,value:l.data}):(m(n,{code:y.invalid_intersection_types}),P)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}isEqual(e){if(!(e instanceof rr))return!1;let r=i((a,o)=>a.isEqual(o),"compare"),n=new K([this._def.left,this._def.right],{compare:r}),s=new K([e._def.left,e._def.right],{compare:r});return n.isEqual(s)}};i(Tr,"ZodIntersection");Tr.create=i((t,e,r)=>new Tr(c({left:t,right:e,typeName:"ZodIntersection"},k(r))),"create");var an=Tr,br=class wt extends E{get schema(){return this._def.getter()}dereference(e){return new wt(p(c({},this._def),{getter:i(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new wt(p(c({},this._def),{getter:i(()=>this._def.getter().clone(),"getter")}))}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}isEqual(e){return e instanceof wt?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new wt(p(c({},this._def),{getter:i(()=>this._def.getter().mandatory(),"getter")}))}};i(br,"ZodLazy");br.create=i((t,e)=>new br(c({getter:t,typeName:"ZodLazy"},k(e))),"create");var on=br,wr=class Fl extends E{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return m(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Fl?rt(this._def.value,e._def.value):!1}};i(wr,"ZodLiteral");wr.create=i((t,e)=>new wr(c({value:t,typeName:"ZodLiteral"},k(e))),"create");var ln=wr,Pr=class nr extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new nr(p(c({},this._def),{keyType:r,valueType:n}))}getReferences(){return he([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new nr(p(c({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.map)return m(n,{code:y.invalid_type,expected:v.map,received:n.parsedType}),P;let s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([l,d],f)=>({key:s._parse(new ie(n,l,n.path,[f,"key"])),value:a._parse(new ie(n,d,n.path,[f,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let d of o){let f=await d.key,g=await d.value;if(f.status==="aborted"||g.status==="aborted")return P;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(f.value,g.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let d of o){let f=d.key,g=d.value;if(f.status==="aborted"||g.status==="aborted")return P;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(f.value,g.value)}return{status:r.value,value:l}}}isEqual(e){return!(!(e instanceof nr)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};i(Pr,"ZodMap");Pr.create=i((t,e,r)=>new Pr(c({valueType:e,keyType:t,typeName:"ZodMap"},k(r))),"create");var gs=Pr,xr=class zl extends E{_parse(e){if(this._getType(e)!==v.nan){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.nan,received:n.parsedType}),P}return{status:"valid",value:e.data}}isEqual(e){return e instanceof zl}};i(xr,"ZodNaN");xr.create=i(t=>new xr(c({typeName:"ZodNaN"},k(t))),"create");var ys=xr,kr=class Ll extends E{_parse(e){let r=Z.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){let s=Z.objectValues(r);return m(n,{expected:Z.joinValues(s),received:n.parsedType,code:y.invalid_type}),P}if(r.indexOf(e.data)===-1){let s=Z.objectValues(r);return m(n,{received:n.data,code:y.invalid_enum_value,options:s}),P}return J(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Ll?rt(this._def.values,e._def.values):!1}};i(kr,"ZodNativeEnum");kr.create=i((t,e)=>new kr(c({values:t,typeName:"ZodNativeEnum"},k(e))),"create");var cn=kr,Sr=class Wl extends E{_parse(e){let r=this._getOrReturnCtx(e);return m(r,{code:y.invalid_type,expected:v.never,received:r.parsedType}),P}isEqual(e){return e instanceof Wl}};i(Sr,"ZodNever");Sr.create=i(t=>new Sr(c({typeName:"ZodNever"},k(t))),"create");var ut=Sr,Er=class ql extends E{_parse(e){if(this._getType(e)!==v.null){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.null,received:n.parsedType}),P}return J(e.data)}isEqual(e){return e instanceof ql}};i(Er,"ZodNull");Er.create=i(t=>new Er(c({typeName:"ZodNull"},k(t))),"create");var dn=Er,Or=class Pt extends E{dereference(e){return new Pt(p(c({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Pt(p(c({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===v.null?J(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Pt?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Pt(p(c({},this._def),{innerType:this._def.innerType.mandatory()}))}};i(Or,"ZodNullable");Or.create=i((t,e)=>new Or(c({innerType:t,typeName:"ZodNullable"},k(e))),"create");var De=Or;function Vl(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return a%o/Math.pow(10,s)}i(Vl,"floatSafeRemainder");var Zr=class sr extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){let a=this._getOrReturnCtx(e);return m(a,{code:y.invalid_type,expected:v.number,received:a.parsedType}),P}let n,s=new te;for(let a of this._def.checks)a.kind==="int"?Z.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:y.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Vl(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:y.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:y.not_finite,message:a.message}),s.dirty()):Z.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,w.toString(r))}gt(e,r){return this.setLimit("min",e,!1,w.toString(r))}lte(e,r){return this.setLimit("max",e,!0,w.toString(r))}lt(e,r){return this.setLimit("max",e,!1,w.toString(r))}setLimit(e,r,n,s){return new sr(p(c({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:w.toString(s)}]}))}_addCheck(e){return new sr(p(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Z.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof sr))return!1;let r=new K(this._def.checks),n=new K(e._def.checks);return r.isEqual(n)}};i(Zr,"ZodNumber");Zr.create=i(t=>new Zr(c({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},k(t))),"create");var un=Zr;function Ae(t){if(t instanceof Me){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fe.create(Ae(n))}return new Me(p(c({},t._def),{shape:i(()=>e,"shape")}))}else return t instanceof lt?new lt(p(c({},t._def),{type:Ae(t.element)})):t instanceof fe?fe.create(Ae(t.unwrap())):t instanceof De?De.create(Ae(t.unwrap())):t instanceof Ne?Ne.create(t.items.map(e=>Ae(e))):t}i(Ae,"deepPartialify");var Te=class ne extends E{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Z.objectKeys(e);return this._cached={shape:e,keys:r}}dereference(e){let r=this._def.shape(),n={};for(let s in r)n[s]=r[s].dereference(e);return new ne(p(c({},this._def),{shape:i(()=>n,"shape")}))}getReferences(){let e=this._def.shape(),r=[];for(let n in e)r.push(...e[n].getReferences());return he(r)}clone(){let e={},r=this._def.shape();for(let[n,s]of Object.entries(r))e[n]=s.clone();return new ne(p(c({},this._def),{shape:i(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==v.object){let g=this._getOrReturnCtx(e);return m(g,{code:y.invalid_type,expected:v.object,received:g.parsedType}),P}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(this._def.unknownKeys!=="strip")for(let g in s.data)o.includes(g)||l.push(g);let d=[];for(let g of o){let h=a[g],x=s.data[g];d.push({key:{status:"valid",value:g},value:h._parse(new ie(s,x,s.path,g)),alwaysSet:g in s.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let g of l)d.push({key:{status:"valid",value:g},value:{status:"valid",value:s.data[g]}});else if(f==="strict")l.length>0&&(m(s,{code:y.unrecognized_keys,keys:l}),n.dirty());else if(f!=="strip")for(let g of l){let h=s.data[g];d.push({key:{status:"valid",value:g},value:f._parse(new ie(s,h,s.path,g)),alwaysSet:g in s.data})}return s.common.async?Promise.resolve().then(async()=>{let g=[];for(let h of d){let x=await h.key;g.push({key:x,value:await h.value,alwaysSet:h.alwaysSet})}return g}).then(g=>te.mergeObjectSync(n,g)):te.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new ne(c(p(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:i((r,n)=>{var s,a,o,l;let d=(o=(a=(s=this._def).errorMap)==null?void 0:a.call(s,r,n).message)!=null?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=w.errToObj(e).message)!=null?l:d}:{message:d}},"errorMap")}:{}))}strip(){return new ne(p(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new ne(p(c({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof E)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return ot.create();if(this._def.unknownKeys==="strict")return ut.create()}extend(e){return new ne(p(c({},this._def),{shape:i(()=>c(c({},this._def.shape()),e),"shape")}))}merge(e){return new ne({unknownKeys:e._def.unknownKeys,shape:i(()=>c(c({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ne(p(c({},this._def),{unknownKeys:e}))}pick(e){let r={};return Z.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new ne(p(c({},this._def),{shape:i(()=>r,"shape")}))}omit(e){let r={};return Z.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new ne(p(c({},this._def),{shape:i(()=>r,"shape")}))}deepPartial(){return Ae(this)}partial(e){let r={};return Z.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s?.optional()}),new ne(p(c({},this._def),{shape:i(()=>r,"shape")}))}required(e){let r={};return Z.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof fe;)a=a._def.innerType;r[n]=a}}),new ne(p(c({},this._def),{shape:i(()=>r,"shape")}))}keyof(){return Kt(Z.objectKeys(this.shape))}isEqual(e){if(!(e instanceof ne)||!this._unknownKeysEqual(e))return!1;let r=this._def.shape(),n=e._def.shape(),s=i((l,d)=>l[0]===d[0]&&l[1].isEqual(d[1]),"compare"),a=new K(Object.entries(r),{compare:s}),o=new K(Object.entries(n),{compare:s});return a.isEqual(o)}_unknownKeysEqual(e){let r=this.additionalProperties(),n=e.additionalProperties();return r===void 0||n===void 0?r===n:r.isEqual(n)}};i(Te,"ZodObject");Te.create=i((t,e)=>new Te(c({shape:i(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},k(e))),"create");Te.strictCreate=i((t,e)=>new Te(c({shape:i(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},k(e))),"strictCreate");Te.lazycreate=i((t,e)=>new Te(c({shape:t,unknownKeys:"strip",typeName:"ZodObject"},k(e))),"lazycreate");var Me=Te,Br=class ar extends E{dereference(e){return new ar(p(c({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new ar(p(c({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===v.undefined?J(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};i(Br,"ZodOptional");Br.create=i((t,e)=>new Br(c({innerType:t,typeName:"ZodOptional"},k(e))),"create");var fe=Br,Gl=class xt extends E{dereference(e){return new xt(p(c({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return he([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new xt(p(c({},this._def),{in:this._def.in.clone(),out:this._def.out.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return i(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?P:a.status==="dirty"?(r.dirty(),Re(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new xt({in:e,out:r,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof xt)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};i(Gl,"ZodPipeline");var pn=Gl,Ir=class ir extends E{unwrap(){return this._def.type}dereference(e){return new ir(p(c({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new ir(p(c({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.promise&&r.common.async===!1)return m(r,{code:y.invalid_type,expected:v.promise,received:r.parsedType}),P;let n=r.parsedType===v.promise?r.data:Promise.resolve(r.data);return J(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}isEqual(e){return e instanceof ir?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};i(Ir,"ZodPromise");Ir.create=i((t,e)=>new Ir(c({type:t,typeName:"ZodPromise"},k(e))),"create");var Ut=Ir,Cr=class kt extends E{dereference(e){return new kt(p(c({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kt(p(c({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let r=this._def.innerType._parse(e);return it(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof kt?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kt(p(c({},this._def),{innerType:this._def.innerType.mandatory()}))}};i(Cr,"ZodReadonly");Cr.create=i((t,e)=>new Cr(c({innerType:t,typeName:"ZodReadonly"},k(e))),"create");var Ft=Cr,Jl=class Ye extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new Ye(p(c({},this._def),{keyType:r,valueType:n}))}getReferences(){return he([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Ye(p(c({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.object)return m(n,{code:y.invalid_type,expected:v.object,received:n.parsedType}),P;let s=[],a=this._def.keyType,o=this._def.valueType;for(let l in n.data)s.push({key:a._parse(new ie(n,l,n.path,l)),value:o._parse(new ie(n,n.data[l],n.path,l))});return n.common.async?te.mergeObjectAsync(r,s):te.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof E?new Ye(c({keyType:e,valueType:r,typeName:"ZodRecord"},k(n))):new Ye(c({keyType:X.create(),valueType:e,typeName:"ZodRecord"},k(r)))}isEqual(e){return!(!(e instanceof Ye)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};i(Jl,"ZodRecord");var hs=Jl,Ar=class Xl extends E{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return m(r,{code:y.unresolved_reference}),P}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Xl?this._def.uri===e._def.uri:!1}};i(Ar,"ZodRef");Ar.create=i(t=>new Ar({typeName:"ZodRef",uri:t}),"create");var ms=Ar,Rr=class Qe extends E{dereference(e){return new Qe(p(c({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Qe(p(c({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return m(n,{code:y.invalid_type,expected:v.set,received:n.parsedType}),P;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:y.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(m(n,{code:y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let a=this._def.valueType;function o(d){let f=new Set;for(let g of d){if(g.status==="aborted")return P;g.status==="dirty"&&r.dirty(),f.add(g.value)}return{status:r.value,value:f}}i(o,"finalizeSet");let l=[...n.data.values()].map((d,f)=>a._parse(new ie(n,d,n.path,f)));return n.common.async?Promise.all(l).then(d=>o(d)):o(l)}min(e,r){return new Qe(p(c({},this._def),{minSize:{value:e,message:w.toString(r)}}))}max(e,r){return new Qe(p(c({},this._def),{maxSize:{value:e,message:w.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}isEqual(e){var r,n,s,a;if(!(e instanceof Qe))return!1;let o=(r=this._def.minSize)==null?void 0:r.value,l=(n=e._def.minSize)==null?void 0:n.value;if(o!==l)return!1;let d=(s=this._def.maxSize)==null?void 0:s.value,f=(a=e._def.maxSize)==null?void 0:a.value;return d!==f?!1:this._def.valueType.isEqual(e._def.valueType)}};i(Rr,"ZodSet");Rr.create=i((t,e)=>new Rr(c({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},k(e))),"create");var vs=Rr,_s=/^c[^\s-]{8,}$/i,Ts=/^[a-z][a-z0-9]*$/,bs=/^[0-9A-HJKMNP-TV-Z]{26}$/,ws=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ps=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ql=i(t=>t===Yl,"isEmojiRegex"),Cn,xs=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ks=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function ec(t,e){return!!((e==="v4"||!e)&&xs.test(t)||(e==="v6"||!e)&&ks.test(t))}i(ec,"isValidIP");var Hr=class et extends E{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){let a=this._getOrReturnCtx(e);return m(a,{code:y.invalid_type,expected:v.string,received:a.parsedType}),P}let n=new te,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:y.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:y.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,l=e.data.length<a.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?m(s,{code:y.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&m(s,{code:y.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ps.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Cn||(Cn=new RegExp(Yl,"u")),Cn.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ws.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")_s.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Ts.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")bs.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:y.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:y.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:y.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:y.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:y.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:y.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Sl(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:y.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?ec(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:y.invalid_string,message:a.message}),n.dirty()):Z.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),c({validation:r,code:y.invalid_string},w.errToObj(n)))}_addCheck(e){return new et(p(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},w.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},w.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},w.errToObj(e)))}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!=null?r:!1},w.errToObj(e?.message)))}regex(e,r){return this._addCheck(c({kind:"regex",regex:e},w.errToObj(r)))}includes(e,r){return this._addCheck(c({kind:"includes",value:e,position:r?.position},w.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(c({kind:"startsWith",value:e},w.errToObj(r)))}endsWith(e,r){return this._addCheck(c({kind:"endsWith",value:e},w.errToObj(r)))}min(e,r){return this._addCheck(c({kind:"min",value:e},w.errToObj(r)))}max(e,r){return this._addCheck(c({kind:"max",value:e},w.errToObj(r)))}length(e,r){return this._addCheck(c({kind:"length",value:e},w.errToObj(r)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new et(p(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[b]=p(c({},this._def[b]),{secret:!0}),this}toLowerCase(){return new et(p(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new et(p(c({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}isEqual(e){if(!(e instanceof et))return!1;let r=new K(this._def.checks),n=new K(e._def.checks);return r.isEqual(n)}};i(Hr,"ZodString");Hr.create=i(t=>{var e;return new Hr(c({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},k(t)))},"create");var X=Hr,Dr=class tc extends E{_parse(e){if(this._getType(e)!==v.symbol){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.symbol,received:n.parsedType}),P}return J(e.data)}isEqual(e){return e instanceof tc}};i(Dr,"ZodSymbol");Dr.create=i(t=>new Dr(c({typeName:"ZodSymbol"},k(t))),"create");var Ss=Dr,ct=class St extends E{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new St(p(c({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new St(p(c({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i(o=>{m(n,o),o.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let o=s.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async l=>{if(r.value==="aborted")return P;let d=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return d.status==="aborted"?P:d.status==="dirty"||r.value==="dirty"?Re(d.value):d});{if(r.value==="aborted")return P;let l=this._def.schema._parseSync({data:o,path:n.path,parent:n});return l.status==="aborted"?P:l.status==="dirty"||r.value==="dirty"?Re(l.value):l}}if(s.type==="refinement"){let o=i(l=>{let d=s.refinement(l,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?P:(l.status==="dirty"&&r.dirty(),o(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?P:(l.status==="dirty"&&r.dirty(),o(l.value).then(()=>({status:r.value,value:l.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!it(o))return o;let l=s.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>it(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:r.value,value:l})):o);Z.assertNever(s)}isEqual(e){return!(e instanceof St)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:Z.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:Z.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:Z.compareFunctions(this._def.effect.transform,e._def.effect.transform):!1}naked(){return this._def.schema.naked()}mandatory(){return new St(p(c({},this._def),{schema:this._def.schema.mandatory()}))}};i(ct,"ZodEffects");ct.create=i((t,e,r)=>new ct(c({schema:t,typeName:"ZodEffects",effect:e},k(r))),"create");ct.createWithPreprocess=i((t,e,r)=>new ct(c({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},k(r))),"createWithPreprocess");var be=ct,Mr=class Et extends E{dereference(e){let r=this._def.items.map(s=>s.dereference(e)),n=this._def.rest?this._def.rest.dereference(e):null;return new Et(p(c({},this._def),{items:r,rest:n}))}getReferences(){return he([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}clone(){let e=this._def.items.map(n=>n.clone()),r=this._def.rest?this._def.rest.clone():null;return new Et(p(c({},this._def),{items:e,rest:r}))}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return m(n,{code:y.invalid_type,expected:v.array,received:n.parsedType}),P;if(n.data.length<this._def.items.length)return m(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,l)=>{let d=this._def.items[l]||this._def.rest;return d?d._parse(new ie(n,o,n.path,l)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>te.mergeArray(r,o)):te.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Et(p(c({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Et)||!this._restEquals(e))return!1;let r=i((a,o)=>a.isEqual(o),"compare"),n=new K(this._def.items,{compare:r}),s=new K(e._def.items,{compare:r});return n.isEqual(s)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};i(Mr,"ZodTuple");Mr.create=i((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mr(c({items:t,typeName:"ZodTuple",rest:null},k(e)))},"create");var Ne=Mr,Nr=class rc extends E{_parse(e){if(this._getType(e)!==v.undefined){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.undefined,received:n.parsedType}),P}return J(e.data)}isEqual(e){return e instanceof rc}mandatory(){return ut.create(c({},this._def))}};i(Nr,"ZodUndefined");Nr.create=i(t=>new Nr(c({typeName:"ZodUndefined"},k(t))),"create");var zt=Nr,$r=class Ot extends E{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new Ot(p(c({},this._def),{options:r}))}getReferences(){return he(this._def.options.reduce((e,r)=>[...e,...r.getReferences()],[]))}clone(){let e=this._def.options.map(r=>r.clone());return new Ot(p(c({},this._def),{options:e}))}_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(let l of a)if(l.result.status==="valid")return l.result;for(let l of a)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let o=a.map(l=>new le(l.ctx.common.issues));return m(r,{code:y.invalid_union,unionErrors:o}),P}if(i(s,"handleResults"),r.common.async)return Promise.all(n.map(async a=>{let o=p(c({},r),{common:p(c({},r.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let a,o=[];for(let d of n){let f=p(c({},r),{common:p(c({},r.common),{issues:[]}),parent:null}),g=d._parseSync({data:r.data,path:r.path,parent:f});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let l=o.map(d=>new le(d));return m(r,{code:y.invalid_union,unionErrors:l}),P}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Ot))return!1;let r=i((a,o)=>a.isEqual(o),"compare"),n=new K([...this._def.options],{compare:r}),s=new K([...e._def.options],{compare:r});return n.isEqual(s)}mandatory(){let e=this._def.options.filter(a=>!(a instanceof zt)).map(a=>a.mandatory()),[r,n,...s]=e;return r?n?new Ot(p(c({},this._def),{options:[r,n,...s]})):r:ut.create(c({},this._def))}};i($r,"ZodUnion");$r.create=i((t,e)=>new $r(c({options:t,typeName:"ZodUnion"},k(e))),"create");var fn=$r,jr=class nc extends E{constructor(){super(...arguments),this._unknown=!0}_parse(e){return J(e.data)}isEqual(e){return e instanceof nc}};i(jr,"ZodUnknown");jr.create=i(t=>new jr(c({typeName:"ZodUnknown"},k(t))),"create");var nt=jr,Kr=class sc extends E{_parse(e){if(this._getType(e)!==v.undefined){let n=this._getOrReturnCtx(e);return m(n,{code:y.invalid_type,expected:v.void,received:n.parsedType}),P}return J(e.data)}isEqual(e){return e instanceof sc}};i(Kr,"ZodVoid");Kr.create=i(t=>new Kr(c({typeName:"ZodVoid"},k(t))),"create");var Es=Kr,rh=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],gv=We.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),ac=i(t=>X.create().displayAs({id:"variable",params:c({type:t?.type||"any"},t?.params)}),"variable"),ic=i(t=>X.create().displayAs({id:"conversation",params:c({},t?.params)}),"conversation"),oc=i(t=>X.create().displayAs({id:"user",params:c({},t?.params)}),"user"),lc=i(t=>X.create().displayAs({id:"message",params:c({},t?.params)}),"message"),cc=i(t=>X.create().displayAs({id:"agent",params:c({},t?.params)}),"agent"),dc=i(t=>X.create().displayAs({id:"event",params:c({},t?.params)}),"event"),uc=i(t=>X.create().displayAs({id:"table",params:c({},t?.params)}),"table"),pc=i(t=>X.create().displayAs({id:"tablerow",params:c({},t?.params)}),"tablerow"),fc=i(t=>X.create().displayAs({id:"intent",params:c({},t?.params)}),"intent"),gc=i(()=>We.create(rh).displayAs({id:"dropdown",params:{}}),"aimodel"),yc=i(t=>X.create().displayAs({id:"datasource",params:c({},t)}),"datasource"),hc=i(t=>X.create().displayAs({id:"knowledgebase",params:c({},t)}),"knowledgebase"),mc={object:Me.lazycreate},vc=i((t,e={message:`Input not instance of ${t.name}`})=>ds(r=>r instanceof t,e),"instanceOfType"),Os=X.create,Zs=un.create,_c=ys.create,Tc=en.create,Bs=tn.create,bc=sn.create,wc=Ss.create,Pc=zt.create,xc=dn.create,kc=ot.create,Sc=nt.create,Ec=ut.create,Oc=Es.create,Zc=lt.create,Bc=Me.create,Ic=Me.strictCreate,Cc=fn.create,Ac=us.create,Rc=an.create,Hc=Ne.create,Dc=hs.create,Mc=ms.create,Nc=Ft.create,$c=gs.create,jc=vs.create,Kc=fs.create,Uc=on.create,Fc=ln.create,zc=We.create,Lc=cn.create,Wc=Ut.create,Fn=be.create,qc=fe.create,Vc=De.create,nh=jt.create,Gc=be.createWithPreprocess,Jc=pn.create,Xc=i(()=>Os().optional(),"ostring"),Yc=i(()=>Zs().optional(),"onumber"),Qc=i(()=>Bs().optional(),"oboolean"),ed={string:i(t=>X.create(p(c({},t),{coerce:!0})),"string"),number:i(t=>un.create(p(c({},t),{coerce:!0})),"number"),boolean:i(t=>tn.create(p(c({},t),{coerce:!0})),"boolean"),bigint:i(t=>en.create(p(c({},t),{coerce:!0})),"bigint"),date:i(t=>sn.create(p(c({},t),{coerce:!0})),"date")},td=P,u=_,rd=i((t,e)=>t.anyOf.length?t.anyOf.length===1?L(t.anyOf[0],p(c({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>L(r,p(c({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),sh=i(t=>{var e;return(e=t[b])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),ah=i(t=>"z.any()","parseDefault"),ih=i((t,e)=>`z.union([${t.type.map(r=>L(p(c({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),oh=i((t,e)=>`z.any().refine((value) => !${L(t.not,p(c({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),lh=i(t=>"z.null()","parseNull"),ch=i(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),dh=i((t,...e)=>Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{}),"omit");function G(t,e,r){var n;let s=t[e],a="";if(s!==void 0){let o=r({value:s,json:JSON.stringify(s)});if(o){let l=o[0],d=o.length===3?o[1]:"",f=o.length===3?o[2]:o[1];a+=l,((n=t.errorMessage)==null?void 0:n[e])!==void 0&&(a+=d+JSON.stringify(t.errorMessage[e])),a+=f}}return a}i(G,"withMessage");var Zt=Symbol("Original index"),uh=i(t=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="boolean")e.push(n?{[Zt]:r}:{[Zt]:r,not:{}});else{if(Zt in n)return t;e.push(p(c({},n),{[Zt]:r}))}}return e},"ensureOriginalIndex");function Nt(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return L(r,p(c({},e),{path:[...e.path,"allOf",r[Zt]]}))}else{let[r,n]=ch(uh(t.allOf));return`z.intersection(${Nt({allOf:r},e)}, ${Nt({allOf:n},e)})`}}i(Nt,"parseAllOf");var ph=i((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,s)=>L(n,p(c({},e),{path:[...e.path,"items",s]})))}])`;let r=t.items?`z.array(${L(t.items,p(c({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return r+=G(t,"minItems",({json:n})=>[`.min(${n}`,", ",")"]),r+=G(t,"maxItems",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseArray"),fh=i(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),gh=i(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),yh=i((t,e)=>{let r=L(t.if,p(c({},e),{path:[...e.path,"if"]})),n=L(t.then,p(c({},e),{path:[...e.path,"then"]})),s=L(t.else,p(c({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${s}]).superRefine((value,ctx) => {
|
|
34
12
|
const result = ${r}.safeParse(value).success
|
|
35
13
|
? ${n}.safeParse(value)
|
|
36
|
-
: ${
|
|
14
|
+
: ${s}.safeParse(value);
|
|
37
15
|
if (!result.success) {
|
|
38
16
|
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
39
17
|
}
|
|
40
|
-
})`},"parseIfThenElse"),
|
|
41
|
-
const schemas = [${t.oneOf.map((r,n)=>
|
|
18
|
+
})`},"parseIfThenElse"),hh=i(t=>{var e;let r="z.number()";return(e=t[b])!=null&&e.coerce&&(r="z.coerce.number()"),t.type==="integer"?r+=G(t,"type",()=>[".int(",")"]):r+=G(t,"format",({value:n})=>{if(n==="int64")return[".int(",")"]}),r+=G(t,"multipleOf",({value:n,json:s})=>n===1?r.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${s}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?r+=G(t,"minimum",({json:n})=>[`.gt(${n}`,", ",")"]):r+=G(t,"minimum",({json:n})=>[`.gte(${n}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(r+=G(t,"exclusiveMinimum",({json:n})=>[`.gt(${n}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?r+=G(t,"maximum",({json:n})=>[`.lt(${n}`,", ",")"]):r+=G(t,"maximum",({json:n})=>[`.lte(${n}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(r+=G(t,"exclusiveMaximum",({json:n})=>[`.lt(${n}`,", ",")"])),r},"parseNumber"),Is=i((t,e)=>t.oneOf.length?t.oneOf.length===1?L(t.oneOf[0],p(c({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
19
|
+
const schemas = [${t.oneOf.map((r,n)=>L(r,p(c({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
|
|
42
20
|
const errors = schemas.reduce(
|
|
43
21
|
(errors: z.ZodError[], schema) =>
|
|
44
22
|
((result) => ("error" in result ? [...errors, result.error] : errors))(
|
|
@@ -54,15 +32,15 @@ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(Me).join(
|
|
|
54
32
|
message: "Invalid input: Should pass single schema",
|
|
55
33
|
});
|
|
56
34
|
}
|
|
57
|
-
})`:"z.any()","parseOneOf");function
|
|
58
|
-
`,
|
|
59
|
-
`,n&&(t.properties?
|
|
60
|
-
`:
|
|
61
|
-
`);for(let
|
|
62
|
-
`,n&&(
|
|
63
|
-
`),
|
|
64
|
-
`,
|
|
65
|
-
`,
|
|
35
|
+
})`:"z.any()","parseOneOf");function nd(t,e){let r;t.properties&&(Object.keys(t.properties).length?(r="z.object({ ",r+=Object.keys(t.properties).map(o=>{let l=t.properties[o],d=`${JSON.stringify(o)}: ${L(l,p(c({},e),{path:[...e.path,"properties",o]}))}`,f=typeof l=="object"&&l.default!==void 0||typeof t.default=="object"&&t.default!==null&&o in t.default,g=Array.isArray(t.required)?t.required.includes(o):typeof l=="object"&&l.required===!0;return!f&&!g?`${d}.optional()`:d}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?L(t.additionalProperties,p(c({},e),{path:[...e.path,"additionalProperties"]})):void 0,s;if(t.patternProperties){let o=Object.fromEntries(Object.entries(t.patternProperties).map(([l,d])=>[l,L(d,p(c({},e),{path:[...e.path,"patternProperties",l]}))],{}));s="",r?n?s+=`.catchall(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?s+=`.catchall(z.union([${Object.values(o).join(", ")}]))`:s+=`.catchall(${Object.values(o)})`:n?s+=`z.record(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?s+=`z.record(z.union([${Object.values(o).join(", ")}]))`:s+=`z.record(${Object.values(o)})`,s+=`.superRefine((value, ctx) => {
|
|
36
|
+
`,s+=`for (const key in value) {
|
|
37
|
+
`,n&&(t.properties?s+=`let evaluated = [${Object.keys(t.properties).map(l=>JSON.stringify(l)).join(", ")}].includes(key)
|
|
38
|
+
`:s+=`let evaluated = false
|
|
39
|
+
`);for(let l in t.patternProperties)s+="if (key.match(new RegExp("+JSON.stringify(l)+`))) {
|
|
40
|
+
`,n&&(s+=`evaluated = true
|
|
41
|
+
`),s+="const result = "+o[l]+`.safeParse(value[key])
|
|
42
|
+
`,s+=`if (!result.success) {
|
|
43
|
+
`,s+=`ctx.addIssue({
|
|
66
44
|
path: [...ctx.path, key],
|
|
67
45
|
code: 'custom',
|
|
68
46
|
message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
|
|
@@ -70,12 +48,12 @@ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(Me).join(
|
|
|
70
48
|
issues: result.error.issues
|
|
71
49
|
}
|
|
72
50
|
})
|
|
73
|
-
`,
|
|
74
|
-
`,
|
|
75
|
-
`;n&&(
|
|
76
|
-
`,
|
|
77
|
-
`,
|
|
78
|
-
`,
|
|
51
|
+
`,s+=`}
|
|
52
|
+
`,s+=`}
|
|
53
|
+
`;n&&(s+=`if (!evaluated) {
|
|
54
|
+
`,s+="const result = "+n+`.safeParse(value[key])
|
|
55
|
+
`,s+=`if (!result.success) {
|
|
56
|
+
`,s+=`ctx.addIssue({
|
|
79
57
|
path: [...ctx.path, key],
|
|
80
58
|
code: 'custom',
|
|
81
59
|
message: \`Invalid input: must match catchall schema\`,
|
|
@@ -83,34 +61,12 @@ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(Me).join(
|
|
|
83
61
|
issues: result.error.issues
|
|
84
62
|
}
|
|
85
63
|
})
|
|
86
|
-
`,
|
|
87
|
-
`,
|
|
88
|
-
`),
|
|
89
|
-
`,a+="})"}let s=r?a?r+a:n?n==="z.never()"?r+".strict()":r+`.catchall(${n})`:r:a||(n?`z.record(${n})`:"z.record(z.any())");return ie.an.anyOf(t)&&(s+=`.and(${Cf(h(d({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?h(d({},i),{type:"object"}):i)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${Ys(h(d({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?h(d({},i),{type:"object"}):i)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${hr(h(d({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?h(d({},i),{type:"object"}):i)}),e)})`),s}l(If,"parseObject");var w_=l(t=>{var e;let r="z.string()";if((e=t[K])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";r="z.coerce.string()"}return r+=fe(t,"format",({value:n})=>{switch(n){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),r+=fe(t,"pattern",({json:n})=>[`.regex(new RegExp(${n})`,", ",")"]),r+=fe(t,"minLength",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxLength",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseString"),P_=l((t,e)=>`${ce(h_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),k_=l(t=>`z.ref('${t.$ref}')`,"parseRef"),E_=l((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return Ys(t,e);let a=t.oneOf.map((s,i)=>ce(s,h(d({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(n=t.discriminator)==null?void 0:n.propertyName}", [${a.join(", ")}])`},"parseDiscriminator"),ce=l((t,e={seen:new Map,path:[]},r)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let n=e.seen.get(t);if(n){if(n.r!==void 0)return n.r;if(e.depth===void 0||n.n>=e.depth)return"z.any()";n.n+=1}else n={r:void 0,n:0},e.seen.set(t,n);let a=O_(t,e);return r||(a=x_(t,a),e.withoutDefaults||(a=S_(t,a))),n.r=a,a},"parseSchema"),x_=l((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),S_=l((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),O_=l((t,e)=>ie.a.nullable(t)?P_(t,e):ie.an.object(t)?If(t,e):ie.an.array(t)?y_(t,e):ie.an.anyOf(t)?Cf(t,e):ie.an.allOf(t)?hr(t,e):ie.a.discriminator(t)?E_(t,e):ie.a.oneOf(t)?Ys(t,e):ie.a.not(t)?f_(t,e):ie.an.enum(t)?__(t):ie.a.const(t)?v_(t):ie.a.multipleType(t)?d_(t,e):ie.a.primitive(t,"string")?w_(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?b_(t):ie.a.primitive(t,"boolean")?u_(t):ie.a.primitive(t,"null")?p_(t):ie.a.conditional(t)?T_(t,e):ie.a.ref(t)?k_(t):c_(t),"selectParser"),ie={an:{object:l(t=>t.type==="object","object"),array:l(t=>t.type==="array","array"),anyOf:l(t=>t.anyOf!==void 0,"anyOf"),allOf:l(t=>t.allOf!==void 0,"allOf"),enum:l(t=>t.enum!==void 0,"enum")},a:{nullable:l(t=>t.nullable===!0,"nullable"),multipleType:l(t=>Array.isArray(t.type),"multipleType"),not:l(t=>t.not!==void 0,"not"),const:l(t=>t.const!==void 0,"const"),primitive:l((t,e)=>t.type===e,"primitive"),conditional:l(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:l(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:l(t=>t.oneOf!==void 0,"oneOf"),ref:l(t=>t.$ref!==void 0,"ref")}},C_=l(t=>{let e;try{e=new Function("z",`return ${t}`)(v)}catch(r){return{sucess:!1,error:`Failed to evaluate schema: ${(r instanceof Error?r:new Error(String(r))).message}`}}return e instanceof v.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),I_=l(t=>ce(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),B_=l(t=>{let e=I_(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=C_(e);if(!r.sucess)throw new ol(r.error);return r.value},"jsonSchemaToZod"),or=l((t,e)=>{var r,n;if(e[K]&&t._def&&(t._def[K]=e[K]),((r=t._def)==null?void 0:r.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&or(i[a],s)}),((n=t._def)==null?void 0:n.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&or(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let s=t._def.type;s&&or(s,a)}else Array.isArray(a)&&a.forEach((s,i)=>{let o=t._def;o.typeName===E.ZodFirstPartyTypeKind.ZodTuple&&or(o.items[i],s)})}},"applyZuiPropsRecursively"),Tr=l(t=>{let e=B_(t);return or(e,t),e},"jsonSchemaToZui"),Bf=class extends Lt.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){console.error("Uncaught error:",e,r)}render(){return this.state.hasError&&this.props.fallback?Lt.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};l(Bf,"ErrorBoundary");var Mt=Bf;function Rf(t,e){return r=>Lt.default.createElement(Mt,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Lt.default.createElement(t,d({},r)))}l(Rf,"withErrorBoundary");var Jr=l(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:i}=e,o=Lo(e,["components","fieldSchema","path","required","fallback"]),c,p;let{formData:m,disabled:T,hidden:O,handlePropertyChange:w,addArrayItem:S,removeArrayItem:W,formErrors:q,formValid:re}=Vo(n,a),J=(0,be.useMemo)(()=>lt(m,a),[m,a]),j=(0,be.useMemo)(()=>Fg(r,n),[n,r]),{discriminator:F,discriminatedSchema:ue,discriminatorValue:Le}=$g(n,a);if(!j||O===!0)return null;let{Component:rt,type:Ce}=j,we={type:Ce,componentID:j.id,scope:a.join("."),context:{path:a,readonly:!1,formData:m,formErrors:q,formValid:re,updateForm:w,updateFormData:l(Pe=>w([],Pe),"updateFormData")},onChange:l(Pe=>w(a,Pe),"onChange"),disabled:T,errors:q?.filter(Pe=>Pe.path===a)||[],label:((c=n[K])==null?void 0:c.title)||qa(((p=a[a.length-1])==null?void 0:p.toString())||""),params:j.params,schema:n,zuiProps:n[K]};if(n.type==="array"&&Ce==="array"){let Pe=rt,Te=we.schema,ke=Array.isArray(J)||typeof J=="object"?J:[],N=d(h(d({},we),{type:Ce,schema:Te,data:ke,addItem:l(Ie=>S(a,Ie),"addItem"),removeItem:l(Ie=>W(a,Ie),"removeItem")}),o);return Array.isArray(n.items)?null:be.default.createElement(Pe,h(d({key:we.scope},N),{isArrayChild:N.isArrayChild}),Array.isArray(N.data)?N.data.map((Ie,Oe)=>{let ze=[...a,Oe.toString()];return be.default.createElement(Mt,{key:ze.join("."),fallback:i,fieldSchema:n.items,path:ze},be.default.createElement(Jr,{key:ze.join("."),components:r,fieldSchema:n.items,path:ze,required:s,isArrayChild:!0,index:Oe,removeSelf:()=>W(a,Oe),fallback:i}))}):[])}if(n.type==="object"&&Ce==="object"&&n.properties){let Pe=rt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{}}),o);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),Object.entries(n.properties).map(([ke,N])=>{var Ie;let Oe=[...a,ke];return be.default.createElement(Mt,{key:Oe.join("."),fallback:i,fieldSchema:N,path:Oe},be.default.createElement(Jr,{key:Oe.join("."),components:r,fieldSchema:N,path:Oe,required:((Ie=n.required)==null?void 0:Ie.includes(ke))||!1,isArrayChild:!1,fallback:i}))}))}if(Ce==="discriminatedUnion"){let Pe=rt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{},discriminatorKey:F?.key||null,discriminatorLabel:qa(F?.key||"Unknown"),discriminatorOptions:F?.values||null,discriminatorValue:Le,setDiscriminator:l(ke=>{if(!F?.key){console.warn("No discriminator key found, cannot set discriminator");return}w(a,{[F.key]:ke})},"setDiscriminator")}),o);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),ue&&be.default.createElement(Mt,{key:a.join("."),fallback:i,fieldSchema:ue,path:a},be.default.createElement(Jr,{components:r,fieldSchema:ue,path:a,required:s,isArrayChild:!1,fallback:i})))}let va=rt,_a=d(h(d({},we),{type:Ce,schema:we.schema,config:{},required:s,data:J,description:n.description}),o);return be.default.createElement(va,d({},_a))},"FormElementRenderer"),R_=l(({schema:t,components:e,onChange:r,value:n,disableValidation:a,fallback:s,dataTransform:i,onValidation:o})=>{let[c,p]=(0,je.useState)(n);return(0,je.useEffect)(()=>{r(c)},[c]),(0,je.useEffect)(()=>{let m=Dt(t);p(T=>Xr(m,T))},[JSON.stringify(t),p]),je.default.createElement(jg,{formData:c,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:i,onValidation:o},je.default.createElement(Mt,{fallback:s,fieldSchema:t,path:[]},je.default.createElement(Jr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),A_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},Z_={errors:al,jsonSchemaToZui:Tr,zuiToJsonSchema:aa,objectToZui:Ft,toTypescript:Qr,toTypescriptSchema:ws};var Vt=(t,e)=>{let r=t._def,n=e._def;if(r.typeName===E.ZodFirstPartyTypeKind.ZodObject&&n.typeName===E.ZodFirstPartyTypeKind.ZodObject){let a=r.shape(),s=n.shape();return E.object({...a,...s})}if(r.typeName===E.ZodFirstPartyTypeKind.ZodRecord&&n.typeName===E.ZodFirstPartyTypeKind.ZodRecord)return E.record(E.intersection(r.valueType,n.valueType));throw new Error("Cannot merge object schemas with record schemas")},Af=E;var _e=E.string().min(1),Df=E.object({text:_e}),Hf=E.object({markdown:_e}),Mf=E.object({imageUrl:_e}),Nf=E.object({audioUrl:_e}),jf=E.object({videoUrl:_e}),$f=E.object({fileUrl:_e,title:_e.optional()}),Uf=E.object({latitude:E.number(),longitude:E.number(),address:E.string().optional(),title:E.string().optional()}),Kf=E.object({title:_e,subtitle:_e.optional(),imageUrl:_e.optional(),actions:E.array(E.object({action:E.enum(["postback","url","say"]),label:_e,value:_e}))}),Zf=E.object({text:_e,options:E.array(E.object({label:_e,value:_e}))}),D_=E.object({items:E.array(Kf)}),H_=E.union([E.object({type:E.literal("text"),payload:Df}),E.object({type:E.literal("markdown"),payload:Hf}),E.object({type:E.literal("image"),payload:Mf}),E.object({type:E.literal("audio"),payload:Nf}),E.object({type:E.literal("video"),payload:jf}),E.object({type:E.literal("file"),payload:$f}),E.object({type:E.literal("location"),payload:Uf})]),M_=E.object({items:E.array(H_)}),N_={schema:Hf},j_={text:{schema:Df},image:{schema:Mf},audio:{schema:Nf},video:{schema:jf},file:{schema:$f},location:{schema:Uf},carousel:{schema:D_},card:{schema:Kf},dropdown:{schema:Zf},choice:{schema:Zf},bloc:{schema:M_}};var br="x-bot-id",Qs="x-bot-user-id",ei="x-integration-id",ti="x-webhook-id",ri="x-bp-configuration-type",wr="x-bp-configuration",Pr="x-bp-operation",ni="x-bp-type",$_={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};var Ff=require("browser-or-node");var ai=console;function Se(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function kr(t,e=8072,r=L_){if(!Ff.isNode)throw new Error("This function can only be called in Node.js");let a=require("http").createServer(async(s,i)=>{try{let o=await U_(s);if(o.path==="/health"){i.writeHead(200).end("ok");return}let c=await t(o);i.writeHead(c?.status??200,c?.headers??{}).end(c?.body??"{}")}catch(o){ai.error("Error while handling request",{error:o?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:o?.message??"Internal error occured"}))}});return a.listen(e,()=>r(e)),a}async function U_(t){let e=await F_(t),r={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),i=t.rawHeaders[a+1];r[s]=i}let n=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:n.pathname,query:K_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function K_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function F_(t){return new Promise((e,r)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let n="";t.on("data",a=>n+=a.toString()),t.on("error",a=>r(a)),t.on("end",()=>e(n))})}function L_(t){ai.info(`Listening on port ${t}`)}var ya=require("@botpress/client");var te={};er(te,{mapKeys:()=>V_,mapValues:()=>W_,mergeRecords:()=>G_,pairs:()=>sa,stripUndefinedProps:()=>q_,values:()=>z_});var sa=t=>Object.entries(t),z_=t=>Object.values(t),W_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[r,e(n,r)])),V_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[e(r),n])),q_=t=>Object.fromEntries(sa(t).filter(([,e])=>e!==void 0)),G_=(t,e,r)=>{let n=[...Object.keys(t),...Object.keys(e)],a=[...new Set(n)],s={};for(let i of a){let o=t[i],c=e[i];o&&c?s[i]=r(o,c):o?s[i]=o:c&&(s[i]=c)}return s};var Z={};er(Z,{safePush:()=>J_,unique:()=>Y_});var J_=(t,...e)=>t?[...t,...e]:[...e],Y_=t=>Array.from(new Set(t));var Fe={};er(Fe,{setName:()=>X_});var X_=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Lf=t=>{let{name:e,version:r}=t,n={actions:{},events:{},channels:{}},a={name:e,version:r,entities:te.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=te.mapValues(t.entities,i=>i.schema);for(let[i,o]of Object.entries(t.definition.actions??{})){let c=o.input.schema.dereference(s),p=o.output.schema.dereference(s),m=t.actions?.[i]?.name??i;n.actions[m]={...o,...t.actions?.[i]??{},input:{schema:c},output:{schema:p}},a.actions[i]={name:m}}for(let[i,o]of Object.entries(t.definition.events??{})){let c=o.schema.dereference(s),p=t.events?.[i]?.name??i;n.events[p]={...o,...t.events?.[i]??{},schema:c},a.events[i]={name:p}}for(let[i,o]of Object.entries(t.definition.channels??{})){let c={};for(let[m,T]of Object.entries(o.messages)){let O=T.schema.dereference(s);c[m]={...T,schema:O}}let p=t.channels?.[i]?.name??i;n.channels[p]={...o,...t.channels?.[i]??{},message:{...o.message??{},tags:{...o.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...o.conversation??{},tags:{...o.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:c},a.channels[i]={name:p}}return{resolved:n,statement:a}};var ia=Symbol("schemaName"),zf=t=>t?te.mapValues(t,(r,n)=>({...r,[ia]:n})):{},Wf=t=>ia in t&&t[ia]!==void 0,Vf=t=>t[ia];var oa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;extend(e,r){let{entities:n,actions:a,events:s,channels:i}=this._callBuilder(e,r),o=this;o.interfaces??={};let c=Object.values(n).map(O=>O.name),p=c.length===0?e.name:`${e.name}<${c.join(",")}>`,{resolved:m,statement:T}=Lf({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(i)});return o.actions=te.mergeRecords(o.actions??{},m.actions,this._mergeActions),o.channels=te.mergeRecords(o.channels??{},m.channels,this._mergeChannels),o.events=te.mergeRecords(o.events??{},m.events,this._mergeEvents),o.interfaces[p]={id:e.id,...T},this}_callBuilder(e,r){let a={entities:zf(this.entities)},s=r(a),i=te.pairs(s.entities).find(([c,p])=>!Wf(p));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:te.mapValues(s.entities,c=>({name:Vf(c),schema:c.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:Vt(e.input.schema,r.input.schema)},output:{schema:Vt(e.output.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:Vt(e.schema,r.schema)});_mergeChannels=(e,r)=>{let n=te.mergeRecords(e.messages,r.messages,this._mergeMessage),a;(e.conversation||r.conversation)&&(a={tags:{...e.conversation?.tags,...r.conversation?.tags}});let s;return(e.message||r.message)&&(s={tags:{...e.message?.tags,...r.message?.tags}}),{...e,...r,messages:n,conversation:a,message:s}};_mergeMessage=(e,r)=>({schema:Vt(e.schema,r.schema)})};var Pt=require("@botpress/client");var qf=at(require("@botpress/client")),la={retries:3,retryCondition:t=>qf.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Q_(e.response?.headers??{})??t)*1e3},Q_=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let r of e){let n=t[r];if(n!==void 0)return eT(String(n))}},eT=t=>{let e=tT(t)?rT(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},tT=t=>t.includes(" "),rT=t=>{let e=nT(t);if(!e)return;let r=new Date;return Math.max(0,Math.floor((e.getTime()-r.getTime())/1e3))},nT=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};var qt=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};var ua=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var ca="#";var aT=E.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Jf=t=>{let e=t[br],r=t[Qs],n=t[ei],a=t[ti],s=t[ri],i=t[wr],o=aT.parse(t[Pr]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing bot user headers");if(!n)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,botUserId:r,integrationId:n,webhookId:a,operation:o,configurationType:s??null,configuration:i?JSON.parse(Buffer.from(i,"base64").toString("utf-8")):{}}};var Yf=at(require("util")),Gt=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,r){this._getConsoleMethod(e)(this._serializeMessage(r))}_serializeMessage(e){let r=Yf.default.format(...e);return process.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(r):r}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var Ye=class extends Gt{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Ye({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};var sT=t=>["traceparent","tracestate","sentry-trace"].reduce((e,r)=>(t[r]&&(e[r]=t[r]),e),{}),Xf=t=>async e=>{let r=Jf(e.headers),[,n]=(e.headers.traceparent||"").split("-"),a=new Pt.Client({botId:r.botId,integrationId:r.integrationId,retry:la,headers:sT(e.headers)}),s=new qt(a),i=new Ye({traceId:n}),o={ctx:r,req:e,client:s,logger:i,instance:t};try{let c;switch(r.operation){case"webhook_received":c=await oT(o);break;case"register":c=await lT(o);break;case"unregister":c=await uT(o);break;case"message_created":c=await fT(o);break;case"action_triggered":c=await pT(o);break;case"ping":c=await iT(o);break;case"create_user":c=await cT(o);break;case"create_conversation":c=await dT(o);break;default:throw new Error(`Unknown operation ${r.operation}`)}return c?{...c,status:c.status??200}:{status:200}}catch(c){if((0,Pt.isApiError)(c)){let m=c.type==="Runtime"?c:new Pt.RuntimeError(c.message,c);return i.forBot().error(m.message),{status:m.code,body:JSON.stringify(m.toJSON())}}console.error(c);let p=new Pt.RuntimeError("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return i.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}},iT=async t=>{},oT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{let{req:s}=Se(r);return a.webhook({client:t,ctx:e,req:s,logger:n})},lT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=Se(r);await a.register({client:t,ctx:e,webhookUrl:s,logger:n})},uT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=Se(r);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:n})},cT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createUser)return;let{tags:s}=Se(r);return await a.createUser({ctx:e,client:t,tags:s,logger:n})},dT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:i}=Se(r);return await a.createConversation({ctx:e,client:t,channel:s,tags:i,logger:n})},fT=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:i,type:o,payload:c,message:p}=Se(e),m=a.channels[s.channel];if(!m)throw new Error(`Channel ${s.channel} not found`);let T=m.messages[o];if(!T)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await T({ctx:t,conversation:s,message:p,user:i,type:o,client:r,payload:c,ack:async({tags:w})=>{await r.updateMessage({id:p.id,tags:w})},logger:n})},pT=async({req:t,ctx:e,client:r,logger:n,instance:a})=>{let{input:s,type:i}=Se(t);if(!i)throw new Error("Missing action type");let o=a.actions[i];if(!o)throw new Error(`Action ${i} not found`);let c=new ua,m={output:await o({ctx:e,input:s,client:r,type:i,logger:n,metadata:c}),meta:c.toJSON()};return{body:JSON.stringify(m)}};var da=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=Xf(this);start=e=>kr(this.handler,e)};var fa=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;addIntegration(e,r){let n=this;return n.integrations||(n.integrations={}),n.integrations[e.name]={enabled:r.enabled,...e,configurationType:r.configurationType,configuration:r.configuration,disabledChannels:r.disabledChannels},this}addPlugin(e,r){let n=this;n.plugins||(n.plugins={});let a=r.alias??e.name;return n.plugins[a]={...e,alias:r.alias,configuration:r.configuration,interfaces:r.interfaces},n.user=this._mergeUser(n.user,e.definition.user),n.conversation=this._mergeConversation(n.conversation,e.definition.conversation),n.message=this._mergeMessage(n.message,e.definition.message),n.recurringEvents=this._mergeRecurringEvents(n.recurringEvents,e.definition.recurringEvents),n.tables=this._mergeTables(n.tables,e.definition.tables),n.workflows=this._mergeWorkflows(n.workflows,e.definition.workflows),n.states=this._mergeStates(n.states,this._prefixKeys(e.definition.states,r.alias)),n.events=this._mergeEvents(n.events,this._prefixKeys(e.definition.events,r.alias)),n.actions=this._mergeActions(n.actions,this._prefixKeys(e.definition.actions,r.alias)),this}_mergeUser=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeConversation=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeMessage=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeStates=(e,r)=>({...e,...r});_mergeEvents=(e,r)=>({...e,...r});_mergeRecurringEvents=(e,r)=>({...e,...r});_mergeActions=(e,r)=>({...e,...r});_mergeTables=(e,r)=>({...e,...r});_mergeWorkflows=(e,r)=>({...e,...r});_prefixKeys=(e,r)=>!e||!r?e:te.mapKeys(e,n=>`${r}${ca}${n}`)};var kt=require("@botpress/client");var Xe=class extends Gt{constructor(e){super({...e})}with(e){return new Xe({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};var Re=class{constructor(e,r={before:{},after:{}}){this._client=e;this._hooks=r}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);createEvent=e=>this._run("createEvent",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createWorkflow=e=>this._run("createWorkflow",e);getWorkflow=e=>this._run("getWorkflow",e);updateWorkflow=e=>this._run("updateWorkflow",e);deleteWorkflow=e=>this._run("deleteWorkflow",e);listWorkflows=e=>this._run("listWorkflows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,r)=>{let n=this._hooks.before[e];n&&(r=await n(r));let a=await this._client[e](r),s=this._hooks.after[e];return s&&(a=await s(a,r)),a}};var Jt=t=>new Proxy({},{get:(e,r)=>({listInstances:{all:n=>Qe({workflowName:r,client:t,input:n}),running:n=>Qe({workflowName:r,client:t,input:n,statuses:["in_progress"]}),scheduled:n=>Qe({workflowName:r,client:t,input:n,statuses:["pending","listening"]}),allFinished:n=>Qe({workflowName:r,client:t,input:n,statuses:["completed","cancelled","failed","timedout"]}),cancelled:n=>Qe({workflowName:r,client:t,input:n,statuses:["cancelled"]}),failed:n=>Qe({workflowName:r,client:t,input:n,statuses:["failed"]}),succeeded:n=>Qe({workflowName:r,client:t,input:n,statuses:["completed"]}),timedOut:n=>Qe({workflowName:r,client:t,input:n,statuses:["timedout"]})},startNewInstance:async n=>{let{workflow:a}=await t.createWorkflow({name:r,status:"pending",...n});return{workflow:et({client:t,workflow:a})}}})}),Qe=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(r=>et({client:t.client,workflow:r}))}},et=t=>({...t.workflow,async update(e){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:et({client:t.client,workflow:r})}},async setFailed({failureReason:e}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:et({client:t.client,workflow:r})}},async setCompleted({output:e}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:et({client:t.client,workflow:r})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:et({client:t.client,workflow:e})}}});var gT=E.enum(["event_received","register","unregister","ping","action_triggered"]),Qf=t=>{let e=t[br],r=t[wr],n=t[ni],a=gT.parse(t[Pr]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing type headers");if(!r)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:n,configuration:r?JSON.parse(Buffer.from(r,"base64").toString("utf-8")):{}}};var he={status:200};var si=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var hT=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],ep=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!hT.includes(e.payload.type))throw new Error("Unexpected event type");let r={...t,logger:mT(t,e)};if(!e.payload.workflow.name)return r.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),he;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":r.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await yT(r,e);default:e.payload.type}return he},mT=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),yT=async(t,e)=>{let r=si(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];return!n||n.length===0?(t.logger.warn(`No ${r} handler found for workflow "${e.payload.workflow.name}"`),he):(await vT(t,e),await _T(t,e),he)},vT=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},_T=async(t,e)=>{let r=si(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];for(let a of n)await a({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:et({...t,workflow:e.payload.workflow}),workflows:Jt(t.client)})};var tp=t=>async e=>{let r=Qf(e.headers),n=new Xe,a=new kt.Client({botId:r.botId,retry:la}),s=new Re(a,{before:{createMessage:async o=>{let c=t.hookHandlers.before_outgoing_message[o.type]??[];for(let p of c){let m=new Re(a);o=(await p({client:m,ctx:r,logger:n.with({conversationId:o.conversationId,userId:o.userId}),data:o,...tt({client:m})}))?.data??o}return o},callAction:async o=>{let c=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let p of c){let m=new Re(a);o=(await p({client:m,ctx:r,logger:n,data:o,...tt({client:m})}))?.data??o}return o}},after:{createMessage:async o=>{let c=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let p of c){let m=new Re(a);o=(await p({client:m,ctx:r,logger:n.with({messageId:o.message.id,conversationId:o.message.conversationId,userId:o.message.userId}),data:o,...tt({client:m})}))?.data??o}return o},callAction:async(o,c)=>{let{type:p}=c,m=t.hookHandlers.after_outgoing_call_action[p]??[];for(let T of m){let O=new Re(a);o=(await T({client:O,ctx:r,logger:n,data:{type:p,...o},...tt({client:O})}))?.data??o}return o}}}),i={req:e,ctx:r,logger:n,client:s,self:t};try{switch(r.operation){case"action_triggered":return await kT(i);case"event_received":return await PT(i);case"register":return await bT(i);case"unregister":return await wT(i);case"ping":return await TT(i);default:throw new Error(`Unknown operation ${r.operation}`)}}catch(o){if((0,kt.isApiError)(o)){let p=o.type==="Runtime"?o:new kt.RuntimeError(o.message,o);return n.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let c=new kt.RuntimeError("An unexpected error occurred in the bot.");return n.error(c.message),{status:c.code,body:JSON.stringify(c.toJSON())}}},TT=async t=>he,bT=async t=>he,wT=async t=>he,PT=async t=>{let{ctx:e,logger:r,req:n,client:a,self:s}=t,i={client:a,ctx:e,logger:r,...tt({client:a})},o=Se(n);if(i.logger=i.logger.with({eventId:o.event.id,messageId:o.event.messageId,conversationId:o.event.conversationId,userId:o.event.userId}),e.type==="workflow_update")return await ep(t,o.event);if(e.type==="message_created"){let w=o.event,S=w.payload.message;i.logger=i.logger.with({messageId:S.id,conversationId:S.conversationId,userId:S.userId});let W=s.hookHandlers.before_incoming_message[S.type]??[];for(let j of W){let F=await j({...i,data:S});if(S=F?.data??S,F?.stop)return he}let q={...i,user:w.payload.user,conversation:w.payload.conversation,message:S,event:w},re=s.messageHandlers[S.type]??[];for(let j of re)await j(q);let J=s.hookHandlers.after_incoming_message[S.type]??[];for(let j of J){let F=await j({...i,data:S});if(S=F?.data??S,F?.stop)return he}return he}if(e.type==="state_expired"){let S=o.event.payload.state,W={...i,state:S},q=s.stateExpiredHandlers["*"]??[];for(let re of q)await re(W);return he}let c=o.event,p=s.hookHandlers.before_incoming_event[c.type]??[];for(let w of p){let S=await w({...i,data:c});if(c=S?.data??c,S?.stop)return he}let m={...i,event:c},T=s.eventHandlers[c.type]??[];for(let w of T)await w(m);let O=s.hookHandlers.after_incoming_event[c.type]??[];for(let w of O){let S=await w({...i,data:c});if(c=S?.data??c,S?.stop)return he}return he},kT=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let{input:s,type:i}=Se(r);if(!i)throw new Error("Missing action type");let o=a.hookHandlers.before_incoming_call_action[i]??[];for(let O of o){let w=await O({ctx:t,logger:e,client:n,data:{type:i,input:s},...tt({client:n})});s=w?.data?.input??s,i=w?.data?.type??i}let c=a.actionHandlers[i];if(!c)throw new Error(`Action ${i} not found`);let p=await c({ctx:t,logger:e,input:s,client:n,type:i,...tt({client:n})}),m=a.hookHandlers.after_incoming_call_action[i]??[];for(let O of m){let w=await O({ctx:t,logger:e,client:n,data:{type:i,output:p},...tt({client:n})});i=w?.data?.type??i,p=w?.data?.output??p}return{status:200,body:JSON.stringify({output:p})}},tt=t=>({workflows:Jt(t.client)});var pa=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._actionHandlers[r];if(n)return n;for(let a of Object.values(this._plugins))if(n=a.actionHandlers[r],n)return n}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(o=>o.messageHandlers[r]??[]),a=this._messageHandlers[r]??[],s=this._messageHandlers["*"]??[],i=[...a,...s].sort((o,c)=>o.order-c.order).map(({handler:o})=>o);return Z.unique([...n,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(o=>o.eventHandlers[r]??[]),a=this._eventHandlers[r]??[],s=this._eventHandlers["*"]??[],i=[...a,...s].sort((o,c)=>o.order-c.order).map(({handler:o})=>o);return Z.unique([...n,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(o=>o.stateExpiredHandlers[r]??[]),a=this._stateExpiredHandlers[r]??[],s=this._stateExpiredHandlers["*"]??[],i=[...a,...s].sort((o,c)=>o.order-c.order).map(({handler:o})=>o);return Z.unique([...n,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{if(this._hookHandlers[r])return new Proxy({},{get:(a,s)=>{let i=Object.values(this._plugins).flatMap(T=>T.hookHandlers[r]?.[s]??[]),o=this._hookHandlers[r]??{},c=o[s]??[],p=o["*"]??[],m=[...c,...p].sort((T,O)=>T.order-O.order).map(({handler:T})=>T);return Z.unique([...i,...m])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{let i=n[s]?.sort((c,p)=>c.order-p.order).map(({handler:c})=>c)??[],o=Object.values(this._plugins).flatMap(c=>c.workflowHandlers[r]?.[s]??[]);return Z.unique([...i,...o])}})}})}on={message:(e,r)=>{this._messageHandlers[e]=Z.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=Z.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=Z.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=Z.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=Z.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=Z.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=Z.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},beforeIncomingCallAction:(e,r)=>{this._hookHandlers.before_incoming_call_action[e]=Z.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=Z.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=Z.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=Z.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=Z.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingCallAction:(e,r)=>{this._hookHandlers.after_incoming_call_action[e]=Z.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=Z.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=Z.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=Z.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};handler=tp(this);start=e=>kr(this.handler,e)};var ga=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes;let r=this._getEntityReference(this.entities),n=e.events===void 0?{}:te.mapValues(e.events,i=>({...i,schema:i.schema(r)})),a=e.actions===void 0?{}:te.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(r)},output:{...i.output,schema:i.output.schema(r)}})),s=e.channels===void 0?{}:te.mapValues(e.channels,i=>({...i,messages:te.mapValues(i.messages,o=>({...o,schema:o.schema(r)}))}));this.events=n,this.actions=a,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let r={};for(let[n,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,i=a.schema._def.description,o=Af.ref(n);s&&o.title(s),i&&o.describe(i),r[n]=o}return r}};var ha=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};var ii=":";var rp=t=>{let[e,r]=t.split(ii);return!e||!r?null:{namespace:e,eventName:r}},np=t=>`${t.namespace}${ii}${t.actionName}`,ap=t=>`${t.namespace}${ii}${t.eventName}`,sp=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.actions[t.actionName]?.name??t.actionName;return{namespace:n,actionName:a}},ip=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.events[t.eventName]?.name??t.eventName;return{namespace:n,eventName:a}};var op=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>i=>ET({client:t,interfaces:e.interfaces,integrationOrInterfaceName:n,methodName:s,input:i})})}),ET=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=sp({namespace:r,actionName:n},e),i=np(s);return(await t.callAction({type:i,input:a})).output};var oi=class{constructor(e,r,n){this._client=e;this._stateType=r;this._stateName=n}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(r=>r.state.payload)}async set(e,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:r})}async getOrSet(e,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:r}).then(n=>n.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,r){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:r})}},lp=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>{let i=e.alias!==void 0?`${e.alias}${ca}${s}`:s;return new oi(t,n,i)}})});var ma=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:r,interfaces:n,alias:a}=this._runtime,s=op(e,this._runtime),i=lp(e,this._runtime),o=Jt(e);return{configuration:r,interfaces:n,actions:s,states:i,alias:a,workflows:o}}get actionHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._actionHandlers[r];if(n)return Fe.setName(a=>n({...a,...this._getTools(a.client)}),n.name)}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[];return Z.unique([...n,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Fe.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._eventHandlers[r]??[],a=Object.entries(this._eventHandlers).filter(([o])=>this._eventResolvesTo(o,r)).flatMap(([,o])=>o??[]),s=this._eventHandlers["*"]??[];return Z.unique([...n,...a,...s]).sort((o,c)=>o.order-c.order).map(({handler:o})=>Fe.setName(c=>o({...c,...this._getTools(c.client)}),o.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[];return Z.unique([...n,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Fe.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._hookHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{s=this._stripAliasPrefix(s);let i=n[s]??[],o=Object.entries(n).filter(([m])=>this._eventResolvesTo(m,s)).flatMap(([,m])=>m??[]),c=n["*"]??[];return Z.unique([...i,...o,...c]).sort((m,T)=>m.order-T.order).map(({handler:m})=>Fe.setName(T=>m({...T,...this._getTools(T.client)}),m.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(a,s)=>(n[s]?.sort((o,c)=>o.order-c.order)??[]).map(({handler:o})=>Fe.setName(c=>o({...c,...this._getTools(c.client)}),o.name))})}})}on={message:(e,r)=>{this._messageHandlers[e]=Z.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=Z.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=Z.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=Z.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=Z.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=Z.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=Z.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},beforeIncomingCallAction:(e,r)=>{this._hookHandlers.before_incoming_call_action[e]=Z.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=Z.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=Z.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=Z.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=Z.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingCallAction:(e,r)=>{this._hookHandlers.after_incoming_call_action[e]=Z.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=Z.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=Z.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=Z.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};_eventResolvesTo=(e,r)=>{let n=rp(e);if(!n)return!1;let a=ip(n,this._runtime.interfaces);return ap(a)===r};_stripAliasPrefix=e=>{let{alias:r}=this._runtime;if(!r)return e;let n=`${r}:`;return e.startsWith(n)?e.slice(n.length):e}};0&&(module.exports={BRAND,Bot,BotDefinition,BotLogger,BotSpecificClient,DIRTY,EMPTY_PATH,ErrorBoundary,INVALID,Integration,IntegrationDefinition,IntegrationLogger,IntegrationSpecificClient,InterfaceDefinition,NEVER,OK,ParseInputLazyPath,ParseStatus,Plugin,PluginDefinition,RuntimeError,Schema,WELL_KNOWN_ATTRIBUTES,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,ZodFirstPartyTypeKind,ZodFunction,ZodIntersection,ZodIssueCode,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodRef,ZodSchema,ZodSet,ZodString,ZodSymbol,ZodTransformer,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,ZuiForm,addIssueToContext,agent,aimodel,any,array,bigint,boolean,botIdHeader,botUserIdHeader,coerce,configurationHeader,configurationTypeHeader,conversation,createZodEnum,cuid2Regex,cuidRegex,custom,datasource,date,datetimeRegex,defaultComponentDefinitions,discriminatedUnion,effect,emailRegex,enum:null,errorUtil,event,fromJsonSchema,fromObject,function:null,getErrorMap,getParsedType,instanceof:null,integrationIdHeader,intent,intersection,ipv4Regex,ipv6Regex,isAborted,isApiError,isAsync,isDirty,isEmojiRegex,isValid,jsonSchemaToZui,knowledgebase,late,lazy,literal,makeIssue,map,mergeObjectSchemas,message,messages,nan,nativeEnum,never,null:null,nullable,number,object,objectToZui,objectUtil,oboolean,onumber,operationHeader,optional,ostring,parseBody,pipeline,preprocess,processCreateParams,promise,quotelessJson,readonly,record,ref,serve,set,setErrorMap,strictObject,string,symbol,table,tablerow,transformer,transforms,tuple,typeHeader,ulidRegex,undefined,union,unknown,user,util,uuidRegex,variable,void:null,webhookIdHeader,withErrorBoundary,z,zuiToJsonSchema});
|
|
64
|
+
`,s+=`}
|
|
65
|
+
`,s+=`}
|
|
66
|
+
`),s+=`}
|
|
67
|
+
`,s+="})"}let a=r?s?r+s:n?n==="z.never()"?r+".strict()":r+`.catchall(${n})`:r:s||(n?`z.record(${n})`:"z.record(z.any())");return $.an.anyOf(t)&&(a+=`.and(${rd(p(c({},t),{anyOf:t.anyOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?p(c({},o),{type:"object"}):o)}),e)})`),$.a.oneOf(t)&&(a+=`.and(${Is(p(c({},t),{oneOf:t.oneOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?p(c({},o),{type:"object"}):o)}),e)})`),$.an.allOf(t)&&(a+=`.and(${Nt(p(c({},t),{allOf:t.allOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?p(c({},o),{type:"object"}):o)}),e)})`),a}i(nd,"parseObject");var mh=i(t=>{var e;let r="z.string()";if((e=t[b])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";r="z.coerce.string()"}return r+=G(t,"format",({value:n})=>{switch(n){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),r+=G(t,"pattern",({json:n})=>[`.regex(new RegExp(${n})`,", ",")"]),r+=G(t,"minLength",({json:n})=>[`.min(${n}`,", ",")"]),r+=G(t,"maxLength",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseString"),vh=i((t,e)=>`${L(dh(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),_h=i(t=>`z.ref('${t.$ref}')`,"parseRef"),Th=i((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return Is(t,e);let s=t.oneOf.map((a,o)=>L(a,p(c({},e),{path:[...e.path,"oneOf",o]})));return`z.discriminatedUnion("${(n=t.discriminator)==null?void 0:n.propertyName}", [${s.join(", ")}])`},"parseDiscriminator"),L=i((t,e={seen:new Map,path:[]},r)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let a=e.parserOverride(t,e);if(typeof a=="string")return a}let n=e.seen.get(t);if(n){if(n.r!==void 0)return n.r;if(e.depth===void 0||n.n>=e.depth)return"z.any()";n.n+=1}else n={r:void 0,n:0},e.seen.set(t,n);let s=Ph(t,e);return r||(s=bh(t,s),e.withoutDefaults||(s=wh(t,s))),n.r=s,s},"parseSchema"),bh=i((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),wh=i((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),Ph=i((t,e)=>$.a.nullable(t)?vh(t,e):$.an.object(t)?nd(t,e):$.an.array(t)?ph(t,e):$.an.anyOf(t)?rd(t,e):$.an.allOf(t)?Nt(t,e):$.a.discriminator(t)?Th(t,e):$.a.oneOf(t)?Is(t,e):$.a.not(t)?oh(t,e):$.an.enum(t)?gh(t):$.a.const(t)?fh(t):$.a.multipleType(t)?ih(t,e):$.a.primitive(t,"string")?mh(t):$.a.primitive(t,"number")||$.a.primitive(t,"integer")?hh(t):$.a.primitive(t,"boolean")?sh(t):$.a.primitive(t,"null")?lh(t):$.a.conditional(t)?yh(t,e):$.a.ref(t)?_h(t):ah(t),"selectParser"),$={an:{object:i(t=>t.type==="object","object"),array:i(t=>t.type==="array","array"),anyOf:i(t=>t.anyOf!==void 0,"anyOf"),allOf:i(t=>t.allOf!==void 0,"allOf"),enum:i(t=>t.enum!==void 0,"enum")},a:{nullable:i(t=>t.nullable===!0,"nullable"),multipleType:i(t=>Array.isArray(t.type),"multipleType"),not:i(t=>t.not!==void 0,"not"),const:i(t=>t.const!==void 0,"const"),primitive:i((t,e)=>t.type===e,"primitive"),conditional:i(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:i(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:i(t=>t.oneOf!==void 0,"oneOf"),ref:i(t=>t.$ref!==void 0,"ref")}},xh=i(t=>{let e;try{e=new Function("z",`return ${t}`)(u)}catch(r){return{sucess:!1,error:`Failed to evaluate schema: ${(r instanceof Error?r:new Error(String(r))).message}`}}return e instanceof u.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),kh=i(t=>L(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),Sh=i(t=>{let e=kh(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=xh(e);if(!r.sucess)throw new zr(r.error);return r.value},"jsonSchemaToZod"),Bt=i((t,e)=>{var r,n;if(e[b]&&t._def&&(t._def[b]=e[b]),((r=t._def)==null?void 0:r.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([s,a])=>{let o=typeof t._def.shape=="function"?t._def.shape():t._def.shape;o[s]&&Bt(o[s],a)}),((n=t._def)==null?void 0:n.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Bt(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let s=e.items;if(typeof s=="object"&&!Array.isArray(s)){let a=t._def.type;a&&Bt(a,s)}else Array.isArray(s)&&s.forEach((a,o)=>{let l=t._def;l.typeName===_.ZodFirstPartyTypeKind.ZodTuple&&Bt(l.items[o],a)})}},"applyZuiPropsRecursively"),Eh=i(t=>{let e=Sh(t);return Bt(e,t),e},"fromJSONSchemaLegacy"),Oh=i(t=>{var e,r;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(n=>typeof n!="boolean"&&sd(n))&&((r=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:r.typeName)===u.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),Zh=i(t=>{var e,r;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(n=>typeof n!="boolean"&&n.type==="null")&&((r=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:r.typeName)===u.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),sd=i(t=>{var e,r;return t.not===!0&&((r=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:r.typeName)===u.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),Bh=i(t=>{var e,r;return!t.not&&((r=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:r.typeName)===u.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),Ih=i(({type:t,minimum:e,exclusiveMinimum:r,maximum:n,exclusiveMaximum:s,multipleOf:a,format:o})=>{let l=u.number();return t==="integer"&&(l=l.int()),o==="finite"&&(l=l.finite()),r!==void 0?l=l.gt(r):e!==void 0&&(l=l.gte(e)),s!==void 0?l=l.lt(s):n!==void 0&&(l=l.lte(n)),a!==void 0&&(l=l.multipleOf(a)),l},"numberJSONSchemaToZuiNumber"),Ch=i(({format:t,pattern:e,minLength:r,maxLength:n})=>{let s=u.string();if(r&&n&&r===n?s=s.length(r):(r&&(s=s.min(r)),n&&(s=s.max(n))),t==="cuid"||e===j.cuid)s=s.cuid();else if(t==="cuid2"||e===j.cuid2)s=s.cuid2();else if(t==="emoji"||e===j.emoji)s=s.emoji();else if(t==="ulid"||e===j.ulid)s=s.ulid();else if(t==="date-time"){let{precision:a,offset:o}=e?Wy(e):{};s=s.datetime({precision:a,offset:o})}else t==="email"||e===j.email?s=s.email():t==="ipv4"||e===j.ipv4?s=s.ip():t==="ipv6"||e===j.ipv6?s=s.ip("v6"):t==="uri"?s=s.url():t==="uuid"||e===j.uuid?s=s.uuid():e&&(s=s.regex(new RegExp(e)));return s},"stringJSONSchemaToZuiString"),vt=i((t,e)=>{let r=[];e.enum!==void 0&&r.push(...e.enum),e.const!==void 0&&r.push(e.const);let n=r.filter(o=>typeof o===t),[s]=n;if(!s){if(t==="string"&&e.type==="string")return Ch(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return Ih(e);if(t==="boolean")return u.boolean();if(t==="null")return u.null();throw new zr(`Unknown primitive type: "${t}"`)}if(n.length===1)return u.literal(s);let a=n.map(o=>u.literal(o));return u.union(a)},"toZuiPrimitive"),Ah=i((t,e)=>Rh(t)?Dh(t,e):Hh(t)?Mh(t,e):Nh(t,e),"arrayJSONSchemaToZuiArray"),Rh=i(t=>Array.isArray(t.items),"_isTuple"),Hh=i(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),Dh=i(({items:t,additionalItems:e},r)=>{let n=t.map(r),s=u.tuple(n);return e!==void 0&&(s=s.rest(r(e))),s},"_handleTuple"),Mh=i(({items:t,minItems:e,maxItems:r},n)=>{let s=u.set(n(t));return e&&(s=s.min(e)),r&&(s=s.max(r)),s},"_handleSet"),Nh=i(({minItems:t,maxItems:e,items:r},n)=>{let s=u.array(n(r));return t&&t===e?s.length(t):(t&&(s=s.min(t)),e&&(s=s.max(e)),s)},"_handleArray"),Xe=u.any();function ad(t){return z(t)}i(ad,"fromJSONSchema");function z(t){var e;if(t===void 0)return Xe;if(t===!0)return u.any();if(t===!1)return u.never();if(t.default!==void 0)return z(p(c({},t),{default:void 0})).default(t.default);if(t.readOnly)return z(p(c({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new ve({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new ve({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new ve({propertyNames:t.propertyNames});if(t.if!==void 0)throw new ve({if:t.if});if(t.then!==void 0)throw new ve({then:t.then});if(t.else!==void 0)throw new ve({else:t.else});if(t.$ref!==void 0)return u.ref(t.$ref);if(t.not!==void 0){if(sd(t))return u.undefined();if(t.not===!0)return u.never();throw new ve({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Xe;if(t.type.length===1)return z(p(c({},t),{type:t.type[0]}));let r=t,{type:n}=r,s=Za(r,["type"]),a=t.type.map(o=>z(p(c({},s),{type:o})));return u.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?u.enum(t.enum):vt("string",t);if(t.type==="integer"){let r=vt("number",t);return r instanceof u.ZodNumber?r.int():r}if(t.type==="number")return vt("number",t);if(t.type==="boolean")return vt("boolean",t);if(t.type==="null")return vt("null",t);if(t.type==="array")return Ah(t,z);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let r=z(t.additionalProperties);return z(p(c({},t),{additionalProperties:void 0})).catchall(r)}if(t.properties!==void 0){let r={};for(let[n,s]of Object.entries(t.properties)){let a=z(s),o=(e=t.required)!=null?e:[];r[n]=o.includes(n)?a:a.optional()}return u.object(r)}if(t.additionalProperties!==void 0){let r=z(t.additionalProperties);return u.record(r)}return u.record(Xe)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Xe;if(t.anyOf.length===1)return z(t.anyOf[0]);if(Oh(t))return z(t.anyOf[0]).optional();if(Zh(t))return z(t.anyOf[0]).nullable();let r=t.anyOf.map(z);return u.union(r)}if(t.allOf!==void 0){if(t.allOf.length===0)return Xe;if(t.allOf.length===1)return z(t.allOf[0]);let[r,...n]=t.allOf,s=z(r),a=z({allOf:n});return u.intersection(s,a)}return Bh(t)?u.unknown():Xe}i(z,"_fromJSONSchema");var $h=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,zn=i((t,e,r=!0)=>{if(typeof t!="object")throw new Rn("Input must be an object");let n=i(o=>{let l=o;return e?.nullable&&(l=l.nullable()),e?.optional&&(l=l.optional()),e?.passtrough&&typeof l.passthrough=="function"&&(l=l.passthrough()),l},"applyOptions"),s=Object.entries(t).reduce((o,[l,d])=>{if(d===null)o[l]=n(_.null());else switch(typeof d){case"string":o[l]=$h.test(d)?n(_.string().datetime()):n(_.string());break;case"number":o[l]=n(_.number());break;case"boolean":o[l]=n(_.boolean());break;case"object":Array.isArray(d)?d.length===0?o[l]=n(_.array(_.unknown())):typeof d[0]=="object"?o[l]=n(_.array(zn(d[0],e,!1))):["string","number","boolean"].includes(typeof d[0])&&(o[l]=n(_.array(_[typeof d[0]]()))):o[l]=n(zn(d,e,!1));break;default:throw new Rn(`Unsupported type for key ${l}`)}return o},{}),a=Object.keys(s).length>0;return e?.passtrough||!r&&!a?_.object(s).passthrough():_.object(s)},"fromObject");function id(){return{}}i(id,"parseAnyDef");function od(t,e){var r,n;let s={type:"array"};return((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!=="ZodAny"&&(s.items=C(t.type._def,p(c({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&H(s,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&H(s,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(H(s,"minItems",t.exactLength.value,t.exactLength.message,e),H(s,"maxItems",t.exactLength.value,t.exactLength.message,e)),s}i(od,"parseArrayDef");function ld(t,e){let r=c({type:"integer",format:"int64"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?H(r,"minimum",n.value,n.message,e):H(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),H(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?H(r,"maximum",n.value,n.message,e):H(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),H(r,"maximum",n.value,n.message,e));break;case"multipleOf":H(r,"multipleOf",n.value,n.message,e);break}return r}i(ld,"parseBigintDef");function cd(t){return c({type:"boolean"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{})}i(cd,"parseBooleanDef");function dd(t,e){return C(t.type._def,e)}i(dd,"parseBrandedDef");var jh=i((t,e)=>C(t.innerType._def,e),"parseCatchDef");function ud(t,e){return e.dateStrategy=="integer"?Kh(t,e):c({type:"string",format:"date-time"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{})}i(ud,"parseDateDef");var Kh=i((t,e)=>{let r=c({type:"integer",format:"unix-time"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{});for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"&&H(r,"minimum",n.value,n.message,e);break;case"max":e.target==="jsonSchema7"&&H(r,"maximum",n.value,n.message,e);break}return r},"integerDateParser");function pd(t,e){return p(c({},C(t.innerType._def,e)),{default:t.defaultValue()})}i(pd,"parseDefaultDef");function fd(t,e){return e.effectStrategy==="input"?C(t.schema._def,e):{}}i(fd,"parseEffectsDef");function gd(t){return{type:"string",enum:t.values}}i(gd,"parseEnumDef");var Uh=i(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function yd(t,e){let r=[C(t.left._def,p(c({},e),{currentPath:[...e.currentPath,"allOf","0"]})),C(t.right._def,p(c({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(a=>!!a),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,s=[];return r.forEach(a=>{if(Uh(a))s.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let o=a;if("additionalProperties"in a&&a.additionalProperties===!1){let l=a,{additionalProperties:d}=l;o=Za(l,["additionalProperties"])}else n=void 0;s.push(o)}}),s.length?c({allOf:s},n):void 0}i(yd,"parseIntersectionDef");function hd(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}i(hd,"parseLiteralDef");function Cs(t,e){var r,n,s,a,o;if(e.target==="openApi3"&&((r=t.keyType)==null?void 0:r._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((d,f)=>{var g;return p(c({},d),{[f]:(g=C(t.valueType._def,p(c({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?g:{}})},{}),additionalProperties:!1};let l={type:"object",additionalProperties:(n=C(t.valueType._def,p(c({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:{}};if(e.target==="openApi3")return l;if(((s=t.keyType)==null?void 0:s._def.typeName)==="ZodString"&&((a=t.keyType._def.checks)!=null&&a.length)){let d=Object.entries(is(t.keyType._def,e)).reduce((f,[g,h])=>g==="type"?f:p(c({},f),{[g]:h}),{});return p(c({},l),{propertyNames:d})}else if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodEnum")return p(c({},l),{propertyNames:{enum:t.keyType._def.values}});return l}i(Cs,"parseRecordDef");function md(t,e){if(e.mapStrategy==="record")return Cs(t,e);let r=C(t.keyType._def,p(c({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=C(t.valueType._def,p(c({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}i(md,"parseMapDef");function vd(t){let e=t.values,n=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n.filter(a=>typeof a=="string"||typeof a=="number")}}i(vd,"parseNativeEnumDef");function _d(){return{not:{}}}i(_d,"parseNeverDef");function Td(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}i(Td,"parseNullDef");var Ur={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function bd(t,e){if(e.target==="openApi3")return ka(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Ur&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((s,a)=>{let o=Ur[a._def.typeName];return o&&!s.includes(o)?[...s,o]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((s,a)=>{let o=typeof a._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(n.length===r.length){let s=n.filter((a,o,l)=>l.indexOf(a)===o);return{type:s.length>1?s:s[0],enum:r.reduce((a,o)=>a.includes(o._def.value)?a:[...a,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return ka(t,e)}i(bd,"parseUnionDef");var ka=i((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,a)=>C(s._def,p(c({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${a}`]}))).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0)),n=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(r.length)return e.unionStrategy==="anyOf"?c({anyOf:r},n):c({oneOf:r},n)},"asUnionOf");function wd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){let n=t.innerType;if(e.target==="openApi3"){let a={type:Ur[n._def.typeName],nullable:!0};return Ln(n._def,e,a)}let s={type:[Ur[n._def.typeName],"null"]};return Ln(n._def,e,s)}if(e.target==="openApi3"){let n=C(t.innerType._def,p(c({},e),{currentPath:[...e.currentPath]}));return n&&p(c({},n),{nullable:!0})}let r=C(t.innerType._def,p(c({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}i(wd,"parseNullableDef");function Pd(t,e){let r=c({type:"number"},t.coerce?{[b]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",as(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?H(r,"minimum",n.value,n.message,e):H(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),H(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?H(r,"maximum",n.value,n.message,e):H(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),H(r,"maximum",n.value,n.message,e));break;case"multipleOf":H(r,"multipleOf",n.value,n.message,e);break}return r}i(Pd,"parseNumberDef");var Fh=i((t,e)=>{var r;return t.unknownKeys instanceof E?(r=C(t.unknownKeys._def,p(c({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function xd(t,e){let r=p(c({type:"object"},Object.entries(t.shape()).reduce((n,[s,a])=>{if(a===void 0||a._def===void 0)return n;let o=C(a._def,p(c({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return o===void 0?n:{properties:p(c({},n.properties),{[s]:o}),required:a.isOptional()?n.required:[...n.required,s]}},{properties:{},required:[]})),{additionalProperties:Fh(t,e)});return r.required.length||delete r.required,r}i(xd,"parseObjectDef");var zh=i((t,e)=>{var r;if(e.currentPath.toString()===((r=e.propertyPath)==null?void 0:r.toString()))return C(t.innerType._def,e);let n=C(t.innerType._def,p(c({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),Lh=i((t,e)=>{if(e.pipeStrategy==="input")return C(t.in._def,e);if(e.pipeStrategy==="output")return C(t.out._def,e);let r=C(t.in._def,p(c({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=C(t.out._def,p(c({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(s=>s!==void 0)}},"parsePipelineDef");function kd(t,e){return C(t.type._def,e)}i(kd,"parsePromiseDef");function Sd(t,e){let n={type:"array",uniqueItems:!0,items:C(t.valueType._def,p(c({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&H(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&H(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}i(Sd,"parseSetDef");function Ed(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>C(r._def,p(c({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:C(t.rest._def,p(c({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>C(r._def,p(c({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}i(Ed,"parseTupleDef");function Od(){return{not:{}}}i(Od,"parseUndefinedDef");function Zd(){return{}}i(Zd,"parseUnknownDef");var Wh=i((t,e)=>C(t.innerType._def,e),"parseReadonlyDef");function Bd(t){return{$ref:t.uri}}i(Bd,"parseRefDef");function C(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let o=qh(n,e);if(o!==void 0)return o}let s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);let a=Gh(t,t.typeName,e);return a&&Ln(t,e,a),s.jsonSchema=a,a}i(C,"parseDef");var qh=i((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Vh(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),Vh=i((t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},"getRelativePath"),Gh=i((t,e,r)=>{switch(e){case"ZodString":return is(t,r);case"ZodNumber":return Pd(t,r);case"ZodObject":return xd(t,r);case"ZodBigInt":return ld(t,r);case"ZodBoolean":return cd(t);case"ZodDate":return ud(t,r);case"ZodUndefined":return Od();case"ZodNull":return Td(r);case"ZodArray":return od(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return bd(t,r);case"ZodIntersection":return yd(t,r);case"ZodTuple":return Ed(t,r);case"ZodRecord":return Cs(t,r);case"ZodRef":return Bd(t);case"ZodLiteral":return hd(t,r);case"ZodEnum":return gd(t);case"ZodNativeEnum":return vd(t);case"ZodNullable":return wd(t,r);case"ZodOptional":return zh(t,r);case"ZodMap":return md(t,r);case"ZodSet":return Sd(t,r);case"ZodLazy":return C(t.getter()._def,r);case"ZodPromise":return kd(t,r);case"ZodNaN":case"ZodNever":return _d();case"ZodEffects":return fd(t,r);case"ZodAny":return id();case"ZodUnknown":return Zd();case"ZodDefault":return pd(t,r);case"ZodBranded":return dd(t,r);case"ZodReadonly":return Wh(t,r);case"ZodCatch":return jh(t,r);case"ZodPipeline":return Lh(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),Ln=i((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[b]:c(c({},t[b]),r[b])}),r),"addMeta"),Sa={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},Jh=i(t=>typeof t=="string"?p(c({},Sa),{name:t}):c(c({},Sa),t),"getDefaultOptions"),Xh=i(t=>{let e=Jh(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return p(c({},e),{currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))})},"getRefs"),Yh=i((t,e)=>{var r;let n=Xh(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,g])=>{var h;return p(c({},d),{[f]:(h=C(g._def,p(c({},n),{currentPath:[...n.basePath,n.definitionPath,f]}),!0))!=null?h:{}})},{}):void 0,a=typeof e=="string"?e:e?.name,o=(r=C(t._def,a===void 0?n:p(c({},n),{currentPath:[...n.basePath,n.definitionPath,a]}),!1))!=null?r:{},l=a===void 0?s?p(c({},o),{[n.definitionPath]:s}):o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:p(c({},s),{[a]:o})};return n.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),l},"zodToJsonSchema"),Qh=i((t,e={target:"openApi3"})=>{let r=Yh(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"toJSONSchemaLegacy");var pt=(t,e)=>{let r=t._def,n=e._def;if(r.typeName===_.ZodFirstPartyTypeKind.ZodObject&&n.typeName===_.ZodFirstPartyTypeKind.ZodObject){let s=r.shape(),a=n.shape();return _.object({...s,...a})}if(r.typeName===_.ZodFirstPartyTypeKind.ZodRecord&&n.typeName===_.ZodFirstPartyTypeKind.ZodRecord)return _.record(_.intersection(r.valueType,n.valueType));throw new Error("Cannot merge object schemas with record schemas")},Id=_;var re=_.string().min(1),Ad=_.object({text:re}),Rd=_.object({markdown:re}),Hd=_.object({imageUrl:re}),Dd=_.object({audioUrl:re}),Md=_.object({videoUrl:re}),Nd=_.object({fileUrl:re,title:re.optional()}),$d=_.object({latitude:_.number(),longitude:_.number(),address:_.string().optional(),title:_.string().optional()}),jd=_.object({title:re,subtitle:re.optional(),imageUrl:re.optional(),actions:_.array(_.object({action:_.enum(["postback","url","say"]),label:re,value:re}))}),Cd=_.object({text:re,options:_.array(_.object({label:re,value:re}))}),em=_.object({items:_.array(jd)}),tm=_.union([_.object({type:_.literal("text"),payload:Ad}),_.object({type:_.literal("markdown"),payload:Rd}),_.object({type:_.literal("image"),payload:Hd}),_.object({type:_.literal("audio"),payload:Dd}),_.object({type:_.literal("video"),payload:Md}),_.object({type:_.literal("file"),payload:Nd}),_.object({type:_.literal("location"),payload:$d})]),rm=_.object({items:_.array(tm)}),nm={schema:Rd},sm={text:{schema:Ad},image:{schema:Hd},audio:{schema:Dd},video:{schema:Md},file:{schema:Nd},location:{schema:$d},carousel:{schema:em},card:{schema:jd},dropdown:{schema:Cd},choice:{schema:Cd},bloc:{schema:rm}};var Lt="x-bot-id",Rs="x-bot-user-id",Hs="x-integration-id",Ds="x-webhook-id",Ms="x-bp-configuration-type",Wt="x-bp-configuration",qt="x-bp-operation",Ns="x-bp-type",am={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};var Kd=require("browser-or-node");var $s=console;function oe(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Vt(t,e=8072,r=cm){if(!Kd.isNode)throw new Error("This function can only be called in Node.js");let s=require("http").createServer(async(a,o)=>{try{let l=await im(a);if(l.path==="/health"){o.writeHead(200).end("ok");return}let d=await t(l);o.writeHead(d?.status??200,d?.headers??{}).end(d?.body??"{}")}catch(l){$s.error("Error while handling request",{error:l?.message??"Internal error occured"}),o.writeHead(500).end(JSON.stringify({error:l?.message??"Internal error occured"}))}});return s.listen(e,()=>r(e)),s}async function im(t){let e=await lm(t),r={};for(let s=0;s<t.rawHeaders.length;s+=2){let a=t.rawHeaders[s].toLowerCase(),o=t.rawHeaders[s+1];r[a]=o}let n=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:n.pathname,query:om(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function om(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function lm(t){return new Promise((e,r)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let n="";t.on("data",s=>n+=s.toString()),t.on("error",s=>r(s)),t.on("end",()=>e(n))})}function cm(t){$s.info(`Listening on port ${t}`)}var Sn=require("@botpress/client");var M={};ht(M,{mapKeys:()=>pm,mapValues:()=>um,mergeRecords:()=>gm,pairs:()=>gn,stripUndefinedProps:()=>fm,values:()=>dm});var gn=t=>Object.entries(t),dm=t=>Object.values(t),um=(t,e)=>Object.fromEntries(gn(t).map(([r,n])=>[r,e(n,r)])),pm=(t,e)=>Object.fromEntries(gn(t).map(([r,n])=>[e(r),n])),fm=t=>Object.fromEntries(gn(t).filter(([,e])=>e!==void 0)),gm=(t,e,r)=>{let n=[...Object.keys(t),...Object.keys(e)],s=[...new Set(n)],a={};for(let o of s){let l=t[o],d=e[o];l&&d?a[o]=r(l,d):l?a[o]=l:d&&(a[o]=d)}return a};var S={};ht(S,{safePush:()=>ym,unique:()=>hm});var ym=(t,...e)=>t?[...t,...e]:[...e],hm=t=>Array.from(new Set(t));var me={};ht(me,{setName:()=>mm});var mm=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Ud=t=>{let{name:e,version:r}=t,n={actions:{},events:{},channels:{}},s={name:e,version:r,entities:M.mapValues(t.entities,o=>({name:o.name})),actions:{},events:{},channels:{}},a=M.mapValues(t.entities,o=>o.schema);for(let[o,l]of Object.entries(t.definition.actions??{})){let d=l.input.schema.dereference(a),f=l.output.schema.dereference(a),g=t.actions?.[o]?.name??o;n.actions[g]={...l,...t.actions?.[o]??{},input:{schema:d},output:{schema:f}},s.actions[o]={name:g}}for(let[o,l]of Object.entries(t.definition.events??{})){let d=l.schema.dereference(a),f=t.events?.[o]?.name??o;n.events[f]={...l,...t.events?.[o]??{},schema:d},s.events[o]={name:f}}for(let[o,l]of Object.entries(t.definition.channels??{})){let d={};for(let[g,h]of Object.entries(l.messages)){let x=h.schema.dereference(a);d[g]={...h,schema:x}}let f=t.channels?.[o]?.name??o;n.channels[f]={...l,...t.channels?.[o]??{},message:{...l.message??{},tags:{...l.message?.tags??{},...t.channels?.[o]?.message?.tags??{}}},conversation:{...l.conversation??{},tags:{...l.conversation?.tags??{},...t.channels?.[o]?.conversation?.tags??{}}},messages:d},s.channels[o]={name:f}}return{resolved:n,statement:s}};var yn=Symbol("schemaName"),Fd=t=>t?M.mapValues(t,(r,n)=>({...r,[yn]:n})):{},zd=t=>yn in t&&t[yn]!==void 0,Ld=t=>t[yn];var hn=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;extend(e,r){let{entities:n,actions:s,events:a,channels:o}=this._callBuilder(e,r),l=this;l.interfaces??={};let d=Object.values(n).map(x=>x.name),f=d.length===0?e.name:`${e.name}<${d.join(",")}>`,{resolved:g,statement:h}=Ud({...e,entities:n,actions:M.stripUndefinedProps(s),events:M.stripUndefinedProps(a),channels:M.stripUndefinedProps(o)});return l.actions=M.mergeRecords(l.actions??{},g.actions,this._mergeActions),l.channels=M.mergeRecords(l.channels??{},g.channels,this._mergeChannels),l.events=M.mergeRecords(l.events??{},g.events,this._mergeEvents),l.interfaces[f]={id:e.id,...h},this}_callBuilder(e,r){let s={entities:Fd(this.entities)},a=r(s),o=M.pairs(a.entities).find(([d,f])=>!zd(f));if(o)throw new Error(`Cannot extend interface "${e.name}" with entity "${o[0]}"; the provided schema is not part of the integration's entities.`);return{entities:M.mapValues(a.entities,d=>({name:Ld(d),schema:d.schema})),actions:a.actions??{},events:a.events??{},channels:a.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:pt(e.input.schema,r.input.schema)},output:{schema:pt(e.output.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:pt(e.schema,r.schema)});_mergeChannels=(e,r)=>{let n=M.mergeRecords(e.messages,r.messages,this._mergeMessage),s;(e.conversation||r.conversation)&&(s={tags:{...e.conversation?.tags,...r.conversation?.tags}});let a;return(e.message||r.message)&&(a={tags:{...e.message?.tags,...r.message?.tags}}),{...e,...r,messages:n,conversation:s,message:a}};_mergeMessage=(e,r)=>({schema:pt(e.schema,r.schema)})};var Ve=require("@botpress/client");var Wd=zs(require("@botpress/client")),mn={retries:3,retryCondition:t=>Wd.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(vm(e.response?.headers??{})??t)*1e3},vm=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let r of e){let n=t[r];if(n!==void 0)return _m(String(n))}},_m=t=>{let e=Tm(t)?bm(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Tm=t=>t.includes(" "),bm=t=>{let e=wm(t);if(!e)return;let r=new Date;return Math.max(0,Math.floor((e.getTime()-r.getTime())/1e3))},wm=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};var ft=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};var vn=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var _n="#";var Pm=_.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Vd=t=>{let e=t[Lt],r=t[Rs],n=t[Hs],s=t[Ds],a=t[Ms],o=t[Wt],l=Pm.parse(t[qt]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing bot user headers");if(!n)throw new Error("Missing integration headers");if(!s)throw new Error("Missing webhook headers");if(!o)throw new Error("Missing configuration headers");if(!l)throw new Error("Missing operation headers");return{botId:e,botUserId:r,integrationId:n,webhookId:s,operation:l,configurationType:a??null,configuration:o?JSON.parse(Buffer.from(o,"base64").toString("utf-8")):{}}};var Gd=zs(require("util")),gt=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,r){this._getConsoleMethod(e)(this._serializeMessage(r))}_serializeMessage(e){let r=Gd.default.format(...e);return process.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(r):r}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var we=class extends gt{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new we({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};var xm=t=>["traceparent","tracestate","sentry-trace"].reduce((e,r)=>(t[r]&&(e[r]=t[r]),e),{}),Jd=t=>async e=>{let r=Vd(e.headers),[,n]=(e.headers.traceparent||"").split("-"),s=new Ve.Client({botId:r.botId,integrationId:r.integrationId,retry:mn,headers:xm(e.headers)}),a=new ft(s),o=new we({traceId:n}),l={ctx:r,req:e,client:a,logger:o,instance:t};try{let d;switch(r.operation){case"webhook_received":d=await Sm(l);break;case"register":d=await Em(l);break;case"unregister":d=await Om(l);break;case"message_created":d=await Im(l);break;case"action_triggered":d=await Cm(l);break;case"ping":d=await km(l);break;case"create_user":d=await Zm(l);break;case"create_conversation":d=await Bm(l);break;default:throw new Error(`Unknown operation ${r.operation}`)}return d?{...d,status:d.status??200}:{status:200}}catch(d){if((0,Ve.isApiError)(d)){let g=d.type==="Runtime"?d:new Ve.RuntimeError(d.message,d);return o.forBot().error(g.message),{status:g.code,body:JSON.stringify(g.toJSON())}}console.error(d);let f=new Ve.RuntimeError("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}},km=async t=>{},Sm=async({client:t,ctx:e,req:r,logger:n,instance:s})=>{let{req:a}=oe(r);return s.webhook({client:t,ctx:e,req:a,logger:n})},Em=async({client:t,ctx:e,req:r,logger:n,instance:s})=>{if(!s.register)return;let{webhookUrl:a}=oe(r);await s.register({client:t,ctx:e,webhookUrl:a,logger:n})},Om=async({client:t,ctx:e,req:r,logger:n,instance:s})=>{if(!s.unregister)return;let{webhookUrl:a}=oe(r);await s.unregister({ctx:e,webhookUrl:a,client:t,logger:n})},Zm=async({client:t,ctx:e,req:r,logger:n,instance:s})=>{if(!s.createUser)return;let{tags:a}=oe(r);return await s.createUser({ctx:e,client:t,tags:a,logger:n})},Bm=async({client:t,ctx:e,req:r,logger:n,instance:s})=>{if(!s.createConversation)return;let{channel:a,tags:o}=oe(r);return await s.createConversation({ctx:e,client:t,channel:a,tags:o,logger:n})},Im=async({ctx:t,req:e,client:r,logger:n,instance:s})=>{let{conversation:a,user:o,type:l,payload:d,message:f}=oe(e),g=s.channels[a.channel];if(!g)throw new Error(`Channel ${a.channel} not found`);let h=g.messages[l];if(!h)throw new Error(`Message of type ${l} not found in channel ${a.channel}`);await h({ctx:t,conversation:a,message:f,user:o,type:l,client:r,payload:d,ack:async({tags:O})=>{await r.updateMessage({id:f.id,tags:O})},logger:n})},Cm=async({req:t,ctx:e,client:r,logger:n,instance:s})=>{let{input:a,type:o}=oe(t);if(!o)throw new Error("Missing action type");let l=s.actions[o];if(!l)throw new Error(`Action ${o} not found`);let d=new vn,g={output:await l({ctx:e,input:a,client:r,type:o,logger:n,metadata:d}),meta:d.toJSON()};return{body:JSON.stringify(g)}};var Tn=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=Jd(this);start=e=>Vt(this.handler,e)};var bn=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;addIntegration(e,r){let n=this;return n.integrations||(n.integrations={}),n.integrations[e.name]={enabled:r.enabled,...e,configurationType:r.configurationType,configuration:r.configuration,disabledChannels:r.disabledChannels},this}addPlugin(e,r){let n=this;n.plugins||(n.plugins={});let s=r.alias??e.name;return n.plugins[s]={...e,alias:r.alias,configuration:r.configuration,interfaces:r.interfaces},n.user=this._mergeUser(n.user,e.definition.user),n.conversation=this._mergeConversation(n.conversation,e.definition.conversation),n.message=this._mergeMessage(n.message,e.definition.message),n.recurringEvents=this._mergeRecurringEvents(n.recurringEvents,e.definition.recurringEvents),n.tables=this._mergeTables(n.tables,e.definition.tables),n.workflows=this._mergeWorkflows(n.workflows,e.definition.workflows),n.states=this._mergeStates(n.states,this._prefixKeys(e.definition.states,r.alias)),n.events=this._mergeEvents(n.events,this._prefixKeys(e.definition.events,r.alias)),n.actions=this._mergeActions(n.actions,this._prefixKeys(e.definition.actions,r.alias)),this}_mergeUser=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeConversation=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeMessage=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeStates=(e,r)=>({...e,...r});_mergeEvents=(e,r)=>({...e,...r});_mergeRecurringEvents=(e,r)=>({...e,...r});_mergeActions=(e,r)=>({...e,...r});_mergeTables=(e,r)=>({...e,...r});_mergeWorkflows=(e,r)=>({...e,...r});_prefixKeys=(e,r)=>!e||!r?e:M.mapKeys(e,n=>`${r}${_n}${n}`)};var Ge=require("@botpress/client");var Pe=class extends gt{constructor(e){super({...e})}with(e){return new Pe({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};var ce=class{constructor(e,r={before:{},after:{}}){this._client=e;this._hooks=r}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);createEvent=e=>this._run("createEvent",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createWorkflow=e=>this._run("createWorkflow",e);getWorkflow=e=>this._run("getWorkflow",e);updateWorkflow=e=>this._run("updateWorkflow",e);deleteWorkflow=e=>this._run("deleteWorkflow",e);listWorkflows=e=>this._run("listWorkflows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,r)=>{let n=this._hooks.before[e];n&&(r=await n(r));let s=await this._client[e](r),a=this._hooks.after[e];return a&&(s=await a(s,r)),s}};var yt=t=>new Proxy({},{get:(e,r)=>({listInstances:{all:n=>xe({workflowName:r,client:t,input:n}),running:n=>xe({workflowName:r,client:t,input:n,statuses:["in_progress"]}),scheduled:n=>xe({workflowName:r,client:t,input:n,statuses:["pending","listening"]}),allFinished:n=>xe({workflowName:r,client:t,input:n,statuses:["completed","cancelled","failed","timedout"]}),cancelled:n=>xe({workflowName:r,client:t,input:n,statuses:["cancelled"]}),failed:n=>xe({workflowName:r,client:t,input:n,statuses:["failed"]}),succeeded:n=>xe({workflowName:r,client:t,input:n,statuses:["completed"]}),timedOut:n=>xe({workflowName:r,client:t,input:n,statuses:["timedout"]})},startNewInstance:async n=>{let{workflow:s}=await t.createWorkflow({name:r,status:"pending",...n});return{workflow:ke({client:t,workflow:s})}}})}),xe=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(r=>ke({client:t.client,workflow:r}))}},ke=t=>({...t.workflow,async update(e){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:ke({client:t.client,workflow:r})}},async setFailed({failureReason:e}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:ke({client:t.client,workflow:r})}},async setCompleted({output:e}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:ke({client:t.client,workflow:r})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:ke({client:t.client,workflow:e})}}});var Am=_.enum(["event_received","register","unregister","ping","action_triggered"]),Xd=t=>{let e=t[Lt],r=t[Wt],n=t[Ns],s=Am.parse(t[qt]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing type headers");if(!r)throw new Error("Missing configuration headers");if(!s)throw new Error("Missing operation headers");return{botId:e,operation:s,type:n,configuration:r?JSON.parse(Buffer.from(r,"base64").toString("utf-8")):{}}};var Y={status:200};var js=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var Rm=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Yd=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!Rm.includes(e.payload.type))throw new Error("Unexpected event type");let r={...t,logger:Hm(t,e)};if(!e.payload.workflow.name)return r.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),Y;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":r.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await Dm(r,e);default:e.payload.type}return Y},Hm=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),Dm=async(t,e)=>{let r=js(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];return!n||n.length===0?(t.logger.warn(`No ${r} handler found for workflow "${e.payload.workflow.name}"`),Y):(await Mm(t,e),await Nm(t,e),Y)},Mm=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},Nm=async(t,e)=>{let r=js(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];for(let s of n)await s({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:ke({...t,workflow:e.payload.workflow}),workflows:yt(t.client)})};var Qd=t=>async e=>{let r=Xd(e.headers),n=new Pe,s=new Ge.Client({botId:r.botId,retry:mn}),a=new ce(s,{before:{createMessage:async l=>{let d=t.hookHandlers.before_outgoing_message[l.type]??[];for(let f of d){let g=new ce(s);l=(await f({client:g,ctx:r,logger:n.with({conversationId:l.conversationId,userId:l.userId}),data:l,...Se({client:g})}))?.data??l}return l},callAction:async l=>{let d=t.hookHandlers.before_outgoing_call_action[l.type]??[];for(let f of d){let g=new ce(s);l=(await f({client:g,ctx:r,logger:n,data:l,...Se({client:g})}))?.data??l}return l}},after:{createMessage:async l=>{let d=t.hookHandlers.after_outgoing_message[l.message.type]??[];for(let f of d){let g=new ce(s);l=(await f({client:g,ctx:r,logger:n.with({messageId:l.message.id,conversationId:l.message.conversationId,userId:l.message.userId}),data:l,...Se({client:g})}))?.data??l}return l},callAction:async(l,d)=>{let{type:f}=d,g=t.hookHandlers.after_outgoing_call_action[f]??[];for(let h of g){let x=new ce(s);l=(await h({client:x,ctx:r,logger:n,data:{type:f,...l},...Se({client:x})}))?.data??l}return l}}}),o={req:e,ctx:r,logger:n,client:a,self:t};try{switch(r.operation){case"action_triggered":return await Fm(o);case"event_received":return await Um(o);case"register":return await jm(o);case"unregister":return await Km(o);case"ping":return await $m(o);default:throw new Error(`Unknown operation ${r.operation}`)}}catch(l){if((0,Ge.isApiError)(l)){let f=l.type==="Runtime"?l:new Ge.RuntimeError(l.message,l);return n.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let d=new Ge.RuntimeError("An unexpected error occurred in the bot.");return n.error(d.message),{status:d.code,body:JSON.stringify(d.toJSON())}}},$m=async t=>Y,jm=async t=>Y,Km=async t=>Y,Um=async t=>{let{ctx:e,logger:r,req:n,client:s,self:a}=t,o={client:s,ctx:e,logger:r,...Se({client:s})},l=oe(n);if(o.logger=o.logger.with({eventId:l.event.id,messageId:l.event.messageId,conversationId:l.event.conversationId,userId:l.event.userId}),e.type==="workflow_update")return await Yd(t,l.event);if(e.type==="message_created"){let O=l.event,B=O.payload.message;o.logger=o.logger.with({messageId:B.id,conversationId:B.conversationId,userId:B.userId});let U=a.hookHandlers.before_incoming_message[B.type]??[];for(let q of U){let se=await q({...o,data:B});if(B=se?.data??B,se?.stop)return Y}let W={...o,user:O.payload.user,conversation:O.payload.conversation,message:B,event:O},Q=a.messageHandlers[B.type]??[];for(let q of Q)await q(W);let ae=a.hookHandlers.after_incoming_message[B.type]??[];for(let q of ae){let se=await q({...o,data:B});if(B=se?.data??B,se?.stop)return Y}return Y}if(e.type==="state_expired"){let B=l.event.payload.state,U={...o,state:B},W=a.stateExpiredHandlers["*"]??[];for(let Q of W)await Q(U);return Y}let d=l.event,f=a.hookHandlers.before_incoming_event[d.type]??[];for(let O of f){let B=await O({...o,data:d});if(d=B?.data??d,B?.stop)return Y}let g={...o,event:d},h=a.eventHandlers[d.type]??[];for(let O of h)await O(g);let x=a.hookHandlers.after_incoming_event[d.type]??[];for(let O of x){let B=await O({...o,data:d});if(d=B?.data??d,B?.stop)return Y}return Y},Fm=async({ctx:t,logger:e,req:r,client:n,self:s})=>{let{input:a,type:o}=oe(r);if(!o)throw new Error("Missing action type");let l=s.hookHandlers.before_incoming_call_action[o]??[];for(let x of l){let O=await x({ctx:t,logger:e,client:n,data:{type:o,input:a},...Se({client:n})});a=O?.data?.input??a,o=O?.data?.type??o}let d=s.actionHandlers[o];if(!d)throw new Error(`Action ${o} not found`);let f=await d({ctx:t,logger:e,input:a,client:n,type:o,...Se({client:n})}),g=s.hookHandlers.after_incoming_call_action[o]??[];for(let x of g){let O=await x({ctx:t,logger:e,client:n,data:{type:o,output:f},...Se({client:n})});o=O?.data?.type??o,f=O?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}},Se=t=>({workflows:yt(t.client)});var wn=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._actionHandlers[r];if(n)return n;for(let s of Object.values(this._plugins))if(n=s.actionHandlers[r],n)return n}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(l=>l.messageHandlers[r]??[]),s=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[],o=[...s,...a].sort((l,d)=>l.order-d.order).map(({handler:l})=>l);return S.unique([...n,...o])}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(l=>l.eventHandlers[r]??[]),s=this._eventHandlers[r]??[],a=this._eventHandlers["*"]??[],o=[...s,...a].sort((l,d)=>l.order-d.order).map(({handler:l})=>l);return S.unique([...n,...o])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(l=>l.stateExpiredHandlers[r]??[]),s=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[],o=[...s,...a].sort((l,d)=>l.order-d.order).map(({handler:l})=>l);return S.unique([...n,...o])}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{if(this._hookHandlers[r])return new Proxy({},{get:(s,a)=>{let o=Object.values(this._plugins).flatMap(h=>h.hookHandlers[r]?.[a]??[]),l=this._hookHandlers[r]??{},d=l[a]??[],f=l["*"]??[],g=[...d,...f].sort((h,x)=>h.order-x.order).map(({handler:h})=>h);return S.unique([...o,...g])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(s,a)=>{let o=n[a]?.sort((d,f)=>d.order-f.order).map(({handler:d})=>d)??[],l=Object.values(this._plugins).flatMap(d=>d.workflowHandlers[r]?.[a]??[]);return S.unique([...o,...l])}})}})}on={message:(e,r)=>{this._messageHandlers[e]=S.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=S.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=S.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=S.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=S.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=S.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=S.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},beforeIncomingCallAction:(e,r)=>{this._hookHandlers.before_incoming_call_action[e]=S.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=S.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=S.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=S.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=S.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingCallAction:(e,r)=>{this._hookHandlers.after_incoming_call_action[e]=S.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=S.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=S.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=S.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};handler=Qd(this);start=e=>Vt(this.handler,e)};var Pn=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes;let r=this._getEntityReference(this.entities),n=e.events===void 0?{}:M.mapValues(e.events,o=>({...o,schema:o.schema(r)})),s=e.actions===void 0?{}:M.mapValues(e.actions,o=>({...o,input:{...o.input,schema:o.input.schema(r)},output:{...o.output,schema:o.output.schema(r)}})),a=e.channels===void 0?{}:M.mapValues(e.channels,o=>({...o,messages:M.mapValues(o.messages,l=>({...l,schema:l.schema(r)}))}));this.events=n,this.actions=s,this.channels=a}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let r={};for(let[n,s]of Object.entries(e)){let a=s.schema._def["x-zui"]?.title,o=s.schema._def.description,l=Id.ref(n);a&&l.title(a),o&&l.describe(o),r[n]=l}return r}};var xn=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};var Ks=":";var eu=t=>{let[e,r]=t.split(Ks);return!e||!r?null:{namespace:e,eventName:r}},tu=t=>`${t.namespace}${Ks}${t.actionName}`,ru=t=>`${t.namespace}${Ks}${t.eventName}`,nu=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,s=r.actions[t.actionName]?.name??t.actionName;return{namespace:n,actionName:s}},su=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,s=r.events[t.eventName]?.name??t.eventName;return{namespace:n,eventName:s}};var au=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(s,a)=>o=>zm({client:t,interfaces:e.interfaces,integrationOrInterfaceName:n,methodName:a,input:o})})}),zm=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:s})=>{let a=nu({namespace:r,actionName:n},e),o=tu(a);return(await t.callAction({type:o,input:s})).output};var Us=class{constructor(e,r,n){this._client=e;this._stateType=r;this._stateName=n}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(r=>r.state.payload)}async set(e,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:r})}async getOrSet(e,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:r}).then(n=>n.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,r){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:r})}},iu=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(s,a)=>{let o=e.alias!==void 0?`${e.alias}${_n}${a}`:a;return new Us(t,n,o)}})});var kn=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:r,interfaces:n,alias:s}=this._runtime,a=au(e,this._runtime),o=iu(e,this._runtime),l=yt(e);return{configuration:r,interfaces:n,actions:a,states:o,alias:s,workflows:l}}get actionHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._actionHandlers[r];if(n)return me.setName(s=>n({...s,...this._getTools(s.client)}),n.name)}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._messageHandlers[r]??[],s=this._messageHandlers["*"]??[];return S.unique([...n,...s]).sort((o,l)=>o.order-l.order).map(({handler:o})=>me.setName(l=>o({...l,...this._getTools(l.client)}),o.name))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._eventHandlers[r]??[],s=Object.entries(this._eventHandlers).filter(([l])=>this._eventResolvesTo(l,r)).flatMap(([,l])=>l??[]),a=this._eventHandlers["*"]??[];return S.unique([...n,...s,...a]).sort((l,d)=>l.order-d.order).map(({handler:l})=>me.setName(d=>l({...d,...this._getTools(d.client)}),l.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._stateExpiredHandlers[r]??[],s=this._stateExpiredHandlers["*"]??[];return S.unique([...n,...s]).sort((o,l)=>o.order-l.order).map(({handler:o})=>me.setName(l=>o({...l,...this._getTools(l.client)}),o.name))}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._hookHandlers[r];if(n)return new Proxy({},{get:(s,a)=>{a=this._stripAliasPrefix(a);let o=n[a]??[],l=Object.entries(n).filter(([g])=>this._eventResolvesTo(g,a)).flatMap(([,g])=>g??[]),d=n["*"]??[];return S.unique([...o,...l,...d]).sort((g,h)=>g.order-h.order).map(({handler:g})=>me.setName(h=>g({...h,...this._getTools(h.client)}),g.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(s,a)=>(n[a]?.sort((l,d)=>l.order-d.order)??[]).map(({handler:l})=>me.setName(d=>l({...d,...this._getTools(d.client)}),l.name))})}})}on={message:(e,r)=>{this._messageHandlers[e]=S.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=S.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=S.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=S.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=S.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=S.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=S.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},beforeIncomingCallAction:(e,r)=>{this._hookHandlers.before_incoming_call_action[e]=S.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=S.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=S.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=S.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=S.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingCallAction:(e,r)=>{this._hookHandlers.after_incoming_call_action[e]=S.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=S.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=S.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=S.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};_eventResolvesTo=(e,r)=>{let n=eu(e);if(!n)return!1;let s=su(n,this._runtime.interfaces);return ru(s)===r};_stripAliasPrefix=e=>{let{alias:r}=this._runtime;if(!r)return e;let n=`${r}:`;return e.startsWith(n)?e.slice(n.length):e}};0&&(module.exports={BRAND,Bot,BotDefinition,BotLogger,BotSpecificClient,DIRTY,EMPTY_PATH,INVALID,Integration,IntegrationDefinition,IntegrationLogger,IntegrationSpecificClient,InterfaceDefinition,NEVER,OK,ParseInputLazyPath,ParseStatus,Plugin,PluginDefinition,RuntimeError,Schema,WELL_KNOWN_ATTRIBUTES,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,ZodFirstPartyTypeKind,ZodFunction,ZodIntersection,ZodIssueCode,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodRef,ZodSchema,ZodSet,ZodString,ZodSymbol,ZodTransformer,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,addIssueToContext,agent,aimodel,any,array,bigint,boolean,botIdHeader,botUserIdHeader,coerce,configurationHeader,configurationTypeHeader,conversation,createZodEnum,cuid2Regex,cuidRegex,custom,datasource,date,discriminatedUnion,effect,emailRegex,enum:null,errorUtil,event,function:null,getErrorMap,getParsedType,instanceof:null,integrationIdHeader,intent,intersection,ipv4Regex,ipv6Regex,isAborted,isApiError,isAsync,isDirty,isEmojiRegex,isValid,knowledgebase,late,lazy,literal,makeIssue,map,mergeObjectSchemas,message,messages,nan,nativeEnum,never,null:null,nullable,number,object,objectUtil,oboolean,onumber,operationHeader,optional,ostring,parseBody,pipeline,preprocess,processCreateParams,promise,quotelessJson,readonly,record,ref,serve,set,setErrorMap,strictObject,string,symbol,table,tablerow,transformer,transforms,tuple,typeHeader,ulidRegex,undefined,union,unknown,user,util,uuidRegex,variable,void:null,webhookIdHeader,z});
|
|
90
68
|
/*! Bundled license information:
|
|
91
69
|
|
|
92
|
-
react/cjs/react.production.min.js:
|
|
93
|
-
(**
|
|
94
|
-
* @license React
|
|
95
|
-
* react.production.min.js
|
|
96
|
-
*
|
|
97
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
98
|
-
*
|
|
99
|
-
* This source code is licensed under the MIT license found in the
|
|
100
|
-
* LICENSE file in the root directory of this source tree.
|
|
101
|
-
*)
|
|
102
|
-
|
|
103
|
-
react/cjs/react.development.js:
|
|
104
|
-
(**
|
|
105
|
-
* @license React
|
|
106
|
-
* react.development.js
|
|
107
|
-
*
|
|
108
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the MIT license found in the
|
|
111
|
-
* LICENSE file in the root directory of this source tree.
|
|
112
|
-
*)
|
|
113
|
-
|
|
114
70
|
@bpinternal/zui/dist/index.js:
|
|
115
71
|
(*! Bundled license information:
|
|
116
72
|
|