@botpress/sdk 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/dist/bot/client/index.d.ts +5 -0
- package/dist/bot/client/types.d.ts +16 -0
- package/dist/bot/common/generic.d.ts +9 -0
- package/dist/bot/definition.d.ts +23 -4
- package/dist/bot/implementation.d.ts +8 -1
- package/dist/bot/server/responses.d.ts +3 -0
- package/dist/bot/server/types.d.ts +54 -1
- package/dist/bot/server/workflows/update-handler.d.ts +3 -0
- package/dist/bot/server/workflows/update-type-conv.d.ts +3 -0
- package/dist/bot/workflow-proxy/index.d.ts +2 -0
- package/dist/bot/workflow-proxy/proxy.d.ts +10 -0
- package/dist/bot/workflow-proxy/types.d.ts +64 -0
- package/dist/bot/workflow-proxy/types.test.d.ts +1 -0
- package/dist/fixtures.d.ts +30 -0
- package/dist/index.cjs +22 -22
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +43 -43
- package/dist/index.mjs.map +4 -4
- package/dist/package.d.ts +1 -0
- package/dist/plugin/common/generic.d.ts +11 -103
- package/dist/plugin/definition.d.ts +15 -6
- package/dist/plugin/implementation.d.ts +21 -2
- package/dist/plugin/server/types.d.ts +9 -2
- package/dist/utils/record-utils.d.ts +1 -0
- package/dist/utils/type-utils.d.ts +3 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";var ig=Object.create;var Ar=Object.defineProperty;var og=Object.getOwnPropertyDescriptor;var ug=Object.getOwnPropertyNames;var cg=Object.getPrototypeOf,lg=Object.prototype.hasOwnProperty;var Za=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var r in e)Ar(t,r,{get:e[r],enumerable:!0})},Ni=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ug(e))!lg.call(t,a)&&a!==r&&Ar(t,a,{get:()=>e[a],enumerable:!(n=og(e,a))||n.enumerable});return t};var et=(t,e,r)=>(r=t!=null?ig(cg(t)):{},Ni(e||!t||!t.__esModule?Ar(r,"default",{value:t,enumerable:!0}):r,t)),dg=t=>Ni(Ar({},"__esModule",{value:!0}),t);var Yi=Za(N=>{"use strict";var Yt=Symbol.for("react.element"),fg=Symbol.for("react.portal"),pg=Symbol.for("react.fragment"),gg=Symbol.for("react.strict_mode"),mg=Symbol.for("react.profiler"),hg=Symbol.for("react.provider"),yg=Symbol.for("react.context"),vg=Symbol.for("react.forward_ref"),_g=Symbol.for("react.suspense"),bg=Symbol.for("react.memo"),Tg=Symbol.for("react.lazy"),$i=Symbol.iterator;function Pg(t){return t===null||typeof t!="object"?null:(t=$i&&t[$i]||t["@@iterator"],typeof t=="function"?t:null)}var Li={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zi=Object.assign,Ki={};function Et(t,e,r){this.props=t,this.context=e,this.refs=Ki,this.updater=r||Li}Et.prototype.isReactComponent={};Et.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")};Et.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Vi(){}Vi.prototype=Et.prototype;function Ra(t,e,r){this.props=t,this.context=e,this.refs=Ki,this.updater=r||Li}var Ba=Ra.prototype=new Vi;Ba.constructor=Ra;zi(Ba,Et.prototype);Ba.isPureReactComponent=!0;var Ui=Array.isArray,qi=Object.prototype.hasOwnProperty,Da={current:null},Gi={key:!0,ref:!0,__self:!0,__source:!0};function Wi(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)&&!Gi.hasOwnProperty(n)&&(a[n]=e[n]);var o=arguments.length-2;if(o===1)a.children=r;else if(1<o){for(var d=Array(o),p=0;p<o;p++)d[p]=arguments[p+2];a.children=d}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)a[n]===void 0&&(a[n]=o[n]);return{$$typeof:Yt,type:t,key:s,ref:i,props:a,_owner:Da.current}}function Eg(t,e){return{$$typeof:Yt,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ma(t){return typeof t=="object"&&t!==null&&t.$$typeof===Yt}function xg(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Fi=/\/+/g;function Aa(t,e){return typeof t=="object"&&t!==null&&t.key!=null?xg(""+t.key):e.toString(36)}function Br(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 Yt:case fg:i=!0}}if(i)return i=t,a=a(i),t=n===""?"."+Aa(i,0):n,Ui(a)?(r="",t!=null&&(r=t.replace(Fi,"$&/")+"/"),Br(a,e,r,"",function(p){return p})):a!=null&&(Ma(a)&&(a=Eg(a,r+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(Fi,"$&/")+"/")+t)),e.push(a)),1;if(i=0,n=n===""?".":n+":",Ui(t))for(var o=0;o<t.length;o++){s=t[o];var d=n+Aa(s,o);i+=Br(s,e,r,d,a)}else if(d=Pg(t),typeof d=="function")for(t=d.call(t),o=0;!(s=t.next()).done;)s=s.value,d=n+Aa(s,o++),i+=Br(s,e,r,d,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 Rr(t,e,r){if(t==null)return t;var n=[],a=0;return Br(t,n,"","",function(s){return e.call(r,s,a++)}),n}function Sg(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 he={current:null},Dr={transition:null},wg={ReactCurrentDispatcher:he,ReactCurrentBatchConfig:Dr,ReactCurrentOwner:Da};function Ji(){throw Error("act(...) is not supported in production builds of React.")}N.Children={map:Rr,forEach:function(t,e,r){Rr(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Rr(t,function(){e++}),e},toArray:function(t){return Rr(t,function(e){return e})||[]},only:function(t){if(!Ma(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};N.Component=Et;N.Fragment=pg;N.Profiler=mg;N.PureComponent=Ra;N.StrictMode=gg;N.Suspense=_g;N.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wg;N.act=Ji;N.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=zi({},t.props),a=t.key,s=t.ref,i=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,i=Da.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(d in e)qi.call(e,d)&&!Gi.hasOwnProperty(d)&&(n[d]=e[d]===void 0&&o!==void 0?o[d]:e[d])}var d=arguments.length-2;if(d===1)n.children=r;else if(1<d){o=Array(d);for(var p=0;p<d;p++)o[p]=arguments[p+2];n.children=o}return{$$typeof:Yt,type:t.type,key:a,ref:s,props:n,_owner:i}};N.createContext=function(t){return t={$$typeof:yg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:hg,_context:t},t.Consumer=t};N.createElement=Wi;N.createFactory=function(t){var e=Wi.bind(null,t);return e.type=t,e};N.createRef=function(){return{current:null}};N.forwardRef=function(t){return{$$typeof:vg,render:t}};N.isValidElement=Ma;N.lazy=function(t){return{$$typeof:Tg,_payload:{_status:-1,_result:t},_init:Sg}};N.memo=function(t,e){return{$$typeof:bg,type:t,compare:e===void 0?null:e}};N.startTransition=function(t){var e=Dr.transition;Dr.transition={};try{t()}finally{Dr.transition=e}};N.unstable_act=Ji;N.useCallback=function(t,e){return he.current.useCallback(t,e)};N.useContext=function(t){return he.current.useContext(t)};N.useDebugValue=function(){};N.useDeferredValue=function(t){return he.current.useDeferredValue(t)};N.useEffect=function(t,e){return he.current.useEffect(t,e)};N.useId=function(){return he.current.useId()};N.useImperativeHandle=function(t,e,r){return he.current.useImperativeHandle(t,e,r)};N.useInsertionEffect=function(t,e){return he.current.useInsertionEffect(t,e)};N.useLayoutEffect=function(t,e){return he.current.useLayoutEffect(t,e)};N.useMemo=function(t,e){return he.current.useMemo(t,e)};N.useReducer=function(t,e,r){return he.current.useReducer(t,e,r)};N.useRef=function(t){return he.current.useRef(t)};N.useState=function(t){return he.current.useState(t)};N.useSyncExternalStore=function(t,e,r){return he.current.useSyncExternalStore(t,e,r)};N.useTransition=function(){return he.current.useTransition()};N.version="18.3.1"});var Xi=Za(($,Mr)=>{"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"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),D=Symbol.iterator,K="@@iterator";function G(c){if(c===null||typeof c!="object")return null;var f=D&&c[D]||c[K];return typeof f=="function"?f:null}var se={current:null},q={transition:null},H={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},J={current:null},ce={},Le=null;function Xe(c){Le=c}ce.setExtraStackFrame=function(c){Le=c},ce.getCurrentStack=null,ce.getStackAddendum=function(){var c="";Le&&(c+=Le);var f=ce.getCurrentStack;return f&&(c+=f()||""),c};var Oe=!1,Te=!1,fa=!1,pa=!1,Pe=!1,_e={ReactCurrentDispatcher:se,ReactCurrentBatchConfig:q,ReactCurrentOwner:J};_e.ReactDebugCurrentFrame=ce,_e.ReactCurrentActQueue=H;function Ee(c){{for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];Ce("warn",c,g)}}function j(c){{for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];Ce("error",c,g)}}function Ce(c,f,g){{var h=_e.ReactDebugCurrentFrame,b=h.getStackAddendum();b!==""&&(f+="%s",g=g.concat([b]));var I=g.map(function(w){return String(w)});I.unshift("Warning: "+f),Function.prototype.apply.call(console[c],console,I)}}var ke={};function ze(c,f){{var g=c.constructor,h=g&&(g.displayName||g.name)||"ReactClass",b=h+"."+f;if(ke[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,h),ke[b]=!0}}var ei={isMounted:function(c){return!1},enqueueForceUpdate:function(c,f,g){ze(c,"forceUpdate")},enqueueReplaceState:function(c,f,g,h){ze(c,"replaceState")},enqueueSetState:function(c,f,g,h){ze(c,"setState")}},Re=Object.assign,ga={};Object.freeze(ga);function Qe(c,f,g){this.props=c,this.context=f,this.refs=ga,this.updater=g||ei}Qe.prototype.isReactComponent={},Qe.prototype.setState=function(c,f){if(typeof c!="object"&&typeof c!="function"&&c!=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,c,f,"setState")},Qe.prototype.forceUpdate=function(c){this.updater.enqueueForceUpdate(this,c,"forceUpdate")};{var ma={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)."]},Qf=function(c,f){Object.defineProperty(Qe.prototype,c,{get:function(){Ee("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var ha in ma)ma.hasOwnProperty(ha)&&Qf(ha,ma[ha])}function ti(){}ti.prototype=Qe.prototype;function ya(c,f,g){this.props=c,this.context=f,this.refs=ga,this.updater=g||ei}var va=ya.prototype=new ti;va.constructor=ya,Re(va,Qe.prototype),va.isPureReactComponent=!0;function ep(){var c={current:null};return Object.seal(c),c}var tp=Array.isArray;function Tr(c){return tp(c)}function rp(c){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&c[Symbol.toStringTag]||c.constructor.name||"Object";return g}}function np(c){try{return ri(c),!1}catch{return!0}}function ri(c){return""+c}function Pr(c){if(np(c))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rp(c)),ri(c)}function ap(c,f,g){var h=c.displayName;if(h)return h;var b=f.displayName||f.name||"";return b!==""?g+"("+b+")":g}function ni(c){return c.displayName||"Context"}function Ke(c){if(c==null)return null;if(typeof c.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case y:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case o:var f=c;return ni(f)+".Consumer";case i:var g=c;return ni(g._context)+".Provider";case d:return ap(c,c.render,"ForwardRef");case T:var h=c.displayName||null;return h!==null?h:Ke(c.type)||"Memo";case k:{var b=c,I=b._payload,w=b._init;try{return Ke(w(I))}catch{return null}}}return null}var qt=Object.prototype.hasOwnProperty,ai={key:!0,ref:!0,__self:!0,__source:!0},si,ii,_a;_a={};function oi(c){if(qt.call(c,"ref")){var f=Object.getOwnPropertyDescriptor(c,"ref").get;if(f&&f.isReactWarning)return!1}return c.ref!==void 0}function ui(c){if(qt.call(c,"key")){var f=Object.getOwnPropertyDescriptor(c,"key").get;if(f&&f.isReactWarning)return!1}return c.key!==void 0}function sp(c,f){var g=function(){si||(si=!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(c,"key",{get:g,configurable:!0})}function ip(c,f){var g=function(){ii||(ii=!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(c,"ref",{get:g,configurable:!0})}function op(c){if(typeof c.ref=="string"&&J.current&&c.__self&&J.current.stateNode!==c.__self){var f=Ke(J.current.type);_a[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,c.ref),_a[f]=!0)}}var ba=function(c,f,g,h,b,I,w){var R={$$typeof:e,type:c,key:f,ref:g,props:w,_owner:I};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function up(c,f,g){var h,b={},I=null,w=null,R=null,F=null;if(f!=null){oi(f)&&(w=f.ref,op(f)),ui(f)&&(Pr(f.key),I=""+f.key),R=f.__self===void 0?null:f.__self,F=f.__source===void 0?null:f.__source;for(h in f)qt.call(f,h)&&!ai.hasOwnProperty(h)&&(b[h]=f[h])}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(c&&c.defaultProps){var re=c.defaultProps;for(h in re)b[h]===void 0&&(b[h]=re[h])}if(I||w){var oe=typeof c=="function"?c.displayName||c.name||"Unknown":c;I&&sp(b,oe),w&&ip(b,oe)}return ba(c,I,w,R,F,J.current,b)}function cp(c,f){var g=ba(c.type,f,c.ref,c._self,c._source,c._owner,c.props);return g}function lp(c,f,g){if(c==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+c+".");var h,b=Re({},c.props),I=c.key,w=c.ref,R=c._self,F=c._source,Y=c._owner;if(f!=null){oi(f)&&(w=f.ref,Y=J.current),ui(f)&&(Pr(f.key),I=""+f.key);var Q;c.type&&c.type.defaultProps&&(Q=c.type.defaultProps);for(h in f)qt.call(f,h)&&!ai.hasOwnProperty(h)&&(f[h]===void 0&&Q!==void 0?b[h]=Q[h]:b[h]=f[h])}var ee=arguments.length-2;if(ee===1)b.children=g;else if(ee>1){for(var re=Array(ee),oe=0;oe<ee;oe++)re[oe]=arguments[oe+2];b.children=re}return ba(c.type,I,w,R,F,Y,b)}function bt(c){return typeof c=="object"&&c!==null&&c.$$typeof===e}var ci=".",dp=":";function fp(c){var f=/[=:]/g,g={"=":"=0",":":"=2"},h=c.replace(f,function(b){return g[b]});return"$"+h}var li=!1,pp=/\/+/g;function di(c){return c.replace(pp,"$&/")}function Ta(c,f){return typeof c=="object"&&c!==null&&c.key!=null?(Pr(c.key),fp(""+c.key)):f.toString(36)}function Er(c,f,g,h,b){var I=typeof c;(I==="undefined"||I==="boolean")&&(c=null);var w=!1;if(c===null)w=!0;else switch(I){case"string":case"number":w=!0;break;case"object":switch(c.$$typeof){case e:case r:w=!0}}if(w){var R=c,F=b(R),Y=h===""?ci+Ta(R,0):h;if(Tr(F)){var Q="";Y!=null&&(Q=di(Y)+"/"),Er(F,f,Q,"",function(sg){return sg})}else F!=null&&(bt(F)&&(F.key&&(!R||R.key!==F.key)&&Pr(F.key),F=cp(F,g+(F.key&&(!R||R.key!==F.key)?di(""+F.key)+"/":"")+Y)),f.push(F));return 1}var ee,re,oe=0,de=h===""?ci:h+dp;if(Tr(c))for(var Zr=0;Zr<c.length;Zr++)ee=c[Zr],re=de+Ta(ee,Zr),oe+=Er(ee,f,g,re,b);else{var Ia=G(c);if(typeof Ia=="function"){var Mi=c;Ia===Mi.entries&&(li||Ee("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),li=!0);for(var ng=Ia.call(Mi),ji,ag=0;!(ji=ng.next()).done;)ee=ji.value,re=de+Ta(ee,ag++),oe+=Er(ee,f,g,re,b)}else if(I==="object"){var Hi=String(c);throw new Error("Objects are not valid as a React child (found: "+(Hi==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":Hi)+"). If you meant to render a collection of children, use an array instead.")}}return oe}function xr(c,f,g){if(c==null)return c;var h=[],b=0;return Er(c,h,"","",function(I){return f.call(g,I,b++)}),h}function gp(c){var f=0;return xr(c,function(){f++}),f}function mp(c,f,g){xr(c,function(){f.apply(this,arguments)},g)}function hp(c){return xr(c,function(f){return f})||[]}function yp(c){if(!bt(c))throw new Error("React.Children.only expected to receive a single React element child.");return c}function vp(c){var f={$$typeof:o,_currentValue:c,_currentValue2:c,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};f.Provider={$$typeof:i,_context:f};var g=!1,h=!1,b=!1;{var I={$$typeof:o,_context:f};Object.defineProperties(I,{Provider:{get:function(){return h||(h=!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(w){f.Provider=w}},_currentValue:{get:function(){return f._currentValue},set:function(w){f._currentValue=w}},_currentValue2:{get:function(){return f._currentValue2},set:function(w){f._currentValue2=w}},_threadCount:{get:function(){return f._threadCount},set:function(w){f._threadCount=w}},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(w){b||(Ee("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",w),b=!0)}}}),f.Consumer=I}return f._currentRenderer=null,f._currentRenderer2=null,f}var Gt=-1,Pa=0,fi=1,_p=2;function bp(c){if(c._status===Gt){var f=c._result,g=f();if(g.then(function(I){if(c._status===Pa||c._status===Gt){var w=c;w._status=fi,w._result=I}},function(I){if(c._status===Pa||c._status===Gt){var w=c;w._status=_p,w._result=I}}),c._status===Gt){var h=c;h._status=Pa,h._result=g}}if(c._status===fi){var b=c._result;return b===void 0&&j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
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
|
|
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?`,
|
|
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
|
|
7
7
|
|
|
8
8
|
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,
|
|
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:
|
|
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.`),
|
|
14
|
-
`+
|
|
15
|
-
`),
|
|
16
|
-
`),Y=
|
|
17
|
-
`+
|
|
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`
|
|
18
18
|
|
|
19
|
-
Check the render method of \``+
|
|
19
|
+
Check the render method of \``+u+"`."}return""}function Xp(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
|
|
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=`
|
|
22
22
|
|
|
23
|
-
Check the top-level render call using <`+g+">.")}return f}function Oi(c,f){if(!(!c._store||c._store.validated||c.key!=null)){c._store.validated=!0;var g=qp(f);if(!ki[g]){ki[g]=!0;var h="";c&&c._owner&&c._owner!==J.current&&(h=" It was passed a child from "+Ke(c._owner.type)+"."),Tt(c),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,h),Tt(null)}}}function Ci(c,f){if(typeof c=="object"){if(Tr(c))for(var g=0;g<c.length;g++){var h=c[g];bt(h)&&Oi(h,f)}else if(bt(c))c._store&&(c._store.validated=!0);else if(c){var b=G(c);if(typeof b=="function"&&b!==c.entries)for(var I=b.call(c),w;!(w=I.next()).done;)bt(w.value)&&Oi(w.value,f)}}}function Ii(c){{var f=c.type;if(f==null||typeof f=="string")return;var g;if(typeof f=="function")g=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===d||f.$$typeof===T))g=f.propTypes;else return;if(g){var h=Ke(f);zp(g,c.props,"prop",h,c)}else if(f.PropTypes!==void 0&&!wa){wa=!0;var b=Ke(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 Gp(c){{for(var f=Object.keys(c.props),g=0;g<f.length;g++){var h=f[g];if(h!=="children"&&h!=="key"){Tt(c),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",h),Tt(null);break}}c.ref!==null&&(Tt(c),j("Invalid attribute `ref` supplied to `React.Fragment`."),Tt(null))}}function Zi(c,f,g){var h=gi(c);if(!h){var b="";(c===void 0||typeof c=="object"&&c!==null&&Object.keys(c).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 I=Vp(f);I?b+=I:b+=wi();var w;c===null?w="null":Tr(c)?w="array":c!==void 0&&c.$$typeof===e?(w="<"+(Ke(c.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):w=typeof c,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,b)}var R=up.apply(this,arguments);if(R==null)return R;if(h)for(var F=2;F<arguments.length;F++)Ci(arguments[F],c);return c===n?Gp(R):Ii(R),R}var Ai=!1;function Wp(c){var f=Zi.bind(null,c);return f.type=c,Ai||(Ai=!0,Ee("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 Ee("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:c}),c}}),f}function Jp(c,f,g){for(var h=lp.apply(this,arguments),b=2;b<arguments.length;b++)Ci(arguments[b],h.type);return Ii(h),h}function Yp(c,f){var g=q.transition;q.transition={};var h=q.transition;q.transition._updatedFibers=new Set;try{c()}finally{if(q.transition=g,g===null&&h._updatedFibers){var b=h._updatedFibers.size;b>10&&Ee("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."),h._updatedFibers.clear()}}}var Ri=!1,Cr=null;function Xp(c){if(Cr===null)try{var f=("require"+Math.random()).slice(0,7),g=Mr&&Mr[f];Cr=g.call(Mr,"timers").setImmediate}catch{Cr=function(b){Ri===!1&&(Ri=!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 I=new MessageChannel;I.port1.onmessage=b,I.port2.postMessage(void 0)}}return Cr(c)}var Pt=0,Bi=!1;function Di(c){{var f=Pt;Pt++,H.current===null&&(H.current=[]);var g=H.isBatchingLegacy,h;try{if(H.isBatchingLegacy=!0,h=c(),!g&&H.didScheduleLegacyUpdate){var b=H.current;b!==null&&(H.didScheduleLegacyUpdate=!1,Ca(b))}}catch(re){throw Ir(f),re}finally{H.isBatchingLegacy=g}if(h!==null&&typeof h=="object"&&typeof h.then=="function"){var I=h,w=!1,R={then:function(re,oe){w=!0,I.then(function(de){Ir(f),Pt===0?ka(de,re,oe):re(de)},function(de){Ir(f),oe(de)})}};return!Bi&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){w||(Bi=!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 () => ...);"))}),R}else{var F=h;if(Ir(f),Pt===0){var Y=H.current;Y!==null&&(Ca(Y),H.current=null);var Q={then:function(re,oe){H.current===null?(H.current=[],ka(F,re,oe)):re(F)}};return Q}else{var ee={then:function(re,oe){re(F)}};return ee}}}}function Ir(c){c!==Pt-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. "),Pt=c}function ka(c,f,g){{var h=H.current;if(h!==null)try{Ca(h),Xp(function(){h.length===0?(H.current=null,f(c)):ka(c,f,g)})}catch(b){g(b)}else f(c)}}var Oa=!1;function Ca(c){if(!Oa){Oa=!0;var f=0;try{for(;f<c.length;f++){var g=c[f];do g=g(!0);while(g!==null)}c.length=0}catch(h){throw c=c.slice(f+1),h}finally{Oa=!1}}}var Qp=Zi,eg=Jp,tg=Wp,rg={map:xr,forEach:mp,count:gp,toArray:hp,only:yp};$.Children=rg,$.Component=Qe,$.Fragment=n,$.Profiler=s,$.PureComponent=ya,$.StrictMode=a,$.Suspense=p,$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_e,$.act=Di,$.cloneElement=eg,$.createContext=vp,$.createElement=Qp,$.createFactory=tg,$.createRef=ep,$.forwardRef=Pp,$.isValidElement=bt,$.lazy=Tp,$.memo=Ep,$.startTransition=Yp,$.unstable_act=Di,$.useCallback=Zp,$.useContext=xp,$.useDebugValue=Bp,$.useDeferredValue=Mp,$.useEffect=Op,$.useId=jp,$.useImperativeHandle=Rp,$.useInsertionEffect=Cp,$.useLayoutEffect=Ip,$.useMemo=Ap,$.useReducer=wp,$.useRef=kp,$.useState=Sp,$.useSyncExternalStore=Hp,$.useTransition=Dp,$.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var xt=Za((ib,ja)=>{"use strict";process.env.NODE_ENV==="production"?ja.exports=Yi():ja.exports=Xi()});var nb={};Jt(nb,{BRAND:()=>kl,Bot:()=>oa,BotDefinition:()=>ia,BotLogger:()=>Ye,BotSpecificClient:()=>Ze,DIRTY:()=>it,EMPTY_PATH:()=>Tl,ErrorBoundary:()=>At,INVALID:()=>C,Integration:()=>sa,IntegrationDefinition:()=>ra,IntegrationLogger:()=>Je,IntegrationSpecificClient:()=>Kt,InterfaceDefinition:()=>ua,NEVER:()=>bf,OK:()=>pe,ParseInputLazyPath:()=>Se,ParseStatus:()=>ye,Plugin:()=>la,PluginDefinition:()=>ca,RuntimeError:()=>da.RuntimeError,Schema:()=>B,ZodAny:()=>lr,ZodArray:()=>Mt,ZodBigInt:()=>$n,ZodBoolean:()=>Un,ZodBranded:()=>Fn,ZodCatch:()=>Ln,ZodDate:()=>zn,ZodDefault:()=>fr,ZodDiscriminatedUnion:()=>Ts,ZodEffects:()=>We,ZodEnum:()=>yt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>ys,ZodFunction:()=>Es,ZodIntersection:()=>Kn,ZodIssueCode:()=>_,ZodLazy:()=>Vn,ZodLiteral:()=>qn,ZodMap:()=>xs,ZodNaN:()=>Ss,ZodNativeEnum:()=>Gn,ZodNever:()=>qe,ZodNull:()=>Wn,ZodNullable:()=>ut,ZodNumber:()=>Jn,ZodObject:()=>ct,ZodOptional:()=>He,ZodParsedType:()=>x,ZodPipeline:()=>Yn,ZodPromise:()=>gr,ZodReadonly:()=>mr,ZodRecord:()=>ws,ZodRef:()=>ks,ZodSchema:()=>B,ZodSet:()=>Os,ZodString:()=>ge,ZodSymbol:()=>js,ZodTransformer:()=>We,ZodTuple:()=>lt,ZodType:()=>B,ZodUndefined:()=>Xn,ZodUnion:()=>Qn,ZodUnknown:()=>Zt,ZodVoid:()=>Hs,ZuiForm:()=>P_,addIssueToContext:()=>E,agent:()=>Sd,aimodel:()=>Id,any:()=>Ud,array:()=>Kd,bigint:()=>Md,boolean:()=>zs,botIdHeader:()=>yr,botUserIdHeader:()=>qs,coerce:()=>_f,configurationHeader:()=>vr,configurationTypeHeader:()=>Js,conversation:()=>Pd,createZodEnum:()=>pr,cuid2Regex:()=>Is,cuidRegex:()=>Cs,custom:()=>bs,datasource:()=>Zd,date:()=>jd,datetimeRegex:()=>Ms,defaultComponentDefinitions:()=>E_,discriminatedUnion:()=>Wd,effect:()=>is,emailRegex:()=>Rs,enum:()=>of,errorUtil:()=>O,event:()=>wd,fromJsonSchema:()=>yf,fromObject:()=>vf,function:()=>nf,getErrorMap:()=>Bt,getParsedType:()=>Me,instanceof:()=>Bd,integrationIdHeader:()=>Gs,intent:()=>Cd,intersection:()=>Jd,ipv4Regex:()=>Bs,ipv6Regex:()=>Ds,isAborted:()=>Xr,isApiError:()=>da.isApiError,isAsync:()=>cr,isDirty:()=>Qr,isEmojiRegex:()=>zl,isValid:()=>Dt,jsonSchemaToZui:()=>hr,knowledgebase:()=>Ad,late:()=>Rd,lazy:()=>af,literal:()=>sf,makeIssue:()=>ur,map:()=>tf,mergeObjectSchemas:()=>Ft,message:()=>xd,messages:()=>Vs,nan:()=>Dd,nativeEnum:()=>uf,never:()=>Ld,null:()=>$d,nullable:()=>df,number:()=>Ls,object:()=>Vd,objectToZui:()=>Ht,objectUtil:()=>Jr,oboolean:()=>hf,onumber:()=>mf,operationHeader:()=>_r,optional:()=>lf,ostring:()=>gf,parseBody:()=>we,pipeline:()=>pf,preprocess:()=>ff,processCreateParams:()=>A,promise:()=>cf,quotelessJson:()=>vl,readonly:()=>ef,record:()=>Xd,ref:()=>Qd,serve:()=>br,set:()=>rf,setErrorMap:()=>_s,strictObject:()=>qd,string:()=>Fs,symbol:()=>Hd,table:()=>kd,tablerow:()=>Od,transformer:()=>is,transforms:()=>x_,tuple:()=>Yd,typeHeader:()=>Ys,ulidRegex:()=>Zs,undefined:()=>Nd,union:()=>Gd,unknown:()=>Fd,user:()=>Ed,util:()=>M,uuidRegex:()=>As,variable:()=>Td,void:()=>zd,webhookIdHeader:()=>Ws,withErrorBoundary:()=>xf,z:()=>S,zuiToJsonSchema:()=>ea});module.exports=dg(nb);var Vs={};Jt(Vs,{defaults:()=>C_,markdown:()=>O_});var An=et(xt(),1),ne=et(xt(),1),Ne=et(xt(),1),Nt=et(xt(),1),be=et(xt(),1),os=Object.defineProperty,kg=Object.defineProperties,Og=Object.getOwnPropertyDescriptors,qr=Object.getOwnPropertySymbols,Bo=Object.prototype.hasOwnProperty,Do=Object.prototype.propertyIsEnumerable,Qi=(t,e,r)=>e in t?os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))Bo.call(e,r)&&Qi(t,r,e[r]);if(qr)for(var r of qr(e))Do.call(e,r)&&Qi(t,r,e[r]);return t},m=(t,e)=>kg(t,Og(e)),u=(t,e)=>os(t,"name",{value:e,configurable:!0}),Mo=(t,e)=>{var r={};for(var n in t)Bo.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&qr)for(var n of qr(t))e.indexOf(n)<0&&Do.call(t,n)&&(r[n]=t[n]);return r},jo=(t,e)=>{for(var r in e)os(t,r,{get:e[r],enumerable:!0})},S={};jo(S,{BRAND:()=>kl,DIRTY:()=>it,EMPTY_PATH:()=>Tl,INVALID:()=>C,NEVER:()=>bf,OK:()=>pe,ParseInputLazyPath:()=>Se,ParseStatus:()=>ye,Schema:()=>B,ZodAny:()=>lr,ZodArray:()=>Mt,ZodBigInt:()=>$n,ZodBoolean:()=>Un,ZodBranded:()=>Fn,ZodCatch:()=>Ln,ZodDate:()=>zn,ZodDefault:()=>fr,ZodDiscriminatedUnion:()=>Ts,ZodEffects:()=>We,ZodEnum:()=>yt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>ys,ZodFunction:()=>Es,ZodIntersection:()=>Kn,ZodIssueCode:()=>_,ZodLazy:()=>Vn,ZodLiteral:()=>qn,ZodMap:()=>xs,ZodNaN:()=>Ss,ZodNativeEnum:()=>Gn,ZodNever:()=>qe,ZodNull:()=>Wn,ZodNullable:()=>ut,ZodNumber:()=>Jn,ZodObject:()=>ct,ZodOptional:()=>He,ZodParsedType:()=>x,ZodPipeline:()=>Yn,ZodPromise:()=>gr,ZodReadonly:()=>mr,ZodRecord:()=>ws,ZodRef:()=>ks,ZodSchema:()=>B,ZodSet:()=>Os,ZodString:()=>ge,ZodSymbol:()=>js,ZodTransformer:()=>We,ZodTuple:()=>lt,ZodType:()=>B,ZodUndefined:()=>Xn,ZodUnion:()=>Qn,ZodUnknown:()=>Zt,ZodVoid:()=>Hs,addIssueToContext:()=>E,agent:()=>Sd,aimodel:()=>Id,any:()=>Ud,array:()=>Kd,bigint:()=>Md,boolean:()=>zs,coerce:()=>_f,conversation:()=>Pd,createZodEnum:()=>pr,cuid2Regex:()=>Is,cuidRegex:()=>Cs,custom:()=>bs,datasource:()=>Zd,date:()=>jd,datetimeRegex:()=>Ms,default:()=>Xv,discriminatedUnion:()=>Wd,effect:()=>is,emailRegex:()=>Rs,enum:()=>of,errorUtil:()=>O,event:()=>wd,fromJsonSchema:()=>yf,fromObject:()=>vf,function:()=>nf,getErrorMap:()=>Bt,getParsedType:()=>Me,instanceof:()=>Bd,intent:()=>Cd,intersection:()=>Jd,ipv4Regex:()=>Bs,ipv6Regex:()=>Ds,isAborted:()=>Xr,isAsync:()=>cr,isDirty:()=>Qr,isEmojiRegex:()=>zl,isValid:()=>Dt,jsonSchemaToZui:()=>hr,knowledgebase:()=>Ad,late:()=>Rd,lazy:()=>af,literal:()=>sf,makeIssue:()=>ur,map:()=>tf,message:()=>xd,nan:()=>Dd,nativeEnum:()=>uf,never:()=>Ld,null:()=>$d,nullable:()=>df,number:()=>Ls,object:()=>Vd,objectToZui:()=>Ht,objectUtil:()=>Jr,oboolean:()=>hf,onumber:()=>mf,optional:()=>lf,ostring:()=>gf,pipeline:()=>pf,preprocess:()=>ff,processCreateParams:()=>A,promise:()=>cf,quotelessJson:()=>vl,readonly:()=>ef,record:()=>Xd,ref:()=>Qd,set:()=>rf,setErrorMap:()=>_s,strictObject:()=>qd,string:()=>Fs,symbol:()=>Hd,table:()=>kd,tablerow:()=>Od,transformer:()=>is,tuple:()=>Yd,ulidRegex:()=>Zs,undefined:()=>Nd,union:()=>Gd,unknown:()=>Fd,user:()=>Ed,util:()=>M,uuidRegex:()=>As,variable:()=>Td,void:()=>zd,zuiToJsonSchema:()=>ea});var U="x-zui",Ho=(0,ne.createContext)({formData:void 0,formSchema:void 0,setFormData:u(()=>{throw new Error("Must be within a FormDataProvider")},"setFormData"),setHiddenState:u(()=>{throw new Error("Must be within a FormDataProvider")},"setHiddenState"),setDisabledState:u(()=>{throw new Error("Must be within a FormDataProvider")},"setDisabledState"),hiddenState:{},disabledState:{},validation:{formValid:null,formErrors:null}}),eo=u((t,e,r)=>{var n;let a=(n=e[U])==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"),No=u((t,e)=>{let r=(0,ne.useContext)(Ho);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ne.useMemo)(()=>at(r.formData,e),[r.formData,e]),a=(0,ne.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(D=>Fo(D.path,e)).map(D=>({message:D.message,code:D.code,path:e})))||null}:{formValid:!0,formErrors:[]}},[r.validation.formValid,r.validation.formErrors,e]),s=r.dataTransform?r.dataTransform(n):n,i=(0,ne.useMemo)(()=>eo("hidden",t,s),[t,s]),o=(0,ne.useMemo)(()=>eo("disabled",t,s),[t,s]);(0,ne.useEffect)(()=>{r.setHiddenState(P=>St(P,e,i||{})),r.setDisabledState(P=>St(P,e,o||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:d,hidden:p}=(0,ne.useMemo)(()=>{let P=i===!0||at(r.hiddenState,e),D=o===!0||at(r.disabledState,e);return{hidden:P===!0,disabled:D===!0}},[r.hiddenState,r.disabledState,i,o,e]),y=(0,ne.useCallback)((P,D)=>{r.setFormData(K=>St(K,P,D))},[r.setFormData]),T=(0,ne.useCallback)((P,D=void 0)=>{let K=It(t.items);r.setFormData(G=>{let se=at(G,P)||[];return D===void 0&&(D=K),St(G,P,Array.isArray(se)?[...se,D]:[D])})},[r.setFormData]),k=(0,ne.useCallback)((P,D)=>{r.setFormData(K=>{let G=at(K,P)||[];return Array.isArray(G)?(G.splice(D,1),St(K,P,G)):K})},[r.setFormData]);return l(m(l({},r),{data:n,disabled:d,hidden:p,handlePropertyChange:y,addArrayItem:T,removeArrayItem:k}),a)},"useFormData");function St(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??{}),l({},t)}u(St,"setObjectPath");var It=u((t,e)=>{var r,n,a,s;if(Array.isArray(t))return It(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return It(t.anyOf[0]);if(t.type==="object"&&t.properties){let i={};return Object.entries(t.properties).map(([o,d])=>{var p;i[o]=It(d,!((p=t.required)!=null&&p.includes(o))||$o(d)||!1)}),i}if(t.type==="array")return t.minItems&&t.minItems>0?[It(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"),Cg=u(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:i})=>{let[o,d]=(0,ne.useState)({}),[p,y]=(0,ne.useState)({}),T=i?i(r):r,k=(0,ne.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let P=hr(n).safeParse(T);return P.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:P.error.issues}},[JSON.stringify({transformedData:T})]);return(0,ne.useEffect)(()=>{s&&s(k)},[k]),ne.default.createElement(Ho.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:k,hiddenState:o,setHiddenState:d,disabledState:p,setDisabledState:y,dataTransform:i}},t)},"FormDataProvider");function at(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}u(at,"getPathData");function $o(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}u($o,"isOptional");function Gr(t,e){let r=l({},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]=Gr(r[n],e[n]):r[n]=Gr({},e[n]):r[n]=e[n]);return r}u(Gr,"deepMerge");var Ig=u((t,e)=>{let{handlePropertyChange:r,data:n}=No(t,e),{discriminator:a,value:s,discriminatedSchema:i}=(0,An.useMemo)(()=>{let o=Uo(t.anyOf),d=o?.key?n?.[o.key]:t.default||null,p=Zg(o?.key||null,d,t.anyOf);return{discriminator:o,value:d,discriminatedSchema:p}},[t.anyOf,n]);return(0,An.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"),Uo=u(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"),Zg=u((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(l({},s),{properties:m(l({},s.properties),{[t]:m(l({},i),{[U]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),Ag=u(t=>{var e;return(e=t.anyOf)!=null&&e.length?Uo(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),Rg=u((t,e)=>{var r,n,a;let s=Ag(e),i=((r=e[U])==null?void 0:r.displayAs)||null;if(!i||!Array.isArray(i)||i.length<2){let y=(n=t?.[s])==null?void 0:n.default;return y?{Component:y,type:s,id:"default",params:{}}:null}let o=i[0],d=((a=t?.[s])==null?void 0:a[o])||null;if(!d)return console.warn(`Component ${s}.${o} not found`),null;let p=i[1]||{};return{Component:d,type:s,id:o,params:p}},"resolveComponent");function Fo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}u(Fo,"pathMatches");function Fa(t,e){return e||(e=new RegExp("/s|-|_| ","g")),Ko(t).split(e).map(Lo).map(Vo).reduce(zo)}u(Fa,"formatTitle");function Lo(t){return t.charAt(0).toUpperCase()+t.substring(1)}u(Lo,"capitalize");function zo(t,e){return`${t} ${e}`}u(zo,"combine");function Ko(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}u(Ko,"decamelize");function Vo(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of Hg)if(s.toLowerCase()===n)return s;return Bg.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:jg.includes(n)||Mg.includes(n)||Dg.includes(n)?n:t}u(Vo,"handleSpecialWords");var Bg=["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"],Dg=["a","an","the"],Mg=["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"],jg=["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"],Hg=["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`:je(t)}u(qo,"primitiveToTypscriptLiteralType");function je(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${je(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}u(je,"primitiveToTypescriptValue");function Go(t){return typeof t>"u"?"undefined":JSON.stringify(t)}u(Go,"unknownToTypescriptValue");var to=u(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:je(t),"toPropertyKey"),Ng=u(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Wo=u(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(Ng).filter(n=>!!n).join("")},"toTypeArgumentName"),Z=u(t=>{let e=(t??"").split(`
|
|
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(`
|
|
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"),
|
|
28
|
-
`:"",
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
(${
|
|
32
|
-
${se}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(je).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return L(o.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new cu(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${L(o.innerType,s)} | undefined`;case v.ZodFirstPartyTypeKind.ZodNullable:return`${L(o.innerType,s)} | null`;case v.ZodFirstPartyTypeKind.ZodDefault:return L(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodCatch:return L(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${L(o.type,s)}>`;case v.ZodFirstPartyTypeKind.ZodBranded:return L(o.type,s);case v.ZodFirstPartyTypeKind.ZodPipeline:return L(o.in,s);case v.ZodFirstPartyTypeKind.ZodSymbol:return`${Z(o.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${L(o.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return Wo(o.uri);default:M.assertNever(o)}}u(L,"sUnwrapZod");var Lg=u((t,e)=>{if(t.props.type==="none")return L(t.props.schema,e);let r=Z(t.props.schema.description),n=t.props.schema.describe(""),a=L(n,e);if(t.props.type==="variable")return ro(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(Wo).join(", ")}>`:"";return ro(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),zg=u(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Kg=u((t,e)=>{let r=zg(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new za;return new Nr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new du;if(r==="variable"){if(n.length>0)throw new za;return new Nr({type:"variable",identifier:a,schema:t})}return new Nr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),Vg=typeof global=="object"&&global&&global.Object===Object&&global,vu=Vg,qg=typeof self=="object"&&self&&self.Object===Object&&self,Gg=vu||qg||Function("return this")(),Ue=Gg,Wg=Ue.Symbol,Ve=Wg,_u=Object.prototype,Jg=_u.hasOwnProperty,Yg=_u.toString,Xt=Ve?Ve.toStringTag:void 0;function bu(t){var e=Jg.call(t,Xt),r=t[Xt];try{t[Xt]=void 0;var n=!0}catch{}var a=Yg.call(t);return n&&(e?t[Xt]=r:delete t[Xt]),a}u(bu,"getRawTag");var Xg=bu,Qg=Object.prototype,em=Qg.toString;function Tu(t){return em.call(t)}u(Tu,"objectToString");var tm=Tu,rm="[object Null]",nm="[object Undefined]",so=Ve?Ve.toStringTag:void 0;function Pu(t){return t==null?t===void 0?nm:rm:so&&so in Object(t)?Xg(t):tm(t)}u(Pu,"baseGetTag");var Ut=Pu;function Eu(t){return t!=null&&typeof t=="object"}u(Eu,"isObjectLike");var Rt=Eu,am="[object Symbol]";function xu(t){return typeof t=="symbol"||Rt(t)&&Ut(t)==am}u(xu,"isSymbol");var us=xu;function Su(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}u(Su,"arrayMap");var sm=Su,im=Array.isArray,$e=im,om=1/0,io=Ve?Ve.prototype:void 0,oo=io?io.toString:void 0;function cs(t){if(typeof t=="string")return t;if($e(t))return sm(t,cs)+"";if(us(t))return oo?oo.call(t):"";var e=t+"";return e=="0"&&1/t==-om?"-0":e}u(cs,"baseToString");var um=cs;function wu(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}u(wu,"isObject");var ls=wu;function ku(t){return t}u(ku,"identity");var cm=ku,lm="[object AsyncFunction]",dm="[object Function]",fm="[object GeneratorFunction]",pm="[object Proxy]";function Ou(t){if(!ls(t))return!1;var e=Ut(t);return e==dm||e==fm||e==lm||e==pm}u(Ou,"isFunction");var Cu=Ou,gm=Ue["__core-js_shared__"],Ha=gm,uo=function(){var t=/[^.]+$/.exec(Ha&&Ha.keys&&Ha.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Iu(t){return!!uo&&uo in t}u(Iu,"isMasked");var mm=Iu,hm=Function.prototype,ym=hm.toString;function Zu(t){if(t!=null){try{return ym.call(t)}catch{}try{return t+""}catch{}}return""}u(Zu,"toSource");var dt=Zu,vm=/[\\^$.*+?()[\]{}|]/g,_m=/^\[object .+?Constructor\]$/,bm=Function.prototype,Tm=Object.prototype,Pm=bm.toString,Em=Tm.hasOwnProperty,xm=RegExp("^"+Pm.call(Em).replace(vm,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Au(t){if(!ls(t)||mm(t))return!1;var e=Cu(t)?xm:_m;return e.test(dt(t))}u(Au,"baseIsNative");var Sm=Au;function Ru(t,e){return t?.[e]}u(Ru,"getValue");var wm=Ru;function Bu(t,e){var r=wm(t,e);return Sm(r)?r:void 0}u(Bu,"getNative");var ft=Bu,km=ft(Ue,"WeakMap"),Ka=km,Om=function(){try{var t=ft(Object,"defineProperty");return t({},"",{}),t}catch{}}(),co=Om,Cm=9007199254740991,Im=/^(?:0|[1-9]\d*)$/;function Du(t,e){var r=typeof t;return e=e??Cm,!!e&&(r=="number"||r!="symbol"&&Im.test(t))&&t>-1&&t%1==0&&t<e}u(Du,"isIndex");var Mu=Du;function ju(t,e,r){e=="__proto__"&&co?co(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}u(ju,"baseAssignValue");var Zm=ju;function Hu(t,e){return t===e||t!==t&&e!==e}u(Hu,"eq");var Nu=Hu,Am=9007199254740991;function $u(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Am}u($u,"isLength");var ds=$u;function Uu(t){return t!=null&&ds(t.length)&&!Cu(t)}u(Uu,"isArrayLike");var Rm=Uu,Bm=Object.prototype;function Fu(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Bm;return t===r}u(Fu,"isPrototype");var Dm=Fu;function Lu(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}u(Lu,"baseTimes");var Mm=Lu,jm="[object Arguments]";function zu(t){return Rt(t)&&Ut(t)==jm}u(zu,"baseIsArguments");var lo=zu,Ku=Object.prototype,Hm=Ku.hasOwnProperty,Nm=Ku.propertyIsEnumerable,$m=lo(function(){return arguments}())?lo:function(t){return Rt(t)&&Hm.call(t,"callee")&&!Nm.call(t,"callee")},Vu=$m;function qu(){return!1}u(qu,"stubFalse");var Um=qu,Gu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fo=Gu&&typeof module=="object"&&module&&!module.nodeType&&module,Fm=fo&&fo.exports===Gu,po=Fm?Ue.Buffer:void 0,Lm=po?po.isBuffer:void 0,zm=Lm||Um,Va=zm,Km="[object Arguments]",Vm="[object Array]",qm="[object Boolean]",Gm="[object Date]",Wm="[object Error]",Jm="[object Function]",Ym="[object Map]",Xm="[object Number]",Qm="[object Object]",eh="[object RegExp]",th="[object Set]",rh="[object String]",nh="[object WeakMap]",ah="[object ArrayBuffer]",sh="[object DataView]",ih="[object Float32Array]",oh="[object Float64Array]",uh="[object Int8Array]",ch="[object Int16Array]",lh="[object Int32Array]",dh="[object Uint8Array]",fh="[object Uint8ClampedArray]",ph="[object Uint16Array]",gh="[object Uint32Array]",X={};X[ih]=X[oh]=X[uh]=X[ch]=X[lh]=X[dh]=X[fh]=X[ph]=X[gh]=!0;X[Km]=X[Vm]=X[ah]=X[qm]=X[sh]=X[Gm]=X[Wm]=X[Jm]=X[Ym]=X[Xm]=X[Qm]=X[eh]=X[th]=X[rh]=X[nh]=!1;function Wu(t){return Rt(t)&&ds(t.length)&&!!X[Ut(t)]}u(Wu,"baseIsTypedArray");var mh=Wu;function Ju(t){return function(e){return t(e)}}u(Ju,"baseUnary");var hh=Ju,Yu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ar=Yu&&typeof module=="object"&&module&&!module.nodeType&&module,yh=ar&&ar.exports===Yu,Na=yh&&vu.process,vh=function(){try{var t=ar&&ar.require&&ar.require("util").types;return t||Na&&Na.binding&&Na.binding("util")}catch{}}(),go=vh,mo=go&&go.isTypedArray,_h=mo?hh(mo):mh,Xu=_h,bh=Object.prototype,Th=bh.hasOwnProperty;function Qu(t,e){var r=$e(t),n=!r&&Vu(t),a=!r&&!n&&Va(t),s=!r&&!n&&!a&&Xu(t),i=r||n||a||s,o=i?Mm(t.length,String):[],d=o.length;for(var p in t)(e||Th.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Mu(p,d)))&&o.push(p);return o}u(Qu,"arrayLikeKeys");var Ph=Qu;function ec(t,e){return function(r){return t(e(r))}}u(ec,"overArg");var Eh=ec,xh=Eh(Object.keys,Object),Sh=xh,wh=Object.prototype,kh=wh.hasOwnProperty;function tc(t){if(!Dm(t))return Sh(t);var e=[];for(var r in Object(t))kh.call(t,r)&&r!="constructor"&&e.push(r);return e}u(tc,"baseKeys");var Oh=tc;function rc(t){return Rm(t)?Ph(t):Oh(t)}u(rc,"keys");var fs=rc,Ch=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ih=/^\w*$/;function nc(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||us(t)?!0:Ih.test(t)||!Ch.test(t)||e!=null&&t in Object(e)}u(nc,"isKey");var ps=nc,Zh=ft(Object,"create"),sr=Zh;function ac(){this.__data__=sr?sr(null):{},this.size=0}u(ac,"hashClear");var Ah=ac;function sc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}u(sc,"hashDelete");var Rh=sc,Bh="__lodash_hash_undefined__",Dh=Object.prototype,Mh=Dh.hasOwnProperty;function ic(t){var e=this.__data__;if(sr){var r=e[t];return r===Bh?void 0:r}return Mh.call(e,t)?e[t]:void 0}u(ic,"hashGet");var jh=ic,Hh=Object.prototype,Nh=Hh.hasOwnProperty;function oc(t){var e=this.__data__;return sr?e[t]!==void 0:Nh.call(e,t)}u(oc,"hashHas");var $h=oc,Uh="__lodash_hash_undefined__";function uc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=sr&&e===void 0?Uh:e,this}u(uc,"hashSet");var Fh=uc;function pt(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])}}u(pt,"Hash");pt.prototype.clear=Ah;pt.prototype.delete=Rh;pt.prototype.get=jh;pt.prototype.has=$h;pt.prototype.set=Fh;var ho=pt;function cc(){this.__data__=[],this.size=0}u(cc,"listCacheClear");var Lh=cc;function lc(t,e){for(var r=t.length;r--;)if(Nu(t[r][0],e))return r;return-1}u(lc,"assocIndexOf");var Bn=lc,zh=Array.prototype,Kh=zh.splice;function dc(t){var e=this.__data__,r=Bn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Kh.call(e,r,1),--this.size,!0}u(dc,"listCacheDelete");var Vh=dc;function fc(t){var e=this.__data__,r=Bn(e,t);return r<0?void 0:e[r][1]}u(fc,"listCacheGet");var qh=fc;function pc(t){return Bn(this.__data__,t)>-1}u(pc,"listCacheHas");var Gh=pc;function gc(t,e){var r=this.__data__,n=Bn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}u(gc,"listCacheSet");var Wh=gc;function gt(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])}}u(gt,"ListCache");gt.prototype.clear=Lh;gt.prototype.delete=Vh;gt.prototype.get=qh;gt.prototype.has=Gh;gt.prototype.set=Wh;var Dn=gt,Jh=ft(Ue,"Map"),ir=Jh;function mc(){this.size=0,this.__data__={hash:new ho,map:new(ir||Dn),string:new ho}}u(mc,"mapCacheClear");var Yh=mc;function hc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}u(hc,"isKeyable");var Xh=hc;function yc(t,e){var r=t.__data__;return Xh(e)?r[typeof e=="string"?"string":"hash"]:r.map}u(yc,"getMapData");var Mn=yc;function vc(t){var e=Mn(this,t).delete(t);return this.size-=e?1:0,e}u(vc,"mapCacheDelete");var Qh=vc;function _c(t){return Mn(this,t).get(t)}u(_c,"mapCacheGet");var ey=_c;function bc(t){return Mn(this,t).has(t)}u(bc,"mapCacheHas");var ty=bc;function Tc(t,e){var r=Mn(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}u(Tc,"mapCacheSet");var ry=Tc;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])}}u(mt,"MapCache");mt.prototype.clear=Yh;mt.prototype.delete=Qh;mt.prototype.get=ey;mt.prototype.has=ty;mt.prototype.set=ry;var jn=mt,ny="Expected a function";function Hn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ny);var r=u(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(Hn.Cache||jn),r}u(Hn,"memoize");Hn.Cache=jn;var ay=Hn,sy=500;function Pc(t){var e=ay(t,function(n){return r.size===sy&&r.clear(),n}),r=e.cache;return e}u(Pc,"memoizeCapped");var iy=Pc,oy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,uy=/\\(\\)?/g,cy=iy(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(oy,function(r,n,a,s){e.push(a?s.replace(uy,"$1"):n||r)}),e}),ly=cy;function Ec(t){return t==null?"":um(t)}u(Ec,"toString");var dy=Ec;function xc(t,e){return $e(t)?t:ps(t,e)?[t]:ly(dy(t))}u(xc,"castPath");var Sc=xc,fy=1/0;function wc(t){if(typeof t=="string"||us(t))return t;var e=t+"";return e=="0"&&1/t==-fy?"-0":e}u(wc,"toKey");var Nn=wc;function kc(t,e){e=Sc(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Nn(e[r++])];return r&&r==n?t:void 0}u(kc,"baseGet");var Oc=kc;function Cc(t,e,r){var n=t==null?void 0:Oc(t,e);return n===void 0?r:n}u(Cc,"get");var py=Cc;function Ic(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}u(Ic,"arrayPush");var gy=Ic;function Zc(){this.__data__=new Dn,this.size=0}u(Zc,"stackClear");var my=Zc;function Ac(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}u(Ac,"stackDelete");var hy=Ac;function Rc(t){return this.__data__.get(t)}u(Rc,"stackGet");var yy=Rc;function Bc(t){return this.__data__.has(t)}u(Bc,"stackHas");var vy=Bc,_y=200;function Dc(t,e){var r=this.__data__;if(r instanceof Dn){var n=r.__data__;if(!ir||n.length<_y-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new jn(n)}return r.set(t,e),this.size=r.size,this}u(Dc,"stackSet");var by=Dc;function ht(t){var e=this.__data__=new Dn(t);this.size=e.size}u(ht,"Stack");ht.prototype.clear=my;ht.prototype.delete=hy;ht.prototype.get=yy;ht.prototype.has=vy;ht.prototype.set=by;var $r=ht;function Mc(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}u(Mc,"arrayFilter");var Ty=Mc;function jc(){return[]}u(jc,"stubArray");var Py=jc,Ey=Object.prototype,xy=Ey.propertyIsEnumerable,yo=Object.getOwnPropertySymbols,Sy=yo?function(t){return t==null?[]:(t=Object(t),Ty(yo(t),function(e){return xy.call(t,e)}))}:Py,wy=Sy;function Hc(t,e,r){var n=e(t);return $e(t)?n:gy(n,r(t))}u(Hc,"baseGetAllKeys");var ky=Hc;function Nc(t){return ky(t,fs,wy)}u(Nc,"getAllKeys");var vo=Nc,Oy=ft(Ue,"DataView"),qa=Oy,Cy=ft(Ue,"Promise"),Ga=Cy,Iy=ft(Ue,"Set"),Wa=Iy,_o="[object Map]",Zy="[object Object]",bo="[object Promise]",To="[object Set]",Po="[object WeakMap]",Eo="[object DataView]",Ay=dt(qa),Ry=dt(ir),By=dt(Ga),Dy=dt(Wa),My=dt(Ka),nt=Ut;(qa&&nt(new qa(new ArrayBuffer(1)))!=Eo||ir&&nt(new ir)!=_o||Ga&&nt(Ga.resolve())!=bo||Wa&&nt(new Wa)!=To||Ka&&nt(new Ka)!=Po)&&(nt=u(function(t){var e=Ut(t),r=e==Zy?t.constructor:void 0,n=r?dt(r):"";if(n)switch(n){case Ay:return Eo;case Ry:return _o;case By:return bo;case Dy:return To;case My:return Po}return e},"getTag"));var xo=nt,jy=Ue.Uint8Array,So=jy,Hy="__lodash_hash_undefined__";function $c(t){return this.__data__.set(t,Hy),this}u($c,"setCacheAdd");var Ny=$c;function Uc(t){return this.__data__.has(t)}u(Uc,"setCacheHas");var $y=Uc;function or(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new jn;++e<r;)this.add(t[e])}u(or,"SetCache");or.prototype.add=or.prototype.push=Ny;or.prototype.has=$y;var Uy=or;function Fc(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}u(Fc,"arraySome");var Fy=Fc;function Lc(t,e){return t.has(e)}u(Lc,"cacheHas");var Ly=Lc,zy=1,Ky=2;function zc(t,e,r,n,a,s){var i=r&zy,o=t.length,d=e.length;if(o!=d&&!(i&&d>o))return!1;var p=s.get(t),y=s.get(e);if(p&&y)return p==e&&y==t;var T=-1,k=!0,P=r&Ky?new Uy:void 0;for(s.set(t,e),s.set(e,t);++T<o;){var D=t[T],K=e[T];if(n)var G=i?n(K,D,T,e,t,s):n(D,K,T,t,e,s);if(G!==void 0){if(G)continue;k=!1;break}if(P){if(!Fy(e,function(se,q){if(!Ly(P,q)&&(D===se||a(D,se,r,n,s)))return P.push(q)})){k=!1;break}}else if(!(D===K||a(D,K,r,n,s))){k=!1;break}}return s.delete(t),s.delete(e),k}u(zc,"equalArrays");var Kc=zc;function Vc(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}u(Vc,"mapToArray");var Vy=Vc;function qc(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}u(qc,"setToArray");var qy=qc,Gy=1,Wy=2,Jy="[object Boolean]",Yy="[object Date]",Xy="[object Error]",Qy="[object Map]",ev="[object Number]",tv="[object RegExp]",rv="[object Set]",nv="[object String]",av="[object Symbol]",sv="[object ArrayBuffer]",iv="[object DataView]",wo=Ve?Ve.prototype:void 0,$a=wo?wo.valueOf:void 0;function Gc(t,e,r,n,a,s,i){switch(r){case iv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case sv:return!(t.byteLength!=e.byteLength||!s(new So(t),new So(e)));case Jy:case Yy:case ev:return Nu(+t,+e);case Xy:return t.name==e.name&&t.message==e.message;case tv:case nv:return t==e+"";case Qy:var o=Vy;case rv:var d=n&Gy;if(o||(o=qy),t.size!=e.size&&!d)return!1;var p=i.get(t);if(p)return p==e;n|=Wy,i.set(t,e);var y=Kc(o(t),o(e),n,a,s,i);return i.delete(t),y;case av:if($a)return $a.call(t)==$a.call(e)}return!1}u(Gc,"equalByTag");var ov=Gc,uv=1,cv=Object.prototype,lv=cv.hasOwnProperty;function Wc(t,e,r,n,a,s){var i=r&uv,o=vo(t),d=o.length,p=vo(e),y=p.length;if(d!=y&&!i)return!1;for(var T=d;T--;){var k=o[T];if(!(i?k in e:lv.call(e,k)))return!1}var P=s.get(t),D=s.get(e);if(P&&D)return P==e&&D==t;var K=!0;s.set(t,e),s.set(e,t);for(var G=i;++T<d;){k=o[T];var se=t[k],q=e[k];if(n)var H=i?n(q,se,k,e,t,s):n(se,q,k,t,e,s);if(!(H===void 0?se===q||a(se,q,r,n,s):H)){K=!1;break}G||(G=k=="constructor")}if(K&&!G){var J=t.constructor,ce=e.constructor;J!=ce&&"constructor"in t&&"constructor"in e&&!(typeof J=="function"&&J instanceof J&&typeof ce=="function"&&ce instanceof ce)&&(K=!1)}return s.delete(t),s.delete(e),K}u(Wc,"equalObjects");var dv=Wc,fv=1,ko="[object Arguments]",Oo="[object Array]",Hr="[object Object]",pv=Object.prototype,Co=pv.hasOwnProperty;function Jc(t,e,r,n,a,s){var i=$e(t),o=$e(e),d=i?Oo:xo(t),p=o?Oo:xo(e);d=d==ko?Hr:d,p=p==ko?Hr:p;var y=d==Hr,T=p==Hr,k=d==p;if(k&&Va(t)){if(!Va(e))return!1;i=!0,y=!1}if(k&&!y)return s||(s=new $r),i||Xu(t)?Kc(t,e,r,n,a,s):ov(t,e,d,r,n,a,s);if(!(r&fv)){var P=y&&Co.call(t,"__wrapped__"),D=T&&Co.call(e,"__wrapped__");if(P||D){var K=P?t.value():t,G=D?e.value():e;return s||(s=new $r),a(K,G,r,n,s)}}return k?(s||(s=new $r),dv(t,e,r,n,a,s)):!1}u(Jc,"baseIsEqualDeep");var gv=Jc;function gs(t,e,r,n,a){return t===e?!0:t==null||e==null||!Rt(t)&&!Rt(e)?t!==t&&e!==e:gv(t,e,r,n,gs,a)}u(gs,"baseIsEqual");var ms=gs,mv=1,hv=2;function Yc(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 d=o[0],p=t[d],y=o[1];if(i&&o[2]){if(p===void 0&&!(d in t))return!1}else{var T=new $r;if(n)var k=n(p,y,d,t,e,T);if(!(k===void 0?ms(y,p,mv|hv,n,T):k))return!1}}return!0}u(Yc,"baseIsMatch");var yv=Yc;function Xc(t){return t===t&&!ls(t)}u(Xc,"isStrictComparable");var Qc=Xc;function el(t){for(var e=fs(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,Qc(a)]}return e}u(el,"getMatchData");var vv=el;function tl(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}u(tl,"matchesStrictComparable");var rl=tl;function nl(t){var e=vv(t);return e.length==1&&e[0][2]?rl(e[0][0],e[0][1]):function(r){return r===t||yv(r,t,e)}}u(nl,"baseMatches");var _v=nl;function al(t,e){return t!=null&&e in Object(t)}u(al,"baseHasIn");var bv=al;function sl(t,e,r){e=Sc(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var i=Nn(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&&ds(a)&&Mu(i,a)&&($e(t)||Vu(t)))}u(sl,"hasPath");var Tv=sl;function il(t,e){return t!=null&&Tv(t,e,bv)}u(il,"hasIn");var Pv=il,Ev=1,xv=2;function ol(t,e){return ps(t)&&Qc(e)?rl(Nn(t),e):function(r){var n=py(r,t);return n===void 0&&n===e?Pv(r,t):ms(e,n,Ev|xv)}}u(ol,"baseMatchesProperty");var Sv=ol;function ul(t){return function(e){return e?.[t]}}u(ul,"baseProperty");var wv=ul;function cl(t){return function(e){return Oc(e,t)}}u(cl,"basePropertyDeep");var kv=cl;function ll(t){return ps(t)?wv(Nn(t)):kv(t)}u(ll,"property");var Ov=ll;function dl(t){return typeof t=="function"?t:t==null?cm:typeof t=="object"?$e(t)?Sv(t[0],t[1]):_v(t):Ov(t)}u(dl,"baseIteratee");var Cv=dl;function fl(t){return function(e,r,n){for(var a=-1,s=Object(e),i=n(e),o=i.length;o--;){var d=i[t?o:++a];if(r(s[d],d,s)===!1)break}return e}}u(fl,"createBaseFor");var Iv=fl,Zv=Iv(),Av=Zv;function pl(t,e){return t&&Av(t,e,fs)}u(pl,"baseForOwn");var Rv=pl;function gl(t,e){return ms(t,e)}u(gl,"isEqual");var ot=gl;function ml(t,e){var r={};return e=Cv(e,3),Rv(t,function(n,a,s){Zm(r,a,e(n,a,s))}),r}u(ml,"mapValues");var Bv=ml;function hs(t){return ae(t)}u(hs,"toTypescriptSchema");function ae(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(${ae(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=Bv(r.shape(),ce=>ce instanceof v.Schema?ae(ce):"z.any()");return[`${Z(r.description)}z.object({`,...Object.entries(n).map(([ce,Le])=>` ${ce}: ${Le},`),"})"].join(`
|
|
33
|
-
`).trim();case v.ZodFirstPartyTypeKind.ZodUnion:let a=r.options.map(ae);return`${Z(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(ae),i=je(r.discriminator);return`${Z(r.description)}z.discriminatedUnion(${i}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let o=ae(r.left),d=ae(r.right);return`${Z(r.description)}z.intersection(${o}, ${d})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(ae);return`${Z(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let y=ae(r.keyType),T=ae(r.valueType);return`${Z(r.description)}z.record(${y}, ${T})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let k=ae(r.keyType),P=ae(r.valueType);return`${Z(r.description)}z.map(${k}, ${P})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${Z(r.description)}z.set(${ae(r.valueType)})`.trim();case v.ZodFirstPartyTypeKind.ZodFunction:let D=r.args.items.map(ae),K=D.length?`.args(${D.join(", ")})`:"",G=ae(r.returns);return`${Z(r.description)}z.function()${K}.returns(${G})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${Z(r.description)}z.lazy(() => ${ae(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let se=je(r.value);return`${Z(r.description)}z.literal(${se})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let q=r.values.map(je);return`${Z(r.description)}z.enum([${q.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new rt(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new rt(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${Z(r.description)}z.optional(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${Z(r.description)}z.nullable(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let H=Go(r.defaultValue());return`${Z(r.description)}${ae(r.innerType)}.default(${H})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new rt(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${Z(r.description)}z.promise(${ae(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new rt(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new rt(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new rt(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${Z(r.description)}z.readonly(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let J=je(r.uri);return`${Z(r.description)}z.ref(${J})`.trim();default:M.assertNever(r)}}u(ae,"sUnwrapZod");var hl=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}};u(hl,"ParseInputLazyPath");var Se=hl,Io=u((t,e)=>{if(Dt(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"),yl=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 ye,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(cr(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 Io(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(cr(a)?a:Promise.resolve(a));return Io(n,s)}refine(e,r){let n=u(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=u(()=>s.addIssue(l({code:_.custom},n(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!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 We({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return He.create(this,this._def)}nullable(){return ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mt.create(this,this._def)}promise(){return gr.create(this,this._def)}or(e){return Qn.create([this,e],this._def)}and(e){return Kn.create(this,e,this._def)}transform(e){return new We(m(l({},A(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new fr(m(l({},A(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Fn(l({typeName:"ZodBranded",type:this},A(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Ln(m(l({},A(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.constructor;return new r(m(l({},this._def),{description:e}))}pipe(e){return Yn.create(this,e)}readonly(){return mr.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[U]=m(l({},this._def[U]),{[r]:n});return this}getMetadata(){return l({},this._def[U])}setMetadata(e){this._def[U]=l({},e)}get ui(){let e=this._getMetadataRoot();return l({},e._def[U])}_setZuiMeta(e,r){let n=this._getMetadataRoot();n._def[U]=m(l({},n._def[U]),{[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=U])!=null||(r[n]={}),this._def[U].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 ea(this,e)}toTypescript(e){return Wr(this,e)}toTypescriptSchema(){return hs(this)}async toTypescriptAsync(e){let r=Wr(this,m(l({},e),{formatter:void 0}));return e?.formatter&&(r=await e.formatter(r)),r}static fromObject(e,r){return Ht(e,r)}static fromJsonSchema(e){return hr(e)}};u(yl,"ZodType");var B=yl,ys=(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))(ys||{}),M;(t=>{t.assertEqual=u(a=>a,"assertEqual");function e(a){}t.assertIs=e,u(e,"assertIs");function r(a){throw new Error("assertNever called")}t.assertNever=r,u(r,"assertNever"),t.arrayToEnum=u(a=>{let s={};for(let i of a)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=u(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=u(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=u((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,u(n,"joinValues"),t.jsonStringifyReplacer=u((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=u((a,s)=>a.toString()===s.toString(),"compareFunctions")})(M||(M={}));var Jr;(t=>{t.mergeShapes=u((e,r)=>l(l({},e),r),"mergeShapes")})(Jr||(Jr={}));var x=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=u(t=>{switch(typeof t){case"undefined":return x.undefined;case"string":return x.string;case"number":return isNaN(t)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":return Array.isArray(t)?x.array:t===null?x.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?x.promise:typeof Map<"u"&&t instanceof Map?x.map:typeof Set<"u"&&t instanceof Set?x.set:typeof Date<"u"&&t instanceof Date?x.date:x.object;default:return x.unknown}},"getParsedType");function A(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[U]:t?.[U]}:{errorMap:u((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},"customMap"),description:a,[U]:t?.[U]}}u(A,"processCreateParams");var vs=u((t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===x.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"),Zo=vs,_=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"]),vl=u(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Yr=class _l extends Error{constructor(e){super(),this.issues=[],this.addIssue=u(n=>{this.issues=[...this.issues,n]},"addIssue"),this.addIssues=u((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=u(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,d=0;for(;d<i.path.length;){let p=i.path[d];d===i.path.length-1?(o[p]=o[p]||{_errors:[]},o[p]._errors.push(r(i))):o[p]=o[p]||{_errors:[]},o=o[p],d++}}},"processError");return a(this),n}static assert(e){if(!(e instanceof _l))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()}};u(Yr,"ZodError");Yr.create=u(t=>new Yr(t),"create");var Ie=Yr,bl=vs;function _s(t){bl=t}u(_s,"setErrorMap");function Bt(){return bl}u(Bt,"getErrorMap");var ur=u(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,i=[...n,...s.path||[]],o=m(l({},s),{path:i}),d="",p=a.filter(y=>!!y).slice().reverse();for(let y of p)d=y(o,{data:r,defaultError:d}).message;return m(l({},s),{path:i,message:(e=s.message)!=null?e:d})},"makeIssue"),Tl=[];function E(t,e){let r=ur({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Bt(),vs].filter(n=>!!n)});t.common.issues.push(r)}u(E,"addIssueToContext");var Pl=class El{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 El.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}}};u(Pl,"ParseStatus");var ye=Pl,C=Object.freeze({status:"aborted"}),it=u(t=>({status:"dirty",value:t}),"DIRTY"),pe=u(t=>({status:"valid",value:t}),"OK"),Xr=u(t=>t.status==="aborted","isAborted"),Qr=u(t=>t.status==="dirty","isDirty"),Dt=u(t=>t.status==="valid","isValid"),cr=u(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),O;(t=>{t.errToObj=u(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=u(e=>typeof e=="string"?e:e?.message,"toString")})(O||(O={}));var en=class xl extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof xl}};u(en,"ZodAny");en.create=u(t=>new en(l({typeName:"ZodAny"},A(t))),"create");var lr=en,tn=class wt extends B{dereference(e){return new wt(m(l({},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 wt?ot((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&ot((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&ot((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!==x.array)return E(r,{code:_.invalid_type,expected:x.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)&&(E(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&&(E(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&&(E(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 Se(r,i,r.path,o)))).then(i=>ye.mergeArray(n,i));let s=[...r.data].map((i,o)=>a.type._parseSync(new Se(r,i,r.path,o)));return ye.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new wt(m(l({},this._def),{minLength:{value:e,message:O.toString(r)}}))}max(e,r){return new wt(m(l({},this._def),{maxLength:{value:e,message:O.toString(r)}}))}length(e,r){return new wt(m(l({},this._def),{exactLength:{value:e,message:O.toString(r)}}))}nonempty(e){return this.min(1,e)}};u(tn,"ZodArray");tn.create=u((t,e)=>new tn(l({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},A(e))),"create");var Mt=tn,Dv={compare:ot},Sl=class{constructor(e=[],r={}){this._options=l(l({},Dv),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))}};u(Sl,"CustomSet");var ue=Sl,rn=class Ur extends B{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)!==x.bigint){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.bigint,received:s.parsedType}),C}let n,a=new ye;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),E(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),E(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),E(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 Ur)||this._def.coerce!==e._def.coerce)return!1;let r=new ue(this._def.checks),n=new ue(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 Ur(m(l({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new Ur(m(l({},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}};u(rn,"ZodBigInt");rn.create=u(t=>{var e;return new rn(l({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var $n=rn,nn=class wl extends B{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==x.boolean){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.boolean,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof wl?this._def.coerce===e._def.coerce:!1}};u(nn,"ZodBoolean");nn.create=u(t=>new nn(l({typeName:"ZodBoolean",coerce:t?.coerce||!1},A(t))),"create");var Un=nn,kl=Symbol("zod_brand"),Ol=class Cl extends B{_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 Cl?this._def.type.isEqual(e._def.type):!1}};u(Ol,"ZodBranded");var Fn=Ol,an=class Il extends B{_parse(e){let{ctx:r}=this._processInputParams(e),n=m(l({},r),{common:m(l({},r.common),{issues:[]})}),a=this._def.innerType._parse({data:n.data,path:n.path,parent:l({},n)});return cr(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 Il?this._def.innerType.isEqual(e._def.innerType)&&M.compareFunctions(this._def.catchValue,e._def.catchValue):!1}};u(an,"ZodCatch");an.create=u((t,e)=>new an(l({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},A(e))),"create");var Ln=an,bs=u((t,e={},r)=>t?lr.create().superRefine((n,a)=>{var s,i;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(s=o.fatal)!=null?s:r)!=null?i:!0,p=typeof o=="string"?{message:o}:o;a.addIssue(m(l({code:"custom"},p),{fatal:d}))}}):lr.create(),"custom"),sn=class Ja extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==x.date){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.date,received:s.parsedType}),C}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_date}),C}let n=new ye,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),E(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),E(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 Ja(m(l({},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 Ja))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)&&this._def.coerce===e._def.coerce}};u(sn,"ZodDate");sn.create=u(t=>new sn(l({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},A(t))),"create");var zn=sn,on=class Ya extends B{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===x.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 Ya(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof Ya?this._def.innerType.isEqual(e._def.innerType)&&ot(this._def.defaultValue(),e._def.defaultValue()):!1}};u(on,"ZodDefault");on.create=u((t,e,r)=>new on(l({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},A(r))),"create");var fr=on,Fe=u(t=>Array.from(new Set(t)),"unique"),De=u(t=>t instanceof Vn?De(t.schema):t instanceof We?De(t.innerType()):t instanceof qn?[t.value]:t instanceof yt?t.options:t instanceof Gn?M.objectValues(t.enum):t instanceof fr?De(t._def.innerType):t instanceof Xn?[void 0]:t instanceof Wn?[null]:t instanceof He?[void 0,...De(t.unwrap())]:t instanceof ut?[null,...De(t.unwrap())]:t instanceof Fn||t instanceof mr?De(t.unwrap()):t instanceof Ln?De(t._def.innerType):[],"getDiscriminator"),Zl=class kt extends B{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=kt._getOptionsMap(this.discriminator,r);return new kt(m(l({},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!==x.object)return E(r,{code:_.invalid_type,expected:x.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}):(E(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=kt._getOptionsMap(e,r);return new kt(l({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},A(n)))}static _getOptionsMap(e,r){let n=new Map;for(let a of r){let s=De(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return n}isEqual(e){if(!(e instanceof kt)||this._def.discriminator!==e._def.discriminator)return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue(this._def.options,{compare:r}),a=new ue(e._def.options,{compare:r});return n.isEqual(a)}};u(Zl,"ZodDiscriminatedUnion");var Ts=Zl;function pr(t,e){return new yt(l({values:t,typeName:"ZodEnum"},A(e)))}u(pr,"createZodEnum");var Ps=class Fr extends B{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return E(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 E(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 Fr.create(e,l(l({},this._def),r))}exclude(e,r=this._def){return Fr.create(this.options.filter(n=>!e.includes(n)),l(l({},this._def),r))}isEqual(e){if(!(e instanceof Fr))return!1;let r=new ue(this._def.values),n=new ue(e._def.values);return r.isEqual(n)}};u(Ps,"ZodEnum");Ps.create=pr;var yt=Ps,Al=class Ot extends B{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new Ot(m(l({},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!==x.function)return E(r,{code:_.invalid_type,expected:x.function,received:r.parsedType}),C;function n(o,d){return ur({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Bt(),Zo].filter(p=>!!p),issueData:{code:_.invalid_arguments,argumentsError:d}})}u(n,"makeArgsIssue");function a(o,d){return ur({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Bt(),Zo].filter(p=>!!p),issueData:{code:_.invalid_return_type,returnTypeError:d}})}u(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof gr){let o=this;return pe(async function(...d){let p=new Ie([]),y=await o._def.args.parseAsync(d,s).catch(P=>{throw p.addIssue(n(d,P)),p}),T=await Reflect.apply(i,this,y);return await o._def.returns._def.type.parseAsync(T,s).catch(P=>{throw p.addIssue(a(T,P)),p})})}else{let o=this;return pe(function(...d){let p=o._def.args.safeParse(d,s);if(!p.success)throw new Ie([n(d,p.error)]);let y=Reflect.apply(i,this,p.data),T=o._def.returns.safeParse(y,s);if(!T.success)throw new Ie([a(y,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ot(m(l({},this._def),{args:lt.create(e).rest(Zt.create())}))}returns(e){return new Ot(m(l({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Ot(l({args:e||lt.create([]).rest(Zt.create()),returns:r||Zt.create(),typeName:"ZodFunction"},A(n)))}isEqual(e){return e instanceof Ot&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};u(Al,"ZodFunction");var Es=Al;function un(t,e){let r=Me(t),n=Me(e);if(t===e)return{valid:!0,data:t};if(r===x.object&&n===x.object){let a=M.objectKeys(e),s=M.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i=l(l({},t),e);for(let o of s){let d=un(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===x.array&&n===x.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],d=un(i,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===x.date&&n===x.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}u(un,"mergeValues");var cn=class Xa extends B{dereference(e){return new Xa(m(l({},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=u((s,i)=>{if(Xr(s)||Xr(i))return C;let o=un(s.value,i.value);return o.valid?((Qr(s)||Qr(i))&&r.dirty(),{status:r.value,value:o.data}):(E(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 Xa))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue([this._def.left,this._def.right],{compare:r}),a=new ue([e._def.left,e._def.right],{compare:r});return n.isEqual(a)}};u(cn,"ZodIntersection");cn.create=u((t,e,r)=>new cn(l({left:t,right:e,typeName:"ZodIntersection"},A(r))),"create");var Kn=cn,ln=class Rl extends B{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 Rl?this._def.getter().isEqual(e._def.getter()):!1}};u(ln,"ZodLazy");ln.create=u((t,e)=>new ln(l({getter:t,typeName:"ZodLazy"},A(e))),"create");var Vn=ln,dn=class Bl extends B{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return E(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 Bl?ot(this._def.value,e._def.value):!1}};u(dn,"ZodLiteral");dn.create=u((t,e)=>new dn(l({value:t,typeName:"ZodLiteral"},A(e))),"create");var qn=dn,fn=class Qa extends B{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 Qa(m(l({},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!==x.map)return E(n,{code:_.invalid_type,expected:x.map,received:n.parsedType}),C;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,d],p)=>({key:a._parse(new Se(n,o,n.path,[p,"key"])),value:s._parse(new Se(n,d,n.path,[p,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let p=await d.key,y=await d.value;if(p.status==="aborted"||y.status==="aborted")return C;(p.status==="dirty"||y.status==="dirty")&&r.dirty(),o.set(p.value,y.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let d of i){let p=d.key,y=d.value;if(p.status==="aborted"||y.status==="aborted")return C;(p.status==="dirty"||y.status==="dirty")&&r.dirty(),o.set(p.value,y.value)}return{status:r.value,value:o}}}isEqual(e){return!(!(e instanceof Qa)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};u(fn,"ZodMap");fn.create=u((t,e,r)=>new fn(l({valueType:e,keyType:t,typeName:"ZodMap"},A(r))),"create");var xs=fn,pn=class Dl extends B{_parse(e){if(this._getType(e)!==x.nan){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Dl}};u(pn,"ZodNaN");pn.create=u(t=>new pn(l({typeName:"ZodNaN"},A(t))),"create");var Ss=pn,gn=class Ml extends B{_parse(e){let r=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==x.string&&n.parsedType!==x.number){let a=M.objectValues(r);return E(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),C}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return E(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 Ml?ot(this._def.values,e._def.values):!1}};u(gn,"ZodNativeEnum");gn.create=u((t,e)=>new gn(l({values:t,typeName:"ZodNativeEnum"},A(e))),"create");var Gn=gn,mn=class jl extends B{_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:_.invalid_type,expected:x.never,received:r.parsedType}),C}isEqual(e){return e instanceof jl}};u(mn,"ZodNever");mn.create=u(t=>new mn(l({typeName:"ZodNever"},A(t))),"create");var qe=mn,hn=class Hl extends B{_parse(e){if(this._getType(e)!==x.null){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.null,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Hl}};u(hn,"ZodNull");hn.create=u(t=>new hn(l({typeName:"ZodNull"},A(t))),"create");var Wn=hn,yn=class es extends B{dereference(e){return new es(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===x.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof es?this._def.innerType.isEqual(e._def.innerType):!1}};u(yn,"ZodNullable");yn.create=u((t,e)=>new yn(l({innerType:t,typeName:"ZodNullable"},A(e))),"create");var ut=yn;function Nl(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)}u(Nl,"floatSafeRemainder");var vn=class Lr extends B{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)!==x.number){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.number,received:s.parsedType}),C}let n,a=new ye;for(let s of this._def.checks)s.kind==="int"?M.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),E(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),E(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),E(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Nl(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),E(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),E(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 Lr(m(l({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new Lr(m(l({},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 Lr))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)}};u(vn,"ZodNumber");vn.create=u(t=>new vn(l({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},A(t))),"create");var Jn=vn;function st(t){if(t instanceof ct){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=He.create(st(n))}return new ct(m(l({},t._def),{shape:u(()=>e,"shape")}))}else return t instanceof Mt?new Mt(m(l({},t._def),{type:st(t.element)})):t instanceof He?He.create(st(t.unwrap())):t instanceof ut?ut.create(st(t.unwrap())):t instanceof lt?lt.create(t.items.map(e=>st(e))):t}u(st,"deepPartialify");var Ge=class xe extends B{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 xe(m(l({},this._def),{shape:u(()=>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)!==x.object){let p=this._getOrReturnCtx(e);return E(p,{code:_.invalid_type,expected:x.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 d=[];for(let p of i){let y=s[p],T=a.data[p];d.push({key:{status:"valid",value:p},value:y._parse(new Se(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 y of o)d.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(p==="strict")o.length>0&&(E(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 y of o){let T=a.data[y];d.push({key:{status:"valid",value:y},value:p._parse(new Se(a,T,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of d){let T=await y.key;p.push({key:T,value:await y.value,alwaysSet:y.alwaysSet})}return p}).then(p=>ye.mergeObjectSync(n,p)):ye.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new xe(l(m(l({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:u((r,n)=>{var a,s,i,o;let d=(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:d}:{message:d}},"errorMap")}:{}))}strip(){return new xe(m(l({},this._def),{unknownKeys:"strip"}))}passthrough(){return new xe(m(l({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new xe(m(l({},this._def),{shape:u(()=>l(l({},this._def.shape()),e),"shape")}))}merge(e){return new xe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:u(()=>l(l({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new xe(m(l({},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 xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}omit(e){let r={};return M.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}deepPartial(){return st(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 xe(m(l({},this._def),{shape:u(()=>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 He;)s=s._def.innerType;r[n]=s}}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}keyof(){return pr(M.objectKeys(this.shape))}isEqual(e){if(!(e instanceof xe)||!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=u((o,d)=>o[0]===d[0]&&o[1].isEqual(d[1]),"compare"),s=new ue(Object.entries(r),{compare:a}),i=new ue(Object.entries(n),{compare:a});return s.isEqual(i)}};u(Ge,"ZodObject");Ge.create=u((t,e)=>new Ge(l({shape:u(()=>t,"shape"),unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"create");Ge.strictCreate=u((t,e)=>new Ge(l({shape:u(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},A(e))),"strictCreate");Ge.lazycreate=u((t,e)=>new Ge(l({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"lazycreate");var ct=Ge,_n=class ts extends B{dereference(e){return new ts(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===x.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ts?this._def.innerType.isEqual(e._def.innerType):!1}};u(_n,"ZodOptional");_n.create=u((t,e)=>new _n(l({innerType:t,typeName:"ZodOptional"},A(e))),"create");var He=_n,$l=class zr extends B{dereference(e){return new zr(m(l({},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 u(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(),it(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 zr({in:e,out:r,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof zr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};u($l,"ZodPipeline");var Yn=$l,bn=class rs extends B{unwrap(){return this._def.type}dereference(e){return new rs(m(l({},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!==x.promise&&r.common.async===!1)return E(r,{code:_.invalid_type,expected:x.promise,received:r.parsedType}),C;let n=r.parsedType===x.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 rs?this._def.type.isEqual(e._def.type):!1}};u(bn,"ZodPromise");bn.create=u((t,e)=>new bn(l({type:t,typeName:"ZodPromise"},A(e))),"create");var gr=bn,Tn=class ns extends B{dereference(e){return new ns(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){let r=this._def.innerType._parse(e);return Dt(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ns?this._def.innerType.isEqual(e._def.innerType):!1}};u(Tn,"ZodReadonly");Tn.create=u((t,e)=>new Tn(l({innerType:t,typeName:"ZodReadonly"},A(e))),"create");var mr=Tn,Ul=class er extends B{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 er(m(l({},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!==x.object)return E(n,{code:_.invalid_type,expected:x.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 Se(n,o,n.path,o)),value:i._parse(new Se(n,n.data[o],n.path,o))});return n.common.async?ye.mergeObjectAsync(r,a):ye.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof B?new er(l({keyType:e,valueType:r,typeName:"ZodRecord"},A(n))):new er(l({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},A(r)))}isEqual(e){return!(!(e instanceof er)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};u(Ul,"ZodRecord");var ws=Ul,Pn=class Fl extends B{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:_.unresolved_reference}),C}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Fl?this._def.uri===e._def.uri:!1}};u(Pn,"ZodRef");Pn.create=u(t=>new Pn({typeName:"ZodRef",uri:t}),"create");var ks=Pn,En=class tr extends B{dereference(e){return new tr(m(l({},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!==x.set)return E(n,{code:_.invalid_type,expected:x.set,received:n.parsedType}),C;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(E(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&&(E(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(d){let p=new Set;for(let y of d){if(y.status==="aborted")return C;y.status==="dirty"&&r.dirty(),p.add(y.value)}return{status:r.value,value:p}}u(i,"finalizeSet");let o=[...n.data.values()].map((d,p)=>s._parse(new Se(n,d,n.path,p)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new tr(m(l({},this._def),{minSize:{value:e,message:O.toString(r)}}))}max(e,r){return new tr(m(l({},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 tr))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 d=(a=this._def.maxSize)==null?void 0:a.value,p=(s=e._def.maxSize)==null?void 0:s.value;return d!==p?!1:this._def.valueType.isEqual(e._def.valueType)}};u(En,"ZodSet");En.create=u((t,e)=>new En(l({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},A(e))),"create");var Os=En,Cs=/^c[^\s-]{8,}$/i,Is=/^[a-z][a-z0-9]*$/,Zs=/^[0-9A-HJKMNP-TV-Z]{26}$/,As=/^[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,Rs=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ll="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",zl=u(t=>t===Ll,"isEmojiRegex"),Ua,Bs=/^(((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}))$/,Ds=/^(([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})))$/,Ms=u(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 Kl(t,e){return!!((e==="v4"||!e)&&Bs.test(t)||(e==="v6"||!e)&&Ds.test(t))}u(Kl,"isValidIP");var xn=class Ct extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==x.string){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.string,received:s.parsedType}),C}let n=new ye,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),E(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),E(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?E(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&E(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Rs.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Ua||(Ua=new RegExp(Ll,"u")),Ua.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"emoji",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")As.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"uuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Cs.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Is.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid2",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Zs.test(e.data)||(a=this._getOrReturnCtx(e,a),E(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),E(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),E(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),E(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),E(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),E(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ms(s).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?Kl(e.data,s.version)||(a=this._getOrReturnCtx(e,a),E(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),l({validation:r,code:_.invalid_string},O.errToObj(n)))}_addCheck(e){return new Ct(m(l({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(l({kind:"email"},O.errToObj(e)))}url(e){return this._addCheck(l({kind:"url"},O.errToObj(e)))}emoji(e){return this._addCheck(l({kind:"emoji"},O.errToObj(e)))}uuid(e){return this._addCheck(l({kind:"uuid"},O.errToObj(e)))}cuid(e){return this._addCheck(l({kind:"cuid"},O.errToObj(e)))}cuid2(e){return this._addCheck(l({kind:"cuid2"},O.errToObj(e)))}ulid(e){return this._addCheck(l({kind:"ulid"},O.errToObj(e)))}ip(e){return this._addCheck(l({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(l({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(l({kind:"regex",regex:e},O.errToObj(r)))}includes(e,r){return this._addCheck(l({kind:"includes",value:e,position:r?.position},O.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(l({kind:"startsWith",value:e},O.errToObj(r)))}endsWith(e,r){return this._addCheck(l({kind:"endsWith",value:e},O.errToObj(r)))}min(e,r){return this._addCheck(l({kind:"min",value:e},O.errToObj(r)))}max(e,r){return this._addCheck(l({kind:"max",value:e},O.errToObj(r)))}length(e,r){return this._addCheck(l({kind:"length",value:e},O.errToObj(r)))}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new Ct(m(l({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[U]=m(l({},this._def[U]),{secret:!0}),this}toLowerCase(){return new Ct(m(l({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Ct(m(l({},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 Ct))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)}};u(xn,"ZodString");xn.create=u(t=>{var e;return new xn(l({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var ge=xn,Sn=class Vl extends B{_parse(e){if(this._getType(e)!==x.symbol){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.symbol,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Vl}};u(Sn,"ZodSymbol");Sn.create=u(t=>new Sn(l({typeName:"ZodSymbol"},A(t))),"create");var js=Sn,jt=class as extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new as(m(l({},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:u(i=>{E(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 d=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return d.status==="aborted"?C:d.status==="dirty"||r.value==="dirty"?it(d.value):d});{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"?it(o.value):o}}if(a.type==="refinement"){let i=u(o=>{let d=a.refinement(o,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return 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(!Dt(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=>Dt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):i);M.assertNever(a)}isEqual(e){return!(e instanceof as)||!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)}};u(jt,"ZodEffects");jt.create=u((t,e,r)=>new jt(l({schema:t,typeName:"ZodEffects",effect:e},A(r))),"create");jt.createWithPreprocess=u((t,e,r)=>new jt(l({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},A(r))),"createWithPreprocess");var We=jt,wn=class Kr extends B{dereference(e){let r=this._def.items.map(a=>a.dereference(e)),n=this._def.rest?this._def.rest.dereference(e):null;return new Kr(m(l({},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!==x.array)return E(n,{code:_.invalid_type,expected:x.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return E(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&&(E(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 d=this._def.items[o]||this._def.rest;return d?d._parse(new Se(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>ye.mergeArray(r,i)):ye.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Kr(m(l({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Kr)||!this._restEquals(e))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue(this._def.items,{compare:r}),a=new ue(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)}};u(wn,"ZodTuple");wn.create=u((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wn(l({items:t,typeName:"ZodTuple",rest:null},A(e)))},"create");var lt=wn,kn=class ql extends B{_parse(e){if(this._getType(e)!==x.undefined){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.undefined,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof ql}};u(kn,"ZodUndefined");kn.create=u(t=>new kn(l({typeName:"ZodUndefined"},A(t))),"create");var Xn=kn,On=class ss extends B{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new ss(m(l({},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 E(r,{code:_.invalid_union,unionErrors:i}),C}if(u(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let i=m(l({},r),{common:m(l({},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 d of n){let p=m(l({},r),{common:m(l({},r.common),{issues:[]}),parent:null}),y=d._parseSync({data:r.data,path:r.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!s&&(s={result:y,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(d=>new Ie(d));return E(r,{code:_.invalid_union,unionErrors:o}),C}}get options(){return this._def.options}isEqual(e){if(!(e instanceof ss))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue([...this._def.options],{compare:r}),a=new ue([...e._def.options],{compare:r});return n.isEqual(a)}};u(On,"ZodUnion");On.create=u((t,e)=>new On(l({options:t,typeName:"ZodUnion"},A(e))),"create");var Qn=On,Cn=class Gl extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Gl}};u(Cn,"ZodUnknown");Cn.create=u(t=>new Cn(l({typeName:"ZodUnknown"},A(t))),"create");var Zt=Cn,In=class Wl extends B{_parse(e){if(this._getType(e)!==x.undefined){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.void,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Wl}};u(In,"ZodVoid");In.create=u(t=>new In(l({typeName:"ZodVoid"},A(t))),"create");var Hs=In,Mv=/^\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))?$/,Ht=u((t,e,r=!0)=>{if(typeof t!="object")throw new La("Input must be an object");let n=u(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,d])=>{if(d===null)i[o]=n(S.null());else switch(typeof d){case"string":i[o]=Mv.test(d)?n(S.string().datetime()):n(S.string());break;case"number":i[o]=n(S.number());break;case"boolean":i[o]=n(S.boolean());break;case"object":Array.isArray(d)?d.length===0?i[o]=n(S.array(S.unknown())):typeof d[0]=="object"?i[o]=n(S.array(Ht(d[0],e,!1))):["string","number","boolean"].includes(typeof d[0])&&(i[o]=n(S.array(S[typeof d[0]]()))):i[o]=n(Ht(d,e,!1));break;default:throw new La(`Unsupported type for key ${o}`)}return i},{}),s=Object.keys(a).length>0;return e?.passtrough||!r&&!s?S.object(a).passthrough():S.object(a)},"objectToZui");function Jl(){return{}}u(Jl,"parseAnyDef");function Ns(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=m(l({},t.errorMessage),{[e]:r}))}u(Ns,"addErrorMessage");function W(t,e,r,n,a){t[e]=r,Ns(t,e,n,a)}u(W,"setResponseValueAndErrors");function Yl(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(l({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&W(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&W(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(W(a,"minItems",t.exactLength.value,t.exactLength.message,e),W(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}u(Yl,"parseArrayDef");function Xl(t,e){let r=l({type:"integer",format:"int64"},t.coerce?{[U]:{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?W(r,"minimum",n.value,n.message,e):W(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),W(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?W(r,"maximum",n.value,n.message,e):W(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),W(r,"maximum",n.value,n.message,e));break;case"multipleOf":W(r,"multipleOf",n.value,n.message,e);break}return r}u(Xl,"parseBigintDef");function Ql(t){return l({type:"boolean"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{})}u(Ql,"parseBooleanDef");function ed(t,e){return V(t.type._def,e)}u(ed,"parseBrandedDef");var jv=u((t,e)=>V(t.innerType._def,e),"parseCatchDef");function td(t,e){return e.dateStrategy=="integer"?Hv(t,e):l({type:"string",format:"date-time"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{})}u(td,"parseDateDef");var Hv=u((t,e)=>{let r=l({type:"integer",format:"unix-time"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"&&W(r,"minimum",n.value,n.message,e);break;case"max":e.target==="jsonSchema7"&&W(r,"maximum",n.value,n.message,e);break}return r},"integerDateParser");function rd(t,e){return m(l({},V(t.innerType._def,e)),{default:t.defaultValue()})}u(rd,"parseDefaultDef");function nd(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):{}}u(nd,"parseEffectsDef");function ad(t){return{type:"string",enum:t.values}}u(ad,"parseEnumDef");var Nv=u(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function sd(t,e){let r=[V(t.left._def,m(l({},e),{currentPath:[...e.currentPath,"allOf","0"]})),V(t.right._def,m(l({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return r.forEach(s=>{if(Nv(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:d}=o;i=Mo(o,["additionalProperties"])}else n=void 0;a.push(i)}}),a.length?l({allOf:a},n):void 0}u(sd,"parseIntersectionDef");function id(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}}u(id,"parseLiteralDef");var Qt={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 $s(t,e){let r=l({type:"string"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?$v(a):a}if(u(n,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":W(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e);break;case"max":W(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":tt(r,"email",a.message,e);break;case"format:idn-email":tt(r,"idn-email",a.message,e);break;case"pattern:zod":Be(r,Qt.email,a.message,e);break}break;case"url":tt(r,"uri",a.message,e);break;case"uuid":tt(r,"uuid",a.message,e);break;case"regex":Be(r,a.regex.source,a.message,e);break;case"cuid":Be(r,Qt.cuid,a.message,e);break;case"cuid2":Be(r,Qt.cuid2,a.message,e);break;case"startsWith":Be(r,"^"+n(a.value),a.message,e);break;case"endsWith":Be(r,n(a.value)+"$",a.message,e);break;case"datetime":tt(r,"date-time",a.message,e);break;case"length":W(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e),W(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"includes":{Be(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&tt(r,"ipv4",a.message,e),a.version!=="v4"&&tt(r,"ipv6",a.message,e);break}case"emoji":Be(r,Qt.emoji,a.message,e);break;case"ulid":{Be(r,Qt.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}u($s,"parseStringDef");var $v=u(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),tt=u((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(l({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(l({format:e},r&&n.errorMessages&&{errorMessage:{format:r}}))):W(t,"format",e,r,n)},"addFormat"),Be=u((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(l({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(l({pattern:e},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):W(t,"pattern",e,r,n)},"addPattern");function Us(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((d,p)=>{var y;return m(l({},d),{[p]:(y=V(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"properties",p]})))!=null?y:{}})},{}),additionalProperties:!1};let o={type:"object",additionalProperties:(n=V(t.valueType._def,m(l({},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 d=Object.entries($s(t.keyType._def,e)).reduce((p,[y,T])=>y==="type"?p:m(l({},p),{[y]:T}),{});return m(l({},o),{propertyNames:d})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return m(l({},o),{propertyNames:{enum:t.keyType._def.values}});return o}u(Us,"parseRecordDef");function od(t,e){if(e.mapStrategy==="record")return Us(t,e);let r=V(t.keyType._def,m(l({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=V(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}u(od,"parseMapDef");function ud(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")}}u(ud,"parseNativeEnumDef");function cd(){return{not:{}}}u(cd,"parseNeverDef");function ld(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}u(ld,"parseNullDef");var Zn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function dd(t,e){if(e.target==="openApi3")return Ao(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Zn&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((a,s)=>{let i=Zn[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 Ao(t,e)}u(dd,"parseUnionDef");var Ao=u((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>V(a._def,m(l({},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"?l({anyOf:r},n):l({oneOf:r},n)},"asUnionOf");function fd(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:Zn[t.innerType._def.typeName],nullable:!0}:{type:[Zn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=V(t.innerType._def,m(l({},e),{currentPath:[...e.currentPath]}));return n&&m(l({},n),{nullable:!0})}let r=V(t.innerType._def,m(l({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}u(fd,"parseNullableDef");function pd(t,e){let r=l({type:"number"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Ns(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?W(r,"minimum",n.value,n.message,e):W(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),W(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?W(r,"maximum",n.value,n.message,e):W(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),W(r,"maximum",n.value,n.message,e));break;case"multipleOf":W(r,"multipleOf",n.value,n.message,e);break}return r}u(pd,"parseNumberDef");function gd(t,e){var r;let n=m(l({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(l({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return o===void 0?a:{properties:m(l({},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(l({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0});return n.required.length||delete n.required,n}u(gd,"parseObjectDef");var Uv=u((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(l({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),Fv=u((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(l({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=V(t.out._def,m(l({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(a=>a!==void 0)}},"parsePipelineDef");function md(t,e){return V(t.type._def,e)}u(md,"parsePromiseDef");function hd(t,e){let n={type:"array",uniqueItems:!0,items:V(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&W(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&W(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}u(hd,"parseSetDef");function yd(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>V(r._def,m(l({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:V(t.rest._def,m(l({},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(l({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}u(yd,"parseTupleDef");function vd(){return{not:{}}}u(vd,"parseUndefinedDef");function _d(){return{}}u(_d,"parseUnknownDef");var Lv=u((t,e)=>V(t.innerType._def,e),"parseReadonlyDef");function bd(t){return{$ref:t.uri}}u(bd,"parseRefDef");function V(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let i=zv(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=Vv(t,t.typeName,e);return s&&qv(t,e,s),a.jsonSchema=s,s}u(V,"parseDef");var zv=u((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Kv(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"),Kv=u((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"),Vv=u((t,e,r)=>{switch(e){case"ZodString":return $s(t,r);case"ZodNumber":return pd(t,r);case"ZodObject":return gd(t,r);case"ZodBigInt":return Xl(t,r);case"ZodBoolean":return Ql(t);case"ZodDate":return td(t,r);case"ZodUndefined":return vd();case"ZodNull":return ld(r);case"ZodArray":return Yl(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return dd(t,r);case"ZodIntersection":return sd(t,r);case"ZodTuple":return yd(t,r);case"ZodRecord":return Us(t,r);case"ZodRef":return bd(t);case"ZodLiteral":return id(t,r);case"ZodEnum":return ad(t);case"ZodNativeEnum":return ud(t);case"ZodNullable":return fd(t,r);case"ZodOptional":return Uv(t,r);case"ZodMap":return od(t,r);case"ZodSet":return hd(t,r);case"ZodLazy":return V(t.getter()._def,r);case"ZodPromise":return md(t,r);case"ZodNaN":case"ZodNever":return cd();case"ZodEffects":return nd(t,r);case"ZodAny":return Jl();case"ZodUnknown":return _d();case"ZodDefault":return rd(t,r);case"ZodBranded":return ed(t,r);case"ZodReadonly":return Lv(t,r);case"ZodCatch":return jv(t,r);case"ZodPipeline":return Fv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),qv=u((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[U]:l(l({},t[U]),r[U])}),r),"addMeta"),Ro={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"},Gv=u(t=>typeof t=="string"?m(l({},Ro),{name:t}):l(l({},Ro),t),"getDefaultOptions"),Wv=u(t=>{let e=Gv(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return m(l({},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"),Jv=u((t,e)=>{var r;let n=Wv(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[p,y])=>{var T;return m(l({},d),{[p]:(T=V(y._def,m(l({},n),{currentPath:[...n.basePath,n.definitionPath,p]}),!0))!=null?T:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(r=V(t._def,s===void 0?n:m(l({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},o=s===void 0?a?m(l({},i),{[n.definitionPath]:a}):i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:m(l({},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"),ea=u((t,e={target:"openApi3"})=>{let r=Jv(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),Yv=["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"],Sb=yt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Td=u(t=>ge.create().displayAs({id:"variable",params:l({type:t?.type||"any"},t?.params)}),"variable"),Pd=u(t=>ge.create().displayAs({id:"conversation",params:l({},t?.params)}),"conversation"),Ed=u(t=>ge.create().displayAs({id:"user",params:l({},t?.params)}),"user"),xd=u(t=>ge.create().displayAs({id:"message",params:l({},t?.params)}),"message"),Sd=u(t=>ge.create().displayAs({id:"agent",params:l({},t?.params)}),"agent"),wd=u(t=>ge.create().displayAs({id:"event",params:l({},t?.params)}),"event"),kd=u(t=>ge.create().displayAs({id:"table",params:l({},t?.params)}),"table"),Od=u(t=>ge.create().displayAs({id:"tablerow",params:l({},t?.params)}),"tablerow"),Cd=u(t=>ge.create().displayAs({id:"intent",params:l({},t?.params)}),"intent"),Id=u(()=>yt.create(Yv).displayAs({id:"dropdown",params:{}}),"aimodel"),Zd=u(t=>ge.create().displayAs({id:"datasource",params:l({},t)}),"datasource"),Ad=u(t=>ge.create().displayAs({id:"knowledgebase",params:l({},t)}),"knowledgebase"),Rd={object:ct.lazycreate},Bd=u((t,e={message:`Input not instance of ${t.name}`})=>bs(r=>r instanceof t,e),"instanceOfType"),Fs=ge.create,Ls=Jn.create,Dd=Ss.create,Md=$n.create,zs=Un.create,jd=zn.create,Hd=js.create,Nd=Xn.create,$d=Wn.create,Ud=lr.create,Fd=Zt.create,Ld=qe.create,zd=Hs.create,Kd=Mt.create,Vd=ct.create,qd=ct.strictCreate,Gd=Qn.create,Wd=Ts.create,Jd=Kn.create,Yd=lt.create,Xd=ws.create,Qd=ks.create,ef=mr.create,tf=xs.create,rf=Os.create,nf=Es.create,af=Vn.create,sf=qn.create,of=yt.create,uf=Gn.create,cf=gr.create,is=We.create,lf=He.create,df=ut.create,Xv=fr.create,ff=We.createWithPreprocess,pf=Yn.create,gf=u(()=>Fs().optional(),"ostring"),mf=u(()=>Ls().optional(),"onumber"),hf=u(()=>zs().optional(),"oboolean"),yf=B.fromJsonSchema,vf=B.fromObject,_f={string:u(t=>ge.create(m(l({},t),{coerce:!0})),"string"),number:u(t=>Jn.create(m(l({},t),{coerce:!0})),"number"),boolean:u(t=>Un.create(m(l({},t),{coerce:!0})),"boolean"),bigint:u(t=>$n.create(m(l({},t),{coerce:!0})),"bigint"),date:u(t=>zn.create(m(l({},t),{coerce:!0})),"date")},bf=C,v=S,Tf=u((t,e)=>t.anyOf.length?t.anyOf.length===1?le(t.anyOf[0],m(l({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>le(r,m(l({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),Qv=u(t=>{var e;return(e=t[U])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),e_=u(t=>"z.any()","parseDefault"),t_=u((t,e)=>`z.union([${t.type.map(r=>le(m(l({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),r_=u((t,e)=>`z.any().refine((value) => !${le(t.not,m(l({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),n_=u(t=>"z.null()","parseNull"),a_=u(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),s_=u((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],d=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+=d+JSON.stringify(t.errorMessage[e])),s+=p}}return s}u(fe,"withMessage");var rr=Symbol("Original index"),i_=u(t=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="boolean")e.push(n?{[rr]:r}:{[rr]:r,not:{}});else{if(rr in n)return t;e.push(m(l({},n),{[rr]:r}))}}return e},"ensureOriginalIndex");function dr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return le(r,m(l({},e),{path:[...e.path,"allOf",r[rr]]}))}else{let[r,n]=a_(i_(t.allOf));return`z.intersection(${dr({allOf:r},e)}, ${dr({allOf:n},e)})`}}u(dr,"parseAllOf");var o_=u((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,a)=>le(n,m(l({},e),{path:[...e.path,"items",a]})))}])`;let r=t.items?`z.array(${le(t.items,m(l({},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"),u_=u(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),c_=u(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"),l_=u((t,e)=>{let r=le(t.if,m(l({},e),{path:[...e.path,"if"]})),n=le(t.then,m(l({},e),{path:[...e.path,"then"]})),a=le(t.else,m(l({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${a}]).superRefine((value,ctx) => {
|
|
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) => {
|
|
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"),
|
|
41
|
-
const schemas = [${t.oneOf.map((r,n)=>
|
|
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(", ")}];
|
|
42
42
|
const errors = schemas.reduce(
|
|
43
43
|
(errors: z.ZodError[], schema) =>
|
|
44
44
|
((result) => ("error" in result ? [...errors, result.error] : errors))(
|
|
@@ -54,7 +54,7 @@ ${se}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(je).join(
|
|
|
54
54
|
message: "Invalid input: Should pass single schema",
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
})`:"z.any()","parseOneOf");function
|
|
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) => {
|
|
58
58
|
`,a+=`for (const key in value) {
|
|
59
59
|
`,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(o=>JSON.stringify(o)).join(", ")}].includes(key)
|
|
60
60
|
`:a+=`let evaluated = false
|
|
@@ -86,7 +86,7 @@ ${se}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(je).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(${Tf(m(l({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${Ks(m(l({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${dr(m(l({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),s}u(Pf,"parseObject");var f_=u(t=>{var e;let r="z.string()";if((e=t[U])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";r="z.coerce.string()"}return r+=fe(t,"format",({value:n})=>{switch(n){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),r+=fe(t,"pattern",({json:n})=>[`.regex(new RegExp(${n})`,", ",")"]),r+=fe(t,"minLength",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxLength",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseString"),p_=u((t,e)=>`${le(s_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),g_=u(t=>`z.ref('${t.$ref}')`,"parseRef"),m_=u((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return Ks(t,e);let a=t.oneOf.map((s,i)=>le(s,m(l({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(n=t.discriminator)==null?void 0:n.propertyName}", [${a.join(", ")}])`},"parseDiscriminator"),le=u((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=v_(t,e);return r||(a=h_(t,a),e.withoutDefaults||(a=y_(t,a))),n.r=a,a},"parseSchema"),h_=u((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),y_=u((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),v_=u((t,e)=>ie.a.nullable(t)?p_(t,e):ie.an.object(t)?Pf(t,e):ie.an.array(t)?o_(t,e):ie.an.anyOf(t)?Tf(t,e):ie.an.allOf(t)?dr(t,e):ie.a.discriminator(t)?m_(t,e):ie.a.oneOf(t)?Ks(t,e):ie.a.not(t)?r_(t,e):ie.an.enum(t)?c_(t):ie.a.const(t)?u_(t):ie.a.multipleType(t)?t_(t,e):ie.a.primitive(t,"string")?f_(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?d_(t):ie.a.primitive(t,"boolean")?Qv(t):ie.a.primitive(t,"null")?n_(t):ie.a.conditional(t)?l_(t,e):ie.a.ref(t)?g_(t):e_(t),"selectParser"),ie={an:{object:u(t=>t.type==="object","object"),array:u(t=>t.type==="array","array"),anyOf:u(t=>t.anyOf!==void 0,"anyOf"),allOf:u(t=>t.allOf!==void 0,"allOf"),enum:u(t=>t.enum!==void 0,"enum")},a:{nullable:u(t=>t.nullable===!0,"nullable"),multipleType:u(t=>Array.isArray(t.type),"multipleType"),not:u(t=>t.not!==void 0,"not"),const:u(t=>t.const!==void 0,"const"),primitive:u((t,e)=>t.type===e,"primitive"),conditional:u(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:u(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:u(t=>t.oneOf!==void 0,"oneOf"),ref:u(t=>t.$ref!==void 0,"ref")}},__=u(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"),b_=u(t=>le(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),T_=u(t=>{let e=b_(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=__(e);if(!r.sucess)throw new Qo(r.error);return r.value},"jsonSchemaToZod"),nr=u((t,e)=>{var r,n;if(e[U]&&t._def&&(t._def[U]=e[U]),((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]&&nr(i[a],s)}),((n=t._def)==null?void 0:n.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&nr(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&&nr(s,a)}else Array.isArray(a)&&a.forEach((s,i)=>{let o=t._def;o.typeName===S.ZodFirstPartyTypeKind.ZodTuple&&nr(o.items[i],s)})}},"applyZuiPropsRecursively"),hr=u(t=>{let e=T_(t);return nr(e,t),e},"jsonSchemaToZui"),Ef=class extends Nt.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?Nt.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};u(Ef,"ErrorBoundary");var At=Ef;function xf(t,e){return r=>Nt.default.createElement(At,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Nt.default.createElement(t,l({},r)))}u(xf,"withErrorBoundary");var Vr=u(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:i}=e,o=Mo(e,["components","fieldSchema","path","required","fallback"]),d,p;let{formData:y,disabled:T,hidden:k,handlePropertyChange:P,addArrayItem:D,removeArrayItem:K,formErrors:G,formValid:se}=No(n,a),q=(0,be.useMemo)(()=>at(y,a),[y,a]),H=(0,be.useMemo)(()=>Rg(r,n),[n,r]),{discriminator:J,discriminatedSchema:ce,discriminatorValue:Le}=Ig(n,a);if(!H||k===!0)return null;let{Component:Xe,type:Oe}=H,Te={type:Oe,componentID:H.id,scope:a.join("."),context:{path:a,readonly:!1,formData:y,formErrors:G,formValid:se,updateForm:P,updateFormData:u(Pe=>P([],Pe),"updateFormData")},onChange:u(Pe=>P(a,Pe),"onChange"),disabled:T,errors:G?.filter(Pe=>Pe.path===a)||[],label:((d=n[U])==null?void 0:d.title)||Fa(((p=a[a.length-1])==null?void 0:p.toString())||""),params:H.params,schema:n,zuiProps:n[U]};if(n.type==="array"&&Oe==="array"){let Pe=Xe,_e=Te.schema,Ee=Array.isArray(q)||typeof q=="object"?q:[],j=l(m(l({},Te),{type:Oe,schema:_e,data:Ee,addItem:u(Ce=>D(a,Ce),"addItem"),removeItem:u(Ce=>K(a,Ce),"removeItem")}),o);return Array.isArray(n.items)?null:be.default.createElement(Pe,m(l({key:Te.scope},j),{isArrayChild:j.isArrayChild}),Array.isArray(j.data)?j.data.map((Ce,ke)=>{let ze=[...a,ke.toString()];return be.default.createElement(At,{key:ze.join("."),fallback:i,fieldSchema:n.items,path:ze},be.default.createElement(Vr,{key:ze.join("."),components:r,fieldSchema:n.items,path:ze,required:s,isArrayChild:!0,index:ke,removeSelf:()=>K(a,ke),fallback:i}))}):[])}if(n.type==="object"&&Oe==="object"&&n.properties){let Pe=Xe,_e=l(m(l({},Te),{type:Oe,schema:Te.schema,data:q||{}}),o);return be.default.createElement(Pe,m(l({key:Te.scope},_e),{isArrayChild:_e.isArrayChild}),Object.entries(n.properties).map(([Ee,j])=>{var Ce;let ke=[...a,Ee];return be.default.createElement(At,{key:ke.join("."),fallback:i,fieldSchema:j,path:ke},be.default.createElement(Vr,{key:ke.join("."),components:r,fieldSchema:j,path:ke,required:((Ce=n.required)==null?void 0:Ce.includes(Ee))||!1,isArrayChild:!1,fallback:i}))}))}if(Oe==="discriminatedUnion"){let Pe=Xe,_e=l(m(l({},Te),{type:Oe,schema:Te.schema,data:q||{},discriminatorKey:J?.key||null,discriminatorLabel:Fa(J?.key||"Unknown"),discriminatorOptions:J?.values||null,discriminatorValue:Le,setDiscriminator:u(Ee=>{if(!J?.key){console.warn("No discriminator key found, cannot set discriminator");return}P(a,{[J.key]:Ee})},"setDiscriminator")}),o);return be.default.createElement(Pe,m(l({key:Te.scope},_e),{isArrayChild:_e.isArrayChild}),ce&&be.default.createElement(At,{key:a.join("."),fallback:i,fieldSchema:ce,path:a},be.default.createElement(Vr,{components:r,fieldSchema:ce,path:a,required:s,isArrayChild:!1,fallback:i})))}let fa=Xe,pa=l(m(l({},Te),{type:Oe,schema:Te.schema,config:{},required:s,data:q,description:n.description}),o);return be.default.createElement(fa,l({},pa))},"FormElementRenderer"),P_=u(({schema:t,components:e,onChange:r,value:n,disableValidation:a,fallback:s,dataTransform:i,onValidation:o})=>{let[d,p]=(0,Ne.useState)(n);return(0,Ne.useEffect)(()=>{r(d)},[d]),(0,Ne.useEffect)(()=>{let y=It(t);p(T=>Gr(y,T))},[JSON.stringify(t),p]),Ne.default.createElement(Cg,{formData:d,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:i,onValidation:o},Ne.default.createElement(At,{fallback:s,fieldSchema:t,path:[]},Ne.default.createElement(Vr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),E_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},x_={errors:Jo,jsonSchemaToZui:hr,zuiToJsonSchema:ea,objectToZui:Ht,toTypescript:Wr,toTypescriptSchema:hs};var Ft=(t,e)=>{let r=t._def,n=e._def;if(r.typeName===S.ZodFirstPartyTypeKind.ZodObject&&n.typeName===S.ZodFirstPartyTypeKind.ZodObject){let a=r.shape(),s=n.shape();return S.object({...a,...s})}if(r.typeName===S.ZodFirstPartyTypeKind.ZodRecord&&n.typeName===S.ZodFirstPartyTypeKind.ZodRecord)return S.record(S.intersection(r.valueType,n.valueType));throw new Error("Cannot merge object schemas with record schemas")},Sf=S;var ve=S.string().min(1),kf=S.object({text:ve}),Of=S.object({markdown:ve}),Cf=S.object({imageUrl:ve}),If=S.object({audioUrl:ve}),Zf=S.object({videoUrl:ve}),Af=S.object({fileUrl:ve,title:ve.optional()}),Rf=S.object({latitude:S.number(),longitude:S.number(),address:S.string().optional(),title:S.string().optional()}),Bf=S.object({title:ve,subtitle:ve.optional(),imageUrl:ve.optional(),actions:S.array(S.object({action:S.enum(["postback","url","say"]),label:ve,value:ve}))}),wf=S.object({text:ve,options:S.array(S.object({label:ve,value:ve}))}),S_=S.object({items:S.array(Bf)}),w_=S.union([S.object({type:S.literal("text"),payload:kf}),S.object({type:S.literal("markdown"),payload:Of}),S.object({type:S.literal("image"),payload:Cf}),S.object({type:S.literal("audio"),payload:If}),S.object({type:S.literal("video"),payload:Zf}),S.object({type:S.literal("file"),payload:Af}),S.object({type:S.literal("location"),payload:Rf})]),k_=S.object({items:S.array(w_)}),O_={schema:Of},C_={text:{schema:kf},image:{schema:Cf},audio:{schema:If},video:{schema:Zf},file:{schema:Af},location:{schema:Rf},carousel:{schema:S_},card:{schema:Bf},dropdown:{schema:wf},choice:{schema:wf},bloc:{schema:k_}};var yr="x-bot-id",qs="x-bot-user-id",Gs="x-integration-id",Ws="x-webhook-id",Js="x-bp-configuration-type",vr="x-bp-configuration",_r="x-bp-operation",Ys="x-bp-type";var Df=require("browser-or-node");var Lt=console;function we(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function br(t,e=8072,r=R_){if(!Df.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 I_(s);if(o.path==="/health"){i.writeHead(200).end("ok");return}let d=await t(o);i.writeHead(d?.status??200,d?.headers??{}).end(d?.body??"{}")}catch(o){Lt.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 I_(t){let e=await A_(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:Z_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function Z_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function A_(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 R_(t){Lt.info(`Listening on port ${t}`)}var da=require("@botpress/client");var te={};Jt(te,{mapValues:()=>D_,mergeRecords:()=>j_,pairs:()=>Xs,stripUndefinedProps:()=>M_,values:()=>B_});var Xs=t=>Object.entries(t),B_=t=>Object.values(t),D_=(t,e)=>Object.fromEntries(Xs(t).map(([r,n])=>[r,e(n,r)])),M_=t=>Object.fromEntries(Xs(t).filter(([,e])=>e!==void 0)),j_=(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],d=e[i];o&&d?s[i]=r(o,d):o?s[i]=o:d&&(s[i]=d)}return s};var z={};Jt(z,{safePush:()=>H_,unique:()=>N_});var H_=(t,...e)=>t?[...t,...e]:[...e],N_=t=>Array.from(new Set(t));var vt={};Jt(vt,{setName:()=>$_});var $_=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Mf=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 d=o.input.schema.dereference(s),p=o.output.schema.dereference(s),y=t.actions?.[i]?.name??i;n.actions[y]={...o,...t.actions?.[i]??{},input:{schema:d},output:{schema:p}},a.actions[i]={name:y}}for(let[i,o]of Object.entries(t.definition.events??{})){let d=o.schema.dereference(s),p=t.events?.[i]?.name??i;n.events[p]={...o,...t.events?.[i]??{},schema:d},a.events[i]={name:p}}for(let[i,o]of Object.entries(t.definition.channels??{})){let d={};for(let[y,T]of Object.entries(o.messages)){let k=T.schema.dereference(s);d[y]={...T,schema:k}}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:d},a.channels[i]={name:p}}return{resolved:n,statement:a}};var ta=Symbol("schemaName"),jf=t=>t?te.mapValues(t,(r,n)=>({...r,[ta]:n})):{},Hf=t=>ta in t&&t[ta]!==void 0,Nf=t=>t[ta];var ra=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 d=Object.values(n).map(k=>k.name),p=d.length===0?e.name:`${e.name}<${d.join(",")}>`,{resolved:y,statement:T}=Mf({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(i)});return o.actions=te.mergeRecords(o.actions??{},y.actions,this._mergeActions),o.channels=te.mergeRecords(o.channels??{},y.channels,this._mergeChannels),o.events=te.mergeRecords(o.events??{},y.events,this._mergeEvents),o.interfaces[p]={id:e.id,...T},this}_callBuilder(e,r){let a={entities:jf(this.entities)},s=r(a),i=te.pairs(s.entities).find(([d,p])=>!Hf(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,d=>({name:Nf(d),schema:d.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:Ft(e.input.schema,r.input.schema)},output:{schema:Ft(e.input.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:Ft(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:Ft(e.schema,r.schema)})};var _t=require("@botpress/client");var $f=require("@botpress/client"),na={retries:3,retryCondition:t=>$f.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};var Kt=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 aa=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var U_=S.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Uf=t=>{let e=t[yr],r=t[qs],n=t[Gs],a=t[Ws],s=t[Js],i=t[vr],o=U_.parse(t[_r]);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 Ff=et(require("util")),Vt=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=Ff.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 Je=class extends Vt{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Je({...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 Lf=t=>async e=>{let r=Uf(e.headers),n=new _t.Client({botId:r.botId,integrationId:r.integrationId,retry:na}),a=new Kt(n),s=new Je,i={ctx:r,req:e,client:a,logger:s,instance:t};try{let o;switch(r.operation){case"webhook_received":o=await L_(i);break;case"register":o=await z_(i);break;case"unregister":o=await K_(i);break;case"message_created":o=await G_(i);break;case"action_triggered":o=await W_(i);break;case"ping":o=await F_(i);break;case"create_user":o=await V_(i);break;case"create_conversation":o=await q_(i);break;default:throw new Error(`Unknown operation ${r.operation}`)}return o?{...o,status:o.status??200}:{status:200}}catch(o){if((0,_t.isApiError)(o)){let p=o.type==="Runtime"?o:new _t.RuntimeError(o.message,o);return s.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(o);let d=new _t.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(d.message),{status:d.code,body:JSON.stringify(d.toJSON())}}},F_=async t=>{},L_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{let{req:s}=we(r);return a.webhook({client:t,ctx:e,req:s,logger:n})},z_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=we(r);await a.register({client:t,ctx:e,webhookUrl:s,logger:n})},K_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=we(r);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:n})},V_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createUser)return;let{tags:s}=we(r);return await a.createUser({ctx:e,client:t,tags:s,logger:n})},q_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:i}=we(r);return await a.createConversation({ctx:e,client:t,channel:s,tags:i,logger:n})},G_=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:i,type:o,payload:d,message:p}=we(e),y=a.channels[s.channel];if(!y)throw new Error(`Channel ${s.channel} not found`);let T=y.messages[o];if(!T)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await T({ctx:t,conversation:s,message:p,user:i,type:o,client:r,payload:d,ack:async({tags:P})=>{await r.updateMessage({id:p.id,tags:P})},logger:n})},W_=async({req:t,ctx:e,client:r,logger:n,instance:a})=>{let{input:s,type:i}=we(t);if(!i)throw new Error("Missing action type");let o=a.actions[i];if(!o)throw new Error(`Action ${i} not found`);let d=new aa,y={output:await o({ctx:e,input:s,client:r,type:i,logger:n,metadata:d}),meta:d.toJSON()};return{body:JSON.stringify(y)}};var sa=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=Lf(this);start=e=>br(this.handler,e)};var ia=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}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;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;return n.plugins||(n.plugins={}),n.plugins[e.name]={...e,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.states=this._mergeStates(n.states,e.definition.states),n.events=this._mergeEvents(n.events,e.definition.events),n.recurringEvents=this._mergeRecurringEvents(n.recurringEvents,e.definition.recurringEvents),n.actions=this._mergeActions(n.actions,e.definition.actions),n.tables=this._mergeTables(n.tables,e.definition.tables),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})};var Kf=et(require("@botpress/client"));var Ye=class extends Vt{constructor(e){super({...e})}with(e){return new Ye({...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);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 J_=S.enum(["event_received","register","unregister","ping","action_triggered"]),zf=t=>{let e=t[yr],r=t[vr],n=t[Ys],a=J_.parse(t[_r]);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 Ae={status:200},Vf=t=>async e=>{let r=zf(e.headers),n=new Ye,a=new Kf.Client({botId:r.botId,retry:na}),s=new Ze(a,{before:{createMessage:async o=>{let d=t.hookHandlers.before_outgoing_message[o.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o},callAction:async o=>{let d=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o}},after:{createMessage:async o=>{let d=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o},callAction:async o=>{let d=t.hookHandlers.after_outgoing_call_action[o.output.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o}}}),i={req:e,ctx:r,logger:n,client:s,self:t};switch(r.operation){case"action_triggered":return await tb(i);case"event_received":return await eb(i);case"register":return await X_(i);case"unregister":return await Q_(i);case"ping":return await Y_(i);default:throw new Error(`Unknown operation ${r.operation}`)}},Y_=async({ctx:t})=>(Lt.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),Ae),X_=async t=>Ae,Q_=async t=>Ae,eb=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let s={client:n,ctx:t,logger:e};Lt.debug(`Received event ${t.type}`);let i=we(r);if(t.type==="message_created"){let k=i.event,P=k.payload.message,D=a.hookHandlers.before_incoming_message[P.type]??[];for(let q of D){let H=await q({...s,data:P});if(P=H?.data??P,H?.stop)return Ae}let K={...s,user:k.payload.user,conversation:k.payload.conversation,states:k.payload.states,message:P,event:k},G=a.messageHandlers[P.type]??[];for(let q of G)await q(K);let se=a.hookHandlers.after_incoming_message[P.type]??[];for(let q of se){let H=await q({...s,data:P});if(P=H?.data??P,H?.stop)return Ae}return Ae}if(t.type==="state_expired"){let P=i.event.payload.state,D={...s,state:P},K=a.stateExpiredHandlers["*"]??[];for(let G of K)await G(D);return Ae}let o=i.event,d=a.hookHandlers.before_incoming_event[o.type]??[];for(let k of d){let P=await k({...s,data:o});if(o=P?.data??o,P?.stop)return Ae}let p={...s,event:o},y=a.eventHandlers[o.type]??[];for(let k of y)await k(p);let T=a.hookHandlers.after_incoming_event[o.type]??[];for(let k of T){let P=await k({...s,data:o});if(o=P?.data??o,P?.stop)return Ae}return Ae},tb=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let{input:s,type:i}=we(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})};return{status:200,body:JSON.stringify(p)}};var oa=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:{}};_plugins={};get actionHandlers(){let e=this._actionHandlers,r=Object.values(this._plugins).reduce((n,a)=>({...n,...a.actionHandlers}),{});return{...e,...r}}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 z.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 z.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 z.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]??[],d=i["*"]??[],p=[...o,...d],y=Object.values(this._plugins).flatMap(T=>T.hookHandlers[s]?.[a]??[]);return z.unique([...p,...y])}})})}on={message:(e,r)=>{this._messageHandlers[e]=z.safePush(this._messageHandlers[e],r)},event:(e,r)=>{this._eventHandlers[e]=z.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=z.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=z.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=z.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=z.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=z.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=z.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=z.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=z.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=z.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};handler=Vf(this);start=e=>br(this.handler,e)};var ua=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=Sf.ref(n);s&&o.title(s),i&&o.describe(i),r[n]=o}return r}};var ca=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}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables};var Qs=":";var qf=t=>{let[e,r]=t.split(Qs);return!e||!r?null:{namespace:e,eventName:r}},Gf=t=>`${t.namespace}${Qs}${t.actionName}`,Wf=t=>`${t.namespace}${Qs}${t.eventName}`,Jf=(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}},Yf=(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 Xf=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>i=>rb({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:s,input:i})})}),rb=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=Jf({namespace:r,actionName:n},e),i=Gf(s);return(await t.callAction({type:i,input:a})).output};var la=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:{}};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}=this._runtime,a=Xf(e,n);return{configuration:r,interfaces:n,actions:a}}get actionHandlers(){let e=this._actionHandlers,r={};for(let[n,a]of te.pairs(e))r[n]=async s=>a({...s,...this._getTools(s.client)});return r}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[];return z.unique([...n,...a]).map(i=>vt.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._eventHandlers[r]??[],a=Object.entries(this._eventHandlers).filter(([o])=>this._eventResolvesTo(o,r)).flatMap(([,o])=>o??[]),s=this._eventHandlers["*"]??[];return z.unique([...n,...a,...s]).map(o=>vt.setName(d=>o({...d,...this._getTools(d.client)}),o.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[];return z.unique([...n,...a]).map(i=>vt.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)=>{let i=n[s]??[],o=Object.entries(n).filter(([y])=>this._eventResolvesTo(y,s)).flatMap(([,y])=>y??[]),d=n["*"]??[];return z.unique([...i,...o,...d]).map(y=>vt.setName(T=>y({...T,...this._getTools(T.client)}),y.name))}})}})}on={message:(e,r)=>{this._messageHandlers[e]=z.safePush(this._messageHandlers[e],r)},event:(e,r)=>{this._eventHandlers[e]=z.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=z.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=z.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=z.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=z.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=z.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=z.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=z.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=z.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=z.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};_eventResolvesTo=(e,r)=>{let n=qf(e);if(!n)return!1;let a=Yf(n,this._runtime.interfaces);return Wf(a)===r}};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(${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});
|
|
90
90
|
/*! Bundled license information:
|
|
91
91
|
|
|
92
92
|
react/cjs/react.production.min.js:
|