@twintag/twintag-form 1.5.0 → 1.6.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/.turbo/turbo-build.log +9 -10
- package/CHANGELOG.md +12 -0
- package/dist/common/button.d.ts +5 -86
- package/dist/common/calendar.d.ts +3 -81
- package/dist/common/form.d.ts +11 -91
- package/dist/common/input.d.ts +4 -149
- package/dist/common/label.d.ts +2 -23
- package/dist/common/textarea.d.ts +2 -75
- package/dist/components/containers/accordion.d.ts +1 -1
- package/dist/components/fields/date-picker.d.ts +1 -2
- package/dist/components/form.d.ts +2 -2
- package/dist/components/provider.d.ts +4 -4
- package/dist/index.cjs +1 -0
- package/dist/index.js +4456 -0
- package/dist/webcomponent.cjs +1 -1
- package/dist/webcomponent.js +140 -3736
- package/lib/common/button.tsx +6 -6
- package/lib/common/calendar.tsx +11 -10
- package/lib/common/checkbox.tsx +3 -3
- package/lib/common/form.tsx +3 -3
- package/lib/common/icon.tsx +1 -1
- package/lib/common/input.tsx +4 -4
- package/lib/common/label.tsx +1 -1
- package/lib/common/popover.tsx +1 -1
- package/lib/common/radiogroup.tsx +2 -2
- package/lib/common/slider.tsx +3 -3
- package/lib/common/switch.tsx +3 -3
- package/lib/common/textarea.tsx +3 -3
- package/lib/components/containers/accordion.tsx +1 -1
- package/lib/components/containers/category.tsx +1 -1
- package/lib/components/fields/checkbox.tsx +1 -1
- package/lib/components/fields/date-picker.tsx +6 -6
- package/lib/components/fields/file.tsx +1 -1
- package/lib/components/fields/input.tsx +1 -1
- package/lib/components/fields/radiogroup.tsx +2 -2
- package/lib/components/fields/textarea.tsx +1 -1
- package/lib/components/fields/toggle.tsx +1 -1
- package/lib/components/fields/tri-toggle.tsx +4 -4
- package/lib/utils/data.ts +5 -3
- package/lib/utils/string.ts +3 -3
- package/lib/webcomponent.ts +0 -1
- package/package.json +8 -9
- package/tailwind.config.ts +21 -26
- package/tsconfig.json +0 -1
- package/vite.config.ts +13 -2
- package/.eslintrc.cjs +0 -9
- package/dist/react.cjs +0 -89
- package/dist/react.d.ts +0 -1
- package/dist/react.js +0 -22662
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { VariantProps, TVReturnType } from 'tailwind-variants';
|
|
2
|
-
import { TVConfig } from 'tailwind-variants/dist/config.js';
|
|
3
2
|
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & VariantProps< TVReturnType<{
|
|
@@ -23,43 +22,7 @@ declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttrib
|
|
|
23
22
|
}, {
|
|
24
23
|
root: string;
|
|
25
24
|
textarea: string[];
|
|
26
|
-
}, undefined,
|
|
27
|
-
variant: {
|
|
28
|
-
default: {
|
|
29
|
-
textarea: string;
|
|
30
|
-
};
|
|
31
|
-
outline: {
|
|
32
|
-
root: string;
|
|
33
|
-
textarea: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
size: {
|
|
37
|
-
sm: {
|
|
38
|
-
textarea: string;
|
|
39
|
-
};
|
|
40
|
-
base: {
|
|
41
|
-
textarea: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}, {
|
|
45
|
-
variant: {
|
|
46
|
-
default: {
|
|
47
|
-
textarea: string;
|
|
48
|
-
};
|
|
49
|
-
outline: {
|
|
50
|
-
root: string;
|
|
51
|
-
textarea: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
size: {
|
|
55
|
-
sm: {
|
|
56
|
-
textarea: string;
|
|
57
|
-
};
|
|
58
|
-
base: {
|
|
59
|
-
textarea: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
}>, {
|
|
25
|
+
}, undefined, {
|
|
63
26
|
variant: {
|
|
64
27
|
default: {
|
|
65
28
|
textarea: string;
|
|
@@ -101,41 +64,5 @@ declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttrib
|
|
|
101
64
|
}, {
|
|
102
65
|
root: string;
|
|
103
66
|
textarea: string[];
|
|
104
|
-
}, undefined,
|
|
105
|
-
variant: {
|
|
106
|
-
default: {
|
|
107
|
-
textarea: string;
|
|
108
|
-
};
|
|
109
|
-
outline: {
|
|
110
|
-
root: string;
|
|
111
|
-
textarea: string;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
size: {
|
|
115
|
-
sm: {
|
|
116
|
-
textarea: string;
|
|
117
|
-
};
|
|
118
|
-
base: {
|
|
119
|
-
textarea: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
}, {
|
|
123
|
-
variant: {
|
|
124
|
-
default: {
|
|
125
|
-
textarea: string;
|
|
126
|
-
};
|
|
127
|
-
outline: {
|
|
128
|
-
root: string;
|
|
129
|
-
textarea: string;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
size: {
|
|
133
|
-
sm: {
|
|
134
|
-
textarea: string;
|
|
135
|
-
};
|
|
136
|
-
base: {
|
|
137
|
-
textarea: string;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
}>, unknown, unknown, undefined>>> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
67
|
+
}, undefined, unknown, unknown, undefined>>> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
141
68
|
export { Textarea };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { Props } from '../../types';
|
|
2
3
|
import { WithChildren } from 'twintag-types/dom';
|
|
3
|
-
import { FC } from 'react';
|
|
4
4
|
|
|
5
5
|
type AccordionProps = Props<'accordion', 'item' | 'multiple' | 'single'> & WithChildren;
|
|
6
6
|
declare const Accordion: FC<AccordionProps>;
|
|
@@ -2,8 +2,8 @@ import { FieldValues } from 'react-hook-form';
|
|
|
2
2
|
import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
export declare const TwintagForm: ForwardRefExoticComponent<{
|
|
5
|
-
defaultValues?: FieldValues
|
|
6
|
-
resetOnSubmit?: boolean
|
|
5
|
+
defaultValues?: FieldValues;
|
|
6
|
+
resetOnSubmit?: boolean;
|
|
7
7
|
} & {
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
} & RefAttributes<HTMLFormElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParsedJsonComponent, RawJsonComponent, TwintagFormContext
|
|
1
|
+
import { ParsedJsonComponent, RawJsonComponent, TwintagFormContext } from '../types';
|
|
2
2
|
import { WithChildren } from 'twintag-types/dom';
|
|
3
3
|
import { Context } from 'react';
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@ export declare const twintagFormContext: Context<TwintagFormContext>;
|
|
|
6
6
|
export declare const useTwintagForm: () => TwintagFormContext;
|
|
7
7
|
type Components = TwintagFormContext['components'];
|
|
8
8
|
type Inputs = TwintagFormContext['inputs'];
|
|
9
|
-
export declare const getResetValues: (config: ParsedJsonComponent | ParsedJsonComponent[], inputs:
|
|
9
|
+
export declare const getResetValues: (config: ParsedJsonComponent | ParsedJsonComponent[], inputs: Inputs) => {
|
|
10
10
|
[k: string]: unknown;
|
|
11
11
|
};
|
|
12
12
|
export declare const TwintagFormProvider: ({ variant, size, inputs, components, config, children, }: {
|
|
13
13
|
config: RawJsonComponent | RawJsonComponent[];
|
|
14
|
-
variant: TwintagFormContext[
|
|
15
|
-
size: TwintagFormContext[
|
|
14
|
+
variant: TwintagFormContext["variant"];
|
|
15
|
+
size: TwintagFormContext["size"];
|
|
16
16
|
inputs: Inputs;
|
|
17
17
|
components: Components;
|
|
18
18
|
} & WithChildren) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),q=require("react"),Rt=require("tailwind-merge"),Pr=require("@radix-ui/react-accordion"),B=require("lucide-react"),Mr=require("@heroicons/react/24/outline"),zr=require("uuid"),W=require("react-hook-form"),$r=require("@radix-ui/react-checkbox"),Lr=require("@radix-ui/react-icons"),$t=require("@radix-ui/react-slot"),Dr=require("@radix-ui/react-label"),Ur=require("date-fns"),qr=require("react-day-picker"),Br=require("@radix-ui/react-popover"),Wr=require("@radix-ui/react-radio-group"),Gr=require("@radix-ui/react-switch"),Jr=require("@radix-ui/react-slider");function oe(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const S=oe(q),ge=oe(Pr),Hr=oe(Mr),lt=oe($r),Lt=oe(Dr),st=oe(Br),Ie=oe(Wr),ut=oe(Gr),Se=oe(Jr);var St=r=>typeof r=="boolean"?`${r}`:r===0?"0":r,$=r=>!r||typeof r!="object"||Object.keys(r).length===0,Yr=(r,e)=>JSON.stringify(r)===JSON.stringify(e);function Dt(r,e){r.forEach(function(t){Array.isArray(t)?Dt(t,e):e.push(t)})}function Ut(r){let e=[];return Dt(r,e),e}var qt=(...r)=>Ut(r).filter(Boolean),Bt=(r,e)=>{let t={},s=Object.keys(r),n=Object.keys(e);for(let a of s)if(n.includes(a)){let i=r[a],c=e[a];Array.isArray(i)||Array.isArray(c)?t[a]=qt(c,i):typeof i=="object"&&typeof c=="object"?t[a]=Bt(i,c):t[a]=c+" "+i}else t[a]=r[a];for(let a of n)s.includes(a)||(t[a]=e[a]);return t},Ot=r=>!r||typeof r!="string"?r:r.replace(/\s+/g," ").trim(),Kr={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Wt=r=>r||void 0,Ve=(...r)=>Wt(Ut(r).filter(Boolean).join(" ")),ct=null,ae={},ft=!1,Re=(...r)=>e=>e.twMerge?((!ct||ft)&&(ft=!1,ct=$(ae)?Rt.twMerge:Rt.extendTailwindMerge({...ae,extend:{theme:ae.theme,classGroups:ae.classGroups,conflictingClassGroupModifiers:ae.conflictingClassGroupModifiers,conflictingClassGroups:ae.conflictingClassGroups,...ae.extend}})),Wt(ct(Ve(r)))):Ve(r),Et=(r,e)=>{for(let t in e)r.hasOwnProperty(t)?r[t]=Ve(r[t],e[t]):r[t]=e[t];return r},O=(r,e)=>{let{extend:t=null,slots:s={},variants:n={},compoundVariants:a=[],compoundSlots:i=[],defaultVariants:c={}}=r,d={...Kr,...e},l=t!=null&&t.base?Ve(t.base,r==null?void 0:r.base):r==null?void 0:r.base,h=t!=null&&t.variants&&!$(t.variants)?Bt(n,t.variants):n,b=t!=null&&t.defaultVariants&&!$(t.defaultVariants)?{...t.defaultVariants,...c}:c;!$(d.twMergeConfig)&&!Yr(d.twMergeConfig,ae)&&(ft=!0,ae=d.twMergeConfig);let V=$(t==null?void 0:t.slots),Z=$(s)?{}:{base:Ve(r==null?void 0:r.base,V&&(t==null?void 0:t.base)),...s},Ae=V?Z:Et({...t==null?void 0:t.slots},$(Z)?{base:r==null?void 0:r.base}:Z),xe=$(t==null?void 0:t.compoundVariants)?a:qt(t==null?void 0:t.compoundVariants,a),re=F=>{if($(h)&&$(s)&&V)return Re(l,F==null?void 0:F.class,F==null?void 0:F.className)(d);if(xe&&!Array.isArray(xe))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof xe}`);if(i&&!Array.isArray(i))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof i}`);let Or=(k,N,j=[],C)=>{let T=j;if(typeof N=="string")T=T.concat(Ot(N).split(" ").map(A=>`${k}:${A}`));else if(Array.isArray(N))T=T.concat(N.reduce((A,E)=>A.concat(`${k}:${E}`),[]));else if(typeof N=="object"&&typeof C=="string"){for(let A in N)if(N.hasOwnProperty(A)&&A===C){let E=N[A];if(E&&typeof E=="string"){let I=Ot(E);T[C]?T[C]=T[C].concat(I.split(" ").map(P=>`${k}:${P}`)):T[C]=I.split(" ").map(P=>`${k}:${P}`)}else Array.isArray(E)&&E.length>0&&(T[C]=E.reduce((I,P)=>I.concat(`${k}:${P}`),[]))}}return T},jt=(k,N=h,j=null,C=null)=>{var T;let A=N[k];if(!A||$(A))return null;let E=(T=C==null?void 0:C[k])!=null?T:F==null?void 0:F[k];if(E===null)return null;let I=St(E),P=Array.isArray(d.responsiveVariants)&&d.responsiveVariants.length>0||d.responsiveVariants===!0,be=b==null?void 0:b[k],U=[];if(typeof I=="object"&&P)for(let[ot,At]of Object.entries(I)){let Fr=A[At];if(ot==="initial"){be=At;continue}Array.isArray(d.responsiveVariants)&&!d.responsiveVariants.includes(ot)||(U=Or(ot,Fr,U,j))}let He=I!=null&&typeof I!="object"?I:St(be),it=A[He||"false"];return typeof U=="object"&&typeof j=="string"&&U[j]?Et(U,it):U.length>0?(U.push(it),j==="base"?U.join(" "):U):it},Er=()=>h?Object.keys(h).map(k=>jt(k,h)):null,Ir=(k,N)=>{if(!h||typeof h!="object")return null;let j=new Array;for(let C in h){let T=jt(C,h,k,N),A=k==="base"&&typeof T=="string"?T:T&&T[k];A&&(j[j.length]=A)}return j},Nt={};for(let k in F)F[k]!==void 0&&(Nt[k]=F[k]);let Tt=(k,N)=>{var j;let C=typeof(F==null?void 0:F[k])=="object"?{[k]:(j=F[k])==null?void 0:j.initial}:{};return{...b,...Nt,...C,...N}},Ct=(k=[],N)=>{let j=[];for(let{class:C,className:T,...A}of k){let E=!0;for(let[I,P]of Object.entries(A)){let be=Tt(I,N)[I];if(Array.isArray(P)){if(!P.includes(be)){E=!1;break}}else{let U=He=>He==null||He===!1;if(U(P)&&U(be))continue;if(be!==P){E=!1;break}}}E&&(C&&j.push(C),T&&j.push(T))}return j},Vr=k=>{let N=Ct(xe,k);if(!Array.isArray(N))return N;let j={};for(let C of N)if(typeof C=="string"&&(j.base=Re(j.base,C)(d)),typeof C=="object")for(let[T,A]of Object.entries(C))j[T]=Re(j[T],A)(d);return j},Zr=k=>{if(i.length<1)return null;let N={};for(let{slots:j=[],class:C,className:T,...A}of i){if(!$(A)){let E=!0;for(let I of Object.keys(A)){let P=Tt(I,k)[I];if(P===void 0||(Array.isArray(A[I])?!A[I].includes(P):A[I]!==P)){E=!1;break}}if(!E)continue}for(let E of j)N[E]=N[E]||[],N[E].push([C,T])}return N};if(!$(s)||!V){let k={};if(typeof Ae=="object"&&!$(Ae))for(let N of Object.keys(Ae))k[N]=j=>{var C,T;return Re(Ae[N],Ir(N,j),((C=Vr(j))!=null?C:[])[N],((T=Zr(j))!=null?T:[])[N],j==null?void 0:j.class,j==null?void 0:j.className)(d)};return k}return Re(l,Er(),Ct(xe),F==null?void 0:F.class,F==null?void 0:F.className)(d)},Sr=()=>{if(!(!h||typeof h!="object"))return Object.keys(h)};return re.variantKeys=Sr(),re.extend=t,re.base=l,re.slots=Ae,re.variants=h,re.defaultVariants=b,re.compoundSlots=i,re.compoundVariants=xe,re};const It=ge.Root,Qr=O({base:"border-b"}),Gt=S.forwardRef(({className:r,...e},t)=>o.jsx(ge.Item,{ref:t,className:Qr({className:r}),...e}));Gt.displayName="AccordionItem";const Xr=O({slots:{header:"flex",trigger:"flex flex-1 items-center justify-between py-4 font-medium hover:underline [&[data-state=open]>svg]:rotate-180",icon:"h-4 w-4 shrink-0 text-current transition-transform duration-200"}}),Jt=S.forwardRef(({className:r,children:e,...t},s)=>{const{header:n,trigger:a,icon:i}=Xr();return o.jsx(ge.Header,{className:n(),asChild:!0,children:o.jsx("div",{children:o.jsxs(ge.Trigger,{ref:s,className:a({className:r}),...t,children:[e,o.jsx(B.ChevronDown,{className:i()})]})})})});Jt.displayName=ge.Trigger.displayName;const es=O({slots:{content:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",wrapper:"pb-4 pt-0"}}),Ht=S.forwardRef(({className:r,children:e,...t},s)=>{const{content:n,wrapper:a}=es();return o.jsx(ge.Content,{ref:s,className:n(),...t,children:o.jsx("div",{className:a({className:r}),children:e})})});Ht.displayName=ge.Content.displayName;const ts=r=>r.replace(/(?:^\w|[A-Z]|\b\w)/g,(e,t)=>t===0?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,""),rs=r=>r.replace(/-./g,e=>e[1].toUpperCase()),ss=r=>r&&r[0].toUpperCase()+r.slice(1),as=O({base:"h-5 w-5 shrink-0"}),ns=({name:r,className:e,...t})=>{const s=q.useMemo(()=>`${ss(rs(r))}Icon`,[r]),n=Hr[s];return n?o.jsx(n,{"aria-hidden":"true",className:as({className:e}),...t}):o.jsx(o.Fragment,{})};var w;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(c=>typeof n[n[c]]!="number"),i={};for(const c of a)i[c]=n[c];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(w||(w={}));var ht;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ht||(ht={}));const m=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ne=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},u=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"]),is=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let c=s,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],d++}}};return n(this),s}static assert(e){if(!(e instanceof D))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}D.create=r=>new D(r);const Ne=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,w.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${w.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${w.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${w.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:w.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,w.assertNever(r)}return{message:t}};let Yt=Ne;function os(r){Yt=r}function Ye(){return Yt}const Ke=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let c="";const d=s.filter(l=>!!l).slice().reverse();for(const l of d)c=l(i,{data:e,defaultError:c}).message;return{...n,path:a,message:c}},cs=[];function f(r,e){const t=Ye(),s=Ke({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Ne?void 0:Ne].filter(n=>!!n)});r.common.issues.push(s)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return v;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return M.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const v=Object.freeze({status:"aborted"}),ke=r=>({status:"dirty",value:r}),z=r=>({status:"valid",value:r}),mt=r=>r.status==="aborted",pt=r=>r.status==="dirty",ve=r=>r.status==="valid",Ze=r=>typeof Promise<"u"&&r instanceof Promise;function Qe(r,e,t,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Kt(r,e,t,s,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var Oe,Ee;class K{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}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}}const Vt=(r,e)=>{if(ve(e))return{success:!0,data:e.value};if(!r.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 D(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,c)=>{var d,l;const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:(d=h??s)!==null&&d!==void 0?d:c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:(l=h??t)!==null&&l!==void 0?l:c.defaultError}},description:n}}class x{get description(){return this._def.description}_getType(e){return ne(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ze(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Vt(n,a)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return ve(a)?{value:a.value}:{issues:n.common.issues}}catch(a){!((s=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>ve(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(Ze(n)?n:Promise.resolve(n));return Vt(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),c=()=>a.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(c(),!1)):i?!0:(c(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new H({schema:this,typeName:g.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:t=>this["~validate"](t)}}optional(){return Y.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return J.create(this)}promise(){return Ce.create(this,this._def)}or(e){return ze.create([this,e],this._def)}and(e){return $e.create(this,e,this._def)}transform(e){return new H({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Be({..._(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new xt({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new We({..._(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Je.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ds=/^c[^\s-]{8,}$/i,ls=/^[0-9a-z]+$/,us=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fs=/^[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,hs=/^[a-z0-9_-]{21}$/i,ms=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ps=/^[-+]?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)?)??$/,gs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let dt;const ys=/^(?:(?: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])$/,_s=/^(?:(?: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])$/,xs=/^(([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]))$/,bs=/^(([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])$/,ws=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ks=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt="((\\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])))",js=new RegExp(`^${Qt}$`);function Xt(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ns(r){return new RegExp(`^${Xt(r)}$`)}function er(r){let e=`${Qt}T${Xt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ts(r,e){return!!((e==="v4"||!e)&&ys.test(r)||(e==="v6"||!e)&&xs.test(r))}function Cs(r,e){if(!ms.test(r))return!1;try{const[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function As(r,e){return!!((e==="v4"||!e)&&_s.test(r)||(e==="v6"||!e)&&bs.test(r))}class G extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:m.string,received:a.parsedType}),v}const s=new M;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,c=e.data.length<a.value;(i||c)&&(n=this._getOrReturnCtx(e,n),i?f(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&f(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")gs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")dt||(dt=new RegExp(vs,"u")),dt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")fs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")hs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"nanoid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")ds.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")ls.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")us.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:u.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"regex",code:u.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?er(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?js.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Ns(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?ps.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"duration",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Ts(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Cs(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"jwt",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?As(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cidr",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?ws.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?ks.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64url",code:u.invalid_string,message:a.message}),s.dirty()):w.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...p.errToObj(s)})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new G({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}G.create=r=>{var e;return new G({checks:[],typeName:g.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function Rs(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}class le extends x{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)!==m.number){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:m.number,received:a.parsedType}),v}let s;const n=new M;for(const a of this._def.checks)a.kind==="int"?w.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Rs(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.not_finite,message:a.message}),n.dirty()):w.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}le.create=r=>new le({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class ue extends x{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)!==m.bigint)return this._getInvalidInput(e);let s;const n=new M;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):w.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ue.create=r=>{var e;return new ue({checks:[],typeName:g.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};class Fe extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.boolean,received:s.parsedType}),v}return z(e.data)}}Fe.create=r=>new Fe({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class ye extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:m.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_date}),v}const s=new M;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):w.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ye({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}ye.create=r=>new ye({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,..._(r)});class Xe extends x{_parse(e){if(this._getType(e)!==m.symbol){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.symbol,received:s.parsedType}),v}return z(e.data)}}Xe.create=r=>new Xe({typeName:g.ZodSymbol,..._(r)});class Pe extends x{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.undefined,received:s.parsedType}),v}return z(e.data)}}Pe.create=r=>new Pe({typeName:g.ZodUndefined,..._(r)});class Me extends x{_parse(e){if(this._getType(e)!==m.null){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.null,received:s.parsedType}),v}return z(e.data)}}Me.create=r=>new Me({typeName:g.ZodNull,..._(r)});class Te extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return z(e.data)}}Te.create=r=>new Te({typeName:g.ZodAny,..._(r)});class pe extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return z(e.data)}}pe.create=r=>new pe({typeName:g.ZodUnknown,..._(r)});class ie extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.never,received:t.parsedType}),v}}ie.create=r=>new ie({typeName:g.ZodNever,..._(r)});class et extends x{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.void,received:s.parsedType}),v}return z(e.data)}}et.create=r=>new et({typeName:g.ZodVoid,..._(r)});class J extends x{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==m.array)return f(t,{code:u.invalid_type,expected:m.array,received:t.parsedType}),v;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(i||c)&&(f(t,{code:i?u.too_big:u.too_small,minimum:c?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(f(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(f(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,c)=>n.type._parseAsync(new K(t,i,t.path,c)))).then(i=>M.mergeArray(s,i));const a=[...t.data].map((i,c)=>n.type._parseSync(new K(t,i,t.path,c)));return M.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new J({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new J({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new J({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}J.create=(r,e)=>new J({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});function we(r){if(r instanceof R){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=Y.create(we(s))}return new R({...r._def,shape:()=>e})}else return r instanceof J?new J({...r._def,type:we(r.element)}):r instanceof Y?Y.create(we(r.unwrap())):r instanceof he?he.create(we(r.unwrap())):r instanceof Q?Q.create(r.items.map(e=>we(e))):r}class R extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=w.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return f(l,{code:u.invalid_type,expected:m.object,received:l.parsedType}),v}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||c.push(l);const d=[];for(const l of i){const h=a[l],b=n.data[l];d.push({key:{status:"valid",value:l},value:h._parse(new K(n,b,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof ie){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of c)d.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(l==="strict")c.length>0&&(f(n,{code:u.unrecognized_keys,keys:c}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of c){const b=n.data[h];d.push({key:{status:"valid",value:h},value:l._parse(new K(n,b,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const h of d){const b=await h.key,V=await h.value;l.push({key:b,value:V,alwaysSet:h.alwaysSet})}return l}).then(l=>M.mergeObjectSync(s,l)):M.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new R({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,c;const d=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(c=p.errToObj(e).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new R({...this._def,unknownKeys:"strip"})}passthrough(){return new R({...this._def,unknownKeys:"passthrough"})}extend(e){return new R({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new R({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new R({...this._def,catchall:e})}pick(e){const t={};return w.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new R({...this._def,shape:()=>t})}omit(e){const t={};return w.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new R({...this._def,shape:()=>t})}deepPartial(){return we(this)}partial(e){const t={};return w.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new R({...this._def,shape:()=>t})}required(e){const t={};return w.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof Y;)a=a._def.innerType;t[s]=a}}),new R({...this._def,shape:()=>t})}keyof(){return tr(w.objectKeys(this.shape))}}R.create=(r,e)=>new R({shape:()=>r,unknownKeys:"strip",catchall:ie.create(),typeName:g.ZodObject,..._(e)});R.strictCreate=(r,e)=>new R({shape:()=>r,unknownKeys:"strict",catchall:ie.create(),typeName:g.ZodObject,..._(e)});R.lazycreate=(r,e)=>new R({shape:r,unknownKeys:"strip",catchall:ie.create(),typeName:g.ZodObject,..._(e)});class ze extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const c of a)if(c.result.status==="valid")return c.result;for(const c of a)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;const i=a.map(c=>new D(c.ctx.common.issues));return f(t,{code:u.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const d of s){const l={...t,common:{...t.common,issues:[]},parent:null},h=d._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const c=i.map(d=>new D(d));return f(t,{code:u.invalid_union,unionErrors:c}),v}}get options(){return this._def.options}}ze.create=(r,e)=>new ze({options:r,typeName:g.ZodUnion,..._(e)});const se=r=>r instanceof De?se(r.schema):r instanceof H?se(r.innerType()):r instanceof Ue?[r.value]:r instanceof fe?r.options:r instanceof qe?w.objectValues(r.enum):r instanceof Be?se(r._def.innerType):r instanceof Pe?[void 0]:r instanceof Me?[null]:r instanceof Y?[void 0,...se(r.unwrap())]:r instanceof he?[null,...se(r.unwrap())]:r instanceof xt||r instanceof Ge?se(r.unwrap()):r instanceof We?se(r._def.innerType):[];class at extends x{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:u.invalid_type,expected:m.object,received:t.parsedType}),v;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=se(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of i){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,a)}}return new at({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}}function gt(r,e){const t=ne(r),s=ne(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&s===m.object){const n=w.objectKeys(e),a=w.objectKeys(r).filter(c=>n.indexOf(c)!==-1),i={...r,...e};for(const c of a){const d=gt(r[c],e[c]);if(!d.valid)return{valid:!1};i[c]=d.data}return{valid:!0,data:i}}else if(t===m.array&&s===m.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],c=e[a],d=gt(i,c);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===m.date&&s===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $e extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(mt(a)||mt(i))return v;const c=gt(a.value,i.value);return c.valid?((pt(a)||pt(i))&&t.dirty(),{status:t.value,value:c.data}):(f(s,{code:u.invalid_intersection_types}),v)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}$e.create=(r,e,t)=>new $e({left:r,right:e,typeName:g.ZodIntersection,..._(t)});class Q extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.array)return f(s,{code:u.invalid_type,expected:m.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return f(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new K(s,i,s.path,c)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>M.mergeArray(t,i)):M.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:r,typeName:g.ZodTuple,rest:null,..._(e)})};class Le extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return f(s,{code:u.invalid_type,expected:m.object,received:s.parsedType}),v;const n=[],a=this._def.keyType,i=this._def.valueType;for(const c in s.data)n.push({key:a._parse(new K(s,c,s.path,c)),value:i._parse(new K(s,s.data[c],s.path,c)),alwaysSet:c in s.data});return s.common.async?M.mergeObjectAsync(t,n):M.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof x?new Le({keyType:e,valueType:t,typeName:g.ZodRecord,..._(s)}):new Le({keyType:G.create(),valueType:e,typeName:g.ZodRecord,..._(t)})}}class tt extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.map)return f(s,{code:u.invalid_type,expected:m.map,received:s.parsedType}),v;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([c,d],l)=>({key:n._parse(new K(s,c,s.path,[l,"key"])),value:a._parse(new K(s,d,s.path,[l,"value"]))}));if(s.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of i){const l=await d.key,h=await d.value;if(l.status==="aborted"||h.status==="aborted")return v;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),c.set(l.value,h.value)}return{status:t.value,value:c}})}else{const c=new Map;for(const d of i){const l=d.key,h=d.value;if(l.status==="aborted"||h.status==="aborted")return v;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),c.set(l.value,h.value)}return{status:t.value,value:c}}}}tt.create=(r,e,t)=>new tt({valueType:e,keyType:r,typeName:g.ZodMap,..._(t)});class _e extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.set)return f(s,{code:u.invalid_type,expected:m.set,received:s.parsedType}),v;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(f(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const l=new Set;for(const h of d){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),l.add(h.value)}return{status:t.value,value:l}}const c=[...s.data.values()].map((d,l)=>a._parse(new K(s,d,s.path,l)));return s.common.async?Promise.all(c).then(d=>i(d)):i(c)}min(e,t){return new _e({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new _e({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_e.create=(r,e)=>new _e({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});class je extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:u.invalid_type,expected:m.function,received:t.parsedType}),v;function s(c,d){return Ke({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ne].filter(l=>!!l),issueData:{code:u.invalid_arguments,argumentsError:d}})}function n(c,d){return Ke({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ne].filter(l=>!!l),issueData:{code:u.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ce){const c=this;return z(async function(...d){const l=new D([]),h=await c._def.args.parseAsync(d,a).catch(Z=>{throw l.addIssue(s(d,Z)),l}),b=await Reflect.apply(i,this,h);return await c._def.returns._def.type.parseAsync(b,a).catch(Z=>{throw l.addIssue(n(b,Z)),l})})}else{const c=this;return z(function(...d){const l=c._def.args.safeParse(d,a);if(!l.success)throw new D([s(d,l.error)]);const h=Reflect.apply(i,this,l.data),b=c._def.returns.safeParse(h,a);if(!b.success)throw new D([n(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new je({...this._def,args:Q.create(e).rest(pe.create())})}returns(e){return new je({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new je({args:e||Q.create([]).rest(pe.create()),returns:t||pe.create(),typeName:g.ZodFunction,..._(s)})}}class De extends x{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})}}De.create=(r,e)=>new De({getter:r,typeName:g.ZodLazy,..._(e)});class Ue extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ue.create=(r,e)=>new Ue({value:r,typeName:g.ZodLiteral,..._(e)});function tr(r,e){return new fe({values:r,typeName:g.ZodEnum,..._(e)})}class fe extends x{constructor(){super(...arguments),Oe.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:w.joinValues(s),received:t.parsedType,code:u.invalid_type}),v}if(Qe(this,Oe)||Kt(this,Oe,new Set(this._def.values)),!Qe(this,Oe).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:u.invalid_enum_value,options:s}),v}return z(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 fe.create(e,{...this._def,...t})}exclude(e,t=this._def){return fe.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Oe=new WeakMap;fe.create=tr;class qe extends x{constructor(){super(...arguments),Ee.set(this,void 0)}_parse(e){const t=w.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==m.string&&s.parsedType!==m.number){const n=w.objectValues(t);return f(s,{expected:w.joinValues(n),received:s.parsedType,code:u.invalid_type}),v}if(Qe(this,Ee)||Kt(this,Ee,new Set(w.getValidEnumValues(this._def.values))),!Qe(this,Ee).has(e.data)){const n=w.objectValues(t);return f(s,{received:s.data,code:u.invalid_enum_value,options:n}),v}return z(e.data)}get enum(){return this._def.values}}Ee=new WeakMap;qe.create=(r,e)=>new qe({values:r,typeName:g.ZodNativeEnum,..._(e)});class Ce extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:u.invalid_type,expected:m.promise,received:t.parsedType}),v;const s=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return z(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ce.create=(r,e)=>new Ce({type:r,typeName:g.ZodPromise,..._(e)});class H extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{f(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async c=>{if(t.value==="aborted")return v;const d=await this._def.schema._parseAsync({data:c,path:s.path,parent:s});return d.status==="aborted"?v:d.status==="dirty"||t.value==="dirty"?ke(d.value):d});{if(t.value==="aborted")return v;const c=this._def.schema._parseSync({data:i,path:s.path,parent:s});return c.status==="aborted"?v:c.status==="dirty"||t.value==="dirty"?ke(c.value):c}}if(n.type==="refinement"){const i=c=>{const d=n.refinement(c,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(s.common.async===!1){const c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return c.status==="aborted"?v:(c.status==="dirty"&&t.dirty(),i(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>c.status==="aborted"?v:(c.status==="dirty"&&t.dirty(),i(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ve(i))return i;const c=n.transform(i.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>ve(i)?Promise.resolve(n.transform(i.value,a)).then(c=>({status:t.value,value:c})):i);w.assertNever(n)}}H.create=(r,e,t)=>new H({schema:r,typeName:g.ZodEffects,effect:e,..._(t)});H.createWithPreprocess=(r,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,..._(t)});class Y extends x{_parse(e){return this._getType(e)===m.undefined?z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Y.create=(r,e)=>new Y({innerType:r,typeName:g.ZodOptional,..._(e)});class he extends x{_parse(e){return this._getType(e)===m.null?z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:g.ZodNullable,..._(e)});class Be extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===m.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Be.create=(r,e)=>new Be({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class We extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ze(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new D(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}We.create=(r,e)=>new We({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class rt extends x{_parse(e){if(this._getType(e)!==m.nan){const s=this._getOrReturnCtx(e);return f(s,{code:u.invalid_type,expected:m.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}}rt.create=r=>new rt({typeName:g.ZodNaN,..._(r)});const Ss=Symbol("zod_brand");class xt extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Je extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ke(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?v:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Je({in:e,out:t,typeName:g.ZodPipeline})}}class Ge extends x{_parse(e){const t=this._def.innerType._parse(e),s=n=>(ve(n)&&(n.value=Object.freeze(n.value)),n);return Ze(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Ge.create=(r,e)=>new Ge({innerType:r,typeName:g.ZodReadonly,..._(e)});function Zt(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function rr(r,e={},t){return r?Te.create().superRefine((s,n)=>{var a,i;const c=r(s);if(c instanceof Promise)return c.then(d=>{var l,h;if(!d){const b=Zt(e,s),V=(h=(l=b.fatal)!==null&&l!==void 0?l:t)!==null&&h!==void 0?h:!0;n.addIssue({code:"custom",...b,fatal:V})}});if(!c){const d=Zt(e,s),l=(i=(a=d.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...d,fatal:l})}}):Te.create()}const Os={object:R.lazycreate};var g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));const Es=(r,e={message:`Input not instance of ${r.name}`})=>rr(t=>t instanceof r,e),sr=G.create,ar=le.create,Is=rt.create,Vs=ue.create,nr=Fe.create,Zs=ye.create,Fs=Xe.create,Ps=Pe.create,Ms=Me.create,zs=Te.create,$s=pe.create,Ls=ie.create,Ds=et.create,Us=J.create,qs=R.create,Bs=R.strictCreate,Ws=ze.create,Gs=at.create,Js=$e.create,Hs=Q.create,Ys=Le.create,Ks=tt.create,Qs=_e.create,Xs=je.create,ea=De.create,ta=Ue.create,ra=fe.create,sa=qe.create,aa=Ce.create,Ft=H.create,na=Y.create,ia=he.create,oa=H.createWithPreprocess,ca=Je.create,da=()=>sr().optional(),la=()=>ar().optional(),ua=()=>nr().optional(),fa={string:r=>G.create({...r,coerce:!0}),number:r=>le.create({...r,coerce:!0}),boolean:r=>Fe.create({...r,coerce:!0}),bigint:r=>ue.create({...r,coerce:!0}),date:r=>ye.create({...r,coerce:!0})},ha=v;var y=Object.freeze({__proto__:null,defaultErrorMap:Ne,setErrorMap:os,getErrorMap:Ye,makeIssue:Ke,EMPTY_PATH:cs,addIssueToContext:f,ParseStatus:M,INVALID:v,DIRTY:ke,OK:z,isAborted:mt,isDirty:pt,isValid:ve,isAsync:Ze,get util(){return w},get objectUtil(){return ht},ZodParsedType:m,getParsedType:ne,ZodType:x,datetimeRegex:er,ZodString:G,ZodNumber:le,ZodBigInt:ue,ZodBoolean:Fe,ZodDate:ye,ZodSymbol:Xe,ZodUndefined:Pe,ZodNull:Me,ZodAny:Te,ZodUnknown:pe,ZodNever:ie,ZodVoid:et,ZodArray:J,ZodObject:R,ZodUnion:ze,ZodDiscriminatedUnion:at,ZodIntersection:$e,ZodTuple:Q,ZodRecord:Le,ZodMap:tt,ZodSet:_e,ZodFunction:je,ZodLazy:De,ZodLiteral:Ue,ZodEnum:fe,ZodNativeEnum:qe,ZodPromise:Ce,ZodEffects:H,ZodTransformer:H,ZodOptional:Y,ZodNullable:he,ZodDefault:Be,ZodCatch:We,ZodNaN:rt,BRAND:Ss,ZodBranded:xt,ZodPipeline:Je,ZodReadonly:Ge,custom:rr,Schema:x,ZodSchema:x,late:Os,get ZodFirstPartyTypeKind(){return g},coerce:fa,any:zs,array:Us,bigint:Vs,boolean:nr,date:Zs,discriminatedUnion:Gs,effect:Ft,enum:ra,function:Xs,instanceof:Es,intersection:Js,lazy:ea,literal:ta,map:Ks,nan:Is,nativeEnum:sa,never:Ls,null:Ms,nullable:ia,number:ar,object:qs,oboolean:ua,onumber:la,optional:na,ostring:da,pipeline:ca,preprocess:oa,promise:aa,record:Ys,set:Qs,strictObject:Bs,string:sr,symbol:Fs,transformer:Ft,tuple:Hs,undefined:Ps,union:Ws,unknown:$s,void:Ds,NEVER:ha,ZodIssueCode:u,quotelessJson:is,ZodError:D});const ma=y.object({fileName:y.string(),extension:y.string(),downloadUrl:y.string().url()});y.object({fileQid:y.string(),instanceQid:y.string(),signedUrl:y.string().url()});const pa=y.union([y.string(),y.number(),y.boolean(),y.null()]),Pt=y.lazy(()=>y.union([pa,y.array(Pt),y.record(Pt)]));y.string().transform((r,e)=>{try{return JSON.parse(r)}catch{return e.addIssue({code:"custom",message:"Invalid JSON"}),y.NEVER}});const ga=y.union([y.string().min(1),y.string().datetime(),y.number(),y.date()]),va=ga.transform(r=>typeof r=="object"&&typeof r.getMonth=="function"?r.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}):r.toString()),ya=y.any();y.object({children:ya});y.record(y.string(),y.record(y.string(),y.union([y.string(),y.number(),y.boolean(),y.null(),ma])).nullable()).nullish();y.union([y.literal("RICH_TEXT"),y.literal("STRING"),y.literal("FILE"),y.literal("DATETIME"),y.literal("BOOLEAN"),y.literal("NUMBER")]);const ir=q.createContext({variant:"default",size:"base",inputs:new Map,components:new Map,config:[],resetValues:{}}),L=()=>{const r=q.useContext(ir);if(!r)throw new Error("useTwintagForm must be used within a TwintagFormProvider");return r},vt=(r,e)=>{const t={...r};let s;if(t.props?s={...t.props}:s={...t},!t.type)return Object.create(null);const[n,a=void 0]=t.type.split(":");s.id=`${n}-${zr.v4()}`;const i=e.get(n);if(i&&(s.comp=i),s.type=n,a&&(s.subtype=a),t.props&&(t.props.subtype&&(s.subtype=t.props.subtype),t.props.label)){const c=va.safeParse(t.props.label);s.label=c.success?c.data:void 0}return t.children&&Array.isArray(t.children)&&(s.items=t.children.map(c=>vt(c,e))),s},_a=(r,e)=>{var n;const t=Array.isArray(r)?[...r]:[r],s=new Map;for(;t.length>0;){const a=t.pop();if(a)for(const[i,c]of Object.entries(a)){if(Array.isArray(c))for(const d of c)t.push(d);typeof c=="object"&&c!==null&&t.push(c),i==="subtype"&&"bind"in a&&typeof a.bind=="string"&&s.set(a.bind,(n=e.get(c))==null?void 0:n.defaultValue)}}return Object.fromEntries(s)},xa=({variant:r,size:e,inputs:t,components:s,config:n,children:a})=>{const i=q.useMemo(()=>Array.isArray(n)?n.map(d=>vt(d,s)):vt(n,s),[n,s]),c=q.useMemo(()=>_a(i,t),[i,t]);return o.jsx(ir.Provider,{value:{config:i,variant:r,size:e,inputs:t,components:s,resetValues:c},children:a})},Mt=O({base:"border",variants:{variant:{default:"rounded-md",outline:"rounded-none"}},defaultVariants:{variant:"default"}}),or=({type:r,defaultValue:e,children:t})=>{const{variant:s}=L();return r==="single"?o.jsx(It,{type:"single",defaultValue:e,collapsible:!0,children:o.jsx("div",{className:Mt({variant:s}),children:t})}):o.jsx(It,{type:"multiple",children:o.jsx("div",{className:Mt({variant:s}),children:t})})};or.displayName="AccordionRoot";const ba=O({slots:{item:"px-5 last:border-none",trigger:"flex flex-1 items-center gap-2.5 font-tf-font",icon:"shrink-0",content:"space-y-3"},variants:{variant:{default:{trigger:"font-medium"},outline:{trigger:""}},size:{sm:{item:"text-sm",icon:"h-4 w-4"},base:{item:"text-base",icon:"h-5 w-5"}}},defaultVariants:{variant:"default",size:"base"}}),cr=({label:r="",value:e="",icon:t,children:s,...n})=>{const{variant:a,size:i}=L(),{item:c,trigger:d,icon:l,content:h}=ba({size:i,variant:a});return o.jsxs(Gt,{value:e||ts(r),className:c(),...n,children:[o.jsx(Jt,{className:"text-category",children:o.jsxs("span",{className:d(),children:[t?o.jsx(ns,{name:t,className:l()}):o.jsx(o.Fragment,{}),r]})}),o.jsx(Ht,{className:h(),children:s})]})};cr.displayName="AccordionItem";const wa=({subtype:r="single",...e})=>r==="item"?o.jsx(cr,{...e}):o.jsx(or,{type:r,...e}),ka=O({slots:{container:"relative w-full space-y-3",heading:"font-tf-font text-tf-category",content:"grid gap-3"},variants:{variant:{default:{heading:"font-medium"},outline:{heading:"font-normal"}},size:{sm:{heading:"text-sm"},base:{heading:"text-base"}}},defaultVariants:{variant:"default",size:"base"}}),dr=({label:r,children:e})=>{const{variant:t,size:s}=L(),{container:n,heading:a,content:i}=ka({size:s,variant:t});return o.jsxs("section",{className:n(),children:[r?o.jsx("h3",{className:a(),children:r}):o.jsx(o.Fragment,{}),o.jsx("div",{className:i(),children:e})]})};dr.displayName="Category";const ja=O({slots:{root:["peer h-4 w-4 shrink-0 rounded-tf-sm border border-tf-accent shadow","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-tf-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-tf-accent data-[state=checked]:text-tf-accent-foreground"],indicator:"flex items-center justify-center text-current",icon:"h-4 w-4"}}),lr=S.forwardRef(({className:r,...e},t)=>{const{root:s,indicator:n,icon:a}=ja();return o.jsx(lt.Root,{ref:t,className:s({className:r}),...e,children:o.jsx(lt.Indicator,{className:n(),children:o.jsx(Lr.CheckIcon,{className:a()})})})});lr.displayName=lt.Root.displayName;const Na=O({base:["text-tf-label","peer-disabled:cursor-not-allowed peer-disabled:opacity-70"],variants:{size:{sm:"text-sm leading-none",base:"text-base leading-none"}},defaultVariants:{size:"base"}}),bt=S.forwardRef(({size:r,className:e,...t},s)=>o.jsx(Lt.Root,{ref:s,className:Na({size:r,className:e}),...t}));bt.displayName=Lt.Root.displayName;const Ta=W.FormProvider,ur=S.createContext({}),me=({...r})=>o.jsx(ur.Provider,{value:{name:r.name},children:o.jsx(W.Controller,{...r})}),nt=()=>{const r=S.useContext(ur),e=S.useContext(fr),{getFieldState:t,formState:s}=W.useFormContext(),n=t(r.name,s);if(!r)throw new Error("useFormField should be used within <FormField>");const{id:a}=e;return{id:a,name:r.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...n}},fr=S.createContext({}),Ca=O({base:"",variants:{variant:{default:"space-y-2",outline:"space-y-1"}},defaultVariants:{variant:"default"}}),X=S.forwardRef(({variant:r,className:e,...t},s)=>{const n=S.useId();return o.jsx(fr.Provider,{value:{id:n},children:o.jsx("div",{ref:s,className:Ca({variant:r,className:e}),...t})})});X.displayName="FormItem";const Aa=O({base:"",variants:{error:{true:"text-tf-destructive"}}}),ee=S.forwardRef(({size:r,className:e,...t},s)=>{const{error:n,formItemId:a}=nt();return o.jsx(bt,{ref:s,size:r,className:Aa({error:!!n,className:e}),htmlFor:a,...t})});ee.displayName="FormLabel";const te=S.forwardRef(({...r},e)=>{const{error:t,formItemId:s,formDescriptionId:n,formMessageId:a}=nt();return o.jsx($t.Slot,{ref:e,id:s,"aria-describedby":t?`${n} ${a}`:`${n}`,"aria-invalid":!!t,...r})});te.displayName="FormControl";const Ra=O({base:"text-tf-muted-foreground",variants:{size:{sm:"text-[0.8rem] leading-none",base:"text-[0.9rem] leading-none"}},defaultVariants:{size:"base"}}),ce=S.forwardRef(({size:r,className:e,...t},s)=>{const{formDescriptionId:n}=nt();return o.jsx("p",{ref:s,id:n,className:Ra({size:r,className:e}),...t})});ce.displayName="FormDescription";const Sa=O({base:"font-medium text-tf-destructive",variants:{size:{sm:"text-[0.8rem]",base:"text-[0.9rem]"}},defaultVariants:{size:"base"}}),de=S.forwardRef(({size:r,className:e,children:t,...s},n)=>{const{error:a,formMessageId:i}=nt(),c=a?String(a==null?void 0:a.message):t;return c?o.jsx("p",{ref:n,id:i,className:Sa({size:r,className:e}),...s,children:c}):null});de.displayName="FormMessage";const hr=!1,Oa=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L(),i=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:hr,control:s,name:e,rules:{required:i?!1:(t==null?void 0:t.error)??!0},render:({field:c})=>o.jsx(X,{variant:n,className:"pt-1.5",children:o.jsxs("div",{className:"flex space-x-2",children:[o.jsx(te,{children:o.jsx(lr,{...c,checked:c.value,onCheckedChange:d=>{c.onChange(d)}})}),o.jsxs("div",{className:"grid gap-1",children:[o.jsxs(ee,{size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{}),o.jsx(de,{size:a})]})]})})})},yt=O({base:["inline-flex items-center justify-center whitespace-nowrap rounded-tf-md font-medium transition-colors","ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-tf-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"],variants:{variant:{default:"bg-tf-primary-foreground text-tf-primary shadow hover:bg-tf-primary-foreground/90",outline:"border border-tf-input bg-tf-background hover:bg-tf-accent hover:text-tf-accent-foreground",ghost:"hover:bg-tf-accent hover:text-tf-accent-foreground"},size:{sm:"h-9 rounded-tf-md px-3 text-sm",base:"h-10 px-3 py-2 text-base"}},defaultVariants:{variant:"default",size:"base"}}),wt=S.forwardRef(({className:r,variant:e,size:t,asChild:s=!1,...n},a)=>{const i=s?$t.Slot:"button";return o.jsx(i,{className:yt({variant:e,size:t,className:r}),ref:a,...n})});wt.displayName="Button";const Ea=O({slots:{picker:"p-3",months:"flex flex-col space-y-4 sm:flex-row sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"relative flex items-center justify-center pt-1",caption_dropdowns:"",caption_label:"font-semibold",nav:"flex items-center space-x-1",nav_button:yt({variant:"outline",className:"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"}),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 rounded-tf-md text-[0.8rem] font-normal text-tf-muted-foreground",row:"mt-2 flex w-full",cell:"relative h-9 w-9 p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-tf-md last:[&:has([aria-selected])]:rounded-r-tf-md [&:has([aria-selected].day-outside)]:bg-tf-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-tf-md",day:yt({variant:"ghost",className:"h-9 w-9 p-0 font-normal aria-selected:opacity-100"}),day_range_end:"day-range-end",day_selected:"bg-tf-accent text-tf-accent-foreground hover:bg-tf-accent hover:text-tf-accent-foreground focus:bg-tf-accent focus:text-tf-accent-foreground",day_today:"bg-tf-muted text-tf-muted-foreground",day_outside:"day-outside text-tf-muted-foreground opacity-50 aria-selected:bg-tf-accent/30 aria-selected:text-tf-accent-foreground",day_disabled:"text-tf-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-tf-accent aria-selected:text-tf-accent-foreground",day_hidden:"invisible"},variants:{variant:{dropdown:{caption_label:"hidden",caption_dropdowns:["flex w-4/6 justify-center gap-1","[&>*>span]:hidden [&>*]:flex-1 [&>.rdp-vhidden]:hidden ","[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-tf-md [&>*>select]:border [&>*>select]:border-tf-input [&>*>select]:bg-tf-background [&>*>select]:px-1","[&>*>select]:ring-offset-tf-background [&>*>select]:focus-visible:outline-none [&>*>select]:focus-visible:ring-1 [&>*>select]:focus-visible:ring-tf-ring"]}},size:{sm:{caption_label:"text-sm",caption_dropdowns:"[&>*>select]:text-sm",cell:"text-sm"},base:{caption_label:"text-base",caption_dropdowns:"[&>*>select]:text-base",cell:"text-base"}}},defaultVariants:{size:"base"}});function mr({size:r,className:e,classNames:t,showOutsideDays:s=!0,...n}){const a=Ea({size:r,variant:n.captionLayout==="dropdown-buttons"?"dropdown":void 0});return o.jsx(qr.DayPicker,{showOutsideDays:s,className:a.picker({className:e}),classNames:{months:a.months(),month:a.month(),caption:a.caption(),caption_label:a.caption_label(),caption_dropdowns:a.caption_dropdowns(),nav:a.nav(),nav_button:a.nav_button(),nav_button_previous:a.nav_button_previous(),nav_button_next:a.nav_button_next(),table:a.table(),head_row:a.head_row(),head_cell:a.head_cell(),row:a.row(),cell:a.cell(),day:a.day(),day_range_end:a.day_range_end(),day_selected:a.day_selected(),day_today:a.day_today(),day_outside:a.day_outside(),day_disabled:a.day_disabled(),day_range_middle:a.day_range_middle(),day_hidden:a.day_hidden(),...t},components:{IconLeft:()=>o.jsx(B.ChevronLeft,{className:"h-4 w-4"}),IconRight:()=>o.jsx(B.ChevronRight,{className:"h-4 w-4"})},...n})}mr.displayName="Calendar";const Ia=st.Root,Va=st.Trigger,Za=O({base:"z-50 w-72 rounded-tf-md border bg-tf-background p-4 text-tf-foreground shadow-md outline-none"}),pr=S.forwardRef(({className:r,align:e="center",sideOffset:t=2,...s},n)=>o.jsx(st.Content,{ref:n,align:e,sideOffset:t,className:Za({className:r}),...s}));pr.displayName=st.Content.displayName;const Fa=O({slots:{button:"w-full justify-start text-left font-normal",icon:"ml-auto text-tf-muted-foreground opacity-70"},variants:{variant:{default:{button:"px-3"},outline:{button:"rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-tf-muted-foreground"}},withValue:{true:{button:"text-tf-muted-foreground"},false:{button:""}},size:{sm:{button:"text-sm",icon:"h-4 w-4"},base:{button:"text-base",icon:"h-5 w-5"}}},defaultVariants:{variant:"default",size:"base"}}),gr=null,Pa=({label:r,bind:e,options:t})=>{const{variant:s,size:n}=L(),{control:a}=W.useFormContext(),{button:i,icon:c}=Fa({variant:s,size:n}),d=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:gr,control:a,name:e,rules:{required:d?!1:(t==null?void 0:t.error)??!0},render:({field:l})=>o.jsxs(X,{variant:s,className:"flex flex-col [&>div[data-radix-popper-content-wrapper]]:!z-50",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{size:n,children:[r,d?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:n,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsxs(Ia,{children:[o.jsx(Va,{asChild:!0,children:o.jsx(te,{children:o.jsxs(wt,{variant:"outline",size:n,className:i({withValue:!l.value,className:"h-10 gap-2"}),children:[l.value?Ur.format(l.value,"PPP"):o.jsx("span",{children:(t==null?void 0:t.placeholder)??"Select a date"}),o.jsx(B.Calendar,{className:c()})]})})}),o.jsx(pr,{className:"w-auto p-0",align:"start",children:o.jsx(mr,{fromYear:1970,toYear:2050,captionLayout:"dropdown-buttons",mode:"single",size:n,selected:Number.isNaN(new Date(l.value).getTime())?void 0:new Date(l.value),onSelect:l.onChange,initialFocus:!0})})]}),o.jsx(de,{size:n,className:"pt-1"})]})})},Ma=O({slots:{root:"relative",input:["flex h-10 w-full border-tf-input bg-tf-background py-2 text-tf-primary-foreground placeholder:text-tf-muted-foreground focus-visible:outline-none","file:border-0 file:bg-transparent file:px-0 file:font-medium file:text-tf-primary-foreground","disabled:cursor-not-allowed disabled:opacity-50"]},variants:{variant:{default:{input:"rounded-tf-md border px-3 ring-offset-tf-background focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2"},outline:{root:'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-tf-ring',input:"border-b px-1"}},size:{sm:{input:"text-sm file:text-sm"},base:{input:"text-base file:text-base"}}},defaultVariants:{variant:"default",size:"base"}}),kt=S.forwardRef(({variant:r,size:e,className:t,type:s,...n},a)=>{const{root:i,input:c}=Ma({variant:r,size:e});return o.jsx("div",{className:i(),children:o.jsx("input",{type:s,className:c({className:t}),ref:a,...n})})});kt.displayName="Input";const vr="",za=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L(),i=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:vr,control:s,name:e,rules:{required:i?!1:(t==null?void 0:t.error)??!0},render:({field:c,formState:d})=>o.jsxs(X,{variant:n,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{htmlFor:e,size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(kt,{ref:l=>{c.ref(l),l&&d.isSubmitSuccessful&&(l.value="")},id:e,type:"file",name:c.name,size:a,variant:n,multiple:!0,onBlur:c.onBlur,onChange:l=>{l.target.files&&c.onChange(l.target.files)}})}),o.jsx(de,{size:a,className:"pt-1.5"})]})})},yr="",$a=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L(),i=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:yr,control:s,name:e,rules:{required:i?!1:(t==null?void 0:t.error)??!0},render:({field:c})=>o.jsxs(X,{variant:n,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(kt,{type:"text",size:a,variant:n,placeholder:(t==null?void 0:t.placeholder)??"Write here...",...c})}),o.jsx(de,{size:a,className:"pt-1"})]})})},La=O({base:"grid gap-2"}),_r=S.forwardRef(({className:r,...e},t)=>o.jsx(Ie.Root,{className:La({className:r}),...e,ref:t}));_r.displayName=Ie.Root.displayName;const Da=O({slots:{item:["aspect-square h-4 w-4 items-center rounded-full border border-tf-accent text-tf-accent ring-offset-tf-background","focus:outline-none focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"],indicator:"relative block h-full w-full",icon:"absolute left-1/2 top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 transform fill-current text-current"}}),xr=S.forwardRef(({className:r,...e},t)=>{const{item:s,indicator:n,icon:a}=Da();return o.jsx(Ie.Item,{ref:t,className:s({className:r}),...e,children:o.jsx(Ie.Indicator,{className:n(),children:o.jsx(B.Circle,{className:a()})})})});xr.displayName=Ie.Item.displayName;const br="",Ua=({label:r,bind:e,items:t,options:s})=>{const{control:n}=W.useFormContext(),{size:a}=L(),i=s==null?void 0:s.optionalField;return o.jsx(me,{defaultValue:br,control:n,name:e,rules:{required:i?!1:(s==null?void 0:s.error)??!0},render:({field:c})=>o.jsxs(X,{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),s!=null&&s.description?o.jsx(ce,{size:a,children:s.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(_r,{ref:c.ref,value:c.value,onValueChange:c.onChange,children:t==null?void 0:t.map(d=>d.type==="item"?o.jsxs(X,{className:"flex items-center space-x-2 space-y-0",children:[o.jsx(te,{children:o.jsx(xr,{value:d.bind})}),o.jsx(ee,{size:a,className:"font-normal",children:d.label})]},d.id):null)})}),o.jsx(de,{size:a})]})})},qa=({label:r})=>{const{size:e}=L();return o.jsx("div",{className:"flex w-full justify-center pt-2",children:o.jsx(wt,{size:e,children:r})})},Ba=O({slots:{root:"relative",textarea:["flex min-h-[60px] w-full border-tf-input bg-tf-background py-2 text-tf-primary-foreground shadow-sm placeholder:text-tf-muted-foreground focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"]},variants:{variant:{default:{textarea:"rounded-tf-md border px-3 ring-offset-tf-background focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2"},outline:{root:'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-tf-ring',textarea:"border-b px-1"}},size:{sm:{textarea:"text-sm"},base:{textarea:"text-base"}}},defaultVariants:{variant:"default",size:"base"}}),wr=S.forwardRef(({variant:r,size:e,className:t,...s},n)=>{const{root:a,textarea:i}=Ba({size:e,variant:r});return o.jsx("div",{className:a(),children:o.jsx("textarea",{className:i({className:t}),ref:n,...s})})});wr.displayName="Textarea";const kr="",Wa=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L(),i=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:kr,control:s,name:e,rules:{required:i?!1:(t==null?void 0:t.error)??!0},render:({field:c})=>o.jsxs(X,{variant:n,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(wr,{...c,size:a,variant:n,placeholder:(t==null?void 0:t.placeholder)??"Write here..."})}),o.jsx(de,{size:a,className:"pt-1"})]})})},Ga=O({slots:{root:["peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2 focus-visible:ring-offset-tf-background","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-tf-accent data-[state=unchecked]:bg-tf-muted"],thumb:["pointer-events-none block h-4 w-4 rounded-full bg-tf-background shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"]}}),jr=S.forwardRef(({className:r,...e},t)=>{const{root:s,thumb:n}=Ga();return o.jsx(ut.Root,{className:s({className:r}),...e,ref:t,children:o.jsx(ut.Thumb,{className:n()})})});jr.displayName=ut.Root.displayName;const Nr=!1,Ja=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L(),i=t==null?void 0:t.optionalField;return o.jsx(me,{defaultValue:Nr,control:s,name:e,rules:{required:i?!1:(t==null?void 0:t.error)??!0},render:({field:c})=>o.jsxs(X,{variant:n,children:[o.jsxs("div",{className:"flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs(ee,{htmlFor:e,size:a,children:[r,i?o.jsx(o.Fragment,{}):o.jsx("span",{className:"ml-0.5 inline-block",children:o.jsx(B.AsteriskIcon,{className:"h-3 w-3 text-tf-destructive"})})]}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(jr,{id:e,ref:c.ref,checked:c.value,onCheckedChange:c.onChange,className:"!my-0"})})]}),o.jsx(de,{size:a})]})})},zt=O({slots:{root:"relative flex w-11 touch-none select-none items-center",track:"relative h-5 w-full grow overflow-hidden rounded-full bg-tf-muted",range:"absolute h-full bg-tf-accent",thumb:"relative block h-4 w-4 rounded-full border-2 border-transparent bg-tf-background shadow-lg focus-visible:outline-none focus-visible:ring-0 disabled:pointer-events-none disabled:opacity-50"},variants:{state:{0:{thumb:"left-0.5"},1:{thumb:"h-5 w-5 border-tf-accent"},2:{thumb:"right-0.5"}}},defaultVariants:{state:1}}),Tr=S.forwardRef(({className:r,...e},t)=>{var d;const s=(d=e.value)==null?void 0:d[0],{root:n,track:a,range:i,thumb:c}=zt({state:s});return o.jsxs(Se.Root,{disabled:!0,ref:t,className:n({className:r}),onClick:l=>{var h;if(l.preventDefault(),s!==void 0){const b=Object.keys(zt.variants.state),V=b.indexOf(s.toString()),Z=V===b.length-1?0:V+1;(h=e.onValueChange)==null||h.call(e,[Z])}},...e,children:[o.jsx(Se.Track,{className:a(),children:o.jsx(Se.Range,{className:i()})}),o.jsx(Se.Thumb,{className:c()})]})});Tr.displayName=Se.Root.displayName;const Cr=null,Ha=({label:r,bind:e,options:t})=>{const{control:s}=W.useFormContext(),{variant:n,size:a}=L();return o.jsx(me,{defaultValue:Cr,control:s,name:e,rules:{required:!1},render:({field:i})=>o.jsxs(X,{variant:n,children:[o.jsxs("div",{className:"flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ee,{htmlFor:e,size:a,children:r}),t!=null&&t.description?o.jsx(ce,{size:a,children:t.description}):o.jsx(o.Fragment,{})]}),o.jsx(te,{children:o.jsx(Tr,{id:e,ref:i.ref,min:0,max:2,step:1,value:[i.value===!0?2:i.value===null?1:0],onValueChange:c=>{i.onChange(c[0]===2?!0:c[0]===1?null:!1)}})})]}),o.jsx(de,{size:a})]})})},Ya=({subtype:r,...e})=>{var s;const t=(s=Rr.get(r))==null?void 0:s.component;return t?o.jsx(t,{...e}):o.jsx(o.Fragment,{})},Ka=({label:r})=>o.jsx(bt,{children:r}),Ar=new Map().set("category",dr).set("accordion",wa),Rr=new Map().set("simple",{defaultValue:yr,component:$a}).set("textarea",{defaultValue:kr,component:Wa}).set("toggle",{defaultValue:Nr,component:Ja}).set("file",{defaultValue:vr,component:za}).set("submit",{component:qa}).set("checkbox",{defaultValue:hr,component:Oa}).set("radiogroup",{defaultValue:br,component:Ua}).set("datepicker",{defaultValue:gr,component:Pa}).set("tri-toggle",{defaultValue:Cr,component:Ha}),Qa=new Map(Ar).set("input",Ya).set("label",Ka),Xa=q.forwardRef(({defaultValues:r,resetOnSubmit:e,children:t},s)=>{const{resetValues:n}=L(),a=q.useRef(null),i=W.useForm({defaultValues:r});q.useImperativeHandle(s,()=>a.current),q.useEffect(()=>{i.formState.isSubmitSuccessful&&e&&r&&i.reset(n||r)},[i.formState,r]);const c=b=>{var Z;const V=new CustomEvent("twintag-form-valid",{detail:b,bubbles:!0,cancelable:!1,composed:!0});(Z=a.current)==null||Z.dispatchEvent(V)},d=b=>{var Z;const V=new CustomEvent("twintag-form-invalid",{detail:b,bubbles:!0,cancelable:!1,composed:!0});(Z=a.current)==null||Z.dispatchEvent(V)},l=()=>{i.handleSubmit(c,d)()},h=()=>{var Z;const b=i.getValues(),V=new CustomEvent("twintag-form-values",{detail:b,bubbles:!0,cancelable:!1,composed:!0});(Z=a.current)==null||Z.dispatchEvent(V)};return q.useEffect(()=>{const b=a.current;return b&&(b.addEventListener("twintag-form-validate",l),b.addEventListener("twintag-form-get_values",h)),()=>{b&&(b.removeEventListener("twintag-form-validate",l),b.removeEventListener("twintag-form-get_values",h))}},[]),o.jsx(Ta,{...i,children:o.jsx("form",{ref:a,className:"relative flex w-full flex-col gap-4 font-tf-font",onSubmit:i.handleSubmit(c,d),children:t})})}),_t=({config:r})=>{const{id:e,type:t,items:s,comp:n,...a}=r;if(!t||!n)return o.jsx(o.Fragment,{});const i=n;return s&&Array.isArray(s)&&s.length>0?Ar.has(t)?o.jsx(i,{items:s,...a,children:s.map(c=>o.jsx(_t,{config:{...c}},c.id))},e):o.jsx(i,{items:s,...a},e):o.jsx(i,{...a},e)},en=()=>{const{config:r}=L();return Array.isArray(r)?o.jsx(o.Fragment,{children:r.map(e=>o.jsx(_t,{config:{...e}},e.id))}):o.jsx(_t,{config:r})},tn=q.forwardRef(({config:r,options:e},t)=>o.jsx(xa,{inputs:Rr,components:Qa,variant:e==null?void 0:e.variant,size:e==null?void 0:e.size,config:r,children:o.jsx(Xa,{ref:t,defaultValues:e==null?void 0:e.defaultValues,resetOnSubmit:e==null?void 0:e.resetOnSubmit,children:o.jsx(en,{})})}));exports.Form=tn;
|