@n8x/react-form-utils 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import e,{createElement as t,createContext as a,useContext as n,useMemo as r,useEffect as s,useReducer as i}from"react";import o from"axios";var d,c={exports:{}},u={};var l,p,h={};
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.development.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */function f(){return l||(l=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===j?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case m:return"Fragment";case v:return"Profiler";case y:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList";case S:return"Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case f:return"Portal";case _:return e.displayName||"Context";case g:return(e._context.displayName||"Context")+".Consumer";case b:var a=e.render;return(e=e.displayName)||(e=""!==(e=a.displayName||a.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case w:return null!==(a=e.displayName||null)?a:t(e.type)||"Memo";case O:a=e._payload,e=e._init;try{return t(e(a))}catch(e){}}return null}function a(e){return""+e}function n(e){try{a(e);var t=!1}catch(e){t=!0}if(t){var n=(t=console).error,r="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",r),a(e)}}function r(e){if(e===m)return"<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return"<...>";try{var a=t(e);return a?"<"+a+">":"<...>"}catch(e){return"<...>"}}function s(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return C[e]||(C[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function o(e,a,r,s,o,c){var l,h=a.children;if(void 0!==h)if(s)if(N(h)){for(s=0;s<h.length;s++)d(h[s]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(h);if(T.call(a,"key")){h=t(e);var f=Object.keys(a).filter(function(e){return"key"!==e});s=0<f.length?"{key: someKey, "+f.join(": ..., ")+": ...}":"{key: someKey}",I[h+s]||(f=0<f.length?"{"+f.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',s,h,f,h),I[h+s]=!0)}if(h=null,void 0!==r&&(n(r),h=""+r),function(e){if(T.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(a)&&(n(a.key),h=""+a.key),"key"in a)for(var m in r={},a)"key"!==m&&(r[m]=a[m]);else r=a;return h&&function(e,t){function a(){u||(u=!0,console.error("%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://react.dev/link/special-props)",t))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}(r,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,t,a,n,r,s){var o=a.ref;return e={$$typeof:p,type:e,key:t,props:a,_owner:n},null!==(void 0!==o?o:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:i}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:r}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:s}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,h,r,null===(l=Z.A)?null:l.getOwner(),o,c)}function d(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===p}var u,l=e,p=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),_=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),Z=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,N=Array.isArray,A=console.createTask?console.createTask:function(){return null},C={},E=(l={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(l,s)(),R=A(r(s)),I={};h.Fragment=m,h.jsx=function(e,t,a){var n=1e4>Z.recentlyCreatedOwnerStacks++;return o(e,t,a,!1,n?Error("react-stack-top-frame"):E,n?A(r(e)):R)},h.jsxs=function(e,t,a){var n=1e4>Z.recentlyCreatedOwnerStacks++;return o(e,t,a,!0,n?Error("react-stack-top-frame"):E,n?A(r(e)):R)}}()),h}var m,y,v,g=(p||(p=1,"production"===process.env.NODE_ENV?c.exports=function(){if(d)return u;d=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(t,a,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==a.key&&(r=""+a.key),"key"in a)for(var s in n={},a)"key"!==s&&(n[s]=a[s]);else n=a;return a=n.ref,{$$typeof:e,type:t,key:r,ref:void 0!==a?a:null,props:n}}return u.Fragment=t,u.jsx=a,u.jsxs=a,u}():c.exports=f()),c.exports);!function(e){e.CLEAN="\n w-full\n bg-white\n border border-zinc-300\n rounded-lg\n px-4 py-2.5\n text-sm\n text-zinc-800\n placeholder:text-zinc-400\n outline-none\n transition-all\n focus:border-zinc-900\n focus:ring-2\n focus:ring-zinc-900/10\n ",e.SOFT_GLASS="\n w-full\n bg-zinc-50\n border border-zinc-200\n rounded-xl\n px-4 py-2.5\n text-sm\n text-zinc-800\n placeholder:text-zinc-400\n outline-none\n transition-all duration-200\n focus:bg-white\n focus:border-zinc-900\n focus:ring-4\n focus:ring-zinc-900/5\n ",e.DARK="\n w-full\n bg-zinc-900\n border border-zinc-700\n rounded-lg\n px-4 py-2.5\n text-sm\n text-zinc-100\n placeholder:text-zinc-500\n outline-none\n transition-all\n focus:border-zinc-400\n focus:ring-2\n focus:ring-zinc-400/20\n ",e.FLOATING_LABEL="\n peer\n w-full\n bg-transparent\n border-b border-zinc-300\n px-0 py-2\n text-sm\n text-zinc-800\n placeholder-transparent\n outline-none\n transition-all\n focus:border-zinc-900\n "}(m||(m={})),function(e){e.TEXT="text",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.SELECT="select",e.RADIO="radio",e.CHECKBOX="checkbox",e.TEXTAREA="textarea",e.DATE="date",e.FILE="file",e.SUBMIT="submit"}(y||(y={})),function(e){e.FULL="col-span-4",e.HALF="col-span-2",e.THIRD="col-span-3",e.QUARTER="col-span-1"}(v||(v={}));var _=function(){return _=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var r in t=arguments[a])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},_.apply(this,arguments)};function b(e,t,a,n){return new(a||(a=Promise))(function(r,s){function i(e){try{d(n.next(e))}catch(e){s(e)}}function o(e){try{d(n.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(i,o)}d((n=n.apply(e,t||[])).next())})}function x(e,t){var a,n,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(d){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(s=0)),s;)try{if(a=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{a=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,d])}}}function k(e,t,a){if(a||2===arguments.length)for(var n,r=0,s=t.length;r<s;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var w,O,S=function(e,a,n,r,s){var i,o,d,c,u,l,p,h;switch(e.type){case"select":return g.jsxs("div",{className:"".concat(e.width||""," flex flex-col gap-1"),children:[e.label&&g.jsx("label",{htmlFor:e.name,children:e.label}),g.jsxs("select",_({defaultValue:e.default,className:"".concat(e._className||a),required:e.required},n(e.name),{children:[null===(i=e.options)||void 0===i?void 0:i.map(function(e){return g.jsx("option",{value:e.value,children:e.label},e.value)}),r&&Object.keys(r).includes(e.name)?g.jsx("p",{className:"text-red-500 text-sm",children:null===(o=r[e.name])||void 0===o?void 0:o.message}):""]}),e.name)]},e.name);case"radio":return g.jsxs("div",{className:"".concat(e.width||""," flex flex-col gap-1"),children:[e.label&&g.jsx("label",{children:e.label}),g.jsxs("div",{className:"flex gap-4 flex-wra text-sm",children:[null===(d=e.options)||void 0===d?void 0:d.map(function(t){return g.jsxs("label",{className:"flex items-center gap-1 border border-zinc-200 rounded-full px-2 py-1",children:[g.jsx("input",_({},n(e.name),{type:"radio",name:e.name,value:t.value,required:e.required})),t.label]},t.value)}),r&&Object.keys(r).includes(e.name)?g.jsx("p",{className:"text-red-500 text-sm",children:null===(c=r[e.name])||void 0===c?void 0:c.message}):""]})]},e.name);case"checkbox":return g.jsxs("div",{className:"".concat(e.width||""," flex flex-col gap-1"),children:[e.label&&g.jsx("label",{children:e.label}),g.jsxs("div",{className:"flex gap-4 flex-wrap text-sm",children:[null===(u=e.options)||void 0===u?void 0:u.map(function(t){return g.jsxs("label",{className:"flex items-center gap-1 border border-zinc-200 rounded-full px-2 py-1",children:[g.jsx("input",_({},n(e.name),{type:"checkbox",name:e.name,value:t.value})),t.label]},t.value)}),r&&Object.keys(r).includes(e.name)?g.jsx("p",{className:"text-red-500 text-sm",children:null===(l=r[e.name])||void 0===l?void 0:l.message}):""]})]},e.name);case"textarea":return g.jsxs("div",{className:"".concat(e.width||""," flex flex-col gap-1"),children:[e.label&&g.jsx("label",{htmlFor:e.name,children:e.label}),t("textarea",_({},n(e.name),{key:e.name,name:e.name,defaultValue:e.default,className:"".concat(e._className||a," resize-none"),placeholder:e.placeholder,required:e.required})),r&&Object.keys(r).includes(e.name)?g.jsx("p",{className:"text-red-500 text-sm",children:null===(p=r[e.name])||void 0===p?void 0:p.message}):""]},e.name);case"submit":return g.jsx("div",{className:"".concat(s?e.width+"bg-zinc-400":e.width||""," flex flex-col gap-1"),children:g.jsx("button",{disabled:s,type:"submit",className:"".concat(e._className||a," flex justify-center items-center"),children:s?g.jsx("p",{className:"w-4 h-4 p-1 border-2 border-t-0 animate-spin rounded-full"}):e.label||"Submit"})},e.name);default:return g.jsxs("div",{className:"".concat(e.width||""," flex flex-col gap-1"),children:[e.label&&g.jsx("label",{htmlFor:e.name,children:e.label}),t("input",_({},n(e.name),{key:e.name,name:e.name,defaultValue:e.default,min:e.min,max:e.max,type:e.type,className:"".concat(e._className||a),placeholder:e.placeholder,required:e.required})),r&&Object.keys(r).includes(e.name)?g.jsx("p",{className:"text-red-500 text-sm",children:null===(h=r[e.name])||void 0===h?void 0:h.message}):""]},e.name)}},j=a(null);!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(w||(w={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(O||(O={}));const Z=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:null===e?Z.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Z.promise:"undefined"!=typeof Map&&e instanceof Map?Z.map:"undefined"!=typeof Set&&e instanceof Set?Z.set:"undefined"!=typeof Date&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}},N=w.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"]);class A extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,n=0;for(;n<r.path.length;){const a=r.path[n];n===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(e){if(!(e instanceof A))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t=Object.create(null),a=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}A.create=e=>new A(e);const C=(e,t)=>{let a;switch(e.code){case N.invalid_type:a=e.received===Z.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case N.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,w.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:a=`Unrecognized key(s) in object: ${w.joinValues(e.keys,", ")}`;break;case N.invalid_union:a="Invalid input";break;case N.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${w.joinValues(e.options)}`;break;case N.invalid_enum_value:a=`Invalid enum value. Expected ${w.joinValues(e.options)}, received '${e.received}'`;break;case N.invalid_arguments:a="Invalid function arguments";break;case N.invalid_return_type:a="Invalid function return type";break;case N.invalid_date:a="Invalid date";break;case N.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:w.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case N.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case N.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case N.custom:a="Invalid input";break;case N.invalid_intersection_types:a="Intersection results could not be merged";break;case N.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case N.not_finite:a="Number must be finite";break;default:a=t.defaultError,w.assertNever(e)}return{message:a}};let E=C;function R(){return E}const I=e=>{const{data:t,path:a,errorMaps:n,issueData:r}=e,s=[...a,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const d=n.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}};function P(e,t){const a=R(),n=I({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===C?void 0:C].filter(e=>!!e)});e.common.issues.push(n)}class ${constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return L;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return $.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return L;if("aborted"===r.status)return L;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const L=Object.freeze({status:"aborted"}),z=e=>({status:"dirty",value:e}),F=e=>({status:"valid",value:e}),M=e=>"aborted"===e.status,D=e=>"dirty"===e.status,U=e=>"valid"===e.status,V=e=>"undefined"!=typeof Promise&&e instanceof Promise;var K;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(K||(K={}));class B{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const q=(e,t)=>{if(U(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new A(e.common.issues);return this._error=t,this._error}}};function W(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:r}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??r.defaultError}:void 0===r.data?{message:s??n??r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:s??a??r.defaultError}},description:r}}class J{get description(){return this._def.description}_getType(e){return T(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(V(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},n=this._parseSync({data:e,path:a.path,parent:a});return q(a,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return U(a)?{value:a.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>U(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},n=this._parse({data:e,path:a.path,parent:a}),r=await(V(n)?n:Promise.resolve(n));return q(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const r=e(t),s=()=>n.addIssue({code:N.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!1)})}refinement(e,t){return this._refinement((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1))}_refinement(e){return new Ge({schema:this,typeName:ct.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Xe.create(this,this._def)}nullable(){return Ye.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ce.create(this)}promise(){return He.create(this,this._def)}or(e){return Ie.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new Ge({...W(this._def),schema:this,typeName:ct.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Qe({...W(this._def),innerType:this,defaultValue:t,typeName:ct.ZodDefault})}brand(){return new nt({typeName:ct.ZodBranded,type:this,...W(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new et({...W(this._def),innerType:this,catchValue:t,typeName:ct.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return rt.create(this,e)}readonly(){return st.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const H=/^c[^\s-]{8,}$/i,G=/^[0-9a-z]+$/,X=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Y=/^[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,Q=/^[a-z0-9_-]{21}$/i,ee=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,te=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ne;const re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,se=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ie=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,oe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,de=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ue="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",le=new RegExp(`^${ue}$`);function pe(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function he(e){return new RegExp(`^${pe(e)}$`)}function fe(e){let t=`${ue}T${pe(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function me(e,t){return!("v4"!==t&&t||!re.test(e))||!("v6"!==t&&t||!ie.test(e))}function ye(e,t){if(!ee.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(n));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===r?.typ)&&(!!r.alg&&(!t||r.alg===t)))}catch{return!1}}function ve(e,t){return!("v4"!==t&&t||!se.test(e))||!("v6"!==t&&t||!oe.test(e))}class ge extends J{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Z.string){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.string,received:t.parsedType}),L}const t=new $;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:N.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:N.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const r=e.data.length>n.value,s=e.data.length<n.value;(r||s)&&(a=this._getOrReturnCtx(e,a),r?P(a,{code:N.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&P(a,{code:N.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)ae.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"email",code:N.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)ne||(ne=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ne.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"emoji",code:N.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)Y.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"uuid",code:N.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)Q.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"nanoid",code:N.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)H.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid",code:N.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)G.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid2",code:N.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)X.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ulid",code:N.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),P(a,{validation:"url",code:N.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"regex",code:N.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){fe(n).test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){le.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){he(n).test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:N.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?te.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"duration",code:N.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?me(e.data,n.version)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ip",code:N.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?ye(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"jwt",code:N.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ve(e.data,n.version)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cidr",code:N.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?de.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"base64",code:N.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?ce.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"base64url",code:N.invalid_string,message:n.message}),t.dirty()):w.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:N.invalid_string,...K.errToObj(a)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...K.errToObj(e)})}url(e){return this._addCheck({kind:"url",...K.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...K.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...K.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...K.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...K.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...K.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...K.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...K.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...K.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...K.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...K.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...K.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...K.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...K.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...K.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...K.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...K.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...K.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...K.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...K.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...K.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...K.errToObj(t)})}nonempty(e){return this.min(1,K.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function _e(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ge.create=e=>new ge({checks:[],typeName:ct.ZodString,coerce:e?.coerce??!1,...W(e)});class be extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Z.number){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.number,received:t.parsedType}),L}let t;const a=new $;for(const n of this._def.checks)if("int"===n.kind)w.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),P(t,{code:N.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==_e(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),P(t,{code:N.not_finite,message:n.message}),a.dirty()):w.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,K.toString(t))}gt(e,t){return this.setLimit("min",e,!1,K.toString(t))}lte(e,t){return this.setLimit("max",e,!0,K.toString(t))}lt(e,t){return this.setLimit("max",e,!1,K.toString(t))}setLimit(e,t,a,n){return new be({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:K.toString(n)}]})}_addCheck(e){return new be({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:K.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:K.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:K.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}be.create=e=>new be({checks:[],typeName:ct.ZodNumber,coerce:e?.coerce||!1,...W(e)});class xe extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Z.bigint)return this._getInvalidInput(e);let t;const a=new $;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),P(t,{code:N.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):w.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,K.toString(t))}gt(e,t){return this.setLimit("min",e,!1,K.toString(t))}lte(e,t){return this.setLimit("max",e,!0,K.toString(t))}lt(e,t){return this.setLimit("max",e,!1,K.toString(t))}setLimit(e,t,a,n){return new xe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:K.toString(n)}]})}_addCheck(e){return new xe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:K.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}xe.create=e=>new xe({checks:[],typeName:ct.ZodBigInt,coerce:e?.coerce??!1,...W(e)});class ke extends J{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Z.boolean){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.boolean,received:t.parsedType}),L}return F(e.data)}}ke.create=e=>new ke({typeName:ct.ZodBoolean,coerce:e?.coerce||!1,...W(e)});class we extends J{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Z.date){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.date,received:t.parsedType}),L}if(Number.isNaN(e.data.getTime())){return P(this._getOrReturnCtx(e),{code:N.invalid_date}),L}const t=new $;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:N.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:N.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):w.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new we({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:K.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:K.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}we.create=e=>new we({checks:[],coerce:e?.coerce||!1,typeName:ct.ZodDate,...W(e)});class Oe extends J{_parse(e){if(this._getType(e)!==Z.symbol){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.symbol,received:t.parsedType}),L}return F(e.data)}}Oe.create=e=>new Oe({typeName:ct.ZodSymbol,...W(e)});class Se extends J{_parse(e){if(this._getType(e)!==Z.undefined){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.undefined,received:t.parsedType}),L}return F(e.data)}}Se.create=e=>new Se({typeName:ct.ZodUndefined,...W(e)});class je extends J{_parse(e){if(this._getType(e)!==Z.null){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.null,received:t.parsedType}),L}return F(e.data)}}je.create=e=>new je({typeName:ct.ZodNull,...W(e)});class Ze extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}}Ze.create=e=>new Ze({typeName:ct.ZodAny,...W(e)});class Te extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}}Te.create=e=>new Te({typeName:ct.ZodUnknown,...W(e)});class Ne extends J{_parse(e){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.never,received:t.parsedType}),L}}Ne.create=e=>new Ne({typeName:ct.ZodNever,...W(e)});class Ae extends J{_parse(e){if(this._getType(e)!==Z.undefined){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.void,received:t.parsedType}),L}return F(e.data)}}Ae.create=e=>new Ae({typeName:ct.ZodVoid,...W(e)});class Ce extends J{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==Z.array)return P(t,{code:N.invalid_type,expected:Z.array,received:t.parsedType}),L;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(P(t,{code:e?N.too_big:N.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(P(t,{code:N.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(P(t,{code:N.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new B(t,e,t.path,a)))).then(e=>$.mergeArray(a,e));const r=[...t.data].map((e,a)=>n.type._parseSync(new B(t,e,t.path,a)));return $.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new Ce({...this._def,minLength:{value:e,message:K.toString(t)}})}max(e,t){return new Ce({...this._def,maxLength:{value:e,message:K.toString(t)}})}length(e,t){return new Ce({...this._def,exactLength:{value:e,message:K.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ee(e){if(e instanceof Re){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=Xe.create(Ee(n))}return new Re({...e._def,shape:()=>t})}return e instanceof Ce?new Ce({...e._def,type:Ee(e.element)}):e instanceof Xe?Xe.create(Ee(e.unwrap())):e instanceof Ye?Ye.create(Ee(e.unwrap())):e instanceof Fe?Fe.create(e.items.map(e=>Ee(e))):e}Ce.create=(e,t)=>new Ce({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ct.ZodArray,...W(t)});class Re extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=w.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Z.object){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.object,received:t.parsedType}),L}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ne&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=n[e],r=a.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new B(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof Ne){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)s.length>0&&(P(a,{code:N.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new B(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>$.mergeObjectSync(t,e)):$.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return K.errToObj,new Re({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const n=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:K.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Re({...this._def,unknownKeys:"strip"})}passthrough(){return new Re({...this._def,unknownKeys:"passthrough"})}extend(e){return new Re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ct.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Re({...this._def,catchall:e})}pick(e){const t={};for(const a of w.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new Re({...this._def,shape:()=>t})}omit(e){const t={};for(const a of w.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new Re({...this._def,shape:()=>t})}deepPartial(){return Ee(this)}partial(e){const t={};for(const a of w.objectKeys(this.shape)){const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new Re({...this._def,shape:()=>t})}required(e){const t={};for(const a of w.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Xe;)e=e._def.innerType;t[a]=e}return new Re({...this._def,shape:()=>t})}keyof(){return qe(w.objectKeys(this.shape))}}Re.create=(e,t)=>new Re({shape:()=>e,unknownKeys:"strip",catchall:Ne.create(),typeName:ct.ZodObject,...W(t)}),Re.strictCreate=(e,t)=>new Re({shape:()=>e,unknownKeys:"strict",catchall:Ne.create(),typeName:ct.ZodObject,...W(t)}),Re.lazycreate=(e,t)=>new Re({shape:e,unknownKeys:"strip",catchall:Ne.create(),typeName:ct.ZodObject,...W(t)});class Ie extends J{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new A(e.ctx.common.issues));return P(t,{code:N.invalid_union,unionErrors:a}),L});{let e;const n=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map(e=>new A(e));return P(t,{code:N.invalid_union,unionErrors:r}),L}}get options(){return this._def.options}}Ie.create=(e,t)=>new Ie({options:e,typeName:ct.ZodUnion,...W(t)});const Pe=e=>e instanceof Ke?Pe(e.schema):e instanceof Ge?Pe(e.innerType()):e instanceof Be?[e.value]:e instanceof We?e.options:e instanceof Je?w.objectValues(e.enum):e instanceof Qe?Pe(e._def.innerType):e instanceof Se?[void 0]:e instanceof je?[null]:e instanceof Xe?[void 0,...Pe(e.unwrap())]:e instanceof Ye?[null,...Pe(e.unwrap())]:e instanceof nt||e instanceof st?Pe(e.unwrap()):e instanceof et?Pe(e._def.innerType):[];class $e extends J{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Z.object)return P(t,{code:N.invalid_type,expected:Z.object,received:t.parsedType}),L;const a=this.discriminator,n=t.data[a],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(P(t,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const n=new Map;for(const a of t){const t=Pe(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(n.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);n.set(r,a)}}return new $e({typeName:ct.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...W(a)})}}function Le(e,t){const a=T(e),n=T(t);if(e===t)return{valid:!0,data:e};if(a===Z.object&&n===Z.object){const a=w.objectKeys(t),n=w.objectKeys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const a of n){const n=Le(e[a],t[a]);if(!n.valid)return{valid:!1};r[a]=n.data}return{valid:!0,data:r}}if(a===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const r=Le(e[n],t[n]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===Z.date&&n===Z.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class ze extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(M(e)||M(n))return L;const r=Le(e.value,n.value);return r.valid?((D(e)||D(n))&&t.dirty(),{status:t.value,value:r.data}):(P(a,{code:N.invalid_intersection_types}),L)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ze.create=(e,t,a)=>new ze({left:e,right:t,typeName:ct.ZodIntersection,...W(a)});class Fe extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Z.array)return P(a,{code:N.invalid_type,expected:Z.array,received:a.parsedType}),L;if(a.data.length<this._def.items.length)return P(a,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&a.data.length>this._def.items.length&&(P(a,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new B(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>$.mergeArray(t,e)):$.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Fe({...this._def,rest:e})}}Fe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fe({items:e,typeName:ct.ZodTuple,rest:null,...W(t)})};class Me extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Z.object)return P(a,{code:N.invalid_type,expected:Z.object,received:a.parsedType}),L;const n=[],r=this._def.keyType,s=this._def.valueType;for(const e in a.data)n.push({key:r._parse(new B(a,e,a.path,e)),value:s._parse(new B(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?$.mergeObjectAsync(t,n):$.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return new Me(t instanceof J?{keyType:e,valueType:t,typeName:ct.ZodRecord,...W(a)}:{keyType:ge.create(),valueType:e,typeName:ct.ZodRecord,...W(t)})}}class De extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Z.map)return P(a,{code:N.invalid_type,expected:Z.map,received:a.parsedType}),L;const n=this._def.keyType,r=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:n._parse(new B(a,e,a.path,[s,"key"])),value:r._parse(new B(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const n=await a.key,r=await a.value;if("aborted"===n.status||"aborted"===r.status)return L;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const n=a.key,r=a.value;if("aborted"===n.status||"aborted"===r.status)return L;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}}De.create=(e,t,a)=>new De({valueType:t,keyType:e,typeName:ct.ZodMap,...W(a)});class Ue extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Z.set)return P(a,{code:N.invalid_type,expected:Z.set,received:a.parsedType}),L;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(P(a,{code:N.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(P(a,{code:N.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const a=new Set;for(const n of e){if("aborted"===n.status)return L;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map((e,t)=>r._parse(new B(a,e,a.path,t)));return a.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new Ue({...this._def,minSize:{value:e,message:K.toString(t)}})}max(e,t){return new Ue({...this._def,maxSize:{value:e,message:K.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ue.create=(e,t)=>new Ue({valueType:e,minSize:null,maxSize:null,typeName:ct.ZodSet,...W(t)});class Ve extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Z.function)return P(t,{code:N.invalid_type,expected:Z.function,received:t.parsedType}),L;function a(e,a){return I({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,R(),C].filter(e=>!!e),issueData:{code:N.invalid_arguments,argumentsError:a}})}function n(e,a){return I({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,R(),C].filter(e=>!!e),issueData:{code:N.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof He){const e=this;return F(async function(...t){const i=new A([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw i.addIssue(a(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,r).catch(e=>{throw i.addIssue(n(d,e)),i})})}{const e=this;return F(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new A([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,r);if(!d.success)throw new A([n(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ve({...this._def,args:Fe.create(e).rest(Te.create())})}returns(e){return new Ve({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new Ve({args:e||Fe.create([]).rest(Te.create()),returns:t||Te.create(),typeName:ct.ZodFunction,...W(a)})}}class Ke extends J{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ke.create=(e,t)=>new Ke({getter:e,typeName:ct.ZodLazy,...W(t)});class Be extends J{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return P(t,{received:t.data,code:N.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}}function qe(e,t){return new We({values:e,typeName:ct.ZodEnum,...W(t)})}Be.create=(e,t)=>new Be({value:e,typeName:ct.ZodLiteral,...W(t)});class We extends J{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return P(t,{expected:w.joinValues(a),received:t.parsedType,code:N.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return P(t,{received:t.data,code:N.invalid_enum_value,options:a}),L}return F(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return We.create(e,{...this._def,...t})}exclude(e,t=this._def){return We.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}We.create=qe;class Je extends J{_parse(e){const t=w.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Z.string&&a.parsedType!==Z.number){const e=w.objectValues(t);return P(a,{expected:w.joinValues(e),received:a.parsedType,code:N.invalid_type}),L}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=w.objectValues(t);return P(a,{received:a.data,code:N.invalid_enum_value,options:e}),L}return F(e.data)}get enum(){return this._def.values}}Je.create=(e,t)=>new Je({values:e,typeName:ct.ZodNativeEnum,...W(t)});class He extends J{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Z.promise&&!1===t.common.async)return P(t,{code:N.invalid_type,expected:Z.promise,received:t.parsedType}),L;const a=t.parsedType===Z.promise?t.data:Promise.resolve(t.data);return F(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}He.create=(e,t)=>new He({type:e,typeName:ct.ZodPromise,...W(t)});class Ge extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{P(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return L;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?L:"dirty"===n.status||"dirty"===t.value?z(n.value):n});{if("aborted"===t.value)return L;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?L:"dirty"===n.status||"dirty"===t.value?z(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?L:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?L:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!U(e))return L;const s=n.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>U(e)?Promise.resolve(n.transform(e.value,r)).then(e=>({status:t.value,value:e})):L)}w.assertNever(n)}}Ge.create=(e,t,a)=>new Ge({schema:e,typeName:ct.ZodEffects,effect:t,...W(a)}),Ge.createWithPreprocess=(e,t,a)=>new Ge({schema:t,effect:{type:"preprocess",transform:e},typeName:ct.ZodEffects,...W(a)});class Xe extends J{_parse(e){return this._getType(e)===Z.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xe.create=(e,t)=>new Xe({innerType:e,typeName:ct.ZodOptional,...W(t)});class Ye extends J{_parse(e){return this._getType(e)===Z.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ye.create=(e,t)=>new Ye({innerType:e,typeName:ct.ZodNullable,...W(t)});class Qe extends J{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===Z.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Qe.create=(e,t)=>new Qe({innerType:e,typeName:ct.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...W(t)});class et extends J{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return V(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new A(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new A(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}et.create=(e,t)=>new et({innerType:e,typeName:ct.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...W(t)});class tt extends J{_parse(e){if(this._getType(e)!==Z.nan){const t=this._getOrReturnCtx(e);return P(t,{code:N.invalid_type,expected:Z.nan,received:t.parsedType}),L}return{status:"valid",value:e.data}}}tt.create=e=>new tt({typeName:ct.ZodNaN,...W(e)});const at=Symbol("zod_brand");class nt extends J{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class rt extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?L:"dirty"===e.status?(t.dirty(),z(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?L:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new rt({in:e,out:t,typeName:ct.ZodPipeline})}}class st extends J{_parse(e){const t=this._def.innerType._parse(e),a=e=>(U(e)&&(e.value=Object.freeze(e.value)),e);return V(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}function it(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function ot(e,t={},a){return e?Ze.create().superRefine((n,r)=>{const s=e(n);if(s instanceof Promise)return s.then(e=>{if(!e){const e=it(t,n),s=e.fatal??a??!0;r.addIssue({code:"custom",...e,fatal:s})}});if(!s){const e=it(t,n),s=e.fatal??a??!0;r.addIssue({code:"custom",...e,fatal:s})}}):Ze.create()}st.create=(e,t)=>new st({innerType:e,typeName:ct.ZodReadonly,...W(t)});const dt={object:Re.lazycreate};var ct;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ct||(ct={}));const ut=ge.create,lt=be.create,pt=tt.create,ht=xe.create,ft=ke.create,mt=we.create,yt=Oe.create,vt=Se.create,gt=je.create,_t=Ze.create,bt=Te.create,xt=Ne.create,kt=Ae.create,wt=Ce.create,Ot=Re.create,St=Re.strictCreate,jt=Ie.create,Zt=$e.create,Tt=ze.create,Nt=Fe.create,At=Me.create,Ct=De.create,Et=Ue.create,Rt=Ve.create,It=Ke.create,Pt=Be.create,$t=We.create,Lt=Je.create,zt=He.create,Ft=Ge.create,Mt=Xe.create,Dt=Ye.create,Ut=Ge.createWithPreprocess,Vt=rt.create,Kt={string:e=>ge.create({...e,coerce:!0}),number:e=>be.create({...e,coerce:!0}),boolean:e=>ke.create({...e,coerce:!0}),bigint:e=>xe.create({...e,coerce:!0}),date:e=>we.create({...e,coerce:!0})},Bt=L;var qt=Object.freeze({__proto__:null,BRAND:at,DIRTY:z,EMPTY_PATH:[],INVALID:L,NEVER:Bt,OK:F,ParseStatus:$,Schema:J,ZodAny:Ze,ZodArray:Ce,ZodBigInt:xe,ZodBoolean:ke,ZodBranded:nt,ZodCatch:et,ZodDate:we,ZodDefault:Qe,ZodDiscriminatedUnion:$e,ZodEffects:Ge,ZodEnum:We,ZodError:A,get ZodFirstPartyTypeKind(){return ct},ZodFunction:Ve,ZodIntersection:ze,ZodIssueCode:N,ZodLazy:Ke,ZodLiteral:Be,ZodMap:De,ZodNaN:tt,ZodNativeEnum:Je,ZodNever:Ne,ZodNull:je,ZodNullable:Ye,ZodNumber:be,ZodObject:Re,ZodOptional:Xe,ZodParsedType:Z,ZodPipeline:rt,ZodPromise:He,ZodReadonly:st,ZodRecord:Me,ZodSchema:J,ZodSet:Ue,ZodString:ge,ZodSymbol:Oe,ZodTransformer:Ge,ZodTuple:Fe,ZodType:J,ZodUndefined:Se,ZodUnion:Ie,ZodUnknown:Te,ZodVoid:Ae,addIssueToContext:P,any:_t,array:wt,bigint:ht,boolean:ft,coerce:Kt,custom:ot,date:mt,datetimeRegex:fe,defaultErrorMap:C,discriminatedUnion:Zt,effect:Ft,enum:$t,function:Rt,getErrorMap:R,getParsedType:T,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ot(t=>t instanceof e,t),intersection:Tt,isAborted:M,isAsync:V,isDirty:D,isValid:U,late:dt,lazy:It,literal:Pt,makeIssue:I,map:Ct,nan:pt,nativeEnum:Lt,never:xt,null:gt,nullable:Dt,number:lt,object:Ot,get objectUtil(){return O},oboolean:()=>ft().optional(),onumber:()=>lt().optional(),optional:Mt,ostring:()=>ut().optional(),pipeline:Vt,preprocess:Ut,promise:zt,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),record:At,set:Et,setErrorMap:function(e){E=e},strictObject:St,string:ut,symbol:yt,transformer:Ft,tuple:Nt,undefined:vt,union:jt,unknown:bt,get util(){return w},void:kt}),Wt=function(e){var t=e.fields,a=e.defaultFieldStyles,i=e.onShubmit,o=e.mode,d=e.children,c=n(j),u=c.setMode,l=c.formUtils,p=c.setValidationSchema,h=l.register,f=l.handleSubmit,y=l.formState,v=y.errors,_=y.isSubmitting,b=Object.keys(t),x=!Array.isArray(t),k=a||m.SOFT_GLASS,w=r(function(){return x?b.flatMap(function(e){return t[e]}):t},[t,x,b]),O=r(function(){var e=Object.fromEntries(w.filter(function(e){return!!e.validationScheme}).map(function(e){return[e.name,e.validationScheme]}));return qt.object(e)},[w]);return s(function(){p(O),u(o||"onChange")},[O,o]),s(function(){l.reset()},[t,l]),g.jsx("div",{className:"w-full py-4",children:g.jsxs("form",{className:"grid grid-cols-4 gap-4",onSubmit:f(i),children:[x?b.map(function(e,a){return g.jsxs("div",{className:" grid grid-cols-4 gap-4 col-span-4",children:[g.jsx("h1",{className:"col-span-4 border-b border-zinc-200 py-2 text-xl",children:e}),t[e].map(function(e){return S(e,k,h,v,_)})]},a)}):t.map(function(e){return S(e,k,h,v,_)}),d]})})},Jt={isLoading:!1,error:"",data:null},Ht=function(e,t){switch(t.type){case"CALL":return _(_({},e),{isLoading:!0,error:""});case"ERROR":return _(_({},e),{isLoading:!1,error:t.payload});case"SUCCESS":return _(_({},e),{isLoading:!1,data:t.payload});default:return e}},Gt=function(e){var t=i(Ht,Jt),a=t[0],n=t[1];return _(_({},a),{execute:function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return b(void 0,void 0,void 0,function(){var a,r,s,i,d,c,u,l,p,h;return x(this,function(f){switch(f.label){case 0:a=new AbortController,n({type:"CALL"}),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.apply(void 0,k(k([],t,!1),[{signal:a.signal}],!1))];case 2:return r=f.sent(),n({type:"SUCCESS",payload:r.data}),[3,4];case 3:return s=f.sent(),i="",o.isAxiosError(s)?i=Array.isArray(null===(d=s.response)||void 0===d?void 0:d.data.message)?null===(l=null===(u=null===(c=s.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||void 0===l?void 0:l[0]:(null===(h=null===(p=s.response)||void 0===p?void 0:p.data)||void 0===h?void 0:h.message)||s.message:s instanceof Error&&(i=s.message),o.isCancel(s)?(n({type:"ERROR",payload:"Request Canceled"}),[2]):(s instanceof Error&&n({type:"ERROR",payload:i}),[3,4]);case 4:return[2,function(){return a.abort()}]}})})}})},Xt={isLoading:!1,error:"",data:null},Yt=function(e,t){switch(t.type){case"CALL":return _(_({},e),{isLoading:!0,error:""});case"ERROR":return _(_({},e),{isLoading:!1,error:t.payload});case"SUCCESS":return _(_({},e),{isLoading:!1,data:t.payload});default:return e}},Qt=function(e){for(var t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];var n=i(Yt,Xt),r=n[0],d=n[1];return s(function(){var a=new AbortController;return d({type:"CALL"}),b(void 0,void 0,void 0,function(){var n,r,s,i,c,u,l,p,h;return x(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,e.apply(void 0,k(k([],t,!1),[{signal:a.signal}],!1))];case 1:return n=f.sent(),d({type:"SUCCESS",payload:n.data}),[3,3];case 2:return r=f.sent(),s="",o.isAxiosError(r)?s=Array.isArray(null===(i=r.response)||void 0===i?void 0:i.data.message)?null===(l=null===(u=null===(c=r.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||void 0===l?void 0:l[0]:(null===(h=null===(p=r.response)||void 0===p?void 0:p.data)||void 0===h?void 0:h.message)||r.message:r instanceof Error&&(s=r.message),o.isCancel(r)?(d({type:"ERROR",payload:"Request Canceled"}),[2]):(r instanceof Error&&d({type:"ERROR",payload:s}),[3,3]);case 3:return[2]}})}),function(){return a.abort()}},[]),_({},r)};export{m as EDefaultFieldStyles,j as FormContext,y as FormFieldTypes,v as FormFieldWidth,Wt as N8xForm,Gt as useN8xFormQuery,Qt as useN8xQuery,qt as z};
11
+ //# sourceMappingURL=index.mjs.map