@botpress/sdk 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,44 +1,44 @@
1
- "use strict";var pg=Object.create;var Mr=Object.defineProperty;var gg=Object.getOwnPropertyDescriptor;var mg=Object.getOwnPropertyNames;var hg=Object.getPrototypeOf,yg=Object.prototype.hasOwnProperty;var Ha=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),er=(t,e)=>{for(var r in e)Mr(t,r,{get:e[r],enumerable:!0})},zi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of mg(e))!yg.call(t,a)&&a!==r&&Mr(t,a,{get:()=>e[a],enumerable:!(n=gg(e,a))||n.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?pg(hg(t)):{},zi(e||!t||!t.__esModule?Mr(r,"default",{value:t,enumerable:!0}):r,t)),vg=t=>zi(Mr({},"__esModule",{value:!0}),t);var no=Ha(j=>{"use strict";var tr=Symbol.for("react.element"),_g=Symbol.for("react.portal"),Tg=Symbol.for("react.fragment"),bg=Symbol.for("react.strict_mode"),wg=Symbol.for("react.profiler"),kg=Symbol.for("react.provider"),Pg=Symbol.for("react.context"),Eg=Symbol.for("react.forward_ref"),xg=Symbol.for("react.suspense"),Sg=Symbol.for("react.memo"),Og=Symbol.for("react.lazy"),Wi=Symbol.iterator;function Cg(t){return t===null||typeof t!="object"?null:(t=Wi&&t[Wi]||t["@@iterator"],typeof t=="function"?t:null)}var Gi={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ji=Object.assign,Yi={};function xt(t,e,r){this.props=t,this.context=e,this.refs=Yi,this.updater=r||Gi}xt.prototype.isReactComponent={};xt.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")};xt.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Xi(){}Xi.prototype=xt.prototype;function ja(t,e,r){this.props=t,this.context=e,this.refs=Yi,this.updater=r||Gi}var $a=ja.prototype=new Xi;$a.constructor=ja;Ji($a,xt.prototype);$a.isPureReactComponent=!0;var Vi=Array.isArray,Qi=Object.prototype.hasOwnProperty,Ua={current:null},eo={key:!0,ref:!0,__self:!0,__source:!0};function to(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)Qi.call(e,n)&&!eo.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 Bg(t,e){return{$$typeof:tr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Fa(t){return typeof t=="object"&&t!==null&&t.$$typeof===tr}function Ig(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var qi=/\/+/g;function Na(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Ig(""+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 _g:i=!0}}if(i)return i=t,a=a(i),t=n===""?"."+Na(i,0):n,Vi(a)?(r="",t!=null&&(r=t.replace(qi,"$&/")+"/"),Nr(a,e,r,"",function(p){return p})):a!=null&&(Fa(a)&&(a=Bg(a,r+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(qi,"$&/")+"/")+t)),e.push(a)),1;if(i=0,n=n===""?".":n+":",Vi(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=Cg(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 Hr(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 Zg(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},Rg={ReactCurrentDispatcher:ye,ReactCurrentBatchConfig:jr,ReactCurrentOwner:Ua};function ro(){throw Error("act(...) is not supported in production builds of React.")}j.Children={map:Hr,forEach:function(t,e,r){Hr(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Hr(t,function(){e++}),e},toArray:function(t){return Hr(t,function(e){return e})||[]},only:function(t){if(!Fa(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};j.Component=xt;j.Fragment=Tg;j.Profiler=wg;j.PureComponent=ja;j.StrictMode=bg;j.Suspense=xg;j.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rg;j.act=ro;j.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=Ji({},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)Qi.call(e,c)&&!eo.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}};j.createContext=function(t){return t={$$typeof:Pg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:kg,_context:t},t.Consumer=t};j.createElement=to;j.createFactory=function(t){var e=to.bind(null,t);return e.type=t,e};j.createRef=function(){return{current:null}};j.forwardRef=function(t){return{$$typeof:Eg,render:t}};j.isValidElement=Fa;j.lazy=function(t){return{$$typeof:Og,_payload:{_status:-1,_result:t},_init:Zg}};j.memo=function(t,e){return{$$typeof:Sg,type:t,compare:e===void 0?null:e}};j.startTransition=function(t){var e=jr.transition;jr.transition={};try{t()}finally{jr.transition=e}};j.unstable_act=ro;j.useCallback=function(t,e){return ye.current.useCallback(t,e)};j.useContext=function(t){return ye.current.useContext(t)};j.useDebugValue=function(){};j.useDeferredValue=function(t){return ye.current.useDeferredValue(t)};j.useEffect=function(t,e){return ye.current.useEffect(t,e)};j.useId=function(){return ye.current.useId()};j.useImperativeHandle=function(t,e,r){return ye.current.useImperativeHandle(t,e,r)};j.useInsertionEffect=function(t,e){return ye.current.useInsertionEffect(t,e)};j.useLayoutEffect=function(t,e){return ye.current.useLayoutEffect(t,e)};j.useMemo=function(t,e){return ye.current.useMemo(t,e)};j.useReducer=function(t,e,r){return ye.current.useReducer(t,e,r)};j.useRef=function(t){return ye.current.useRef(t)};j.useState=function(t){return ye.current.useState(t)};j.useSyncExternalStore=function(t,e,r){return ye.current.useSyncExternalStore(t,e,r)};j.useTransition=function(){return ye.current.useTransition()};j.version="18.3.1"});var ao=Ha(($,$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"),h=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),P=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},N={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},L={current:null},ue={},Ke=null;function tt(u){Ke=u}ue.setExtraStackFrame=function(u){Ke=u},ue.getCurrentStack=null,ue.getStackAddendum=function(){var u="";Ke&&(u+=Ke);var f=ue.getCurrentStack;return f&&(u+=f()||""),u};var Ce=!1,we=!1,va=!1,_a=!1,ke=!1,Te={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:L};Te.ReactDebugCurrentFrame=ue,Te.ReactCurrentActQueue=N;function Pe(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Be("warn",u,g)}}function H(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Be("error",u,g)}}function Be(u,f,g){{var y=Te.ReactDebugCurrentFrame,T=y.getStackAddendum();T!==""&&(f+="%s",g=g.concat([T]));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",T=y+"."+f;if(Oe[T])return;H("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[T]=!0}}var ii={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")}},Re=Object.assign,Ta={};Object.freeze(Ta);function rt(u,f,g){this.props=u,this.context=f,this.refs=Ta,this.updater=g||ii}rt.prototype.isReactComponent={},rt.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")},rt.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)."]},ip=function(u,f){Object.defineProperty(rt.prototype,u,{get:function(){Pe("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var wa in ba)ba.hasOwnProperty(wa)&&ip(wa,ba[wa])}function oi(){}oi.prototype=rt.prototype;function ka(u,f,g){this.props=u,this.context=f,this.refs=Ta,this.updater=g||ii}var Pa=ka.prototype=new oi;Pa.constructor=ka,Re(Pa,rt.prototype),Pa.isPureReactComponent=!0;function op(){var u={current:null};return Object.seal(u),u}var lp=Array.isArray;function Er(u){return lp(u)}function up(u){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&u[Symbol.toStringTag]||u.constructor.name||"Object";return g}}function cp(u){try{return li(u),!1}catch{return!0}}function li(u){return""+u}function xr(u){if(cp(u))return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",up(u)),li(u)}function dp(u,f,g){var y=u.displayName;if(y)return y;var T=f.displayName||f.name||"";return T!==""?g+"("+T+")":g}function ui(u){return u.displayName||"Context"}function We(u){if(u==null)return null;if(typeof u.tag=="number"&&H("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 h:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case o:var f=u;return ui(f)+".Consumer";case i:var g=u;return ui(g._context)+".Provider";case c:return dp(u,u.render,"ForwardRef");case b:var y=u.displayName||null;return y!==null?y:We(u.type)||"Memo";case I:{var T=u,B=T._payload,x=T._init;try{return We(x(B))}catch{return null}}}return null}var Yt=Object.prototype.hasOwnProperty,ci={key:!0,ref:!0,__self:!0,__source:!0},di,fi,Ea;Ea={};function pi(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 gi(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 fp(u,f){var g=function(){di||(di=!0,H("%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 pp(u,f){var g=function(){fi||(fi=!0,H("%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 gp(u){if(typeof u.ref=="string"&&L.current&&u.__self&&L.current.stateNode!==u.__self){var f=We(L.current.type);Ea[f]||(H('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,T,B,x){var A={$$typeof:e,type:u,key:f,ref:g,props:x,_owner:B};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function mp(u,f,g){var y,T={},B=null,x=null,A=null,K=null;if(f!=null){pi(f)&&(x=f.ref,gp(f)),gi(f)&&(xr(f.key),B=""+f.key),A=f.__self===void 0?null:f.__self,K=f.__source===void 0?null:f.__source;for(y in f)Yt.call(f,y)&&!ci.hasOwnProperty(y)&&(T[y]=f[y])}var Y=arguments.length-2;if(Y===1)T.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),T.children=Q}if(u&&u.defaultProps){var ne=u.defaultProps;for(y in ne)T[y]===void 0&&(T[y]=ne[y])}if(B||x){var oe=typeof u=="function"?u.displayName||u.name||"Unknown":u;B&&fp(T,oe),x&&pp(T,oe)}return xa(u,B,x,A,K,L.current,T)}function hp(u,f){var g=xa(u.type,f,u.ref,u._self,u._source,u._owner,u.props);return g}function yp(u,f,g){if(u==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+u+".");var y,T=Re({},u.props),B=u.key,x=u.ref,A=u._self,K=u._source,Y=u._owner;if(f!=null){pi(f)&&(x=f.ref,Y=L.current),gi(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)&&!ci.hasOwnProperty(y)&&(f[y]===void 0&&Q!==void 0?T[y]=Q[y]:T[y]=f[y])}var ee=arguments.length-2;if(ee===1)T.children=g;else if(ee>1){for(var ne=Array(ee),oe=0;oe<ee;oe++)ne[oe]=arguments[oe+2];T.children=ne}return xa(u.type,B,x,A,K,Y,T)}function kt(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}var mi=".",vp=":";function _p(u){var f=/[=:]/g,g={"=":"=0",":":"=2"},y=u.replace(f,function(T){return g[T]});return"$"+y}var hi=!1,Tp=/\/+/g;function yi(u){return u.replace(Tp,"$&/")}function Sa(u,f){return typeof u=="object"&&u!==null&&u.key!=null?(xr(u.key),_p(""+u.key)):f.toString(36)}function Sr(u,f,g,y,T){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 A=u,K=T(A),Y=y===""?mi+Sa(A,0):y;if(Er(K)){var Q="";Y!=null&&(Q=yi(Y)+"/"),Sr(K,f,Q,"",function(fg){return fg})}else K!=null&&(kt(K)&&(K.key&&(!A||A.key!==K.key)&&xr(K.key),K=hp(K,g+(K.key&&(!A||A.key!==K.key)?yi(""+K.key)+"/":"")+Y)),f.push(K));return 1}var ee,ne,oe=0,de=y===""?mi:y+vp;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,T);else{var Ma=q(u);if(typeof Ma=="function"){var Fi=u;Ma===Fi.entries&&(hi||Pe("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),hi=!0);for(var cg=Ma.call(Fi),Li,dg=0;!(Li=cg.next()).done;)ee=Li.value,ne=de+Sa(ee,dg++),oe+=Sr(ee,f,g,ne,T)}else if(B==="object"){var Ki=String(u);throw new Error("Objects are not valid as a React child (found: "+(Ki==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":Ki)+"). 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=[],T=0;return Sr(u,y,"","",function(B){return f.call(g,B,T++)}),y}function bp(u){var f=0;return Or(u,function(){f++}),f}function wp(u,f,g){Or(u,function(){f.apply(this,arguments)},g)}function kp(u){return Or(u,function(f){return f})||[]}function Pp(u){if(!kt(u))throw new Error("React.Children.only expected to receive a single React element child.");return u}function Ep(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,T=!1;{var B={$$typeof:o,_context:f};Object.defineProperties(B,{Provider:{get:function(){return y||(y=!0,H("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,H("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){T||(Pe("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",x),T=!0)}}}),f.Consumer=B}return f._currentRenderer=null,f._currentRenderer2=null,f}var Xt=-1,Oa=0,vi=1,xp=2;function Sp(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=vi,x._result=B}},function(B){if(u._status===Oa||u._status===Xt){var x=u;x._status=xp,x._result=B}}),u._status===Xt){var y=u;y._status=Oa,y._result=g}}if(u._status===vi){var T=u._result;return T===void 0&&H(`lazy: Expected the result of a dynamic import() call. Instead received: %s
1
+ "use strict";var fg=Object.create;var Mr=Object.defineProperty;var pg=Object.getOwnPropertyDescriptor;var gg=Object.getOwnPropertyNames;var hg=Object.getPrototypeOf,mg=Object.prototype.hasOwnProperty;var Ma=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),er=(t,e)=>{for(var r in e)Mr(t,r,{get:e[r],enumerable:!0})},Li=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gg(e))!mg.call(t,a)&&a!==r&&Mr(t,a,{get:()=>e[a],enumerable:!(n=pg(e,a))||n.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?fg(hg(t)):{},Li(e||!t||!t.__esModule?Mr(r,"default",{value:t,enumerable:!0}):r,t)),yg=t=>Li(Mr({},"__esModule",{value:!0}),t);var ro=Ma($=>{"use strict";var tr=Symbol.for("react.element"),vg=Symbol.for("react.portal"),_g=Symbol.for("react.fragment"),Tg=Symbol.for("react.strict_mode"),bg=Symbol.for("react.profiler"),wg=Symbol.for("react.provider"),Pg=Symbol.for("react.context"),kg=Symbol.for("react.forward_ref"),Eg=Symbol.for("react.suspense"),xg=Symbol.for("react.memo"),Sg=Symbol.for("react.lazy"),zi=Symbol.iterator;function Og(t){return t===null||typeof t!="object"?null:(t=zi&&t[zi]||t["@@iterator"],typeof t=="function"?t:null)}var qi={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Gi=Object.assign,Ji={};function xt(t,e,r){this.props=t,this.context=e,this.refs=Ji,this.updater=r||qi}xt.prototype.isReactComponent={};xt.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")};xt.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Yi(){}Yi.prototype=xt.prototype;function ja(t,e,r){this.props=t,this.context=e,this.refs=Ji,this.updater=r||qi}var Na=ja.prototype=new Yi;Na.constructor=ja;Gi(Na,xt.prototype);Na.isPureReactComponent=!0;var Wi=Array.isArray,Xi=Object.prototype.hasOwnProperty,$a={current:null},Qi={key:!0,ref:!0,__self:!0,__source:!0};function eo(t,e,r){var n,a={},s=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Xi.call(e,n)&&!Qi.hasOwnProperty(n)&&(a[n]=e[n]);var i=arguments.length-2;if(i===1)a.children=r;else if(1<i){for(var c=Array(i),p=0;p<i;p++)c[p]=arguments[p+2];a.children=c}if(t&&t.defaultProps)for(n in i=t.defaultProps,i)a[n]===void 0&&(a[n]=i[n]);return{$$typeof:tr,type:t,key:s,ref:o,props:a,_owner:$a.current}}function Cg(t,e){return{$$typeof:tr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ua(t){return typeof t=="object"&&t!==null&&t.$$typeof===tr}function Ig(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Vi=/\/+/g;function Ha(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Ig(""+t.key):e.toString(36)}function jr(t,e,r,n,a){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case tr:case vg:o=!0}}if(o)return o=t,a=a(o),t=n===""?"."+Ha(o,0):n,Wi(a)?(r="",t!=null&&(r=t.replace(Vi,"$&/")+"/"),jr(a,e,r,"",function(p){return p})):a!=null&&(Ua(a)&&(a=Cg(a,r+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(Vi,"$&/")+"/")+t)),e.push(a)),1;if(o=0,n=n===""?".":n+":",Wi(t))for(var i=0;i<t.length;i++){s=t[i];var c=n+Ha(s,i);o+=jr(s,e,r,c,a)}else if(c=Og(t),typeof c=="function")for(t=c.call(t),i=0;!(s=t.next()).done;)s=s.value,c=n+Ha(s,i++),o+=jr(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 o}function Hr(t,e,r){if(t==null)return t;var n=[],a=0;return jr(t,n,"","",function(s){return e.call(r,s,a++)}),n}function Bg(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},Nr={transition:null},Zg={ReactCurrentDispatcher:ye,ReactCurrentBatchConfig:Nr,ReactCurrentOwner:$a};function to(){throw Error("act(...) is not supported in production builds of React.")}$.Children={map:Hr,forEach:function(t,e,r){Hr(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Hr(t,function(){e++}),e},toArray:function(t){return Hr(t,function(e){return e})||[]},only:function(t){if(!Ua(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};$.Component=xt;$.Fragment=_g;$.Profiler=bg;$.PureComponent=ja;$.StrictMode=Tg;$.Suspense=Eg;$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zg;$.act=to;$.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=Gi({},t.props),a=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=$a.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var i=t.type.defaultProps;for(c in e)Xi.call(e,c)&&!Qi.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&i!==void 0?i[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){i=Array(c);for(var p=0;p<c;p++)i[p]=arguments[p+2];n.children=i}return{$$typeof:tr,type:t.type,key:a,ref:s,props:n,_owner:o}};$.createContext=function(t){return t={$$typeof:Pg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:wg,_context:t},t.Consumer=t};$.createElement=eo;$.createFactory=function(t){var e=eo.bind(null,t);return e.type=t,e};$.createRef=function(){return{current:null}};$.forwardRef=function(t){return{$$typeof:kg,render:t}};$.isValidElement=Ua;$.lazy=function(t){return{$$typeof:Sg,_payload:{_status:-1,_result:t},_init:Bg}};$.memo=function(t,e){return{$$typeof:xg,type:t,compare:e===void 0?null:e}};$.startTransition=function(t){var e=Nr.transition;Nr.transition={};try{t()}finally{Nr.transition=e}};$.unstable_act=to;$.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 no=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"),o=Symbol.for("react.provider"),i=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"),C=Symbol.for("react.lazy"),k=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},N={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},F={current:null},ue={},Le=null;function tt(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,ya=!1,va=!1,Pe=!1,Te={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:F};Te.ReactDebugCurrentFrame=ue,Te.ReactCurrentActQueue=N;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 j(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;j("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 si={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")}},Re=Object.assign,_a={};Object.freeze(_a);function rt(u,f,g){this.props=u,this.context=f,this.refs=_a,this.updater=g||si}rt.prototype.isReactComponent={},rt.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")},rt.prototype.forceUpdate=function(u){this.updater.enqueueForceUpdate(this,u,"forceUpdate")};{var Ta={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)."]},sp=function(u,f){Object.defineProperty(rt.prototype,u,{get:function(){ke("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var ba in Ta)Ta.hasOwnProperty(ba)&&sp(ba,Ta[ba])}function ii(){}ii.prototype=rt.prototype;function wa(u,f,g){this.props=u,this.context=f,this.refs=_a,this.updater=g||si}var Pa=wa.prototype=new ii;Pa.constructor=wa,Re(Pa,rt.prototype),Pa.isPureReactComponent=!0;function ip(){var u={current:null};return Object.seal(u),u}var op=Array.isArray;function Er(u){return op(u)}function lp(u){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&u[Symbol.toStringTag]||u.constructor.name||"Object";return g}}function up(u){try{return oi(u),!1}catch{return!0}}function oi(u){return""+u}function xr(u){if(up(u))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",lp(u)),oi(u)}function cp(u,f,g){var y=u.displayName;if(y)return y;var b=f.displayName||f.name||"";return b!==""?g+"("+b+")":g}function li(u){return u.displayName||"Context"}function We(u){if(u==null)return null;if(typeof u.tag=="number"&&j("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 i:var f=u;return li(f)+".Consumer";case o:var g=u;return li(g._context)+".Provider";case c:return cp(u,u.render,"ForwardRef");case T:var y=u.displayName||null;return y!==null?y:We(u.type)||"Memo";case C:{var b=u,B=b._payload,x=b._init;try{return We(x(B))}catch{return null}}}return null}var Yt=Object.prototype.hasOwnProperty,ui={key:!0,ref:!0,__self:!0,__source:!0},ci,di,ka;ka={};function fi(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 pi(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 dp(u,f){var g=function(){ci||(ci=!0,j("%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 fp(u,f){var g=function(){di||(di=!0,j("%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 pp(u){if(typeof u.ref=="string"&&F.current&&u.__self&&F.current.stateNode!==u.__self){var f=We(F.current.type);ka[f]||(j('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),ka[f]=!0)}}var Ea=function(u,f,g,y,b,B,x){var A={$$typeof:e,type:u,key:f,ref:g,props:x,_owner:B};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function gp(u,f,g){var y,b={},B=null,x=null,A=null,L=null;if(f!=null){fi(f)&&(x=f.ref,pp(f)),pi(f)&&(xr(f.key),B=""+f.key),A=f.__self===void 0?null:f.__self,L=f.__source===void 0?null:f.__source;for(y in f)Yt.call(f,y)&&!ui.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&&dp(b,oe),x&&fp(b,oe)}return Ea(u,B,x,A,L,F.current,b)}function hp(u,f){var g=Ea(u.type,f,u.ref,u._self,u._source,u._owner,u.props);return g}function mp(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=Re({},u.props),B=u.key,x=u.ref,A=u._self,L=u._source,Y=u._owner;if(f!=null){fi(f)&&(x=f.ref,Y=F.current),pi(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)&&!ui.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 Ea(u.type,B,x,A,L,Y,b)}function Pt(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}var gi=".",yp=":";function vp(u){var f=/[=:]/g,g={"=":"=0",":":"=2"},y=u.replace(f,function(b){return g[b]});return"$"+y}var hi=!1,_p=/\/+/g;function mi(u){return u.replace(_p,"$&/")}function xa(u,f){return typeof u=="object"&&u!==null&&u.key!=null?(xr(u.key),vp(""+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 A=u,L=b(A),Y=y===""?gi+xa(A,0):y;if(Er(L)){var Q="";Y!=null&&(Q=mi(Y)+"/"),Sr(L,f,Q,"",function(dg){return dg})}else L!=null&&(Pt(L)&&(L.key&&(!A||A.key!==L.key)&&xr(L.key),L=hp(L,g+(L.key&&(!A||A.key!==L.key)?mi(""+L.key)+"/":"")+Y)),f.push(L));return 1}var ee,ne,oe=0,de=y===""?gi:y+yp;if(Er(u))for(var Dr=0;Dr<u.length;Dr++)ee=u[Dr],ne=de+xa(ee,Dr),oe+=Sr(ee,f,g,ne,b);else{var Da=q(u);if(typeof Da=="function"){var Ui=u;Da===Ui.entries&&(hi||ke("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),hi=!0);for(var ug=Da.call(Ui),Ki,cg=0;!(Ki=ug.next()).done;)ee=Ki.value,ne=de+xa(ee,cg++),oe+=Sr(ee,f,g,ne,b)}else if(B==="object"){var Fi=String(u);throw new Error("Objects are not valid as a React child (found: "+(Fi==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":Fi)+"). 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 Tp(u){var f=0;return Or(u,function(){f++}),f}function bp(u,f,g){Or(u,function(){f.apply(this,arguments)},g)}function wp(u){return Or(u,function(f){return f})||[]}function Pp(u){if(!Pt(u))throw new Error("React.Children.only expected to receive a single React element child.");return u}function kp(u){var f={$$typeof:i,_currentValue:u,_currentValue2:u,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};f.Provider={$$typeof:o,_context:f};var g=!1,y=!1,b=!1;{var B={$$typeof:i,_context:f};Object.defineProperties(B,{Provider:{get:function(){return y||(y=!0,j("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,j("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,Sa=0,yi=1,Ep=2;function xp(u){if(u._status===Xt){var f=u._result,g=f();if(g.then(function(B){if(u._status===Sa||u._status===Xt){var x=u;x._status=yi,x._result=B}},function(B){if(u._status===Sa||u._status===Xt){var x=u;x._status=Ep,x._result=B}}),u._status===Xt){var y=u;y._status=Sa,y._result=g}}if(u._status===yi){var b=u._result;return b===void 0&&j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
2
 
3
3
  Your code should look like:
4
4
  const MyComponent = lazy(() => import('./MyComponent'))
5
5
 
6
- Did you accidentally put curly braces around the import?`,T),"default"in T||H(`lazy: Expected the result of a dynamic import() call. Instead received: %s
6
+ Did you accidentally put curly braces around the import?`,b),"default"in b||j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
7
 
8
8
  Your code should look like:
9
- const MyComponent = lazy(() => import('./MyComponent'))`,T),T.default}else throw u._result}function Op(u){var f={_status:Xt,_result:u},g={$$typeof:I,_payload:f,_init:Sp};{var y,T;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return y},set:function(B){H("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 T},set:function(B){H("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."),T=B,Object.defineProperty(g,"propTypes",{enumerable:!0})}}})}return g}function Cp(u){u!=null&&u.$$typeof===b?H("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof u!="function"?H("forwardRef requires a render function but was given %s.",u===null?"null":typeof u):u.length!==0&&u.length!==2&&H("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)&&H("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 _i;_i=Symbol.for("react.module.reference");function Ti(u){return!!(typeof u=="string"||typeof u=="function"||u===n||u===s||ke||u===a||u===p||u===h||_a||u===P||Ce||we||va||typeof u=="object"&&u!==null&&(u.$$typeof===I||u.$$typeof===b||u.$$typeof===i||u.$$typeof===o||u.$$typeof===c||u.$$typeof===_i||u.getModuleId!==void 0))}function Bp(u,f){Ti(u)||H("memo: The first argument must be a component. Instead received: %s",u===null?"null":typeof u);var g={$$typeof:b,type:u,compare:f===void 0?null:f};{var y;Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return y},set:function(T){y=T,!u.name&&!u.displayName&&(u.displayName=T)}})}return g}function he(){var u=re.current;return u===null&&H(`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:
9
+ const MyComponent = lazy(() => import('./MyComponent'))`,b),b.default}else throw u._result}function Sp(u){var f={_status:Xt,_result:u},g={$$typeof:C,_payload:f,_init:xp};{var y,b;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return y},set:function(B){j("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){j("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 Op(u){u!=null&&u.$$typeof===T?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof u!="function"?j("forwardRef requires a render function but was given %s.",u===null?"null":typeof u):u.length!==0&&u.length!==2&&j("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)&&j("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 vi;vi=Symbol.for("react.module.reference");function _i(u){return!!(typeof u=="string"||typeof u=="function"||u===n||u===s||Pe||u===a||u===p||u===m||va||u===k||Ce||we||ya||typeof u=="object"&&u!==null&&(u.$$typeof===C||u.$$typeof===T||u.$$typeof===o||u.$$typeof===i||u.$$typeof===c||u.$$typeof===vi||u.getModuleId!==void 0))}function Cp(u,f){_i(u)||j("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&&j(`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
10
  1. You might have mismatching versions of React and the renderer (such as React DOM)
11
11
  2. You might be breaking the Rules of Hooks
12
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 Ip(u){var f=he();if(u._context!==void 0){var g=u._context;g.Consumer===u?H("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&&H("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(u)}function Zp(u){var f=he();return f.useState(u)}function Rp(u,f,g){var y=he();return y.useReducer(u,f,g)}function Ap(u){var f=he();return f.useRef(u)}function Dp(u,f){var g=he();return g.useEffect(u,f)}function Mp(u,f){var g=he();return g.useInsertionEffect(u,f)}function Hp(u,f){var g=he();return g.useLayoutEffect(u,f)}function Np(u,f){var g=he();return g.useCallback(u,f)}function jp(u,f){var g=he();return g.useMemo(u,f)}function $p(u,f,g){var y=he();return y.useImperativeHandle(u,f,g)}function Up(u,f){{var g=he();return g.useDebugValue(u,f)}}function Fp(){var u=he();return u.useTransition()}function Lp(u){var f=he();return f.useDeferredValue(u)}function Kp(){var u=he();return u.useId()}function zp(u,f,g){var y=he();return y.useSyncExternalStore(u,f,g)}var Qt=0,bi,wi,ki,Pi,Ei,xi,Si;function Oi(){}Oi.__reactDisabledLog=!0;function Wp(){{if(Qt===0){bi=console.log,wi=console.info,ki=console.warn,Pi=console.error,Ei=console.group,xi=console.groupCollapsed,Si=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Oi,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Qt++}}function Vp(){{if(Qt--,Qt===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Re({},u,{value:bi}),info:Re({},u,{value:wi}),warn:Re({},u,{value:ki}),error:Re({},u,{value:Pi}),group:Re({},u,{value:Ei}),groupCollapsed:Re({},u,{value:xi}),groupEnd:Re({},u,{value:Si})})}Qt<0&&H("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ca=Te.ReactCurrentDispatcher,Ba;function Cr(u,f,g){{if(Ba===void 0)try{throw Error()}catch(T){var y=T.stack.trim().match(/\n( *(at )?)/);Ba=y&&y[1]||""}return`
14
- `+Ba+u}}var Ia=!1,Br;{var qp=typeof WeakMap=="function"?WeakMap:Map;Br=new qp}function Ci(u,f){if(!u||Ia)return"";{var g=Br.get(u);if(g!==void 0)return g}var y;Ia=!0;var T=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=Ca.current,Ca.current=null,Wp();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 A=de.stack.split(`
15
- `),K=y.stack.split(`
16
- `),Y=A.length-1,Q=K.length-1;Y>=1&&Q>=0&&A[Y]!==K[Q];)Q--;for(;Y>=1&&Q>=0;Y--,Q--)if(A[Y]!==K[Q]){if(Y!==1||Q!==1)do if(Y--,Q--,Q<0||A[Y]!==K[Q]){var ee=`
17
- `+A[Y].replace(" at new "," at ");return u.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",u.displayName)),typeof u=="function"&&Br.set(u,ee),ee}while(Y>=1&&Q>=0);break}}}finally{Ia=!1,Ca.current=B,Vp(),Error.prepareStackTrace=T}var ne=u?u.displayName||u.name:"",oe=ne?Cr(ne):"";return typeof u=="function"&&Br.set(u,oe),oe}function Gp(u,f,g){return Ci(u,!1)}function Jp(u){var f=u.prototype;return!!(f&&f.isReactComponent)}function Ir(u,f,g){if(u==null)return"";if(typeof u=="function")return Ci(u,Jp(u));if(typeof u=="string")return Cr(u);switch(u){case p:return Cr("Suspense");case h:return Cr("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return Gp(u.render);case b:return Ir(u.type,f,g);case I:{var y=u,T=y._payload,B=y._init;try{return Ir(B(T),f,g)}catch{}}}return""}var Bi={},Ii=Te.ReactDebugCurrentFrame;function Zr(u){if(u){var f=u._owner,g=Ir(u.type,u._source,f?f.type:null);Ii.setExtraStackFrame(g)}else Ii.setExtraStackFrame(null)}function Yp(u,f,g,y,T){{var B=Function.call.bind(Yt);for(var x in u)if(B(u,x)){var A=void 0;try{if(typeof u[x]!="function"){var K=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 K.name="Invariant Violation",K}A=u[x](f,x,y,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){A=Y}A&&!(A instanceof Error)&&(Zr(T),H("%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 A),Zr(null)),A instanceof Error&&!(A.message in Bi)&&(Bi[A.message]=!0,Zr(T),H("Failed %s type: %s",g,A.message),Zr(null))}}}function Pt(u){if(u){var f=u._owner,g=Ir(u.type,u._source,f?f.type:null);tt(g)}else tt(null)}var Za;Za=!1;function Zi(){if(L.current){var u=We(L.current.type);if(u)return`
13
+ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),u}function Ip(u){var f=me();if(u._context!==void 0){var g=u._context;g.Consumer===u?j("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&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(u)}function Bp(u){var f=me();return f.useState(u)}function Zp(u,f,g){var y=me();return y.useReducer(u,f,g)}function Rp(u){var f=me();return f.useRef(u)}function Ap(u,f){var g=me();return g.useEffect(u,f)}function Dp(u,f){var g=me();return g.useInsertionEffect(u,f)}function Mp(u,f){var g=me();return g.useLayoutEffect(u,f)}function Hp(u,f){var g=me();return g.useCallback(u,f)}function jp(u,f){var g=me();return g.useMemo(u,f)}function Np(u,f,g){var y=me();return y.useImperativeHandle(u,f,g)}function $p(u,f){{var g=me();return g.useDebugValue(u,f)}}function Up(){var u=me();return u.useTransition()}function Kp(u){var f=me();return f.useDeferredValue(u)}function Fp(){var u=me();return u.useId()}function Lp(u,f,g){var y=me();return y.useSyncExternalStore(u,f,g)}var Qt=0,Ti,bi,wi,Pi,ki,Ei,xi;function Si(){}Si.__reactDisabledLog=!0;function zp(){{if(Qt===0){Ti=console.log,bi=console.info,wi=console.warn,Pi=console.error,ki=console.group,Ei=console.groupCollapsed,xi=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Si,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Qt++}}function Wp(){{if(Qt--,Qt===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Re({},u,{value:Ti}),info:Re({},u,{value:bi}),warn:Re({},u,{value:wi}),error:Re({},u,{value:Pi}),group:Re({},u,{value:ki}),groupCollapsed:Re({},u,{value:Ei}),groupEnd:Re({},u,{value:xi})})}Qt<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Oa=Te.ReactCurrentDispatcher,Ca;function Cr(u,f,g){{if(Ca===void 0)try{throw Error()}catch(b){var y=b.stack.trim().match(/\n( *(at )?)/);Ca=y&&y[1]||""}return`
14
+ `+Ca+u}}var Ia=!1,Ir;{var Vp=typeof WeakMap=="function"?WeakMap:Map;Ir=new Vp}function Oi(u,f){if(!u||Ia)return"";{var g=Ir.get(u);if(g!==void 0)return g}var y;Ia=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=Oa.current,Oa.current=null,zp();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 A=de.stack.split(`
15
+ `),L=y.stack.split(`
16
+ `),Y=A.length-1,Q=L.length-1;Y>=1&&Q>=0&&A[Y]!==L[Q];)Q--;for(;Y>=1&&Q>=0;Y--,Q--)if(A[Y]!==L[Q]){if(Y!==1||Q!==1)do if(Y--,Q--,Q<0||A[Y]!==L[Q]){var ee=`
17
+ `+A[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{Ia=!1,Oa.current=B,Wp(),Error.prepareStackTrace=b}var ne=u?u.displayName||u.name:"",oe=ne?Cr(ne):"";return typeof u=="function"&&Ir.set(u,oe),oe}function qp(u,f,g){return Oi(u,!1)}function Gp(u){var f=u.prototype;return!!(f&&f.isReactComponent)}function Br(u,f,g){if(u==null)return"";if(typeof u=="function")return Oi(u,Gp(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 qp(u.render);case T:return Br(u.type,f,g);case C:{var y=u,b=y._payload,B=y._init;try{return Br(B(b),f,g)}catch{}}}return""}var Ci={},Ii=Te.ReactDebugCurrentFrame;function Zr(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);Ii.setExtraStackFrame(g)}else Ii.setExtraStackFrame(null)}function Jp(u,f,g,y,b){{var B=Function.call.bind(Yt);for(var x in u)if(B(u,x)){var A=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}A=u[x](f,x,y,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){A=Y}A&&!(A instanceof Error)&&(Zr(b),j("%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 A),Zr(null)),A instanceof Error&&!(A.message in Ci)&&(Ci[A.message]=!0,Zr(b),j("Failed %s type: %s",g,A.message),Zr(null))}}}function kt(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);tt(g)}else tt(null)}var Ba;Ba=!1;function Bi(){if(F.current){var u=We(F.current.type);if(u)return`
18
18
 
19
- Check the render method of \``+u+"`."}return""}function Xp(u){if(u!==void 0){var f=u.fileName.replace(/^.*[\\\/]/,""),g=u.lineNumber;return`
19
+ Check the render method of \``+u+"`."}return""}function Yp(u){if(u!==void 0){var f=u.fileName.replace(/^.*[\\\/]/,""),g=u.lineNumber;return`
20
20
 
21
- Check your code at `+f+":"+g+"."}return""}function Qp(u){return u!=null?Xp(u.__source):""}var Ri={};function eg(u){var f=Zi();if(!f){var g=typeof u=="string"?u:u.displayName||u.name;g&&(f=`
21
+ Check your code at `+f+":"+g+"."}return""}function Xp(u){return u!=null?Yp(u.__source):""}var Zi={};function Qp(u){var f=Bi();if(!f){var g=typeof u=="string"?u:u.displayName||u.name;g&&(f=`
22
22
 
23
- Check the top-level render call using <`+g+">.")}return f}function Ai(u,f){if(!(!u._store||u._store.validated||u.key!=null)){u._store.validated=!0;var g=eg(f);if(!Ri[g]){Ri[g]=!0;var y="";u&&u._owner&&u._owner!==L.current&&(y=" It was passed a child from "+We(u._owner.type)+"."),Pt(u),H('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),Pt(null)}}}function Di(u,f){if(typeof u=="object"){if(Er(u))for(var g=0;g<u.length;g++){var y=u[g];kt(y)&&Ai(y,f)}else if(kt(u))u._store&&(u._store.validated=!0);else if(u){var T=q(u);if(typeof T=="function"&&T!==u.entries)for(var B=T.call(u),x;!(x=B.next()).done;)kt(x.value)&&Ai(x.value,f)}}}function Mi(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===b))g=f.propTypes;else return;if(g){var y=We(f);Yp(g,u.props,"prop",y,u)}else if(f.PropTypes!==void 0&&!Za){Za=!0;var T=We(f);H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function tg(u){{for(var f=Object.keys(u.props),g=0;g<f.length;g++){var y=f[g];if(y!=="children"&&y!=="key"){Pt(u),H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),Pt(null);break}}u.ref!==null&&(Pt(u),H("Invalid attribute `ref` supplied to `React.Fragment`."),Pt(null))}}function Hi(u,f,g){var y=Ti(u);if(!y){var T="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(T+=" 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=Qp(f);B?T+=B:T+=Zi();var x;u===null?x="null":Er(u)?x="array":u!==void 0&&u.$$typeof===e?(x="<"+(We(u.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):x=typeof u,H("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,T)}var A=mp.apply(this,arguments);if(A==null)return A;if(y)for(var K=2;K<arguments.length;K++)Di(arguments[K],u);return u===n?tg(A):Mi(A),A}var Ni=!1;function rg(u){var f=Hi.bind(null,u);return f.type=u,Ni||(Ni=!0,Pe("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 Pe("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:u}),u}}),f}function ng(u,f,g){for(var y=yp.apply(this,arguments),T=2;T<arguments.length;T++)Di(arguments[T],y.type);return Mi(y),y}function ag(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 T=y._updatedFibers.size;T>10&&Pe("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 ji=!1,Rr=null;function sg(u){if(Rr===null)try{var f=("require"+Math.random()).slice(0,7),g=$r&&$r[f];Rr=g.call($r,"timers").setImmediate}catch{Rr=function(T){ji===!1&&(ji=!0,typeof MessageChannel>"u"&&H("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=T,B.port2.postMessage(void 0)}}return Rr(u)}var Et=0,$i=!1;function Ui(u){{var f=Et;Et++,N.current===null&&(N.current=[]);var g=N.isBatchingLegacy,y;try{if(N.isBatchingLegacy=!0,y=u(),!g&&N.didScheduleLegacyUpdate){var T=N.current;T!==null&&(N.didScheduleLegacyUpdate=!1,Da(T))}}catch(ne){throw Ar(f),ne}finally{N.isBatchingLegacy=g}if(y!==null&&typeof y=="object"&&typeof y.then=="function"){var B=y,x=!1,A={then:function(ne,oe){x=!0,B.then(function(de){Ar(f),Et===0?Ra(de,ne,oe):ne(de)},function(de){Ar(f),oe(de)})}};return!$i&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){x||($i=!0,H("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 () => ...);"))}),A}else{var K=y;if(Ar(f),Et===0){var Y=N.current;Y!==null&&(Da(Y),N.current=null);var Q={then:function(ne,oe){N.current===null?(N.current=[],Ra(K,ne,oe)):ne(K)}};return Q}else{var ee={then:function(ne,oe){ne(K)}};return ee}}}}function Ar(u){u!==Et-1&&H("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Et=u}function Ra(u,f,g){{var y=N.current;if(y!==null)try{Da(y),sg(function(){y.length===0?(N.current=null,f(u)):Ra(u,f,g)})}catch(T){g(T)}else f(u)}}var Aa=!1;function Da(u){if(!Aa){Aa=!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{Aa=!1}}}var ig=Hi,og=ng,lg=rg,ug={map:Or,forEach:wp,count:bp,toArray:kp,only:Pp};$.Children=ug,$.Component=rt,$.Fragment=n,$.Profiler=s,$.PureComponent=ka,$.StrictMode=a,$.Suspense=p,$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Te,$.act=Ui,$.cloneElement=og,$.createContext=Ep,$.createElement=ig,$.createFactory=lg,$.createRef=op,$.forwardRef=Cp,$.isValidElement=kt,$.lazy=Op,$.memo=Bp,$.startTransition=ag,$.unstable_act=Ui,$.useCallback=Np,$.useContext=Ip,$.useDebugValue=Up,$.useDeferredValue=Lp,$.useEffect=Dp,$.useId=Kp,$.useImperativeHandle=$p,$.useInsertionEffect=Mp,$.useLayoutEffect=Hp,$.useMemo=jp,$.useReducer=Rp,$.useRef=Ap,$.useState=Zp,$.useSyncExternalStore=zp,$.useTransition=Fp,$.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var St=Ha((_T,La)=>{"use strict";process.env.NODE_ENV==="production"?La.exports=no():La.exports=ao()});var hT={};er(hT,{BRAND:()=>Rc,Bot:()=>pa,BotDefinition:()=>da,BotLogger:()=>Xe,BotSpecificClient:()=>Ze,DIRTY:()=>ut,EMPTY_PATH:()=>Sc,ErrorBoundary:()=>Dt,INVALID:()=>C,Integration:()=>ca,IntegrationDefinition:()=>oa,IntegrationLogger:()=>Ye,IntegrationSpecificClient:()=>Vt,InterfaceDefinition:()=>ga,NEVER:()=>xf,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Plugin:()=>ha,PluginDefinition:()=>ma,RuntimeError:()=>ya.RuntimeError,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>jt,ZodBigInt:()=>Kn,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>hr,ZodDiscriminatedUnion:()=>Ss,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>ks,ZodFunction:()=>Cs,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Bs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>Ne,ZodParsedType:()=>k,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Zs,ZodRef:()=>Rs,ZodSchema:()=>D,ZodSet:()=>As,ZodString:()=>ge,ZodSymbol:()=>Ls,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Ks,ZuiForm:()=>C_,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Md,any:()=>Vd,array:()=>Yd,bigint:()=>Fd,boolean:()=>Js,botIdHeader:()=>br,botUserIdHeader:()=>Qs,coerce:()=>Ef,configurationHeader:()=>wr,configurationTypeHeader:()=>ri,conversation:()=>Od,createZodEnum:()=>yr,cuid2Regex:()=>Ms,cuidRegex:()=>Ds,custom:()=>xs,datasource:()=>Hd,date:()=>Ld,datetimeRegex:()=>Fs,defaultComponentDefinitions:()=>B_,discriminatedUnion:()=>tf,effect:()=>fs,emailRegex:()=>js,enum:()=>pf,errorUtil:()=>O,event:()=>Zd,fromJsonSchema:()=>kf,fromObject:()=>Pf,function:()=>cf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>$d,integrationIdHeader:()=>ei,intent:()=>Dd,intersection:()=>rf,ipv4Regex:()=>$s,ipv6Regex:()=>Us,isAborted:()=>rn,isApiError:()=>ya.isApiError,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Jc,isValid:()=>Nt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Nd,late:()=>jd,lazy:()=>df,literal:()=>ff,makeIssue:()=>fr,map:()=>lf,mergeObjectSchemas:()=>zt,message:()=>Bd,messages:()=>Xs,nan:()=>Ud,nativeEnum:()=>gf,never:()=>Gd,null:()=>Wd,nullable:()=>yf,number:()=>Gs,object:()=>Xd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>wf,onumber:()=>bf,operationHeader:()=>kr,optional:()=>hf,ostring:()=>Tf,parseBody:()=>Se,pipeline:()=>_f,preprocess:()=>vf,processCreateParams:()=>R,promise:()=>mf,quotelessJson:()=>Pc,readonly:()=>of,record:()=>af,ref:()=>sf,serve:()=>Pr,set:()=>uf,setErrorMap:()=>Es,strictObject:()=>Qd,string:()=>qs,symbol:()=>Kd,table:()=>Rd,tablerow:()=>Ad,transformer:()=>fs,transforms:()=>I_,tuple:()=>nf,typeHeader:()=>ni,ulidRegex:()=>Hs,undefined:()=>zd,union:()=>ef,unknown:()=>qd,user:()=>Cd,util:()=>M,uuidRegex:()=>Ns,variable:()=>Sd,void:()=>Jd,webhookIdHeader:()=>ti,withErrorBoundary:()=>Bf,z:()=>E,zuiToJsonSchema:()=>aa});module.exports=vg(hT);var Xs={};er(Xs,{defaults:()=>M_,markdown:()=>D_});var Mn=nt(St(),1),ae=nt(St(),1),je=nt(St(),1),Ft=nt(St(),1),be=nt(St(),1),ps=Object.defineProperty,Ag=Object.defineProperties,Dg=Object.getOwnPropertyDescriptors,Yr=Object.getOwnPropertySymbols,$o=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,so=(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={}))$o.call(e,r)&&so(t,r,e[r]);if(Yr)for(var r of Yr(e))Uo.call(e,r)&&so(t,r,e[r]);return t},m=(t,e)=>Ag(t,Dg(e)),l=(t,e)=>ps(t,"name",{value:e,configurable:!0}),Fo=(t,e)=>{var r={};for(var n in t)$o.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&&Uo.call(t,n)&&(r[n]=t[n]);return r},Lo=(t,e)=>{for(var r in e)ps(t,r,{get:e[r],enumerable:!0})},E={};Lo(E,{BRAND:()=>Rc,DIRTY:()=>ut,EMPTY_PATH:()=>Sc,INVALID:()=>C,NEVER:()=>xf,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>jt,ZodBigInt:()=>Kn,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>hr,ZodDiscriminatedUnion:()=>Ss,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>ks,ZodFunction:()=>Cs,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Bs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>Ne,ZodParsedType:()=>k,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Zs,ZodRef:()=>Rs,ZodSchema:()=>D,ZodSet:()=>As,ZodString:()=>ge,ZodSymbol:()=>Ls,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Ks,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Md,any:()=>Vd,array:()=>Yd,bigint:()=>Fd,boolean:()=>Js,coerce:()=>Ef,conversation:()=>Od,createZodEnum:()=>yr,cuid2Regex:()=>Ms,cuidRegex:()=>Ds,custom:()=>xs,datasource:()=>Hd,date:()=>Ld,datetimeRegex:()=>Fs,default:()=>s_,discriminatedUnion:()=>tf,effect:()=>fs,emailRegex:()=>js,enum:()=>pf,errorUtil:()=>O,event:()=>Zd,fromJsonSchema:()=>kf,fromObject:()=>Pf,function:()=>cf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>$d,intent:()=>Dd,intersection:()=>rf,ipv4Regex:()=>$s,ipv6Regex:()=>Us,isAborted:()=>rn,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Jc,isValid:()=>Nt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Nd,late:()=>jd,lazy:()=>df,literal:()=>ff,makeIssue:()=>fr,map:()=>lf,message:()=>Bd,nan:()=>Ud,nativeEnum:()=>gf,never:()=>Gd,null:()=>Wd,nullable:()=>yf,number:()=>Gs,object:()=>Xd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>wf,onumber:()=>bf,optional:()=>hf,ostring:()=>Tf,pipeline:()=>_f,preprocess:()=>vf,processCreateParams:()=>R,promise:()=>mf,quotelessJson:()=>Pc,readonly:()=>of,record:()=>af,ref:()=>sf,set:()=>uf,setErrorMap:()=>Es,strictObject:()=>Qd,string:()=>qs,symbol:()=>Kd,table:()=>Rd,tablerow:()=>Ad,transformer:()=>fs,tuple:()=>nf,ulidRegex:()=>Hs,undefined:()=>zd,union:()=>ef,unknown:()=>qd,user:()=>Cd,util:()=>M,uuidRegex:()=>Ns,variable:()=>Sd,void:()=>Jd,zuiToJsonSchema:()=>aa});var F="x-zui",Ko=(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}}),io=l((t,e,r)=>{var n;let a=(n=e[F])==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"),zo=l((t,e)=>{let r=(0,ae.useContext)(Ko);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ae.useMemo)(()=>ot(r.formData,e),[r.formData,e]),a=(0,ae.useMemo)(()=>{var P;return r.validation.formValid===null?{formValid:null,formErrors:null}:r.validation.formValid===!1?{formValid:!1,formErrors:((P=r.validation.formErrors)==null?void 0:P.filter(S=>qo(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)(()=>io("hidden",t,s),[t,s]),o=(0,ae.useMemo)(()=>io("disabled",t,s),[t,s]);(0,ae.useEffect)(()=>{r.setHiddenState(P=>Ot(P,e,i||{})),r.setDisabledState(P=>Ot(P,e,o||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:c,hidden:p}=(0,ae.useMemo)(()=>{let P=i===!0||ot(r.hiddenState,e),S=o===!0||ot(r.disabledState,e);return{hidden:P===!0,disabled:S===!0}},[r.hiddenState,r.disabledState,i,o,e]),h=(0,ae.useCallback)((P,S)=>{r.setFormData(W=>Ot(W,P,S))},[r.setFormData]),b=(0,ae.useCallback)((P,S=void 0)=>{let W=Rt(t.items);r.setFormData(q=>{let re=ot(q,P)||[];return S===void 0&&(S=W),Ot(q,P,Array.isArray(re)?[...re,S]:[S])})},[r.setFormData]),I=(0,ae.useCallback)((P,S)=>{r.setFormData(W=>{let q=ot(W,P)||[];return Array.isArray(q)?(q.splice(S,1),Ot(W,P,q)):W})},[r.setFormData]);return d(m(d({},r),{data:n,disabled:c,hidden:p,handlePropertyChange:h,addArrayItem:b,removeArrayItem:I}),a)},"useFormData");function Ot(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(Ot,"setObjectPath");var Rt=l((t,e)=>{var r,n,a,s;if(Array.isArray(t))return Rt(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return Rt(t.anyOf[0]);if(t.type==="object"&&t.properties){let i={};return Object.entries(t.properties).map(([o,c])=>{var p;i[o]=Rt(c,!((p=t.required)!=null&&p.includes(o))||Wo(c)||!1)}),i}if(t.type==="array")return t.minItems&&t.minItems>0?[Rt(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"),Mg=l(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:i})=>{let[o,c]=(0,ae.useState)({}),[p,h]=(0,ae.useState)({}),b=i?i(r):r,I=(0,ae.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let P=Tr(n).safeParse(b);return P.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:P.error.issues}},[JSON.stringify({transformedData:b})]);return(0,ae.useEffect)(()=>{s&&s(I)},[I]),ae.default.createElement(Ko.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:I,hiddenState:o,setHiddenState:c,disabledState:p,setDisabledState:h,dataTransform:i}},t)},"FormDataProvider");function ot(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}l(ot,"getPathData");function Wo(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}l(Wo,"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 Hg=l((t,e)=>{let{handlePropertyChange:r,data:n}=zo(t,e),{discriminator:a,value:s,discriminatedSchema:i}=(0,Mn.useMemo)(()=>{let o=Vo(t.anyOf),c=o?.key?n?.[o.key]:t.default||null,p=Ng(o?.key||null,c,t.anyOf);return{discriminator:o,value:c,discriminatedSchema:p}},[t.anyOf,n]);return(0,Mn.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"),Vo=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"),Ng=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 m(d({},s),{properties:m(d({},s.properties),{[t]:m(d({},i),{[F]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),jg=l(t=>{var e;return(e=t.anyOf)!=null&&e.length?Vo(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),$g=l((t,e)=>{var r,n,a;let s=jg(e),i=((r=e[F])==null?void 0:r.displayAs)||null;if(!i||!Array.isArray(i)||i.length<2){let h=(n=t?.[s])==null?void 0:n.default;return h?{Component:h,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 qo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}l(qo,"pathMatches");function qa(t,e){return e||(e=new RegExp("/s|-|_| ","g")),Yo(t).split(e).map(Go).map(Xo).reduce(Jo)}l(qa,"formatTitle");function Go(t){return t.charAt(0).toUpperCase()+t.substring(1)}l(Go,"capitalize");function Jo(t,e){return`${t} ${e}`}l(Jo,"combine");function Yo(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(Yo,"decamelize");function Xo(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of zg)if(s.toLowerCase()===n)return s;return Ug.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:Kg.includes(n)||Lg.includes(n)||Fg.includes(n)?n:t}l(Xo,"handleSpecialWords");var Ug=["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"],Fg=["a","an","the"],Lg=["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"],Kg=["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"],zg=["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 Qo(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:He(t)}l(Qo,"primitiveToTypscriptLiteralType");function He(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${He(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}l(He,"primitiveToTypescriptValue");function el(t){return typeof t>"u"?"undefined":JSON.stringify(t)}l(el,"unknownToTypescriptValue");var oo=l(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:He(t),"toPropertyKey"),Wg=l(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),tl=l(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(Wg).filter(n=>!!n).join("")},"toTypeArgumentName"),Z=l(t=>{let e=(t??"").split(`
23
+ Check the top-level render call using <`+g+">.")}return f}function Ri(u,f){if(!(!u._store||u._store.validated||u.key!=null)){u._store.validated=!0;var g=Qp(f);if(!Zi[g]){Zi[g]=!0;var y="";u&&u._owner&&u._owner!==F.current&&(y=" It was passed a child from "+We(u._owner.type)+"."),kt(u),j('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),kt(null)}}}function Ai(u,f){if(typeof u=="object"){if(Er(u))for(var g=0;g<u.length;g++){var y=u[g];Pt(y)&&Ri(y,f)}else if(Pt(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;)Pt(x.value)&&Ri(x.value,f)}}}function Di(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);Jp(g,u.props,"prop",y,u)}else if(f.PropTypes!==void 0&&!Ba){Ba=!0;var b=We(f);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function eg(u){{for(var f=Object.keys(u.props),g=0;g<f.length;g++){var y=f[g];if(y!=="children"&&y!=="key"){kt(u),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),kt(null);break}}u.ref!==null&&(kt(u),j("Invalid attribute `ref` supplied to `React.Fragment`."),kt(null))}}function Mi(u,f,g){var y=_i(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=Xp(f);B?b+=B:b+=Bi();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,j("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 A=gp.apply(this,arguments);if(A==null)return A;if(y)for(var L=2;L<arguments.length;L++)Ai(arguments[L],u);return u===n?eg(A):Di(A),A}var Hi=!1;function tg(u){var f=Mi.bind(null,u);return f.type=u,Hi||(Hi=!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 rg(u,f,g){for(var y=mp.apply(this,arguments),b=2;b<arguments.length;b++)Ai(arguments[b],y.type);return Di(y),y}function ng(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 ji=!1,Rr=null;function ag(u){if(Rr===null)try{var f=("require"+Math.random()).slice(0,7),g=$r&&$r[f];Rr=g.call($r,"timers").setImmediate}catch{Rr=function(b){ji===!1&&(ji=!0,typeof MessageChannel>"u"&&j("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 Rr(u)}var Et=0,Ni=!1;function $i(u){{var f=Et;Et++,N.current===null&&(N.current=[]);var g=N.isBatchingLegacy,y;try{if(N.isBatchingLegacy=!0,y=u(),!g&&N.didScheduleLegacyUpdate){var b=N.current;b!==null&&(N.didScheduleLegacyUpdate=!1,Aa(b))}}catch(ne){throw Ar(f),ne}finally{N.isBatchingLegacy=g}if(y!==null&&typeof y=="object"&&typeof y.then=="function"){var B=y,x=!1,A={then:function(ne,oe){x=!0,B.then(function(de){Ar(f),Et===0?Za(de,ne,oe):ne(de)},function(de){Ar(f),oe(de)})}};return!Ni&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){x||(Ni=!0,j("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 () => ...);"))}),A}else{var L=y;if(Ar(f),Et===0){var Y=N.current;Y!==null&&(Aa(Y),N.current=null);var Q={then:function(ne,oe){N.current===null?(N.current=[],Za(L,ne,oe)):ne(L)}};return Q}else{var ee={then:function(ne,oe){ne(L)}};return ee}}}}function Ar(u){u!==Et-1&&j("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Et=u}function Za(u,f,g){{var y=N.current;if(y!==null)try{Aa(y),ag(function(){y.length===0?(N.current=null,f(u)):Za(u,f,g)})}catch(b){g(b)}else f(u)}}var Ra=!1;function Aa(u){if(!Ra){Ra=!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{Ra=!1}}}var sg=Mi,ig=rg,og=tg,lg={map:Or,forEach:bp,count:Tp,toArray:wp,only:Pp};U.Children=lg,U.Component=rt,U.Fragment=n,U.Profiler=s,U.PureComponent=wa,U.StrictMode=a,U.Suspense=p,U.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Te,U.act=$i,U.cloneElement=ig,U.createContext=kp,U.createElement=sg,U.createFactory=og,U.createRef=ip,U.forwardRef=Op,U.isValidElement=Pt,U.lazy=Sp,U.memo=Cp,U.startTransition=ng,U.unstable_act=$i,U.useCallback=Hp,U.useContext=Ip,U.useDebugValue=$p,U.useDeferredValue=Kp,U.useEffect=Ap,U.useId=Fp,U.useImperativeHandle=Np,U.useInsertionEffect=Dp,U.useLayoutEffect=Mp,U.useMemo=jp,U.useReducer=Zp,U.useRef=Rp,U.useState=Bp,U.useSyncExternalStore=Lp,U.useTransition=Up,U.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var St=Ma((vT,Ka)=>{"use strict";process.env.NODE_ENV==="production"?Ka.exports=ro():Ka.exports=no()});var hT={};er(hT,{BRAND:()=>Zc,Bot:()=>fa,BotDefinition:()=>da,BotLogger:()=>Xe,BotSpecificClient:()=>Ze,DIRTY:()=>ut,EMPTY_PATH:()=>xc,ErrorBoundary:()=>Dt,INVALID:()=>I,Integration:()=>ca,IntegrationDefinition:()=>oa,IntegrationLogger:()=>Ye,IntegrationSpecificClient:()=>Vt,InterfaceDefinition:()=>pa,NEVER:()=>Ef,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Plugin:()=>ha,PluginDefinition:()=>ga,RuntimeError:()=>ma.RuntimeError,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>Nt,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>xs,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>ws,ZodFunction:()=>Os,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Cs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>je,ZodParsedType:()=>P,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Bs,ZodRef:()=>Zs,ZodSchema:()=>D,ZodSet:()=>Rs,ZodString:()=>ge,ZodSymbol:()=>Ks,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Fs,ZuiForm:()=>O_,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Dd,any:()=>Wd,array:()=>Jd,bigint:()=>Ud,boolean:()=>Gs,botIdHeader:()=>br,botUserIdHeader:()=>Xs,coerce:()=>kf,configurationHeader:()=>wr,configurationTypeHeader:()=>ti,conversation:()=>Sd,createZodEnum:()=>yr,cuid2Regex:()=>Ds,cuidRegex:()=>As,custom:()=>Es,datasource:()=>Md,date:()=>Kd,datetimeRegex:()=>Us,defaultComponentDefinitions:()=>C_,discriminatedUnion:()=>ef,effect:()=>ds,emailRegex:()=>js,enum:()=>ff,errorUtil:()=>O,event:()=>Bd,fromJsonSchema:()=>wf,fromObject:()=>Pf,function:()=>uf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>Nd,integrationIdHeader:()=>Qs,intent:()=>Ad,intersection:()=>tf,ipv4Regex:()=>Ns,ipv6Regex:()=>$s,isAborted:()=>rn,isApiError:()=>ma.isApiError,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Gc,isValid:()=>jt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Hd,late:()=>jd,lazy:()=>cf,literal:()=>df,makeIssue:()=>fr,map:()=>of,mergeObjectSchemas:()=>zt,message:()=>Cd,messages:()=>Ys,nan:()=>$d,nativeEnum:()=>pf,never:()=>qd,null:()=>zd,nullable:()=>mf,number:()=>qs,object:()=>Yd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>bf,onumber:()=>Tf,operationHeader:()=>Pr,optional:()=>hf,ostring:()=>_f,parseBody:()=>Se,pipeline:()=>vf,preprocess:()=>yf,processCreateParams:()=>R,promise:()=>gf,quotelessJson:()=>Pc,readonly:()=>sf,record:()=>nf,ref:()=>af,serve:()=>kr,set:()=>lf,setErrorMap:()=>ks,strictObject:()=>Xd,string:()=>Vs,symbol:()=>Fd,table:()=>Zd,tablerow:()=>Rd,transformer:()=>ds,transforms:()=>I_,tuple:()=>rf,typeHeader:()=>ri,ulidRegex:()=>Ms,undefined:()=>Ld,union:()=>Qd,unknown:()=>Vd,user:()=>Od,util:()=>M,uuidRegex:()=>Hs,variable:()=>xd,void:()=>Gd,webhookIdHeader:()=>ei,withErrorBoundary:()=>Cf,z:()=>E,zuiToJsonSchema:()=>aa});module.exports=yg(hT);var Ys={};er(Ys,{defaults:()=>D_,markdown:()=>A_});var Mn=nt(St(),1),ae=nt(St(),1),Ne=nt(St(),1),Kt=nt(St(),1),be=nt(St(),1),fs=Object.defineProperty,Rg=Object.defineProperties,Ag=Object.getOwnPropertyDescriptors,Yr=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable,ao=(t,e,r)=>e in t?fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))No.call(e,r)&&ao(t,r,e[r]);if(Yr)for(var r of Yr(e))$o.call(e,r)&&ao(t,r,e[r]);return t},h=(t,e)=>Rg(t,Ag(e)),l=(t,e)=>fs(t,"name",{value:e,configurable:!0}),Uo=(t,e)=>{var r={};for(var n in t)No.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&&$o.call(t,n)&&(r[n]=t[n]);return r},Ko=(t,e)=>{for(var r in e)fs(t,r,{get:e[r],enumerable:!0})},E={};Ko(E,{BRAND:()=>Zc,DIRTY:()=>ut,EMPTY_PATH:()=>xc,INVALID:()=>I,NEVER:()=>Ef,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>Nt,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>xs,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>ws,ZodFunction:()=>Os,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Cs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>je,ZodParsedType:()=>P,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Bs,ZodRef:()=>Zs,ZodSchema:()=>D,ZodSet:()=>Rs,ZodString:()=>ge,ZodSymbol:()=>Ks,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Fs,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Dd,any:()=>Wd,array:()=>Jd,bigint:()=>Ud,boolean:()=>Gs,coerce:()=>kf,conversation:()=>Sd,createZodEnum:()=>yr,cuid2Regex:()=>Ds,cuidRegex:()=>As,custom:()=>Es,datasource:()=>Md,date:()=>Kd,datetimeRegex:()=>Us,default:()=>a_,discriminatedUnion:()=>ef,effect:()=>ds,emailRegex:()=>js,enum:()=>ff,errorUtil:()=>O,event:()=>Bd,fromJsonSchema:()=>wf,fromObject:()=>Pf,function:()=>uf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>Nd,intent:()=>Ad,intersection:()=>tf,ipv4Regex:()=>Ns,ipv6Regex:()=>$s,isAborted:()=>rn,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Gc,isValid:()=>jt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Hd,late:()=>jd,lazy:()=>cf,literal:()=>df,makeIssue:()=>fr,map:()=>of,message:()=>Cd,nan:()=>$d,nativeEnum:()=>pf,never:()=>qd,null:()=>zd,nullable:()=>mf,number:()=>qs,object:()=>Yd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>bf,onumber:()=>Tf,optional:()=>hf,ostring:()=>_f,pipeline:()=>vf,preprocess:()=>yf,processCreateParams:()=>R,promise:()=>gf,quotelessJson:()=>Pc,readonly:()=>sf,record:()=>nf,ref:()=>af,set:()=>lf,setErrorMap:()=>ks,strictObject:()=>Xd,string:()=>Vs,symbol:()=>Fd,table:()=>Zd,tablerow:()=>Rd,transformer:()=>ds,tuple:()=>rf,ulidRegex:()=>Ms,undefined:()=>Ld,union:()=>Qd,unknown:()=>Vd,user:()=>Od,util:()=>M,uuidRegex:()=>Hs,variable:()=>xd,void:()=>Gd,zuiToJsonSchema:()=>aa});var K="x-zui",Fo=(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}}),so=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 o=new Function("return "+a)()(r);switch(typeof o){case"object":case"boolean":return o;default:return!1}}return!1},"parseMaskableField"),Lo=l((t,e)=>{let r=(0,ae.useContext)(Fo);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ae.useMemo)(()=>ot(r.formData,e),[r.formData,e]),a=(0,ae.useMemo)(()=>{var k;return r.validation.formValid===null?{formValid:null,formErrors:null}:r.validation.formValid===!1?{formValid:!1,formErrors:((k=r.validation.formErrors)==null?void 0:k.filter(S=>Vo(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,o=(0,ae.useMemo)(()=>so("hidden",t,s),[t,s]),i=(0,ae.useMemo)(()=>so("disabled",t,s),[t,s]);(0,ae.useEffect)(()=>{r.setHiddenState(k=>Ot(k,e,o||{})),r.setDisabledState(k=>Ot(k,e,i||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:c,hidden:p}=(0,ae.useMemo)(()=>{let k=o===!0||ot(r.hiddenState,e),S=i===!0||ot(r.disabledState,e);return{hidden:k===!0,disabled:S===!0}},[r.hiddenState,r.disabledState,o,i,e]),m=(0,ae.useCallback)((k,S)=>{r.setFormData(W=>Ot(W,k,S))},[r.setFormData]),T=(0,ae.useCallback)((k,S=void 0)=>{let W=Rt(t.items);r.setFormData(q=>{let re=ot(q,k)||[];return S===void 0&&(S=W),Ot(q,k,Array.isArray(re)?[...re,S]:[S])})},[r.setFormData]),C=(0,ae.useCallback)((k,S)=>{r.setFormData(W=>{let q=ot(W,k)||[];return Array.isArray(q)?(q.splice(S,1),Ot(W,k,q)):W})},[r.setFormData]);return d(h(d({},r),{data:n,disabled:c,hidden:p,handlePropertyChange:m,addArrayItem:T,removeArrayItem:C}),a)},"useFormData");function Ot(t,e,r){if(e.length===0)return r;let n=e.length;return e.reduce((a,s,o)=>(o===n-1?a[s]=r:a[s]||(a[s]=isNaN(Number(s))?{}:[]),a[s]),t??{}),d({},t)}l(Ot,"setObjectPath");var Rt=l((t,e)=>{var r,n,a,s;if(Array.isArray(t))return Rt(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return Rt(t.anyOf[0]);if(t.type==="object"&&t.properties){let o={};return Object.entries(t.properties).map(([i,c])=>{var p;o[i]=Rt(c,!((p=t.required)!=null&&p.includes(i))||zo(c)||!1)}),o}if(t.type==="array")return t.minItems&&t.minItems>0?[Rt(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"),Dg=l(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:o})=>{let[i,c]=(0,ae.useState)({}),[p,m]=(0,ae.useState)({}),T=o?o(r):r,C=(0,ae.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let k=Tr(n).safeParse(T);return k.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:k.error.issues}},[JSON.stringify({transformedData:T})]);return(0,ae.useEffect)(()=>{s&&s(C)},[C]),ae.default.createElement(Fo.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:C,hiddenState:i,setHiddenState:c,disabledState:p,setDisabledState:m,dataTransform:o}},t)},"FormDataProvider");function ot(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}l(ot,"getPathData");function zo(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}l(zo,"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 Mg=l((t,e)=>{let{handlePropertyChange:r,data:n}=Lo(t,e),{discriminator:a,value:s,discriminatedSchema:o}=(0,Mn.useMemo)(()=>{let i=Wo(t.anyOf),c=i?.key?n?.[i.key]:t.default||null,p=Hg(i?.key||null,c,t.anyOf);return{discriminator:i,value:c,discriminatedSchema:p}},[t.anyOf,n]);return(0,Mn.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:o}},"useDiscriminator"),Wo=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"),Hg=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 o=(n=s.properties)==null?void 0:n[t];if(o?.type==="string"&&((a=o.enum)!=null&&a.length)&&o.enum[0]===e)return h(d({},s),{properties:h(d({},s.properties),{[t]:h(d({},o),{[K]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),jg=l(t=>{var e;return(e=t.anyOf)!=null&&e.length?Wo(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),Ng=l((t,e)=>{var r,n,a;let s=jg(e),o=((r=e[K])==null?void 0:r.displayAs)||null;if(!o||!Array.isArray(o)||o.length<2){let m=(n=t?.[s])==null?void 0:n.default;return m?{Component:m,type:s,id:"default",params:{}}:null}let i=o[0],c=((a=t?.[s])==null?void 0:a[i])||null;if(!c)return console.warn(`Component ${s}.${i} not found`),null;let p=o[1]||{};return{Component:c,type:s,id:i,params:p}},"resolveComponent");function Vo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}l(Vo,"pathMatches");function Va(t,e){return e||(e=new RegExp("/s|-|_| ","g")),Jo(t).split(e).map(qo).map(Yo).reduce(Go)}l(Va,"formatTitle");function qo(t){return t.charAt(0).toUpperCase()+t.substring(1)}l(qo,"capitalize");function Go(t,e){return`${t} ${e}`}l(Go,"combine");function Jo(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(Jo,"decamelize");function Yo(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of Lg)if(s.toLowerCase()===n)return s;return $g.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:Fg.includes(n)||Kg.includes(n)||Ug.includes(n)?n:t}l(Yo,"handleSpecialWords");var $g=["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"],Ug=["a","an","the"],Kg=["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"],Fg=["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"],Lg=["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 Xo(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:He(t)}l(Xo,"primitiveToTypscriptLiteralType");function He(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${He(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}l(He,"primitiveToTypescriptValue");function Qo(t){return typeof t>"u"?"undefined":JSON.stringify(t)}l(Qo,"unknownToTypescriptValue");var io=l(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:He(t),"toPropertyKey"),zg=l(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),el=l(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(zg).filter(n=>!!n).join("")},"toTypeArgumentName"),Z=l(t=>{let e=(t??"").split(`
24
24
  `).filter(r=>r.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
25
25
  * ${e.join(`
26
26
  * `)}
27
- */`},"getMultilineComment"),rl={};Lo(rl,{JsonSchemaToZuiError:()=>sl,ObjectToZuiError:()=>Ga,UnrepresentableGenericError:()=>Ja,UnsupportedZuiToJsonSchemaError:()=>Vg,UnsupportedZuiToTypescriptSchemaError:()=>st,UnsupportedZuiToTypescriptTypeError:()=>ml,UntitledDeclarationError:()=>yl,ZuiToJsonSchemaError:()=>ll,ZuiToTypescriptSchemaError:()=>dl,ZuiToTypescriptTypeError:()=>Hn,ZuiTransformError:()=>Lt});var nl=class extends Error{constructor(e,r){super(r),this.transform=e}};l(nl,"ZuiTransformError");var Lt=nl,al=class extends Lt{constructor(e){super("json-schema-to-zui",e)}};l(al,"JsonSchemaToZuiError");var sl=al,il=class extends Lt{constructor(e){super("object-to-zui",e)}};l(il,"ObjectToZuiError");var Ga=il,ol=class extends Lt{constructor(e){super("zui-to-json-schema",e)}};l(ol,"ZuiToJsonSchemaError");var ll=ol,ul=class extends ll{constructor(e){super(`Zod type ${e} cannot be transformed to JSON Schema.`)}};l(ul,"UnsupportedZuiToJsonSchemaError");var Vg=ul,cl=class extends Lt{constructor(e){super("zui-to-typescript-schema",e)}};l(cl,"ZuiToTypescriptSchemaError");var dl=cl,fl=class extends dl{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};l(fl,"UnsupportedZuiToTypescriptSchemaError");var st=fl,pl=class extends Lt{constructor(e){super("zui-to-typescript-type",e)}};l(pl,"ZuiToTypescriptTypeError");var Hn=pl,gl=class extends Hn{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};l(gl,"UnsupportedZuiToTypescriptTypeError");var ml=gl,hl=class extends Hn{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};l(hl,"UntitledDeclarationError");var yl=hl,vl=class extends Hn{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};l(vl,"UnrepresentableGenericError");var Ja=vl,_l=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],qg=l(t=>_l.includes(t),"isPrimitive"),Gg=l(t=>_l.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),lo=l(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Tl=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};l(Tl,"KeyValue");var Ur=Tl,bl=class{constructor(e){this.schema=e}};l(bl,"FnParameters");var uo=bl,wl=class{constructor(e){this.schema=e}};l(wl,"FnReturn");var co=wl,kl=class{constructor(e){this.props=e}};l(kl,"Declaration");var Lr=kl;function Qr(t,e={}){let r=Xg(t,e),n=z(r,{});return e.formatter&&(n=e.formatter(n)),n}l(Qr,"toTypescript");function z(t,e){var r,n,a;let s=m(d({},e),{parent:t});if(t===null)return"";if(t instanceof Lr)return Jg(t,s);if(t instanceof Ur){if(t.value instanceof v.ZodOptional){let P=t.value._def.innerType;return P instanceof v.Schema&&!P.description&&t.value.description&&(P=P?.describe(t.value.description)),z(new Ur(t.key,P,!0),s)}let c=Z(t.value._def.description),p=c?.trim().length>0?`
28
- `:"",h=t.value.describe(""),I=t.optional||t.value.isOptional()?"?":"";return`${p}${c}${p}${t.key}${I}: ${z(h,s)}${p}`}if(t instanceof uo){if(t.schema instanceof v.ZodTuple){let h="";for(let b=0;b<t.schema.items.length;b++){let I=(a=(n=(r=t.schema.items[b])==null?void 0:r.ui)==null?void 0:n.title)!=null?a:`arg${b}`,P=t.schema.items[b];h+=`${z(new Ur(oo(I),P),s)}${b<t.schema.items.length-1?", ":""} `}return h}let c=z(t.schema,s);return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||Gg(c)?`args: ${c}`:c}if(t instanceof co)return t.schema instanceof v.ZodOptional?`${z(t.schema.unwrap(),s)} | undefined`:z(t.schema,s);let o=t._def;switch(o.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(o.description)} string`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:case v.ZodFirstPartyTypeKind.ZodNaN:case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(o.description)} number`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)} boolean`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(o.description)} Date`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(o.description)} undefined`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(o.description)} null`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(o.description)} any`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(o.description)} unknown`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(o.description)} never`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(o.description)} void`.trim();case v.ZodFirstPartyTypeKind.ZodArray:let c=z(o.type,s);return qg(c)?`${c}[]`:`Array<${c}>`;case v.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(o.shape()).map(([N,L])=>z(new Ur(oo(N),L),s)).join("; ")} }`;case v.ZodFirstPartyTypeKind.ZodUnion:let h=o.options.map(N=>z(N,s));return`${Z(o.description)}
29
- ${h.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let b=o.options.map(N=>z(N,s));return`${Z(t._def.description)}
30
- ${b.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodIntersection:return`${z(o.left,s)} & ${z(o.right,s)}`;case v.ZodFirstPartyTypeKind.ZodTuple:return o.items.length===0?"":`[${o.items.map(N=>z(N,s)).join(", ")}]`;case v.ZodFirstPartyTypeKind.ZodRecord:let P=z(o.keyType,s),S=z(o.valueType,s);return`${Z(o.description)} { [key: ${P}]: ${S} }`;case v.ZodFirstPartyTypeKind.ZodMap:return`Map<${z(o.keyType,s)}, ${z(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodSet:return`Set<${z(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodFunction:let W=z(new uo(o.args),s),q=z(new co(o.returns),s);return`${Z(o.description)}
31
- (${W}) => ${q}`;case v.ZodFirstPartyTypeKind.ZodLazy:return z(o.getter(),s);case v.ZodFirstPartyTypeKind.ZodLiteral:let re=Qo(o.value);return`${Z(o.description)}
32
- ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(He).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return z(o.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new ml(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`${Z(o.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${z(o.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return tl(o.uri);default:M.assertNever(o)}}l(z,"sUnwrapZod");var Jg=l((t,e)=>{if(t.props.type==="none")return z(t.props.schema,e);let r=Z(t.props.schema.description),n=t.props.schema.describe(""),a=z(n,e);if(t.props.type==="variable")return lo(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(tl).join(", ")}>`:"";return lo(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Yg=l(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Xg=l((t,e)=>{let r=Yg(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new Ja;return new Lr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new yl;if(r==="variable"){if(n.length>0)throw new Ja;return new Lr({type:"variable",identifier:a,schema:t})}return new Lr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),Qg=typeof global=="object"&&global&&global.Object===Object&&global,Pl=Qg,em=typeof self=="object"&&self&&self.Object===Object&&self,tm=Pl||em||Function("return this")(),Ue=tm,rm=Ue.Symbol,Ve=rm,El=Object.prototype,nm=El.hasOwnProperty,am=El.toString,rr=Ve?Ve.toStringTag:void 0;function xl(t){var e=nm.call(t,rr),r=t[rr];try{t[rr]=void 0;var n=!0}catch{}var a=am.call(t);return n&&(e?t[rr]=r:delete t[rr]),a}l(xl,"getRawTag");var sm=xl,im=Object.prototype,om=im.toString;function Sl(t){return om.call(t)}l(Sl,"objectToString");var lm=Sl,um="[object Null]",cm="[object Undefined]",fo=Ve?Ve.toStringTag:void 0;function Ol(t){return t==null?t===void 0?cm:um:fo&&fo in Object(t)?sm(t):lm(t)}l(Ol,"baseGetTag");var Kt=Ol;function Cl(t){return t!=null&&typeof t=="object"}l(Cl,"isObjectLike");var Mt=Cl,dm="[object Symbol]";function Bl(t){return typeof t=="symbol"||Mt(t)&&Kt(t)==dm}l(Bl,"isSymbol");var gs=Bl;function Il(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(Il,"arrayMap");var fm=Il,pm=Array.isArray,$e=pm,gm=1/0,po=Ve?Ve.prototype:void 0,go=po?po.toString:void 0;function ms(t){if(typeof t=="string")return t;if($e(t))return fm(t,ms)+"";if(gs(t))return go?go.call(t):"";var e=t+"";return e=="0"&&1/t==-gm?"-0":e}l(ms,"baseToString");var mm=ms;function Zl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}l(Zl,"isObject");var hs=Zl;function Rl(t){return t}l(Rl,"identity");var hm=Rl,ym="[object AsyncFunction]",vm="[object Function]",_m="[object GeneratorFunction]",Tm="[object Proxy]";function Al(t){if(!hs(t))return!1;var e=Kt(t);return e==vm||e==_m||e==ym||e==Tm}l(Al,"isFunction");var Dl=Al,bm=Ue["__core-js_shared__"],Ka=bm,mo=function(){var t=/[^.]+$/.exec(Ka&&Ka.keys&&Ka.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ml(t){return!!mo&&mo in t}l(Ml,"isMasked");var wm=Ml,km=Function.prototype,Pm=km.toString;function Hl(t){if(t!=null){try{return Pm.call(t)}catch{}try{return t+""}catch{}}return""}l(Hl,"toSource");var gt=Hl,Em=/[\\^$.*+?()[\]{}|]/g,xm=/^\[object .+?Constructor\]$/,Sm=Function.prototype,Om=Object.prototype,Cm=Sm.toString,Bm=Om.hasOwnProperty,Im=RegExp("^"+Cm.call(Bm).replace(Em,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nl(t){if(!hs(t)||wm(t))return!1;var e=Dl(t)?Im:xm;return e.test(gt(t))}l(Nl,"baseIsNative");var Zm=Nl;function jl(t,e){return t?.[e]}l(jl,"getValue");var Rm=jl;function $l(t,e){var r=Rm(t,e);return Zm(r)?r:void 0}l($l,"getNative");var mt=$l,Am=mt(Ue,"WeakMap"),Ya=Am,Dm=function(){try{var t=mt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ho=Dm,Mm=9007199254740991,Hm=/^(?:0|[1-9]\d*)$/;function Ul(t,e){var r=typeof t;return e=e??Mm,!!e&&(r=="number"||r!="symbol"&&Hm.test(t))&&t>-1&&t%1==0&&t<e}l(Ul,"isIndex");var Fl=Ul;function Ll(t,e,r){e=="__proto__"&&ho?ho(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}l(Ll,"baseAssignValue");var Nm=Ll;function Kl(t,e){return t===e||t!==t&&e!==e}l(Kl,"eq");var zl=Kl,jm=9007199254740991;function Wl(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=jm}l(Wl,"isLength");var ys=Wl;function Vl(t){return t!=null&&ys(t.length)&&!Dl(t)}l(Vl,"isArrayLike");var $m=Vl,Um=Object.prototype;function ql(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Um;return t===r}l(ql,"isPrototype");var Fm=ql;function Gl(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}l(Gl,"baseTimes");var Lm=Gl,Km="[object Arguments]";function Jl(t){return Mt(t)&&Kt(t)==Km}l(Jl,"baseIsArguments");var yo=Jl,Yl=Object.prototype,zm=Yl.hasOwnProperty,Wm=Yl.propertyIsEnumerable,Vm=yo(function(){return arguments}())?yo:function(t){return Mt(t)&&zm.call(t,"callee")&&!Wm.call(t,"callee")},Xl=Vm;function Ql(){return!1}l(Ql,"stubFalse");var qm=Ql,eu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vo=eu&&typeof module=="object"&&module&&!module.nodeType&&module,Gm=vo&&vo.exports===eu,_o=Gm?Ue.Buffer:void 0,Jm=_o?_o.isBuffer:void 0,Ym=Jm||qm,Xa=Ym,Xm="[object Arguments]",Qm="[object Array]",eh="[object Boolean]",th="[object Date]",rh="[object Error]",nh="[object Function]",ah="[object Map]",sh="[object Number]",ih="[object Object]",oh="[object RegExp]",lh="[object Set]",uh="[object String]",ch="[object WeakMap]",dh="[object ArrayBuffer]",fh="[object DataView]",ph="[object Float32Array]",gh="[object Float64Array]",mh="[object Int8Array]",hh="[object Int16Array]",yh="[object Int32Array]",vh="[object Uint8Array]",_h="[object Uint8ClampedArray]",Th="[object Uint16Array]",bh="[object Uint32Array]",X={};X[ph]=X[gh]=X[mh]=X[hh]=X[yh]=X[vh]=X[_h]=X[Th]=X[bh]=!0;X[Xm]=X[Qm]=X[dh]=X[eh]=X[fh]=X[th]=X[rh]=X[nh]=X[ah]=X[sh]=X[ih]=X[oh]=X[lh]=X[uh]=X[ch]=!1;function tu(t){return Mt(t)&&ys(t.length)&&!!X[Kt(t)]}l(tu,"baseIsTypedArray");var wh=tu;function ru(t){return function(e){return t(e)}}l(ru,"baseUnary");var kh=ru,nu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lr=nu&&typeof module=="object"&&module&&!module.nodeType&&module,Ph=lr&&lr.exports===nu,za=Ph&&Pl.process,Eh=function(){try{var t=lr&&lr.require&&lr.require("util").types;return t||za&&za.binding&&za.binding("util")}catch{}}(),To=Eh,bo=To&&To.isTypedArray,xh=bo?kh(bo):wh,au=xh,Sh=Object.prototype,Oh=Sh.hasOwnProperty;function su(t,e){var r=$e(t),n=!r&&Xl(t),a=!r&&!n&&Xa(t),s=!r&&!n&&!a&&au(t),i=r||n||a||s,o=i?Lm(t.length,String):[],c=o.length;for(var p in t)(e||Oh.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Fl(p,c)))&&o.push(p);return o}l(su,"arrayLikeKeys");var Ch=su;function iu(t,e){return function(r){return t(e(r))}}l(iu,"overArg");var Bh=iu,Ih=Bh(Object.keys,Object),Zh=Ih,Rh=Object.prototype,Ah=Rh.hasOwnProperty;function ou(t){if(!Fm(t))return Zh(t);var e=[];for(var r in Object(t))Ah.call(t,r)&&r!="constructor"&&e.push(r);return e}l(ou,"baseKeys");var Dh=ou;function lu(t){return $m(t)?Ch(t):Dh(t)}l(lu,"keys");var vs=lu,Mh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hh=/^\w*$/;function uu(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||gs(t)?!0:Hh.test(t)||!Mh.test(t)||e!=null&&t in Object(e)}l(uu,"isKey");var _s=uu,Nh=mt(Object,"create"),ur=Nh;function cu(){this.__data__=ur?ur(null):{},this.size=0}l(cu,"hashClear");var jh=cu;function du(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}l(du,"hashDelete");var $h=du,Uh="__lodash_hash_undefined__",Fh=Object.prototype,Lh=Fh.hasOwnProperty;function fu(t){var e=this.__data__;if(ur){var r=e[t];return r===Uh?void 0:r}return Lh.call(e,t)?e[t]:void 0}l(fu,"hashGet");var Kh=fu,zh=Object.prototype,Wh=zh.hasOwnProperty;function pu(t){var e=this.__data__;return ur?e[t]!==void 0:Wh.call(e,t)}l(pu,"hashHas");var Vh=pu,qh="__lodash_hash_undefined__";function gu(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ur&&e===void 0?qh:e,this}l(gu,"hashSet");var Gh=gu;function ht(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(ht,"Hash");ht.prototype.clear=jh;ht.prototype.delete=$h;ht.prototype.get=Kh;ht.prototype.has=Vh;ht.prototype.set=Gh;var wo=ht;function mu(){this.__data__=[],this.size=0}l(mu,"listCacheClear");var Jh=mu;function hu(t,e){for(var r=t.length;r--;)if(zl(t[r][0],e))return r;return-1}l(hu,"assocIndexOf");var Nn=hu,Yh=Array.prototype,Xh=Yh.splice;function yu(t){var e=this.__data__,r=Nn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Xh.call(e,r,1),--this.size,!0}l(yu,"listCacheDelete");var Qh=yu;function vu(t){var e=this.__data__,r=Nn(e,t);return r<0?void 0:e[r][1]}l(vu,"listCacheGet");var ey=vu;function _u(t){return Nn(this.__data__,t)>-1}l(_u,"listCacheHas");var ty=_u;function Tu(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(Tu,"listCacheSet");var ry=Tu;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,"ListCache");yt.prototype.clear=Jh;yt.prototype.delete=Qh;yt.prototype.get=ey;yt.prototype.has=ty;yt.prototype.set=ry;var jn=yt,ny=mt(Ue,"Map"),cr=ny;function bu(){this.size=0,this.__data__={hash:new wo,map:new(cr||jn),string:new wo}}l(bu,"mapCacheClear");var ay=bu;function wu(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}l(wu,"isKeyable");var sy=wu;function ku(t,e){var r=t.__data__;return sy(e)?r[typeof e=="string"?"string":"hash"]:r.map}l(ku,"getMapData");var $n=ku;function Pu(t){var e=$n(this,t).delete(t);return this.size-=e?1:0,e}l(Pu,"mapCacheDelete");var iy=Pu;function Eu(t){return $n(this,t).get(t)}l(Eu,"mapCacheGet");var oy=Eu;function xu(t){return $n(this,t).has(t)}l(xu,"mapCacheHas");var ly=xu;function Su(t,e){var r=$n(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}l(Su,"mapCacheSet");var uy=Su;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,"MapCache");vt.prototype.clear=ay;vt.prototype.delete=iy;vt.prototype.get=oy;vt.prototype.has=ly;vt.prototype.set=uy;var Un=vt,cy="Expected a function";function Fn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(cy);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(Fn.Cache||Un),r}l(Fn,"memoize");Fn.Cache=Un;var dy=Fn,fy=500;function Ou(t){var e=dy(t,function(n){return r.size===fy&&r.clear(),n}),r=e.cache;return e}l(Ou,"memoizeCapped");var py=Ou,gy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,my=/\\(\\)?/g,hy=py(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(gy,function(r,n,a,s){e.push(a?s.replace(my,"$1"):n||r)}),e}),yy=hy;function Cu(t){return t==null?"":mm(t)}l(Cu,"toString");var vy=Cu;function Bu(t,e){return $e(t)?t:_s(t,e)?[t]:yy(vy(t))}l(Bu,"castPath");var Iu=Bu,_y=1/0;function Zu(t){if(typeof t=="string"||gs(t))return t;var e=t+"";return e=="0"&&1/t==-_y?"-0":e}l(Zu,"toKey");var Ln=Zu;function Ru(t,e){e=Iu(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ln(e[r++])];return r&&r==n?t:void 0}l(Ru,"baseGet");var Au=Ru;function Du(t,e,r){var n=t==null?void 0:Au(t,e);return n===void 0?r:n}l(Du,"get");var Ty=Du;function Mu(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}l(Mu,"arrayPush");var by=Mu;function Hu(){this.__data__=new jn,this.size=0}l(Hu,"stackClear");var wy=Hu;function Nu(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}l(Nu,"stackDelete");var ky=Nu;function ju(t){return this.__data__.get(t)}l(ju,"stackGet");var Py=ju;function $u(t){return this.__data__.has(t)}l($u,"stackHas");var Ey=$u,xy=200;function Uu(t,e){var r=this.__data__;if(r instanceof jn){var n=r.__data__;if(!cr||n.length<xy-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(Uu,"stackSet");var Sy=Uu;function _t(t){var e=this.__data__=new jn(t);this.size=e.size}l(_t,"Stack");_t.prototype.clear=wy;_t.prototype.delete=ky;_t.prototype.get=Py;_t.prototype.has=Ey;_t.prototype.set=Sy;var Kr=_t;function Fu(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(Fu,"arrayFilter");var Oy=Fu;function Lu(){return[]}l(Lu,"stubArray");var Cy=Lu,By=Object.prototype,Iy=By.propertyIsEnumerable,ko=Object.getOwnPropertySymbols,Zy=ko?function(t){return t==null?[]:(t=Object(t),Oy(ko(t),function(e){return Iy.call(t,e)}))}:Cy,Ry=Zy;function Ku(t,e,r){var n=e(t);return $e(t)?n:by(n,r(t))}l(Ku,"baseGetAllKeys");var Ay=Ku;function zu(t){return Ay(t,vs,Ry)}l(zu,"getAllKeys");var Po=zu,Dy=mt(Ue,"DataView"),Qa=Dy,My=mt(Ue,"Promise"),es=My,Hy=mt(Ue,"Set"),ts=Hy,Eo="[object Map]",Ny="[object Object]",xo="[object Promise]",So="[object Set]",Oo="[object WeakMap]",Co="[object DataView]",jy=gt(Qa),$y=gt(cr),Uy=gt(es),Fy=gt(ts),Ly=gt(Ya),it=Kt;(Qa&&it(new Qa(new ArrayBuffer(1)))!=Co||cr&&it(new cr)!=Eo||es&&it(es.resolve())!=xo||ts&&it(new ts)!=So||Ya&&it(new Ya)!=Oo)&&(it=l(function(t){var e=Kt(t),r=e==Ny?t.constructor:void 0,n=r?gt(r):"";if(n)switch(n){case jy:return Co;case $y:return Eo;case Uy:return xo;case Fy:return So;case Ly:return Oo}return e},"getTag"));var Bo=it,Ky=Ue.Uint8Array,Io=Ky,zy="__lodash_hash_undefined__";function Wu(t){return this.__data__.set(t,zy),this}l(Wu,"setCacheAdd");var Wy=Wu;function Vu(t){return this.__data__.has(t)}l(Vu,"setCacheHas");var Vy=Vu;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=Wy;dr.prototype.has=Vy;var qy=dr;function qu(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(qu,"arraySome");var Gy=qu;function Gu(t,e){return t.has(e)}l(Gu,"cacheHas");var Jy=Gu,Yy=1,Xy=2;function Ju(t,e,r,n,a,s){var i=r&Yy,o=t.length,c=e.length;if(o!=c&&!(i&&c>o))return!1;var p=s.get(t),h=s.get(e);if(p&&h)return p==e&&h==t;var b=-1,I=!0,P=r&Xy?new qy:void 0;for(s.set(t,e),s.set(e,t);++b<o;){var S=t[b],W=e[b];if(n)var q=i?n(W,S,b,e,t,s):n(S,W,b,t,e,s);if(q!==void 0){if(q)continue;I=!1;break}if(P){if(!Gy(e,function(re,J){if(!Jy(P,J)&&(S===re||a(S,re,r,n,s)))return P.push(J)})){I=!1;break}}else if(!(S===W||a(S,W,r,n,s))){I=!1;break}}return s.delete(t),s.delete(e),I}l(Ju,"equalArrays");var Yu=Ju;function Xu(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}l(Xu,"mapToArray");var Qy=Xu;function Qu(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}l(Qu,"setToArray");var ev=Qu,tv=1,rv=2,nv="[object Boolean]",av="[object Date]",sv="[object Error]",iv="[object Map]",ov="[object Number]",lv="[object RegExp]",uv="[object Set]",cv="[object String]",dv="[object Symbol]",fv="[object ArrayBuffer]",pv="[object DataView]",Zo=Ve?Ve.prototype:void 0,Wa=Zo?Zo.valueOf:void 0;function ec(t,e,r,n,a,s,i){switch(r){case pv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case fv:return!(t.byteLength!=e.byteLength||!s(new Io(t),new Io(e)));case nv:case av:case ov:return zl(+t,+e);case sv:return t.name==e.name&&t.message==e.message;case lv:case cv:return t==e+"";case iv:var o=Qy;case uv:var c=n&tv;if(o||(o=ev),t.size!=e.size&&!c)return!1;var p=i.get(t);if(p)return p==e;n|=rv,i.set(t,e);var h=Yu(o(t),o(e),n,a,s,i);return i.delete(t),h;case dv:if(Wa)return Wa.call(t)==Wa.call(e)}return!1}l(ec,"equalByTag");var gv=ec,mv=1,hv=Object.prototype,yv=hv.hasOwnProperty;function tc(t,e,r,n,a,s){var i=r&mv,o=Po(t),c=o.length,p=Po(e),h=p.length;if(c!=h&&!i)return!1;for(var b=c;b--;){var I=o[b];if(!(i?I in e:yv.call(e,I)))return!1}var P=s.get(t),S=s.get(e);if(P&&S)return P==e&&S==t;var W=!0;s.set(t,e),s.set(e,t);for(var q=i;++b<c;){I=o[b];var re=t[I],J=e[I];if(n)var N=i?n(J,re,I,e,t,s):n(re,J,I,t,e,s);if(!(N===void 0?re===J||a(re,J,r,n,s):N)){W=!1;break}q||(q=I=="constructor")}if(W&&!q){var L=t.constructor,ue=e.constructor;L!=ue&&"constructor"in t&&"constructor"in e&&!(typeof L=="function"&&L instanceof L&&typeof ue=="function"&&ue instanceof ue)&&(W=!1)}return s.delete(t),s.delete(e),W}l(tc,"equalObjects");var vv=tc,_v=1,Ro="[object Arguments]",Ao="[object Array]",Fr="[object Object]",Tv=Object.prototype,Do=Tv.hasOwnProperty;function rc(t,e,r,n,a,s){var i=$e(t),o=$e(e),c=i?Ao:Bo(t),p=o?Ao:Bo(e);c=c==Ro?Fr:c,p=p==Ro?Fr:p;var h=c==Fr,b=p==Fr,I=c==p;if(I&&Xa(t)){if(!Xa(e))return!1;i=!0,h=!1}if(I&&!h)return s||(s=new Kr),i||au(t)?Yu(t,e,r,n,a,s):gv(t,e,c,r,n,a,s);if(!(r&_v)){var P=h&&Do.call(t,"__wrapped__"),S=b&&Do.call(e,"__wrapped__");if(P||S){var W=P?t.value():t,q=S?e.value():e;return s||(s=new Kr),a(W,q,r,n,s)}}return I?(s||(s=new Kr),vv(t,e,r,n,a,s)):!1}l(rc,"baseIsEqualDeep");var bv=rc;function Ts(t,e,r,n,a){return t===e?!0:t==null||e==null||!Mt(t)&&!Mt(e)?t!==t&&e!==e:bv(t,e,r,n,Ts,a)}l(Ts,"baseIsEqual");var bs=Ts,wv=1,kv=2;function nc(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],h=o[1];if(i&&o[2]){if(p===void 0&&!(c in t))return!1}else{var b=new Kr;if(n)var I=n(p,h,c,t,e,b);if(!(I===void 0?bs(h,p,wv|kv,n,b):I))return!1}}return!0}l(nc,"baseIsMatch");var Pv=nc;function ac(t){return t===t&&!hs(t)}l(ac,"isStrictComparable");var sc=ac;function ic(t){for(var e=vs(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,sc(a)]}return e}l(ic,"getMatchData");var Ev=ic;function oc(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}l(oc,"matchesStrictComparable");var lc=oc;function uc(t){var e=Ev(t);return e.length==1&&e[0][2]?lc(e[0][0],e[0][1]):function(r){return r===t||Pv(r,t,e)}}l(uc,"baseMatches");var xv=uc;function cc(t,e){return t!=null&&e in Object(t)}l(cc,"baseHasIn");var Sv=cc;function dc(t,e,r){e=Iu(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var i=Ln(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)&&Fl(i,a)&&($e(t)||Xl(t)))}l(dc,"hasPath");var Ov=dc;function fc(t,e){return t!=null&&Ov(t,e,Sv)}l(fc,"hasIn");var Cv=fc,Bv=1,Iv=2;function pc(t,e){return _s(t)&&sc(e)?lc(Ln(t),e):function(r){var n=Ty(r,t);return n===void 0&&n===e?Cv(r,t):bs(e,n,Bv|Iv)}}l(pc,"baseMatchesProperty");var Zv=pc;function gc(t){return function(e){return e?.[t]}}l(gc,"baseProperty");var Rv=gc;function mc(t){return function(e){return Au(e,t)}}l(mc,"basePropertyDeep");var Av=mc;function hc(t){return _s(t)?Rv(Ln(t)):Av(t)}l(hc,"property");var Dv=hc;function yc(t){return typeof t=="function"?t:t==null?hm:typeof t=="object"?$e(t)?Zv(t[0],t[1]):xv(t):Dv(t)}l(yc,"baseIteratee");var Mv=yc;function vc(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(vc,"createBaseFor");var Hv=vc,Nv=Hv(),jv=Nv;function _c(t,e){return t&&jv(t,e,vs)}l(_c,"baseForOwn");var $v=_c;function Tc(t,e){return bs(t,e)}l(Tc,"isEqual");var ct=Tc;function bc(t,e){var r={};return e=Mv(e,3),$v(t,function(n,a,s){Nm(r,a,e(n,a,s))}),r}l(bc,"mapValues");var Uv=bc;function ws(t){return se(t)}l(ws,"toTypescriptSchema");function se(t){let r=t._def;switch(r.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(r.description)}z.string()`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:return`${Z(r.description)}z.number()`.trim();case v.ZodFirstPartyTypeKind.ZodNaN:return`${Z(r.description)}z.nan()`.trim();case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(r.description)}z.bigint()`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)}z.boolean()`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(r.description)}z.date()`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(r.description)}z.undefined()`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(r.description)}z.null()`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(r.description)}z.any()`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(r.description)}z.unknown()`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(r.description)}z.never()`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(r.description)}z.void()`.trim();case v.ZodFirstPartyTypeKind.ZodArray:return`z.array(${se(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=Uv(r.shape(),ue=>ue instanceof v.Schema?se(ue):"z.any()");return[`${Z(r.description)}z.object({`,...Object.entries(n).map(([ue,Ke])=>` ${ue}: ${Ke},`),"})"].join(`
33
- `).trim();case v.ZodFirstPartyTypeKind.ZodUnion:let a=r.options.map(se);return`${Z(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(se),i=He(r.discriminator);return`${Z(r.description)}z.discriminatedUnion(${i}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let o=se(r.left),c=se(r.right);return`${Z(r.description)}z.intersection(${o}, ${c})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(se);return`${Z(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let h=se(r.keyType),b=se(r.valueType);return`${Z(r.description)}z.record(${h}, ${b})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let I=se(r.keyType),P=se(r.valueType);return`${Z(r.description)}z.map(${I}, ${P})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${Z(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`${Z(r.description)}z.function()${W}.returns(${q})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${Z(r.description)}z.lazy(() => ${se(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let re=He(r.value);return`${Z(r.description)}z.literal(${re})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let J=r.values.map(He);return`${Z(r.description)}z.enum([${J.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new st(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new st(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${Z(r.description)}z.optional(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${Z(r.description)}z.nullable(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let N=el(r.defaultValue());return`${Z(r.description)}${se(r.innerType)}.default(${N})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new st(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${Z(r.description)}z.promise(${se(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new st(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new st(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new st(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${Z(r.description)}z.readonly(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let L=He(r.uri);return`${Z(r.description)}z.ref(${L})`.trim();default:M.assertNever(r)}}l(se,"sUnwrapZod");var wc=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(wc,"ParseInputLazyPath");var xe=wc,Mo=l((t,e)=>{if(Nt(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 Ie(t.common.issues);return this._error=r,this._error}}},"handleResult"),kc=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 Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(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:Me(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:Me(e)},s=this._parseSync({data:e,path:a.path,parent:a});return Mo(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:Me(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(pr(a)?a:Promise.resolve(a));return Mo(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 dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jt.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(m(d({},R(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new hr(m(d({},R(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Wn(d({typeName:"ZodBranded",type:this},R(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Vn(m(d({},R(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.constructor;return new r(m(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[F]=m(d({},this._def[F]),{[r]:n});return this}getMetadata(){return d({},this._def[F])}setMetadata(e){this._def[F]=d({},e)}get ui(){let e=this._getMetadataRoot();return d({},e._def[F])}_setZuiMeta(e,r){let n=this._getMetadataRoot();n._def[F]=m(d({},n._def[F]),{[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=F])!=null||(r[n]={}),this._def[F].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,m(d({},e),{formatter:void 0}));return e?.formatter&&(r=await e.formatter(r)),r}static fromObject(e,r){return Ut(e,r)}static fromJsonSchema(e){return Tr(e)}};l(kc,"ZodType");var D=kc,ks=(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))(ks||{}),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"]),Me=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 R(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,[F]:t?.[F]}:{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,[F]:t?.[F]}}l(R,"processCreateParams");var Ps=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"),Ho=Ps,_=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"]),Pc=l(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),tn=class Ec 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 Ec))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 Ie=tn,xc=Ps;function Es(t){xc=t}l(Es,"setErrorMap");function Ht(){return xc}l(Ht,"getErrorMap");var fr=l(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,i=[...n,...s.path||[]],o=m(d({},s),{path:i}),c="",p=a.filter(h=>!!h).slice().reverse();for(let h of p)c=h(o,{data:r,defaultError:c}).message;return m(d({},s),{path:i,message:(e=s.message)!=null?e:c})},"makeIssue"),Sc=[];function w(t,e){let r=fr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ht(),Ps].filter(n=>!!n)});t.common.issues.push(r)}l(w,"addIssueToContext");var Oc=class Cc{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 C;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 Cc.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 C;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(Oc,"ParseStatus");var ve=Oc,C=Object.freeze({status:"aborted"}),ut=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"),Nt=l(t=>t.status==="valid","isValid"),pr=l(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),O;(t=>{t.errToObj=l(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=l(e=>typeof e=="string"?e:e?.message,"toString")})(O||(O={}));var an=class Bc extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Bc}};l(an,"ZodAny");an.create=l(t=>new an(d({typeName:"ZodAny"},R(t))),"create");var gr=an,sn=class Ct extends D{dereference(e){return new Ct(m(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 Ct?ct((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&ct((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&ct((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 w(r,{code:_.invalid_type,expected:k.array,received:r.parsedType}),C;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(w(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&&(w(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&&(w(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 Ct(m(d({},this._def),{minLength:{value:e,message:O.toString(r)}}))}max(e,r){return new Ct(m(d({},this._def),{maxLength:{value:e,message:O.toString(r)}}))}length(e,r){return new Ct(m(d({},this._def),{exactLength:{value:e,message:O.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"},R(e))),"create");var jt=sn,Fv={compare:ct},Ic=class{constructor(e=[],r={}){this._options=d(d({},Fv),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(Ic,"CustomSet");var le=Ic,on=class zr extends D{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 w(s,{code:_.invalid_type,expected:k.bigint,received:s.parsedType}),C}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),w(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),w(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),w(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,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new zr(m(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new zr(m(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.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},R(t)))},"create");var Kn=on,ln=class Zc extends D{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==k.boolean){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.boolean,received:n.parsedType}),C}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},R(t))),"create");var zn=ln,Rc=Symbol("zod_brand"),Ac=class Dc extends D{_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 Dc?this._def.type.isEqual(e._def.type):!1}};l(Ac,"ZodBranded");var Wn=Ac,un=class Mc extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=m(d({},r),{common:m(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 Ie(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Mc?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},R(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(m(d({code:"custom"},p),{fatal:c}))}}):gr.create(),"custom"),cn=class rs extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:k.date,received:s.parsedType}),C}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_date}),C}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),w(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),w(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(m(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.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"},R(t))),"create");var qn=cn,dn=class ns extends D{_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(m(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof ns?this._def.innerType.isEqual(e._def.innerType)&&ct(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},R(r))),"create");var hr=dn,Fe=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 Tt?t.options:t instanceof Xn?M.objectValues(t.enum):t instanceof hr?De(t._def.innerType):t instanceof ra?[void 0]:t instanceof Qn?[null]:t instanceof Ne?[void 0,...De(t.unwrap())]:t instanceof dt?[null,...De(t.unwrap())]:t instanceof Wn||t instanceof _r?De(t.unwrap()):t instanceof Vn?De(t._def.innerType):[],"getDiscriminator"),Hc=class Bt extends D{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=Bt._getOptionsMap(this.discriminator,r);return new Bt(m(d({},this._def),{options:r,optionsMap:n}))}getReferences(){return Fe(this.options.flatMap(e=>e.getReferences()))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.object)return w(r,{code:_.invalid_type,expected:k.object,received:r.parsedType}),C;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}):(w(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=Bt._getOptionsMap(e,r);return new Bt(d({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},R(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 Bt)||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(Hc,"ZodDiscriminatedUnion");var Ss=Hc;function yr(t,e){return new Tt(d({values:t,typeName:"ZodEnum"},R(e)))}l(yr,"createZodEnum");var Os=class Wr extends D{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{expected:M.joinValues(n),received:r.parsedType,code:_.invalid_type}),C}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{received:r.data,code:_.invalid_enum_value,options:n}),C}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 Tt=Os,Nc=class It extends D{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new It(m(d({},this._def),{args:r,returns:n}))}getReferences(){return Fe([...this._def.args.getReferences(),...this._def.returns.getReferences()])}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.function)return w(r,{code:_.invalid_type,expected:k.function,received:r.parsedType}),C;function n(o,c){return fr({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ht(),Ho].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,Ht(),Ho].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 Ie([]),h=await o._def.args.parseAsync(c,s).catch(P=>{throw p.addIssue(n(c,P)),p}),b=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(b,s).catch(P=>{throw p.addIssue(a(b,P)),p})})}else{let o=this;return pe(function(...c){let p=o._def.args.safeParse(c,s);if(!p.success)throw new Ie([n(c,p.error)]);let h=Reflect.apply(i,this,p.data),b=o._def.returns.safeParse(h,s);if(!b.success)throw new Ie([a(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new It(m(d({},this._def),{args:pt.create(e).rest(At.create())}))}returns(e){return new It(m(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new It(d({args:e||pt.create([]).rest(At.create()),returns:r||At.create(),typeName:"ZodFunction"},R(n)))}isEqual(e){return e instanceof It&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};l(Nc,"ZodFunction");var Cs=Nc;function fn(t,e){let r=Me(t),n=Me(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 D{dereference(e){return new as(m(d({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Fe([...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 C;let o=fn(s.value,i.value);return o.valid?((nn(s)||nn(i))&&r.dirty(),{status:r.value,value:o.data}):(w(n,{code:_.invalid_intersection_types}),C)},"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"},R(r))),"create");var Gn=pn,gn=class jc extends D{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 jc?this._def.getter().isEqual(e._def.getter()):!1}};l(gn,"ZodLazy");gn.create=l((t,e)=>new gn(d({getter:t,typeName:"ZodLazy"},R(e))),"create");var Jn=gn,mn=class $c extends D{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return w(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof $c?ct(this._def.value,e._def.value):!1}};l(mn,"ZodLiteral");mn.create=l((t,e)=>new mn(d({value:t,typeName:"ZodLiteral"},R(e))),"create");var Yn=mn,hn=class ss extends D{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(m(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Fe([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.map)return w(n,{code:_.invalid_type,expected:k.map,received:n.parsedType}),C;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,h=await c.value;if(p.status==="aborted"||h.status==="aborted")return C;(p.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(p.value,h.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let p=c.key,h=c.value;if(p.status==="aborted"||h.status==="aborted")return C;(p.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(p.value,h.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(hn,"ZodMap");hn.create=l((t,e,r)=>new hn(d({valueType:e,keyType:t,typeName:"ZodMap"},R(r))),"create");var Bs=hn,yn=class Uc extends D{_parse(e){if(this._getType(e)!==k.nan){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Uc}};l(yn,"ZodNaN");yn.create=l(t=>new yn(d({typeName:"ZodNaN"},R(t))),"create");var Is=yn,vn=class Fc extends D{_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 w(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),C}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return w(n,{received:n.data,code:_.invalid_enum_value,options:a}),C}return pe(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Fc?ct(this._def.values,e._def.values):!1}};l(vn,"ZodNativeEnum");vn.create=l((t,e)=>new vn(d({values:t,typeName:"ZodNativeEnum"},R(e))),"create");var Xn=vn,_n=class Lc extends D{_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.invalid_type,expected:k.never,received:r.parsedType}),C}isEqual(e){return e instanceof Lc}};l(_n,"ZodNever");_n.create=l(t=>new _n(d({typeName:"ZodNever"},R(t))),"create");var qe=_n,Tn=class Kc extends D{_parse(e){if(this._getType(e)!==k.null){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.null,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Kc}};l(Tn,"ZodNull");Tn.create=l(t=>new Tn(d({typeName:"ZodNull"},R(t))),"create");var Qn=Tn,bn=class is extends D{dereference(e){return new is(m(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"},R(e))),"create");var dt=bn;function zc(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(zc,"floatSafeRemainder");var wn=class Vr extends D{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 w(s,{code:_.invalid_type,expected:k.number,received:s.parsedType}),C}let n,a=new ve;for(let s of this._def.checks)s.kind==="int"?M.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),w(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),w(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),w(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?zc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),w(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),w(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,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new Vr(m(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new Vr(m(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.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},R(t))),"create");var ea=wn;function lt(t){if(t instanceof ft){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ne.create(lt(n))}return new ft(m(d({},t._def),{shape:l(()=>e,"shape")}))}else return t instanceof jt?new jt(m(d({},t._def),{type:lt(t.element)})):t instanceof Ne?Ne.create(lt(t.unwrap())):t instanceof dt?dt.create(lt(t.unwrap())):t instanceof pt?pt.create(t.items.map(e=>lt(e))):t}l(lt,"deepPartialify");var Ge=class Ee extends D{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(m(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 Fe(r)}_parse(e){if(this._getType(e)!==k.object){let p=this._getOrReturnCtx(e);return w(p,{code:_.invalid_type,expected:k.object,received:p.parsedType}),C}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 h=s[p],b=a.data[p];c.push({key:{status:"valid",value:p},value:h._parse(new xe(a,b,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qe){let p=this._def.unknownKeys;if(p==="passthrough")for(let h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(p==="strict")o.length>0&&(w(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 h of o){let b=a.data[h];c.push({key:{status:"valid",value:h},value:p._parse(new xe(a,b,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let h of c){let b=await h.key;p.push({key:b,value:await h.value,alwaysSet:h.alwaysSet})}return p}).then(p=>ve.mergeObjectSync(n,p)):ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new Ee(d(m(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=O.errToObj(e).message)!=null?o:c}:{message:c}},"errorMap")}:{}))}strip(){return new Ee(m(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new Ee(m(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new Ee(m(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(m(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(m(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(m(d({},this._def),{shape:l(()=>r,"shape")}))}deepPartial(){return lt(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(m(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(m(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"},R(e))),"create");Ge.strictCreate=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},R(e))),"strictCreate");Ge.lazycreate=l((t,e)=>new Ge(d({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},R(e))),"lazycreate");var ft=Ge,kn=class os extends D{dereference(e){return new os(m(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(kn,"ZodOptional");kn.create=l((t,e)=>new kn(d({innerType:t,typeName:"ZodOptional"},R(e))),"create");var Ne=kn,Wc=class qr extends D{dereference(e){return new qr(m(d({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Fe([...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"?C:s.status==="dirty"?(r.dirty(),ut(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"?C: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(Wc,"ZodPipeline");var ta=Wc,Pn=class ls extends D{unwrap(){return this._def.type}dereference(e){return new ls(m(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 w(r,{code:_.invalid_type,expected:k.promise,received:r.parsedType}),C;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(Pn,"ZodPromise");Pn.create=l((t,e)=>new Pn(d({type:t,typeName:"ZodPromise"},R(e))),"create");var vr=Pn,En=class us extends D{dereference(e){return new us(m(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 Nt(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"},R(e))),"create");var _r=En,Vc=class ar extends D{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(m(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Fe([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.object)return w(n,{code:_.invalid_type,expected:k.object,received:n.parsedType}),C;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 D?new ar(d({keyType:e,valueType:r,typeName:"ZodRecord"},R(n))):new ar(d({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},R(r)))}isEqual(e){return!(!(e instanceof ar)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(Vc,"ZodRecord");var Zs=Vc,xn=class qc extends D{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.unresolved_reference}),C}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof qc?this._def.uri===e._def.uri:!1}};l(xn,"ZodRef");xn.create=l(t=>new xn({typeName:"ZodRef",uri:t}),"create");var Rs=xn,Sn=class sr extends D{dereference(e){return new sr(m(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 w(n,{code:_.invalid_type,expected:k.set,received:n.parsedType}),C;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(w(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&&(w(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 h of c){if(h.status==="aborted")return C;h.status==="dirty"&&r.dirty(),p.add(h.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(m(d({},this._def),{minSize:{value:e,message:O.toString(r)}}))}max(e,r){return new sr(m(d({},this._def),{maxSize:{value:e,message:O.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"},R(e))),"create");var As=Sn,Ds=/^c[^\s-]{8,}$/i,Ms=/^[a-z][a-z0-9]*$/,Hs=/^[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,Gc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jc=l(t=>t===Gc,"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})))$/,Fs=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 Yc(t,e){return!!((e==="v4"||!e)&&$s.test(t)||(e==="v6"||!e)&&Us.test(t))}l(Yc,"isValidIP");var On=class Zt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:k.string,received:s.parsedType}),C}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),w(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),w(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?w(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&w(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),w(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Va||(Va=new RegExp(Gc,"u")),Va.test(e.data)||(a=this._getOrReturnCtx(e,a),w(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),w(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),w(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Ms.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid2",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Hs.test(e.data)||(a=this._getOrReturnCtx(e,a),w(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),w(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),w(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),w(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),w(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),w(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Fs(s).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?Yc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),w(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},O.errToObj(n)))}_addCheck(e){return new Zt(m(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},O.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},O.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},O.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},O.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},O.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},O.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},O.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},O.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},O.errToObj(e?.message)))}regex(e,r){return this._addCheck(d({kind:"regex",regex:e},O.errToObj(r)))}includes(e,r){return this._addCheck(d({kind:"includes",value:e,position:r?.position},O.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(d({kind:"startsWith",value:e},O.errToObj(r)))}endsWith(e,r){return this._addCheck(d({kind:"endsWith",value:e},O.errToObj(r)))}min(e,r){return this._addCheck(d({kind:"min",value:e},O.errToObj(r)))}max(e,r){return this._addCheck(d({kind:"max",value:e},O.errToObj(r)))}length(e,r){return this._addCheck(d({kind:"length",value:e},O.errToObj(r)))}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new Zt(m(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[F]=m(d({},this._def[F]),{secret:!0}),this}toLowerCase(){return new Zt(m(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Zt(m(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},R(t)))},"create");var ge=On,Cn=class Xc extends D{_parse(e){if(this._getType(e)!==k.symbol){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.symbol,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Xc}};l(Cn,"ZodSymbol");Cn.create=l(t=>new Cn(d({typeName:"ZodSymbol"},R(t))),"create");var Ls=Cn,$t=class cs extends D{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(m(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=>{w(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 C;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"||r.value==="dirty"?ut(c.value):c});{if(r.value==="aborted")return C;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"||r.value==="dirty"?ut(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"?C:(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"?C:(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(!Nt(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=>Nt(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($t,"ZodEffects");$t.create=l((t,e,r)=>new $t(d({schema:t,typeName:"ZodEffects",effect:e},R(r))),"create");$t.createWithPreprocess=l((t,e,r)=>new $t(d({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},R(r))),"createWithPreprocess");var Je=$t,Bn=class Gr extends D{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(m(d({},this._def),{items:r,rest:n}))}getReferences(){return Fe([...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 w(n,{code:_.invalid_type,expected:k.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return w(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(w(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(m(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(Bn,"ZodTuple");Bn.create=l((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bn(d({items:t,typeName:"ZodTuple",rest:null},R(e)))},"create");var pt=Bn,In=class Qc extends D{_parse(e){if(this._getType(e)!==k.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.undefined,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Qc}};l(In,"ZodUndefined");In.create=l(t=>new In(d({typeName:"ZodUndefined"},R(t))),"create");var ra=In,Zn=class ds extends D{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new ds(m(d({},this._def),{options:r}))}getReferences(){return Fe(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 Ie(o.ctx.common.issues));return w(r,{code:_.invalid_union,unionErrors:i}),C}if(l(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let i=m(d({},r),{common:m(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=m(d({},r),{common:m(d({},r.common),{issues:[]}),parent:null}),h=c._parseSync({data:r.data,path:r.path,parent:p});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,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 Ie(c));return w(r,{code:_.invalid_union,unionErrors:o}),C}}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(Zn,"ZodUnion");Zn.create=l((t,e)=>new Zn(d({options:t,typeName:"ZodUnion"},R(e))),"create");var na=Zn,Rn=class ed extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof ed}};l(Rn,"ZodUnknown");Rn.create=l(t=>new Rn(d({typeName:"ZodUnknown"},R(t))),"create");var At=Rn,An=class td extends D{_parse(e){if(this._getType(e)!==k.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:k.void,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof td}};l(An,"ZodVoid");An.create=l(t=>new An(d({typeName:"ZodVoid"},R(t))),"create");var Ks=An,Lv=/^\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))?$/,Ut=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]=Lv.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(Ut(c[0],e,!1))):["string","number","boolean"].includes(typeof c[0])&&(i[o]=n(E.array(E[typeof c[0]]()))):i[o]=n(Ut(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 rd(){return{}}l(rd,"parseAnyDef");function zs(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=m(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 nd(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,m(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(nd,"parseArrayDef");function ad(t,e){let r=d({type:"integer",format:"int64"},t.coerce?{[F]:{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(ad,"parseBigintDef");function sd(t){return d({type:"boolean"},t.coerce?{[F]:{coerce:t.coerce||void 0}}:{})}l(sd,"parseBooleanDef");function id(t,e){return V(t.type._def,e)}l(id,"parseBrandedDef");var Kv=l((t,e)=>V(t.innerType._def,e),"parseCatchDef");function od(t,e){return e.dateStrategy=="integer"?zv(t,e):d({type:"string",format:"date-time"},t.coerce?{[F]:{coerce:t.coerce||void 0}}:{})}l(od,"parseDateDef");var zv=l((t,e)=>{let r=d({type:"integer",format:"unix-time"},t.coerce?{[F]:{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 ld(t,e){return m(d({},V(t.innerType._def,e)),{default:t.defaultValue()})}l(ld,"parseDefaultDef");function ud(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):{}}l(ud,"parseEffectsDef");function cd(t){return{type:"string",enum:t.values}}l(cd,"parseEnumDef");var Wv=l(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function dd(t,e){let r=[V(t.left._def,m(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),V(t.right._def,m(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(Wv(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=Fo(o,["additionalProperties"])}else n=void 0;a.push(i)}}),a.length?d({allOf:a},n):void 0}l(dd,"parseIntersectionDef");function fd(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(fd,"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?{[F]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?Vv(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":at(r,"email",a.message,e);break;case"format:idn-email":at(r,"idn-email",a.message,e);break;case"pattern:zod":Ae(r,nr.email,a.message,e);break}break;case"url":at(r,"uri",a.message,e);break;case"uuid":at(r,"uuid",a.message,e);break;case"regex":Ae(r,a.regex.source,a.message,e);break;case"cuid":Ae(r,nr.cuid,a.message,e);break;case"cuid2":Ae(r,nr.cuid2,a.message,e);break;case"startsWith":Ae(r,"^"+n(a.value),a.message,e);break;case"endsWith":Ae(r,n(a.value)+"$",a.message,e);break;case"datetime":at(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":{Ae(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&at(r,"ipv4",a.message,e),a.version!=="v4"&&at(r,"ipv6",a.message,e);break}case"emoji":Ae(r,nr.emoji,a.message,e);break;case"ulid":{Ae(r,nr.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}l(Ws,"parseStringDef");var Vv=l(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),at=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"),Ae=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 h;return m(d({},c),{[p]:(h=V(t.valueType._def,m(d({},e),{currentPath:[...e.currentPath,"properties",p]})))!=null?h:{}})},{}),additionalProperties:!1};let o={type:"object",additionalProperties:(n=V(t.valueType._def,m(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,[h,b])=>h==="type"?p:m(d({},p),{[h]:b}),{});return m(d({},o),{propertyNames:c})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return m(d({},o),{propertyNames:{enum:t.keyType._def.values}});return o}l(Vs,"parseRecordDef");function pd(t,e){if(e.mapStrategy==="record")return Vs(t,e);let r=V(t.keyType._def,m(d({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=V(t.valueType._def,m(d({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}l(pd,"parseMapDef");function gd(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(gd,"parseNativeEnumDef");function md(){return{not:{}}}l(md,"parseNeverDef");function hd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}l(hd,"parseNullDef");var Dn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function yd(t,e){if(e.target==="openApi3")return No(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 No(t,e)}l(yd,"parseUnionDef");var No=l((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>V(a._def,m(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 vd(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,m(d({},e),{currentPath:[...e.currentPath]}));return n&&m(d({},n),{nullable:!0})}let r=V(t.innerType._def,m(d({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}l(vd,"parseNullableDef");function _d(t,e){let r=d({type:"number"},t.coerce?{[F]:{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(_d,"parseNumberDef");function Td(t,e){var r;let n=m(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,m(d({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return o===void 0?a:{properties:m(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,m(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0});return n.required.length||delete n.required,n}l(Td,"parseObjectDef");var qv=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,m(d({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),Gv=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,m(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=V(t.out._def,m(d({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(a=>a!==void 0)}},"parsePipelineDef");function bd(t,e){return V(t.type._def,e)}l(bd,"parsePromiseDef");function wd(t,e){let n={type:"array",uniqueItems:!0,items:V(t.valueType._def,m(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(wd,"parseSetDef");function kd(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>V(r._def,m(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:V(t.rest._def,m(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,m(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}l(kd,"parseTupleDef");function Pd(){return{not:{}}}l(Pd,"parseUndefinedDef");function Ed(){return{}}l(Ed,"parseUnknownDef");var Jv=l((t,e)=>V(t.innerType._def,e),"parseReadonlyDef");function xd(t){return{$ref:t.uri}}l(xd,"parseRefDef");function V(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let i=Yv(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=Qv(t,t.typeName,e);return s&&e_(t,e,s),a.jsonSchema=s,s}l(V,"parseDef");var Yv=l((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Xv(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"),Xv=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"),Qv=l((t,e,r)=>{switch(e){case"ZodString":return Ws(t,r);case"ZodNumber":return _d(t,r);case"ZodObject":return Td(t,r);case"ZodBigInt":return ad(t,r);case"ZodBoolean":return sd(t);case"ZodDate":return od(t,r);case"ZodUndefined":return Pd();case"ZodNull":return hd(r);case"ZodArray":return nd(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return yd(t,r);case"ZodIntersection":return dd(t,r);case"ZodTuple":return kd(t,r);case"ZodRecord":return Vs(t,r);case"ZodRef":return xd(t);case"ZodLiteral":return fd(t,r);case"ZodEnum":return cd(t);case"ZodNativeEnum":return gd(t);case"ZodNullable":return vd(t,r);case"ZodOptional":return qv(t,r);case"ZodMap":return pd(t,r);case"ZodSet":return wd(t,r);case"ZodLazy":return V(t.getter()._def,r);case"ZodPromise":return bd(t,r);case"ZodNaN":case"ZodNever":return md();case"ZodEffects":return ud(t,r);case"ZodAny":return rd();case"ZodUnknown":return Ed();case"ZodDefault":return ld(t,r);case"ZodBranded":return id(t,r);case"ZodReadonly":return Jv(t,r);case"ZodCatch":return Kv(t,r);case"ZodPipeline":return Gv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),e_=l((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[F]:d(d({},t[F]),r[F])}),r),"addMeta"),jo={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"},t_=l(t=>typeof t=="string"?m(d({},jo),{name:t}):d(d({},jo),t),"getDefaultOptions"),r_=l(t=>{let e=t_(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return m(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"),n_=l((t,e)=>{var r;let n=r_(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[p,h])=>{var b;return m(d({},c),{[p]:(b=V(h._def,m(d({},n),{currentPath:[...n.basePath,n.definitionPath,p]}),!0))!=null?b:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(r=V(t._def,s===void 0?n:m(d({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},o=s===void 0?a?m(d({},i),{[n.definitionPath]:a}):i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:m(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=n_(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),a_=["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"],NT=Tt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Sd=l(t=>ge.create().displayAs({id:"variable",params:d({type:t?.type||"any"},t?.params)}),"variable"),Od=l(t=>ge.create().displayAs({id:"conversation",params:d({},t?.params)}),"conversation"),Cd=l(t=>ge.create().displayAs({id:"user",params:d({},t?.params)}),"user"),Bd=l(t=>ge.create().displayAs({id:"message",params:d({},t?.params)}),"message"),Id=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"),Rd=l(t=>ge.create().displayAs({id:"table",params:d({},t?.params)}),"table"),Ad=l(t=>ge.create().displayAs({id:"tablerow",params:d({},t?.params)}),"tablerow"),Dd=l(t=>ge.create().displayAs({id:"intent",params:d({},t?.params)}),"intent"),Md=l(()=>Tt.create(a_).displayAs({id:"dropdown",params:{}}),"aimodel"),Hd=l(t=>ge.create().displayAs({id:"datasource",params:d({},t)}),"datasource"),Nd=l(t=>ge.create().displayAs({id:"knowledgebase",params:d({},t)}),"knowledgebase"),jd={object:ft.lazycreate},$d=l((t,e={message:`Input not instance of ${t.name}`})=>xs(r=>r instanceof t,e),"instanceOfType"),qs=ge.create,Gs=ea.create,Ud=Is.create,Fd=Kn.create,Js=zn.create,Ld=qn.create,Kd=Ls.create,zd=ra.create,Wd=Qn.create,Vd=gr.create,qd=At.create,Gd=qe.create,Jd=Ks.create,Yd=jt.create,Xd=ft.create,Qd=ft.strictCreate,ef=na.create,tf=Ss.create,rf=Gn.create,nf=pt.create,af=Zs.create,sf=Rs.create,of=_r.create,lf=Bs.create,uf=As.create,cf=Cs.create,df=Jn.create,ff=Yn.create,pf=Tt.create,gf=Xn.create,mf=vr.create,fs=Je.create,hf=Ne.create,yf=dt.create,s_=hr.create,vf=Je.createWithPreprocess,_f=ta.create,Tf=l(()=>qs().optional(),"ostring"),bf=l(()=>Gs().optional(),"onumber"),wf=l(()=>Js().optional(),"oboolean"),kf=D.fromJsonSchema,Pf=D.fromObject,Ef={string:l(t=>ge.create(m(d({},t),{coerce:!0})),"string"),number:l(t=>ea.create(m(d({},t),{coerce:!0})),"number"),boolean:l(t=>zn.create(m(d({},t),{coerce:!0})),"boolean"),bigint:l(t=>Kn.create(m(d({},t),{coerce:!0})),"bigint"),date:l(t=>qn.create(m(d({},t),{coerce:!0})),"date")},xf=C,v=E,Sf=l((t,e)=>t.anyOf.length?t.anyOf.length===1?ce(t.anyOf[0],m(d({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>ce(r,m(d({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),i_=l(t=>{var e;return(e=t[F])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),o_=l(t=>"z.any()","parseDefault"),l_=l((t,e)=>`z.union([${t.type.map(r=>ce(m(d({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),u_=l((t,e)=>`z.any().refine((value) => !${ce(t.not,m(d({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),c_=l(t=>"z.null()","parseNull"),d_=l(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),f_=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"),p_=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(m(d({},n),{[ir]:r}))}}return e},"ensureOriginalIndex");function mr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return ce(r,m(d({},e),{path:[...e.path,"allOf",r[ir]]}))}else{let[r,n]=d_(p_(t.allOf));return`z.intersection(${mr({allOf:r},e)}, ${mr({allOf:n},e)})`}}l(mr,"parseAllOf");var g_=l((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,a)=>ce(n,m(d({},e),{path:[...e.path,"items",a]})))}])`;let r=t.items?`z.array(${ce(t.items,m(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"),m_=l(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),h_=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"),y_=l((t,e)=>{let r=ce(t.if,m(d({},e),{path:[...e.path,"if"]})),n=ce(t.then,m(d({},e),{path:[...e.path,"then"]})),a=ce(t.else,m(d({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${a}]).superRefine((value,ctx) => {
27
+ */`},"getMultilineComment"),tl={};Ko(tl,{JsonSchemaToZuiError:()=>al,ObjectToZuiError:()=>qa,UnrepresentableGenericError:()=>Ga,UnsupportedZuiToJsonSchemaError:()=>Wg,UnsupportedZuiToTypescriptSchemaError:()=>st,UnsupportedZuiToTypescriptTypeError:()=>gl,UntitledDeclarationError:()=>ml,ZuiToJsonSchemaError:()=>ol,ZuiToTypescriptSchemaError:()=>cl,ZuiToTypescriptTypeError:()=>Hn,ZuiTransformError:()=>Ft});var rl=class extends Error{constructor(e,r){super(r),this.transform=e}};l(rl,"ZuiTransformError");var Ft=rl,nl=class extends Ft{constructor(e){super("json-schema-to-zui",e)}};l(nl,"JsonSchemaToZuiError");var al=nl,sl=class extends Ft{constructor(e){super("object-to-zui",e)}};l(sl,"ObjectToZuiError");var qa=sl,il=class extends Ft{constructor(e){super("zui-to-json-schema",e)}};l(il,"ZuiToJsonSchemaError");var ol=il,ll=class extends ol{constructor(e){super(`Zod type ${e} cannot be transformed to JSON Schema.`)}};l(ll,"UnsupportedZuiToJsonSchemaError");var Wg=ll,ul=class extends Ft{constructor(e){super("zui-to-typescript-schema",e)}};l(ul,"ZuiToTypescriptSchemaError");var cl=ul,dl=class extends cl{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};l(dl,"UnsupportedZuiToTypescriptSchemaError");var st=dl,fl=class extends Ft{constructor(e){super("zui-to-typescript-type",e)}};l(fl,"ZuiToTypescriptTypeError");var Hn=fl,pl=class extends Hn{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};l(pl,"UnsupportedZuiToTypescriptTypeError");var gl=pl,hl=class extends Hn{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};l(hl,"UntitledDeclarationError");var ml=hl,yl=class extends Hn{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};l(yl,"UnrepresentableGenericError");var Ga=yl,vl=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Vg=l(t=>vl.includes(t),"isPrimitive"),qg=l(t=>vl.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),oo=l(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),_l=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};l(_l,"KeyValue");var Ur=_l,Tl=class{constructor(e){this.schema=e}};l(Tl,"FnParameters");var lo=Tl,bl=class{constructor(e){this.schema=e}};l(bl,"FnReturn");var uo=bl,wl=class{constructor(e){this.props=e}};l(wl,"Declaration");var Fr=wl;function Qr(t,e={}){let r=Yg(t,e),n=z(r,{});return e.formatter&&(n=e.formatter(n)),n}l(Qr,"toTypescript");function z(t,e){var r,n,a;let s=h(d({},e),{parent:t});if(t===null)return"";if(t instanceof Fr)return Gg(t,s);if(t instanceof Ur){if(t.value instanceof v.ZodOptional){let k=t.value._def.innerType;return k instanceof v.Schema&&!k.description&&t.value.description&&(k=k?.describe(t.value.description)),z(new Ur(t.key,k,!0),s)}let c=Z(t.value._def.description),p=c?.trim().length>0?`
28
+ `:"",m=t.value.describe(""),C=t.optional||t.value.isOptional()?"?":"";return`${p}${c}${p}${t.key}${C}: ${z(m,s)}${p}`}if(t instanceof lo){if(t.schema instanceof v.ZodTuple){let m="";for(let T=0;T<t.schema.items.length;T++){let C=(a=(n=(r=t.schema.items[T])==null?void 0:r.ui)==null?void 0:n.title)!=null?a:`arg${T}`,k=t.schema.items[T];m+=`${z(new Ur(io(C),k),s)}${T<t.schema.items.length-1?", ":""} `}return m}let c=z(t.schema,s);return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||qg(c)?`args: ${c}`:c}if(t instanceof uo)return t.schema instanceof v.ZodOptional?`${z(t.schema.unwrap(),s)} | undefined`:z(t.schema,s);let i=t._def;switch(i.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(i.description)} string`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:case v.ZodFirstPartyTypeKind.ZodNaN:case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(i.description)} number`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)} boolean`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(i.description)} Date`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(i.description)} undefined`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(i.description)} null`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(i.description)} any`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(i.description)} unknown`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(i.description)} never`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(i.description)} void`.trim();case v.ZodFirstPartyTypeKind.ZodArray:let c=z(i.type,s);return Vg(c)?`${c}[]`:`Array<${c}>`;case v.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(i.shape()).map(([N,F])=>z(new Ur(io(N),F),s)).join("; ")} }`;case v.ZodFirstPartyTypeKind.ZodUnion:let m=i.options.map(N=>z(N,s));return`${Z(i.description)}
29
+ ${m.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let T=i.options.map(N=>z(N,s));return`${Z(t._def.description)}
30
+ ${T.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodIntersection:return`${z(i.left,s)} & ${z(i.right,s)}`;case v.ZodFirstPartyTypeKind.ZodTuple:return i.items.length===0?"":`[${i.items.map(N=>z(N,s)).join(", ")}]`;case v.ZodFirstPartyTypeKind.ZodRecord:let k=z(i.keyType,s),S=z(i.valueType,s);return`${Z(i.description)} { [key: ${k}]: ${S} }`;case v.ZodFirstPartyTypeKind.ZodMap:return`Map<${z(i.keyType,s)}, ${z(i.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodSet:return`Set<${z(i.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodFunction:let W=z(new lo(i.args),s),q=z(new uo(i.returns),s);return`${Z(i.description)}
31
+ (${W}) => ${q}`;case v.ZodFirstPartyTypeKind.ZodLazy:return z(i.getter(),s);case v.ZodFirstPartyTypeKind.ZodLiteral:let re=Xo(i.value);return`${Z(i.description)}
32
+ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return i.values.map(He).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return z(i.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new gl(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${z(i.innerType,s)} | undefined`;case v.ZodFirstPartyTypeKind.ZodNullable:return`${z(i.innerType,s)} | null`;case v.ZodFirstPartyTypeKind.ZodDefault:return z(i.innerType,s);case v.ZodFirstPartyTypeKind.ZodCatch:return z(i.innerType,s);case v.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${z(i.type,s)}>`;case v.ZodFirstPartyTypeKind.ZodBranded:return z(i.type,s);case v.ZodFirstPartyTypeKind.ZodPipeline:return z(i.in,s);case v.ZodFirstPartyTypeKind.ZodSymbol:return`${Z(i.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${z(i.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return el(i.uri);default:M.assertNever(i)}}l(z,"sUnwrapZod");var Gg=l((t,e)=>{if(t.props.type==="none")return z(t.props.schema,e);let r=Z(t.props.schema.description),n=t.props.schema.describe(""),a=z(n,e);if(t.props.type==="variable")return oo(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(el).join(", ")}>`:"";return oo(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Jg=l(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yg=l((t,e)=>{let r=Jg(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new Ga;return new Fr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new ml;if(r==="variable"){if(n.length>0)throw new Ga;return new Fr({type:"variable",identifier:a,schema:t})}return new Fr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),Xg=typeof global=="object"&&global&&global.Object===Object&&global,Pl=Xg,Qg=typeof self=="object"&&self&&self.Object===Object&&self,eh=Pl||Qg||Function("return this")(),Ue=eh,th=Ue.Symbol,Ve=th,kl=Object.prototype,rh=kl.hasOwnProperty,nh=kl.toString,rr=Ve?Ve.toStringTag:void 0;function El(t){var e=rh.call(t,rr),r=t[rr];try{t[rr]=void 0;var n=!0}catch{}var a=nh.call(t);return n&&(e?t[rr]=r:delete t[rr]),a}l(El,"getRawTag");var ah=El,sh=Object.prototype,ih=sh.toString;function xl(t){return ih.call(t)}l(xl,"objectToString");var oh=xl,lh="[object Null]",uh="[object Undefined]",co=Ve?Ve.toStringTag:void 0;function Sl(t){return t==null?t===void 0?uh:lh:co&&co in Object(t)?ah(t):oh(t)}l(Sl,"baseGetTag");var Lt=Sl;function Ol(t){return t!=null&&typeof t=="object"}l(Ol,"isObjectLike");var Mt=Ol,ch="[object Symbol]";function Cl(t){return typeof t=="symbol"||Mt(t)&&Lt(t)==ch}l(Cl,"isSymbol");var ps=Cl;function Il(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(Il,"arrayMap");var dh=Il,fh=Array.isArray,$e=fh,ph=1/0,fo=Ve?Ve.prototype:void 0,po=fo?fo.toString:void 0;function gs(t){if(typeof t=="string")return t;if($e(t))return dh(t,gs)+"";if(ps(t))return po?po.call(t):"";var e=t+"";return e=="0"&&1/t==-ph?"-0":e}l(gs,"baseToString");var gh=gs;function Bl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}l(Bl,"isObject");var hs=Bl;function Zl(t){return t}l(Zl,"identity");var hh=Zl,mh="[object AsyncFunction]",yh="[object Function]",vh="[object GeneratorFunction]",_h="[object Proxy]";function Rl(t){if(!hs(t))return!1;var e=Lt(t);return e==yh||e==vh||e==mh||e==_h}l(Rl,"isFunction");var Al=Rl,Th=Ue["__core-js_shared__"],Fa=Th,go=function(){var t=/[^.]+$/.exec(Fa&&Fa.keys&&Fa.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Dl(t){return!!go&&go in t}l(Dl,"isMasked");var bh=Dl,wh=Function.prototype,Ph=wh.toString;function Ml(t){if(t!=null){try{return Ph.call(t)}catch{}try{return t+""}catch{}}return""}l(Ml,"toSource");var gt=Ml,kh=/[\\^$.*+?()[\]{}|]/g,Eh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Sh=Object.prototype,Oh=xh.toString,Ch=Sh.hasOwnProperty,Ih=RegExp("^"+Oh.call(Ch).replace(kh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Hl(t){if(!hs(t)||bh(t))return!1;var e=Al(t)?Ih:Eh;return e.test(gt(t))}l(Hl,"baseIsNative");var Bh=Hl;function jl(t,e){return t?.[e]}l(jl,"getValue");var Zh=jl;function Nl(t,e){var r=Zh(t,e);return Bh(r)?r:void 0}l(Nl,"getNative");var ht=Nl,Rh=ht(Ue,"WeakMap"),Ja=Rh,Ah=function(){try{var t=ht(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ho=Ah,Dh=9007199254740991,Mh=/^(?:0|[1-9]\d*)$/;function $l(t,e){var r=typeof t;return e=e??Dh,!!e&&(r=="number"||r!="symbol"&&Mh.test(t))&&t>-1&&t%1==0&&t<e}l($l,"isIndex");var Ul=$l;function Kl(t,e,r){e=="__proto__"&&ho?ho(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}l(Kl,"baseAssignValue");var Hh=Kl;function Fl(t,e){return t===e||t!==t&&e!==e}l(Fl,"eq");var Ll=Fl,jh=9007199254740991;function zl(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=jh}l(zl,"isLength");var ms=zl;function Wl(t){return t!=null&&ms(t.length)&&!Al(t)}l(Wl,"isArrayLike");var Nh=Wl,$h=Object.prototype;function Vl(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||$h;return t===r}l(Vl,"isPrototype");var Uh=Vl;function ql(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}l(ql,"baseTimes");var Kh=ql,Fh="[object Arguments]";function Gl(t){return Mt(t)&&Lt(t)==Fh}l(Gl,"baseIsArguments");var mo=Gl,Jl=Object.prototype,Lh=Jl.hasOwnProperty,zh=Jl.propertyIsEnumerable,Wh=mo(function(){return arguments}())?mo:function(t){return Mt(t)&&Lh.call(t,"callee")&&!zh.call(t,"callee")},Yl=Wh;function Xl(){return!1}l(Xl,"stubFalse");var Vh=Xl,Ql=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yo=Ql&&typeof module=="object"&&module&&!module.nodeType&&module,qh=yo&&yo.exports===Ql,vo=qh?Ue.Buffer:void 0,Gh=vo?vo.isBuffer:void 0,Jh=Gh||Vh,Ya=Jh,Yh="[object Arguments]",Xh="[object Array]",Qh="[object Boolean]",em="[object Date]",tm="[object Error]",rm="[object Function]",nm="[object Map]",am="[object Number]",sm="[object Object]",im="[object RegExp]",om="[object Set]",lm="[object String]",um="[object WeakMap]",cm="[object ArrayBuffer]",dm="[object DataView]",fm="[object Float32Array]",pm="[object Float64Array]",gm="[object Int8Array]",hm="[object Int16Array]",mm="[object Int32Array]",ym="[object Uint8Array]",vm="[object Uint8ClampedArray]",_m="[object Uint16Array]",Tm="[object Uint32Array]",X={};X[fm]=X[pm]=X[gm]=X[hm]=X[mm]=X[ym]=X[vm]=X[_m]=X[Tm]=!0;X[Yh]=X[Xh]=X[cm]=X[Qh]=X[dm]=X[em]=X[tm]=X[rm]=X[nm]=X[am]=X[sm]=X[im]=X[om]=X[lm]=X[um]=!1;function eu(t){return Mt(t)&&ms(t.length)&&!!X[Lt(t)]}l(eu,"baseIsTypedArray");var bm=eu;function tu(t){return function(e){return t(e)}}l(tu,"baseUnary");var wm=tu,ru=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lr=ru&&typeof module=="object"&&module&&!module.nodeType&&module,Pm=lr&&lr.exports===ru,La=Pm&&Pl.process,km=function(){try{var t=lr&&lr.require&&lr.require("util").types;return t||La&&La.binding&&La.binding("util")}catch{}}(),_o=km,To=_o&&_o.isTypedArray,Em=To?wm(To):bm,nu=Em,xm=Object.prototype,Sm=xm.hasOwnProperty;function au(t,e){var r=$e(t),n=!r&&Yl(t),a=!r&&!n&&Ya(t),s=!r&&!n&&!a&&nu(t),o=r||n||a||s,i=o?Kh(t.length,String):[],c=i.length;for(var p in t)(e||Sm.call(t,p))&&!(o&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ul(p,c)))&&i.push(p);return i}l(au,"arrayLikeKeys");var Om=au;function su(t,e){return function(r){return t(e(r))}}l(su,"overArg");var Cm=su,Im=Cm(Object.keys,Object),Bm=Im,Zm=Object.prototype,Rm=Zm.hasOwnProperty;function iu(t){if(!Uh(t))return Bm(t);var e=[];for(var r in Object(t))Rm.call(t,r)&&r!="constructor"&&e.push(r);return e}l(iu,"baseKeys");var Am=iu;function ou(t){return Nh(t)?Om(t):Am(t)}l(ou,"keys");var ys=ou,Dm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mm=/^\w*$/;function lu(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||ps(t)?!0:Mm.test(t)||!Dm.test(t)||e!=null&&t in Object(e)}l(lu,"isKey");var vs=lu,Hm=ht(Object,"create"),ur=Hm;function uu(){this.__data__=ur?ur(null):{},this.size=0}l(uu,"hashClear");var jm=uu;function cu(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}l(cu,"hashDelete");var Nm=cu,$m="__lodash_hash_undefined__",Um=Object.prototype,Km=Um.hasOwnProperty;function du(t){var e=this.__data__;if(ur){var r=e[t];return r===$m?void 0:r}return Km.call(e,t)?e[t]:void 0}l(du,"hashGet");var Fm=du,Lm=Object.prototype,zm=Lm.hasOwnProperty;function fu(t){var e=this.__data__;return ur?e[t]!==void 0:zm.call(e,t)}l(fu,"hashHas");var Wm=fu,Vm="__lodash_hash_undefined__";function pu(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ur&&e===void 0?Vm:e,this}l(pu,"hashSet");var qm=pu;function mt(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(mt,"Hash");mt.prototype.clear=jm;mt.prototype.delete=Nm;mt.prototype.get=Fm;mt.prototype.has=Wm;mt.prototype.set=qm;var bo=mt;function gu(){this.__data__=[],this.size=0}l(gu,"listCacheClear");var Gm=gu;function hu(t,e){for(var r=t.length;r--;)if(Ll(t[r][0],e))return r;return-1}l(hu,"assocIndexOf");var jn=hu,Jm=Array.prototype,Ym=Jm.splice;function mu(t){var e=this.__data__,r=jn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ym.call(e,r,1),--this.size,!0}l(mu,"listCacheDelete");var Xm=mu;function yu(t){var e=this.__data__,r=jn(e,t);return r<0?void 0:e[r][1]}l(yu,"listCacheGet");var Qm=yu;function vu(t){return jn(this.__data__,t)>-1}l(vu,"listCacheHas");var ey=vu;function _u(t,e){var r=this.__data__,n=jn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}l(_u,"listCacheSet");var ty=_u;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,"ListCache");yt.prototype.clear=Gm;yt.prototype.delete=Xm;yt.prototype.get=Qm;yt.prototype.has=ey;yt.prototype.set=ty;var Nn=yt,ry=ht(Ue,"Map"),cr=ry;function Tu(){this.size=0,this.__data__={hash:new bo,map:new(cr||Nn),string:new bo}}l(Tu,"mapCacheClear");var ny=Tu;function bu(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}l(bu,"isKeyable");var ay=bu;function wu(t,e){var r=t.__data__;return ay(e)?r[typeof e=="string"?"string":"hash"]:r.map}l(wu,"getMapData");var $n=wu;function Pu(t){var e=$n(this,t).delete(t);return this.size-=e?1:0,e}l(Pu,"mapCacheDelete");var sy=Pu;function ku(t){return $n(this,t).get(t)}l(ku,"mapCacheGet");var iy=ku;function Eu(t){return $n(this,t).has(t)}l(Eu,"mapCacheHas");var oy=Eu;function xu(t,e){var r=$n(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}l(xu,"mapCacheSet");var ly=xu;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,"MapCache");vt.prototype.clear=ny;vt.prototype.delete=sy;vt.prototype.get=iy;vt.prototype.has=oy;vt.prototype.set=ly;var Un=vt,uy="Expected a function";function Kn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(uy);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 o=t.apply(this,n);return r.cache=s.set(a,o)||s,o},"memoized");return r.cache=new(Kn.Cache||Un),r}l(Kn,"memoize");Kn.Cache=Un;var cy=Kn,dy=500;function Su(t){var e=cy(t,function(n){return r.size===dy&&r.clear(),n}),r=e.cache;return e}l(Su,"memoizeCapped");var fy=Su,py=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gy=/\\(\\)?/g,hy=fy(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(py,function(r,n,a,s){e.push(a?s.replace(gy,"$1"):n||r)}),e}),my=hy;function Ou(t){return t==null?"":gh(t)}l(Ou,"toString");var yy=Ou;function Cu(t,e){return $e(t)?t:vs(t,e)?[t]:my(yy(t))}l(Cu,"castPath");var Iu=Cu,vy=1/0;function Bu(t){if(typeof t=="string"||ps(t))return t;var e=t+"";return e=="0"&&1/t==-vy?"-0":e}l(Bu,"toKey");var Fn=Bu;function Zu(t,e){e=Iu(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(Zu,"baseGet");var Ru=Zu;function Au(t,e,r){var n=t==null?void 0:Ru(t,e);return n===void 0?r:n}l(Au,"get");var _y=Au;function Du(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}l(Du,"arrayPush");var Ty=Du;function Mu(){this.__data__=new Nn,this.size=0}l(Mu,"stackClear");var by=Mu;function Hu(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}l(Hu,"stackDelete");var wy=Hu;function ju(t){return this.__data__.get(t)}l(ju,"stackGet");var Py=ju;function Nu(t){return this.__data__.has(t)}l(Nu,"stackHas");var ky=Nu,Ey=200;function $u(t,e){var r=this.__data__;if(r instanceof Nn){var n=r.__data__;if(!cr||n.length<Ey-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($u,"stackSet");var xy=$u;function _t(t){var e=this.__data__=new Nn(t);this.size=e.size}l(_t,"Stack");_t.prototype.clear=by;_t.prototype.delete=wy;_t.prototype.get=Py;_t.prototype.has=ky;_t.prototype.set=xy;var Lr=_t;function Uu(t,e){for(var r=-1,n=t==null?0:t.length,a=0,s=[];++r<n;){var o=t[r];e(o,r,t)&&(s[a++]=o)}return s}l(Uu,"arrayFilter");var Sy=Uu;function Ku(){return[]}l(Ku,"stubArray");var Oy=Ku,Cy=Object.prototype,Iy=Cy.propertyIsEnumerable,wo=Object.getOwnPropertySymbols,By=wo?function(t){return t==null?[]:(t=Object(t),Sy(wo(t),function(e){return Iy.call(t,e)}))}:Oy,Zy=By;function Fu(t,e,r){var n=e(t);return $e(t)?n:Ty(n,r(t))}l(Fu,"baseGetAllKeys");var Ry=Fu;function Lu(t){return Ry(t,ys,Zy)}l(Lu,"getAllKeys");var Po=Lu,Ay=ht(Ue,"DataView"),Xa=Ay,Dy=ht(Ue,"Promise"),Qa=Dy,My=ht(Ue,"Set"),es=My,ko="[object Map]",Hy="[object Object]",Eo="[object Promise]",xo="[object Set]",So="[object WeakMap]",Oo="[object DataView]",jy=gt(Xa),Ny=gt(cr),$y=gt(Qa),Uy=gt(es),Ky=gt(Ja),it=Lt;(Xa&&it(new Xa(new ArrayBuffer(1)))!=Oo||cr&&it(new cr)!=ko||Qa&&it(Qa.resolve())!=Eo||es&&it(new es)!=xo||Ja&&it(new Ja)!=So)&&(it=l(function(t){var e=Lt(t),r=e==Hy?t.constructor:void 0,n=r?gt(r):"";if(n)switch(n){case jy:return Oo;case Ny:return ko;case $y:return Eo;case Uy:return xo;case Ky:return So}return e},"getTag"));var Co=it,Fy=Ue.Uint8Array,Io=Fy,Ly="__lodash_hash_undefined__";function zu(t){return this.__data__.set(t,Ly),this}l(zu,"setCacheAdd");var zy=zu;function Wu(t){return this.__data__.has(t)}l(Wu,"setCacheHas");var Wy=Wu;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=zy;dr.prototype.has=Wy;var Vy=dr;function Vu(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(Vu,"arraySome");var qy=Vu;function qu(t,e){return t.has(e)}l(qu,"cacheHas");var Gy=qu,Jy=1,Yy=2;function Gu(t,e,r,n,a,s){var o=r&Jy,i=t.length,c=e.length;if(i!=c&&!(o&&c>i))return!1;var p=s.get(t),m=s.get(e);if(p&&m)return p==e&&m==t;var T=-1,C=!0,k=r&Yy?new Vy:void 0;for(s.set(t,e),s.set(e,t);++T<i;){var S=t[T],W=e[T];if(n)var q=o?n(W,S,T,e,t,s):n(S,W,T,t,e,s);if(q!==void 0){if(q)continue;C=!1;break}if(k){if(!qy(e,function(re,J){if(!Gy(k,J)&&(S===re||a(S,re,r,n,s)))return k.push(J)})){C=!1;break}}else if(!(S===W||a(S,W,r,n,s))){C=!1;break}}return s.delete(t),s.delete(e),C}l(Gu,"equalArrays");var Ju=Gu;function Yu(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}l(Yu,"mapToArray");var Xy=Yu;function Xu(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}l(Xu,"setToArray");var Qy=Xu,ev=1,tv=2,rv="[object Boolean]",nv="[object Date]",av="[object Error]",sv="[object Map]",iv="[object Number]",ov="[object RegExp]",lv="[object Set]",uv="[object String]",cv="[object Symbol]",dv="[object ArrayBuffer]",fv="[object DataView]",Bo=Ve?Ve.prototype:void 0,za=Bo?Bo.valueOf:void 0;function Qu(t,e,r,n,a,s,o){switch(r){case fv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case dv:return!(t.byteLength!=e.byteLength||!s(new Io(t),new Io(e)));case rv:case nv:case iv:return Ll(+t,+e);case av:return t.name==e.name&&t.message==e.message;case ov:case uv:return t==e+"";case sv:var i=Xy;case lv:var c=n&ev;if(i||(i=Qy),t.size!=e.size&&!c)return!1;var p=o.get(t);if(p)return p==e;n|=tv,o.set(t,e);var m=Ju(i(t),i(e),n,a,s,o);return o.delete(t),m;case cv:if(za)return za.call(t)==za.call(e)}return!1}l(Qu,"equalByTag");var pv=Qu,gv=1,hv=Object.prototype,mv=hv.hasOwnProperty;function ec(t,e,r,n,a,s){var o=r&gv,i=Po(t),c=i.length,p=Po(e),m=p.length;if(c!=m&&!o)return!1;for(var T=c;T--;){var C=i[T];if(!(o?C in e:mv.call(e,C)))return!1}var k=s.get(t),S=s.get(e);if(k&&S)return k==e&&S==t;var W=!0;s.set(t,e),s.set(e,t);for(var q=o;++T<c;){C=i[T];var re=t[C],J=e[C];if(n)var N=o?n(J,re,C,e,t,s):n(re,J,C,t,e,s);if(!(N===void 0?re===J||a(re,J,r,n,s):N)){W=!1;break}q||(q=C=="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(ec,"equalObjects");var yv=ec,vv=1,Zo="[object Arguments]",Ro="[object Array]",Kr="[object Object]",_v=Object.prototype,Ao=_v.hasOwnProperty;function tc(t,e,r,n,a,s){var o=$e(t),i=$e(e),c=o?Ro:Co(t),p=i?Ro:Co(e);c=c==Zo?Kr:c,p=p==Zo?Kr:p;var m=c==Kr,T=p==Kr,C=c==p;if(C&&Ya(t)){if(!Ya(e))return!1;o=!0,m=!1}if(C&&!m)return s||(s=new Lr),o||nu(t)?Ju(t,e,r,n,a,s):pv(t,e,c,r,n,a,s);if(!(r&vv)){var k=m&&Ao.call(t,"__wrapped__"),S=T&&Ao.call(e,"__wrapped__");if(k||S){var W=k?t.value():t,q=S?e.value():e;return s||(s=new Lr),a(W,q,r,n,s)}}return C?(s||(s=new Lr),yv(t,e,r,n,a,s)):!1}l(tc,"baseIsEqualDeep");var Tv=tc;function _s(t,e,r,n,a){return t===e?!0:t==null||e==null||!Mt(t)&&!Mt(e)?t!==t&&e!==e:Tv(t,e,r,n,_s,a)}l(_s,"baseIsEqual");var Ts=_s,bv=1,wv=2;function rc(t,e,r,n){var a=r.length,s=a,o=!n;if(t==null)return!s;for(t=Object(t);a--;){var i=r[a];if(o&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++a<s;){i=r[a];var c=i[0],p=t[c],m=i[1];if(o&&i[2]){if(p===void 0&&!(c in t))return!1}else{var T=new Lr;if(n)var C=n(p,m,c,t,e,T);if(!(C===void 0?Ts(m,p,bv|wv,n,T):C))return!1}}return!0}l(rc,"baseIsMatch");var Pv=rc;function nc(t){return t===t&&!hs(t)}l(nc,"isStrictComparable");var ac=nc;function sc(t){for(var e=ys(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,ac(a)]}return e}l(sc,"getMatchData");var kv=sc;function ic(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}l(ic,"matchesStrictComparable");var oc=ic;function lc(t){var e=kv(t);return e.length==1&&e[0][2]?oc(e[0][0],e[0][1]):function(r){return r===t||Pv(r,t,e)}}l(lc,"baseMatches");var Ev=lc;function uc(t,e){return t!=null&&e in Object(t)}l(uc,"baseHasIn");var xv=uc;function cc(t,e,r){e=Iu(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var o=Fn(e[n]);if(!(s=t!=null&&r(t,o)))break;t=t[o]}return s||++n!=a?s:(a=t==null?0:t.length,!!a&&ms(a)&&Ul(o,a)&&($e(t)||Yl(t)))}l(cc,"hasPath");var Sv=cc;function dc(t,e){return t!=null&&Sv(t,e,xv)}l(dc,"hasIn");var Ov=dc,Cv=1,Iv=2;function fc(t,e){return vs(t)&&ac(e)?oc(Fn(t),e):function(r){var n=_y(r,t);return n===void 0&&n===e?Ov(r,t):Ts(e,n,Cv|Iv)}}l(fc,"baseMatchesProperty");var Bv=fc;function pc(t){return function(e){return e?.[t]}}l(pc,"baseProperty");var Zv=pc;function gc(t){return function(e){return Ru(e,t)}}l(gc,"basePropertyDeep");var Rv=gc;function hc(t){return vs(t)?Zv(Fn(t)):Rv(t)}l(hc,"property");var Av=hc;function mc(t){return typeof t=="function"?t:t==null?hh:typeof t=="object"?$e(t)?Bv(t[0],t[1]):Ev(t):Av(t)}l(mc,"baseIteratee");var Dv=mc;function yc(t){return function(e,r,n){for(var a=-1,s=Object(e),o=n(e),i=o.length;i--;){var c=o[t?i:++a];if(r(s[c],c,s)===!1)break}return e}}l(yc,"createBaseFor");var Mv=yc,Hv=Mv(),jv=Hv;function vc(t,e){return t&&jv(t,e,ys)}l(vc,"baseForOwn");var Nv=vc;function _c(t,e){return Ts(t,e)}l(_c,"isEqual");var ct=_c;function Tc(t,e){var r={};return e=Dv(e,3),Nv(t,function(n,a,s){Hh(r,a,e(n,a,s))}),r}l(Tc,"mapValues");var $v=Tc;function bs(t){return se(t)}l(bs,"toTypescriptSchema");function se(t){let r=t._def;switch(r.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(r.description)}z.string()`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:return`${Z(r.description)}z.number()`.trim();case v.ZodFirstPartyTypeKind.ZodNaN:return`${Z(r.description)}z.nan()`.trim();case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(r.description)}z.bigint()`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)}z.boolean()`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(r.description)}z.date()`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(r.description)}z.undefined()`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(r.description)}z.null()`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(r.description)}z.any()`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(r.description)}z.unknown()`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(r.description)}z.never()`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(r.description)}z.void()`.trim();case v.ZodFirstPartyTypeKind.ZodArray:return`z.array(${se(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=$v(r.shape(),ue=>ue instanceof v.Schema?se(ue):"z.any()");return[`${Z(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`${Z(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(se),o=He(r.discriminator);return`${Z(r.description)}z.discriminatedUnion(${o}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let i=se(r.left),c=se(r.right);return`${Z(r.description)}z.intersection(${i}, ${c})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(se);return`${Z(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let m=se(r.keyType),T=se(r.valueType);return`${Z(r.description)}z.record(${m}, ${T})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let C=se(r.keyType),k=se(r.valueType);return`${Z(r.description)}z.map(${C}, ${k})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${Z(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`${Z(r.description)}z.function()${W}.returns(${q})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${Z(r.description)}z.lazy(() => ${se(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let re=He(r.value);return`${Z(r.description)}z.literal(${re})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let J=r.values.map(He);return`${Z(r.description)}z.enum([${J.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new st(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new st(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${Z(r.description)}z.optional(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${Z(r.description)}z.nullable(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let N=Qo(r.defaultValue());return`${Z(r.description)}${se(r.innerType)}.default(${N})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new st(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${Z(r.description)}z.promise(${se(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new st(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new st(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new st(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${Z(r.description)}z.readonly(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let F=He(r.uri);return`${Z(r.description)}z.ref(${F})`.trim();default:M.assertNever(r)}}l(se,"sUnwrapZod");var bc=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(bc,"ParseInputLazyPath");var xe=bc,Do=l((t,e)=>{if(jt(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"),wc=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 Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(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:Me(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:Me(e)},s=this._parseSync({data:e,path:a.path,parent:a});return Do(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:Me(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(pr(a)?a:Promise.resolve(a));return Do(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 o=e(a),i=l(()=>s.addIssue(d({code:_.custom},n(a))),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!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 je.create(this,this._def)}nullable(){return dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.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({},R(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({},R(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Wn(d({typeName:"ZodBranded",type:this},R(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Vn(h(d({},R(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 bs(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 Ut(e,r)}static fromJsonSchema(e){return Tr(e)}};l(wc,"ZodType");var D=wc,ws=(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))(ws||{}),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 o of a)s[o]=o;return s},"arrayToEnum"),t.getValidEnumValues=l(a=>{let s=(0,t.objectKeys)(a).filter(i=>typeof a[a[i]]!="number"),o={};for(let i of s)o[i]=a[i];return(0,t.objectValues)(o)},"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 o in a)Object.prototype.hasOwnProperty.call(a,o)&&s.push(o);return s},t.find=l((a,s)=>{for(let o of a)if(s(o))return o},"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(o=>typeof o=="string"?`'${o}'`:o).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 P=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=l(t=>{switch(typeof t){case"undefined":return P.undefined;case"string":return P.string;case"number":return isNaN(t)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(t)?P.array:t===null?P.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?P.promise:typeof Map<"u"&&t instanceof Map?P.map:typeof Set<"u"&&t instanceof Set?P.set:typeof Date<"u"&&t instanceof Date?P.date:P.object;default:return P.unknown}},"getParsedType");function R(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((o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:r??i.defaultError},"customMap"),description:a,[K]:t?.[K]}}l(R,"processCreateParams");var Ps=l((t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===P.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"),Mo=Ps,_=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"]),Pc=l(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),tn=class kc 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 o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,c=0;for(;c<o.path.length;){let p=o.path[c];c===o.path.length-1?(i[p]=i[p]||{_errors:[]},i[p]._errors.push(r(o))):i[p]=i[p]||{_errors:[]},i=i[p],c++}}},"processError");return a(this),n}static assert(e){if(!(e instanceof kc))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,Ec=Ps;function ks(t){Ec=t}l(ks,"setErrorMap");function Ht(){return Ec}l(Ht,"getErrorMap");var fr=l(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,o=[...n,...s.path||[]],i=h(d({},s),{path:o}),c="",p=a.filter(m=>!!m).slice().reverse();for(let m of p)c=m(i,{data:r,defaultError:c}).message;return h(d({},s),{path:o,message:(e=s.message)!=null?e:c})},"makeIssue"),xc=[];function w(t,e){let r=fr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ht(),Ps].filter(n=>!!n)});t.common.issues.push(r)}l(w,"addIssueToContext");var Sc=class Oc{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 Oc.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:o}=a;if(s.status==="aborted"||o.status==="aborted")return I;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}};l(Sc,"ParseStatus");var ve=Sc,I=Object.freeze({status:"aborted"}),ut=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"),jt=l(t=>t.status==="valid","isValid"),pr=l(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),O;(t=>{t.errToObj=l(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=l(e=>typeof e=="string"?e:e?.message,"toString")})(O||(O={}));var an=class Cc extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Cc}};l(an,"ZodAny");an.create=l(t=>new an(d({typeName:"ZodAny"},R(t))),"create");var gr=an,sn=class Ct extends D{dereference(e){return new Ct(h(d({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}isEqual(e){var r,n,a,s,o,i;return e instanceof Ct?ct((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&ct((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&ct((o=this._def.minLength)==null?void 0:o.value,(i=e._def.minLength)==null?void 0:i.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!==P.array)return w(r,{code:_.invalid_type,expected:P.array,received:r.parsedType}),I;if(a.exactLength!==null){let o=r.data.length>a.exactLength.value,i=r.data.length<a.exactLength.value;(o||i)&&(w(r,{code:o?_.too_big:_.too_small,minimum:i?a.exactLength.value:void 0,maximum:o?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&&(w(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&&(w(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((o,i)=>a.type._parseAsync(new xe(r,o,r.path,i)))).then(o=>ve.mergeArray(n,o));let s=[...r.data].map((o,i)=>a.type._parseSync(new xe(r,o,r.path,i)));return ve.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ct(h(d({},this._def),{minLength:{value:e,message:O.toString(r)}}))}max(e,r){return new Ct(h(d({},this._def),{maxLength:{value:e,message:O.toString(r)}}))}length(e,r){return new Ct(h(d({},this._def),{exactLength:{value:e,message:O.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"},R(e))),"create");var Nt=sn,Uv={compare:ct},Ic=class{constructor(e=[],r={}){this._options=d(d({},Uv),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(Ic,"CustomSet");var le=Ic,on=class zr extends D{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)!==P.bigint){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.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),w(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),w(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),w(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,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.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:O.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:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.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},R(t)))},"create");var Ln=on,ln=class Bc extends D{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==P.boolean){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.boolean,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Bc?this._def.coerce===e._def.coerce:!1}};l(ln,"ZodBoolean");ln.create=l(t=>new ln(d({typeName:"ZodBoolean",coerce:t?.coerce||!1},R(t))),"create");var zn=ln,Zc=Symbol("zod_brand"),Rc=class Ac extends D{_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 Ac?this._def.type.isEqual(e._def.type):!1}};l(Rc,"ZodBranded");var Wn=Rc,un=class Dc extends D{_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 Dc?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},R(e))),"create");var Vn=un,Es=l((t,e={},r)=>t?gr.create().superRefine((n,a)=>{var s,o;if(!t(n)){let i=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(s=i.fatal)!=null?s:r)!=null?o:!0,p=typeof i=="string"?{message:i}:i;a.addIssue(h(d({code:"custom"},p),{fatal:c}))}}):gr.create(),"custom"),cn=class ts extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.date,received:s.parsedType}),I}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return w(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),w(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),w(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 ts(h(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.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 ts))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"},R(t))),"create");var qn=cn,dn=class rs extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===P.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 rs(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof rs?this._def.innerType.isEqual(e._def.innerType)&&ct(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},R(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 Tt?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 je?[void 0,...De(t.unwrap())]:t instanceof dt?[null,...De(t.unwrap())]:t instanceof Wn||t instanceof _r?De(t.unwrap()):t instanceof Vn?De(t._def.innerType):[],"getDiscriminator"),Mc=class It extends D{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=It._getOptionsMap(this.discriminator,r);return new It(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!==P.object)return w(r,{code:_.invalid_type,expected:P.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}):(w(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=It._getOptionsMap(e,r);return new It(d({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},R(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 o of s){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return n}isEqual(e){if(!(e instanceof It)||this._def.discriminator!==e._def.discriminator)return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le(this._def.options,{compare:r}),a=new le(e._def.options,{compare:r});return n.isEqual(a)}};l(Mc,"ZodDiscriminatedUnion");var xs=Mc;function yr(t,e){return new Tt(d({values:t,typeName:"ZodEnum"},R(e)))}l(yr,"createZodEnum");var Ss=class Wr extends D{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return w(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 w(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(Ss,"ZodEnum");Ss.create=yr;var Tt=Ss,Hc=class Bt extends D{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new Bt(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!==P.function)return w(r,{code:_.invalid_type,expected:P.function,received:r.parsedType}),I;function n(i,c){return fr({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ht(),Mo].filter(p=>!!p),issueData:{code:_.invalid_arguments,argumentsError:c}})}l(n,"makeArgsIssue");function a(i,c){return fr({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ht(),Mo].filter(p=>!!p),issueData:{code:_.invalid_return_type,returnTypeError:c}})}l(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof vr){let i=this;return pe(async function(...c){let p=new Be([]),m=await i._def.args.parseAsync(c,s).catch(k=>{throw p.addIssue(n(c,k)),p}),T=await Reflect.apply(o,this,m);return await i._def.returns._def.type.parseAsync(T,s).catch(k=>{throw p.addIssue(a(T,k)),p})})}else{let i=this;return pe(function(...c){let p=i._def.args.safeParse(c,s);if(!p.success)throw new Be([n(c,p.error)]);let m=Reflect.apply(o,this,p.data),T=i._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 Bt(h(d({},this._def),{args:pt.create(e).rest(At.create())}))}returns(e){return new Bt(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 Bt(d({args:e||pt.create([]).rest(At.create()),returns:r||At.create(),typeName:"ZodFunction"},R(n)))}isEqual(e){return e instanceof Bt&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};l(Hc,"ZodFunction");var Os=Hc;function fn(t,e){let r=Me(t),n=Me(e);if(t===e)return{valid:!0,data:t};if(r===P.object&&n===P.object){let a=M.objectKeys(e),s=M.objectKeys(t).filter(i=>a.indexOf(i)!==-1),o=d(d({},t),e);for(let i of s){let c=fn(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===P.array&&n===P.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let o=t[s],i=e[s],c=fn(o,i);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===P.date&&n===P.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}l(fn,"mergeValues");var pn=class ns extends D{dereference(e){return new ns(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,o)=>{if(rn(s)||rn(o))return I;let i=fn(s.value,o.value);return i.valid?((nn(s)||nn(o))&&r.dirty(),{status:r.value,value:i.data}):(w(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,o])=>a(s,o)):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 ns))return!1;let r=l((s,o)=>s.isEqual(o),"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"},R(r))),"create");var Gn=pn,gn=class jc extends D{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 jc?this._def.getter().isEqual(e._def.getter()):!1}};l(gn,"ZodLazy");gn.create=l((t,e)=>new gn(d({getter:t,typeName:"ZodLazy"},R(e))),"create");var Jn=gn,hn=class Nc extends D{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return w(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 Nc?ct(this._def.value,e._def.value):!1}};l(hn,"ZodLiteral");hn.create=l((t,e)=>new hn(d({value:t,typeName:"ZodLiteral"},R(e))),"create");var Yn=hn,mn=class as extends D{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 as(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!==P.map)return w(n,{code:_.invalid_type,expected:P.map,received:n.parsedType}),I;let a=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,c],p)=>({key:a._parse(new xe(n,i,n.path,[p,"key"])),value:s._parse(new xe(n,c,n.path,[p,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){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(),i.set(p.value,m.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let c of o){let p=c.key,m=c.value;if(p.status==="aborted"||m.status==="aborted")return I;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),i.set(p.value,m.value)}return{status:r.value,value:i}}}isEqual(e){return!(!(e instanceof as)||!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"},R(r))),"create");var Cs=mn,yn=class $c extends D{_parse(e){if(this._getType(e)!==P.nan){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.nan,received:n.parsedType}),I}return{status:"valid",value:e.data}}isEqual(e){return e instanceof $c}};l(yn,"ZodNaN");yn.create=l(t=>new yn(d({typeName:"ZodNaN"},R(t))),"create");var Is=yn,vn=class Uc extends D{_parse(e){let r=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==P.string&&n.parsedType!==P.number){let a=M.objectValues(r);return w(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),I}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return w(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 Uc?ct(this._def.values,e._def.values):!1}};l(vn,"ZodNativeEnum");vn.create=l((t,e)=>new vn(d({values:t,typeName:"ZodNativeEnum"},R(e))),"create");var Xn=vn,_n=class Kc extends D{_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.invalid_type,expected:P.never,received:r.parsedType}),I}isEqual(e){return e instanceof Kc}};l(_n,"ZodNever");_n.create=l(t=>new _n(d({typeName:"ZodNever"},R(t))),"create");var qe=_n,Tn=class Fc extends D{_parse(e){if(this._getType(e)!==P.null){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.null,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Fc}};l(Tn,"ZodNull");Tn.create=l(t=>new Tn(d({typeName:"ZodNull"},R(t))),"create");var Qn=Tn,bn=class ss extends D{dereference(e){return new ss(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===P.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ss?this._def.innerType.isEqual(e._def.innerType):!1}};l(bn,"ZodNullable");bn.create=l((t,e)=>new bn(d({innerType:t,typeName:"ZodNullable"},R(e))),"create");var dt=bn;function Lc(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(".","")),o=parseInt(e.toFixed(a).replace(".",""));return s%o/Math.pow(10,a)}l(Lc,"floatSafeRemainder");var wn=class Vr extends D{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)!==P.number){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.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),w(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),w(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),w(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Lc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),w(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),w(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,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.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:O.toString(a)}]}))}_addCheck(e){return new Vr(h(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.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},R(t))),"create");var ea=wn;function lt(t){if(t instanceof ft){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=je.create(lt(n))}return new ft(h(d({},t._def),{shape:l(()=>e,"shape")}))}else return t instanceof Nt?new Nt(h(d({},t._def),{type:lt(t.element)})):t instanceof je?je.create(lt(t.unwrap())):t instanceof dt?dt.create(lt(t.unwrap())):t instanceof pt?pt.create(t.items.map(e=>lt(e))):t}l(lt,"deepPartialify");var Ge=class Ee extends D{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)!==P.object){let p=this._getOrReturnCtx(e);return w(p,{code:_.invalid_type,expected:P.object,received:p.parsedType}),I}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof qe&&this._def.unknownKeys==="strip"))for(let p in a.data)o.includes(p)||i.push(p);let c=[];for(let p of o){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 i)c.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(p==="strict")i.length>0&&(w(a,{code:_.unrecognized_keys,keys:i}),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 i){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 O.errToObj,new Ee(d(h(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:l((r,n)=>{var a,s,o,i;let c=(o=(s=(a=this._def).errorMap)==null?void 0:s.call(a,r,n).message)!=null?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(i=O.errToObj(e).message)!=null?i: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 lt(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 je;)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((i,c)=>i[0]===c[0]&&i[1].isEqual(c[1]),"compare"),s=new le(Object.entries(r),{compare:a}),o=new le(Object.entries(n),{compare:a});return s.isEqual(o)}};l(Ge,"ZodObject");Ge.create=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},R(e))),"create");Ge.strictCreate=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},R(e))),"strictCreate");Ge.lazycreate=l((t,e)=>new Ge(d({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},R(e))),"lazycreate");var ft=Ge,Pn=class is extends D{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)===P.undefined?pe(void 0):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(Pn,"ZodOptional");Pn.create=l((t,e)=>new Pn(d({innerType:t,typeName:"ZodOptional"},R(e))),"create");var je=Pn,zc=class qr extends D{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(),ut(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(zc,"ZodPipeline");var ta=zc,kn=class os extends D{unwrap(){return this._def.type}dereference(e){return new os(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!==P.promise&&r.common.async===!1)return w(r,{code:_.invalid_type,expected:P.promise,received:r.parsedType}),I;let n=r.parsedType===P.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 os?this._def.type.isEqual(e._def.type):!1}};l(kn,"ZodPromise");kn.create=l((t,e)=>new kn(d({type:t,typeName:"ZodPromise"},R(e))),"create");var vr=kn,En=class ls extends D{dereference(e){return new ls(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 jt(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ls?this._def.innerType.isEqual(e._def.innerType):!1}};l(En,"ZodReadonly");En.create=l((t,e)=>new En(d({innerType:t,typeName:"ZodReadonly"},R(e))),"create");var _r=En,Wc=class ar extends D{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!==P.object)return w(n,{code:_.invalid_type,expected:P.object,received:n.parsedType}),I;let a=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)a.push({key:s._parse(new xe(n,i,n.path,i)),value:o._parse(new xe(n,n.data[i],n.path,i))});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 D?new ar(d({keyType:e,valueType:r,typeName:"ZodRecord"},R(n))):new ar(d({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},R(r)))}isEqual(e){return!(!(e instanceof ar)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(Wc,"ZodRecord");var Bs=Wc,xn=class Vc extends D{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.unresolved_reference}),I}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Vc?this._def.uri===e._def.uri:!1}};l(xn,"ZodRef");xn.create=l(t=>new xn({typeName:"ZodRef",uri:t}),"create");var Zs=xn,Sn=class sr extends D{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!==P.set)return w(n,{code:_.invalid_type,expected:P.set,received:n.parsedType}),I;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(w(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&&(w(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 o(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(o,"finalizeSet");let i=[...n.data.values()].map((c,p)=>s._parse(new xe(n,c,n.path,p)));return n.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,r){return new sr(h(d({},this._def),{minSize:{value:e,message:O.toString(r)}}))}max(e,r){return new sr(h(d({},this._def),{maxSize:{value:e,message:O.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 o=(r=this._def.minSize)==null?void 0:r.value,i=(n=e._def.minSize)==null?void 0:n.value;if(o!==i)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"},R(e))),"create");var Rs=Sn,As=/^c[^\s-]{8,}$/i,Ds=/^[a-z][a-z0-9]*$/,Ms=/^[0-9A-HJKMNP-TV-Z]{26}$/,Hs=/^[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,qc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gc=l(t=>t===qc,"isEmojiRegex"),Wa,Ns=/^(((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}))$/,$s=/^(([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})))$/,Us=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 Jc(t,e){return!!((e==="v4"||!e)&&Ns.test(t)||(e==="v6"||!e)&&$s.test(t))}l(Jc,"isValidIP");var On=class Zt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.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),w(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),w(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(a=this._getOrReturnCtx(e,a),o?w(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&w(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),w(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Wa||(Wa=new RegExp(qc,"u")),Wa.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"emoji",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Hs.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"uuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")As.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Ds.test(e.data)||(a=this._getOrReturnCtx(e,a),w(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),w(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),w(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),w(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),w(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),w(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),w(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Us(s).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?Jc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),w(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},O.errToObj(n)))}_addCheck(e){return new Zt(h(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},O.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},O.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},O.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},O.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},O.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},O.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},O.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},O.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},O.errToObj(e?.message)))}regex(e,r){return this._addCheck(d({kind:"regex",regex:e},O.errToObj(r)))}includes(e,r){return this._addCheck(d({kind:"includes",value:e,position:r?.position},O.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(d({kind:"startsWith",value:e},O.errToObj(r)))}endsWith(e,r){return this._addCheck(d({kind:"endsWith",value:e},O.errToObj(r)))}min(e,r){return this._addCheck(d({kind:"min",value:e},O.errToObj(r)))}max(e,r){return this._addCheck(d({kind:"max",value:e},O.errToObj(r)))}length(e,r){return this._addCheck(d({kind:"length",value:e},O.errToObj(r)))}nonempty(e){return this.min(1,O.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},R(t)))},"create");var ge=On,Cn=class Yc extends D{_parse(e){if(this._getType(e)!==P.symbol){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.symbol,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Yc}};l(Cn,"ZodSymbol");Cn.create=l(t=>new Cn(d({typeName:"ZodSymbol"},R(t))),"create");var Ks=Cn,$t=class us extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new us(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(o=>{w(n,o),o.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let o=a.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return I;let c=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return c.status==="aborted"?I:c.status==="dirty"||r.value==="dirty"?ut(c.value):c});{if(r.value==="aborted")return I;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?I:i.status==="dirty"||r.value==="dirty"?ut(i.value):i}}if(a.type==="refinement"){let o=l(i=>{let c=a.refinement(i,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 i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?I:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?I:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(a.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!jt(o))return o;let i=a.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>jt(o)?Promise.resolve(a.transform(o.value,s)).then(i=>({status:r.value,value:i})):o);M.assertNever(a)}isEqual(e){return!(e instanceof us)||!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($t,"ZodEffects");$t.create=l((t,e,r)=>new $t(d({schema:t,typeName:"ZodEffects",effect:e},R(r))),"create");$t.createWithPreprocess=l((t,e,r)=>new $t(d({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},R(r))),"createWithPreprocess");var Je=$t,In=class Gr extends D{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!==P.array)return w(n,{code:_.invalid_type,expected:P.array,received:n.parsedType}),I;if(n.data.length<this._def.items.length)return w(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&&(w(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new xe(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>ve.mergeArray(r,o)):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,o)=>s.isEqual(o),"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},R(e)))},"create");var pt=In,Bn=class Xc extends D{_parse(e){if(this._getType(e)!==P.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.undefined,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Xc}};l(Bn,"ZodUndefined");Bn.create=l(t=>new Bn(d({typeName:"ZodUndefined"},R(t))),"create");var ra=Bn,Zn=class cs extends D{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new cs(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 i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Be(i.ctx.common.issues));return w(r,{code:_.invalid_union,unionErrors:o}),I}if(l(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let o=h(d({},r),{common:h(d({},r.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let s,o=[];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&&o.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(c=>new Be(c));return w(r,{code:_.invalid_union,unionErrors:i}),I}}get options(){return this._def.options}isEqual(e){if(!(e instanceof cs))return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le([...this._def.options],{compare:r}),a=new le([...e._def.options],{compare:r});return n.isEqual(a)}};l(Zn,"ZodUnion");Zn.create=l((t,e)=>new Zn(d({options:t,typeName:"ZodUnion"},R(e))),"create");var na=Zn,Rn=class Qc extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Qc}};l(Rn,"ZodUnknown");Rn.create=l(t=>new Rn(d({typeName:"ZodUnknown"},R(t))),"create");var At=Rn,An=class ed extends D{_parse(e){if(this._getType(e)!==P.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.void,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof ed}};l(An,"ZodVoid");An.create=l(t=>new An(d({typeName:"ZodVoid"},R(t))),"create");var Fs=An,Kv=/^\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))?$/,Ut=l((t,e,r=!0)=>{if(typeof t!="object")throw new qa("Input must be an object");let n=l(o=>{let i=o;return e?.nullable&&(i=i.nullable()),e?.optional&&(i=i.optional()),e?.passtrough&&typeof i.passthrough=="function"&&(i=i.passthrough()),i},"applyOptions"),a=Object.entries(t).reduce((o,[i,c])=>{if(c===null)o[i]=n(E.null());else switch(typeof c){case"string":o[i]=Kv.test(c)?n(E.string().datetime()):n(E.string());break;case"number":o[i]=n(E.number());break;case"boolean":o[i]=n(E.boolean());break;case"object":Array.isArray(c)?c.length===0?o[i]=n(E.array(E.unknown())):typeof c[0]=="object"?o[i]=n(E.array(Ut(c[0],e,!1))):["string","number","boolean"].includes(typeof c[0])&&(o[i]=n(E.array(E[typeof c[0]]()))):o[i]=n(Ut(c,e,!1));break;default:throw new qa(`Unsupported type for key ${i}`)}return o},{}),s=Object.keys(a).length>0;return e?.passtrough||!r&&!s?E.object(a).passthrough():E.object(a)},"objectToZui");function td(){return{}}l(td,"parseAnyDef");function Ls(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=h(d({},t.errorMessage),{[e]:r}))}l(Ls,"addErrorMessage");function G(t,e,r,n,a){t[e]=r,Ls(t,e,n,a)}l(G,"setResponseValueAndErrors");function rd(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(rd,"parseArrayDef");function nd(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(nd,"parseBigintDef");function ad(t){return d({type:"boolean"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(ad,"parseBooleanDef");function sd(t,e){return V(t.type._def,e)}l(sd,"parseBrandedDef");var Fv=l((t,e)=>V(t.innerType._def,e),"parseCatchDef");function id(t,e){return e.dateStrategy=="integer"?Lv(t,e):d({type:"string",format:"date-time"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(id,"parseDateDef");var Lv=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 od(t,e){return h(d({},V(t.innerType._def,e)),{default:t.defaultValue()})}l(od,"parseDefaultDef");function ld(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):{}}l(ld,"parseEffectsDef");function ud(t){return{type:"string",enum:t.values}}l(ud,"parseEnumDef");var zv=l(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function cd(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(zv(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let i=s,{additionalProperties:c}=i;o=Uo(i,["additionalProperties"])}else n=void 0;a.push(o)}}),a.length?d({allOf:a},n):void 0}l(cd,"parseIntersectionDef");function dd(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(dd,"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 zs(t,e){let r=d({type:"string"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?Wv(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":at(r,"email",a.message,e);break;case"format:idn-email":at(r,"idn-email",a.message,e);break;case"pattern:zod":Ae(r,nr.email,a.message,e);break}break;case"url":at(r,"uri",a.message,e);break;case"uuid":at(r,"uuid",a.message,e);break;case"regex":Ae(r,a.regex.source,a.message,e);break;case"cuid":Ae(r,nr.cuid,a.message,e);break;case"cuid2":Ae(r,nr.cuid2,a.message,e);break;case"startsWith":Ae(r,"^"+n(a.value),a.message,e);break;case"endsWith":Ae(r,n(a.value)+"$",a.message,e);break;case"datetime":at(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":{Ae(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&at(r,"ipv4",a.message,e),a.version!=="v4"&&at(r,"ipv6",a.message,e);break}case"emoji":Ae(r,nr.emoji,a.message,e);break;case"ulid":{Ae(r,nr.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}l(zs,"parseStringDef");var Wv=l(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),at=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"),Ae=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 Ws(t,e){var r,n,a,s,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((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 i={type:"object",additionalProperties:(n=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:{}};if(e.target==="openApi3")return i;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let c=Object.entries(zs(t.keyType._def,e)).reduce((p,[m,T])=>m==="type"?p:h(d({},p),{[m]:T}),{});return h(d({},i),{propertyNames:c})}else if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodEnum")return h(d({},i),{propertyNames:{enum:t.keyType._def.values}});return i}l(Ws,"parseRecordDef");function fd(t,e){if(e.mapStrategy==="record")return Ws(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(fd,"parseMapDef");function pd(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(pd,"parseNativeEnumDef");function gd(){return{not:{}}}l(gd,"parseNeverDef");function hd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}l(hd,"parseNullDef");var Dn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function md(t,e){if(e.target==="openApi3")return Ho(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 o=Dn[s._def.typeName];return o&&!a.includes(o)?[...a,o]: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 o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];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,o,i)=>i.indexOf(s)===o);return{type:a.length>1?a:a[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._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 Ho(t,e)}l(md,"parseUnionDef");var Ho=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 yd(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(yd,"parseNullableDef");function vd(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",Ls(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(vd,"parseNumberDef");function _d(t,e){var r;let n=h(d({type:"object"},Object.entries(t.shape()).reduce((a,[s,o])=>{if(o===void 0||o._def===void 0)return a;let i=V(o._def,h(d({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return i===void 0?a:{properties:h(d({},a.properties),{[s]:i}),required:o.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(_d,"parseObjectDef");var Vv=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"),qv=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 Td(t,e){return V(t.type._def,e)}l(Td,"parsePromiseDef");function bd(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(bd,"parseSetDef");function wd(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(wd,"parseTupleDef");function Pd(){return{not:{}}}l(Pd,"parseUndefinedDef");function kd(){return{}}l(kd,"parseUnknownDef");var Gv=l((t,e)=>V(t.innerType._def,e),"parseReadonlyDef");function Ed(t){return{$ref:t.uri}}l(Ed,"parseRefDef");function V(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let o=Jv(n,e);if(o!==void 0)return o}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=Xv(t,t.typeName,e);return s&&Qv(t,e,s),a.jsonSchema=s,s}l(V,"parseDef");var Jv=l((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Yv(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"),Yv=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"),Xv=l((t,e,r)=>{switch(e){case"ZodString":return zs(t,r);case"ZodNumber":return vd(t,r);case"ZodObject":return _d(t,r);case"ZodBigInt":return nd(t,r);case"ZodBoolean":return ad(t);case"ZodDate":return id(t,r);case"ZodUndefined":return Pd();case"ZodNull":return hd(r);case"ZodArray":return rd(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return md(t,r);case"ZodIntersection":return cd(t,r);case"ZodTuple":return wd(t,r);case"ZodRecord":return Ws(t,r);case"ZodRef":return Ed(t);case"ZodLiteral":return dd(t,r);case"ZodEnum":return ud(t);case"ZodNativeEnum":return pd(t);case"ZodNullable":return yd(t,r);case"ZodOptional":return Vv(t,r);case"ZodMap":return fd(t,r);case"ZodSet":return bd(t,r);case"ZodLazy":return V(t.getter()._def,r);case"ZodPromise":return Td(t,r);case"ZodNaN":case"ZodNever":return gd();case"ZodEffects":return ld(t,r);case"ZodAny":return td();case"ZodUnknown":return kd();case"ZodDefault":return od(t,r);case"ZodBranded":return sd(t,r);case"ZodReadonly":return Gv(t,r);case"ZodCatch":return Fv(t,r);case"ZodPipeline":return qv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),Qv=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"),jo={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"},e_=l(t=>typeof t=="string"?h(d({},jo),{name:t}):d(d({},jo),t),"getDefaultOptions"),t_=l(t=>{let e=e_(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"),r_=l((t,e)=>{var r;let n=t_(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,o=(r=V(t._def,s===void 0?n:h(d({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},i=s===void 0?a?h(d({},o),{[n.definitionPath]:a}):o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:h(d({},a),{[s]:o})};return n.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),i},"zodToJsonSchema"),aa=l((t,e={target:"openApi3"})=>{let r=r_(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),n_=["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"],HT=Tt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),xd=l(t=>ge.create().displayAs({id:"variable",params:d({type:t?.type||"any"},t?.params)}),"variable"),Sd=l(t=>ge.create().displayAs({id:"conversation",params:d({},t?.params)}),"conversation"),Od=l(t=>ge.create().displayAs({id:"user",params:d({},t?.params)}),"user"),Cd=l(t=>ge.create().displayAs({id:"message",params:d({},t?.params)}),"message"),Id=l(t=>ge.create().displayAs({id:"agent",params:d({},t?.params)}),"agent"),Bd=l(t=>ge.create().displayAs({id:"event",params:d({},t?.params)}),"event"),Zd=l(t=>ge.create().displayAs({id:"table",params:d({},t?.params)}),"table"),Rd=l(t=>ge.create().displayAs({id:"tablerow",params:d({},t?.params)}),"tablerow"),Ad=l(t=>ge.create().displayAs({id:"intent",params:d({},t?.params)}),"intent"),Dd=l(()=>Tt.create(n_).displayAs({id:"dropdown",params:{}}),"aimodel"),Md=l(t=>ge.create().displayAs({id:"datasource",params:d({},t)}),"datasource"),Hd=l(t=>ge.create().displayAs({id:"knowledgebase",params:d({},t)}),"knowledgebase"),jd={object:ft.lazycreate},Nd=l((t,e={message:`Input not instance of ${t.name}`})=>Es(r=>r instanceof t,e),"instanceOfType"),Vs=ge.create,qs=ea.create,$d=Is.create,Ud=Ln.create,Gs=zn.create,Kd=qn.create,Fd=Ks.create,Ld=ra.create,zd=Qn.create,Wd=gr.create,Vd=At.create,qd=qe.create,Gd=Fs.create,Jd=Nt.create,Yd=ft.create,Xd=ft.strictCreate,Qd=na.create,ef=xs.create,tf=Gn.create,rf=pt.create,nf=Bs.create,af=Zs.create,sf=_r.create,of=Cs.create,lf=Rs.create,uf=Os.create,cf=Jn.create,df=Yn.create,ff=Tt.create,pf=Xn.create,gf=vr.create,ds=Je.create,hf=je.create,mf=dt.create,a_=mr.create,yf=Je.createWithPreprocess,vf=ta.create,_f=l(()=>Vs().optional(),"ostring"),Tf=l(()=>qs().optional(),"onumber"),bf=l(()=>Gs().optional(),"oboolean"),wf=D.fromJsonSchema,Pf=D.fromObject,kf={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")},Ef=I,v=E,xf=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"),s_=l(t=>{var e;return(e=t[K])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),i_=l(t=>"z.any()","parseDefault"),o_=l((t,e)=>`z.union([${t.type.map(r=>ce(h(d({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),l_=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"),u_=l(t=>"z.null()","parseNull"),c_=l(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),d_=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 o=r({value:a,json:JSON.stringify(a)});if(o){let i=o[0],c=o.length===3?o[1]:"",p=o.length===3?o[2]:o[1];s+=i,((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"),f_=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]=c_(f_(t.allOf));return`z.intersection(${hr({allOf:r},e)}, ${hr({allOf:n},e)})`}}l(hr,"parseAllOf");var p_=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"),g_=l(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),h_=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"),m_=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) => {
34
34
  const result = ${r}.safeParse(value).success
35
35
  ? ${n}.safeParse(value)
36
36
  : ${a}.safeParse(value);
37
37
  if (!result.success) {
38
38
  result.error.errors.forEach((error) => ctx.addIssue(error))
39
39
  }
40
- })`},"parseIfThenElse"),v_=l(t=>{var e;let r="z.number()";return(e=t[F])!=null&&e.coerce&&(r="z.coerce.number()"),t.type==="integer"?r+=fe(t,"type",()=>[".int(",")"]):r+=fe(t,"format",({value:n})=>{if(n==="int64")return[".int(",")"]}),r+=fe(t,"multipleOf",({value:n,json:a})=>n===1?r.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${a}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?r+=fe(t,"minimum",({json:n})=>[`.gt(${n}`,", ",")"]):r+=fe(t,"minimum",({json:n})=>[`.gte(${n}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(r+=fe(t,"exclusiveMinimum",({json:n})=>[`.gt(${n}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?r+=fe(t,"maximum",({json:n})=>[`.lt(${n}`,", ",")"]):r+=fe(t,"maximum",({json:n})=>[`.lte(${n}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(r+=fe(t,"exclusiveMaximum",({json:n})=>[`.lt(${n}`,", ",")"])),r},"parseNumber"),Ys=l((t,e)=>t.oneOf.length?t.oneOf.length===1?ce(t.oneOf[0],m(d({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
41
- const schemas = [${t.oneOf.map((r,n)=>ce(r,m(d({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
40
+ })`},"parseIfThenElse"),y_=l(t=>{var e;let r="z.number()";return(e=t[K])!=null&&e.coerce&&(r="z.coerce.number()"),t.type==="integer"?r+=fe(t,"type",()=>[".int(",")"]):r+=fe(t,"format",({value:n})=>{if(n==="int64")return[".int(",")"]}),r+=fe(t,"multipleOf",({value:n,json:a})=>n===1?r.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${a}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?r+=fe(t,"minimum",({json:n})=>[`.gt(${n}`,", ",")"]):r+=fe(t,"minimum",({json:n})=>[`.gte(${n}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(r+=fe(t,"exclusiveMinimum",({json:n})=>[`.gt(${n}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?r+=fe(t,"maximum",({json:n})=>[`.lt(${n}`,", ",")"]):r+=fe(t,"maximum",({json:n})=>[`.lte(${n}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(r+=fe(t,"exclusiveMaximum",({json:n})=>[`.lt(${n}`,", ",")"])),r},"parseNumber"),Js=l((t,e)=>t.oneOf.length?t.oneOf.length===1?ce(t.oneOf[0],h(d({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
41
+ const schemas = [${t.oneOf.map((r,n)=>ce(r,h(d({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
42
42
  const errors = schemas.reduce(
43
43
  (errors: z.ZodError[], schema) =>
44
44
  ((result) => ("error" in result ? [...errors, result.error] : errors))(
@@ -54,13 +54,13 @@ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(He).join(
54
54
  message: "Invalid input: Should pass single schema",
55
55
  });
56
56
  }
57
- })`:"z.any()","parseOneOf");function Of(t,e){let r;t.properties&&(Object.keys(t.properties).length?(r="z.object({ ",r+=Object.keys(t.properties).map(i=>{let o=t.properties[i],c=`${JSON.stringify(i)}: ${ce(o,m(d({},e),{path:[...e.path,"properties",i]}))}`,p=typeof o=="object"&&o.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,h=Array.isArray(t.required)?t.required.includes(i):typeof o=="object"&&o.required===!0;return!p&&!h?`${c}.optional()`:c}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?ce(t.additionalProperties,m(d({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([o,c])=>[o,ce(c,m(d({},e),{path:[...e.path,"patternProperties",o]}))],{}));a="",r?n?a+=`.catchall(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:a+=`.catchall(${Object.values(i)})`:n?a+=`z.record(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`z.record(z.union([${Object.values(i).join(", ")}]))`:a+=`z.record(${Object.values(i)})`,a+=`.superRefine((value, ctx) => {
57
+ })`:"z.any()","parseOneOf");function Sf(t,e){let r;t.properties&&(Object.keys(t.properties).length?(r="z.object({ ",r+=Object.keys(t.properties).map(o=>{let i=t.properties[o],c=`${JSON.stringify(o)}: ${ce(i,h(d({},e),{path:[...e.path,"properties",o]}))}`,p=typeof i=="object"&&i.default!==void 0||typeof t.default=="object"&&t.default!==null&&o in t.default,m=Array.isArray(t.required)?t.required.includes(o):typeof i=="object"&&i.required===!0;return!p&&!m?`${c}.optional()`:c}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?ce(t.additionalProperties,h(d({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let o=Object.fromEntries(Object.entries(t.patternProperties).map(([i,c])=>[i,ce(c,h(d({},e),{path:[...e.path,"patternProperties",i]}))],{}));a="",r?n?a+=`.catchall(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?a+=`.catchall(z.union([${Object.values(o).join(", ")}]))`:a+=`.catchall(${Object.values(o)})`:n?a+=`z.record(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?a+=`z.record(z.union([${Object.values(o).join(", ")}]))`:a+=`z.record(${Object.values(o)})`,a+=`.superRefine((value, ctx) => {
58
58
  `,a+=`for (const key in value) {
59
- `,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(o=>JSON.stringify(o)).join(", ")}].includes(key)
59
+ `,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(i=>JSON.stringify(i)).join(", ")}].includes(key)
60
60
  `:a+=`let evaluated = false
61
- `);for(let o in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(o)+`))) {
61
+ `);for(let i in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(i)+`))) {
62
62
  `,n&&(a+=`evaluated = true
63
- `),a+="const result = "+i[o]+`.safeParse(value[key])
63
+ `),a+="const result = "+o[i]+`.safeParse(value[key])
64
64
  `,a+=`if (!result.success) {
65
65
  `,a+=`ctx.addIssue({
66
66
  path: [...ctx.path, key],
@@ -86,7 +86,7 @@ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(He).join(
86
86
  `,a+=`}
87
87
  `,a+=`}
88
88
  `),a+=`}
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(${Sf(m(d({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(d({},i),{type:"object"}):i)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${Ys(m(d({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(d({},i),{type:"object"}):i)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${mr(m(d({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(d({},i),{type:"object"}):i)}),e)})`),s}l(Of,"parseObject");var __=l(t=>{var e;let r="z.string()";if((e=t[F])!=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"),T_=l((t,e)=>`${ce(f_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),b_=l(t=>`z.ref('${t.$ref}')`,"parseRef"),w_=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,m(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=E_(t,e);return r||(a=k_(t,a),e.withoutDefaults||(a=P_(t,a))),n.r=a,a},"parseSchema"),k_=l((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),P_=l((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),E_=l((t,e)=>ie.a.nullable(t)?T_(t,e):ie.an.object(t)?Of(t,e):ie.an.array(t)?g_(t,e):ie.an.anyOf(t)?Sf(t,e):ie.an.allOf(t)?mr(t,e):ie.a.discriminator(t)?w_(t,e):ie.a.oneOf(t)?Ys(t,e):ie.a.not(t)?u_(t,e):ie.an.enum(t)?h_(t):ie.a.const(t)?m_(t):ie.a.multipleType(t)?l_(t,e):ie.a.primitive(t,"string")?__(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?v_(t):ie.a.primitive(t,"boolean")?i_(t):ie.a.primitive(t,"null")?c_(t):ie.a.conditional(t)?y_(t,e):ie.a.ref(t)?b_(t):o_(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")}},x_=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"),S_=l(t=>ce(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),O_=l(t=>{let e=S_(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=x_(e);if(!r.sucess)throw new sl(r.error);return r.value},"jsonSchemaToZod"),or=l((t,e)=>{var r,n;if(e[F]&&t._def&&(t._def[F]=e[F]),((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=O_(t);return or(e,t),e},"jsonSchemaToZui"),Cf=class extends Ft.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?Ft.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};l(Cf,"ErrorBoundary");var Dt=Cf;function Bf(t,e){return r=>Ft.default.createElement(Dt,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Ft.default.createElement(t,d({},r)))}l(Bf,"withErrorBoundary");var Jr=l(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:i}=e,o=Fo(e,["components","fieldSchema","path","required","fallback"]),c,p;let{formData:h,disabled:b,hidden:I,handlePropertyChange:P,addArrayItem:S,removeArrayItem:W,formErrors:q,formValid:re}=zo(n,a),J=(0,be.useMemo)(()=>ot(h,a),[h,a]),N=(0,be.useMemo)(()=>$g(r,n),[n,r]),{discriminator:L,discriminatedSchema:ue,discriminatorValue:Ke}=Hg(n,a);if(!N||I===!0)return null;let{Component:tt,type:Ce}=N,we={type:Ce,componentID:N.id,scope:a.join("."),context:{path:a,readonly:!1,formData:h,formErrors:q,formValid:re,updateForm:P,updateFormData:l(ke=>P([],ke),"updateFormData")},onChange:l(ke=>P(a,ke),"onChange"),disabled:b,errors:q?.filter(ke=>ke.path===a)||[],label:((c=n[F])==null?void 0:c.title)||qa(((p=a[a.length-1])==null?void 0:p.toString())||""),params:N.params,schema:n,zuiProps:n[F]};if(n.type==="array"&&Ce==="array"){let ke=tt,Te=we.schema,Pe=Array.isArray(J)||typeof J=="object"?J:[],H=d(m(d({},we),{type:Ce,schema:Te,data:Pe,addItem:l(Be=>S(a,Be),"addItem"),removeItem:l(Be=>W(a,Be),"removeItem")}),o);return Array.isArray(n.items)?null:be.default.createElement(ke,m(d({key:we.scope},H),{isArrayChild:H.isArrayChild}),Array.isArray(H.data)?H.data.map((Be,Oe)=>{let ze=[...a,Oe.toString()];return be.default.createElement(Dt,{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 ke=tt,Te=d(m(d({},we),{type:Ce,schema:we.schema,data:J||{}}),o);return be.default.createElement(ke,m(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),Object.entries(n.properties).map(([Pe,H])=>{var Be;let Oe=[...a,Pe];return be.default.createElement(Dt,{key:Oe.join("."),fallback:i,fieldSchema:H,path:Oe},be.default.createElement(Jr,{key:Oe.join("."),components:r,fieldSchema:H,path:Oe,required:((Be=n.required)==null?void 0:Be.includes(Pe))||!1,isArrayChild:!1,fallback:i}))}))}if(Ce==="discriminatedUnion"){let ke=tt,Te=d(m(d({},we),{type:Ce,schema:we.schema,data:J||{},discriminatorKey:L?.key||null,discriminatorLabel:qa(L?.key||"Unknown"),discriminatorOptions:L?.values||null,discriminatorValue:Ke,setDiscriminator:l(Pe=>{if(!L?.key){console.warn("No discriminator key found, cannot set discriminator");return}P(a,{[L.key]:Pe})},"setDiscriminator")}),o);return be.default.createElement(ke,m(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),ue&&be.default.createElement(Dt,{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=tt,_a=d(m(d({},we),{type:Ce,schema:we.schema,config:{},required:s,data:J,description:n.description}),o);return be.default.createElement(va,d({},_a))},"FormElementRenderer"),C_=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 h=Rt(t);p(b=>Xr(h,b))},[JSON.stringify(t),p]),je.default.createElement(Mg,{formData:c,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:i,onValidation:o},je.default.createElement(Dt,{fallback:s,fieldSchema:t,path:[]},je.default.createElement(Jr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),B_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},I_={errors:rl,jsonSchemaToZui:Tr,zuiToJsonSchema:aa,objectToZui:Ut,toTypescript:Qr,toTypescriptSchema:ws};var zt=(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")},If=E;var _e=E.string().min(1),Rf=E.object({text:_e}),Af=E.object({markdown:_e}),Df=E.object({imageUrl:_e}),Mf=E.object({audioUrl:_e}),Hf=E.object({videoUrl:_e}),Nf=E.object({fileUrl:_e,title:_e.optional()}),jf=E.object({latitude:E.number(),longitude:E.number(),address:E.string().optional(),title:E.string().optional()}),$f=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}))}),Z_=E.object({items:E.array($f)}),R_=E.union([E.object({type:E.literal("text"),payload:Rf}),E.object({type:E.literal("markdown"),payload:Af}),E.object({type:E.literal("image"),payload:Df}),E.object({type:E.literal("audio"),payload:Mf}),E.object({type:E.literal("video"),payload:Hf}),E.object({type:E.literal("file"),payload:Nf}),E.object({type:E.literal("location"),payload:jf})]),A_=E.object({items:E.array(R_)}),D_={schema:Af},M_={text:{schema:Rf},image:{schema:Df},audio:{schema:Mf},video:{schema:Hf},file:{schema:Nf},location:{schema:jf},carousel:{schema:Z_},card:{schema:$f},dropdown:{schema:Zf},choice:{schema:Zf},bloc:{schema:A_}};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",kr="x-bp-operation",ni="x-bp-type";var Uf=require("browser-or-node");var Wt=console;function Se(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Pr(t,e=8072,r=$_){if(!Uf.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 H_(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){Wt.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 H_(t){let e=await j_(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:N_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function N_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function j_(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 $_(t){Wt.info(`Listening on port ${t}`)}var ya=require("@botpress/client");var te={};er(te,{mapKeys:()=>L_,mapValues:()=>F_,mergeRecords:()=>z_,pairs:()=>sa,stripUndefinedProps:()=>K_,values:()=>U_});var sa=t=>Object.entries(t),U_=t=>Object.values(t),F_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[r,e(n,r)])),L_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[e(r),n])),K_=t=>Object.fromEntries(sa(t).filter(([,e])=>e!==void 0)),z_=(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 U={};er(U,{safePush:()=>W_,unique:()=>V_});var W_=(t,...e)=>t?[...t,...e]:[...e],V_=t=>Array.from(new Set(t));var Le={};er(Le,{setName:()=>q_});var q_=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Ff=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),h=t.actions?.[i]?.name??i;n.actions[h]={...o,...t.actions?.[i]??{},input:{schema:c},output:{schema:p}},a.actions[i]={name:h}}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[h,b]of Object.entries(o.messages)){let I=b.schema.dereference(s);c[h]={...b,schema:I}}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"),Lf=t=>t?te.mapValues(t,(r,n)=>({...r,[ia]:n})):{},Kf=t=>ia in t&&t[ia]!==void 0,zf=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}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;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(I=>I.name),p=c.length===0?e.name:`${e.name}<${c.join(",")}>`,{resolved:h,statement:b}=Ff({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(i)});return o.actions=te.mergeRecords(o.actions??{},h.actions,this._mergeActions),o.channels=te.mergeRecords(o.channels??{},h.channels,this._mergeChannels),o.events=te.mergeRecords(o.events??{},h.events,this._mergeEvents),o.interfaces[p]={id:e.id,...b},this}_callBuilder(e,r){let a={entities:Lf(this.entities)},s=r(a),i=te.pairs(s.entities).find(([c,p])=>!Kf(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:zf(c),schema:c.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:zt(e.input.schema,r.input.schema)},output:{schema:zt(e.input.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:zt(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:zt(e.schema,r.schema)})};var wt=require("@botpress/client");var Wf=require("@botpress/client"),la={retries:3,retryCondition:t=>Wf.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};var Vt=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)};var ua=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var G_=E.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Vf=t=>{let e=t[br],r=t[Qs],n=t[ei],a=t[ti],s=t[ri],i=t[wr],o=G_.parse(t[kr]);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 qf=nt(require("util")),qt=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=qf.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 qt{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 Gf=t=>async e=>{let r=Vf(e.headers),n=new wt.Client({botId:r.botId,integrationId:r.integrationId,retry:la}),a=new Vt(n),s=new Ye,i={ctx:r,req:e,client:a,logger:s,instance:t};try{let o;switch(r.operation){case"webhook_received":o=await Y_(i);break;case"register":o=await X_(i);break;case"unregister":o=await Q_(i);break;case"message_created":o=await rT(i);break;case"action_triggered":o=await nT(i);break;case"ping":o=await J_(i);break;case"create_user":o=await eT(i);break;case"create_conversation":o=await tT(i);break;default:throw new Error(`Unknown operation ${r.operation}`)}return o?{...o,status:o.status??200}:{status:200}}catch(o){if((0,wt.isApiError)(o)){let p=o.type==="Runtime"?o:new wt.RuntimeError(o.message,o);return s.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(o);let c=new wt.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 s.forBot().error(c.message),{status:c.code,body:JSON.stringify(c.toJSON())}}},J_=async t=>{},Y_=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})},X_=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})},Q_=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})},eT=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})},tT=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})},rT=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:i,type:o,payload:c,message:p}=Se(e),h=a.channels[s.channel];if(!h)throw new Error(`Channel ${s.channel} not found`);let b=h.messages[o];if(!b)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await b({ctx:t,conversation:s,message:p,user:i,type:o,client:r,payload:c,ack:async({tags:P})=>{await r.updateMessage({id:p.id,tags:P})},logger:n})},nT=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,h={output:await o({ctx:e,input:s,client:r,type:i,logger:n,metadata:c}),meta:c.toJSON()};return{body:JSON.stringify(h)}};var ca=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=Gf(this);start=e=>Pr(this.handler,e)};var aT="#",da=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}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;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},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}${aT}${n}`)};var Xf=nt(require("@botpress/client"));var Xe=class extends qt{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})}};var Ze=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)),a}};var Gt=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 sT=E.enum(["event_received","register","unregister","ping","action_triggered"]),Jf=t=>{let e=t[br],r=t[wr],n=t[ni],a=sT.parse(t[kr]);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 me={status:200};var ai=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}`)}},fa=t=>t==="timedOut"?"timed_out":t;var iT=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Yf=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!iT.includes(e.payload.type))throw new Error("Unexpected event type");if(!e.payload.workflow.name)return t.logger.withWorkflowId(e.payload.workflow.id).warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),me;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":t.logger.withWorkflowId(e.payload.workflow.id).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 oT(t,e);default:e.payload.type}return me},oT=async(t,e)=>{let r=ai(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];return!n||n.length===0?(t.logger.withWorkflowId(e.payload.workflow.id).warn(`No ${r} handler found for workflow "${e.payload.workflow.name}"`),me):(await lT(t,e),await uT(t,e),me)},lT=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},uT=async(t,e)=>{let r=ai(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:Gt(t.client)})};var Qf=t=>async e=>{let r=Jf(e.headers),n=new Xe,a=new Xf.Client({botId:r.botId,retry:la}),s=new Ze(a,{before:{createMessage:async o=>{let c=t.hookHandlers.before_outgoing_message[o.type]??[];for(let p of c){let h=new Ze(a);o=(await p({client:h,ctx:r,logger:n,data:o,...Jt({client:h})}))?.data??o}return o},callAction:async o=>{let c=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let p of c){let h=new Ze(a);o=(await p({client:h,ctx:r,logger:n,data:o,...Jt({client:h})}))?.data??o}return o}},after:{createMessage:async o=>{let c=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let p of c){let h=new Ze(a);o=(await p({client:h,ctx:r,logger:n,data:o,...Jt({client:h})}))?.data??o}return o},callAction:async o=>{let c=t.hookHandlers.after_outgoing_call_action[o.output.type]??[];for(let p of c){let h=new Ze(a);o=(await p({client:h,ctx:r,logger:n,data:o,...Jt({client:h})}))?.data??o}return o}}}),i={req:e,ctx:r,logger:n,client:s,self:t};switch(r.operation){case"action_triggered":return await gT(i);case"event_received":return await pT(i);case"register":return await dT(i);case"unregister":return await fT(i);case"ping":return await cT(i);default:throw new Error(`Unknown operation ${r.operation}`)}},cT=async({ctx:t})=>(Wt.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),me),dT=async t=>me,fT=async t=>me,pT=async t=>{let{ctx:e,logger:r,req:n,client:a,self:s}=t,i={client:a,ctx:e,logger:r,...Jt({client:a})};Wt.debug(`Received event ${e.type}`);let o=Se(n);if(e.type==="workflow_update")return await Yf(t,o.event);if(e.type==="message_created"){let P=o.event,S=P.payload.message,W=s.hookHandlers.before_incoming_message[S.type]??[];for(let N of W){let L=await N({...i,data:S});if(S=L?.data??S,L?.stop)return me}let q={...i,user:P.payload.user,conversation:P.payload.conversation,states:P.payload.states,message:S,event:P},re=s.messageHandlers[S.type]??[];for(let N of re)await N(q);let J=s.hookHandlers.after_incoming_message[S.type]??[];for(let N of J){let L=await N({...i,data:S});if(S=L?.data??S,L?.stop)return me}return me}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 me}let c=o.event,p=s.hookHandlers.before_incoming_event[c.type]??[];for(let P of p){let S=await P({...i,data:c});if(c=S?.data??c,S?.stop)return me}let h={...i,event:c},b=s.eventHandlers[c.type]??[];for(let P of b)await P(h);let I=s.hookHandlers.after_incoming_event[c.type]??[];for(let P of I){let S=await P({...i,data:c});if(c=S?.data??c,S?.stop)return me}return me},gT=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.actionHandlers[i];if(!o)throw new Error(`Action ${i} not found`);let p={output:await o({ctx:t,logger:e,input:s,client:n,type:i,...Jt({client:n})})};return{status:200,body:JSON.stringify(p)}},Jt=t=>({workflows:Gt(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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={};_plugins={};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=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.messageHandlers[r]??[]);return U.unique([...s,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._eventHandlers[r]??[],a=this._eventHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.eventHandlers[r]??[]);return U.unique([...s,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.stateExpiredHandlers[r]??[]);return U.unique([...s,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>{let s=r,i=this._hookHandlers[s]??{},o=i[a]??[],c=i["*"]??[],p=[...o,...c],h=Object.values(this._plugins).flatMap(b=>b.hookHandlers[s]?.[a]??[]);return U.unique([...p,...h])}})})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>{let i=this._workflowHandlers[r]?.[a],o=Object.values(this._plugins).flatMap(c=>c.workflowHandlers[r]?.[a]??[]);return U.unique([...i??[],...o])}})})}on={message:(e,r)=>{this._messageHandlers[e]=U.safePush(this._messageHandlers[e],r)},workflows:new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>s=>{let i=fa(a);this._workflowHandlers[i]??={},this._workflowHandlers[i][r]=U.safePush(this._workflowHandlers[i][r],s)}})}),event:(e,r)=>{this._eventHandlers[e]=U.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=U.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=U.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=U.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=U.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=U.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=U.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=U.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=U.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=U.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};handler=Qf(this);start=e=>Pr(this.handler,e)};var ga=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.entities=e.entities??{};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;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=If.ref(n);s&&o.title(s),i&&o.describe(i),r[n]=o}return r}};var ma=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}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};var si=":";var ep=t=>{let[e,r]=t.split(si);return!e||!r?null:{namespace:e,eventName:r}},tp=t=>`${t.namespace}${si}${t.actionName}`,rp=t=>`${t.namespace}${si}${t.eventName}`,np=(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}},ap=(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 sp=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>i=>mT({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:s,input:i})})}),mT=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=np({namespace:r,actionName:n},e),i=tp(s);return(await t.callAction({type:i,input:a})).output};var ha=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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={};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=sp(e,n),i=Gt(e);return{configuration:r,interfaces:n,actions:s,alias:a,workflows:i}}get actionHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._actionHandlers[r];if(n)return Le.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 U.unique([...n,...a]).map(i=>Le.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 U.unique([...n,...a,...s]).map(o=>Le.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 U.unique([...n,...a]).map(i=>Le.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(([h])=>this._eventResolvesTo(h,s)).flatMap(([,h])=>h??[]),c=n["*"]??[];return U.unique([...i,...o,...c]).map(h=>Le.setName(b=>h({...b,...this._getTools(b.client)}),h.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>(this._workflowHandlers[r]?.[a]??[]).map(o=>Le.setName(c=>o({...c,...this._getTools(c.client)}),o.name))})})}on={message:(e,r)=>{this._messageHandlers[e]=U.safePush(this._messageHandlers[e],r)},workflows:new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>s=>{let i=fa(a);this._workflowHandlers[i]??={},this._workflowHandlers[i][r]=U.safePush(this._workflowHandlers[i][r],s)}})}),event:(e,r)=>{this._eventHandlers[e]=U.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=U.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=U.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=U.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=U.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=U.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=U.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=U.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=U.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=U.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};_eventResolvesTo=(e,r)=>{let n=ep(e);if(!n)return!1;let a=ap(n,this._runtime.interfaces);return rp(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,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});
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(${xf(h(d({},t),{anyOf:t.anyOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${Js(h(d({},t),{oneOf:t.oneOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${hr(h(d({},t),{allOf:t.allOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),s}l(Sf,"parseObject");var v_=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"),__=l((t,e)=>`${ce(d_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),T_=l(t=>`z.ref('${t.$ref}')`,"parseRef"),b_=l((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return Js(t,e);let a=t.oneOf.map((s,o)=>ce(s,h(d({},e),{path:[...e.path,"oneOf",o]})));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=k_(t,e);return r||(a=w_(t,a),e.withoutDefaults||(a=P_(t,a))),n.r=a,a},"parseSchema"),w_=l((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),P_=l((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),k_=l((t,e)=>ie.a.nullable(t)?__(t,e):ie.an.object(t)?Sf(t,e):ie.an.array(t)?p_(t,e):ie.an.anyOf(t)?xf(t,e):ie.an.allOf(t)?hr(t,e):ie.a.discriminator(t)?b_(t,e):ie.a.oneOf(t)?Js(t,e):ie.a.not(t)?l_(t,e):ie.an.enum(t)?h_(t):ie.a.const(t)?g_(t):ie.a.multipleType(t)?o_(t,e):ie.a.primitive(t,"string")?v_(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?y_(t):ie.a.primitive(t,"boolean")?s_(t):ie.a.primitive(t,"null")?u_(t):ie.a.conditional(t)?m_(t,e):ie.a.ref(t)?T_(t):i_(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")}},E_=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"),x_=l(t=>ce(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),S_=l(t=>{let e=x_(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=E_(e);if(!r.sucess)throw new al(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 o=typeof t._def.shape=="function"?t._def.shape():t._def.shape;o[a]&&or(o[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,o)=>{let i=t._def;i.typeName===E.ZodFirstPartyTypeKind.ZodTuple&&or(i.items[o],s)})}},"applyZuiPropsRecursively"),Tr=l(t=>{let e=S_(t);return or(e,t),e},"jsonSchemaToZui"),Of=class extends Kt.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?Kt.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};l(Of,"ErrorBoundary");var Dt=Of;function Cf(t,e){return r=>Kt.default.createElement(Dt,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Kt.default.createElement(t,d({},r)))}l(Cf,"withErrorBoundary");var Jr=l(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:o}=e,i=Uo(e,["components","fieldSchema","path","required","fallback"]),c,p;let{formData:m,disabled:T,hidden:C,handlePropertyChange:k,addArrayItem:S,removeArrayItem:W,formErrors:q,formValid:re}=Lo(n,a),J=(0,be.useMemo)(()=>ot(m,a),[m,a]),N=(0,be.useMemo)(()=>Ng(r,n),[n,r]),{discriminator:F,discriminatedSchema:ue,discriminatorValue:Le}=Mg(n,a);if(!N||C===!0)return null;let{Component:tt,type:Ce}=N,we={type:Ce,componentID:N.id,scope:a.join("."),context:{path:a,readonly:!1,formData:m,formErrors:q,formValid:re,updateForm:k,updateFormData:l(Pe=>k([],Pe),"updateFormData")},onChange:l(Pe=>k(a,Pe),"onChange"),disabled:T,errors:q?.filter(Pe=>Pe.path===a)||[],label:((c=n[K])==null?void 0:c.title)||Va(((p=a[a.length-1])==null?void 0:p.toString())||""),params:N.params,schema:n,zuiProps:n[K]};if(n.type==="array"&&Ce==="array"){let Pe=tt,Te=we.schema,ke=Array.isArray(J)||typeof J=="object"?J:[],j=d(h(d({},we),{type:Ce,schema:Te,data:ke,addItem:l(Ie=>S(a,Ie),"addItem"),removeItem:l(Ie=>W(a,Ie),"removeItem")}),i);return Array.isArray(n.items)?null:be.default.createElement(Pe,h(d({key:we.scope},j),{isArrayChild:j.isArrayChild}),Array.isArray(j.data)?j.data.map((Ie,Oe)=>{let ze=[...a,Oe.toString()];return be.default.createElement(Dt,{key:ze.join("."),fallback:o,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:o}))}):[])}if(n.type==="object"&&Ce==="object"&&n.properties){let Pe=tt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{}}),i);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),Object.entries(n.properties).map(([ke,j])=>{var Ie;let Oe=[...a,ke];return be.default.createElement(Dt,{key:Oe.join("."),fallback:o,fieldSchema:j,path:Oe},be.default.createElement(Jr,{key:Oe.join("."),components:r,fieldSchema:j,path:Oe,required:((Ie=n.required)==null?void 0:Ie.includes(ke))||!1,isArrayChild:!1,fallback:o}))}))}if(Ce==="discriminatedUnion"){let Pe=tt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{},discriminatorKey:F?.key||null,discriminatorLabel:Va(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}k(a,{[F.key]:ke})},"setDiscriminator")}),i);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),ue&&be.default.createElement(Dt,{key:a.join("."),fallback:o,fieldSchema:ue,path:a},be.default.createElement(Jr,{components:r,fieldSchema:ue,path:a,required:s,isArrayChild:!1,fallback:o})))}let ya=tt,va=d(h(d({},we),{type:Ce,schema:we.schema,config:{},required:s,data:J,description:n.description}),i);return be.default.createElement(ya,d({},va))},"FormElementRenderer"),O_=l(({schema:t,components:e,onChange:r,value:n,disableValidation:a,fallback:s,dataTransform:o,onValidation:i})=>{let[c,p]=(0,Ne.useState)(n);return(0,Ne.useEffect)(()=>{r(c)},[c]),(0,Ne.useEffect)(()=>{let m=Rt(t);p(T=>Xr(m,T))},[JSON.stringify(t),p]),Ne.default.createElement(Dg,{formData:c,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:o,onValidation:i},Ne.default.createElement(Dt,{fallback:s,fieldSchema:t,path:[]},Ne.default.createElement(Jr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),C_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},I_={errors:tl,jsonSchemaToZui:Tr,zuiToJsonSchema:aa,objectToZui:Ut,toTypescript:Qr,toTypescriptSchema:bs};var zt=(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")},If=E;var _e=E.string().min(1),Zf=E.object({text:_e}),Rf=E.object({markdown:_e}),Af=E.object({imageUrl:_e}),Df=E.object({audioUrl:_e}),Mf=E.object({videoUrl:_e}),Hf=E.object({fileUrl:_e,title:_e.optional()}),jf=E.object({latitude:E.number(),longitude:E.number(),address:E.string().optional(),title:E.string().optional()}),Nf=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}))}),Bf=E.object({text:_e,options:E.array(E.object({label:_e,value:_e}))}),B_=E.object({items:E.array(Nf)}),Z_=E.union([E.object({type:E.literal("text"),payload:Zf}),E.object({type:E.literal("markdown"),payload:Rf}),E.object({type:E.literal("image"),payload:Af}),E.object({type:E.literal("audio"),payload:Df}),E.object({type:E.literal("video"),payload:Mf}),E.object({type:E.literal("file"),payload:Hf}),E.object({type:E.literal("location"),payload:jf})]),R_=E.object({items:E.array(Z_)}),A_={schema:Rf},D_={text:{schema:Zf},image:{schema:Af},audio:{schema:Df},video:{schema:Mf},file:{schema:Hf},location:{schema:jf},carousel:{schema:B_},card:{schema:Nf},dropdown:{schema:Bf},choice:{schema:Bf},bloc:{schema:R_}};var br="x-bot-id",Xs="x-bot-user-id",Qs="x-integration-id",ei="x-webhook-id",ti="x-bp-configuration-type",wr="x-bp-configuration",Pr="x-bp-operation",ri="x-bp-type";var $f=require("browser-or-node");var Wt=console;function Se(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function kr(t,e=8072,r=N_){if(!$f.isNode)throw new Error("This function can only be called in Node.js");let a=require("http").createServer(async(s,o)=>{try{let i=await M_(s);if(i.path==="/health"){o.writeHead(200).end("ok");return}let c=await t(i);o.writeHead(c?.status??200,c?.headers??{}).end(c?.body??"{}")}catch(i){Wt.error("Error while handling request",{error:i?.message??"Internal error occured"}),o.writeHead(500).end(JSON.stringify({error:i?.message??"Internal error occured"}))}});return a.listen(e,()=>r(e)),a}async function M_(t){let e=await j_(t),r={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),o=t.rawHeaders[a+1];r[s]=o}let n=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:n.pathname,query:H_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function H_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function j_(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 N_(t){Wt.info(`Listening on port ${t}`)}var ma=require("@botpress/client");var te={};er(te,{mapKeys:()=>K_,mapValues:()=>U_,mergeRecords:()=>L_,pairs:()=>sa,stripUndefinedProps:()=>F_,values:()=>$_});var sa=t=>Object.entries(t),$_=t=>Object.values(t),U_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[r,e(n,r)])),K_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[e(r),n])),F_=t=>Object.fromEntries(sa(t).filter(([,e])=>e!==void 0)),L_=(t,e,r)=>{let n=[...Object.keys(t),...Object.keys(e)],a=[...new Set(n)],s={};for(let o of a){let i=t[o],c=e[o];i&&c?s[o]=r(i,c):i?s[o]=i:c&&(s[o]=c)}return s};var H={};er(H,{safePush:()=>z_,unique:()=>W_});var z_=(t,...e)=>t?[...t,...e]:[...e],W_=t=>Array.from(new Set(t));var Fe={};er(Fe,{setName:()=>V_});var V_=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Uf=t=>{let{name:e,version:r}=t,n={actions:{},events:{},channels:{}},a={name:e,version:r,entities:te.mapValues(t.entities,o=>({name:o.name})),actions:{},events:{},channels:{}},s=te.mapValues(t.entities,o=>o.schema);for(let[o,i]of Object.entries(t.definition.actions??{})){let c=i.input.schema.dereference(s),p=i.output.schema.dereference(s),m=t.actions?.[o]?.name??o;n.actions[m]={...i,...t.actions?.[o]??{},input:{schema:c},output:{schema:p}},a.actions[o]={name:m}}for(let[o,i]of Object.entries(t.definition.events??{})){let c=i.schema.dereference(s),p=t.events?.[o]?.name??o;n.events[p]={...i,...t.events?.[o]??{},schema:c},a.events[o]={name:p}}for(let[o,i]of Object.entries(t.definition.channels??{})){let c={};for(let[m,T]of Object.entries(i.messages)){let C=T.schema.dereference(s);c[m]={...T,schema:C}}let p=t.channels?.[o]?.name??o;n.channels[p]={...i,...t.channels?.[o]??{},message:{...i.message??{},tags:{...i.message?.tags??{},...t.channels?.[o]?.message?.tags??{}}},conversation:{...i.conversation??{},tags:{...i.conversation?.tags??{},...t.channels?.[o]?.conversation?.tags??{}}},messages:c},a.channels[o]={name:p}}return{resolved:n,statement:a}};var ia=Symbol("schemaName"),Kf=t=>t?te.mapValues(t,(r,n)=>({...r,[ia]:n})):{},Ff=t=>ia in t&&t[ia]!==void 0,Lf=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}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;extend(e,r){let{entities:n,actions:a,events:s,channels:o}=this._callBuilder(e,r),i=this;i.interfaces??={};let c=Object.values(n).map(C=>C.name),p=c.length===0?e.name:`${e.name}<${c.join(",")}>`,{resolved:m,statement:T}=Uf({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(o)});return i.actions=te.mergeRecords(i.actions??{},m.actions,this._mergeActions),i.channels=te.mergeRecords(i.channels??{},m.channels,this._mergeChannels),i.events=te.mergeRecords(i.events??{},m.events,this._mergeEvents),i.interfaces[p]={id:e.id,...T},this}_callBuilder(e,r){let a={entities:Kf(this.entities)},s=r(a),o=te.pairs(s.entities).find(([c,p])=>!Ff(p));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:te.mapValues(s.entities,c=>({name:Lf(c),schema:c.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:zt(e.input.schema,r.input.schema)},output:{schema:zt(e.input.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:zt(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:zt(e.schema,r.schema)})};var wt=require("@botpress/client");var zf=require("@botpress/client"),la={retries:3,retryCondition:t=>zf.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};var Vt=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)};var ua=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var q_=E.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Wf=t=>{let e=t[br],r=t[Xs],n=t[Qs],a=t[ei],s=t[ti],o=t[wr],i=q_.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(!o)throw new Error("Missing configuration headers");if(!i)throw new Error("Missing operation headers");return{botId:e,botUserId:r,integrationId:n,webhookId:a,operation:i,configurationType:s??null,configuration:o?JSON.parse(Buffer.from(o,"base64").toString("utf-8")):{}}};var Vf=nt(require("util")),qt=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=Vf.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 qt{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 qf=t=>async e=>{let r=Wf(e.headers),n=new wt.Client({botId:r.botId,integrationId:r.integrationId,retry:la}),a=new Vt(n),s=new Ye,o={ctx:r,req:e,client:a,logger:s,instance:t};try{let i;switch(r.operation){case"webhook_received":i=await J_(o);break;case"register":i=await Y_(o);break;case"unregister":i=await X_(o);break;case"message_created":i=await tT(o);break;case"action_triggered":i=await rT(o);break;case"ping":i=await G_(o);break;case"create_user":i=await Q_(o);break;case"create_conversation":i=await eT(o);break;default:throw new Error(`Unknown operation ${r.operation}`)}return i?{...i,status:i.status??200}:{status:200}}catch(i){if((0,wt.isApiError)(i)){let p=i.type==="Runtime"?i:new wt.RuntimeError(i.message,i);return s.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(i);let c=new wt.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 s.forBot().error(c.message),{status:c.code,body:JSON.stringify(c.toJSON())}}},G_=async t=>{},J_=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})},Y_=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})},X_=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})},Q_=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})},eT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:o}=Se(r);return await a.createConversation({ctx:e,client:t,channel:s,tags:o,logger:n})},tT=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:o,type:i,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[i];if(!T)throw new Error(`Message of type ${i} not found in channel ${s.channel}`);await T({ctx:t,conversation:s,message:p,user:o,type:i,client:r,payload:c,ack:async({tags:k})=>{await r.updateMessage({id:p.id,tags:k})},logger:n})},rT=async({req:t,ctx:e,client:r,logger:n,instance:a})=>{let{input:s,type:o}=Se(t);if(!o)throw new Error("Missing action type");let i=a.actions[o];if(!i)throw new Error(`Action ${o} not found`);let c=new ua,m={output:await i({ctx:e,input:s,client:r,type:o,logger:n,metadata:c}),meta:c.toJSON()};return{body:JSON.stringify(m)}};var ca=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=qf(this);start=e=>kr(this.handler,e)};var nT="#",da=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}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;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},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}${nT}${n}`)};var Yf=nt(require("@botpress/client"));var Xe=class extends qt{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})}};var Ze=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)),a}};var Gt=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 aT=E.enum(["event_received","register","unregister","ping","action_triggered"]),Gf=t=>{let e=t[br],r=t[wr],n=t[ri],a=aT.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 ni=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 sT=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Jf=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!sT.includes(e.payload.type))throw new Error("Unexpected event type");if(!e.payload.workflow.name)return t.logger.withWorkflowId(e.payload.workflow.id).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":t.logger.withWorkflowId(e.payload.workflow.id).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 iT(t,e);default:e.payload.type}return he},iT=async(t,e)=>{let r=ni(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];return!n||n.length===0?(t.logger.withWorkflowId(e.payload.workflow.id).warn(`No ${r} handler found for workflow "${e.payload.workflow.name}"`),he):(await oT(t,e),await lT(t,e),he)},oT=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},lT=async(t,e)=>{let r=ni(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:Gt(t.client)})};var Xf=t=>async e=>{let r=Gf(e.headers),n=new Xe,a=new Yf.Client({botId:r.botId,retry:la}),s=new Ze(a,{before:{createMessage:async i=>{let c=t.hookHandlers.before_outgoing_message[i.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i},callAction:async i=>{let c=t.hookHandlers.before_outgoing_call_action[i.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i}},after:{createMessage:async i=>{let c=t.hookHandlers.after_outgoing_message[i.message.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i},callAction:async i=>{let c=t.hookHandlers.after_outgoing_call_action[i.output.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i}}}),o={req:e,ctx:r,logger:n,client:s,self:t};switch(r.operation){case"action_triggered":return await pT(o);case"event_received":return await fT(o);case"register":return await cT(o);case"unregister":return await dT(o);case"ping":return await uT(o);default:throw new Error(`Unknown operation ${r.operation}`)}},uT=async({ctx:t})=>(Wt.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),he),cT=async t=>he,dT=async t=>he,fT=async t=>{let{ctx:e,logger:r,req:n,client:a,self:s}=t,o={client:a,ctx:e,logger:r,...Jt({client:a})};Wt.debug(`Received event ${e.type}`);let i=Se(n);if(e.type==="workflow_update")return await Jf(t,i.event);if(e.type==="message_created"){let k=i.event,S=k.payload.message,W=s.hookHandlers.before_incoming_message[S.type]??[];for(let N of W){let F=await N({...o,data:S});if(S=F?.data??S,F?.stop)return he}let q={...o,user:k.payload.user,conversation:k.payload.conversation,states:k.payload.states,message:S,event:k},re=s.messageHandlers[S.type]??[];for(let N of re)await N(q);let J=s.hookHandlers.after_incoming_message[S.type]??[];for(let N of J){let F=await N({...o,data:S});if(S=F?.data??S,F?.stop)return he}return he}if(e.type==="state_expired"){let S=i.event.payload.state,W={...o,state:S},q=s.stateExpiredHandlers["*"]??[];for(let re of q)await re(W);return he}let c=i.event,p=s.hookHandlers.before_incoming_event[c.type]??[];for(let k of p){let S=await k({...o,data:c});if(c=S?.data??c,S?.stop)return he}let m={...o,event:c},T=s.eventHandlers[c.type]??[];for(let k of T)await k(m);let C=s.hookHandlers.after_incoming_event[c.type]??[];for(let k of C){let S=await k({...o,data:c});if(c=S?.data??c,S?.stop)return he}return he},pT=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let{input:s,type:o}=Se(r);if(!o)throw new Error("Missing action type");let i=a.actionHandlers[o];if(!i)throw new Error(`Action ${o} not found`);let p={output:await i({ctx:t,logger:e,input:s,client:n,type:o,...Jt({client:n})})};return{status:200,body:JSON.stringify(p)}},Jt=t=>({workflows:Gt(t.client)});var fa=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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_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(i=>i.messageHandlers[r]??[]),a=this._messageHandlers[r]??[],s=this._messageHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(i=>i.eventHandlers[r]??[]),a=this._eventHandlers[r]??[],s=this._eventHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(i=>i.stateExpiredHandlers[r]??[]),a=this._stateExpiredHandlers[r]??[],s=this._stateExpiredHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{if(this._hookHandlers[r])return new Proxy({},{get:(a,s)=>{let o=Object.values(this._plugins).flatMap(T=>T.hookHandlers[r]?.[s]??[]),i=this._hookHandlers[r]??{},c=i[s]??[],p=i["*"]??[],m=[...c,...p].sort((T,C)=>T.order-C.order).map(({handler:T})=>T);return H.unique([...o,...m])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{let o=n[s]?.sort((c,p)=>c.order-p.order).map(({handler:c})=>c)??[],i=Object.values(this._plugins).flatMap(c=>c.workflowHandlers[r]?.[s]??[]);return H.unique([...o,...i])}})}})}on={message:(e,r)=>{this._messageHandlers[e]=H.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=H.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=H.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=H.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=H.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=H.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=H.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=H.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=H.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=H.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=H.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=H.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=H.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=H.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};handler=Xf(this);start=e=>kr(this.handler,e)};var pa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.entities=e.entities??{};let r=this._getEntityReference(this.entities),n=e.events===void 0?{}:te.mapValues(e.events,o=>({...o,schema:o.schema(r)})),a=e.actions===void 0?{}:te.mapValues(e.actions,o=>({...o,input:{...o.input,schema:o.input.schema(r)},output:{...o.output,schema:o.output.schema(r)}})),s=e.channels===void 0?{}:te.mapValues(e.channels,o=>({...o,messages:te.mapValues(o.messages,i=>({...i,schema:i.schema(r)}))}));this.events=n,this.actions=a,this.channels=s}name;version;entities;events;actions;channels;_getEntityReference=e=>{let r={};for(let[n,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,o=a.schema._def.description,i=If.ref(n);s&&i.title(s),o&&i.describe(o),r[n]=i}return r}};var ga=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}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};var ai=":";var Qf=t=>{let[e,r]=t.split(ai);return!e||!r?null:{namespace:e,eventName:r}},ep=t=>`${t.namespace}${ai}${t.actionName}`,tp=t=>`${t.namespace}${ai}${t.eventName}`,rp=(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}},np=(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 ap=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>o=>gT({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:s,input:o})})}),gT=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=rp({namespace:r,actionName:n},e),o=ep(s);return(await t.callAction({type:o,input:a})).output};var ha=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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_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=ap(e,n),o=Gt(e);return{configuration:r,interfaces:n,actions:s,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 H.unique([...n,...a]).sort((o,i)=>o.order-i.order).map(({handler:o})=>Fe.setName(i=>o({...i,...this._getTools(i.client)}),o.name))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._eventHandlers[r]??[],a=Object.entries(this._eventHandlers).filter(([i])=>this._eventResolvesTo(i,r)).flatMap(([,i])=>i??[]),s=this._eventHandlers["*"]??[];return H.unique([...n,...a,...s]).sort((i,c)=>i.order-c.order).map(({handler:i})=>Fe.setName(c=>i({...c,...this._getTools(c.client)}),i.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[];return H.unique([...n,...a]).sort((o,i)=>o.order-i.order).map(({handler:o})=>Fe.setName(i=>o({...i,...this._getTools(i.client)}),o.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 o=n[s]??[],i=Object.entries(n).filter(([m])=>this._eventResolvesTo(m,s)).flatMap(([,m])=>m??[]),c=n["*"]??[];return H.unique([...o,...i,...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((i,c)=>i.order-c.order)??[]).map(({handler:i})=>Fe.setName(c=>i({...c,...this._getTools(c.client)}),i.name))})}})}on={message:(e,r)=>{this._messageHandlers[e]=H.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=H.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=H.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=H.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=H.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=H.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=H.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=H.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=H.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=H.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=H.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=H.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=H.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=H.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};_eventResolvesTo=(e,r)=>{let n=Qf(e);if(!n)return!1;let a=np(n,this._runtime.interfaces);return tp(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,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});
90
90
  /*! Bundled license information:
91
91
 
92
92
  react/cjs/react.production.min.js: