@botpress/sdk 3.4.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
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 fg=Object.create;var Mr=Object.defineProperty;var pg=Object.getOwnPropertyDescriptor;var gg=Object.getOwnPropertyNames;var hg=Object.getPrototypeOf,mg=Object.prototype.hasOwnProperty;var Ma=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),er=(t,e)=>{for(var r in e)Mr(t,r,{get:e[r],enumerable:!0})},Li=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gg(e))!mg.call(t,a)&&a!==r&&Mr(t,a,{get:()=>e[a],enumerable:!(n=pg(e,a))||n.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?fg(hg(t)):{},Li(e||!t||!t.__esModule?Mr(r,"default",{value:t,enumerable:!0}):r,t)),yg=t=>Li(Mr({},"__esModule",{value:!0}),t);var ro=Ma($=>{"use strict";var tr=Symbol.for("react.element"),vg=Symbol.for("react.portal"),_g=Symbol.for("react.fragment"),Tg=Symbol.for("react.strict_mode"),bg=Symbol.for("react.profiler"),wg=Symbol.for("react.provider"),Pg=Symbol.for("react.context"),kg=Symbol.for("react.forward_ref"),Eg=Symbol.for("react.suspense"),xg=Symbol.for("react.memo"),Sg=Symbol.for("react.lazy"),zi=Symbol.iterator;function Og(t){return t===null||typeof t!="object"?null:(t=zi&&t[zi]||t["@@iterator"],typeof t=="function"?t:null)}var qi={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Gi=Object.assign,Ji={};function xt(t,e,r){this.props=t,this.context=e,this.refs=Ji,this.updater=r||qi}xt.prototype.isReactComponent={};xt.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};xt.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Yi(){}Yi.prototype=xt.prototype;function ja(t,e,r){this.props=t,this.context=e,this.refs=Ji,this.updater=r||qi}var Na=ja.prototype=new Yi;Na.constructor=ja;Gi(Na,xt.prototype);Na.isPureReactComponent=!0;var Wi=Array.isArray,Xi=Object.prototype.hasOwnProperty,$a={current:null},Qi={key:!0,ref:!0,__self:!0,__source:!0};function eo(t,e,r){var n,a={},s=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Xi.call(e,n)&&!Qi.hasOwnProperty(n)&&(a[n]=e[n]);var i=arguments.length-2;if(i===1)a.children=r;else if(1<i){for(var c=Array(i),p=0;p<i;p++)c[p]=arguments[p+2];a.children=c}if(t&&t.defaultProps)for(n in i=t.defaultProps,i)a[n]===void 0&&(a[n]=i[n]);return{$$typeof:tr,type:t,key:s,ref:o,props:a,_owner:$a.current}}function Cg(t,e){return{$$typeof:tr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ua(t){return typeof t=="object"&&t!==null&&t.$$typeof===tr}function Ig(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Vi=/\/+/g;function Ha(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Ig(""+t.key):e.toString(36)}function jr(t,e,r,n,a){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case tr:case vg:o=!0}}if(o)return o=t,a=a(o),t=n===""?"."+Ha(o,0):n,Wi(a)?(r="",t!=null&&(r=t.replace(Vi,"$&/")+"/"),jr(a,e,r,"",function(p){return p})):a!=null&&(Ua(a)&&(a=Cg(a,r+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(Vi,"$&/")+"/")+t)),e.push(a)),1;if(o=0,n=n===""?".":n+":",Wi(t))for(var i=0;i<t.length;i++){s=t[i];var c=n+Ha(s,i);o+=jr(s,e,r,c,a)}else if(c=Og(t),typeof c=="function")for(t=c.call(t),i=0;!(s=t.next()).done;)s=s.value,c=n+Ha(s,i++),o+=jr(s,e,r,c,a);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Hr(t,e,r){if(t==null)return t;var n=[],a=0;return jr(t,n,"","",function(s){return e.call(r,s,a++)}),n}function Bg(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var ye={current:null},Nr={transition:null},Zg={ReactCurrentDispatcher:ye,ReactCurrentBatchConfig:Nr,ReactCurrentOwner:$a};function to(){throw Error("act(...) is not supported in production builds of React.")}$.Children={map:Hr,forEach:function(t,e,r){Hr(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Hr(t,function(){e++}),e},toArray:function(t){return Hr(t,function(e){return e})||[]},only:function(t){if(!Ua(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};$.Component=xt;$.Fragment=_g;$.Profiler=bg;$.PureComponent=ja;$.StrictMode=Tg;$.Suspense=Eg;$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zg;$.act=to;$.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Gi({},t.props),a=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=$a.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var i=t.type.defaultProps;for(c in e)Xi.call(e,c)&&!Qi.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&i!==void 0?i[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){i=Array(c);for(var p=0;p<c;p++)i[p]=arguments[p+2];n.children=i}return{$$typeof:tr,type:t.type,key:a,ref:s,props:n,_owner:o}};$.createContext=function(t){return t={$$typeof:Pg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:wg,_context:t},t.Consumer=t};$.createElement=eo;$.createFactory=function(t){var e=eo.bind(null,t);return e.type=t,e};$.createRef=function(){return{current:null}};$.forwardRef=function(t){return{$$typeof:kg,render:t}};$.isValidElement=Ua;$.lazy=function(t){return{$$typeof:Sg,_payload:{_status:-1,_result:t},_init:Bg}};$.memo=function(t,e){return{$$typeof:xg,type:t,compare:e===void 0?null:e}};$.startTransition=function(t){var e=Nr.transition;Nr.transition={};try{t()}finally{Nr.transition=e}};$.unstable_act=to;$.useCallback=function(t,e){return ye.current.useCallback(t,e)};$.useContext=function(t){return ye.current.useContext(t)};$.useDebugValue=function(){};$.useDeferredValue=function(t){return ye.current.useDeferredValue(t)};$.useEffect=function(t,e){return ye.current.useEffect(t,e)};$.useId=function(){return ye.current.useId()};$.useImperativeHandle=function(t,e,r){return ye.current.useImperativeHandle(t,e,r)};$.useInsertionEffect=function(t,e){return ye.current.useInsertionEffect(t,e)};$.useLayoutEffect=function(t,e){return ye.current.useLayoutEffect(t,e)};$.useMemo=function(t,e){return ye.current.useMemo(t,e)};$.useReducer=function(t,e,r){return ye.current.useReducer(t,e,r)};$.useRef=function(t){return ye.current.useRef(t)};$.useState=function(t){return ye.current.useState(t)};$.useSyncExternalStore=function(t,e,r){return ye.current.useSyncExternalStore(t,e,r)};$.useTransition=function(){return ye.current.useTransition()};$.version="18.3.1"});var no=Ma((U,$r)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t="18.3.1",e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),S=Symbol.iterator,W="@@iterator";function q(u){if(u===null||typeof u!="object")return null;var f=S&&u[S]||u[W];return typeof f=="function"?f:null}var re={current:null},J={transition:null},N={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},F={current:null},ue={},Le=null;function tt(u){Le=u}ue.setExtraStackFrame=function(u){Le=u},ue.getCurrentStack=null,ue.getStackAddendum=function(){var u="";Le&&(u+=Le);var f=ue.getCurrentStack;return f&&(u+=f()||""),u};var Ce=!1,we=!1,ya=!1,va=!1,Pe=!1,Te={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:F};Te.ReactDebugCurrentFrame=ue,Te.ReactCurrentActQueue=N;function ke(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Ie("warn",u,g)}}function j(u){{for(var f=arguments.length,g=new Array(f>1?f-1:0),y=1;y<f;y++)g[y-1]=arguments[y];Ie("error",u,g)}}function Ie(u,f,g){{var y=Te.ReactDebugCurrentFrame,b=y.getStackAddendum();b!==""&&(f+="%s",g=g.concat([b]));var B=g.map(function(x){return String(x)});B.unshift("Warning: "+f),Function.prototype.apply.call(console[u],console,B)}}var Oe={};function ze(u,f){{var g=u.constructor,y=g&&(g.displayName||g.name)||"ReactClass",b=y+"."+f;if(Oe[b])return;j("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",f,y),Oe[b]=!0}}var si={isMounted:function(u){return!1},enqueueForceUpdate:function(u,f,g){ze(u,"forceUpdate")},enqueueReplaceState:function(u,f,g,y){ze(u,"replaceState")},enqueueSetState:function(u,f,g,y){ze(u,"setState")}},Re=Object.assign,_a={};Object.freeze(_a);function rt(u,f,g){this.props=u,this.context=f,this.refs=_a,this.updater=g||si}rt.prototype.isReactComponent={},rt.prototype.setState=function(u,f){if(typeof u!="object"&&typeof u!="function"&&u!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,u,f,"setState")},rt.prototype.forceUpdate=function(u){this.updater.enqueueForceUpdate(this,u,"forceUpdate")};{var Ta={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},sp=function(u,f){Object.defineProperty(rt.prototype,u,{get:function(){ke("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var ba in Ta)Ta.hasOwnProperty(ba)&&sp(ba,Ta[ba])}function ii(){}ii.prototype=rt.prototype;function wa(u,f,g){this.props=u,this.context=f,this.refs=_a,this.updater=g||si}var Pa=wa.prototype=new ii;Pa.constructor=wa,Re(Pa,rt.prototype),Pa.isPureReactComponent=!0;function ip(){var u={current:null};return Object.seal(u),u}var op=Array.isArray;function Er(u){return op(u)}function lp(u){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&u[Symbol.toStringTag]||u.constructor.name||"Object";return g}}function up(u){try{return oi(u),!1}catch{return!0}}function oi(u){return""+u}function xr(u){if(up(u))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",lp(u)),oi(u)}function cp(u,f,g){var y=u.displayName;if(y)return y;var b=f.displayName||f.name||"";return b!==""?g+"("+b+")":g}function li(u){return u.displayName||"Context"}function We(u){if(u==null)return null;if(typeof u.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case m:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case i:var f=u;return li(f)+".Consumer";case o:var g=u;return li(g._context)+".Provider";case c:return cp(u,u.render,"ForwardRef");case T:var y=u.displayName||null;return y!==null?y:We(u.type)||"Memo";case C:{var b=u,B=b._payload,x=b._init;try{return We(x(B))}catch{return null}}}return null}var Yt=Object.prototype.hasOwnProperty,ui={key:!0,ref:!0,__self:!0,__source:!0},ci,di,ka;ka={};function fi(u){if(Yt.call(u,"ref")){var f=Object.getOwnPropertyDescriptor(u,"ref").get;if(f&&f.isReactWarning)return!1}return u.ref!==void 0}function pi(u){if(Yt.call(u,"key")){var f=Object.getOwnPropertyDescriptor(u,"key").get;if(f&&f.isReactWarning)return!1}return u.key!==void 0}function dp(u,f){var g=function(){ci||(ci=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(u,"key",{get:g,configurable:!0})}function fp(u,f){var g=function(){di||(di=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(u,"ref",{get:g,configurable:!0})}function pp(u){if(typeof u.ref=="string"&&F.current&&u.__self&&F.current.stateNode!==u.__self){var f=We(F.current.type);ka[f]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',f,u.ref),ka[f]=!0)}}var Ea=function(u,f,g,y,b,B,x){var A={$$typeof:e,type:u,key:f,ref:g,props:x,_owner:B};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function gp(u,f,g){var y,b={},B=null,x=null,A=null,L=null;if(f!=null){fi(f)&&(x=f.ref,pp(f)),pi(f)&&(xr(f.key),B=""+f.key),A=f.__self===void 0?null:f.__self,L=f.__source===void 0?null:f.__source;for(y in f)Yt.call(f,y)&&!ui.hasOwnProperty(y)&&(b[y]=f[y])}var Y=arguments.length-2;if(Y===1)b.children=g;else if(Y>1){for(var Q=Array(Y),ee=0;ee<Y;ee++)Q[ee]=arguments[ee+2];Object.freeze&&Object.freeze(Q),b.children=Q}if(u&&u.defaultProps){var ne=u.defaultProps;for(y in ne)b[y]===void 0&&(b[y]=ne[y])}if(B||x){var oe=typeof u=="function"?u.displayName||u.name||"Unknown":u;B&&dp(b,oe),x&&fp(b,oe)}return Ea(u,B,x,A,L,F.current,b)}function hp(u,f){var g=Ea(u.type,f,u.ref,u._self,u._source,u._owner,u.props);return g}function mp(u,f,g){if(u==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+u+".");var y,b=Re({},u.props),B=u.key,x=u.ref,A=u._self,L=u._source,Y=u._owner;if(f!=null){fi(f)&&(x=f.ref,Y=F.current),pi(f)&&(xr(f.key),B=""+f.key);var Q;u.type&&u.type.defaultProps&&(Q=u.type.defaultProps);for(y in f)Yt.call(f,y)&&!ui.hasOwnProperty(y)&&(f[y]===void 0&&Q!==void 0?b[y]=Q[y]:b[y]=f[y])}var ee=arguments.length-2;if(ee===1)b.children=g;else if(ee>1){for(var ne=Array(ee),oe=0;oe<ee;oe++)ne[oe]=arguments[oe+2];b.children=ne}return Ea(u.type,B,x,A,L,Y,b)}function Pt(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}var gi=".",yp=":";function vp(u){var f=/[=:]/g,g={"=":"=0",":":"=2"},y=u.replace(f,function(b){return g[b]});return"$"+y}var hi=!1,_p=/\/+/g;function mi(u){return u.replace(_p,"$&/")}function xa(u,f){return typeof u=="object"&&u!==null&&u.key!=null?(xr(u.key),vp(""+u.key)):f.toString(36)}function Sr(u,f,g,y,b){var B=typeof u;(B==="undefined"||B==="boolean")&&(u=null);var x=!1;if(u===null)x=!0;else switch(B){case"string":case"number":x=!0;break;case"object":switch(u.$$typeof){case e:case r:x=!0}}if(x){var A=u,L=b(A),Y=y===""?gi+xa(A,0):y;if(Er(L)){var Q="";Y!=null&&(Q=mi(Y)+"/"),Sr(L,f,Q,"",function(dg){return dg})}else L!=null&&(Pt(L)&&(L.key&&(!A||A.key!==L.key)&&xr(L.key),L=hp(L,g+(L.key&&(!A||A.key!==L.key)?mi(""+L.key)+"/":"")+Y)),f.push(L));return 1}var ee,ne,oe=0,de=y===""?gi:y+yp;if(Er(u))for(var Dr=0;Dr<u.length;Dr++)ee=u[Dr],ne=de+xa(ee,Dr),oe+=Sr(ee,f,g,ne,b);else{var Da=q(u);if(typeof Da=="function"){var Ui=u;Da===Ui.entries&&(hi||ke("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),hi=!0);for(var ug=Da.call(Ui),Ki,cg=0;!(Ki=ug.next()).done;)ee=Ki.value,ne=de+xa(ee,cg++),oe+=Sr(ee,f,g,ne,b)}else if(B==="object"){var Fi=String(u);throw new Error("Objects are not valid as a React child (found: "+(Fi==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":Fi)+"). If you meant to render a collection of children, use an array instead.")}}return oe}function Or(u,f,g){if(u==null)return u;var y=[],b=0;return Sr(u,y,"","",function(B){return f.call(g,B,b++)}),y}function Tp(u){var f=0;return Or(u,function(){f++}),f}function bp(u,f,g){Or(u,function(){f.apply(this,arguments)},g)}function wp(u){return Or(u,function(f){return f})||[]}function Pp(u){if(!Pt(u))throw new Error("React.Children.only expected to receive a single React element child.");return u}function kp(u){var f={$$typeof:i,_currentValue:u,_currentValue2:u,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};f.Provider={$$typeof:o,_context:f};var g=!1,y=!1,b=!1;{var B={$$typeof:i,_context:f};Object.defineProperties(B,{Provider:{get:function(){return y||(y=!0,j("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),f.Provider},set:function(x){f.Provider=x}},_currentValue:{get:function(){return f._currentValue},set:function(x){f._currentValue=x}},_currentValue2:{get:function(){return f._currentValue2},set:function(x){f._currentValue2=x}},_threadCount:{get:function(){return f._threadCount},set:function(x){f._threadCount=x}},Consumer:{get:function(){return g||(g=!0,j("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),f.Consumer}},displayName:{get:function(){return f.displayName},set:function(x){b||(ke("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",x),b=!0)}}}),f.Consumer=B}return f._currentRenderer=null,f._currentRenderer2=null,f}var Xt=-1,Sa=0,yi=1,Ep=2;function xp(u){if(u._status===Xt){var f=u._result,g=f();if(g.then(function(B){if(u._status===Sa||u._status===Xt){var x=u;x._status=yi,x._result=B}},function(B){if(u._status===Sa||u._status===Xt){var x=u;x._status=Ep,x._result=B}}),u._status===Xt){var y=u;y._status=Sa,y._result=g}}if(u._status===yi){var b=u._result;return b===void 0&&j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
2
 
3
3
  Your code should look like:
4
4
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -6,39 +6,39 @@ Your code should look like:
6
6
  Did you accidentally put curly braces around the import?`,b),"default"in b||j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
7
 
8
8
  Your code should look like:
9
- const MyComponent = lazy(() => import('./MyComponent'))`,b),b.default}else throw c._result}function Tp(c){var f={_status:Gt,_result:c},g={$$typeof:k,_payload:f,_init:bp};{var h,b;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return h},set:function(I){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),h=I,Object.defineProperty(g,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return b},set:function(I){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),b=I,Object.defineProperty(g,"propTypes",{enumerable:!0})}}})}return g}function Pp(c){c!=null&&c.$$typeof===T?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof c!="function"?j("forwardRef requires a render function but was given %s.",c===null?"null":typeof c):c.length!==0&&c.length!==2&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",c.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),c!=null&&(c.defaultProps!=null||c.propTypes!=null)&&j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var f={$$typeof:d,render:c};{var g;Object.defineProperty(f,"displayName",{enumerable:!1,configurable:!0,get:function(){return g},set:function(h){g=h,!c.name&&!c.displayName&&(c.displayName=h)}})}return f}var pi;pi=Symbol.for("react.module.reference");function gi(c){return!!(typeof c=="string"||typeof c=="function"||c===n||c===s||Pe||c===a||c===p||c===y||pa||c===P||Oe||Te||fa||typeof c=="object"&&c!==null&&(c.$$typeof===k||c.$$typeof===T||c.$$typeof===i||c.$$typeof===o||c.$$typeof===d||c.$$typeof===pi||c.getModuleId!==void 0))}function Ep(c,f){gi(c)||j("memo: The first argument must be a component. Instead received: %s",c===null?"null":typeof c);var g={$$typeof:T,type:c,compare:f===void 0?null:f};{var h;Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return h},set:function(b){h=b,!c.name&&!c.displayName&&(c.displayName=b)}})}return g}function me(){var c=se.current;return c===null&&j(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
9
+ const MyComponent = lazy(() => import('./MyComponent'))`,b),b.default}else throw u._result}function Sp(u){var f={_status:Xt,_result:u},g={$$typeof:C,_payload:f,_init:xp};{var y,b;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return y},set:function(B){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),y=B,Object.defineProperty(g,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return b},set:function(B){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),b=B,Object.defineProperty(g,"propTypes",{enumerable:!0})}}})}return g}function Op(u){u!=null&&u.$$typeof===T?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof u!="function"?j("forwardRef requires a render function but was given %s.",u===null?"null":typeof u):u.length!==0&&u.length!==2&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",u.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),u!=null&&(u.defaultProps!=null||u.propTypes!=null)&&j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var f={$$typeof:c,render:u};{var g;Object.defineProperty(f,"displayName",{enumerable:!1,configurable:!0,get:function(){return g},set:function(y){g=y,!u.name&&!u.displayName&&(u.displayName=y)}})}return f}var vi;vi=Symbol.for("react.module.reference");function _i(u){return!!(typeof u=="string"||typeof u=="function"||u===n||u===s||Pe||u===a||u===p||u===m||va||u===k||Ce||we||ya||typeof u=="object"&&u!==null&&(u.$$typeof===C||u.$$typeof===T||u.$$typeof===o||u.$$typeof===i||u.$$typeof===c||u.$$typeof===vi||u.getModuleId!==void 0))}function Cp(u,f){_i(u)||j("memo: The first argument must be a component. Instead received: %s",u===null?"null":typeof u);var g={$$typeof:T,type:u,compare:f===void 0?null:f};{var y;Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return y},set:function(b){y=b,!u.name&&!u.displayName&&(u.displayName=b)}})}return g}function me(){var u=re.current;return u===null&&j(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
10
10
  1. You might have mismatching versions of React and the renderer (such as React DOM)
11
11
  2. You might be breaking the Rules of Hooks
12
12
  3. You might have more than one copy of React in the same app
13
- See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),c}function xp(c){var f=me();if(c._context!==void 0){var g=c._context;g.Consumer===c?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):g.Provider===c&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(c)}function Sp(c){var f=me();return f.useState(c)}function wp(c,f,g){var h=me();return h.useReducer(c,f,g)}function kp(c){var f=me();return f.useRef(c)}function Op(c,f){var g=me();return g.useEffect(c,f)}function Cp(c,f){var g=me();return g.useInsertionEffect(c,f)}function Ip(c,f){var g=me();return g.useLayoutEffect(c,f)}function Zp(c,f){var g=me();return g.useCallback(c,f)}function Ap(c,f){var g=me();return g.useMemo(c,f)}function Rp(c,f,g){var h=me();return h.useImperativeHandle(c,f,g)}function Bp(c,f){{var g=me();return g.useDebugValue(c,f)}}function Dp(){var c=me();return c.useTransition()}function Mp(c){var f=me();return f.useDeferredValue(c)}function jp(){var c=me();return c.useId()}function Hp(c,f,g){var h=me();return h.useSyncExternalStore(c,f,g)}var Wt=0,mi,hi,yi,vi,_i,bi,Ti;function Pi(){}Pi.__reactDisabledLog=!0;function Np(){{if(Wt===0){mi=console.log,hi=console.info,yi=console.warn,vi=console.error,_i=console.group,bi=console.groupCollapsed,Ti=console.groupEnd;var c={configurable:!0,enumerable:!0,value:Pi,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}Wt++}}function $p(){{if(Wt--,Wt===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Re({},c,{value:mi}),info:Re({},c,{value:hi}),warn:Re({},c,{value:yi}),error:Re({},c,{value:vi}),group:Re({},c,{value:_i}),groupCollapsed:Re({},c,{value:bi}),groupEnd:Re({},c,{value:Ti})})}Wt<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ea=_e.ReactCurrentDispatcher,xa;function Sr(c,f,g){{if(xa===void 0)try{throw Error()}catch(b){var h=b.stack.trim().match(/\n( *(at )?)/);xa=h&&h[1]||""}return`
14
- `+xa+c}}var Sa=!1,wr;{var Up=typeof WeakMap=="function"?WeakMap:Map;wr=new Up}function Ei(c,f){if(!c||Sa)return"";{var g=wr.get(c);if(g!==void 0)return g}var h;Sa=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=Ea.current,Ea.current=null,Np();try{if(f){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(de){h=de}Reflect.construct(c,[],w)}else{try{w.call()}catch(de){h=de}c.call(w.prototype)}}else{try{throw Error()}catch(de){h=de}c()}}catch(de){if(de&&h&&typeof de.stack=="string"){for(var R=de.stack.split(`
15
- `),F=h.stack.split(`
16
- `),Y=R.length-1,Q=F.length-1;Y>=1&&Q>=0&&R[Y]!==F[Q];)Q--;for(;Y>=1&&Q>=0;Y--,Q--)if(R[Y]!==F[Q]){if(Y!==1||Q!==1)do if(Y--,Q--,Q<0||R[Y]!==F[Q]){var ee=`
17
- `+R[Y].replace(" at new "," at ");return c.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",c.displayName)),typeof c=="function"&&wr.set(c,ee),ee}while(Y>=1&&Q>=0);break}}}finally{Sa=!1,Ea.current=I,$p(),Error.prepareStackTrace=b}var re=c?c.displayName||c.name:"",oe=re?Sr(re):"";return typeof c=="function"&&wr.set(c,oe),oe}function Fp(c,f,g){return Ei(c,!1)}function Lp(c){var f=c.prototype;return!!(f&&f.isReactComponent)}function kr(c,f,g){if(c==null)return"";if(typeof c=="function")return Ei(c,Lp(c));if(typeof c=="string")return Sr(c);switch(c){case p:return Sr("Suspense");case y:return Sr("SuspenseList")}if(typeof c=="object")switch(c.$$typeof){case d:return Fp(c.render);case T:return kr(c.type,f,g);case k:{var h=c,b=h._payload,I=h._init;try{return kr(I(b),f,g)}catch{}}}return""}var xi={},Si=_e.ReactDebugCurrentFrame;function Or(c){if(c){var f=c._owner,g=kr(c.type,c._source,f?f.type:null);Si.setExtraStackFrame(g)}else Si.setExtraStackFrame(null)}function zp(c,f,g,h,b){{var I=Function.call.bind(qt);for(var w in c)if(I(c,w)){var R=void 0;try{if(typeof c[w]!="function"){var F=Error((h||"React class")+": "+g+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw F.name="Invariant Violation",F}R=c[w](f,w,h,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){R=Y}R&&!(R instanceof Error)&&(Or(b),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",h||"React class",g,w,typeof R),Or(null)),R instanceof Error&&!(R.message in xi)&&(xi[R.message]=!0,Or(b),j("Failed %s type: %s",g,R.message),Or(null))}}}function Tt(c){if(c){var f=c._owner,g=kr(c.type,c._source,f?f.type:null);Xe(g)}else Xe(null)}var wa;wa=!1;function wi(){if(J.current){var c=Ke(J.current.type);if(c)return`
13
+ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),u}function Ip(u){var f=me();if(u._context!==void 0){var g=u._context;g.Consumer===u?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):g.Provider===u&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(u)}function Bp(u){var f=me();return f.useState(u)}function Zp(u,f,g){var y=me();return y.useReducer(u,f,g)}function Rp(u){var f=me();return f.useRef(u)}function Ap(u,f){var g=me();return g.useEffect(u,f)}function Dp(u,f){var g=me();return g.useInsertionEffect(u,f)}function Mp(u,f){var g=me();return g.useLayoutEffect(u,f)}function Hp(u,f){var g=me();return g.useCallback(u,f)}function jp(u,f){var g=me();return g.useMemo(u,f)}function Np(u,f,g){var y=me();return y.useImperativeHandle(u,f,g)}function $p(u,f){{var g=me();return g.useDebugValue(u,f)}}function Up(){var u=me();return u.useTransition()}function Kp(u){var f=me();return f.useDeferredValue(u)}function Fp(){var u=me();return u.useId()}function Lp(u,f,g){var y=me();return y.useSyncExternalStore(u,f,g)}var Qt=0,Ti,bi,wi,Pi,ki,Ei,xi;function Si(){}Si.__reactDisabledLog=!0;function zp(){{if(Qt===0){Ti=console.log,bi=console.info,wi=console.warn,Pi=console.error,ki=console.group,Ei=console.groupCollapsed,xi=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Si,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Qt++}}function Wp(){{if(Qt--,Qt===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Re({},u,{value:Ti}),info:Re({},u,{value:bi}),warn:Re({},u,{value:wi}),error:Re({},u,{value:Pi}),group:Re({},u,{value:ki}),groupCollapsed:Re({},u,{value:Ei}),groupEnd:Re({},u,{value:xi})})}Qt<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Oa=Te.ReactCurrentDispatcher,Ca;function Cr(u,f,g){{if(Ca===void 0)try{throw Error()}catch(b){var y=b.stack.trim().match(/\n( *(at )?)/);Ca=y&&y[1]||""}return`
14
+ `+Ca+u}}var Ia=!1,Ir;{var Vp=typeof WeakMap=="function"?WeakMap:Map;Ir=new Vp}function Oi(u,f){if(!u||Ia)return"";{var g=Ir.get(u);if(g!==void 0)return g}var y;Ia=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=Oa.current,Oa.current=null,zp();try{if(f){var x=function(){throw Error()};if(Object.defineProperty(x.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(x,[])}catch(de){y=de}Reflect.construct(u,[],x)}else{try{x.call()}catch(de){y=de}u.call(x.prototype)}}else{try{throw Error()}catch(de){y=de}u()}}catch(de){if(de&&y&&typeof de.stack=="string"){for(var A=de.stack.split(`
15
+ `),L=y.stack.split(`
16
+ `),Y=A.length-1,Q=L.length-1;Y>=1&&Q>=0&&A[Y]!==L[Q];)Q--;for(;Y>=1&&Q>=0;Y--,Q--)if(A[Y]!==L[Q]){if(Y!==1||Q!==1)do if(Y--,Q--,Q<0||A[Y]!==L[Q]){var ee=`
17
+ `+A[Y].replace(" at new "," at ");return u.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",u.displayName)),typeof u=="function"&&Ir.set(u,ee),ee}while(Y>=1&&Q>=0);break}}}finally{Ia=!1,Oa.current=B,Wp(),Error.prepareStackTrace=b}var ne=u?u.displayName||u.name:"",oe=ne?Cr(ne):"";return typeof u=="function"&&Ir.set(u,oe),oe}function qp(u,f,g){return Oi(u,!1)}function Gp(u){var f=u.prototype;return!!(f&&f.isReactComponent)}function Br(u,f,g){if(u==null)return"";if(typeof u=="function")return Oi(u,Gp(u));if(typeof u=="string")return Cr(u);switch(u){case p:return Cr("Suspense");case m:return Cr("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return qp(u.render);case T:return Br(u.type,f,g);case C:{var y=u,b=y._payload,B=y._init;try{return Br(B(b),f,g)}catch{}}}return""}var Ci={},Ii=Te.ReactDebugCurrentFrame;function Zr(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);Ii.setExtraStackFrame(g)}else Ii.setExtraStackFrame(null)}function Jp(u,f,g,y,b){{var B=Function.call.bind(Yt);for(var x in u)if(B(u,x)){var A=void 0;try{if(typeof u[x]!="function"){var L=Error((y||"React class")+": "+g+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw L.name="Invariant Violation",L}A=u[x](f,x,y,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){A=Y}A&&!(A instanceof Error)&&(Zr(b),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",y||"React class",g,x,typeof A),Zr(null)),A instanceof Error&&!(A.message in Ci)&&(Ci[A.message]=!0,Zr(b),j("Failed %s type: %s",g,A.message),Zr(null))}}}function kt(u){if(u){var f=u._owner,g=Br(u.type,u._source,f?f.type:null);tt(g)}else tt(null)}var Ba;Ba=!1;function Bi(){if(F.current){var u=We(F.current.type);if(u)return`
18
18
 
19
- Check the render method of \``+c+"`."}return""}function Kp(c){if(c!==void 0){var f=c.fileName.replace(/^.*[\\\/]/,""),g=c.lineNumber;return`
19
+ Check the render method of \``+u+"`."}return""}function Yp(u){if(u!==void 0){var f=u.fileName.replace(/^.*[\\\/]/,""),g=u.lineNumber;return`
20
20
 
21
- Check your code at `+f+":"+g+"."}return""}function Vp(c){return c!=null?Kp(c.__source):""}var ki={};function qp(c){var f=wi();if(!f){var g=typeof c=="string"?c:c.displayName||c.name;g&&(f=`
21
+ Check your code at `+f+":"+g+"."}return""}function Xp(u){return u!=null?Yp(u.__source):""}var Zi={};function Qp(u){var f=Bi();if(!f){var g=typeof u=="string"?u:u.displayName||u.name;g&&(f=`
22
22
 
23
- Check the top-level render call using <`+g+">.")}return f}function 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 Ri(u,f){if(!(!u._store||u._store.validated||u.key!=null)){u._store.validated=!0;var g=Qp(f);if(!Zi[g]){Zi[g]=!0;var y="";u&&u._owner&&u._owner!==F.current&&(y=" It was passed a child from "+We(u._owner.type)+"."),kt(u),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,y),kt(null)}}}function Ai(u,f){if(typeof u=="object"){if(Er(u))for(var g=0;g<u.length;g++){var y=u[g];Pt(y)&&Ri(y,f)}else if(Pt(u))u._store&&(u._store.validated=!0);else if(u){var b=q(u);if(typeof b=="function"&&b!==u.entries)for(var B=b.call(u),x;!(x=B.next()).done;)Pt(x.value)&&Ri(x.value,f)}}}function Di(u){{var f=u.type;if(f==null||typeof f=="string")return;var g;if(typeof f=="function")g=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===c||f.$$typeof===T))g=f.propTypes;else return;if(g){var y=We(f);Jp(g,u.props,"prop",y,u)}else if(f.PropTypes!==void 0&&!Ba){Ba=!0;var b=We(f);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function eg(u){{for(var f=Object.keys(u.props),g=0;g<f.length;g++){var y=f[g];if(y!=="children"&&y!=="key"){kt(u),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),kt(null);break}}u.ref!==null&&(kt(u),j("Invalid attribute `ref` supplied to `React.Fragment`."),kt(null))}}function Mi(u,f,g){var y=_i(u);if(!y){var b="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var B=Xp(f);B?b+=B:b+=Bi();var x;u===null?x="null":Er(u)?x="array":u!==void 0&&u.$$typeof===e?(x="<"+(We(u.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):x=typeof u,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,b)}var A=gp.apply(this,arguments);if(A==null)return A;if(y)for(var L=2;L<arguments.length;L++)Ai(arguments[L],u);return u===n?eg(A):Di(A),A}var Hi=!1;function tg(u){var f=Mi.bind(null,u);return f.type=u,Hi||(Hi=!0,ke("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(f,"type",{enumerable:!1,get:function(){return ke("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:u}),u}}),f}function rg(u,f,g){for(var y=mp.apply(this,arguments),b=2;b<arguments.length;b++)Ai(arguments[b],y.type);return Di(y),y}function ng(u,f){var g=J.transition;J.transition={};var y=J.transition;J.transition._updatedFibers=new Set;try{u()}finally{if(J.transition=g,g===null&&y._updatedFibers){var b=y._updatedFibers.size;b>10&&ke("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),y._updatedFibers.clear()}}}var ji=!1,Rr=null;function ag(u){if(Rr===null)try{var f=("require"+Math.random()).slice(0,7),g=$r&&$r[f];Rr=g.call($r,"timers").setImmediate}catch{Rr=function(b){ji===!1&&(ji=!0,typeof MessageChannel>"u"&&j("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var B=new MessageChannel;B.port1.onmessage=b,B.port2.postMessage(void 0)}}return Rr(u)}var Et=0,Ni=!1;function $i(u){{var f=Et;Et++,N.current===null&&(N.current=[]);var g=N.isBatchingLegacy,y;try{if(N.isBatchingLegacy=!0,y=u(),!g&&N.didScheduleLegacyUpdate){var b=N.current;b!==null&&(N.didScheduleLegacyUpdate=!1,Aa(b))}}catch(ne){throw Ar(f),ne}finally{N.isBatchingLegacy=g}if(y!==null&&typeof y=="object"&&typeof y.then=="function"){var B=y,x=!1,A={then:function(ne,oe){x=!0,B.then(function(de){Ar(f),Et===0?Za(de,ne,oe):ne(de)},function(de){Ar(f),oe(de)})}};return!Ni&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){x||(Ni=!0,j("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),A}else{var L=y;if(Ar(f),Et===0){var Y=N.current;Y!==null&&(Aa(Y),N.current=null);var Q={then:function(ne,oe){N.current===null?(N.current=[],Za(L,ne,oe)):ne(L)}};return Q}else{var ee={then:function(ne,oe){ne(L)}};return ee}}}}function Ar(u){u!==Et-1&&j("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Et=u}function Za(u,f,g){{var y=N.current;if(y!==null)try{Aa(y),ag(function(){y.length===0?(N.current=null,f(u)):Za(u,f,g)})}catch(b){g(b)}else f(u)}}var Ra=!1;function Aa(u){if(!Ra){Ra=!0;var f=0;try{for(;f<u.length;f++){var g=u[f];do g=g(!0);while(g!==null)}u.length=0}catch(y){throw u=u.slice(f+1),y}finally{Ra=!1}}}var sg=Mi,ig=rg,og=tg,lg={map:Or,forEach:bp,count:Tp,toArray:wp,only:Pp};U.Children=lg,U.Component=rt,U.Fragment=n,U.Profiler=s,U.PureComponent=wa,U.StrictMode=a,U.Suspense=p,U.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Te,U.act=$i,U.cloneElement=ig,U.createContext=kp,U.createElement=sg,U.createFactory=og,U.createRef=ip,U.forwardRef=Op,U.isValidElement=Pt,U.lazy=Sp,U.memo=Cp,U.startTransition=ng,U.unstable_act=$i,U.useCallback=Hp,U.useContext=Ip,U.useDebugValue=$p,U.useDeferredValue=Kp,U.useEffect=Ap,U.useId=Fp,U.useImperativeHandle=Np,U.useInsertionEffect=Dp,U.useLayoutEffect=Mp,U.useMemo=jp,U.useReducer=Zp,U.useRef=Rp,U.useState=Bp,U.useSyncExternalStore=Lp,U.useTransition=Up,U.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var St=Ma((vT,Ka)=>{"use strict";process.env.NODE_ENV==="production"?Ka.exports=ro():Ka.exports=no()});var hT={};er(hT,{BRAND:()=>Zc,Bot:()=>fa,BotDefinition:()=>da,BotLogger:()=>Xe,BotSpecificClient:()=>Ze,DIRTY:()=>ut,EMPTY_PATH:()=>xc,ErrorBoundary:()=>Dt,INVALID:()=>I,Integration:()=>ca,IntegrationDefinition:()=>oa,IntegrationLogger:()=>Ye,IntegrationSpecificClient:()=>Vt,InterfaceDefinition:()=>pa,NEVER:()=>Ef,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Plugin:()=>ha,PluginDefinition:()=>ga,RuntimeError:()=>ma.RuntimeError,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>Nt,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>xs,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>ws,ZodFunction:()=>Os,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Cs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>je,ZodParsedType:()=>P,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Bs,ZodRef:()=>Zs,ZodSchema:()=>D,ZodSet:()=>Rs,ZodString:()=>ge,ZodSymbol:()=>Ks,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Fs,ZuiForm:()=>O_,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Dd,any:()=>Wd,array:()=>Jd,bigint:()=>Ud,boolean:()=>Gs,botIdHeader:()=>br,botUserIdHeader:()=>Xs,coerce:()=>kf,configurationHeader:()=>wr,configurationTypeHeader:()=>ti,conversation:()=>Sd,createZodEnum:()=>yr,cuid2Regex:()=>Ds,cuidRegex:()=>As,custom:()=>Es,datasource:()=>Md,date:()=>Kd,datetimeRegex:()=>Us,defaultComponentDefinitions:()=>C_,discriminatedUnion:()=>ef,effect:()=>ds,emailRegex:()=>js,enum:()=>ff,errorUtil:()=>O,event:()=>Bd,fromJsonSchema:()=>wf,fromObject:()=>Pf,function:()=>uf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>Nd,integrationIdHeader:()=>Qs,intent:()=>Ad,intersection:()=>tf,ipv4Regex:()=>Ns,ipv6Regex:()=>$s,isAborted:()=>rn,isApiError:()=>ma.isApiError,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Gc,isValid:()=>jt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Hd,late:()=>jd,lazy:()=>cf,literal:()=>df,makeIssue:()=>fr,map:()=>of,mergeObjectSchemas:()=>zt,message:()=>Cd,messages:()=>Ys,nan:()=>$d,nativeEnum:()=>pf,never:()=>qd,null:()=>zd,nullable:()=>mf,number:()=>qs,object:()=>Yd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>bf,onumber:()=>Tf,operationHeader:()=>Pr,optional:()=>hf,ostring:()=>_f,parseBody:()=>Se,pipeline:()=>vf,preprocess:()=>yf,processCreateParams:()=>R,promise:()=>gf,quotelessJson:()=>Pc,readonly:()=>sf,record:()=>nf,ref:()=>af,serve:()=>kr,set:()=>lf,setErrorMap:()=>ks,strictObject:()=>Xd,string:()=>Vs,symbol:()=>Fd,table:()=>Zd,tablerow:()=>Rd,transformer:()=>ds,transforms:()=>I_,tuple:()=>rf,typeHeader:()=>ri,ulidRegex:()=>Ms,undefined:()=>Ld,union:()=>Qd,unknown:()=>Vd,user:()=>Od,util:()=>M,uuidRegex:()=>Hs,variable:()=>xd,void:()=>Gd,webhookIdHeader:()=>ei,withErrorBoundary:()=>Cf,z:()=>E,zuiToJsonSchema:()=>aa});module.exports=yg(hT);var Ys={};er(Ys,{defaults:()=>D_,markdown:()=>A_});var Mn=nt(St(),1),ae=nt(St(),1),Ne=nt(St(),1),Kt=nt(St(),1),be=nt(St(),1),fs=Object.defineProperty,Rg=Object.defineProperties,Ag=Object.getOwnPropertyDescriptors,Yr=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable,ao=(t,e,r)=>e in t?fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))No.call(e,r)&&ao(t,r,e[r]);if(Yr)for(var r of Yr(e))$o.call(e,r)&&ao(t,r,e[r]);return t},h=(t,e)=>Rg(t,Ag(e)),l=(t,e)=>fs(t,"name",{value:e,configurable:!0}),Uo=(t,e)=>{var r={};for(var n in t)No.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Yr)for(var n of Yr(t))e.indexOf(n)<0&&$o.call(t,n)&&(r[n]=t[n]);return r},Ko=(t,e)=>{for(var r in e)fs(t,r,{get:e[r],enumerable:!0})},E={};Ko(E,{BRAND:()=>Zc,DIRTY:()=>ut,EMPTY_PATH:()=>xc,INVALID:()=>I,NEVER:()=>Ef,OK:()=>pe,ParseInputLazyPath:()=>xe,ParseStatus:()=>ve,Schema:()=>D,ZodAny:()=>gr,ZodArray:()=>Nt,ZodBigInt:()=>Ln,ZodBoolean:()=>zn,ZodBranded:()=>Wn,ZodCatch:()=>Vn,ZodDate:()=>qn,ZodDefault:()=>mr,ZodDiscriminatedUnion:()=>xs,ZodEffects:()=>Je,ZodEnum:()=>Tt,ZodError:()=>Be,ZodFirstPartyTypeKind:()=>ws,ZodFunction:()=>Os,ZodIntersection:()=>Gn,ZodIssueCode:()=>_,ZodLazy:()=>Jn,ZodLiteral:()=>Yn,ZodMap:()=>Cs,ZodNaN:()=>Is,ZodNativeEnum:()=>Xn,ZodNever:()=>qe,ZodNull:()=>Qn,ZodNullable:()=>dt,ZodNumber:()=>ea,ZodObject:()=>ft,ZodOptional:()=>je,ZodParsedType:()=>P,ZodPipeline:()=>ta,ZodPromise:()=>vr,ZodReadonly:()=>_r,ZodRecord:()=>Bs,ZodRef:()=>Zs,ZodSchema:()=>D,ZodSet:()=>Rs,ZodString:()=>ge,ZodSymbol:()=>Ks,ZodTransformer:()=>Je,ZodTuple:()=>pt,ZodType:()=>D,ZodUndefined:()=>ra,ZodUnion:()=>na,ZodUnknown:()=>At,ZodVoid:()=>Fs,addIssueToContext:()=>w,agent:()=>Id,aimodel:()=>Dd,any:()=>Wd,array:()=>Jd,bigint:()=>Ud,boolean:()=>Gs,coerce:()=>kf,conversation:()=>Sd,createZodEnum:()=>yr,cuid2Regex:()=>Ds,cuidRegex:()=>As,custom:()=>Es,datasource:()=>Md,date:()=>Kd,datetimeRegex:()=>Us,default:()=>a_,discriminatedUnion:()=>ef,effect:()=>ds,emailRegex:()=>js,enum:()=>ff,errorUtil:()=>O,event:()=>Bd,fromJsonSchema:()=>wf,fromObject:()=>Pf,function:()=>uf,getErrorMap:()=>Ht,getParsedType:()=>Me,instanceof:()=>Nd,intent:()=>Ad,intersection:()=>tf,ipv4Regex:()=>Ns,ipv6Regex:()=>$s,isAborted:()=>rn,isAsync:()=>pr,isDirty:()=>nn,isEmojiRegex:()=>Gc,isValid:()=>jt,jsonSchemaToZui:()=>Tr,knowledgebase:()=>Hd,late:()=>jd,lazy:()=>cf,literal:()=>df,makeIssue:()=>fr,map:()=>of,message:()=>Cd,nan:()=>$d,nativeEnum:()=>pf,never:()=>qd,null:()=>zd,nullable:()=>mf,number:()=>qs,object:()=>Yd,objectToZui:()=>Ut,objectUtil:()=>en,oboolean:()=>bf,onumber:()=>Tf,optional:()=>hf,ostring:()=>_f,pipeline:()=>vf,preprocess:()=>yf,processCreateParams:()=>R,promise:()=>gf,quotelessJson:()=>Pc,readonly:()=>sf,record:()=>nf,ref:()=>af,set:()=>lf,setErrorMap:()=>ks,strictObject:()=>Xd,string:()=>Vs,symbol:()=>Fd,table:()=>Zd,tablerow:()=>Rd,transformer:()=>ds,tuple:()=>rf,ulidRegex:()=>Ms,undefined:()=>Ld,union:()=>Qd,unknown:()=>Vd,user:()=>Od,util:()=>M,uuidRegex:()=>Hs,variable:()=>xd,void:()=>Gd,zuiToJsonSchema:()=>aa});var K="x-zui",Fo=(0,ae.createContext)({formData:void 0,formSchema:void 0,setFormData:l(()=>{throw new Error("Must be within a FormDataProvider")},"setFormData"),setHiddenState:l(()=>{throw new Error("Must be within a FormDataProvider")},"setHiddenState"),setDisabledState:l(()=>{throw new Error("Must be within a FormDataProvider")},"setDisabledState"),hiddenState:{},disabledState:{},validation:{formValid:null,formErrors:null}}),so=l((t,e,r)=>{var n;let a=(n=e[K])==null?void 0:n[t];if(typeof a>"u")return!1;if(typeof a=="boolean")return a;if(typeof a=="string"){if(typeof window>"u")return console.warn("Function evaluation is not supported in server side rendering"),!1;let o=new Function("return "+a)()(r);switch(typeof o){case"object":case"boolean":return o;default:return!1}}return!1},"parseMaskableField"),Lo=l((t,e)=>{let r=(0,ae.useContext)(Fo);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ae.useMemo)(()=>ot(r.formData,e),[r.formData,e]),a=(0,ae.useMemo)(()=>{var k;return r.validation.formValid===null?{formValid:null,formErrors:null}:r.validation.formValid===!1?{formValid:!1,formErrors:((k=r.validation.formErrors)==null?void 0:k.filter(S=>Vo(S.path,e)).map(S=>({message:S.message,code:S.code,path:e})))||null}:{formValid:!0,formErrors:[]}},[r.validation.formValid,r.validation.formErrors,e]),s=r.dataTransform?r.dataTransform(n):n,o=(0,ae.useMemo)(()=>so("hidden",t,s),[t,s]),i=(0,ae.useMemo)(()=>so("disabled",t,s),[t,s]);(0,ae.useEffect)(()=>{r.setHiddenState(k=>Ot(k,e,o||{})),r.setDisabledState(k=>Ot(k,e,i||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:c,hidden:p}=(0,ae.useMemo)(()=>{let k=o===!0||ot(r.hiddenState,e),S=i===!0||ot(r.disabledState,e);return{hidden:k===!0,disabled:S===!0}},[r.hiddenState,r.disabledState,o,i,e]),m=(0,ae.useCallback)((k,S)=>{r.setFormData(W=>Ot(W,k,S))},[r.setFormData]),T=(0,ae.useCallback)((k,S=void 0)=>{let W=Rt(t.items);r.setFormData(q=>{let re=ot(q,k)||[];return S===void 0&&(S=W),Ot(q,k,Array.isArray(re)?[...re,S]:[S])})},[r.setFormData]),C=(0,ae.useCallback)((k,S)=>{r.setFormData(W=>{let q=ot(W,k)||[];return Array.isArray(q)?(q.splice(S,1),Ot(W,k,q)):W})},[r.setFormData]);return d(h(d({},r),{data:n,disabled:c,hidden:p,handlePropertyChange:m,addArrayItem:T,removeArrayItem:C}),a)},"useFormData");function Ot(t,e,r){if(e.length===0)return r;let n=e.length;return e.reduce((a,s,o)=>(o===n-1?a[s]=r:a[s]||(a[s]=isNaN(Number(s))?{}:[]),a[s]),t??{}),d({},t)}l(Ot,"setObjectPath");var Rt=l((t,e)=>{var r,n,a,s;if(Array.isArray(t))return Rt(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return Rt(t.anyOf[0]);if(t.type==="object"&&t.properties){let o={};return Object.entries(t.properties).map(([i,c])=>{var p;o[i]=Rt(c,!((p=t.required)!=null&&p.includes(i))||zo(c)||!1)}),o}if(t.type==="array")return t.minItems&&t.minItems>0?[Rt(t.items)]:[];if(t.type==="string")return(n=t.enum)!=null&&n.length?t.enum[0]:"";if(t.type==="number")return(a=t.enum)!=null&&a.length?t.enum[0]:0;if(t.type==="boolean")return(s=t.enum)!=null&&s.length?t.enum[0]:!1}},"getDefaultValues"),Dg=l(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:o})=>{let[i,c]=(0,ae.useState)({}),[p,m]=(0,ae.useState)({}),T=o?o(r):r,C=(0,ae.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let k=Tr(n).safeParse(T);return k.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:k.error.issues}},[JSON.stringify({transformedData:T})]);return(0,ae.useEffect)(()=>{s&&s(C)},[C]),ae.default.createElement(Fo.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:C,hiddenState:i,setHiddenState:c,disabledState:p,setDisabledState:m,dataTransform:o}},t)},"FormDataProvider");function ot(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}l(ot,"getPathData");function zo(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}l(zo,"isOptional");function Xr(t,e){let r=d({},t);for(let n in e)e.hasOwnProperty(n)&&(typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?typeof r[n]=="object"&&r[n]!==null&&!Array.isArray(r[n])?r[n]=Xr(r[n],e[n]):r[n]=Xr({},e[n]):r[n]=e[n]);return r}l(Xr,"deepMerge");var Mg=l((t,e)=>{let{handlePropertyChange:r,data:n}=Lo(t,e),{discriminator:a,value:s,discriminatedSchema:o}=(0,Mn.useMemo)(()=>{let i=Wo(t.anyOf),c=i?.key?n?.[i.key]:t.default||null,p=Hg(i?.key||null,c,t.anyOf);return{discriminator:i,value:c,discriminatedSchema:p}},[t.anyOf,n]);return(0,Mn.useEffect)(()=>{a?.key&&a?.values.length&&Object.keys(n||{}).length<1&&!t.default&&r(e,{[a.key]:a.values[0]})},[]),{discriminator:a,discriminatorValue:s,discriminatedSchema:o}},"useDiscriminator"),Wo=l(t=>{let e=t?.map(r=>r.type!=="object"||!r.properties?null:Object.entries(r.properties).map(([n,a])=>{var s;return a.type==="string"&&((s=a.enum)!=null&&s.length)?{key:n,value:a.enum[0]}:null}).filter(n=>!!n)).flat().reduce((r,n)=>{if(!n)return r;let{key:a,value:s}=n;return r.key===null&&(r.key=a),r.key===a&&r.values.push(s),r},{key:null,values:[]});return e?.key===null||!e?.values.length?null:e},"resolveDiscriminator"),Hg=l((t,e,r)=>{var n,a;if(!r?.length||!t||!e)return null;for(let s of r){if(s.type!=="object")continue;let o=(n=s.properties)==null?void 0:n[t];if(o?.type==="string"&&((a=o.enum)!=null&&a.length)&&o.enum[0]===e)return h(d({},s),{properties:h(d({},s.properties),{[t]:h(d({},o),{[K]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),jg=l(t=>{var e;return(e=t.anyOf)!=null&&e.length?Wo(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),Ng=l((t,e)=>{var r,n,a;let s=jg(e),o=((r=e[K])==null?void 0:r.displayAs)||null;if(!o||!Array.isArray(o)||o.length<2){let m=(n=t?.[s])==null?void 0:n.default;return m?{Component:m,type:s,id:"default",params:{}}:null}let i=o[0],c=((a=t?.[s])==null?void 0:a[i])||null;if(!c)return console.warn(`Component ${s}.${i} not found`),null;let p=o[1]||{};return{Component:c,type:s,id:i,params:p}},"resolveComponent");function Vo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}l(Vo,"pathMatches");function Va(t,e){return e||(e=new RegExp("/s|-|_| ","g")),Jo(t).split(e).map(qo).map(Yo).reduce(Go)}l(Va,"formatTitle");function qo(t){return t.charAt(0).toUpperCase()+t.substring(1)}l(qo,"capitalize");function Go(t,e){return`${t} ${e}`}l(Go,"combine");function Jo(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}l(Jo,"decamelize");function Yo(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of Lg)if(s.toLowerCase()===n)return s;return $g.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:Fg.includes(n)||Kg.includes(n)||Ug.includes(n)?n:t}l(Yo,"handleSpecialWords");var $g=["2D","3D","4WD","A2O","API","BIOS","CCTV","CC","CCV","CD","CD-ROM","COBOL","CIA","CMS","CSS","CSV","CV","DIY","DVD","DB","DNA","E3","EIN","ESPN","FAQ","FAQs","FTP","FPS","FORTRAN","FBI","HTML","HTTP","ID","IP","ISO","JS","JSON","LASER","M2A","M2M","M2MM","M2O","MMORPG","NAFTA","NASA","NDA","O2M","PDF","PHP","POP","RAM","RNGR","ROM","RPG","RTFM","RTS","SCUBA","SITCOM","SKU","SMTP","SQL","SSN","SWAT","TBS","TTL","TV","TNA","UI","URL","USB","UWP","VIP","W3C","WYSIWYG","WWW","WWE","WWF"],Ug=["a","an","the"],Kg=["and","that","but","or","as","if","when","than","because","while","where","after","so","though","since","until","whether","before","although","nor","like","once","unless","now","except"],Fg=["about","above","across","after","against","along","among","around","at","because of","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","despite","down","during","except","excepting","for","from","in","in front of","inside","in spite of","instead of","into","like","near","of","off","on","onto","out","outside","over","past","regarding","since","through","throughout","to","toward","under","underneath","until","up","upon","up to","with","within","without","with regard to","with respect to"],Lg=["2FA","3D","4K","5K","8K","AGI","BI","ChatGPT","CTA","DateTime","GitHub","GPT","HD","IBMid","ID","IDs","iMac","IMAX","iOS","IP","iPad","iPhone","iPod","LDAP","LinkedIn","LLM","M2M","M2O","macOS","McDonalds","ML","MySQL","NLG","NLP","NLU","O2M","OpenAI","PDFs","PEFT","pH","PostgreSQL","SEO","TTS","UHD","UUID","XSS","YouTube"];function Xo(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:He(t)}l(Xo,"primitiveToTypscriptLiteralType");function He(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${He(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}l(He,"primitiveToTypescriptValue");function Qo(t){return typeof t>"u"?"undefined":JSON.stringify(t)}l(Qo,"unknownToTypescriptValue");var io=l(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:He(t),"toPropertyKey"),zg=l(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),el=l(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(zg).filter(n=>!!n).join("")},"toTypeArgumentName"),Z=l(t=>{let e=(t??"").split(`
24
24
  `).filter(r=>r.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
25
25
  * ${e.join(`
26
26
  * `)}
27
- */`},"getMultilineComment"),Jo={};jo(Jo,{JsonSchemaToZuiError:()=>Qo,ObjectToZuiError:()=>La,UnrepresentableGenericError:()=>za,UnsupportedZuiToJsonSchemaError:()=>$g,UnsupportedZuiToTypescriptSchemaError:()=>rt,UnsupportedZuiToTypescriptTypeError:()=>cu,UntitledDeclarationError:()=>du,ZuiToJsonSchemaError:()=>ru,ZuiToTypescriptSchemaError:()=>su,ZuiToTypescriptTypeError:()=>Rn,ZuiTransformError:()=>$t});var Yo=class extends Error{constructor(e,r){super(r),this.transform=e}};u(Yo,"ZuiTransformError");var $t=Yo,Xo=class extends $t{constructor(e){super("json-schema-to-zui",e)}};u(Xo,"JsonSchemaToZuiError");var Qo=Xo,eu=class extends $t{constructor(e){super("object-to-zui",e)}};u(eu,"ObjectToZuiError");var La=eu,tu=class extends $t{constructor(e){super("zui-to-json-schema",e)}};u(tu,"ZuiToJsonSchemaError");var ru=tu,nu=class extends ru{constructor(e){super(`Zod type ${e} cannot be transformed to JSON Schema.`)}};u(nu,"UnsupportedZuiToJsonSchemaError");var $g=nu,au=class extends $t{constructor(e){super("zui-to-typescript-schema",e)}};u(au,"ZuiToTypescriptSchemaError");var su=au,iu=class extends su{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};u(iu,"UnsupportedZuiToTypescriptSchemaError");var rt=iu,ou=class extends $t{constructor(e){super("zui-to-typescript-type",e)}};u(ou,"ZuiToTypescriptTypeError");var Rn=ou,uu=class extends Rn{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};u(uu,"UnsupportedZuiToTypescriptTypeError");var cu=uu,lu=class extends Rn{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};u(lu,"UntitledDeclarationError");var du=lu,fu=class extends Rn{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};u(fu,"UnrepresentableGenericError");var za=fu,pu=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Ug=u(t=>pu.includes(t),"isPrimitive"),Fg=u(t=>pu.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),ro=u(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),gu=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};u(gu,"KeyValue");var jr=gu,mu=class{constructor(e){this.schema=e}};u(mu,"FnParameters");var no=mu,hu=class{constructor(e){this.schema=e}};u(hu,"FnReturn");var ao=hu,yu=class{constructor(e){this.props=e}};u(yu,"Declaration");var Nr=yu;function Wr(t,e={}){let r=Kg(t,e),n=L(r,{});return e.formatter&&(n=e.formatter(n)),n}u(Wr,"toTypescript");function L(t,e){var r,n,a;let s=m(l({},e),{parent:t});if(t===null)return"";if(t instanceof Nr)return Lg(t,s);if(t instanceof jr){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)),L(new jr(t.key,P,!0),s)}let d=Z(t.value._def.description),p=d?.trim().length>0?`
28
- `:"",y=t.value.describe(""),k=t.optional||t.value.isOptional()?"?":"";return`${p}${d}${p}${t.key}${k}: ${L(y,s)}${p}`}if(t instanceof no){if(t.schema instanceof v.ZodTuple){let y="";for(let T=0;T<t.schema.items.length;T++){let k=(a=(n=(r=t.schema.items[T])==null?void 0:r.ui)==null?void 0:n.title)!=null?a:`arg${T}`,P=t.schema.items[T];y+=`${L(new jr(to(k),P),s)}${T<t.schema.items.length-1?", ":""} `}return y}let d=L(t.schema,s);return d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]")||d.startsWith("(")&&d.endsWith(")")||d.startsWith("Array<")&&d.endsWith(">")||d.startsWith("Record<")&&d.endsWith(">")||Fg(d)?`args: ${d}`:d}if(t instanceof ao)return t.schema instanceof v.ZodOptional?`${L(t.schema.unwrap(),s)} | undefined`:L(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 d=L(o.type,s);return Ug(d)?`${d}[]`:`Array<${d}>`;case v.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(o.shape()).map(([H,J])=>L(new jr(to(H),J),s)).join("; ")} }`;case v.ZodFirstPartyTypeKind.ZodUnion:let y=o.options.map(H=>L(H,s));return`${Z(o.description)}
29
- ${y.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let T=o.options.map(H=>L(H,s));return`${Z(t._def.description)}
30
- ${T.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodIntersection:return`${L(o.left,s)} & ${L(o.right,s)}`;case v.ZodFirstPartyTypeKind.ZodTuple:return o.items.length===0?"":`[${o.items.map(H=>L(H,s)).join(", ")}]`;case v.ZodFirstPartyTypeKind.ZodRecord:let P=L(o.keyType,s),D=L(o.valueType,s);return`${Z(o.description)} { [key: ${P}]: ${D} }`;case v.ZodFirstPartyTypeKind.ZodMap:return`Map<${L(o.keyType,s)}, ${L(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodSet:return`Set<${L(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodFunction:let K=L(new no(o.args),s),G=L(new ao(o.returns),s);return`${Z(o.description)}
31
- (${K}) => ${G}`;case v.ZodFirstPartyTypeKind.ZodLazy:return L(o.getter(),s);case v.ZodFirstPartyTypeKind.ZodLiteral:let se=qo(o.value);return`${Z(o.description)}
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"),tl={};Ko(tl,{JsonSchemaToZuiError:()=>al,ObjectToZuiError:()=>qa,UnrepresentableGenericError:()=>Ga,UnsupportedZuiToJsonSchemaError:()=>Wg,UnsupportedZuiToTypescriptSchemaError:()=>st,UnsupportedZuiToTypescriptTypeError:()=>gl,UntitledDeclarationError:()=>ml,ZuiToJsonSchemaError:()=>ol,ZuiToTypescriptSchemaError:()=>cl,ZuiToTypescriptTypeError:()=>Hn,ZuiTransformError:()=>Ft});var rl=class extends Error{constructor(e,r){super(r),this.transform=e}};l(rl,"ZuiTransformError");var Ft=rl,nl=class extends Ft{constructor(e){super("json-schema-to-zui",e)}};l(nl,"JsonSchemaToZuiError");var al=nl,sl=class extends Ft{constructor(e){super("object-to-zui",e)}};l(sl,"ObjectToZuiError");var qa=sl,il=class extends Ft{constructor(e){super("zui-to-json-schema",e)}};l(il,"ZuiToJsonSchemaError");var ol=il,ll=class extends ol{constructor(e){super(`Zod type ${e} cannot be transformed to JSON Schema.`)}};l(ll,"UnsupportedZuiToJsonSchemaError");var Wg=ll,ul=class extends Ft{constructor(e){super("zui-to-typescript-schema",e)}};l(ul,"ZuiToTypescriptSchemaError");var cl=ul,dl=class extends cl{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};l(dl,"UnsupportedZuiToTypescriptSchemaError");var st=dl,fl=class extends Ft{constructor(e){super("zui-to-typescript-type",e)}};l(fl,"ZuiToTypescriptTypeError");var Hn=fl,pl=class extends Hn{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};l(pl,"UnsupportedZuiToTypescriptTypeError");var gl=pl,hl=class extends Hn{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};l(hl,"UntitledDeclarationError");var ml=hl,yl=class extends Hn{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};l(yl,"UnrepresentableGenericError");var Ga=yl,vl=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Vg=l(t=>vl.includes(t),"isPrimitive"),qg=l(t=>vl.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),oo=l(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),_l=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};l(_l,"KeyValue");var Ur=_l,Tl=class{constructor(e){this.schema=e}};l(Tl,"FnParameters");var lo=Tl,bl=class{constructor(e){this.schema=e}};l(bl,"FnReturn");var uo=bl,wl=class{constructor(e){this.props=e}};l(wl,"Declaration");var Fr=wl;function Qr(t,e={}){let r=Yg(t,e),n=z(r,{});return e.formatter&&(n=e.formatter(n)),n}l(Qr,"toTypescript");function z(t,e){var r,n,a;let s=h(d({},e),{parent:t});if(t===null)return"";if(t instanceof Fr)return Gg(t,s);if(t instanceof Ur){if(t.value instanceof v.ZodOptional){let k=t.value._def.innerType;return k instanceof v.Schema&&!k.description&&t.value.description&&(k=k?.describe(t.value.description)),z(new Ur(t.key,k,!0),s)}let c=Z(t.value._def.description),p=c?.trim().length>0?`
28
+ `:"",m=t.value.describe(""),C=t.optional||t.value.isOptional()?"?":"";return`${p}${c}${p}${t.key}${C}: ${z(m,s)}${p}`}if(t instanceof lo){if(t.schema instanceof v.ZodTuple){let m="";for(let T=0;T<t.schema.items.length;T++){let C=(a=(n=(r=t.schema.items[T])==null?void 0:r.ui)==null?void 0:n.title)!=null?a:`arg${T}`,k=t.schema.items[T];m+=`${z(new Ur(io(C),k),s)}${T<t.schema.items.length-1?", ":""} `}return m}let c=z(t.schema,s);return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||qg(c)?`args: ${c}`:c}if(t instanceof uo)return t.schema instanceof v.ZodOptional?`${z(t.schema.unwrap(),s)} | undefined`:z(t.schema,s);let i=t._def;switch(i.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(i.description)} string`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:case v.ZodFirstPartyTypeKind.ZodNaN:case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(i.description)} number`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)} boolean`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(i.description)} Date`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(i.description)} undefined`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(i.description)} null`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(i.description)} any`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(i.description)} unknown`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(i.description)} never`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(i.description)} void`.trim();case v.ZodFirstPartyTypeKind.ZodArray:let c=z(i.type,s);return Vg(c)?`${c}[]`:`Array<${c}>`;case v.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(i.shape()).map(([N,F])=>z(new Ur(io(N),F),s)).join("; ")} }`;case v.ZodFirstPartyTypeKind.ZodUnion:let m=i.options.map(N=>z(N,s));return`${Z(i.description)}
29
+ ${m.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let T=i.options.map(N=>z(N,s));return`${Z(t._def.description)}
30
+ ${T.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodIntersection:return`${z(i.left,s)} & ${z(i.right,s)}`;case v.ZodFirstPartyTypeKind.ZodTuple:return i.items.length===0?"":`[${i.items.map(N=>z(N,s)).join(", ")}]`;case v.ZodFirstPartyTypeKind.ZodRecord:let k=z(i.keyType,s),S=z(i.valueType,s);return`${Z(i.description)} { [key: ${k}]: ${S} }`;case v.ZodFirstPartyTypeKind.ZodMap:return`Map<${z(i.keyType,s)}, ${z(i.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodSet:return`Set<${z(i.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodFunction:let W=z(new lo(i.args),s),q=z(new uo(i.returns),s);return`${Z(i.description)}
31
+ (${W}) => ${q}`;case v.ZodFirstPartyTypeKind.ZodLazy:return z(i.getter(),s);case v.ZodFirstPartyTypeKind.ZodLiteral:let re=Xo(i.value);return`${Z(i.description)}
32
+ ${re}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return i.values.map(He).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return z(i.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new gl(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${z(i.innerType,s)} | undefined`;case v.ZodFirstPartyTypeKind.ZodNullable:return`${z(i.innerType,s)} | null`;case v.ZodFirstPartyTypeKind.ZodDefault:return z(i.innerType,s);case v.ZodFirstPartyTypeKind.ZodCatch:return z(i.innerType,s);case v.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${z(i.type,s)}>`;case v.ZodFirstPartyTypeKind.ZodBranded:return z(i.type,s);case v.ZodFirstPartyTypeKind.ZodPipeline:return z(i.in,s);case v.ZodFirstPartyTypeKind.ZodSymbol:return`${Z(i.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${z(i.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return el(i.uri);default:M.assertNever(i)}}l(z,"sUnwrapZod");var Gg=l((t,e)=>{if(t.props.type==="none")return z(t.props.schema,e);let r=Z(t.props.schema.description),n=t.props.schema.describe(""),a=z(n,e);if(t.props.type==="variable")return oo(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(el).join(", ")}>`:"";return oo(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Jg=l(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yg=l((t,e)=>{let r=Jg(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new Ga;return new Fr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new ml;if(r==="variable"){if(n.length>0)throw new Ga;return new Fr({type:"variable",identifier:a,schema:t})}return new Fr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),Xg=typeof global=="object"&&global&&global.Object===Object&&global,Pl=Xg,Qg=typeof self=="object"&&self&&self.Object===Object&&self,eh=Pl||Qg||Function("return this")(),Ue=eh,th=Ue.Symbol,Ve=th,kl=Object.prototype,rh=kl.hasOwnProperty,nh=kl.toString,rr=Ve?Ve.toStringTag:void 0;function El(t){var e=rh.call(t,rr),r=t[rr];try{t[rr]=void 0;var n=!0}catch{}var a=nh.call(t);return n&&(e?t[rr]=r:delete t[rr]),a}l(El,"getRawTag");var ah=El,sh=Object.prototype,ih=sh.toString;function xl(t){return ih.call(t)}l(xl,"objectToString");var oh=xl,lh="[object Null]",uh="[object Undefined]",co=Ve?Ve.toStringTag:void 0;function Sl(t){return t==null?t===void 0?uh:lh:co&&co in Object(t)?ah(t):oh(t)}l(Sl,"baseGetTag");var Lt=Sl;function Ol(t){return t!=null&&typeof t=="object"}l(Ol,"isObjectLike");var Mt=Ol,ch="[object Symbol]";function Cl(t){return typeof t=="symbol"||Mt(t)&&Lt(t)==ch}l(Cl,"isSymbol");var ps=Cl;function Il(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}l(Il,"arrayMap");var dh=Il,fh=Array.isArray,$e=fh,ph=1/0,fo=Ve?Ve.prototype:void 0,po=fo?fo.toString:void 0;function gs(t){if(typeof t=="string")return t;if($e(t))return dh(t,gs)+"";if(ps(t))return po?po.call(t):"";var e=t+"";return e=="0"&&1/t==-ph?"-0":e}l(gs,"baseToString");var gh=gs;function Bl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}l(Bl,"isObject");var hs=Bl;function Zl(t){return t}l(Zl,"identity");var hh=Zl,mh="[object AsyncFunction]",yh="[object Function]",vh="[object GeneratorFunction]",_h="[object Proxy]";function Rl(t){if(!hs(t))return!1;var e=Lt(t);return e==yh||e==vh||e==mh||e==_h}l(Rl,"isFunction");var Al=Rl,Th=Ue["__core-js_shared__"],Fa=Th,go=function(){var t=/[^.]+$/.exec(Fa&&Fa.keys&&Fa.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Dl(t){return!!go&&go in t}l(Dl,"isMasked");var bh=Dl,wh=Function.prototype,Ph=wh.toString;function Ml(t){if(t!=null){try{return Ph.call(t)}catch{}try{return t+""}catch{}}return""}l(Ml,"toSource");var gt=Ml,kh=/[\\^$.*+?()[\]{}|]/g,Eh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Sh=Object.prototype,Oh=xh.toString,Ch=Sh.hasOwnProperty,Ih=RegExp("^"+Oh.call(Ch).replace(kh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Hl(t){if(!hs(t)||bh(t))return!1;var e=Al(t)?Ih:Eh;return e.test(gt(t))}l(Hl,"baseIsNative");var Bh=Hl;function jl(t,e){return t?.[e]}l(jl,"getValue");var Zh=jl;function Nl(t,e){var r=Zh(t,e);return Bh(r)?r:void 0}l(Nl,"getNative");var ht=Nl,Rh=ht(Ue,"WeakMap"),Ja=Rh,Ah=function(){try{var t=ht(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ho=Ah,Dh=9007199254740991,Mh=/^(?:0|[1-9]\d*)$/;function $l(t,e){var r=typeof t;return e=e??Dh,!!e&&(r=="number"||r!="symbol"&&Mh.test(t))&&t>-1&&t%1==0&&t<e}l($l,"isIndex");var Ul=$l;function Kl(t,e,r){e=="__proto__"&&ho?ho(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}l(Kl,"baseAssignValue");var Hh=Kl;function Fl(t,e){return t===e||t!==t&&e!==e}l(Fl,"eq");var Ll=Fl,jh=9007199254740991;function zl(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=jh}l(zl,"isLength");var ms=zl;function Wl(t){return t!=null&&ms(t.length)&&!Al(t)}l(Wl,"isArrayLike");var Nh=Wl,$h=Object.prototype;function Vl(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||$h;return t===r}l(Vl,"isPrototype");var Uh=Vl;function ql(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}l(ql,"baseTimes");var Kh=ql,Fh="[object Arguments]";function Gl(t){return Mt(t)&&Lt(t)==Fh}l(Gl,"baseIsArguments");var mo=Gl,Jl=Object.prototype,Lh=Jl.hasOwnProperty,zh=Jl.propertyIsEnumerable,Wh=mo(function(){return arguments}())?mo:function(t){return Mt(t)&&Lh.call(t,"callee")&&!zh.call(t,"callee")},Yl=Wh;function Xl(){return!1}l(Xl,"stubFalse");var Vh=Xl,Ql=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yo=Ql&&typeof module=="object"&&module&&!module.nodeType&&module,qh=yo&&yo.exports===Ql,vo=qh?Ue.Buffer:void 0,Gh=vo?vo.isBuffer:void 0,Jh=Gh||Vh,Ya=Jh,Yh="[object Arguments]",Xh="[object Array]",Qh="[object Boolean]",em="[object Date]",tm="[object Error]",rm="[object Function]",nm="[object Map]",am="[object Number]",sm="[object Object]",im="[object RegExp]",om="[object Set]",lm="[object String]",um="[object WeakMap]",cm="[object ArrayBuffer]",dm="[object DataView]",fm="[object Float32Array]",pm="[object Float64Array]",gm="[object Int8Array]",hm="[object Int16Array]",mm="[object Int32Array]",ym="[object Uint8Array]",vm="[object Uint8ClampedArray]",_m="[object Uint16Array]",Tm="[object Uint32Array]",X={};X[fm]=X[pm]=X[gm]=X[hm]=X[mm]=X[ym]=X[vm]=X[_m]=X[Tm]=!0;X[Yh]=X[Xh]=X[cm]=X[Qh]=X[dm]=X[em]=X[tm]=X[rm]=X[nm]=X[am]=X[sm]=X[im]=X[om]=X[lm]=X[um]=!1;function eu(t){return Mt(t)&&ms(t.length)&&!!X[Lt(t)]}l(eu,"baseIsTypedArray");var bm=eu;function tu(t){return function(e){return t(e)}}l(tu,"baseUnary");var wm=tu,ru=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lr=ru&&typeof module=="object"&&module&&!module.nodeType&&module,Pm=lr&&lr.exports===ru,La=Pm&&Pl.process,km=function(){try{var t=lr&&lr.require&&lr.require("util").types;return t||La&&La.binding&&La.binding("util")}catch{}}(),_o=km,To=_o&&_o.isTypedArray,Em=To?wm(To):bm,nu=Em,xm=Object.prototype,Sm=xm.hasOwnProperty;function au(t,e){var r=$e(t),n=!r&&Yl(t),a=!r&&!n&&Ya(t),s=!r&&!n&&!a&&nu(t),o=r||n||a||s,i=o?Kh(t.length,String):[],c=i.length;for(var p in t)(e||Sm.call(t,p))&&!(o&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ul(p,c)))&&i.push(p);return i}l(au,"arrayLikeKeys");var Om=au;function su(t,e){return function(r){return t(e(r))}}l(su,"overArg");var Cm=su,Im=Cm(Object.keys,Object),Bm=Im,Zm=Object.prototype,Rm=Zm.hasOwnProperty;function iu(t){if(!Uh(t))return Bm(t);var e=[];for(var r in Object(t))Rm.call(t,r)&&r!="constructor"&&e.push(r);return e}l(iu,"baseKeys");var Am=iu;function ou(t){return Nh(t)?Om(t):Am(t)}l(ou,"keys");var ys=ou,Dm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mm=/^\w*$/;function lu(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||ps(t)?!0:Mm.test(t)||!Dm.test(t)||e!=null&&t in Object(e)}l(lu,"isKey");var vs=lu,Hm=ht(Object,"create"),ur=Hm;function uu(){this.__data__=ur?ur(null):{},this.size=0}l(uu,"hashClear");var jm=uu;function cu(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}l(cu,"hashDelete");var Nm=cu,$m="__lodash_hash_undefined__",Um=Object.prototype,Km=Um.hasOwnProperty;function du(t){var e=this.__data__;if(ur){var r=e[t];return r===$m?void 0:r}return Km.call(e,t)?e[t]:void 0}l(du,"hashGet");var Fm=du,Lm=Object.prototype,zm=Lm.hasOwnProperty;function fu(t){var e=this.__data__;return ur?e[t]!==void 0:zm.call(e,t)}l(fu,"hashHas");var Wm=fu,Vm="__lodash_hash_undefined__";function pu(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ur&&e===void 0?Vm:e,this}l(pu,"hashSet");var qm=pu;function mt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(mt,"Hash");mt.prototype.clear=jm;mt.prototype.delete=Nm;mt.prototype.get=Fm;mt.prototype.has=Wm;mt.prototype.set=qm;var bo=mt;function gu(){this.__data__=[],this.size=0}l(gu,"listCacheClear");var Gm=gu;function hu(t,e){for(var r=t.length;r--;)if(Ll(t[r][0],e))return r;return-1}l(hu,"assocIndexOf");var jn=hu,Jm=Array.prototype,Ym=Jm.splice;function mu(t){var e=this.__data__,r=jn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ym.call(e,r,1),--this.size,!0}l(mu,"listCacheDelete");var Xm=mu;function yu(t){var e=this.__data__,r=jn(e,t);return r<0?void 0:e[r][1]}l(yu,"listCacheGet");var Qm=yu;function vu(t){return jn(this.__data__,t)>-1}l(vu,"listCacheHas");var ey=vu;function _u(t,e){var r=this.__data__,n=jn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}l(_u,"listCacheSet");var ty=_u;function yt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(yt,"ListCache");yt.prototype.clear=Gm;yt.prototype.delete=Xm;yt.prototype.get=Qm;yt.prototype.has=ey;yt.prototype.set=ty;var Nn=yt,ry=ht(Ue,"Map"),cr=ry;function Tu(){this.size=0,this.__data__={hash:new bo,map:new(cr||Nn),string:new bo}}l(Tu,"mapCacheClear");var ny=Tu;function bu(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}l(bu,"isKeyable");var ay=bu;function wu(t,e){var r=t.__data__;return ay(e)?r[typeof e=="string"?"string":"hash"]:r.map}l(wu,"getMapData");var $n=wu;function Pu(t){var e=$n(this,t).delete(t);return this.size-=e?1:0,e}l(Pu,"mapCacheDelete");var sy=Pu;function ku(t){return $n(this,t).get(t)}l(ku,"mapCacheGet");var iy=ku;function Eu(t){return $n(this,t).has(t)}l(Eu,"mapCacheHas");var oy=Eu;function xu(t,e){var r=$n(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}l(xu,"mapCacheSet");var ly=xu;function vt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}l(vt,"MapCache");vt.prototype.clear=ny;vt.prototype.delete=sy;vt.prototype.get=iy;vt.prototype.has=oy;vt.prototype.set=ly;var Un=vt,uy="Expected a function";function Kn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(uy);var r=l(function(){var n=arguments,a=e?e.apply(this,n):n[0],s=r.cache;if(s.has(a))return s.get(a);var o=t.apply(this,n);return r.cache=s.set(a,o)||s,o},"memoized");return r.cache=new(Kn.Cache||Un),r}l(Kn,"memoize");Kn.Cache=Un;var cy=Kn,dy=500;function Su(t){var e=cy(t,function(n){return r.size===dy&&r.clear(),n}),r=e.cache;return e}l(Su,"memoizeCapped");var fy=Su,py=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gy=/\\(\\)?/g,hy=fy(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(py,function(r,n,a,s){e.push(a?s.replace(gy,"$1"):n||r)}),e}),my=hy;function Ou(t){return t==null?"":gh(t)}l(Ou,"toString");var yy=Ou;function Cu(t,e){return $e(t)?t:vs(t,e)?[t]:my(yy(t))}l(Cu,"castPath");var Iu=Cu,vy=1/0;function Bu(t){if(typeof t=="string"||ps(t))return t;var e=t+"";return e=="0"&&1/t==-vy?"-0":e}l(Bu,"toKey");var Fn=Bu;function Zu(t,e){e=Iu(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Fn(e[r++])];return r&&r==n?t:void 0}l(Zu,"baseGet");var Ru=Zu;function Au(t,e,r){var n=t==null?void 0:Ru(t,e);return n===void 0?r:n}l(Au,"get");var _y=Au;function Du(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}l(Du,"arrayPush");var Ty=Du;function Mu(){this.__data__=new Nn,this.size=0}l(Mu,"stackClear");var by=Mu;function Hu(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}l(Hu,"stackDelete");var wy=Hu;function ju(t){return this.__data__.get(t)}l(ju,"stackGet");var Py=ju;function Nu(t){return this.__data__.has(t)}l(Nu,"stackHas");var ky=Nu,Ey=200;function $u(t,e){var r=this.__data__;if(r instanceof Nn){var n=r.__data__;if(!cr||n.length<Ey-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Un(n)}return r.set(t,e),this.size=r.size,this}l($u,"stackSet");var xy=$u;function _t(t){var e=this.__data__=new Nn(t);this.size=e.size}l(_t,"Stack");_t.prototype.clear=by;_t.prototype.delete=wy;_t.prototype.get=Py;_t.prototype.has=ky;_t.prototype.set=xy;var Lr=_t;function Uu(t,e){for(var r=-1,n=t==null?0:t.length,a=0,s=[];++r<n;){var o=t[r];e(o,r,t)&&(s[a++]=o)}return s}l(Uu,"arrayFilter");var Sy=Uu;function Ku(){return[]}l(Ku,"stubArray");var Oy=Ku,Cy=Object.prototype,Iy=Cy.propertyIsEnumerable,wo=Object.getOwnPropertySymbols,By=wo?function(t){return t==null?[]:(t=Object(t),Sy(wo(t),function(e){return Iy.call(t,e)}))}:Oy,Zy=By;function Fu(t,e,r){var n=e(t);return $e(t)?n:Ty(n,r(t))}l(Fu,"baseGetAllKeys");var Ry=Fu;function Lu(t){return Ry(t,ys,Zy)}l(Lu,"getAllKeys");var Po=Lu,Ay=ht(Ue,"DataView"),Xa=Ay,Dy=ht(Ue,"Promise"),Qa=Dy,My=ht(Ue,"Set"),es=My,ko="[object Map]",Hy="[object Object]",Eo="[object Promise]",xo="[object Set]",So="[object WeakMap]",Oo="[object DataView]",jy=gt(Xa),Ny=gt(cr),$y=gt(Qa),Uy=gt(es),Ky=gt(Ja),it=Lt;(Xa&&it(new Xa(new ArrayBuffer(1)))!=Oo||cr&&it(new cr)!=ko||Qa&&it(Qa.resolve())!=Eo||es&&it(new es)!=xo||Ja&&it(new Ja)!=So)&&(it=l(function(t){var e=Lt(t),r=e==Hy?t.constructor:void 0,n=r?gt(r):"";if(n)switch(n){case jy:return Oo;case Ny:return ko;case $y:return Eo;case Uy:return xo;case Ky:return So}return e},"getTag"));var Co=it,Fy=Ue.Uint8Array,Io=Fy,Ly="__lodash_hash_undefined__";function zu(t){return this.__data__.set(t,Ly),this}l(zu,"setCacheAdd");var zy=zu;function Wu(t){return this.__data__.has(t)}l(Wu,"setCacheHas");var Wy=Wu;function dr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Un;++e<r;)this.add(t[e])}l(dr,"SetCache");dr.prototype.add=dr.prototype.push=zy;dr.prototype.has=Wy;var Vy=dr;function Vu(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}l(Vu,"arraySome");var qy=Vu;function qu(t,e){return t.has(e)}l(qu,"cacheHas");var Gy=qu,Jy=1,Yy=2;function Gu(t,e,r,n,a,s){var o=r&Jy,i=t.length,c=e.length;if(i!=c&&!(o&&c>i))return!1;var p=s.get(t),m=s.get(e);if(p&&m)return p==e&&m==t;var T=-1,C=!0,k=r&Yy?new Vy:void 0;for(s.set(t,e),s.set(e,t);++T<i;){var S=t[T],W=e[T];if(n)var q=o?n(W,S,T,e,t,s):n(S,W,T,t,e,s);if(q!==void 0){if(q)continue;C=!1;break}if(k){if(!qy(e,function(re,J){if(!Gy(k,J)&&(S===re||a(S,re,r,n,s)))return k.push(J)})){C=!1;break}}else if(!(S===W||a(S,W,r,n,s))){C=!1;break}}return s.delete(t),s.delete(e),C}l(Gu,"equalArrays");var Ju=Gu;function Yu(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}l(Yu,"mapToArray");var Xy=Yu;function Xu(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}l(Xu,"setToArray");var Qy=Xu,ev=1,tv=2,rv="[object Boolean]",nv="[object Date]",av="[object Error]",sv="[object Map]",iv="[object Number]",ov="[object RegExp]",lv="[object Set]",uv="[object String]",cv="[object Symbol]",dv="[object ArrayBuffer]",fv="[object DataView]",Bo=Ve?Ve.prototype:void 0,za=Bo?Bo.valueOf:void 0;function Qu(t,e,r,n,a,s,o){switch(r){case fv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case dv:return!(t.byteLength!=e.byteLength||!s(new Io(t),new Io(e)));case rv:case nv:case iv:return Ll(+t,+e);case av:return t.name==e.name&&t.message==e.message;case ov:case uv:return t==e+"";case sv:var i=Xy;case lv:var c=n&ev;if(i||(i=Qy),t.size!=e.size&&!c)return!1;var p=o.get(t);if(p)return p==e;n|=tv,o.set(t,e);var m=Ju(i(t),i(e),n,a,s,o);return o.delete(t),m;case cv:if(za)return za.call(t)==za.call(e)}return!1}l(Qu,"equalByTag");var pv=Qu,gv=1,hv=Object.prototype,mv=hv.hasOwnProperty;function ec(t,e,r,n,a,s){var o=r&gv,i=Po(t),c=i.length,p=Po(e),m=p.length;if(c!=m&&!o)return!1;for(var T=c;T--;){var C=i[T];if(!(o?C in e:mv.call(e,C)))return!1}var k=s.get(t),S=s.get(e);if(k&&S)return k==e&&S==t;var W=!0;s.set(t,e),s.set(e,t);for(var q=o;++T<c;){C=i[T];var re=t[C],J=e[C];if(n)var N=o?n(J,re,C,e,t,s):n(re,J,C,t,e,s);if(!(N===void 0?re===J||a(re,J,r,n,s):N)){W=!1;break}q||(q=C=="constructor")}if(W&&!q){var F=t.constructor,ue=e.constructor;F!=ue&&"constructor"in t&&"constructor"in e&&!(typeof F=="function"&&F instanceof F&&typeof ue=="function"&&ue instanceof ue)&&(W=!1)}return s.delete(t),s.delete(e),W}l(ec,"equalObjects");var yv=ec,vv=1,Zo="[object Arguments]",Ro="[object Array]",Kr="[object Object]",_v=Object.prototype,Ao=_v.hasOwnProperty;function tc(t,e,r,n,a,s){var o=$e(t),i=$e(e),c=o?Ro:Co(t),p=i?Ro:Co(e);c=c==Zo?Kr:c,p=p==Zo?Kr:p;var m=c==Kr,T=p==Kr,C=c==p;if(C&&Ya(t)){if(!Ya(e))return!1;o=!0,m=!1}if(C&&!m)return s||(s=new Lr),o||nu(t)?Ju(t,e,r,n,a,s):pv(t,e,c,r,n,a,s);if(!(r&vv)){var k=m&&Ao.call(t,"__wrapped__"),S=T&&Ao.call(e,"__wrapped__");if(k||S){var W=k?t.value():t,q=S?e.value():e;return s||(s=new Lr),a(W,q,r,n,s)}}return C?(s||(s=new Lr),yv(t,e,r,n,a,s)):!1}l(tc,"baseIsEqualDeep");var Tv=tc;function _s(t,e,r,n,a){return t===e?!0:t==null||e==null||!Mt(t)&&!Mt(e)?t!==t&&e!==e:Tv(t,e,r,n,_s,a)}l(_s,"baseIsEqual");var Ts=_s,bv=1,wv=2;function rc(t,e,r,n){var a=r.length,s=a,o=!n;if(t==null)return!s;for(t=Object(t);a--;){var i=r[a];if(o&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++a<s;){i=r[a];var c=i[0],p=t[c],m=i[1];if(o&&i[2]){if(p===void 0&&!(c in t))return!1}else{var T=new Lr;if(n)var C=n(p,m,c,t,e,T);if(!(C===void 0?Ts(m,p,bv|wv,n,T):C))return!1}}return!0}l(rc,"baseIsMatch");var Pv=rc;function nc(t){return t===t&&!hs(t)}l(nc,"isStrictComparable");var ac=nc;function sc(t){for(var e=ys(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,ac(a)]}return e}l(sc,"getMatchData");var kv=sc;function ic(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}l(ic,"matchesStrictComparable");var oc=ic;function lc(t){var e=kv(t);return e.length==1&&e[0][2]?oc(e[0][0],e[0][1]):function(r){return r===t||Pv(r,t,e)}}l(lc,"baseMatches");var Ev=lc;function uc(t,e){return t!=null&&e in Object(t)}l(uc,"baseHasIn");var xv=uc;function cc(t,e,r){e=Iu(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var o=Fn(e[n]);if(!(s=t!=null&&r(t,o)))break;t=t[o]}return s||++n!=a?s:(a=t==null?0:t.length,!!a&&ms(a)&&Ul(o,a)&&($e(t)||Yl(t)))}l(cc,"hasPath");var Sv=cc;function dc(t,e){return t!=null&&Sv(t,e,xv)}l(dc,"hasIn");var Ov=dc,Cv=1,Iv=2;function fc(t,e){return vs(t)&&ac(e)?oc(Fn(t),e):function(r){var n=_y(r,t);return n===void 0&&n===e?Ov(r,t):Ts(e,n,Cv|Iv)}}l(fc,"baseMatchesProperty");var Bv=fc;function pc(t){return function(e){return e?.[t]}}l(pc,"baseProperty");var Zv=pc;function gc(t){return function(e){return Ru(e,t)}}l(gc,"basePropertyDeep");var Rv=gc;function hc(t){return vs(t)?Zv(Fn(t)):Rv(t)}l(hc,"property");var Av=hc;function mc(t){return typeof t=="function"?t:t==null?hh:typeof t=="object"?$e(t)?Bv(t[0],t[1]):Ev(t):Av(t)}l(mc,"baseIteratee");var Dv=mc;function yc(t){return function(e,r,n){for(var a=-1,s=Object(e),o=n(e),i=o.length;i--;){var c=o[t?i:++a];if(r(s[c],c,s)===!1)break}return e}}l(yc,"createBaseFor");var Mv=yc,Hv=Mv(),jv=Hv;function vc(t,e){return t&&jv(t,e,ys)}l(vc,"baseForOwn");var Nv=vc;function _c(t,e){return Ts(t,e)}l(_c,"isEqual");var ct=_c;function Tc(t,e){var r={};return e=Dv(e,3),Nv(t,function(n,a,s){Hh(r,a,e(n,a,s))}),r}l(Tc,"mapValues");var $v=Tc;function bs(t){return se(t)}l(bs,"toTypescriptSchema");function se(t){let r=t._def;switch(r.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(r.description)}z.string()`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:return`${Z(r.description)}z.number()`.trim();case v.ZodFirstPartyTypeKind.ZodNaN:return`${Z(r.description)}z.nan()`.trim();case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(r.description)}z.bigint()`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)}z.boolean()`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(r.description)}z.date()`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(r.description)}z.undefined()`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(r.description)}z.null()`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(r.description)}z.any()`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(r.description)}z.unknown()`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(r.description)}z.never()`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(r.description)}z.void()`.trim();case v.ZodFirstPartyTypeKind.ZodArray:return`z.array(${se(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=$v(r.shape(),ue=>ue instanceof v.Schema?se(ue):"z.any()");return[`${Z(r.description)}z.object({`,...Object.entries(n).map(([ue,Le])=>` ${ue}: ${Le},`),"})"].join(`
33
+ `).trim();case v.ZodFirstPartyTypeKind.ZodUnion:let a=r.options.map(se);return`${Z(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(se),o=He(r.discriminator);return`${Z(r.description)}z.discriminatedUnion(${o}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let i=se(r.left),c=se(r.right);return`${Z(r.description)}z.intersection(${i}, ${c})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(se);return`${Z(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let m=se(r.keyType),T=se(r.valueType);return`${Z(r.description)}z.record(${m}, ${T})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let C=se(r.keyType),k=se(r.valueType);return`${Z(r.description)}z.map(${C}, ${k})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${Z(r.description)}z.set(${se(r.valueType)})`.trim();case v.ZodFirstPartyTypeKind.ZodFunction:let S=r.args.items.map(se),W=S.length?`.args(${S.join(", ")})`:"",q=se(r.returns);return`${Z(r.description)}z.function()${W}.returns(${q})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${Z(r.description)}z.lazy(() => ${se(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let re=He(r.value);return`${Z(r.description)}z.literal(${re})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let J=r.values.map(He);return`${Z(r.description)}z.enum([${J.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new st(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new st(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${Z(r.description)}z.optional(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${Z(r.description)}z.nullable(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let N=Qo(r.defaultValue());return`${Z(r.description)}${se(r.innerType)}.default(${N})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new st(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${Z(r.description)}z.promise(${se(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new st(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new st(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new st(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${Z(r.description)}z.readonly(${se(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let F=He(r.uri);return`${Z(r.description)}z.ref(${F})`.trim();default:M.assertNever(r)}}l(se,"sUnwrapZod");var bc=class{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};l(bc,"ParseInputLazyPath");var xe=bc,Do=l((t,e)=>{if(jt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Be(t.common.issues);return this._error=r,this._error}}},"handleResult"),wc=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}dereference(e){return this}getReferences(){return[]}_getType(e){return Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(pr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let a={common:{issues:[],async:(n=r?.async)!=null?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},s=this._parseSync({data:e,path:a.path,parent:a});return Do(a,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(pr(a)?a:Promise.resolve(a));return Do(n,s)}refine(e,r){let n=l(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let o=e(a),i=l(()=>s.addIssue(d({code:_.custom},n(a))),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Je({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return je.create(this,this._def)}nullable(){return dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this,this._def)}promise(){return vr.create(this,this._def)}or(e){return na.create([this,e],this._def)}and(e){return Gn.create(this,e,this._def)}transform(e){return new Je(h(d({},R(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new mr(h(d({},R(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Wn(d({typeName:"ZodBranded",type:this},R(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Vn(h(d({},R(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.constructor;return new r(h(d({},this._def),{description:e}))}pipe(e){return ta.create(this,e)}readonly(){return _r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){for(let[r,n]of Object.entries(e))this._def[K]=h(d({},this._def[K]),{[r]:n});return this}getMetadata(){return d({},this._def[K])}setMetadata(e){this._def[K]=d({},e)}get ui(){let e=this._getMetadataRoot();return d({},e._def[K])}_setZuiMeta(e,r){let n=this._getMetadataRoot();n._def[K]=h(d({},n._def[K]),{[e]:r})}_getMetadataRoot(){let e=this._def;switch(e.typeName){case"ZodNullable":case"ZodDefault":case"ZodOptional":case"ZodReadonly":return e.innerType;case"ZodEffects":return e.schema;default:return this}}displayAs(e){var r,n,a;return(a=(r=this._def)[n=K])!=null||(r[n]={}),this._def[K].displayAs=[e.id,e.params],this}title(e){return this._setZuiMeta("title",e),this}hidden(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("hidden",r),this}disabled(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("disabled",r),this}placeholder(e){return this._setZuiMeta("placeholder",e),this}toJsonSchema(e){return aa(this,e)}toTypescript(e){return Qr(this,e)}toTypescriptSchema(){return bs(this)}async toTypescriptAsync(e){let r=Qr(this,h(d({},e),{formatter:void 0}));return e?.formatter&&(r=await e.formatter(r)),r}static fromObject(e,r){return Ut(e,r)}static fromJsonSchema(e){return Tr(e)}};l(wc,"ZodType");var D=wc,ws=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(ws||{}),M;(t=>{t.assertEqual=l(a=>a,"assertEqual");function e(a){}t.assertIs=e,l(e,"assertIs");function r(a){throw new Error("assertNever called")}t.assertNever=r,l(r,"assertNever"),t.arrayToEnum=l(a=>{let s={};for(let o of a)s[o]=o;return s},"arrayToEnum"),t.getValidEnumValues=l(a=>{let s=(0,t.objectKeys)(a).filter(i=>typeof a[a[i]]!="number"),o={};for(let i of s)o[i]=a[i];return(0,t.objectValues)(o)},"getValidEnumValues"),t.objectValues=l(a=>(0,t.objectKeys)(a).map(function(s){return a[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let o in a)Object.prototype.hasOwnProperty.call(a,o)&&s.push(o);return s},t.find=l((a,s)=>{for(let o of a)if(s(o))return o},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=n,l(n,"joinValues"),t.jsonStringifyReplacer=l((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=l((a,s)=>a.toString()===s.toString(),"compareFunctions")})(M||(M={}));var en;(t=>{t.mergeShapes=l((e,r)=>d(d({},e),r),"mergeShapes")})(en||(en={}));var P=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=l(t=>{switch(typeof t){case"undefined":return P.undefined;case"string":return P.string;case"number":return isNaN(t)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(t)?P.array:t===null?P.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?P.promise:typeof Map<"u"&&t instanceof Map?P.map:typeof Set<"u"&&t instanceof Set?P.set:typeof Date<"u"&&t instanceof Date?P.date:P.object;default:return P.unknown}},"getParsedType");function R(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[K]:t?.[K]}:{errorMap:l((o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:r??i.defaultError},"customMap"),description:a,[K]:t?.[K]}}l(R,"processCreateParams");var Ps=l((t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===P.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,M.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(t.options)}, received '${t.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:M.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;case _.unresolved_reference:r="Unresolved reference";break;default:r=e.defaultError,M.assertNever(t)}return{message:r}},"errorMap"),Mo=Ps,_=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite","unresolved_reference"]),Pc=l(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),tn=class kc extends Error{constructor(e){super(),this.issues=[],this.addIssue=l(n=>{this.issues=[...this.issues,n]},"addIssue"),this.addIssues=l((n=[])=>{this.issues=[...this.issues,...n]},"addIssues");let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},a=l(s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,c=0;for(;c<o.path.length;){let p=o.path[c];c===o.path.length-1?(i[p]=i[p]||{_errors:[]},i[p]._errors.push(r(o))):i[p]=i[p]||{_errors:[]},i=i[p],c++}}},"processError");return a(this),n}static assert(e){if(!(e instanceof kc))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};l(tn,"ZodError");tn.create=l(t=>new tn(t),"create");var Be=tn,Ec=Ps;function ks(t){Ec=t}l(ks,"setErrorMap");function Ht(){return Ec}l(Ht,"getErrorMap");var fr=l(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,o=[...n,...s.path||[]],i=h(d({},s),{path:o}),c="",p=a.filter(m=>!!m).slice().reverse();for(let m of p)c=m(i,{data:r,defaultError:c}).message;return h(d({},s),{path:o,message:(e=s.message)!=null?e:c})},"makeIssue"),xc=[];function w(t,e){let r=fr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ht(),Ps].filter(n=>!!n)});t.common.issues.push(r)}l(w,"addIssueToContext");var Sc=class Oc{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return I;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return Oc.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:o}=a;if(s.status==="aborted"||o.status==="aborted")return I;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}};l(Sc,"ParseStatus");var ve=Sc,I=Object.freeze({status:"aborted"}),ut=l(t=>({status:"dirty",value:t}),"DIRTY"),pe=l(t=>({status:"valid",value:t}),"OK"),rn=l(t=>t.status==="aborted","isAborted"),nn=l(t=>t.status==="dirty","isDirty"),jt=l(t=>t.status==="valid","isValid"),pr=l(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),O;(t=>{t.errToObj=l(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=l(e=>typeof e=="string"?e:e?.message,"toString")})(O||(O={}));var an=class Cc extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Cc}};l(an,"ZodAny");an.create=l(t=>new an(d({typeName:"ZodAny"},R(t))),"create");var gr=an,sn=class Ct extends D{dereference(e){return new Ct(h(d({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}isEqual(e){var r,n,a,s,o,i;return e instanceof Ct?ct((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&ct((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&ct((o=this._def.minLength)==null?void 0:o.value,(i=e._def.minLength)==null?void 0:i.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==P.array)return w(r,{code:_.invalid_type,expected:P.array,received:r.parsedType}),I;if(a.exactLength!==null){let o=r.data.length>a.exactLength.value,i=r.data.length<a.exactLength.value;(o||i)&&(w(r,{code:o?_.too_big:_.too_small,minimum:i?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(w(r,{code:_.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(w(r,{code:_.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>a.type._parseAsync(new xe(r,o,r.path,i)))).then(o=>ve.mergeArray(n,o));let s=[...r.data].map((o,i)=>a.type._parseSync(new xe(r,o,r.path,i)));return ve.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ct(h(d({},this._def),{minLength:{value:e,message:O.toString(r)}}))}max(e,r){return new Ct(h(d({},this._def),{maxLength:{value:e,message:O.toString(r)}}))}length(e,r){return new Ct(h(d({},this._def),{exactLength:{value:e,message:O.toString(r)}}))}nonempty(e){return this.min(1,e)}};l(sn,"ZodArray");sn.create=l((t,e)=>new sn(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},R(e))),"create");var Nt=sn,Uv={compare:ct},Ic=class{constructor(e=[],r={}){this._options=d(d({},Uv),r),this._items=[];for(let n of e)this.add(n)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(r=>this._options.compare(r,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(r=>e.has(r))}};l(Ic,"CustomSet");var le=Ic,on=class zr extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==P.bigint){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.bigint,received:s.parsedType}),I}let n,a=new ve;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof zr)||this._def.coerce!==e._def.coerce)return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new zr(h(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new zr(h(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};l(on,"ZodBigInt");on.create=l(t=>{var e;return new on(d({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},R(t)))},"create");var Ln=on,ln=class Bc extends D{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==P.boolean){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.boolean,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Bc?this._def.coerce===e._def.coerce:!1}};l(ln,"ZodBoolean");ln.create=l(t=>new ln(d({typeName:"ZodBoolean",coerce:t?.coerce||!1},R(t))),"create");var zn=ln,Zc=Symbol("zod_brand"),Rc=class Ac extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}isEqual(e){return e instanceof Ac?this._def.type.isEqual(e._def.type):!1}};l(Rc,"ZodBranded");var Wn=Rc,un=class Dc extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=h(d({},r),{common:h(d({},r.common),{issues:[]})}),a=this._def.innerType._parse({data:n.data,path:n.path,parent:d({},n)});return pr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Dc?this._def.innerType.isEqual(e._def.innerType)&&M.compareFunctions(this._def.catchValue,e._def.catchValue):!1}};l(un,"ZodCatch");un.create=l((t,e)=>new un(d({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},R(e))),"create");var Vn=un,Es=l((t,e={},r)=>t?gr.create().superRefine((n,a)=>{var s,o;if(!t(n)){let i=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(s=i.fatal)!=null?s:r)!=null?o:!0,p=typeof i=="string"?{message:i}:i;a.addIssue(h(d({code:"custom"},p),{fatal:c}))}}):gr.create(),"custom"),cn=class ts extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.date,received:s.parsedType}),I}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_date}),I}let n=new ve,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:_.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:_.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):M.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ts(h(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof ts))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)&&this._def.coerce===e._def.coerce}};l(cn,"ZodDate");cn.create=l(t=>new cn(d({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},R(t))),"create");var qn=cn,dn=class rs extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}dereference(e){return new rs(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof rs?this._def.innerType.isEqual(e._def.innerType)&&ct(this._def.defaultValue(),e._def.defaultValue()):!1}};l(dn,"ZodDefault");dn.create=l((t,e,r)=>new dn(d({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},R(r))),"create");var mr=dn,Ke=l(t=>Array.from(new Set(t)),"unique"),De=l(t=>t instanceof Jn?De(t.schema):t instanceof Je?De(t.innerType()):t instanceof Yn?[t.value]:t instanceof Tt?t.options:t instanceof Xn?M.objectValues(t.enum):t instanceof mr?De(t._def.innerType):t instanceof ra?[void 0]:t instanceof Qn?[null]:t instanceof je?[void 0,...De(t.unwrap())]:t instanceof dt?[null,...De(t.unwrap())]:t instanceof Wn||t instanceof _r?De(t.unwrap()):t instanceof Vn?De(t._def.innerType):[],"getDiscriminator"),Mc=class It extends D{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=It._getOptionsMap(this.discriminator,r);return new It(h(d({},this._def),{options:r,optionsMap:n}))}getReferences(){return Ke(this.options.flatMap(e=>e.getReferences()))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return w(r,{code:_.invalid_type,expected:P.object,received:r.parsedType}),I;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=It._getOptionsMap(e,r);return new It(d({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},R(n)))}static _getOptionsMap(e,r){let n=new Map;for(let a of r){let s=De(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return n}isEqual(e){if(!(e instanceof It)||this._def.discriminator!==e._def.discriminator)return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le(this._def.options,{compare:r}),a=new le(e._def.options,{compare:r});return n.isEqual(a)}};l(Mc,"ZodDiscriminatedUnion");var xs=Mc;function yr(t,e){return new Tt(d({values:t,typeName:"ZodEnum"},R(e)))}l(yr,"createZodEnum");var Ss=class Wr extends D{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{expected:M.joinValues(n),received:r.parsedType,code:_.invalid_type}),I}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{received:r.data,code:_.invalid_enum_value,options:n}),I}return pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Wr.create(e,d(d({},this._def),r))}exclude(e,r=this._def){return Wr.create(this.options.filter(n=>!e.includes(n)),d(d({},this._def),r))}isEqual(e){if(!(e instanceof Wr))return!1;let r=new le(this._def.values),n=new le(e._def.values);return r.isEqual(n)}};l(Ss,"ZodEnum");Ss.create=yr;var Tt=Ss,Hc=class Bt extends D{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new Bt(h(d({},this._def),{args:r,returns:n}))}getReferences(){return Ke([...this._def.args.getReferences(),...this._def.returns.getReferences()])}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==P.function)return w(r,{code:_.invalid_type,expected:P.function,received:r.parsedType}),I;function n(i,c){return fr({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ht(),Mo].filter(p=>!!p),issueData:{code:_.invalid_arguments,argumentsError:c}})}l(n,"makeArgsIssue");function a(i,c){return fr({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ht(),Mo].filter(p=>!!p),issueData:{code:_.invalid_return_type,returnTypeError:c}})}l(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof vr){let i=this;return pe(async function(...c){let p=new Be([]),m=await i._def.args.parseAsync(c,s).catch(k=>{throw p.addIssue(n(c,k)),p}),T=await Reflect.apply(o,this,m);return await i._def.returns._def.type.parseAsync(T,s).catch(k=>{throw p.addIssue(a(T,k)),p})})}else{let i=this;return pe(function(...c){let p=i._def.args.safeParse(c,s);if(!p.success)throw new Be([n(c,p.error)]);let m=Reflect.apply(o,this,p.data),T=i._def.returns.safeParse(m,s);if(!T.success)throw new Be([a(m,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Bt(h(d({},this._def),{args:pt.create(e).rest(At.create())}))}returns(e){return new Bt(h(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Bt(d({args:e||pt.create([]).rest(At.create()),returns:r||At.create(),typeName:"ZodFunction"},R(n)))}isEqual(e){return e instanceof Bt&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};l(Hc,"ZodFunction");var Os=Hc;function fn(t,e){let r=Me(t),n=Me(e);if(t===e)return{valid:!0,data:t};if(r===P.object&&n===P.object){let a=M.objectKeys(e),s=M.objectKeys(t).filter(i=>a.indexOf(i)!==-1),o=d(d({},t),e);for(let i of s){let c=fn(t[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(r===P.array&&n===P.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let o=t[s],i=e[s],c=fn(o,i);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===P.date&&n===P.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}l(fn,"mergeValues");var pn=class ns extends D{dereference(e){return new ns(h(d({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Ke([...this._def.left.getReferences(),...this._def.right.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=l((s,o)=>{if(rn(s)||rn(o))return I;let i=fn(s.value,o.value);return i.valid?((nn(s)||nn(o))&&r.dirty(),{status:r.value,value:i.data}):(w(n,{code:_.invalid_intersection_types}),I)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>a(s,o)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}isEqual(e){if(!(e instanceof ns))return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le([this._def.left,this._def.right],{compare:r}),a=new le([e._def.left,e._def.right],{compare:r});return n.isEqual(a)}};l(pn,"ZodIntersection");pn.create=l((t,e,r)=>new pn(d({left:t,right:e,typeName:"ZodIntersection"},R(r))),"create");var Gn=pn,gn=class jc extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}isEqual(e){return e instanceof jc?this._def.getter().isEqual(e._def.getter()):!1}};l(gn,"ZodLazy");gn.create=l((t,e)=>new gn(d({getter:t,typeName:"ZodLazy"},R(e))),"create");var Jn=gn,hn=class Nc extends D{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return w(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Nc?ct(this._def.value,e._def.value):!1}};l(hn,"ZodLiteral");hn.create=l((t,e)=>new hn(d({value:t,typeName:"ZodLiteral"},R(e))),"create");var Yn=hn,mn=class as extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new as(h(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Ke([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.map)return w(n,{code:_.invalid_type,expected:P.map,received:n.parsedType}),I;let a=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,c],p)=>({key:a._parse(new xe(n,i,n.path,[p,"key"])),value:s._parse(new xe(n,c,n.path,[p,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let p=await c.key,m=await c.value;if(p.status==="aborted"||m.status==="aborted")return I;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),i.set(p.value,m.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let c of o){let p=c.key,m=c.value;if(p.status==="aborted"||m.status==="aborted")return I;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),i.set(p.value,m.value)}return{status:r.value,value:i}}}isEqual(e){return!(!(e instanceof as)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(mn,"ZodMap");mn.create=l((t,e,r)=>new mn(d({valueType:e,keyType:t,typeName:"ZodMap"},R(r))),"create");var Cs=mn,yn=class $c extends D{_parse(e){if(this._getType(e)!==P.nan){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.nan,received:n.parsedType}),I}return{status:"valid",value:e.data}}isEqual(e){return e instanceof $c}};l(yn,"ZodNaN");yn.create=l(t=>new yn(d({typeName:"ZodNaN"},R(t))),"create");var Is=yn,vn=class Uc extends D{_parse(e){let r=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==P.string&&n.parsedType!==P.number){let a=M.objectValues(r);return w(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),I}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return w(n,{received:n.data,code:_.invalid_enum_value,options:a}),I}return pe(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Uc?ct(this._def.values,e._def.values):!1}};l(vn,"ZodNativeEnum");vn.create=l((t,e)=>new vn(d({values:t,typeName:"ZodNativeEnum"},R(e))),"create");var Xn=vn,_n=class Kc extends D{_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.invalid_type,expected:P.never,received:r.parsedType}),I}isEqual(e){return e instanceof Kc}};l(_n,"ZodNever");_n.create=l(t=>new _n(d({typeName:"ZodNever"},R(t))),"create");var qe=_n,Tn=class Fc extends D{_parse(e){if(this._getType(e)!==P.null){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.null,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Fc}};l(Tn,"ZodNull");Tn.create=l(t=>new Tn(d({typeName:"ZodNull"},R(t))),"create");var Qn=Tn,bn=class ss extends D{dereference(e){return new ss(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===P.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ss?this._def.innerType.isEqual(e._def.innerType):!1}};l(bn,"ZodNullable");bn.create=l((t,e)=>new bn(d({innerType:t,typeName:"ZodNullable"},R(e))),"create");var dt=bn;function Lc(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(t.toFixed(a).replace(".","")),o=parseInt(e.toFixed(a).replace(".",""));return s%o/Math.pow(10,a)}l(Lc,"floatSafeRemainder");var wn=class Vr extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==P.number){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.number,received:s.parsedType}),I}let n,a=new ve;for(let s of this._def.checks)s.kind==="int"?M.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:_.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Lc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),w(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:_.not_finite,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new Vr(h(d({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new Vr(h(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&M.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof Vr))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}};l(wn,"ZodNumber");wn.create=l(t=>new wn(d({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},R(t))),"create");var ea=wn;function lt(t){if(t instanceof ft){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=je.create(lt(n))}return new ft(h(d({},t._def),{shape:l(()=>e,"shape")}))}else return t instanceof Nt?new Nt(h(d({},t._def),{type:lt(t.element)})):t instanceof je?je.create(lt(t.unwrap())):t instanceof dt?dt.create(lt(t.unwrap())):t instanceof pt?pt.create(t.items.map(e=>lt(e))):t}l(lt,"deepPartialify");var Ge=class Ee extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=M.objectKeys(e);return this._cached={shape:e,keys:r}}dereference(e){let r=this._def.shape(),n={};for(let a in r)n[a]=r[a].dereference(e);return new Ee(h(d({},this._def),{shape:l(()=>n,"shape")}))}getReferences(){let e=this._def.shape(),r=[];for(let n in e)r.push(...e[n].getReferences());return Ke(r)}_parse(e){if(this._getType(e)!==P.object){let p=this._getOrReturnCtx(e);return w(p,{code:_.invalid_type,expected:P.object,received:p.parsedType}),I}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof qe&&this._def.unknownKeys==="strip"))for(let p in a.data)o.includes(p)||i.push(p);let c=[];for(let p of o){let m=s[p],T=a.data[p];c.push({key:{status:"valid",value:p},value:m._parse(new xe(a,T,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qe){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of i)c.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(p==="strict")i.length>0&&(w(a,{code:_.unrecognized_keys,keys:i}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let m of i){let T=a.data[m];c.push({key:{status:"valid",value:m},value:p._parse(new xe(a,T,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of c){let T=await m.key;p.push({key:T,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>ve.mergeObjectSync(n,p)):ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new Ee(d(h(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:l((r,n)=>{var a,s,o,i;let c=(o=(s=(a=this._def).errorMap)==null?void 0:s.call(a,r,n).message)!=null?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(i=O.errToObj(e).message)!=null?i:c}:{message:c}},"errorMap")}:{}))}strip(){return new Ee(h(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new Ee(h(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new Ee(h(d({},this._def),{shape:l(()=>d(d({},this._def.shape()),e),"shape")}))}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:l(()=>d(d({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ee(h(d({},this._def),{catchall:e}))}pick(e){let r={};return M.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}omit(e){let r={};return M.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}deepPartial(){return lt(this)}partial(e){let r={};return M.objectKeys(this.shape).forEach(n=>{let a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a?.optional()}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}required(e){let r={};return M.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof je;)s=s._def.innerType;r[n]=s}}),new Ee(h(d({},this._def),{shape:l(()=>r,"shape")}))}keyof(){return yr(M.objectKeys(this.shape))}isEqual(e){if(!(e instanceof Ee)||!this._def.catchall.isEqual(e._def.catchall)||this._def.unknownKeys!==e._def.unknownKeys)return!1;let r=this._def.shape(),n=e._def.shape(),a=l((i,c)=>i[0]===c[0]&&i[1].isEqual(c[1]),"compare"),s=new le(Object.entries(r),{compare:a}),o=new le(Object.entries(n),{compare:a});return s.isEqual(o)}};l(Ge,"ZodObject");Ge.create=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},R(e))),"create");Ge.strictCreate=l((t,e)=>new Ge(d({shape:l(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},R(e))),"strictCreate");Ge.lazycreate=l((t,e)=>new Ge(d({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},R(e))),"lazycreate");var ft=Ge,Pn=class is extends D{dereference(e){return new is(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===P.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof is?this._def.innerType.isEqual(e._def.innerType):!1}};l(Pn,"ZodOptional");Pn.create=l((t,e)=>new Pn(d({innerType:t,typeName:"ZodOptional"},R(e))),"create");var je=Pn,zc=class qr extends D{dereference(e){return new qr(h(d({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Ke([...this._def.in.getReferences(),...this._def.out.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return l(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?I:s.status==="dirty"?(r.dirty(),ut(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?I:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new qr({in:e,out:r,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof qr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};l(zc,"ZodPipeline");var ta=zc,kn=class os extends D{unwrap(){return this._def.type}dereference(e){return new os(h(d({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==P.promise&&r.common.async===!1)return w(r,{code:_.invalid_type,expected:P.promise,received:r.parsedType}),I;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return pe(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}isEqual(e){return e instanceof os?this._def.type.isEqual(e._def.type):!1}};l(kn,"ZodPromise");kn.create=l((t,e)=>new kn(d({type:t,typeName:"ZodPromise"},R(e))),"create");var vr=kn,En=class ls extends D{dereference(e){return new ls(h(d({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){let r=this._def.innerType._parse(e);return jt(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ls?this._def.innerType.isEqual(e._def.innerType):!1}};l(En,"ZodReadonly");En.create=l((t,e)=>new En(d({innerType:t,typeName:"ZodReadonly"},R(e))),"create");var _r=En,Wc=class ar extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new ar(h(d({},this._def),{keyType:r,valueType:n}))}getReferences(){return Ke([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return w(n,{code:_.invalid_type,expected:P.object,received:n.parsedType}),I;let a=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)a.push({key:s._parse(new xe(n,i,n.path,i)),value:o._parse(new xe(n,n.data[i],n.path,i))});return n.common.async?ve.mergeObjectAsync(r,a):ve.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof D?new ar(d({keyType:e,valueType:r,typeName:"ZodRecord"},R(n))):new ar(d({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},R(r)))}isEqual(e){return!(!(e instanceof ar)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};l(Wc,"ZodRecord");var Bs=Wc,xn=class Vc extends D{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:_.unresolved_reference}),I}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Vc?this._def.uri===e._def.uri:!1}};l(xn,"ZodRef");xn.create=l(t=>new xn({typeName:"ZodRef",uri:t}),"create");var Zs=xn,Sn=class sr extends D{dereference(e){return new sr(h(d({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.set)return w(n,{code:_.invalid_type,expected:P.set,received:n.parsedType}),I;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(w(n,{code:_.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(w(n,{code:_.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function o(c){let p=new Set;for(let m of c){if(m.status==="aborted")return I;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}l(o,"finalizeSet");let i=[...n.data.values()].map((c,p)=>s._parse(new xe(n,c,n.path,p)));return n.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,r){return new sr(h(d({},this._def),{minSize:{value:e,message:O.toString(r)}}))}max(e,r){return new sr(h(d({},this._def),{maxSize:{value:e,message:O.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}isEqual(e){var r,n,a,s;if(!(e instanceof sr))return!1;let o=(r=this._def.minSize)==null?void 0:r.value,i=(n=e._def.minSize)==null?void 0:n.value;if(o!==i)return!1;let c=(a=this._def.maxSize)==null?void 0:a.value,p=(s=e._def.maxSize)==null?void 0:s.value;return c!==p?!1:this._def.valueType.isEqual(e._def.valueType)}};l(Sn,"ZodSet");Sn.create=l((t,e)=>new Sn(d({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},R(e))),"create");var Rs=Sn,As=/^c[^\s-]{8,}$/i,Ds=/^[a-z][a-z0-9]*$/,Ms=/^[0-9A-HJKMNP-TV-Z]{26}$/,Hs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,js=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gc=l(t=>t===qc,"isEmojiRegex"),Wa,Ns=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,$s=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Us=l(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex");function Jc(t,e){return!!((e==="v4"||!e)&&Ns.test(t)||(e==="v6"||!e)&&$s.test(t))}l(Jc,"isValidIP");var On=class Zt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let s=this._getOrReturnCtx(e);return w(s,{code:_.invalid_type,expected:P.string,received:s.parsedType}),I}let n=new ve,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(a=this._getOrReturnCtx(e,a),o?w(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&w(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")js.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Wa||(Wa=new RegExp(qc,"u")),Wa.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"emoji",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Hs.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"uuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")As.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Ds.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid2",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ms.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"ulid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),w(a,{validation:"url",code:_.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"regex",code:_.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Us(s).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?Jc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"ip",code:_.invalid_string,message:s.message}),n.dirty()):M.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),d({validation:r,code:_.invalid_string},O.errToObj(n)))}_addCheck(e){return new Zt(h(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},O.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},O.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},O.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},O.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},O.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},O.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},O.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},O.errToObj(e)))}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!=null?r:!1},O.errToObj(e?.message)))}regex(e,r){return this._addCheck(d({kind:"regex",regex:e},O.errToObj(r)))}includes(e,r){return this._addCheck(d({kind:"includes",value:e,position:r?.position},O.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(d({kind:"startsWith",value:e},O.errToObj(r)))}endsWith(e,r){return this._addCheck(d({kind:"endsWith",value:e},O.errToObj(r)))}min(e,r){return this._addCheck(d({kind:"min",value:e},O.errToObj(r)))}max(e,r){return this._addCheck(d({kind:"max",value:e},O.errToObj(r)))}length(e,r){return this._addCheck(d({kind:"length",value:e},O.errToObj(r)))}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[K]=h(d({},this._def[K]),{secret:!0}),this}toLowerCase(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Zt(h(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}isEqual(e){if(!(e instanceof Zt))return!1;let r=new le(this._def.checks),n=new le(e._def.checks);return r.isEqual(n)}};l(On,"ZodString");On.create=l(t=>{var e;return new On(d({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},R(t)))},"create");var ge=On,Cn=class Yc extends D{_parse(e){if(this._getType(e)!==P.symbol){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.symbol,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Yc}};l(Cn,"ZodSymbol");Cn.create=l(t=>new Cn(d({typeName:"ZodSymbol"},R(t))),"create");var Ks=Cn,$t=class us extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new us(h(d({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:l(o=>{w(n,o),o.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let o=a.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return I;let c=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return c.status==="aborted"?I:c.status==="dirty"||r.value==="dirty"?ut(c.value):c});{if(r.value==="aborted")return I;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?I:i.status==="dirty"||r.value==="dirty"?ut(i.value):i}}if(a.type==="refinement"){let o=l(i=>{let c=a.refinement(i,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?I:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?I:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(a.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!jt(o))return o;let i=a.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>jt(o)?Promise.resolve(a.transform(o.value,s)).then(i=>({status:r.value,value:i})):o);M.assertNever(a)}isEqual(e){return!(e instanceof us)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:M.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):(M.assertNever(this._def.effect),!1)}};l($t,"ZodEffects");$t.create=l((t,e,r)=>new $t(d({schema:t,typeName:"ZodEffects",effect:e},R(r))),"create");$t.createWithPreprocess=l((t,e,r)=>new $t(d({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},R(r))),"createWithPreprocess");var Je=$t,In=class Gr extends D{dereference(e){let r=this._def.items.map(a=>a.dereference(e)),n=this._def.rest?this._def.rest.dereference(e):null;return new Gr(h(d({},this._def),{items:r,rest:n}))}getReferences(){return Ke([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.array)return w(n,{code:_.invalid_type,expected:P.array,received:n.parsedType}),I;if(n.data.length<this._def.items.length)return w(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new xe(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>ve.mergeArray(r,o)):ve.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Gr(h(d({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Gr)||!this._restEquals(e))return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le(this._def.items,{compare:r}),a=new le(e._def.items,{compare:r});return n.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};l(In,"ZodTuple");In.create=l((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In(d({items:t,typeName:"ZodTuple",rest:null},R(e)))},"create");var pt=In,Bn=class Xc extends D{_parse(e){if(this._getType(e)!==P.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.undefined,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof Xc}};l(Bn,"ZodUndefined");Bn.create=l(t=>new Bn(d({typeName:"ZodUndefined"},R(t))),"create");var ra=Bn,Zn=class cs extends D{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new cs(h(d({},this._def),{options:r}))}getReferences(){return Ke(this._def.options.reduce((e,r)=>[...e,...r.getReferences()],[]))}_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Be(i.ctx.common.issues));return w(r,{code:_.invalid_union,unionErrors:o}),I}if(l(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let o=h(d({},r),{common:h(d({},r.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let s,o=[];for(let c of n){let p=h(d({},r),{common:h(d({},r.common),{issues:[]}),parent:null}),m=c._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:p}),p.common.issues.length&&o.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(c=>new Be(c));return w(r,{code:_.invalid_union,unionErrors:i}),I}}get options(){return this._def.options}isEqual(e){if(!(e instanceof cs))return!1;let r=l((s,o)=>s.isEqual(o),"compare"),n=new le([...this._def.options],{compare:r}),a=new le([...e._def.options],{compare:r});return n.isEqual(a)}};l(Zn,"ZodUnion");Zn.create=l((t,e)=>new Zn(d({options:t,typeName:"ZodUnion"},R(e))),"create");var na=Zn,Rn=class Qc extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof Qc}};l(Rn,"ZodUnknown");Rn.create=l(t=>new Rn(d({typeName:"ZodUnknown"},R(t))),"create");var At=Rn,An=class ed extends D{_parse(e){if(this._getType(e)!==P.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:_.invalid_type,expected:P.void,received:n.parsedType}),I}return pe(e.data)}isEqual(e){return e instanceof ed}};l(An,"ZodVoid");An.create=l(t=>new An(d({typeName:"ZodVoid"},R(t))),"create");var Fs=An,Kv=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,Ut=l((t,e,r=!0)=>{if(typeof t!="object")throw new qa("Input must be an object");let n=l(o=>{let i=o;return e?.nullable&&(i=i.nullable()),e?.optional&&(i=i.optional()),e?.passtrough&&typeof i.passthrough=="function"&&(i=i.passthrough()),i},"applyOptions"),a=Object.entries(t).reduce((o,[i,c])=>{if(c===null)o[i]=n(E.null());else switch(typeof c){case"string":o[i]=Kv.test(c)?n(E.string().datetime()):n(E.string());break;case"number":o[i]=n(E.number());break;case"boolean":o[i]=n(E.boolean());break;case"object":Array.isArray(c)?c.length===0?o[i]=n(E.array(E.unknown())):typeof c[0]=="object"?o[i]=n(E.array(Ut(c[0],e,!1))):["string","number","boolean"].includes(typeof c[0])&&(o[i]=n(E.array(E[typeof c[0]]()))):o[i]=n(Ut(c,e,!1));break;default:throw new qa(`Unsupported type for key ${i}`)}return o},{}),s=Object.keys(a).length>0;return e?.passtrough||!r&&!s?E.object(a).passthrough():E.object(a)},"objectToZui");function td(){return{}}l(td,"parseAnyDef");function Ls(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=h(d({},t.errorMessage),{[e]:r}))}l(Ls,"addErrorMessage");function G(t,e,r,n,a){t[e]=r,Ls(t,e,n,a)}l(G,"setResponseValueAndErrors");function rd(t,e){var r,n;let a={type:"array"};return((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!=="ZodAny"&&(a.items=V(t.type._def,h(d({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&G(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&G(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(G(a,"minItems",t.exactLength.value,t.exactLength.message,e),G(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}l(rd,"parseArrayDef");function nd(t,e){let r=d({type:"integer",format:"int64"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}l(nd,"parseBigintDef");function ad(t){return d({type:"boolean"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(ad,"parseBooleanDef");function sd(t,e){return V(t.type._def,e)}l(sd,"parseBrandedDef");var Fv=l((t,e)=>V(t.innerType._def,e),"parseCatchDef");function id(t,e){return e.dateStrategy=="integer"?Lv(t,e):d({type:"string",format:"date-time"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{})}l(id,"parseDateDef");var Lv=l((t,e)=>{let r=d({type:"integer",format:"unix-time"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"&&G(r,"minimum",n.value,n.message,e);break;case"max":e.target==="jsonSchema7"&&G(r,"maximum",n.value,n.message,e);break}return r},"integerDateParser");function od(t,e){return h(d({},V(t.innerType._def,e)),{default:t.defaultValue()})}l(od,"parseDefaultDef");function ld(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):{}}l(ld,"parseEffectsDef");function ud(t){return{type:"string",enum:t.values}}l(ud,"parseEnumDef");var zv=l(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function cd(t,e){let r=[V(t.left._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),V(t.right._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return r.forEach(s=>{if(zv(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let i=s,{additionalProperties:c}=i;o=Uo(i,["additionalProperties"])}else n=void 0;a.push(o)}}),a.length?d({allOf:a},n):void 0}l(cd,"parseIntersectionDef");function dd(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}l(dd,"parseLiteralDef");var nr={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function zs(t,e){let r=d({type:"string"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?Wv(a):a}if(l(n,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e);break;case"max":G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":at(r,"email",a.message,e);break;case"format:idn-email":at(r,"idn-email",a.message,e);break;case"pattern:zod":Ae(r,nr.email,a.message,e);break}break;case"url":at(r,"uri",a.message,e);break;case"uuid":at(r,"uuid",a.message,e);break;case"regex":Ae(r,a.regex.source,a.message,e);break;case"cuid":Ae(r,nr.cuid,a.message,e);break;case"cuid2":Ae(r,nr.cuid2,a.message,e);break;case"startsWith":Ae(r,"^"+n(a.value),a.message,e);break;case"endsWith":Ae(r,n(a.value)+"$",a.message,e);break;case"datetime":at(r,"date-time",a.message,e);break;case"length":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e),G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"includes":{Ae(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&at(r,"ipv4",a.message,e),a.version!=="v4"&&at(r,"ipv6",a.message,e);break}case"emoji":Ae(r,nr.emoji,a.message,e);break;case"ulid":{Ae(r,nr.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}l(zs,"parseStringDef");var Wv=l(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),at=l((t,e,r,n)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(d({format:t.format},t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(d({format:e},r&&n.errorMessages&&{errorMessage:{format:r}}))):G(t,"format",e,r,n)},"addFormat"),Ae=l((t,e,r,n)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(d({pattern:t.pattern},t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(d({pattern:e},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):G(t,"pattern",e,r,n)},"addPattern");function Ws(t,e){var r,n,a,s,o;if(e.target==="openApi3"&&((r=t.keyType)==null?void 0:r._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,p)=>{var m;return h(d({},c),{[p]:(m=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"properties",p]})))!=null?m:{}})},{}),additionalProperties:!1};let i={type:"object",additionalProperties:(n=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:{}};if(e.target==="openApi3")return i;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let c=Object.entries(zs(t.keyType._def,e)).reduce((p,[m,T])=>m==="type"?p:h(d({},p),{[m]:T}),{});return h(d({},i),{propertyNames:c})}else if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodEnum")return h(d({},i),{propertyNames:{enum:t.keyType._def.values}});return i}l(Ws,"parseRecordDef");function fd(t,e){if(e.mapStrategy==="record")return Ws(t,e);let r=V(t.keyType._def,h(d({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}l(fd,"parseMapDef");function pd(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(n.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:n.filter(s=>typeof s=="string"||typeof s=="number")}}l(pd,"parseNativeEnumDef");function gd(){return{not:{}}}l(gd,"parseNeverDef");function hd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}l(hd,"parseNullDef");var Dn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function md(t,e){if(e.target==="openApi3")return Ho(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Dn&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((a,s)=>{let o=Dn[s._def.typeName];return o&&!a.includes(o)?[...a,o]:a},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((a,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(n.length===r.length){let a=n.filter((s,o,i)=>i.indexOf(s)===o);return{type:a.length>1?a:a[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,a)=>[...n,...a._def.values.filter(s=>!n.includes(s))],[])};return Ho(t,e)}l(md,"parseUnionDef");var Ho=l((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>V(a._def,h(d({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0)),n=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(r.length)return e.unionStrategy==="anyOf"?d({anyOf:r},n):d({oneOf:r},n)},"asUnionOf");function yd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Dn[t.innerType._def.typeName],nullable:!0}:{type:[Dn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath]}));return n&&h(d({},n),{nullable:!0})}let r=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}l(yd,"parseNullableDef");function vd(t,e){let r=d({type:"number"},t.coerce?{[K]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Ls(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}l(vd,"parseNumberDef");function _d(t,e){var r;let n=h(d({type:"object"},Object.entries(t.shape()).reduce((a,[s,o])=>{if(o===void 0||o._def===void 0)return a;let i=V(o._def,h(d({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return i===void 0?a:{properties:h(d({},a.properties),{[s]:i}),required:o.isOptional()?a.required:[...a.required,s]}},{properties:{},required:[]})),{additionalProperties:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(r=V(t.catchall._def,h(d({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0});return n.required.length||delete n.required,n}l(_d,"parseObjectDef");var Vv=l((t,e)=>{var r;if(e.currentPath.toString()===((r=e.propertyPath)==null?void 0:r.toString()))return V(t.innerType._def,e);let n=V(t.innerType._def,h(d({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),qv=l((t,e)=>{if(e.pipeStrategy==="input")return V(t.in._def,e);if(e.pipeStrategy==="output")return V(t.out._def,e);let r=V(t.in._def,h(d({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=V(t.out._def,h(d({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(a=>a!==void 0)}},"parsePipelineDef");function Td(t,e){return V(t.type._def,e)}l(Td,"parsePromiseDef");function bd(t,e){let n={type:"array",uniqueItems:!0,items:V(t.valueType._def,h(d({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&G(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&G(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}l(bd,"parseSetDef");function wd(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>V(r._def,h(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:V(t.rest._def,h(d({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>V(r._def,h(d({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}l(wd,"parseTupleDef");function Pd(){return{not:{}}}l(Pd,"parseUndefinedDef");function kd(){return{}}l(kd,"parseUnknownDef");var Gv=l((t,e)=>V(t.innerType._def,e),"parseReadonlyDef");function Ed(t){return{$ref:t.uri}}l(Ed,"parseRefDef");function V(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let o=Jv(n,e);if(o!==void 0)return o}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=Xv(t,t.typeName,e);return s&&Qv(t,e,s),a.jsonSchema=s,s}l(V,"parseDef");var Jv=l((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Yv(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),Yv=l((t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},"getRelativePath"),Xv=l((t,e,r)=>{switch(e){case"ZodString":return zs(t,r);case"ZodNumber":return vd(t,r);case"ZodObject":return _d(t,r);case"ZodBigInt":return nd(t,r);case"ZodBoolean":return ad(t);case"ZodDate":return id(t,r);case"ZodUndefined":return Pd();case"ZodNull":return hd(r);case"ZodArray":return rd(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return md(t,r);case"ZodIntersection":return cd(t,r);case"ZodTuple":return wd(t,r);case"ZodRecord":return Ws(t,r);case"ZodRef":return Ed(t);case"ZodLiteral":return dd(t,r);case"ZodEnum":return ud(t);case"ZodNativeEnum":return pd(t);case"ZodNullable":return yd(t,r);case"ZodOptional":return Vv(t,r);case"ZodMap":return fd(t,r);case"ZodSet":return bd(t,r);case"ZodLazy":return V(t.getter()._def,r);case"ZodPromise":return Td(t,r);case"ZodNaN":case"ZodNever":return gd();case"ZodEffects":return ld(t,r);case"ZodAny":return td();case"ZodUnknown":return kd();case"ZodDefault":return od(t,r);case"ZodBranded":return sd(t,r);case"ZodReadonly":return Gv(t,r);case"ZodCatch":return Fv(t,r);case"ZodPipeline":return qv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),Qv=l((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[K]:d(d({},t[K]),r[K])}),r),"addMeta"),jo={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},e_=l(t=>typeof t=="string"?h(d({},jo),{name:t}):d(d({},jo),t),"getDefaultOptions"),t_=l(t=>{let e=e_(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return h(d({},e),{currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))})},"getRefs"),r_=l((t,e)=>{var r;let n=t_(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[p,m])=>{var T;return h(d({},c),{[p]:(T=V(m._def,h(d({},n),{currentPath:[...n.basePath,n.definitionPath,p]}),!0))!=null?T:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,o=(r=V(t._def,s===void 0?n:h(d({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},i=s===void 0?a?h(d({},o),{[n.definitionPath]:a}):o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:h(d({},a),{[s]:o})};return n.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),i},"zodToJsonSchema"),aa=l((t,e={target:"openApi3"})=>{let r=r_(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),n_=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],HT=Tt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),xd=l(t=>ge.create().displayAs({id:"variable",params:d({type:t?.type||"any"},t?.params)}),"variable"),Sd=l(t=>ge.create().displayAs({id:"conversation",params:d({},t?.params)}),"conversation"),Od=l(t=>ge.create().displayAs({id:"user",params:d({},t?.params)}),"user"),Cd=l(t=>ge.create().displayAs({id:"message",params:d({},t?.params)}),"message"),Id=l(t=>ge.create().displayAs({id:"agent",params:d({},t?.params)}),"agent"),Bd=l(t=>ge.create().displayAs({id:"event",params:d({},t?.params)}),"event"),Zd=l(t=>ge.create().displayAs({id:"table",params:d({},t?.params)}),"table"),Rd=l(t=>ge.create().displayAs({id:"tablerow",params:d({},t?.params)}),"tablerow"),Ad=l(t=>ge.create().displayAs({id:"intent",params:d({},t?.params)}),"intent"),Dd=l(()=>Tt.create(n_).displayAs({id:"dropdown",params:{}}),"aimodel"),Md=l(t=>ge.create().displayAs({id:"datasource",params:d({},t)}),"datasource"),Hd=l(t=>ge.create().displayAs({id:"knowledgebase",params:d({},t)}),"knowledgebase"),jd={object:ft.lazycreate},Nd=l((t,e={message:`Input not instance of ${t.name}`})=>Es(r=>r instanceof t,e),"instanceOfType"),Vs=ge.create,qs=ea.create,$d=Is.create,Ud=Ln.create,Gs=zn.create,Kd=qn.create,Fd=Ks.create,Ld=ra.create,zd=Qn.create,Wd=gr.create,Vd=At.create,qd=qe.create,Gd=Fs.create,Jd=Nt.create,Yd=ft.create,Xd=ft.strictCreate,Qd=na.create,ef=xs.create,tf=Gn.create,rf=pt.create,nf=Bs.create,af=Zs.create,sf=_r.create,of=Cs.create,lf=Rs.create,uf=Os.create,cf=Jn.create,df=Yn.create,ff=Tt.create,pf=Xn.create,gf=vr.create,ds=Je.create,hf=je.create,mf=dt.create,a_=mr.create,yf=Je.createWithPreprocess,vf=ta.create,_f=l(()=>Vs().optional(),"ostring"),Tf=l(()=>qs().optional(),"onumber"),bf=l(()=>Gs().optional(),"oboolean"),wf=D.fromJsonSchema,Pf=D.fromObject,kf={string:l(t=>ge.create(h(d({},t),{coerce:!0})),"string"),number:l(t=>ea.create(h(d({},t),{coerce:!0})),"number"),boolean:l(t=>zn.create(h(d({},t),{coerce:!0})),"boolean"),bigint:l(t=>Ln.create(h(d({},t),{coerce:!0})),"bigint"),date:l(t=>qn.create(h(d({},t),{coerce:!0})),"date")},Ef=I,v=E,xf=l((t,e)=>t.anyOf.length?t.anyOf.length===1?ce(t.anyOf[0],h(d({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>ce(r,h(d({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),s_=l(t=>{var e;return(e=t[K])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),i_=l(t=>"z.any()","parseDefault"),o_=l((t,e)=>`z.union([${t.type.map(r=>ce(h(d({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),l_=l((t,e)=>`z.any().refine((value) => !${ce(t.not,h(d({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),u_=l(t=>"z.null()","parseNull"),c_=l(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),d_=l((t,...e)=>Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{}),"omit");function fe(t,e,r){var n;let a=t[e],s="";if(a!==void 0){let o=r({value:a,json:JSON.stringify(a)});if(o){let i=o[0],c=o.length===3?o[1]:"",p=o.length===3?o[2]:o[1];s+=i,((n=t.errorMessage)==null?void 0:n[e])!==void 0&&(s+=c+JSON.stringify(t.errorMessage[e])),s+=p}}return s}l(fe,"withMessage");var ir=Symbol("Original index"),f_=l(t=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="boolean")e.push(n?{[ir]:r}:{[ir]:r,not:{}});else{if(ir in n)return t;e.push(h(d({},n),{[ir]:r}))}}return e},"ensureOriginalIndex");function hr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return ce(r,h(d({},e),{path:[...e.path,"allOf",r[ir]]}))}else{let[r,n]=c_(f_(t.allOf));return`z.intersection(${hr({allOf:r},e)}, ${hr({allOf:n},e)})`}}l(hr,"parseAllOf");var p_=l((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,a)=>ce(n,h(d({},e),{path:[...e.path,"items",a]})))}])`;let r=t.items?`z.array(${ce(t.items,h(d({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return r+=fe(t,"minItems",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxItems",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseArray"),g_=l(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),h_=l(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),m_=l((t,e)=>{let r=ce(t.if,h(d({},e),{path:[...e.path,"if"]})),n=ce(t.then,h(d({},e),{path:[...e.path,"then"]})),a=ce(t.else,h(d({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${a}]).superRefine((value,ctx) => {
34
34
  const result = ${r}.safeParse(value).success
35
35
  ? ${n}.safeParse(value)
36
36
  : ${a}.safeParse(value);
37
37
  if (!result.success) {
38
38
  result.error.errors.forEach((error) => ctx.addIssue(error))
39
39
  }
40
- })`},"parseIfThenElse"),d_=u(t=>{var e;let r="z.number()";return(e=t[U])!=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"),Ks=u((t,e)=>t.oneOf.length?t.oneOf.length===1?le(t.oneOf[0],m(l({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
41
- const schemas = [${t.oneOf.map((r,n)=>le(r,m(l({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
40
+ })`},"parseIfThenElse"),y_=l(t=>{var e;let r="z.number()";return(e=t[K])!=null&&e.coerce&&(r="z.coerce.number()"),t.type==="integer"?r+=fe(t,"type",()=>[".int(",")"]):r+=fe(t,"format",({value:n})=>{if(n==="int64")return[".int(",")"]}),r+=fe(t,"multipleOf",({value:n,json:a})=>n===1?r.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${a}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?r+=fe(t,"minimum",({json:n})=>[`.gt(${n}`,", ",")"]):r+=fe(t,"minimum",({json:n})=>[`.gte(${n}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(r+=fe(t,"exclusiveMinimum",({json:n})=>[`.gt(${n}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?r+=fe(t,"maximum",({json:n})=>[`.lt(${n}`,", ",")"]):r+=fe(t,"maximum",({json:n})=>[`.lte(${n}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(r+=fe(t,"exclusiveMaximum",({json:n})=>[`.lt(${n}`,", ",")"])),r},"parseNumber"),Js=l((t,e)=>t.oneOf.length?t.oneOf.length===1?ce(t.oneOf[0],h(d({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
41
+ const schemas = [${t.oneOf.map((r,n)=>ce(r,h(d({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
42
42
  const errors = schemas.reduce(
43
43
  (errors: z.ZodError[], schema) =>
44
44
  ((result) => ("error" in result ? [...errors, result.error] : errors))(
@@ -54,13 +54,13 @@ ${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 Pf(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],d=`${JSON.stringify(i)}: ${le(o,m(l({},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,y=Array.isArray(t.required)?t.required.includes(i):typeof o=="object"&&o.required===!0;return!p&&!y?`${d}.optional()`:d}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?le(t.additionalProperties,m(l({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([o,d])=>[o,le(d,m(l({},e),{path:[...e.path,"patternProperties",o]}))],{}));a="",r?n?a+=`.catchall(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:a+=`.catchall(${Object.values(i)})`:n?a+=`z.record(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`z.record(z.union([${Object.values(i).join(", ")}]))`:a+=`z.record(${Object.values(i)})`,a+=`.superRefine((value, ctx) => {
57
+ })`:"z.any()","parseOneOf");function Sf(t,e){let r;t.properties&&(Object.keys(t.properties).length?(r="z.object({ ",r+=Object.keys(t.properties).map(o=>{let i=t.properties[o],c=`${JSON.stringify(o)}: ${ce(i,h(d({},e),{path:[...e.path,"properties",o]}))}`,p=typeof i=="object"&&i.default!==void 0||typeof t.default=="object"&&t.default!==null&&o in t.default,m=Array.isArray(t.required)?t.required.includes(o):typeof i=="object"&&i.required===!0;return!p&&!m?`${c}.optional()`:c}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?ce(t.additionalProperties,h(d({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let o=Object.fromEntries(Object.entries(t.patternProperties).map(([i,c])=>[i,ce(c,h(d({},e),{path:[...e.path,"patternProperties",i]}))],{}));a="",r?n?a+=`.catchall(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?a+=`.catchall(z.union([${Object.values(o).join(", ")}]))`:a+=`.catchall(${Object.values(o)})`:n?a+=`z.record(z.union([${[...Object.values(o),n].join(", ")}]))`:Object.keys(o).length>1?a+=`z.record(z.union([${Object.values(o).join(", ")}]))`:a+=`z.record(${Object.values(o)})`,a+=`.superRefine((value, ctx) => {
58
58
  `,a+=`for (const key in value) {
59
- `,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(o=>JSON.stringify(o)).join(", ")}].includes(key)
59
+ `,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(i=>JSON.stringify(i)).join(", ")}].includes(key)
60
60
  `:a+=`let evaluated = false
61
- `);for(let o in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(o)+`))) {
61
+ `);for(let i in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(i)+`))) {
62
62
  `,n&&(a+=`evaluated = true
63
- `),a+="const result = "+i[o]+`.safeParse(value[key])
63
+ `),a+="const result = "+o[i]+`.safeParse(value[key])
64
64
  `,a+=`if (!result.success) {
65
65
  `,a+=`ctx.addIssue({
66
66
  path: [...ctx.path, key],
@@ -86,7 +86,7 @@ ${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(${xf(h(d({},t),{anyOf:t.anyOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${Js(h(d({},t),{oneOf:t.oneOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${hr(h(d({},t),{allOf:t.allOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?h(d({},o),{type:"object"}):o)}),e)})`),s}l(Sf,"parseObject");var v_=l(t=>{var e;let r="z.string()";if((e=t[K])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";r="z.coerce.string()"}return r+=fe(t,"format",({value:n})=>{switch(n){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),r+=fe(t,"pattern",({json:n})=>[`.regex(new RegExp(${n})`,", ",")"]),r+=fe(t,"minLength",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxLength",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseString"),__=l((t,e)=>`${ce(d_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),T_=l(t=>`z.ref('${t.$ref}')`,"parseRef"),b_=l((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return Js(t,e);let a=t.oneOf.map((s,o)=>ce(s,h(d({},e),{path:[...e.path,"oneOf",o]})));return`z.discriminatedUnion("${(n=t.discriminator)==null?void 0:n.propertyName}", [${a.join(", ")}])`},"parseDiscriminator"),ce=l((t,e={seen:new Map,path:[]},r)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let n=e.seen.get(t);if(n){if(n.r!==void 0)return n.r;if(e.depth===void 0||n.n>=e.depth)return"z.any()";n.n+=1}else n={r:void 0,n:0},e.seen.set(t,n);let a=k_(t,e);return r||(a=w_(t,a),e.withoutDefaults||(a=P_(t,a))),n.r=a,a},"parseSchema"),w_=l((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),P_=l((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),k_=l((t,e)=>ie.a.nullable(t)?__(t,e):ie.an.object(t)?Sf(t,e):ie.an.array(t)?p_(t,e):ie.an.anyOf(t)?xf(t,e):ie.an.allOf(t)?hr(t,e):ie.a.discriminator(t)?b_(t,e):ie.a.oneOf(t)?Js(t,e):ie.a.not(t)?l_(t,e):ie.an.enum(t)?h_(t):ie.a.const(t)?g_(t):ie.a.multipleType(t)?o_(t,e):ie.a.primitive(t,"string")?v_(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?y_(t):ie.a.primitive(t,"boolean")?s_(t):ie.a.primitive(t,"null")?u_(t):ie.a.conditional(t)?m_(t,e):ie.a.ref(t)?T_(t):i_(t),"selectParser"),ie={an:{object:l(t=>t.type==="object","object"),array:l(t=>t.type==="array","array"),anyOf:l(t=>t.anyOf!==void 0,"anyOf"),allOf:l(t=>t.allOf!==void 0,"allOf"),enum:l(t=>t.enum!==void 0,"enum")},a:{nullable:l(t=>t.nullable===!0,"nullable"),multipleType:l(t=>Array.isArray(t.type),"multipleType"),not:l(t=>t.not!==void 0,"not"),const:l(t=>t.const!==void 0,"const"),primitive:l((t,e)=>t.type===e,"primitive"),conditional:l(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:l(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:l(t=>t.oneOf!==void 0,"oneOf"),ref:l(t=>t.$ref!==void 0,"ref")}},E_=l(t=>{let e;try{e=new Function("z",`return ${t}`)(v)}catch(r){return{sucess:!1,error:`Failed to evaluate schema: ${(r instanceof Error?r:new Error(String(r))).message}`}}return e instanceof v.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),x_=l(t=>ce(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),S_=l(t=>{let e=x_(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=E_(e);if(!r.sucess)throw new al(r.error);return r.value},"jsonSchemaToZod"),or=l((t,e)=>{var r,n;if(e[K]&&t._def&&(t._def[K]=e[K]),((r=t._def)==null?void 0:r.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,s])=>{let o=typeof t._def.shape=="function"?t._def.shape():t._def.shape;o[a]&&or(o[a],s)}),((n=t._def)==null?void 0:n.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&or(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let s=t._def.type;s&&or(s,a)}else Array.isArray(a)&&a.forEach((s,o)=>{let i=t._def;i.typeName===E.ZodFirstPartyTypeKind.ZodTuple&&or(i.items[o],s)})}},"applyZuiPropsRecursively"),Tr=l(t=>{let e=S_(t);return or(e,t),e},"jsonSchemaToZui"),Of=class extends Kt.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){console.error("Uncaught error:",e,r)}render(){return this.state.hasError&&this.props.fallback?Kt.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};l(Of,"ErrorBoundary");var Dt=Of;function Cf(t,e){return r=>Kt.default.createElement(Dt,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Kt.default.createElement(t,d({},r)))}l(Cf,"withErrorBoundary");var Jr=l(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:o}=e,i=Uo(e,["components","fieldSchema","path","required","fallback"]),c,p;let{formData:m,disabled:T,hidden:C,handlePropertyChange:k,addArrayItem:S,removeArrayItem:W,formErrors:q,formValid:re}=Lo(n,a),J=(0,be.useMemo)(()=>ot(m,a),[m,a]),N=(0,be.useMemo)(()=>Ng(r,n),[n,r]),{discriminator:F,discriminatedSchema:ue,discriminatorValue:Le}=Mg(n,a);if(!N||C===!0)return null;let{Component:tt,type:Ce}=N,we={type:Ce,componentID:N.id,scope:a.join("."),context:{path:a,readonly:!1,formData:m,formErrors:q,formValid:re,updateForm:k,updateFormData:l(Pe=>k([],Pe),"updateFormData")},onChange:l(Pe=>k(a,Pe),"onChange"),disabled:T,errors:q?.filter(Pe=>Pe.path===a)||[],label:((c=n[K])==null?void 0:c.title)||Va(((p=a[a.length-1])==null?void 0:p.toString())||""),params:N.params,schema:n,zuiProps:n[K]};if(n.type==="array"&&Ce==="array"){let Pe=tt,Te=we.schema,ke=Array.isArray(J)||typeof J=="object"?J:[],j=d(h(d({},we),{type:Ce,schema:Te,data:ke,addItem:l(Ie=>S(a,Ie),"addItem"),removeItem:l(Ie=>W(a,Ie),"removeItem")}),i);return Array.isArray(n.items)?null:be.default.createElement(Pe,h(d({key:we.scope},j),{isArrayChild:j.isArrayChild}),Array.isArray(j.data)?j.data.map((Ie,Oe)=>{let ze=[...a,Oe.toString()];return be.default.createElement(Dt,{key:ze.join("."),fallback:o,fieldSchema:n.items,path:ze},be.default.createElement(Jr,{key:ze.join("."),components:r,fieldSchema:n.items,path:ze,required:s,isArrayChild:!0,index:Oe,removeSelf:()=>W(a,Oe),fallback:o}))}):[])}if(n.type==="object"&&Ce==="object"&&n.properties){let Pe=tt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{}}),i);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),Object.entries(n.properties).map(([ke,j])=>{var Ie;let Oe=[...a,ke];return be.default.createElement(Dt,{key:Oe.join("."),fallback:o,fieldSchema:j,path:Oe},be.default.createElement(Jr,{key:Oe.join("."),components:r,fieldSchema:j,path:Oe,required:((Ie=n.required)==null?void 0:Ie.includes(ke))||!1,isArrayChild:!1,fallback:o}))}))}if(Ce==="discriminatedUnion"){let Pe=tt,Te=d(h(d({},we),{type:Ce,schema:we.schema,data:J||{},discriminatorKey:F?.key||null,discriminatorLabel:Va(F?.key||"Unknown"),discriminatorOptions:F?.values||null,discriminatorValue:Le,setDiscriminator:l(ke=>{if(!F?.key){console.warn("No discriminator key found, cannot set discriminator");return}k(a,{[F.key]:ke})},"setDiscriminator")}),i);return be.default.createElement(Pe,h(d({key:we.scope},Te),{isArrayChild:Te.isArrayChild}),ue&&be.default.createElement(Dt,{key:a.join("."),fallback:o,fieldSchema:ue,path:a},be.default.createElement(Jr,{components:r,fieldSchema:ue,path:a,required:s,isArrayChild:!1,fallback:o})))}let ya=tt,va=d(h(d({},we),{type:Ce,schema:we.schema,config:{},required:s,data:J,description:n.description}),i);return be.default.createElement(ya,d({},va))},"FormElementRenderer"),O_=l(({schema:t,components:e,onChange:r,value:n,disableValidation:a,fallback:s,dataTransform:o,onValidation:i})=>{let[c,p]=(0,Ne.useState)(n);return(0,Ne.useEffect)(()=>{r(c)},[c]),(0,Ne.useEffect)(()=>{let m=Rt(t);p(T=>Xr(m,T))},[JSON.stringify(t),p]),Ne.default.createElement(Dg,{formData:c,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:o,onValidation:i},Ne.default.createElement(Dt,{fallback:s,fieldSchema:t,path:[]},Ne.default.createElement(Jr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),C_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},I_={errors:tl,jsonSchemaToZui:Tr,zuiToJsonSchema:aa,objectToZui:Ut,toTypescript:Qr,toTypescriptSchema:bs};var zt=(t,e)=>{let r=t._def,n=e._def;if(r.typeName===E.ZodFirstPartyTypeKind.ZodObject&&n.typeName===E.ZodFirstPartyTypeKind.ZodObject){let a=r.shape(),s=n.shape();return E.object({...a,...s})}if(r.typeName===E.ZodFirstPartyTypeKind.ZodRecord&&n.typeName===E.ZodFirstPartyTypeKind.ZodRecord)return E.record(E.intersection(r.valueType,n.valueType));throw new Error("Cannot merge object schemas with record schemas")},If=E;var _e=E.string().min(1),Zf=E.object({text:_e}),Rf=E.object({markdown:_e}),Af=E.object({imageUrl:_e}),Df=E.object({audioUrl:_e}),Mf=E.object({videoUrl:_e}),Hf=E.object({fileUrl:_e,title:_e.optional()}),jf=E.object({latitude:E.number(),longitude:E.number(),address:E.string().optional(),title:E.string().optional()}),Nf=E.object({title:_e,subtitle:_e.optional(),imageUrl:_e.optional(),actions:E.array(E.object({action:E.enum(["postback","url","say"]),label:_e,value:_e}))}),Bf=E.object({text:_e,options:E.array(E.object({label:_e,value:_e}))}),B_=E.object({items:E.array(Nf)}),Z_=E.union([E.object({type:E.literal("text"),payload:Zf}),E.object({type:E.literal("markdown"),payload:Rf}),E.object({type:E.literal("image"),payload:Af}),E.object({type:E.literal("audio"),payload:Df}),E.object({type:E.literal("video"),payload:Mf}),E.object({type:E.literal("file"),payload:Hf}),E.object({type:E.literal("location"),payload:jf})]),R_=E.object({items:E.array(Z_)}),A_={schema:Rf},D_={text:{schema:Zf},image:{schema:Af},audio:{schema:Df},video:{schema:Mf},file:{schema:Hf},location:{schema:jf},carousel:{schema:B_},card:{schema:Nf},dropdown:{schema:Bf},choice:{schema:Bf},bloc:{schema:R_}};var br="x-bot-id",Xs="x-bot-user-id",Qs="x-integration-id",ei="x-webhook-id",ti="x-bp-configuration-type",wr="x-bp-configuration",Pr="x-bp-operation",ri="x-bp-type";var $f=require("browser-or-node");var Wt=console;function Se(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function kr(t,e=8072,r=N_){if(!$f.isNode)throw new Error("This function can only be called in Node.js");let a=require("http").createServer(async(s,o)=>{try{let i=await M_(s);if(i.path==="/health"){o.writeHead(200).end("ok");return}let c=await t(i);o.writeHead(c?.status??200,c?.headers??{}).end(c?.body??"{}")}catch(i){Wt.error("Error while handling request",{error:i?.message??"Internal error occured"}),o.writeHead(500).end(JSON.stringify({error:i?.message??"Internal error occured"}))}});return a.listen(e,()=>r(e)),a}async function M_(t){let e=await j_(t),r={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),o=t.rawHeaders[a+1];r[s]=o}let n=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:n.pathname,query:H_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function H_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function j_(t){return new Promise((e,r)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let n="";t.on("data",a=>n+=a.toString()),t.on("error",a=>r(a)),t.on("end",()=>e(n))})}function N_(t){Wt.info(`Listening on port ${t}`)}var ma=require("@botpress/client");var te={};er(te,{mapKeys:()=>K_,mapValues:()=>U_,mergeRecords:()=>L_,pairs:()=>sa,stripUndefinedProps:()=>F_,values:()=>$_});var sa=t=>Object.entries(t),$_=t=>Object.values(t),U_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[r,e(n,r)])),K_=(t,e)=>Object.fromEntries(sa(t).map(([r,n])=>[e(r),n])),F_=t=>Object.fromEntries(sa(t).filter(([,e])=>e!==void 0)),L_=(t,e,r)=>{let n=[...Object.keys(t),...Object.keys(e)],a=[...new Set(n)],s={};for(let o of a){let i=t[o],c=e[o];i&&c?s[o]=r(i,c):i?s[o]=i:c&&(s[o]=c)}return s};var H={};er(H,{safePush:()=>z_,unique:()=>W_});var z_=(t,...e)=>t?[...t,...e]:[...e],W_=t=>Array.from(new Set(t));var Fe={};er(Fe,{setName:()=>V_});var V_=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Uf=t=>{let{name:e,version:r}=t,n={actions:{},events:{},channels:{}},a={name:e,version:r,entities:te.mapValues(t.entities,o=>({name:o.name})),actions:{},events:{},channels:{}},s=te.mapValues(t.entities,o=>o.schema);for(let[o,i]of Object.entries(t.definition.actions??{})){let c=i.input.schema.dereference(s),p=i.output.schema.dereference(s),m=t.actions?.[o]?.name??o;n.actions[m]={...i,...t.actions?.[o]??{},input:{schema:c},output:{schema:p}},a.actions[o]={name:m}}for(let[o,i]of Object.entries(t.definition.events??{})){let c=i.schema.dereference(s),p=t.events?.[o]?.name??o;n.events[p]={...i,...t.events?.[o]??{},schema:c},a.events[o]={name:p}}for(let[o,i]of Object.entries(t.definition.channels??{})){let c={};for(let[m,T]of Object.entries(i.messages)){let C=T.schema.dereference(s);c[m]={...T,schema:C}}let p=t.channels?.[o]?.name??o;n.channels[p]={...i,...t.channels?.[o]??{},message:{...i.message??{},tags:{...i.message?.tags??{},...t.channels?.[o]?.message?.tags??{}}},conversation:{...i.conversation??{},tags:{...i.conversation?.tags??{},...t.channels?.[o]?.conversation?.tags??{}}},messages:c},a.channels[o]={name:p}}return{resolved:n,statement:a}};var ia=Symbol("schemaName"),Kf=t=>t?te.mapValues(t,(r,n)=>({...r,[ia]:n})):{},Ff=t=>ia in t&&t[ia]!==void 0,Lf=t=>t[ia];var oa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;extend(e,r){let{entities:n,actions:a,events:s,channels:o}=this._callBuilder(e,r),i=this;i.interfaces??={};let c=Object.values(n).map(C=>C.name),p=c.length===0?e.name:`${e.name}<${c.join(",")}>`,{resolved:m,statement:T}=Uf({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(o)});return i.actions=te.mergeRecords(i.actions??{},m.actions,this._mergeActions),i.channels=te.mergeRecords(i.channels??{},m.channels,this._mergeChannels),i.events=te.mergeRecords(i.events??{},m.events,this._mergeEvents),i.interfaces[p]={id:e.id,...T},this}_callBuilder(e,r){let a={entities:Kf(this.entities)},s=r(a),o=te.pairs(s.entities).find(([c,p])=>!Ff(p));if(o)throw new Error(`Cannot extend interface "${e.name}" with entity "${o[0]}"; the provided schema is not part of the integration's entities.`);return{entities:te.mapValues(s.entities,c=>({name:Lf(c),schema:c.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:zt(e.input.schema,r.input.schema)},output:{schema:zt(e.input.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:zt(e.schema,r.schema)});_mergeChannels=(e,r)=>{let n=te.mergeRecords(e.messages,r.messages,this._mergeMessage),a;(e.conversation||r.conversation)&&(a={tags:{...e.conversation?.tags,...r.conversation?.tags}});let s;return(e.message||r.message)&&(s={tags:{...e.message?.tags,...r.message?.tags}}),{...e,...r,messages:n,conversation:a,message:s}};_mergeMessage=(e,r)=>({schema:zt(e.schema,r.schema)})};var wt=require("@botpress/client");var zf=require("@botpress/client"),la={retries:3,retryCondition:t=>zf.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};var Vt=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e)};var ua=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var q_=E.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Wf=t=>{let e=t[br],r=t[Xs],n=t[Qs],a=t[ei],s=t[ti],o=t[wr],i=q_.parse(t[Pr]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing bot user headers");if(!n)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!o)throw new Error("Missing configuration headers");if(!i)throw new Error("Missing operation headers");return{botId:e,botUserId:r,integrationId:n,webhookId:a,operation:i,configurationType:s??null,configuration:o?JSON.parse(Buffer.from(o,"base64").toString("utf-8")):{}}};var Vf=nt(require("util")),qt=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,r){this._getConsoleMethod(e)(this._serializeMessage(r))}_serializeMessage(e){let r=Vf.default.format(...e);return process.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(r):r}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var Ye=class extends qt{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Ye({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};var qf=t=>async e=>{let r=Wf(e.headers),n=new wt.Client({botId:r.botId,integrationId:r.integrationId,retry:la}),a=new Vt(n),s=new Ye,o={ctx:r,req:e,client:a,logger:s,instance:t};try{let i;switch(r.operation){case"webhook_received":i=await J_(o);break;case"register":i=await Y_(o);break;case"unregister":i=await X_(o);break;case"message_created":i=await tT(o);break;case"action_triggered":i=await rT(o);break;case"ping":i=await G_(o);break;case"create_user":i=await Q_(o);break;case"create_conversation":i=await eT(o);break;default:throw new Error(`Unknown operation ${r.operation}`)}return i?{...i,status:i.status??200}:{status:200}}catch(i){if((0,wt.isApiError)(i)){let p=i.type==="Runtime"?i:new wt.RuntimeError(i.message,i);return s.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(i);let c=new wt.RuntimeError("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return s.forBot().error(c.message),{status:c.code,body:JSON.stringify(c.toJSON())}}},G_=async t=>{},J_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{let{req:s}=Se(r);return a.webhook({client:t,ctx:e,req:s,logger:n})},Y_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=Se(r);await a.register({client:t,ctx:e,webhookUrl:s,logger:n})},X_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=Se(r);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:n})},Q_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createUser)return;let{tags:s}=Se(r);return await a.createUser({ctx:e,client:t,tags:s,logger:n})},eT=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:o}=Se(r);return await a.createConversation({ctx:e,client:t,channel:s,tags:o,logger:n})},tT=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:o,type:i,payload:c,message:p}=Se(e),m=a.channels[s.channel];if(!m)throw new Error(`Channel ${s.channel} not found`);let T=m.messages[i];if(!T)throw new Error(`Message of type ${i} not found in channel ${s.channel}`);await T({ctx:t,conversation:s,message:p,user:o,type:i,client:r,payload:c,ack:async({tags:k})=>{await r.updateMessage({id:p.id,tags:k})},logger:n})},rT=async({req:t,ctx:e,client:r,logger:n,instance:a})=>{let{input:s,type:o}=Se(t);if(!o)throw new Error("Missing action type");let i=a.actions[o];if(!i)throw new Error(`Action ${o} not found`);let c=new ua,m={output:await i({ctx:e,input:s,client:r,type:o,logger:n,metadata:c}),meta:c.toJSON()};return{body:JSON.stringify(m)}};var ca=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=qf(this);start=e=>kr(this.handler,e)};var nT="#",da=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;addIntegration(e,r){let n=this;return n.integrations||(n.integrations={}),n.integrations[e.name]={enabled:r.enabled,...e,configurationType:r.configurationType,configuration:r.configuration},this}addPlugin(e,r){let n=this;n.plugins||(n.plugins={});let a=r.alias??e.name;return n.plugins[a]={...e,alias:r.alias,configuration:r.configuration,interfaces:r.interfaces},n.user=this._mergeUser(n.user,e.definition.user),n.conversation=this._mergeConversation(n.conversation,e.definition.conversation),n.message=this._mergeMessage(n.message,e.definition.message),n.recurringEvents=this._mergeRecurringEvents(n.recurringEvents,e.definition.recurringEvents),n.tables=this._mergeTables(n.tables,e.definition.tables),n.workflows=this._mergeWorkflows(n.workflows,e.definition.workflows),n.states=this._mergeStates(n.states,this._prefixKeys(e.definition.states,r.alias)),n.events=this._mergeEvents(n.events,this._prefixKeys(e.definition.events,r.alias)),n.actions=this._mergeActions(n.actions,this._prefixKeys(e.definition.actions,r.alias)),this}_mergeUser=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeConversation=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeMessage=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeStates=(e,r)=>({...e,...r});_mergeEvents=(e,r)=>({...e,...r});_mergeRecurringEvents=(e,r)=>({...e,...r});_mergeActions=(e,r)=>({...e,...r});_mergeTables=(e,r)=>({...e,...r});_mergeWorkflows=(e,r)=>({...e,...r});_prefixKeys=(e,r)=>!e||!r?e:te.mapKeys(e,n=>`${r}${nT}${n}`)};var Yf=nt(require("@botpress/client"));var Xe=class extends qt{constructor(e){super({...e})}with(e){return new Xe({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}};var Ze=class{constructor(e,r={before:{},after:{}}){this._client=e;this._hooks=r}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);createEvent=e=>this._run("createEvent",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createWorkflow=e=>this._run("createWorkflow",e);getWorkflow=e=>this._run("getWorkflow",e);updateWorkflow=e=>this._run("updateWorkflow",e);deleteWorkflow=e=>this._run("deleteWorkflow",e);listWorkflows=e=>this._run("listWorkflows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,r)=>{let n=this._hooks.before[e];n&&(r=await n(r));let a=await this._client[e](r),s=this._hooks.after[e];return s&&(a=await s(a)),a}};var Gt=t=>new Proxy({},{get:(e,r)=>({listInstances:{all:n=>Qe({workflowName:r,client:t,input:n}),running:n=>Qe({workflowName:r,client:t,input:n,statuses:["in_progress"]}),scheduled:n=>Qe({workflowName:r,client:t,input:n,statuses:["pending","listening"]}),allFinished:n=>Qe({workflowName:r,client:t,input:n,statuses:["completed","cancelled","failed","timedout"]}),cancelled:n=>Qe({workflowName:r,client:t,input:n,statuses:["cancelled"]}),failed:n=>Qe({workflowName:r,client:t,input:n,statuses:["failed"]}),succeeded:n=>Qe({workflowName:r,client:t,input:n,statuses:["completed"]}),timedOut:n=>Qe({workflowName:r,client:t,input:n,statuses:["timedout"]})},startNewInstance:async n=>{let{workflow:a}=await t.createWorkflow({name:r,status:"pending",...n});return{workflow:et({client:t,workflow:a})}}})}),Qe=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(r=>et({client:t.client,workflow:r}))}},et=t=>({...t.workflow,async update(e){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:et({client:t.client,workflow:r})}},async setFailed({failureReason:e}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:et({client:t.client,workflow:r})}},async setCompleted({output:e}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:et({client:t.client,workflow:r})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:et({client:t.client,workflow:e})}}});var aT=E.enum(["event_received","register","unregister","ping","action_triggered"]),Gf=t=>{let e=t[br],r=t[wr],n=t[ri],a=aT.parse(t[Pr]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing type headers");if(!r)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:n,configuration:r?JSON.parse(Buffer.from(r,"base64").toString("utf-8")):{}}};var he={status:200};var ni=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var sT=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Jf=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!sT.includes(e.payload.type))throw new Error("Unexpected event type");if(!e.payload.workflow.name)return t.logger.withWorkflowId(e.payload.workflow.id).warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),he;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":t.logger.withWorkflowId(e.payload.workflow.id).info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await iT(t,e);default:e.payload.type}return he},iT=async(t,e)=>{let r=ni(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];return!n||n.length===0?(t.logger.withWorkflowId(e.payload.workflow.id).warn(`No ${r} handler found for workflow "${e.payload.workflow.name}"`),he):(await oT(t,e),await lT(t,e),he)},oT=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},lT=async(t,e)=>{let r=ni(e.payload.type),n=t.self.workflowHandlers[r]?.[e.payload.workflow.name];for(let a of n)await a({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:et({...t,workflow:e.payload.workflow}),workflows:Gt(t.client)})};var Xf=t=>async e=>{let r=Gf(e.headers),n=new Xe,a=new Yf.Client({botId:r.botId,retry:la}),s=new Ze(a,{before:{createMessage:async i=>{let c=t.hookHandlers.before_outgoing_message[i.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i},callAction:async i=>{let c=t.hookHandlers.before_outgoing_call_action[i.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i}},after:{createMessage:async i=>{let c=t.hookHandlers.after_outgoing_message[i.message.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i},callAction:async i=>{let c=t.hookHandlers.after_outgoing_call_action[i.output.type]??[];for(let p of c){let m=new Ze(a);i=(await p({client:m,ctx:r,logger:n,data:i,...Jt({client:m})}))?.data??i}return i}}}),o={req:e,ctx:r,logger:n,client:s,self:t};switch(r.operation){case"action_triggered":return await pT(o);case"event_received":return await fT(o);case"register":return await cT(o);case"unregister":return await dT(o);case"ping":return await uT(o);default:throw new Error(`Unknown operation ${r.operation}`)}},uT=async({ctx:t})=>(Wt.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),he),cT=async t=>he,dT=async t=>he,fT=async t=>{let{ctx:e,logger:r,req:n,client:a,self:s}=t,o={client:a,ctx:e,logger:r,...Jt({client:a})};Wt.debug(`Received event ${e.type}`);let i=Se(n);if(e.type==="workflow_update")return await Jf(t,i.event);if(e.type==="message_created"){let k=i.event,S=k.payload.message,W=s.hookHandlers.before_incoming_message[S.type]??[];for(let N of W){let F=await N({...o,data:S});if(S=F?.data??S,F?.stop)return he}let q={...o,user:k.payload.user,conversation:k.payload.conversation,states:k.payload.states,message:S,event:k},re=s.messageHandlers[S.type]??[];for(let N of re)await N(q);let J=s.hookHandlers.after_incoming_message[S.type]??[];for(let N of J){let F=await N({...o,data:S});if(S=F?.data??S,F?.stop)return he}return he}if(e.type==="state_expired"){let S=i.event.payload.state,W={...o,state:S},q=s.stateExpiredHandlers["*"]??[];for(let re of q)await re(W);return he}let c=i.event,p=s.hookHandlers.before_incoming_event[c.type]??[];for(let k of p){let S=await k({...o,data:c});if(c=S?.data??c,S?.stop)return he}let m={...o,event:c},T=s.eventHandlers[c.type]??[];for(let k of T)await k(m);let C=s.hookHandlers.after_incoming_event[c.type]??[];for(let k of C){let S=await k({...o,data:c});if(c=S?.data??c,S?.stop)return he}return he},pT=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let{input:s,type:o}=Se(r);if(!o)throw new Error("Missing action type");let i=a.actionHandlers[o];if(!i)throw new Error(`Action ${o} not found`);let p={output:await i({ctx:t,logger:e,input:s,client:n,type:o,...Jt({client:n})})};return{status:200,body:JSON.stringify(p)}},Jt=t=>({workflows:Gt(t.client)});var fa=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._actionHandlers[r];if(n)return n;for(let a of Object.values(this._plugins))if(n=a.actionHandlers[r],n)return n}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(i=>i.messageHandlers[r]??[]),a=this._messageHandlers[r]??[],s=this._messageHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(i=>i.eventHandlers[r]??[]),a=this._eventHandlers[r]??[],s=this._eventHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.values(this._plugins).flatMap(i=>i.stateExpiredHandlers[r]??[]),a=this._stateExpiredHandlers[r]??[],s=this._stateExpiredHandlers["*"]??[],o=[...a,...s].sort((i,c)=>i.order-c.order).map(({handler:i})=>i);return H.unique([...n,...o])}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{if(this._hookHandlers[r])return new Proxy({},{get:(a,s)=>{let o=Object.values(this._plugins).flatMap(T=>T.hookHandlers[r]?.[s]??[]),i=this._hookHandlers[r]??{},c=i[s]??[],p=i["*"]??[],m=[...c,...p].sort((T,C)=>T.order-C.order).map(({handler:T})=>T);return H.unique([...o,...m])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{let o=n[s]?.sort((c,p)=>c.order-p.order).map(({handler:c})=>c)??[],i=Object.values(this._plugins).flatMap(c=>c.workflowHandlers[r]?.[s]??[]);return H.unique([...o,...i])}})}})}on={message:(e,r)=>{this._messageHandlers[e]=H.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=H.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=H.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=H.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=H.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=H.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=H.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=H.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=H.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=H.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=H.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=H.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=H.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=H.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};handler=Xf(this);start=e=>kr(this.handler,e)};var pa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.entities=e.entities??{};let r=this._getEntityReference(this.entities),n=e.events===void 0?{}:te.mapValues(e.events,o=>({...o,schema:o.schema(r)})),a=e.actions===void 0?{}:te.mapValues(e.actions,o=>({...o,input:{...o.input,schema:o.input.schema(r)},output:{...o.output,schema:o.output.schema(r)}})),s=e.channels===void 0?{}:te.mapValues(e.channels,o=>({...o,messages:te.mapValues(o.messages,i=>({...i,schema:i.schema(r)}))}));this.events=n,this.actions=a,this.channels=s}name;version;entities;events;actions;channels;_getEntityReference=e=>{let r={};for(let[n,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,o=a.schema._def.description,i=If.ref(n);s&&i.title(s),o&&i.describe(o),r[n]=i}return r}};var ga=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};var ai=":";var Qf=t=>{let[e,r]=t.split(ai);return!e||!r?null:{namespace:e,eventName:r}},ep=t=>`${t.namespace}${ai}${t.actionName}`,tp=t=>`${t.namespace}${ai}${t.eventName}`,rp=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.actions[t.actionName]?.name??t.actionName;return{namespace:n,actionName:a}},np=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.events[t.eventName]?.name??t.eventName;return{namespace:n,eventName:a}};var ap=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>o=>gT({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:s,input:o})})}),gT=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=rp({namespace:r,actionName:n},e),o=ep(s);return(await t.callAction({type:o,input:a})).output};var ha=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:r,interfaces:n,alias:a}=this._runtime,s=ap(e,n),o=Gt(e);return{configuration:r,interfaces:n,actions:s,alias:a,workflows:o}}get actionHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._actionHandlers[r];if(n)return Fe.setName(a=>n({...a,...this._getTools(a.client)}),n.name)}})}get messageHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[];return H.unique([...n,...a]).sort((o,i)=>o.order-i.order).map(({handler:o})=>Fe.setName(i=>o({...i,...this._getTools(i.client)}),o.name))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._eventHandlers[r]??[],a=Object.entries(this._eventHandlers).filter(([i])=>this._eventResolvesTo(i,r)).flatMap(([,i])=>i??[]),s=this._eventHandlers["*"]??[];return H.unique([...n,...a,...s]).sort((i,c)=>i.order-c.order).map(({handler:i})=>Fe.setName(c=>i({...c,...this._getTools(c.client)}),i.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{r=this._stripAliasPrefix(r);let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[];return H.unique([...n,...a]).sort((o,i)=>o.order-i.order).map(({handler:o})=>Fe.setName(i=>o({...i,...this._getTools(i.client)}),o.name))}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._hookHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{s=this._stripAliasPrefix(s);let o=n[s]??[],i=Object.entries(n).filter(([m])=>this._eventResolvesTo(m,s)).flatMap(([,m])=>m??[]),c=n["*"]??[];return H.unique([...o,...i,...c]).sort((m,T)=>m.order-T.order).map(({handler:m})=>Fe.setName(T=>m({...T,...this._getTools(T.client)}),m.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._workflowHandlers[r];if(n)return new Proxy({},{get:(a,s)=>(n[s]?.sort((i,c)=>i.order-c.order)??[]).map(({handler:i})=>Fe.setName(c=>i({...c,...this._getTools(c.client)}),i.name))})}})}on={message:(e,r)=>{this._messageHandlers[e]=H.safePush(this._messageHandlers[e],{handler:r,order:this._registerOrder++})},event:(e,r)=>{this._eventHandlers[e]=H.safePush(this._eventHandlers[e],{handler:r,order:this._registerOrder++})},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=H.safePush(this._stateExpiredHandlers[e],{handler:r,order:this._registerOrder++})},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=H.safePush(this._hookHandlers.before_incoming_event[e],{handler:r,order:this._registerOrder++})},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=H.safePush(this._hookHandlers.before_incoming_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=H.safePush(this._hookHandlers.before_outgoing_message[e],{handler:r,order:this._registerOrder++})},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=H.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=H.safePush(this._hookHandlers.after_incoming_event[e],{handler:r,order:this._registerOrder++})},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=H.safePush(this._hookHandlers.after_incoming_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=H.safePush(this._hookHandlers.after_outgoing_message[e],{handler:r,order:this._registerOrder++})},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=H.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:r,order:this._registerOrder++})},workflowStart:(e,r)=>{this._workflowHandlers.started[e]=H.safePush(this._workflowHandlers.started[e],{handler:r,order:this._registerOrder++})},workflowContinue:(e,r)=>{this._workflowHandlers.continued[e]=H.safePush(this._workflowHandlers.continued[e],{handler:r,order:this._registerOrder++})},workflowTimeout:(e,r)=>{this._workflowHandlers.timed_out[e]=H.safePush(this._workflowHandlers.timed_out[e],{handler:r,order:this._registerOrder++})}};_eventResolvesTo=(e,r)=>{let n=Qf(e);if(!n)return!1;let a=np(n,this._runtime.interfaces);return tp(a)===r};_stripAliasPrefix=e=>{let{alias:r}=this._runtime;if(!r)return e;let n=`${r}:`;return e.startsWith(n)?e.slice(n.length):e}};0&&(module.exports={BRAND,Bot,BotDefinition,BotLogger,BotSpecificClient,DIRTY,EMPTY_PATH,ErrorBoundary,INVALID,Integration,IntegrationDefinition,IntegrationLogger,IntegrationSpecificClient,InterfaceDefinition,NEVER,OK,ParseInputLazyPath,ParseStatus,Plugin,PluginDefinition,RuntimeError,Schema,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,ZodFirstPartyTypeKind,ZodFunction,ZodIntersection,ZodIssueCode,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodRef,ZodSchema,ZodSet,ZodString,ZodSymbol,ZodTransformer,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,ZuiForm,addIssueToContext,agent,aimodel,any,array,bigint,boolean,botIdHeader,botUserIdHeader,coerce,configurationHeader,configurationTypeHeader,conversation,createZodEnum,cuid2Regex,cuidRegex,custom,datasource,date,datetimeRegex,defaultComponentDefinitions,discriminatedUnion,effect,emailRegex,enum:null,errorUtil,event,fromJsonSchema,fromObject,function:null,getErrorMap,getParsedType,instanceof:null,integrationIdHeader,intent,intersection,ipv4Regex,ipv6Regex,isAborted,isApiError,isAsync,isDirty,isEmojiRegex,isValid,jsonSchemaToZui,knowledgebase,late,lazy,literal,makeIssue,map,mergeObjectSchemas,message,messages,nan,nativeEnum,never,null:null,nullable,number,object,objectToZui,objectUtil,oboolean,onumber,operationHeader,optional,ostring,parseBody,pipeline,preprocess,processCreateParams,promise,quotelessJson,readonly,record,ref,serve,set,setErrorMap,strictObject,string,symbol,table,tablerow,transformer,transforms,tuple,typeHeader,ulidRegex,undefined,union,unknown,user,util,uuidRegex,variable,void:null,webhookIdHeader,withErrorBoundary,z,zuiToJsonSchema});
90
90
  /*! Bundled license information:
91
91
 
92
92
  react/cjs/react.production.min.js: