@animaapp/anima-sdk-react 0.2.2 → 0.2.3
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 +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +99 -97
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G../node_modules/swr/dist/_internal/config-context-client-Cm1JTDEP.mjs (1:0): Module level directives cause errors when bundled, "use client" in "../node_modules/swr/dist/_internal/config-context-client-Cm1JTDEP.mjs" was ignored
|
|
2
|
+
[36mvite v6.0.11 [32mbuilding for production...[36m[39m
|
|
3
|
+
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[33m../node_modules/swr/dist/_internal/config-context-client-Cm1JTDEP.mjs (1:0): Module level directives cause errors when bundled, "use client" in "../node_modules/swr/dist/_internal/config-context-client-Cm1JTDEP.mjs" was ignored.[39m
|
|
4
4
|
[2K[1G[32m✓[39m 25 modules transformed.
|
|
5
5
|
[2K[1Grendering chunks (1)...[2K[1G[32m
|
|
6
6
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
7
|
-
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[2m112.
|
|
7
|
+
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[2m112.80 kB[22m[1m[22m[2m │ gzip: 33.30 kB[22m[2m │ map: 414.96 kB[22m
|
|
8
8
|
[32m[36m[vite:dts][32m Start rollup declaration files...[39m
|
|
9
9
|
Analysis will use the bundled TypeScript version 5.7.2
|
|
10
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
10
|
+
[32m[36m[vite:dts][32m Declaration files built in 1321ms.
|
|
11
11
|
[39m
|
|
12
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[
|
|
13
|
-
[32m✓ built in
|
|
12
|
+
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m167.05 kB[22m[1m[22m[2m │ gzip: 41.91 kB[22m[2m │ map: 432.27 kB[22m
|
|
13
|
+
[32m✓ built in 1.61s[39m
|
package/dist/index.cjs
CHANGED
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var ss;function Ca(){return ss||(ss=1,process.env.NODE_ENV!=="production"&&function(){function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}function e(g,b){h||s.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=b();if(!p){var v=b();a(l,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}v=i({inst:{value:l,getSnapshot:b}});var m=v[0].inst,V=v[1];return u(function(){m.value=l,m.getSnapshot=b,n(m)&&V({inst:m})},[g,l,b]),o(function(){return n(m)&&V({inst:m}),g(function(){n(m)&&V({inst:m})})},[g]),c(l),l}function n(g){var b=g.getSnapshot;g=g.value;try{var l=b();return!a(g,l)}catch(v){return!0}}function r(g,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=F,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;In.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),In}var as;function Na(){return as||(as=1,process.env.NODE_ENV==="production"?tn.exports=Aa():tn.exports=Ca()),tn.exports}var Pa=Na();const Ns=0,Ps=1,Rs=2,is=3;var os=Object.prototype.hasOwnProperty;function ar(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&ar(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(os.call(t,n)&&++r&&!os.call(e,n)||!(n in e)||!ar(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Re=new WeakMap,Me=()=>{},ee=Me(),ir=Object,N=t=>t===ee,we=t=>typeof t=="function",Le=(t,e)=>Be(Be({},t),e),js=t=>we(t.then),Zn={},nn={},Ar="undefined",Gt=typeof window!=Ar,or=typeof document!=Ar,Ra=Gt&&"Deno"in window,ja=()=>Gt&&typeof window.requestAnimationFrame!=Ar,Is=(t,e)=>{const n=Re.get(t);return[()=>!N(e)&&t.get(e)||Zn,r=>{if(!N(e)){const s=t.get(e);e in nn||(nn[e]=s),n[5](e,Le(s,r),s||Zn)}},n[6],()=>!N(e)&&e in nn?nn[e]:!N(e)&&t.get(e)||Zn]};let ur=!0;const Ia=()=>ur,[cr,dr]=Gt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Me,Me],Za=()=>{const t=or&&document.visibilityState;return N(t)||t!=="hidden"},Da=t=>(or&&document.addEventListener("visibilitychange",t),cr("focus",t),()=>{or&&document.removeEventListener("visibilitychange",t),dr("focus",t)}),Ma=t=>{const e=()=>{ur=!0,t()},n=()=>{ur=!1};return cr("online",e),cr("offline",n),()=>{dr("online",e),dr("offline",n)}},La={isOnline:Ia,isVisible:Za},$a={initFocus:Da,initReconnect:Ma},us=!F.useId,Zt=!Gt||Ra,Fa=t=>ja()?window.requestAnimationFrame(t):setTimeout(t,1),Dn=Zt?F.useEffect:F.useLayoutEffect,Mn=typeof navigator!="undefined"&&navigator.connection,cs=!Zt&&Mn&&(["slow-2g","2g"].includes(Mn.effectiveType)||Mn.saveData),rn=new WeakMap,Ln=(t,e)=>ir.prototype.toString.call(t)===`[object ${e}]`;let Wa=0;const lr=t=>{const e=typeof t,n=Ln(t,"Date"),r=Ln(t,"RegExp"),s=Ln(t,"Object");let a,i;if(ir(t)===t&&!n&&!r){if(a=rn.get(t),a)return a;if(a=++Wa+"~",rn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=lr(t[i])+",";rn.set(t,a)}if(s){a="#";const o=ir.keys(t).sort();for(;!N(i=o.pop());)N(t[i])||(a+=i+":"+lr(t[i])+",");rn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Cr=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?lr(t):"",[t,e]};let za=0;const fr=()=>++za;function Zs(...t){return qe(this,null,function*(){const[e,n,r,s]=t,a=Le({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(we(n)){const k=n,g=[],b=e.keys();for(const l of b)!/^\$(inf|sub)\$/.test(l)&&k(e.get(l)._k)&&g.push(l);return Promise.all(g.map(p))}return p(n);function p(k){return qe(this,null,function*(){const[g]=Cr(k);if(!g)return;const[b,l]=Is(e,g),[v,m,V,R]=Re.get(e),K=()=>{const fe=v[g];return(we(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete V[g],delete R[g],fe&&fe[0])?fe[0](Rs).then(()=>b().data):b().data};if(t.length<3)return K();let D=r,q;const j=fr();m[g]=[j,0];const $=!N(u),Oe=b(),M=Oe.data,rt=Oe._c,Ve=N(rt)?M:rt;if($&&(u=we(u)?u(Ve,M):u,l({data:u,_c:Ve})),we(D))try{D=D(Ve)}catch(fe){q=fe}if(D&&js(D))if(D=yield D.catch(fe=>{q=fe}),j!==m[g][0]){if(q)throw q;return D}else q&&$&&c(q)&&(i=!0,l({data:Ve,_c:ee}));if(i&&!q)if(we(i)){const fe=i(D,Ve);l({data:fe,error:ee,_c:ee})}else l({data:D,error:ee,_c:ee});if(m[g][1]=fr(),Promise.resolve(K()).then(()=>{l({_c:ee})}),q){if(h)throw q;return}return D})}})}const ds=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Va=(t,e)=>{if(!Re.has(t)){const n=Le($a,e),r={},s=Zs.bind(ee,t);let a=Me;const i={},o=(h,p)=>{const k=i[h]||[];return i[h]=k,k.push(p),()=>k.splice(k.indexOf(p),1)},u=(h,p,k)=>{t.set(h,p);const g=i[h];if(g)for(const b of g)b(p,k)},c=()=>{if(!Re.has(t)&&(Re.set(t,[r,{},{},{},s,u,o]),!Zt)){const h=n.initFocus(setTimeout.bind(ee,ds.bind(ee,r,Ns))),p=n.initReconnect(setTimeout.bind(ee,ds.bind(ee,r,Ps)));a=()=>{h&&h(),p&&p(),Re.delete(t)}}};return c(),[t,s,c,a]}return[t,Re.get(t)[4]]},Ua=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!N(a)&&i>a||setTimeout(r,o,s)},Ba=ar,[Ds,qa]=Va(new Map),Ka=Le({onLoadingSlow:Me,onSuccess:Me,onError:Me,onErrorRetry:Ua,onDiscarded:Me,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:cs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:cs?5e3:3e3,compare:Ba,isPaused:()=>!1,cache:Ds,mutate:qa,fallback:{}},La),Ha=(t,e)=>{const n=Le(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=Le(s,i))}return n},Ga=F.createContext({}),Ja="$inf$",Ms=Gt&&window.__SWR_DEVTOOLS_USE__,Xa=Ms?window.__SWR_DEVTOOLS_USE__:[],Ya=()=>{Ms&&(window.__SWR_DEVTOOLS_REACT__=F)},Qa=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],ei=()=>Le(Ka,F.useContext(Ga)),ti=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=Cr(e),[,,,o]=Re.get(Ds);if(i.startsWith(Ja))return n(...a);const u=o[i];return N(u)?n(...a):(delete o[i],u)}),r),ni=Xa.concat(ti),ri=t=>function(...n){const r=ei(),[s,a,i]=Qa(n),o=Ha(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(ni);for(let p=h.length;p--;)u=h[p](u);return u(s,a||o.fetcher||null,o)},si=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};Ya();const $n=F.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Fn={dedupe:!0},ai=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[g,b,l,v]=Re.get(r),[m,V]=Cr(t),R=F.useRef(!1),K=F.useRef(!1),D=F.useRef(m),q=F.useRef(e),j=F.useRef(n),$=()=>j.current,Oe=()=>$().isVisible()&&$().isOnline(),[M,rt,Ve,fe]=Is(r,m),st=F.useRef({}).current,Xt=N(i)?N(n.fallback)?ee:n.fallback[m]:i,Ir=(I,Z)=>{for(const G in st){const z=G;if(z==="data"){if(!s(I[z],Z[z])&&(!N(I[z])||!s(Qt,Z[z])))return!1}else if(Z[z]!==I[z])return!1}return!0},Zr=F.useMemo(()=>{const I=!m||!e?!1:N(o)?$().isPaused()||a?!1:u!==!1:o,Z=Y=>{const Te=Le(Y);return delete Te._k,I?Be({isValidating:!0,isLoading:!0},Te):Te},G=M(),z=fe(),ge=Z(G),ot=G===z?ge:Z(z);let H=ge;return[()=>{const Y=Z(M());return Ir(Y,H)?(H.data=Y.data,H.isLoading=Y.isLoading,H.isValidating=Y.isValidating,H.error=Y.error,H):(H=Y,Y)},()=>ot]},[r,m]),at=Pa.useSyncExternalStore(F.useCallback(I=>Ve(m,(Z,G)=>{Ir(G,Z)||I()}),[r,m]),Zr[0],Zr[1]),Dr=!R.current,Ys=g[m]&&g[m].length>0,it=at.data,Ue=N(it)?Xt&&js(Xt)?$n(Xt):Xt:it,Yt=at.error,Tn=F.useRef(Ue),Qt=k?N(it)?N(Tn.current)?Ue:Tn.current:it:Ue,Mr=Ys&&!N(Yt)?!1:Dr&&!N(o)?o:$().isPaused()?!1:a?N(Ue)?!1:u:N(Ue)||u,Lr=!!(m&&e&&Dr&&Mr),Qs=N(at.isValidating)?Lr:at.isValidating,ea=N(at.isLoading)?Lr:at.isLoading,wt=F.useCallback(I=>qe(exports,null,function*(){const Z=q.current;if(!m||!Z||K.current||$().isPaused())return!1;let G,z,ge=!0;const ot=I||{},H=!l[m]||!ot.dedupe,Y=()=>us?!K.current&&m===D.current&&R.current:m===D.current,Te={isValidating:!1,isLoading:!1},Fr=()=>{rt(Te)},Wr=()=>{const de=l[m];de&&de[1]===z&&delete l[m]},zr={isValidating:!0};N(M().data)&&(zr.isLoading=!0);try{if(H&&(rt(zr),n.loadingTimeout&&N(M().data)&&setTimeout(()=>{ge&&Y()&&$().onLoadingSlow(m,n)},n.loadingTimeout),l[m]=[Z(V),fr()]),[G,z]=l[m],G=yield G,H&&setTimeout(Wr,n.dedupingInterval),!l[m]||l[m][1]!==z)return H&&Y()&&$().onDiscarded(m),!1;Te.error=ee;const de=b[m];if(!N(de)&&(z<=de[0]||z<=de[1]||de[1]===0))return Fr(),H&&Y()&&$().onDiscarded(m),!1;const Ae=M().data;Te.data=s(Ae,G)?Ae:G,H&&Y()&&$().onSuccess(G,m,n)}catch(de){Wr();const Ae=$(),{shouldRetryOnError:An}=Ae;Ae.isPaused()||(Te.error=de,H&&Y()&&(Ae.onError(de,m,Ae),(An===!0||we(An)&&An(de))&&(!$().revalidateOnFocus||!$().revalidateOnReconnect||Oe())&&Ae.onErrorRetry(de,m,Ae,ta=>{const Cn=g[m];Cn&&Cn[0]&&Cn[0](is,ta)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return ge=!1,Fr(),!0}),[m,r]),$r=F.useCallback((...I)=>Zs(r,D.current,...I),[]);if(Dn(()=>{q.current=e,j.current=n,N(it)||(Tn.current=it)}),Dn(()=>{if(!m)return;const I=wt.bind(ee,Fn);let Z=0;const z=si(m,g,(ge,ot={})=>{if(ge==Ns){const H=Date.now();$().revalidateOnFocus&&H>Z&&Oe()&&(Z=H+$().focusThrottleInterval,I())}else if(ge==Ps)$().revalidateOnReconnect&&Oe()&&I();else{if(ge==Rs)return wt();if(ge==is)return wt(ot)}});return K.current=!1,D.current=m,R.current=!0,rt({_k:V}),Mr&&(N(Ue)||Zt?I():Fa(I)),()=>{K.current=!0,z()}},[m]),Dn(()=>{let I;function Z(){const z=we(c)?c(M().data):c;z&&I!==-1&&(I=setTimeout(G,z))}function G(){!M().error&&(h||$().isVisible())&&(p||$().isOnline())?wt(Fn).then(Z):Z()}return Z(),()=>{I&&(clearTimeout(I),I=-1)}},[c,h,p,m]),F.useDebugValue(Qt),a&&N(Ue)&&m){if(!us&&Zt)throw new Error("Fallback data is required when using Suspense in SSR.");q.current=e,j.current=n,K.current=!1;const I=v[m];if(!N(I)){const Z=$r(I);$n(Z)}if(N(Yt)){const Z=wt(Fn);N(Qt)||(Z.status="fulfilled",Z.value=!0),$n(Z)}else throw Yt}return{mutate:$r,get data(){return st.data=!0,Qt},get error(){return st.error=!0,Yt},get isValidating(){return st.isValidating=!0,Qs},get isLoading(){return st.isLoading=!0,ea}}},ii=ri(ai);var oi=Object.defineProperty,ui=Object.defineProperties,ci=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertySymbols,di=Object.prototype.hasOwnProperty,li=Object.prototype.propertyIsEnumerable,fs=(t,e,n)=>e in t?oi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))di.call(e,n)&&fs(t,n,e[n]);if(ls)for(var n of ls(e))li.call(e,n)&&fs(t,n,e[n]);return t},x=(t,e)=>ui(t,ci(e)),Ee=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var hr;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(hr||(hr={}));const _=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pe=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},f=C.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"]),fi=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}oe.create=t=>new oe(t);const gt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let Ls=gt;function hi(t){Ls=t}function pn(){return Ls}const mn=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=x(d({},s),{path:a});if(s.message!==void 0)return x(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return x(d({},s),{path:a,message:o})},pi=[];function y(t,e){const n=pn(),r=mn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===gt?void 0:gt].filter(s=>!!s)});t.common.issues.push(r)}class X{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return S;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return X.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return S;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const S=Object.freeze({status:"aborted"}),yn=t=>({status:"dirty",value:t}),te=t=>({status:"valid",value:t}),pr=t=>t.status==="aborted",mr=t=>t.status==="dirty",et=t=>t.status==="valid",Dt=t=>typeof Promise!="undefined"&&t instanceof Promise;function gn(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function $s(t,e,n,r,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var St,Ot;class xe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 hs=(t,e)=>{if(et(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new oe(t.common.issues);return this._error=n,this._error}}};function O(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return Pe(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Dt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},a=this._parseSync({data:e,path:s.path,parent:s});return hs(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return et(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>et(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield Dt(s)?s:Promise.resolve(s);return hs(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:f.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ye({schema:this,typeName:E.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:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return vt.create(this,this._def)}or(e){return Ft.create([this,e],this._def)}and(e){return Wt.create(this,e,this._def)}transform(e){return new ye(x(d({},O(this._def)),{schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new qt(x(d({},O(this._def)),{innerType:this,defaultValue:n,typeName:E.ZodDefault}))}brand(){return new Nr(d({typeName:E.ZodBranded,type:this},O(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Kt(x(d({},O(this._def)),{innerType:this,catchValue:n,typeName:E.ZodCatch}))}describe(e){const n=this.constructor;return new n(x(d({},this._def),{description:e}))}pipe(e){return Jt.create(this,e)}readonly(){return Ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mi=/^c[^\s-]{8,}$/i,yi=/^[0-9a-z]+$/,gi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_i=/^[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,vi=/^[a-z0-9_-]{21}$/i,bi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wi=/^[-+]?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)?)??$/,ki=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ei="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wn;const xi=/^(?:(?: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])$/,Si=/^(?:(?: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])$/,Oi=/^(([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]))$/,Ti=/^(([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])$/,Ai=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ci=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fs="((\\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])))",Ni=new RegExp(`^${Fs}$`);function Ws(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Pi(t){return new RegExp(`^${Ws(t)}$`)}function zs(t){let e=`${Fs}T${Ws(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ri(t,e){return!!((e==="v4"||!e)&&xi.test(t)||(e==="v6"||!e)&&Oi.test(t))}function ji(t,e){if(!bi.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function Ii(t,e){return!!((e==="v4"||!e)&&Si.test(t)||(e==="v6"||!e)&&Ti.test(t))}class pe extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.string,received:s.parsedType}),S}const n=new X;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ki.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"email",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Wn||(Wn=new RegExp(Ei,"u")),Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"emoji",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")_i.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"uuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")vi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"nanoid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")mi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")yi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid2",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")gi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ulid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),y(r,{validation:"url",code:f.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"regex",code:f.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?zs(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Ni.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Pi(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?wi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"duration",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Ri(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ip",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?ji(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"jwt",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Ii(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cidr",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64url",code:f.invalid_string,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:f.invalid_string},w.errToObj(r)))}_addCheck(e){return new pe(x(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},w.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},w.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},w.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},w.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},w.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},w.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},w.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},w.errToObj(e)))}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1},w.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(d({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},w.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},w.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},w.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},w.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},w.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},w.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},w.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},w.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},w.errToObj(n)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new pe(x(d({},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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pe.create=t=>{var e;return new pe(d({checks:[],typeName:E.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};function Zi(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class $e extends T{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)!==_.number){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.number,received:s.parsedType}),S}let n;const r=new X;for(const s of this._def.checks)s.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Zi(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new $e(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new $e(x(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}$e.create=t=>new $e(d({checks:[],typeName:E.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Fe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new X;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.bigint,received:n.parsedType}),S}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Fe(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new Fe(x(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Fe.create=t=>{var e;return new Fe(d({checks:[],typeName:E.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};class Mt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.boolean,received:n.parsedType}),S}return te(e.data)}}Mt.create=t=>new Mt(d({typeName:E.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class tt extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.date,received:s.parsedType}),S}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_date}),S}const n=new X;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):C.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tt(x(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}tt.create=t=>new tt(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:E.ZodDate},O(t)));class _n extends T{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.symbol,received:n.parsedType}),S}return te(e.data)}}_n.create=t=>new _n(d({typeName:E.ZodSymbol},O(t)));class Lt extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.undefined,received:n.parsedType}),S}return te(e.data)}}Lt.create=t=>new Lt(d({typeName:E.ZodUndefined},O(t)));class $t extends T{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.null,received:n.parsedType}),S}return te(e.data)}}$t.create=t=>new $t(d({typeName:E.ZodNull},O(t)));class _t extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}}_t.create=t=>new _t(d({typeName:E.ZodAny},O(t)));class Xe extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}}Xe.create=t=>new Xe(d({typeName:E.ZodUnknown},O(t)));class je extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.never,received:n.parsedType}),S}}je.create=t=>new je(d({typeName:E.ZodNever},O(t)));class vn extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.void,received:n.parsedType}),S}return te(e.data)}}vn.create=t=>new vn(d({typeName:E.ZodVoid},O(t)));class me extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return y(n,{code:f.invalid_type,expected:_.array,received:n.parsedType}),S;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>X.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new xe(n,i,n.path,o)));return X.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new me(x(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new me(x(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new me(x(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}me.create=(t,e)=>new me(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray},O(e)));function lt(t){if(t instanceof W){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ke.create(lt(r))}return new W(x(d({},t._def),{shape:()=>e}))}else return t instanceof me?new me(x(d({},t._def),{type:lt(t.element)})):t instanceof ke?ke.create(lt(t.unwrap())):t instanceof ze?ze.create(lt(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>lt(e))):t}class W extends T{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(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return y(u,{code:f.invalid_type,expected:_.object,received:u.parsedType}),S}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof je){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(y(r,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,p=yield c.value;u.push({key:h,value:p,alwaysSet:c.alwaysSet})}return u})).then(u=>X.mergeObjectSync(n,u)):X.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new W(d(x(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new W(x(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new W(x(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new W(x(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new W({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:E.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new W(x(d({},this._def),{catchall:e}))}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}deepPartial(){return lt(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new W(x(d({},this._def),{shape:()=>n}))}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ke;)s=s._def.innerType;n[r]=s}}),new W(x(d({},this._def),{shape:()=>n}))}keyof(){return Vs(C.objectKeys(this.shape))}}W.create=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));W.strictCreate=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strict",catchall:je.create(),typeName:E.ZodObject},O(e)));W.lazycreate=(t,e)=>new W(d({shape:t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));class Ft extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new oe(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),S}if(n.common.async)return Promise.all(r.map(a=>Ee(this,null,function*(){const i=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new oe(u));return y(n,{code:f.invalid_union,unionErrors:o}),S}}get options(){return this._def.options}}Ft.create=(t,e)=>new Ft(d({options:t,typeName:E.ZodUnion},O(e)));const Ie=t=>t instanceof Vt?Ie(t.schema):t instanceof ye?Ie(t.innerType()):t instanceof Ut?[t.value]:t instanceof We?t.options:t instanceof Bt?C.objectValues(t.enum):t instanceof qt?Ie(t._def.innerType):t instanceof Lt?[void 0]:t instanceof $t?[null]:t instanceof ke?[void 0,...Ie(t.unwrap())]:t instanceof ze?[null,...Ie(t.unwrap())]:t instanceof Nr||t instanceof Ht?Ie(t.unwrap()):t instanceof Kt?Ie(t._def.innerType):[];class On extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return y(n,{code:f.invalid_type,expected:_.object,received:n.parsedType}),S;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=Ie(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 o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new On(d({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},O(r)))}}function yr(t,e){const n=Pe(t),r=Pe(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=yr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=yr(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Wt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(pr(a)||pr(i))return S;const o=yr(a.value,i.value);return o.valid?((mr(a)||mr(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:f.invalid_intersection_types}),S)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Wt.create=(t,e,n)=>new Wt(d({left:t,right:e,typeName:E.ZodIntersection},O(n)));class Se extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return y(r,{code:f.invalid_type,expected:_.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return y(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>X.mergeArray(n,a)):X.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Se(x(d({},this._def),{rest:e}))}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se(d({items:t,typeName:E.ZodTuple,rest:null},O(e)))};class zt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return y(r,{code:f.invalid_type,expected:_.object,received:r.parsedType}),S;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new xe(r,o,r.path,o)),value:i._parse(new xe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?X.mergeObjectAsync(n,s):X.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new zt(d({keyType:e,valueType:n,typeName:E.ZodRecord},O(r))):new zt(d({keyType:pe.create(),valueType:e,typeName:E.ZodRecord},O(n)))}}class bn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return y(r,{code:f.invalid_type,expected:_.map,received:r.parsedType}),S;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new xe(r,o,r.path,[c,"key"])),value:a._parse(new xe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return S;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return S;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}bn.create=(t,e,n)=>new bn(d({valueType:e,keyType:t,typeName:E.ZodMap},O(n)));class nt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return y(r,{code:f.invalid_type,expected:_.set,received:r.parsedType}),S;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return S;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new xe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new nt(x(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new nt(x(d({},this._def),{maxSize:{value:e,message:w.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}nt.create=(t,e)=>new nt(d({valueType:t,minSize:null,maxSize:null,typeName:E.ZodSet},O(e)));class pt extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return y(n,{code:f.invalid_type,expected:_.function,received:n.parsedType}),S;function r(o,u){return mn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),gt].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:u}})}function s(o,u){return mn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),gt].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return te(function(...u){return Ee(this,null,function*(){const c=new oe([]),h=yield o._def.args.parseAsync(u,a).catch(k=>{throw c.addIssue(r(u,k)),c}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw c.addIssue(s(p,k)),c})})})}else{const o=this;return te(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new oe([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new oe([s(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pt(x(d({},this._def),{args:Se.create(e).rest(Xe.create())}))}returns(e){return new pt(x(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new pt(d({args:e||Se.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:E.ZodFunction},O(r)))}}class Vt extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vt.create=(t,e)=>new Vt(d({getter:t,typeName:E.ZodLazy},O(e)));class Ut extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ut.create=(t,e)=>new Ut(d({value:t,typeName:E.ZodLiteral},O(e)));function Vs(t,e){return new We(d({values:t,typeName:E.ZodEnum},O(e)))}class We extends T{constructor(){super(...arguments),St.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:C.joinValues(r),received:n.parsedType,code:f.invalid_type}),S}if(gn(this,St)||$s(this,St,new Set(this._def.values)),!gn(this,St).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:r}),S}return te(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return We.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return We.create(this.options.filter(r=>!e.includes(r)),d(d({},this._def),n))}}St=new WeakMap;We.create=Vs;class Bt extends T{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=C.objectValues(n);return y(r,{expected:C.joinValues(s),received:r.parsedType,code:f.invalid_type}),S}if(gn(this,Ot)||$s(this,Ot,new Set(C.getValidEnumValues(this._def.values))),!gn(this,Ot).has(e.data)){const s=C.objectValues(n);return y(r,{received:r.data,code:f.invalid_enum_value,options:s}),S}return te(e.data)}get enum(){return this._def.values}}Ot=new WeakMap;Bt.create=(t,e)=>new Bt(d({values:t,typeName:E.ZodNativeEnum},O(e)));class vt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:_.promise,received:n.parsedType}),S;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return te(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:E.ZodPromise},O(e)));class ye extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return S;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?S:u.status==="dirty"||n.value==="dirty"?yn(u.value):u}));{if(n.value==="aborted")return S;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?S:o.status==="dirty"||n.value==="dirty"?yn(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!et(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>et(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}ye.create=(t,e,n)=>new ye(d({schema:t,typeName:E.ZodEffects,effect:e},O(n)));ye.createWithPreprocess=(t,e,n)=>new ye(d({schema:e,effect:{type:"preprocess",transform:t},typeName:E.ZodEffects},O(n)));class ke extends T{_parse(e){return this._getType(e)===_.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:E.ZodOptional},O(e)));class ze extends T{_parse(e){return this._getType(e)===_.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(t,e)=>new ze(d({innerType:t,typeName:E.ZodNullable},O(e)));class qt extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}qt.create=(t,e)=>new qt(d({innerType:t,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},O(e)));class Kt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=x(d({},n),{common:x(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Dt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Kt.create=(t,e)=>new Kt(d({innerType:t,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},O(e)));class wn extends T{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.nan,received:n.parsedType}),S}return{status:"valid",value:e.data}}}wn.create=t=>new wn(d({typeName:E.ZodNaN},O(t)));const Di=Symbol("zod_brand");class Nr extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Jt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return Ee(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?S:s.status==="dirty"?(n.dirty(),yn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?S:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Jt({in:e,out:n,typeName:E.ZodPipeline})}}class Ht extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Dt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ht.create=(t,e)=>new Ht(d({innerType:t,typeName:E.ZodReadonly},O(e)));function Us(t,e={},n){return t?_t.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue(x(d({code:"custom"},c),{fatal:u}))}}):_t.create()}const Mi={object:W.lazycreate};var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const Li=(t,e={message:`Input not instance of ${t.name}`})=>Us(n=>n instanceof t,e),Bs=pe.create,qs=$e.create,$i=wn.create,Fi=Fe.create,Ks=Mt.create,Wi=tt.create,zi=_n.create,Vi=Lt.create,Ui=$t.create,Bi=_t.create,qi=Xe.create,Ki=je.create,Hi=vn.create,Gi=me.create,Ji=W.create,Xi=W.strictCreate,Yi=Ft.create,Qi=On.create,eo=Wt.create,to=Se.create,no=zt.create,ro=bn.create,so=nt.create,ao=pt.create,io=Vt.create,oo=Ut.create,uo=We.create,co=Bt.create,lo=vt.create,ps=ye.create,fo=ke.create,ho=ze.create,po=ye.createWithPreprocess,mo=Jt.create,yo=()=>Bs().optional(),go=()=>qs().optional(),_o=()=>Ks().optional(),vo={string:t=>pe.create(x(d({},t),{coerce:!0})),number:t=>$e.create(x(d({},t),{coerce:!0})),boolean:t=>Mt.create(x(d({},t),{coerce:!0})),bigint:t=>Fe.create(x(d({},t),{coerce:!0})),date:t=>tt.create(x(d({},t),{coerce:!0}))},bo=S;var ne=Object.freeze({__proto__:null,defaultErrorMap:gt,setErrorMap:hi,getErrorMap:pn,makeIssue:mn,EMPTY_PATH:pi,addIssueToContext:y,ParseStatus:X,INVALID:S,DIRTY:yn,OK:te,isAborted:pr,isDirty:mr,isValid:et,isAsync:Dt,get util(){return C},get objectUtil(){return hr},ZodParsedType:_,getParsedType:Pe,ZodType:T,datetimeRegex:zs,ZodString:pe,ZodNumber:$e,ZodBigInt:Fe,ZodBoolean:Mt,ZodDate:tt,ZodSymbol:_n,ZodUndefined:Lt,ZodNull:$t,ZodAny:_t,ZodUnknown:Xe,ZodNever:je,ZodVoid:vn,ZodArray:me,ZodObject:W,ZodUnion:Ft,ZodDiscriminatedUnion:On,ZodIntersection:Wt,ZodTuple:Se,ZodRecord:zt,ZodMap:bn,ZodSet:nt,ZodFunction:pt,ZodLazy:Vt,ZodLiteral:Ut,ZodEnum:We,ZodNativeEnum:Bt,ZodPromise:vt,ZodEffects:ye,ZodTransformer:ye,ZodOptional:ke,ZodNullable:ze,ZodDefault:qt,ZodCatch:Kt,ZodNaN:wn,BRAND:Di,ZodBranded:Nr,ZodPipeline:Jt,ZodReadonly:Ht,custom:Us,Schema:T,ZodSchema:T,late:Mi,get ZodFirstPartyTypeKind(){return E},coerce:vo,any:Bi,array:Gi,bigint:Fi,boolean:Ks,date:Wi,discriminatedUnion:Qi,effect:ps,enum:uo,function:ao,instanceof:Li,intersection:eo,lazy:io,literal:oo,map:ro,nan:$i,nativeEnum:co,never:Ki,null:Ui,nullable:ho,number:qs,object:Ji,oboolean:_o,onumber:go,optional:fo,ostring:yo,pipeline:mo,preprocess:po,promise:lo,record:no,set:so,strictObject:Xi,string:Bs,symbol:zi,transformer:ps,tuple:to,undefined:Vi,union:Yi,unknown:qi,void:Hi,NEVER:bo,ZodIssueCode:f,quotelessJson:fi,ZodError:oe});ne.object({language:ne.enum(["typescript","javascript"]).optional()}).and(ne.union([ne.object({framework:ne.literal("react"),model:ne.string().optional(),styling:ne.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:ne.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:ne.boolean().optional(),enableCompactStructure:ne.boolean().optional()}),ne.object({framework:ne.literal("html"),styling:ne.enum(["plain_css","inline_styles"]),enableTranslation:ne.boolean().optional()})]));var wo=Object.defineProperty,ko=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,ms=Object.getOwnPropertySymbols,xo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable,ys=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Hs=t=>{throw TypeError(t)},gs=(t,e,n)=>e in t?wo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e)=>{for(var n in e||(e={}))xo.call(e,n)&&gs(t,n,e[n]);if(ms)for(var n of ms(e))So.call(e,n)&&gs(t,n,e[n]);return t},Pr=(t,e)=>ko(t,Eo(e)),Rr=(t,e,n)=>e.has(t)||Hs("Cannot "+n),P=(t,e,n)=>(Rr(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Hs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),J=(t,e,n,r)=>(Rr(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Rr(t,e,"access private method"),n),U=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Oo=(t,e,n)=>(e=t[ys("asyncIterator")])?e.call(t):(t=t[ys("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),To=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ao(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gr={exports:{}},Co=gr.exports,_s;function No(){return _s||(_s=1,function(t,e){(function(n,r){t.exports=r()})(Co,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:To,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",p=s&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),l=g&&Object.getPrototypeOf(new Map().entries()),v=h&&typeof Array.prototype[Symbol.iterator]=="function",m=v&&Object.getPrototypeOf([][Symbol.iterator]()),V=h&&typeof String.prototype[Symbol.iterator]=="function",R=V&&Object.getPrototypeOf(""[Symbol.iterator]()),K=8,D=-1;function q(j){var $=typeof j;if($!=="object")return $;if(j===null)return"null";if(j===r)return"global";if(Array.isArray(j)&&(p===!1||!(Symbol.toStringTag in j)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&j===window.location)return"Location";if(typeof window.document=="object"&&j===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&j===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&j===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&j instanceof window.HTMLElement){if(j.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(j.tagName==="TD")return"HTMLTableDataCellElement";if(j.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=p&&j[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var M=Object.getPrototypeOf(j);return M===RegExp.prototype?"RegExp":M===Date.prototype?"Date":n&&M===Promise.prototype?"Promise":i&&M===Set.prototype?"Set":a&&M===Map.prototype?"Map":u&&M===WeakSet.prototype?"WeakSet":o&&M===WeakMap.prototype?"WeakMap":c&&M===DataView.prototype?"DataView":a&&M===l?"Map Iterator":i&&M===b?"Set Iterator":v&&M===m?"Array Iterator":V&&M===R?"String Iterator":M===null?"Object":Object.prototype.toString.call(j).slice(K,D)}return q})}(gr)),gr.exports}var Po=No();const Ro=Ao(Po),jr=typeof Buffer!="undefined",jo=jr&&typeof Buffer.from!="undefined",Io=jr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Zo=jo?function(t){return Buffer.from(t)}:jr?function(t){return new Buffer(t)}:function(t){return t};function bt(t){return Io(t)?"Buffer":Ro(t)}const Do=new Set(["Arguments","Array","Map","Object","Set"]);function Mo(t,e,n=null){switch(n||bt(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function _r(t){return Do.has(t)}function vs(t,e,n,r=null){switch(r||bt(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Lo=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,$o=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Fo=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,zn=Lo||$o||Fo||Function("return this")();function Wo(t){return t.slice(0)}function zo(t){return new Boolean(t.valueOf())}function Vo(t){return new DataView(t.buffer)}function Uo(t){return Zo(t)}function Bo(t){return new Date(t.getTime())}function qo(t){return new Number(t)}function Ko(t){return new RegExp(t.source,t.flags)}function Ho(t){return new String(t)}function Ce(t,e){return zn[e].from?zn[e].from(t):new zn[e](t)}function Q(t){return t}function bs(){return[]}function Go(){return new Map}function Jo(){return{}}function Xo(){return new Set}const Yo=new Map([["ArrayBuffer",Wo],["Boolean",zo],["Buffer",Uo],["DataView",Vo],["Date",Bo],["Number",qo],["RegExp",Ko],["String",Ho],["Float32Array",Ce],["Float64Array",Ce],["Int16Array",Ce],["Int32Array",Ce],["Int8Array",Ce],["Uint16Array",Ce],["Uint32Array",Ce],["Uint8Array",Ce],["Uint8ClampedArray",Ce],["Array Iterator",Q],["Map Iterator",Q],["Promise",Q],["Set Iterator",Q],["String Iterator",Q],["function",Q],["global",Q],["WeakMap",Q],["WeakSet",Q],["boolean",Q],["null",Q],["number",Q],["string",Q],["symbol",Q],["undefined",Q],["Arguments",bs],["Array",bs],["Map",Go],["Object",Jo],["Set",Xo]]);function Qo(){}function vr(t,e=null,n=Qo){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||bt(t),s=Yo.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=bt(t);if(!_r(r))return br(t,null,null,null);const s=vr(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return br(t,s,a,i)}function br(t,e,n,r,s){const a=bt(t),i=vr(t,a);if(!_r(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let u of o){const c=Mo(t,u,a);if(r.has(c))vs(e,u,n.get(c),a);else{const h=bt(c),p=vr(c,h);_r(h)&&(n.set(c,p),r.add(c)),vs(e,u,br(c,p,n,r),a)}}return e}const eu=t=>new Promise(e=>setTimeout(e,t));var on,Ge,un,wr,Gs;class tu{constructor({maxAttempts:e=3,func:n}){le(this,wr),le(this,on),le(this,Ge),le(this,un),J(this,on,e),J(this,un,n),J(this,Ge,0)}run(){return U(this,null,function*(){try{return yield P(this,un).call(this)}catch(e){if(J(this,Ge,P(this,Ge)+1),P(this,Ge)>P(this,on))throw console.error("Max attempts reached"),e;const n=be(this,wr,Gs).call(this);return yield eu(n),yield this.run()}})}}on=new WeakMap,Ge=new WeakMap,un=new WeakMap,wr=new WeakSet,Gs=function(){return P(this,Ge)*1e3*1.5};function nu(){return typeof CompressionStream!="undefined"}function ru(t){return U(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Oo(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield su(n)})}function su(t){return U(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class au extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class ws extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Tt extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class iu extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Vn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Js(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function kr(){return Math.floor(Date.now()/1e3).toString()}const ou=5*60*1e3,uu=1*1e3;var Je,re,_e,Er,xr,At;class cu{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){le(this,_e),le(this,Je),le(this,re),this.baseAddress=n,J(this,Je,e),J(this,re,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return J(this,re,e),this}get(e){return U(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(P(this,re));return J(this,re,{}),u.extraHeaders&&(o=ie(ie({},o),u.extraHeaders)),u.requestValidation&&(o=Pr(ie({},o),{"X-Request-Nonce":Js(),"X-Request-Timestamp":kr()})),u.async?yield be(this,_e,xr).call(this,`${i}${n}`,u.async,{headers:o}):yield be(this,_e,Er).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return J(this,re,{}),be(this,_e,At).call(this,r,"POST",s,a,i)})}put(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return J(this,re,{}),be(this,_e,At).call(this,r,"PUT",s,a,i)})}delete(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return J(this,re,{}),be(this,_e,At).call(this,r,"DELETE",s,a,i)})}patch(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return J(this,re,{}),be(this,_e,At).call(this,r,"PATCH",s,a,i)})}}Je=new WeakMap,re=new WeakMap,_e=new WeakSet,Er=function(t,e,n){return U(this,null,function*(){const r=()=>U(this,null,function*(){var u,c;try{return yield P(this,Je).call(this,t,ie(ie({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new Tt({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,p;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((p=u==null?void 0:u.headersObject)==null?void 0:p[c])||""},i=u=>U(this,null,function*(){var c;if(!u.ok){const p=yield u.text().catch();throw new ws({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(u,"x-response-nonce"),k=s==null?void 0:s["X-Request-Nonce"];if(!p||p!==k)throw new Vn("Response nonce mismatch");const g=Number(a(u,"x-response-timestamp")),b=Number(kr()),l=60*60*24;if(isNaN(g)||Math.abs(b-g)>l)throw new Vn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Vn(k)}let h=yield u.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const u=yield new tu({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},xr=function(t,e,n){return U(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>uu,maxTimeout:u=ou}=e,c=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield P(this,Je).call(this,c,ie(ie({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new Tt({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new ws({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:g}=k;if(!g)throw new Error("Job ID not found in response");return new Promise((b,l)=>U(this,null,function*(){const v=setTimeout(()=>{l(new Error("Job timed out"))},u),m=(V=0)=>U(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(v),P(this,Je).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{l(new Tt({canceled:!0}))}).catch(R=>{l(new Tt({canceled:!1}))});return}try{const R=yield(yield P(this,Je).call(this,`${h}/${g}`,{headers:this.headers})).json();if(R.status==="success"){clearTimeout(v);const K=R.response_json;b(K)}else if(R.status==="failed")clearTimeout(v),l(new iu(R.response_json));else{a&&a(R.response_json);const K=o(V);setTimeout(()=>m(V+1),K)}}catch(R){l(R)}});m()}))})},At=function(t,e,n,r,s){return U(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=ie(ie({},u),s.extraHeaders)),s.requestValidation&&(u=Pr(ie({},u),{"X-Request-Nonce":Js(),"X-Request-Timestamp":kr()}));let c=r.skipBodyJsonStringify?n:JSON.stringify(n);return s.compress&&nu()&&(u["Content-Encoding"]="gzip",c=yield ru(c)),s.async?yield be(this,_e,xr).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield be(this,_e,Er).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const ks=(t,e,n,r)=>t instanceof Tt?t:new au({resource:e,api:String(n),args:r,cause:t}),Un=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw ks(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw ks(o,n.resourceName,r,s)}):i}}});var Ct;class du{constructor(e){le(this,Ct),this.resourceName="Files",J(this,Ct,e)}get(e){return U(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(ie({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield P(this,Ct).get(a)})}getImageFills(e){return U(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield P(this,Ct).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}Ct=new WeakMap;const lu=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},fu=t=>t?t.ts>Date.now()-1e3*30:!1;var ve,Sr,Xs;class hu{constructor(e){le(this,Sr),le(this,ve),this.resourceName="Images",J(this,ve,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=lu(n,r,s),o=P(this,ve).cache.images.entries.get(i);if(fu(o))return o.result;o&&P(this,ve).cache.images.entries.delete(i);const u=P(this,ve).cache.images.pendingRequests.get(i);if(u)return u;const c=be(this,Sr,Xs).call(this,i,n,r,s,a);P(this,ve).cache.images.pendingRequests.set(i,c);try{return yield c}finally{P(this,ve).cache.images.pendingRequests.delete(i)}})}}ve=new WeakMap,Sr=new WeakSet,Xs=function(t,e,n,r,s){return U(this,null,function*(){const a=yield P(this,ve).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return P(this,ve).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var cn;class pu{constructor(e){le(this,cn),this.resourceName="Nodes",J(this,cn,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=Pr(ie({},s),{ids:r.join(",")}),i=new URLSearchParams(ie({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield P(this,cn).get(o)})}}cn=new WeakMap;var Ze;class mu extends cu{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),le(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Un(this,new du(this)),this.nodes=Un(this,new pu(this)),this.images=Un(this,new hu(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");J(this,Ze,e)}get token(){return P(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return P(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=P(this,Ze):P(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${P(this,Ze)}`),e}}Ze=new WeakMap;const yu=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new mu,params:s={}}){n&&(r.token=n);try{return yield r.files.get({fileKey:e,params:s})}catch(a){throw console.error(a),a}}),gu=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=ii(["figma",t,e,r],()=>s?yu({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ta;exports.useFigmaFile=gu;
|
|
21
|
+
*/var ss;function Ca(){return ss||(ss=1,process.env.NODE_ENV!=="production"&&function(){function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}function e(g,b){h||s.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=b();if(!p){var v=b();a(l,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}v=i({inst:{value:l,getSnapshot:b}});var m=v[0].inst,V=v[1];return u(function(){m.value=l,m.getSnapshot=b,n(m)&&V({inst:m})},[g,l,b]),o(function(){return n(m)&&V({inst:m}),g(function(){n(m)&&V({inst:m})})},[g]),c(l),l}function n(g){var b=g.getSnapshot;g=g.value;try{var l=b();return!a(g,l)}catch(v){return!0}}function r(g,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=F,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;In.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),In}var as;function Na(){return as||(as=1,process.env.NODE_ENV==="production"?tn.exports=Aa():tn.exports=Ca()),tn.exports}var Pa=Na();const Ns=0,Ps=1,Rs=2,is=3;var os=Object.prototype.hasOwnProperty;function ar(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&ar(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(os.call(t,n)&&++r&&!os.call(e,n)||!(n in e)||!ar(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Re=new WeakMap,Me=()=>{},te=Me(),ir=Object,N=t=>t===te,we=t=>typeof t=="function",Le=(t,e)=>Be(Be({},t),e),js=t=>we(t.then),Zn={},nn={},Ar="undefined",Gt=typeof window!=Ar,or=typeof document!=Ar,Ra=Gt&&"Deno"in window,ja=()=>Gt&&typeof window.requestAnimationFrame!=Ar,Is=(t,e)=>{const n=Re.get(t);return[()=>!N(e)&&t.get(e)||Zn,r=>{if(!N(e)){const s=t.get(e);e in nn||(nn[e]=s),n[5](e,Le(s,r),s||Zn)}},n[6],()=>!N(e)&&e in nn?nn[e]:!N(e)&&t.get(e)||Zn]};let ur=!0;const Ia=()=>ur,[cr,dr]=Gt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Me,Me],Za=()=>{const t=or&&document.visibilityState;return N(t)||t!=="hidden"},Da=t=>(or&&document.addEventListener("visibilitychange",t),cr("focus",t),()=>{or&&document.removeEventListener("visibilitychange",t),dr("focus",t)}),Ma=t=>{const e=()=>{ur=!0,t()},n=()=>{ur=!1};return cr("online",e),cr("offline",n),()=>{dr("online",e),dr("offline",n)}},La={isOnline:Ia,isVisible:Za},$a={initFocus:Da,initReconnect:Ma},us=!F.useId,Zt=!Gt||Ra,Fa=t=>ja()?window.requestAnimationFrame(t):setTimeout(t,1),Dn=Zt?F.useEffect:F.useLayoutEffect,Mn=typeof navigator!="undefined"&&navigator.connection,cs=!Zt&&Mn&&(["slow-2g","2g"].includes(Mn.effectiveType)||Mn.saveData),rn=new WeakMap,Ln=(t,e)=>ir.prototype.toString.call(t)===`[object ${e}]`;let Wa=0;const lr=t=>{const e=typeof t,n=Ln(t,"Date"),r=Ln(t,"RegExp"),s=Ln(t,"Object");let a,i;if(ir(t)===t&&!n&&!r){if(a=rn.get(t),a)return a;if(a=++Wa+"~",rn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=lr(t[i])+",";rn.set(t,a)}if(s){a="#";const o=ir.keys(t).sort();for(;!N(i=o.pop());)N(t[i])||(a+=i+":"+lr(t[i])+",");rn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Cr=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?lr(t):"",[t,e]};let za=0;const fr=()=>++za;function Zs(...t){return qe(this,null,function*(){const[e,n,r,s]=t,a=Le({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(we(n)){const k=n,g=[],b=e.keys();for(const l of b)!/^\$(inf|sub)\$/.test(l)&&k(e.get(l)._k)&&g.push(l);return Promise.all(g.map(p))}return p(n);function p(k){return qe(this,null,function*(){const[g]=Cr(k);if(!g)return;const[b,l]=Is(e,g),[v,m,V,R]=Re.get(e),K=()=>{const fe=v[g];return(we(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete V[g],delete R[g],fe&&fe[0])?fe[0](Rs).then(()=>b().data):b().data};if(t.length<3)return K();let D=r,q;const j=fr();m[g]=[j,0];const $=!N(u),Oe=b(),M=Oe.data,rt=Oe._c,Ve=N(rt)?M:rt;if($&&(u=we(u)?u(Ve,M):u,l({data:u,_c:Ve})),we(D))try{D=D(Ve)}catch(fe){q=fe}if(D&&js(D))if(D=yield D.catch(fe=>{q=fe}),j!==m[g][0]){if(q)throw q;return D}else q&&$&&c(q)&&(i=!0,l({data:Ve,_c:te}));if(i&&!q)if(we(i)){const fe=i(D,Ve);l({data:fe,error:te,_c:te})}else l({data:D,error:te,_c:te});if(m[g][1]=fr(),Promise.resolve(K()).then(()=>{l({_c:te})}),q){if(h)throw q;return}return D})}})}const ds=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Va=(t,e)=>{if(!Re.has(t)){const n=Le($a,e),r={},s=Zs.bind(te,t);let a=Me;const i={},o=(h,p)=>{const k=i[h]||[];return i[h]=k,k.push(p),()=>k.splice(k.indexOf(p),1)},u=(h,p,k)=>{t.set(h,p);const g=i[h];if(g)for(const b of g)b(p,k)},c=()=>{if(!Re.has(t)&&(Re.set(t,[r,{},{},{},s,u,o]),!Zt)){const h=n.initFocus(setTimeout.bind(te,ds.bind(te,r,Ns))),p=n.initReconnect(setTimeout.bind(te,ds.bind(te,r,Ps)));a=()=>{h&&h(),p&&p(),Re.delete(t)}}};return c(),[t,s,c,a]}return[t,Re.get(t)[4]]},Ua=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!N(a)&&i>a||setTimeout(r,o,s)},Ba=ar,[Ds,qa]=Va(new Map),Ka=Le({onLoadingSlow:Me,onSuccess:Me,onError:Me,onErrorRetry:Ua,onDiscarded:Me,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:cs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:cs?5e3:3e3,compare:Ba,isPaused:()=>!1,cache:Ds,mutate:qa,fallback:{}},La),Ha=(t,e)=>{const n=Le(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=Le(s,i))}return n},Ga=F.createContext({}),Ja="$inf$",Ms=Gt&&window.__SWR_DEVTOOLS_USE__,Xa=Ms?window.__SWR_DEVTOOLS_USE__:[],Ya=()=>{Ms&&(window.__SWR_DEVTOOLS_REACT__=F)},Qa=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],ei=()=>Le(Ka,F.useContext(Ga)),ti=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=Cr(e),[,,,o]=Re.get(Ds);if(i.startsWith(Ja))return n(...a);const u=o[i];return N(u)?n(...a):(delete o[i],u)}),r),ni=Xa.concat(ti),ri=t=>function(...n){const r=ei(),[s,a,i]=Qa(n),o=Ha(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(ni);for(let p=h.length;p--;)u=h[p](u);return u(s,a||o.fetcher||null,o)},si=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};Ya();const $n=F.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Fn={dedupe:!0},ai=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[g,b,l,v]=Re.get(r),[m,V]=Cr(t),R=F.useRef(!1),K=F.useRef(!1),D=F.useRef(m),q=F.useRef(e),j=F.useRef(n),$=()=>j.current,Oe=()=>$().isVisible()&&$().isOnline(),[M,rt,Ve,fe]=Is(r,m),st=F.useRef({}).current,Xt=N(i)?N(n.fallback)?te:n.fallback[m]:i,Ir=(I,Z)=>{for(const G in st){const z=G;if(z==="data"){if(!s(I[z],Z[z])&&(!N(I[z])||!s(Qt,Z[z])))return!1}else if(Z[z]!==I[z])return!1}return!0},Zr=F.useMemo(()=>{const I=!m||!e?!1:N(o)?$().isPaused()||a?!1:u!==!1:o,Z=Q=>{const Te=Le(Q);return delete Te._k,I?Be({isValidating:!0,isLoading:!0},Te):Te},G=M(),z=fe(),ge=Z(G),ot=G===z?ge:Z(z);let H=ge;return[()=>{const Q=Z(M());return Ir(Q,H)?(H.data=Q.data,H.isLoading=Q.isLoading,H.isValidating=Q.isValidating,H.error=Q.error,H):(H=Q,Q)},()=>ot]},[r,m]),at=Pa.useSyncExternalStore(F.useCallback(I=>Ve(m,(Z,G)=>{Ir(G,Z)||I()}),[r,m]),Zr[0],Zr[1]),Dr=!R.current,Ys=g[m]&&g[m].length>0,it=at.data,Ue=N(it)?Xt&&js(Xt)?$n(Xt):Xt:it,Yt=at.error,Tn=F.useRef(Ue),Qt=k?N(it)?N(Tn.current)?Ue:Tn.current:it:Ue,Mr=Ys&&!N(Yt)?!1:Dr&&!N(o)?o:$().isPaused()?!1:a?N(Ue)?!1:u:N(Ue)||u,Lr=!!(m&&e&&Dr&&Mr),Qs=N(at.isValidating)?Lr:at.isValidating,ea=N(at.isLoading)?Lr:at.isLoading,wt=F.useCallback(I=>qe(exports,null,function*(){const Z=q.current;if(!m||!Z||K.current||$().isPaused())return!1;let G,z,ge=!0;const ot=I||{},H=!l[m]||!ot.dedupe,Q=()=>us?!K.current&&m===D.current&&R.current:m===D.current,Te={isValidating:!1,isLoading:!1},Fr=()=>{rt(Te)},Wr=()=>{const de=l[m];de&&de[1]===z&&delete l[m]},zr={isValidating:!0};N(M().data)&&(zr.isLoading=!0);try{if(H&&(rt(zr),n.loadingTimeout&&N(M().data)&&setTimeout(()=>{ge&&Q()&&$().onLoadingSlow(m,n)},n.loadingTimeout),l[m]=[Z(V),fr()]),[G,z]=l[m],G=yield G,H&&setTimeout(Wr,n.dedupingInterval),!l[m]||l[m][1]!==z)return H&&Q()&&$().onDiscarded(m),!1;Te.error=te;const de=b[m];if(!N(de)&&(z<=de[0]||z<=de[1]||de[1]===0))return Fr(),H&&Q()&&$().onDiscarded(m),!1;const Ae=M().data;Te.data=s(Ae,G)?Ae:G,H&&Q()&&$().onSuccess(G,m,n)}catch(de){Wr();const Ae=$(),{shouldRetryOnError:An}=Ae;Ae.isPaused()||(Te.error=de,H&&Q()&&(Ae.onError(de,m,Ae),(An===!0||we(An)&&An(de))&&(!$().revalidateOnFocus||!$().revalidateOnReconnect||Oe())&&Ae.onErrorRetry(de,m,Ae,ta=>{const Cn=g[m];Cn&&Cn[0]&&Cn[0](is,ta)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return ge=!1,Fr(),!0}),[m,r]),$r=F.useCallback((...I)=>Zs(r,D.current,...I),[]);if(Dn(()=>{q.current=e,j.current=n,N(it)||(Tn.current=it)}),Dn(()=>{if(!m)return;const I=wt.bind(te,Fn);let Z=0;const z=si(m,g,(ge,ot={})=>{if(ge==Ns){const H=Date.now();$().revalidateOnFocus&&H>Z&&Oe()&&(Z=H+$().focusThrottleInterval,I())}else if(ge==Ps)$().revalidateOnReconnect&&Oe()&&I();else{if(ge==Rs)return wt();if(ge==is)return wt(ot)}});return K.current=!1,D.current=m,R.current=!0,rt({_k:V}),Mr&&(N(Ue)||Zt?I():Fa(I)),()=>{K.current=!0,z()}},[m]),Dn(()=>{let I;function Z(){const z=we(c)?c(M().data):c;z&&I!==-1&&(I=setTimeout(G,z))}function G(){!M().error&&(h||$().isVisible())&&(p||$().isOnline())?wt(Fn).then(Z):Z()}return Z(),()=>{I&&(clearTimeout(I),I=-1)}},[c,h,p,m]),F.useDebugValue(Qt),a&&N(Ue)&&m){if(!us&&Zt)throw new Error("Fallback data is required when using Suspense in SSR.");q.current=e,j.current=n,K.current=!1;const I=v[m];if(!N(I)){const Z=$r(I);$n(Z)}if(N(Yt)){const Z=wt(Fn);N(Qt)||(Z.status="fulfilled",Z.value=!0),$n(Z)}else throw Yt}return{mutate:$r,get data(){return st.data=!0,Qt},get error(){return st.error=!0,Yt},get isValidating(){return st.isValidating=!0,Qs},get isLoading(){return st.isLoading=!0,ea}}},ii=ri(ai);var oi=Object.defineProperty,ui=Object.defineProperties,ci=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertySymbols,di=Object.prototype.hasOwnProperty,li=Object.prototype.propertyIsEnumerable,fs=(t,e,n)=>e in t?oi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))di.call(e,n)&&fs(t,n,e[n]);if(ls)for(var n of ls(e))li.call(e,n)&&fs(t,n,e[n]);return t},x=(t,e)=>ui(t,ci(e)),Ee=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var hr;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(hr||(hr={}));const _=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pe=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},f=C.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"]),fi=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}oe.create=t=>new oe(t);const gt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let Ls=gt;function hi(t){Ls=t}function pn(){return Ls}const mn=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=x(d({},s),{path:a});if(s.message!==void 0)return x(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return x(d({},s),{path:a,message:o})},pi=[];function y(t,e){const n=pn(),r=mn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===gt?void 0:gt].filter(s=>!!s)});t.common.issues.push(r)}class Y{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return S;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return Y.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return S;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const S=Object.freeze({status:"aborted"}),yn=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),pr=t=>t.status==="aborted",mr=t=>t.status==="dirty",et=t=>t.status==="valid",Dt=t=>typeof Promise!="undefined"&&t instanceof Promise;function gn(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function $s(t,e,n,r,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var St,Ot;class xe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 hs=(t,e)=>{if(et(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new oe(t.common.issues);return this._error=n,this._error}}};function O(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return Pe(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Y,ctx:{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Dt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},a=this._parseSync({data:e,path:s.path,parent:s});return hs(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return et(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>et(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield Dt(s)?s:Promise.resolve(s);return hs(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:f.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ye({schema:this,typeName:E.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:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return vt.create(this,this._def)}or(e){return Ft.create([this,e],this._def)}and(e){return Wt.create(this,e,this._def)}transform(e){return new ye(x(d({},O(this._def)),{schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new qt(x(d({},O(this._def)),{innerType:this,defaultValue:n,typeName:E.ZodDefault}))}brand(){return new Nr(d({typeName:E.ZodBranded,type:this},O(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Kt(x(d({},O(this._def)),{innerType:this,catchValue:n,typeName:E.ZodCatch}))}describe(e){const n=this.constructor;return new n(x(d({},this._def),{description:e}))}pipe(e){return Jt.create(this,e)}readonly(){return Ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mi=/^c[^\s-]{8,}$/i,yi=/^[0-9a-z]+$/,gi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_i=/^[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,vi=/^[a-z0-9_-]{21}$/i,bi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wi=/^[-+]?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)?)??$/,ki=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ei="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wn;const xi=/^(?:(?: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])$/,Si=/^(?:(?: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])$/,Oi=/^(([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]))$/,Ti=/^(([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])$/,Ai=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ci=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fs="((\\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])))",Ni=new RegExp(`^${Fs}$`);function Ws(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Pi(t){return new RegExp(`^${Ws(t)}$`)}function zs(t){let e=`${Fs}T${Ws(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ri(t,e){return!!((e==="v4"||!e)&&xi.test(t)||(e==="v6"||!e)&&Oi.test(t))}function ji(t,e){if(!bi.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function Ii(t,e){return!!((e==="v4"||!e)&&Si.test(t)||(e==="v6"||!e)&&Ti.test(t))}class pe extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.string,received:s.parsedType}),S}const n=new Y;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ki.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"email",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Wn||(Wn=new RegExp(Ei,"u")),Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"emoji",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")_i.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"uuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")vi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"nanoid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")mi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")yi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid2",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")gi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ulid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),y(r,{validation:"url",code:f.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"regex",code:f.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?zs(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Ni.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Pi(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?wi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"duration",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Ri(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ip",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?ji(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"jwt",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Ii(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cidr",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64url",code:f.invalid_string,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:f.invalid_string},w.errToObj(r)))}_addCheck(e){return new pe(x(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},w.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},w.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},w.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},w.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},w.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},w.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},w.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},w.errToObj(e)))}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1},w.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(d({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},w.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},w.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},w.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},w.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},w.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},w.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},w.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},w.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},w.errToObj(n)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new pe(x(d({},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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pe.create=t=>{var e;return new pe(d({checks:[],typeName:E.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};function Zi(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class $e extends T{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)!==_.number){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.number,received:s.parsedType}),S}let n;const r=new Y;for(const s of this._def.checks)s.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Zi(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new $e(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new $e(x(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}$e.create=t=>new $e(d({checks:[],typeName:E.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Fe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new Y;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.bigint,received:n.parsedType}),S}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Fe(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new Fe(x(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Fe.create=t=>{var e;return new Fe(d({checks:[],typeName:E.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};class Mt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.boolean,received:n.parsedType}),S}return ne(e.data)}}Mt.create=t=>new Mt(d({typeName:E.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class tt extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.date,received:s.parsedType}),S}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_date}),S}const n=new Y;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):C.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tt(x(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}tt.create=t=>new tt(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:E.ZodDate},O(t)));class _n extends T{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.symbol,received:n.parsedType}),S}return ne(e.data)}}_n.create=t=>new _n(d({typeName:E.ZodSymbol},O(t)));class Lt extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.undefined,received:n.parsedType}),S}return ne(e.data)}}Lt.create=t=>new Lt(d({typeName:E.ZodUndefined},O(t)));class $t extends T{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.null,received:n.parsedType}),S}return ne(e.data)}}$t.create=t=>new $t(d({typeName:E.ZodNull},O(t)));class _t extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}_t.create=t=>new _t(d({typeName:E.ZodAny},O(t)));class Xe extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Xe.create=t=>new Xe(d({typeName:E.ZodUnknown},O(t)));class je extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.never,received:n.parsedType}),S}}je.create=t=>new je(d({typeName:E.ZodNever},O(t)));class vn extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.void,received:n.parsedType}),S}return ne(e.data)}}vn.create=t=>new vn(d({typeName:E.ZodVoid},O(t)));class me extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return y(n,{code:f.invalid_type,expected:_.array,received:n.parsedType}),S;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>Y.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new xe(n,i,n.path,o)));return Y.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new me(x(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new me(x(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new me(x(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}me.create=(t,e)=>new me(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray},O(e)));function lt(t){if(t instanceof W){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ke.create(lt(r))}return new W(x(d({},t._def),{shape:()=>e}))}else return t instanceof me?new me(x(d({},t._def),{type:lt(t.element)})):t instanceof ke?ke.create(lt(t.unwrap())):t instanceof ze?ze.create(lt(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>lt(e))):t}class W extends T{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(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return y(u,{code:f.invalid_type,expected:_.object,received:u.parsedType}),S}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof je){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(y(r,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,p=yield c.value;u.push({key:h,value:p,alwaysSet:c.alwaysSet})}return u})).then(u=>Y.mergeObjectSync(n,u)):Y.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new W(d(x(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new W(x(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new W(x(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new W(x(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new W({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:E.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new W(x(d({},this._def),{catchall:e}))}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}deepPartial(){return lt(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new W(x(d({},this._def),{shape:()=>n}))}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ke;)s=s._def.innerType;n[r]=s}}),new W(x(d({},this._def),{shape:()=>n}))}keyof(){return Vs(C.objectKeys(this.shape))}}W.create=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));W.strictCreate=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strict",catchall:je.create(),typeName:E.ZodObject},O(e)));W.lazycreate=(t,e)=>new W(d({shape:t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));class Ft extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new oe(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),S}if(n.common.async)return Promise.all(r.map(a=>Ee(this,null,function*(){const i=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new oe(u));return y(n,{code:f.invalid_union,unionErrors:o}),S}}get options(){return this._def.options}}Ft.create=(t,e)=>new Ft(d({options:t,typeName:E.ZodUnion},O(e)));const Ie=t=>t instanceof Vt?Ie(t.schema):t instanceof ye?Ie(t.innerType()):t instanceof Ut?[t.value]:t instanceof We?t.options:t instanceof Bt?C.objectValues(t.enum):t instanceof qt?Ie(t._def.innerType):t instanceof Lt?[void 0]:t instanceof $t?[null]:t instanceof ke?[void 0,...Ie(t.unwrap())]:t instanceof ze?[null,...Ie(t.unwrap())]:t instanceof Nr||t instanceof Ht?Ie(t.unwrap()):t instanceof Kt?Ie(t._def.innerType):[];class On extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return y(n,{code:f.invalid_type,expected:_.object,received:n.parsedType}),S;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=Ie(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 o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new On(d({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},O(r)))}}function yr(t,e){const n=Pe(t),r=Pe(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=yr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=yr(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Wt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(pr(a)||pr(i))return S;const o=yr(a.value,i.value);return o.valid?((mr(a)||mr(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:f.invalid_intersection_types}),S)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Wt.create=(t,e,n)=>new Wt(d({left:t,right:e,typeName:E.ZodIntersection},O(n)));class Se extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return y(r,{code:f.invalid_type,expected:_.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return y(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>Y.mergeArray(n,a)):Y.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Se(x(d({},this._def),{rest:e}))}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se(d({items:t,typeName:E.ZodTuple,rest:null},O(e)))};class zt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return y(r,{code:f.invalid_type,expected:_.object,received:r.parsedType}),S;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new xe(r,o,r.path,o)),value:i._parse(new xe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Y.mergeObjectAsync(n,s):Y.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new zt(d({keyType:e,valueType:n,typeName:E.ZodRecord},O(r))):new zt(d({keyType:pe.create(),valueType:e,typeName:E.ZodRecord},O(n)))}}class bn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return y(r,{code:f.invalid_type,expected:_.map,received:r.parsedType}),S;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new xe(r,o,r.path,[c,"key"])),value:a._parse(new xe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return S;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return S;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}bn.create=(t,e,n)=>new bn(d({valueType:e,keyType:t,typeName:E.ZodMap},O(n)));class nt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return y(r,{code:f.invalid_type,expected:_.set,received:r.parsedType}),S;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return S;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new xe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new nt(x(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new nt(x(d({},this._def),{maxSize:{value:e,message:w.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}nt.create=(t,e)=>new nt(d({valueType:t,minSize:null,maxSize:null,typeName:E.ZodSet},O(e)));class pt extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return y(n,{code:f.invalid_type,expected:_.function,received:n.parsedType}),S;function r(o,u){return mn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),gt].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:u}})}function s(o,u){return mn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pn(),gt].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return ne(function(...u){return Ee(this,null,function*(){const c=new oe([]),h=yield o._def.args.parseAsync(u,a).catch(k=>{throw c.addIssue(r(u,k)),c}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw c.addIssue(s(p,k)),c})})})}else{const o=this;return ne(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new oe([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new oe([s(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pt(x(d({},this._def),{args:Se.create(e).rest(Xe.create())}))}returns(e){return new pt(x(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new pt(d({args:e||Se.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:E.ZodFunction},O(r)))}}class Vt extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vt.create=(t,e)=>new Vt(d({getter:t,typeName:E.ZodLazy},O(e)));class Ut extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ut.create=(t,e)=>new Ut(d({value:t,typeName:E.ZodLiteral},O(e)));function Vs(t,e){return new We(d({values:t,typeName:E.ZodEnum},O(e)))}class We extends T{constructor(){super(...arguments),St.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:C.joinValues(r),received:n.parsedType,code:f.invalid_type}),S}if(gn(this,St)||$s(this,St,new Set(this._def.values)),!gn(this,St).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:r}),S}return ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return We.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return We.create(this.options.filter(r=>!e.includes(r)),d(d({},this._def),n))}}St=new WeakMap;We.create=Vs;class Bt extends T{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=C.objectValues(n);return y(r,{expected:C.joinValues(s),received:r.parsedType,code:f.invalid_type}),S}if(gn(this,Ot)||$s(this,Ot,new Set(C.getValidEnumValues(this._def.values))),!gn(this,Ot).has(e.data)){const s=C.objectValues(n);return y(r,{received:r.data,code:f.invalid_enum_value,options:s}),S}return ne(e.data)}get enum(){return this._def.values}}Ot=new WeakMap;Bt.create=(t,e)=>new Bt(d({values:t,typeName:E.ZodNativeEnum},O(e)));class vt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:_.promise,received:n.parsedType}),S;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return ne(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:E.ZodPromise},O(e)));class ye extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return S;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?S:u.status==="dirty"||n.value==="dirty"?yn(u.value):u}));{if(n.value==="aborted")return S;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?S:o.status==="dirty"||n.value==="dirty"?yn(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!et(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>et(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}ye.create=(t,e,n)=>new ye(d({schema:t,typeName:E.ZodEffects,effect:e},O(n)));ye.createWithPreprocess=(t,e,n)=>new ye(d({schema:e,effect:{type:"preprocess",transform:t},typeName:E.ZodEffects},O(n)));class ke extends T{_parse(e){return this._getType(e)===_.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:E.ZodOptional},O(e)));class ze extends T{_parse(e){return this._getType(e)===_.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(t,e)=>new ze(d({innerType:t,typeName:E.ZodNullable},O(e)));class qt extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}qt.create=(t,e)=>new qt(d({innerType:t,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},O(e)));class Kt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=x(d({},n),{common:x(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Dt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Kt.create=(t,e)=>new Kt(d({innerType:t,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},O(e)));class wn extends T{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.nan,received:n.parsedType}),S}return{status:"valid",value:e.data}}}wn.create=t=>new wn(d({typeName:E.ZodNaN},O(t)));const Di=Symbol("zod_brand");class Nr extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Jt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return Ee(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?S:s.status==="dirty"?(n.dirty(),yn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?S:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Jt({in:e,out:n,typeName:E.ZodPipeline})}}class Ht extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Dt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ht.create=(t,e)=>new Ht(d({innerType:t,typeName:E.ZodReadonly},O(e)));function Us(t,e={},n){return t?_t.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue(x(d({code:"custom"},c),{fatal:u}))}}):_t.create()}const Mi={object:W.lazycreate};var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const Li=(t,e={message:`Input not instance of ${t.name}`})=>Us(n=>n instanceof t,e),Bs=pe.create,qs=$e.create,$i=wn.create,Fi=Fe.create,Ks=Mt.create,Wi=tt.create,zi=_n.create,Vi=Lt.create,Ui=$t.create,Bi=_t.create,qi=Xe.create,Ki=je.create,Hi=vn.create,Gi=me.create,Ji=W.create,Xi=W.strictCreate,Yi=Ft.create,Qi=On.create,eo=Wt.create,to=Se.create,no=zt.create,ro=bn.create,so=nt.create,ao=pt.create,io=Vt.create,oo=Ut.create,uo=We.create,co=Bt.create,lo=vt.create,ps=ye.create,fo=ke.create,ho=ze.create,po=ye.createWithPreprocess,mo=Jt.create,yo=()=>Bs().optional(),go=()=>qs().optional(),_o=()=>Ks().optional(),vo={string:t=>pe.create(x(d({},t),{coerce:!0})),number:t=>$e.create(x(d({},t),{coerce:!0})),boolean:t=>Mt.create(x(d({},t),{coerce:!0})),bigint:t=>Fe.create(x(d({},t),{coerce:!0})),date:t=>tt.create(x(d({},t),{coerce:!0}))},bo=S;var J=Object.freeze({__proto__:null,defaultErrorMap:gt,setErrorMap:hi,getErrorMap:pn,makeIssue:mn,EMPTY_PATH:pi,addIssueToContext:y,ParseStatus:Y,INVALID:S,DIRTY:yn,OK:ne,isAborted:pr,isDirty:mr,isValid:et,isAsync:Dt,get util(){return C},get objectUtil(){return hr},ZodParsedType:_,getParsedType:Pe,ZodType:T,datetimeRegex:zs,ZodString:pe,ZodNumber:$e,ZodBigInt:Fe,ZodBoolean:Mt,ZodDate:tt,ZodSymbol:_n,ZodUndefined:Lt,ZodNull:$t,ZodAny:_t,ZodUnknown:Xe,ZodNever:je,ZodVoid:vn,ZodArray:me,ZodObject:W,ZodUnion:Ft,ZodDiscriminatedUnion:On,ZodIntersection:Wt,ZodTuple:Se,ZodRecord:zt,ZodMap:bn,ZodSet:nt,ZodFunction:pt,ZodLazy:Vt,ZodLiteral:Ut,ZodEnum:We,ZodNativeEnum:Bt,ZodPromise:vt,ZodEffects:ye,ZodTransformer:ye,ZodOptional:ke,ZodNullable:ze,ZodDefault:qt,ZodCatch:Kt,ZodNaN:wn,BRAND:Di,ZodBranded:Nr,ZodPipeline:Jt,ZodReadonly:Ht,custom:Us,Schema:T,ZodSchema:T,late:Mi,get ZodFirstPartyTypeKind(){return E},coerce:vo,any:Bi,array:Gi,bigint:Fi,boolean:Ks,date:Wi,discriminatedUnion:Qi,effect:ps,enum:uo,function:ao,instanceof:Li,intersection:eo,lazy:io,literal:oo,map:ro,nan:$i,nativeEnum:co,never:Ki,null:Ui,nullable:ho,number:qs,object:Ji,oboolean:_o,onumber:go,optional:fo,ostring:yo,pipeline:mo,preprocess:po,promise:lo,record:no,set:so,strictObject:Xi,string:Bs,symbol:zi,transformer:ps,tuple:to,undefined:Vi,union:Yi,unknown:qi,void:Hi,NEVER:bo,ZodIssueCode:f,quotelessJson:fi,ZodError:oe});J.object({language:J.enum(["typescript","javascript"]).optional()}).and(J.union([J.object({framework:J.literal("react"),model:J.string().optional(),styling:J.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:J.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:J.boolean().optional(),enableCompactStructure:J.boolean().optional(),enableAutoSplit:J.boolean().optional(),autoSplitThreshold:J.number().optional()}),J.object({framework:J.literal("html"),styling:J.enum(["plain_css","inline_styles"]),enableTranslation:J.boolean().optional()})]));var wo=Object.defineProperty,ko=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,ms=Object.getOwnPropertySymbols,xo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable,ys=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Hs=t=>{throw TypeError(t)},gs=(t,e,n)=>e in t?wo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e)=>{for(var n in e||(e={}))xo.call(e,n)&&gs(t,n,e[n]);if(ms)for(var n of ms(e))So.call(e,n)&&gs(t,n,e[n]);return t},Pr=(t,e)=>ko(t,Eo(e)),Rr=(t,e,n)=>e.has(t)||Hs("Cannot "+n),P=(t,e,n)=>(Rr(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Hs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,r)=>(Rr(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Rr(t,e,"access private method"),n),U=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Oo=(t,e,n)=>(e=t[ys("asyncIterator")])?e.call(t):(t=t[ys("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),To=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ao(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gr={exports:{}},Co=gr.exports,_s;function No(){return _s||(_s=1,function(t,e){(function(n,r){t.exports=r()})(Co,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:To,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",p=s&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),l=g&&Object.getPrototypeOf(new Map().entries()),v=h&&typeof Array.prototype[Symbol.iterator]=="function",m=v&&Object.getPrototypeOf([][Symbol.iterator]()),V=h&&typeof String.prototype[Symbol.iterator]=="function",R=V&&Object.getPrototypeOf(""[Symbol.iterator]()),K=8,D=-1;function q(j){var $=typeof j;if($!=="object")return $;if(j===null)return"null";if(j===r)return"global";if(Array.isArray(j)&&(p===!1||!(Symbol.toStringTag in j)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&j===window.location)return"Location";if(typeof window.document=="object"&&j===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&j===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&j===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&j instanceof window.HTMLElement){if(j.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(j.tagName==="TD")return"HTMLTableDataCellElement";if(j.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=p&&j[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var M=Object.getPrototypeOf(j);return M===RegExp.prototype?"RegExp":M===Date.prototype?"Date":n&&M===Promise.prototype?"Promise":i&&M===Set.prototype?"Set":a&&M===Map.prototype?"Map":u&&M===WeakSet.prototype?"WeakSet":o&&M===WeakMap.prototype?"WeakMap":c&&M===DataView.prototype?"DataView":a&&M===l?"Map Iterator":i&&M===b?"Set Iterator":v&&M===m?"Array Iterator":V&&M===R?"String Iterator":M===null?"Object":Object.prototype.toString.call(j).slice(K,D)}return q})}(gr)),gr.exports}var Po=No();const Ro=Ao(Po),jr=typeof Buffer!="undefined",jo=jr&&typeof Buffer.from!="undefined",Io=jr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Zo=jo?function(t){return Buffer.from(t)}:jr?function(t){return new Buffer(t)}:function(t){return t};function bt(t){return Io(t)?"Buffer":Ro(t)}const Do=new Set(["Arguments","Array","Map","Object","Set"]);function Mo(t,e,n=null){switch(n||bt(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function _r(t){return Do.has(t)}function vs(t,e,n,r=null){switch(r||bt(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Lo=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,$o=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Fo=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,zn=Lo||$o||Fo||Function("return this")();function Wo(t){return t.slice(0)}function zo(t){return new Boolean(t.valueOf())}function Vo(t){return new DataView(t.buffer)}function Uo(t){return Zo(t)}function Bo(t){return new Date(t.getTime())}function qo(t){return new Number(t)}function Ko(t){return new RegExp(t.source,t.flags)}function Ho(t){return new String(t)}function Ce(t,e){return zn[e].from?zn[e].from(t):new zn[e](t)}function ee(t){return t}function bs(){return[]}function Go(){return new Map}function Jo(){return{}}function Xo(){return new Set}const Yo=new Map([["ArrayBuffer",Wo],["Boolean",zo],["Buffer",Uo],["DataView",Vo],["Date",Bo],["Number",qo],["RegExp",Ko],["String",Ho],["Float32Array",Ce],["Float64Array",Ce],["Int16Array",Ce],["Int32Array",Ce],["Int8Array",Ce],["Uint16Array",Ce],["Uint32Array",Ce],["Uint8Array",Ce],["Uint8ClampedArray",Ce],["Array Iterator",ee],["Map Iterator",ee],["Promise",ee],["Set Iterator",ee],["String Iterator",ee],["function",ee],["global",ee],["WeakMap",ee],["WeakSet",ee],["boolean",ee],["null",ee],["number",ee],["string",ee],["symbol",ee],["undefined",ee],["Arguments",bs],["Array",bs],["Map",Go],["Object",Jo],["Set",Xo]]);function Qo(){}function vr(t,e=null,n=Qo){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||bt(t),s=Yo.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=bt(t);if(!_r(r))return br(t,null,null,null);const s=vr(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return br(t,s,a,i)}function br(t,e,n,r,s){const a=bt(t),i=vr(t,a);if(!_r(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let u of o){const c=Mo(t,u,a);if(r.has(c))vs(e,u,n.get(c),a);else{const h=bt(c),p=vr(c,h);_r(h)&&(n.set(c,p),r.add(c)),vs(e,u,br(c,p,n,r),a)}}return e}const eu=t=>new Promise(e=>setTimeout(e,t));var on,Ge,un,wr,Gs;class tu{constructor({maxAttempts:e=3,func:n}){le(this,wr),le(this,on),le(this,Ge),le(this,un),X(this,on,e),X(this,un,n),X(this,Ge,0)}run(){return U(this,null,function*(){try{return yield P(this,un).call(this)}catch(e){if(X(this,Ge,P(this,Ge)+1),P(this,Ge)>P(this,on))throw console.error("Max attempts reached"),e;const n=be(this,wr,Gs).call(this);return yield eu(n),yield this.run()}})}}on=new WeakMap,Ge=new WeakMap,un=new WeakMap,wr=new WeakSet,Gs=function(){return P(this,Ge)*1e3*1.5};function nu(){return typeof CompressionStream!="undefined"}function ru(t){return U(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Oo(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield su(n)})}function su(t){return U(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class au extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class ws extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Tt extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class iu extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Vn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Js(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function kr(){return Math.floor(Date.now()/1e3).toString()}const ou=5*60*1e3,uu=1*1e3;var Je,re,_e,Er,xr,At;class cu{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){le(this,_e),le(this,Je),le(this,re),this.baseAddress=n,X(this,Je,e),X(this,re,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return X(this,re,e),this}get(e){return U(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(P(this,re));return X(this,re,{}),u.extraHeaders&&(o=ie(ie({},o),u.extraHeaders)),u.requestValidation&&(o=Pr(ie({},o),{"X-Request-Nonce":Js(),"X-Request-Timestamp":kr()})),u.async?yield be(this,_e,xr).call(this,`${i}${n}`,u.async,{headers:o}):yield be(this,_e,Er).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return X(this,re,{}),be(this,_e,At).call(this,r,"POST",s,a,i)})}put(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return X(this,re,{}),be(this,_e,At).call(this,r,"PUT",s,a,i)})}delete(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return X(this,re,{}),be(this,_e,At).call(this,r,"DELETE",s,a,i)})}patch(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(P(this,re));return X(this,re,{}),be(this,_e,At).call(this,r,"PATCH",s,a,i)})}}Je=new WeakMap,re=new WeakMap,_e=new WeakSet,Er=function(t,e,n){return U(this,null,function*(){const r=()=>U(this,null,function*(){var u,c;try{return yield P(this,Je).call(this,t,ie(ie({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new Tt({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,p;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((p=u==null?void 0:u.headersObject)==null?void 0:p[c])||""},i=u=>U(this,null,function*(){var c;if(!u.ok){const p=yield u.text().catch();throw new ws({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(u,"x-response-nonce"),k=s==null?void 0:s["X-Request-Nonce"];if(!p||p!==k)throw new Vn("Response nonce mismatch");const g=Number(a(u,"x-response-timestamp")),b=Number(kr()),l=60*60*24;if(isNaN(g)||Math.abs(b-g)>l)throw new Vn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Vn(k)}let h=yield u.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const u=yield new tu({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},xr=function(t,e,n){return U(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>uu,maxTimeout:u=ou}=e,c=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield P(this,Je).call(this,c,ie(ie({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new Tt({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new ws({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:g}=k;if(!g)throw new Error("Job ID not found in response");return new Promise((b,l)=>U(this,null,function*(){const v=setTimeout(()=>{l(new Error("Job timed out"))},u),m=(V=0)=>U(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(v),P(this,Je).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{l(new Tt({canceled:!0}))}).catch(R=>{l(new Tt({canceled:!1}))});return}try{const R=yield(yield P(this,Je).call(this,`${h}/${g}`,{headers:this.headers})).json();if(R.status==="success"){clearTimeout(v);const K=R.response_json;b(K)}else if(R.status==="failed")clearTimeout(v),l(new iu(R.response_json));else{a&&a(R.response_json);const K=o(V);setTimeout(()=>m(V+1),K)}}catch(R){l(R)}});m()}))})},At=function(t,e,n,r,s){return U(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=ie(ie({},u),s.extraHeaders)),s.requestValidation&&(u=Pr(ie({},u),{"X-Request-Nonce":Js(),"X-Request-Timestamp":kr()}));let c=r.skipBodyJsonStringify?n:JSON.stringify(n);return s.compress&&nu()&&(u["Content-Encoding"]="gzip",c=yield ru(c)),s.async?yield be(this,_e,xr).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield be(this,_e,Er).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const ks=(t,e,n,r)=>t instanceof Tt?t:new au({resource:e,api:String(n),args:r,cause:t}),Un=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw ks(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw ks(o,n.resourceName,r,s)}):i}}});var Ct;class du{constructor(e){le(this,Ct),this.resourceName="Files",X(this,Ct,e)}get(e){return U(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(ie({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield P(this,Ct).get(a)})}getImageFills(e){return U(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield P(this,Ct).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}Ct=new WeakMap;const lu=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},fu=t=>t?t.ts>Date.now()-1e3*30:!1;var ve,Sr,Xs;class hu{constructor(e){le(this,Sr),le(this,ve),this.resourceName="Images",X(this,ve,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=lu(n,r,s),o=P(this,ve).cache.images.entries.get(i);if(fu(o))return o.result;o&&P(this,ve).cache.images.entries.delete(i);const u=P(this,ve).cache.images.pendingRequests.get(i);if(u)return u;const c=be(this,Sr,Xs).call(this,i,n,r,s,a);P(this,ve).cache.images.pendingRequests.set(i,c);try{return yield c}finally{P(this,ve).cache.images.pendingRequests.delete(i)}})}}ve=new WeakMap,Sr=new WeakSet,Xs=function(t,e,n,r,s){return U(this,null,function*(){const a=yield P(this,ve).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return P(this,ve).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var cn;class pu{constructor(e){le(this,cn),this.resourceName="Nodes",X(this,cn,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=Pr(ie({},s),{ids:r.join(",")}),i=new URLSearchParams(ie({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield P(this,cn).get(o)})}}cn=new WeakMap;var Ze;class mu extends cu{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),le(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Un(this,new du(this)),this.nodes=Un(this,new pu(this)),this.images=Un(this,new hu(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");X(this,Ze,e)}get token(){return P(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return P(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=P(this,Ze):P(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${P(this,Ze)}`),e}}Ze=new WeakMap;const yu=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new mu,params:s={}}){n&&(r.token=n);try{return yield r.files.get({fileKey:e,params:s})}catch(a){throw console.error(a),a}}),gu=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=ii(["figma",t,e,r],()=>s?yu({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ta;exports.useFigmaFile=gu;
|
|
22
22
|
//# sourceMappingURL=index.cjs.map
|