@service_laboratory/auth 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +184 -37
- package/dist/index.js +5374 -633
- package/dist/index.umd.cjs +45 -2
- package/package.json +38 -38
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Y,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react"),require("@service_laboratory/ui"),require("lucide-react"),require("react-dom"),require("@tanstack/store")):typeof define=="function"&&define.amd?define(["exports","react","@service_laboratory/ui","lucide-react","react-dom","@tanstack/store"],N):(Y=typeof globalThis<"u"?globalThis:Y||self,N(Y.auth={},Y.react,Y["@service_laboratory/ui"],Y["lucide-react"],Y["react-dom"],Y["@tanstack/store"]))})(this,(function(Y,N,_,Te,lo,Sr){"use strict";function fo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const me=fo(N),_e={loginForm:{emailInput:"login-form-email-input",passwordInput:"login-form-password-input",submitButton:"login-form-submit-button",signUpFormLink:"login-form-signup-link",resetPasswordLink:"login-form-reset-password-link"},signupForm:{emailInput:"signup-form-email-input",passwordInput:"signup-form-password-input",submitButton:"signup-form-submit-button"},verifyEmailForm:{authCodeInput:"verify-email-form-auth-code-input",submitButton:"verify-email-form-submit-button"},startResetPasswordForm:{emailInput:"start-reset-password-form-email-input",submitButton:"start-reset-password-form-submit-button"},confirmResetPasswordForm:{authCodeInput:"confirm-reset-password-form-auth-code-input",newPasswordInput:"confirm-reset-password-form-new-password-input",submitButton:"confirm-reset-password-form-submit-button"}};var _t={exports:{}},tt={};var Or;function mo(){if(Or)return tt;Or=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var a in o)a!=="key"&&(i[a]=o[a])}else i=o;return o=i.ref,{$$typeof:e,type:n,key:s,ref:o!==void 0?o:null,props:i}}return tt.Fragment=t,tt.jsx=r,tt.jsxs=r,tt}var rt={};var xr;function ho(){return xr||(xr=1,process.env.NODE_ENV!=="production"&&(function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Se?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case I:return"Fragment";case F:return"Profiler";case V:return"StrictMode";case U:return"Suspense";case J:return"SuspenseList";case oe:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case x:return"Portal";case P:return u.displayName||"Context";case L:return(u._context.displayName||"Context")+".Consumer";case $:var S=u.render;return u=u.displayName,u||(u=S.displayName||S.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case te:return S=u.displayName||null,S!==null?S:e(u.type)||"Memo";case fe:S=u._payload,u=u._init;try{return e(u(S))}catch{}}return null}function t(u){return""+u}function r(u){try{t(u);var S=!1}catch{S=!0}if(S){S=console;var j=S.error,D=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return j.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",D),t(u)}}function n(u){if(u===I)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===fe)return"<...>";try{var S=e(u);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function o(){var u=C.A;return u===null?null:u.getOwner()}function i(){return Error("react-stack-top-frame")}function s(u){if(Z.call(u,"key")){var S=Object.getOwnPropertyDescriptor(u,"key").get;if(S&&S.isReactWarning)return!1}return u.key!==void 0}function a(u,S){function j(){de||(de=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",S))}j.isReactWarning=!0,Object.defineProperty(u,"key",{get:j,configurable:!0})}function l(){var u=e(this.type);return se[u]||(se[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function h(u,S,j,D,pe,ie){var A=j.ref;return u={$$typeof:O,type:u,key:S,props:j,_owner:D},(A!==void 0?A:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:l}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:pe}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ie}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function b(u,S,j,D,pe,ie){var A=S.children;if(A!==void 0)if(D)if(G(A)){for(D=0;D<A.length;D++)g(A[D]);Object.freeze&&Object.freeze(A)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(A);if(Z.call(S,"key")){A=e(u);var ee=Object.keys(S).filter(function(je){return je!=="key"});D=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",ze[A+D]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,S,b,P,b),Se[b+S]=!0)}if(b=null,_!==void 0&&(a(_),b=""+_),j(l)&&(a(l.key),b=""+l.key),"key"in l){_={};for(var te in l)te!=="key"&&(_[te]=l[te])}else _=l;return b&&y(_,typeof t=="function"?t.displayName||t.name||"Unknown":t),E(t,b,_,u(),Y,ee)}function f(t){m(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===X&&(t._payload.status==="fulfilled"?m(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function m(t){return typeof t=="object"&&t!==null&&t.$$typeof===c}var i=w,c=Symbol.for("react.transitional.element"),d=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),He=Symbol.for("react.activity"),Be=Symbol.for("react.client.reference"),Z=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=Object.prototype.hasOwnProperty,qe=Array.isArray,Q=console.createTask?console.createTask:function(){return null};i={react_stack_bottom_frame:function(t){return t()}};var pe,_e={},Ee=i.react_stack_bottom_frame.bind(i,h)(),ge=Q(s(h)),Se={};U.Fragment=p,U.jsx=function(t,l,_){var S=1e4>Z.recentlyCreatedOwnerStacks++;return v(t,l,_,!1,S?Error("react-stack-top-frame"):Ee,S?Q(s(t)):ge)},U.jsxs=function(t,l,_){var S=1e4>Z.recentlyCreatedOwnerStacks++;return v(t,l,_,!0,S?Error("react-stack-top-frame"):Ee,S?Q(s(t)):ge)}})()),U}var ae;function we(){return ae||(ae=1,process.env.NODE_ENV==="production"?V.exports=xe():V.exports=ye()),V.exports}var r=we(),Oe=process.env.NODE_ENV==="production";function je(e,n){if(!Oe){if(e)return;var a="Warning: "+n;typeof console<"u"&&console.warn(a);try{throw Error(a)}catch{}}}var W={exports:{}},G={},z={exports:{}},H={};var se;function Le(){if(se)return H;se=1;var e=w;function n(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var a=typeof Object.is=="function"?Object.is:n,s=e.useState,u=e.useEffect,h=e.useLayoutEffect,j=e.useDebugValue;function y(f,m){var i=m(),c=s({inst:{value:i,getSnapshot:m}}),d=c[0].inst,p=c[1];return h(function(){d.value=i,d.getSnapshot=m,L(d)&&p({inst:d})},[f,i,m]),u(function(){return L(d)&&p({inst:d}),f(function(){L(d)&&p({inst:d})})},[f]),j(i),i}function L(f){var m=f.getSnapshot;f=f.value;try{var i=m();return!a(f,i)}catch{return!0}}function E(f,m){return m()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?E:y;return H.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,H}var B={};var ie;function Te(){return ie||(ie=1,process.env.NODE_ENV!=="production"&&(function(){function e(i,c){return i===c&&(i!==0||1/i===1/c)||i!==i&&c!==c}function n(i,c){v||u.startTransition===void 0||(v=!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 d=c();if(!f){var p=c();h(d,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}p=j({inst:{value:d,getSnapshot:c}});var O=p[0].inst,C=p[1];return L(function(){O.value=d,O.getSnapshot=c,a(O)&&C({inst:O})},[i,d,c]),y(function(){return a(O)&&C({inst:O}),i(function(){a(O)&&C({inst:O})})},[i]),E(d),d}function a(i){var c=i.getSnapshot;i=i.value;try{var d=c();return!h(i,d)}catch{return!0}}function s(i,c){return c()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var u=w,h=typeof Object.is=="function"?Object.is:e,j=u.useState,y=u.useEffect,L=u.useLayoutEffect,E=u.useDebugValue,v=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:n;B.useSyncExternalStore=u.useSyncExternalStore!==void 0?u.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),B}var le;function ue(){return le||(le=1,process.env.NODE_ENV==="production"?z.exports=Le():z.exports=Te()),z.exports}var ce;function Ce(){if(ce)return G;ce=1;var e=w,n=ue();function a(E,v){return E===v&&(E!==0||1/E===1/v)||E!==E&&v!==v}var s=typeof Object.is=="function"?Object.is:a,u=n.useSyncExternalStore,h=e.useRef,j=e.useEffect,y=e.useMemo,L=e.useDebugValue;return G.useSyncExternalStoreWithSelector=function(E,v,f,m,i){var c=h(null);if(c.current===null){var d={hasValue:!1,value:null};c.current=d}else d=c.current;c=y(function(){function O(g){if(!C){if(C=!0,k=g,g=m(g),i!==void 0&&d.hasValue){var T=d.value;if(i(T,g))return N=T}return N=g}if(T=N,s(k,g))return T;var I=m(g);return i!==void 0&&i(T,I)?(k=g,T):(k=g,N=I)}var C=!1,k,N,D=f===void 0?null:f;return[function(){return O(v())},D===null?void 0:function(){return O(D())}]},[v,f,m,i]);var p=u(E,c[0],c[1]);return j(function(){d.hasValue=!0,d.value=p},[p]),L(p),p},G}var q={};var de;function ke(){return de||(de=1,process.env.NODE_ENV!=="production"&&(function(){function e(E,v){return E===v&&(E!==0||1/E===1/v)||E!==E&&v!==v}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=w,a=ue(),s=typeof Object.is=="function"?Object.is:e,u=a.useSyncExternalStore,h=n.useRef,j=n.useEffect,y=n.useMemo,L=n.useDebugValue;q.useSyncExternalStoreWithSelector=function(E,v,f,m,i){var c=h(null);if(c.current===null){var d={hasValue:!1,value:null};c.current=d}else d=c.current;c=y(function(){function O(g){if(!C){if(C=!0,k=g,g=m(g),i!==void 0&&d.hasValue){var T=d.value;if(i(T,g))return N=T}return N=g}if(T=N,s(k,g))return T;var I=m(g);return i!==void 0&&i(T,I)?(k=g,T):(k=g,N=I)}var C=!1,k,N,D=f===void 0?null:f;return[function(){return O(v())},D===null?void 0:function(){return O(D())}]},[v,f,m,i]);var p=u(E,c[0],c[1]);return j(function(){d.hasValue=!0,d.value=p},[p]),L(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),q}var fe;function Ne(){return fe||(fe=1,process.env.NODE_ENV==="production"?W.exports=Ce():W.exports=ke()),W.exports}var Re=Ne();function Fe(e,n=s=>s,a={}){const s=a.equal??Ae;return Re.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,n,s)}function Ae(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[s,u]of e)if(!n.has(s)||!Object.is(u,n.get(s)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}if(e instanceof Date&&n instanceof Date)return e.getTime()===n.getTime();const a=me(e);if(a.length!==me(n).length)return!1;for(let s=0;s<a.length;s++)if(!Object.prototype.hasOwnProperty.call(n,a[s])||!Object.is(e[a[s]],n[a[s]]))return!1;return!0}function me(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const K=$.createContext(null);function De(){return typeof document>"u"?K:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=K,K)}function Ie(e){const n=$.useContext(De());return je(!!n,"useRouter must be used inside a <RouterProvider> component!"),n}function Pe(e){const n=Ie();return $.useCallback(a=>n.navigate({...a,from:a.from??e?.from}),[e?.from,n])}const Me=({auth:e,children:n})=>{const a=Pe(),{isLoaded:s,isAuthenticated:u}=Fe(e.accountStore,y=>y),[h,j]=w.useState(0);return w.useEffect(()=>{const y=setInterval(()=>{j(L=>L===100?(clearInterval(y),L):L+1)},100);return()=>clearInterval(y)},[]),w.useEffect(()=>{e.initAuthData(),e.load()},[e]),w.useEffect(()=>{s&&!u&&a({to:"/auth/login"})},[s,u,a]),s&&u?n:h>5?r.jsx("div",{className:"flex items-center justify-center h-screen",children:r.jsxs("div",{className:"p-4 rounded w-1/2",children:[r.jsx("h2",{className:"text-center",children:"account loading..."}),r.jsx(o.Progress,{value:h})]})}):null},Ue=({reset:e,processing:n})=>{const[a,s]=w.useState(!1);return r.jsxs("div",{className:o.cn("fixed right-0 top-0 py-5 px-10 bg-white border-grey border-2 w-100 h-45 rounded-2xl",{"opacity-50 h-10 w-5 p-5":!a}),children:[r.jsx(o.Button,{onClick:()=>{s(!a)},variant:"ghost",className:"cursor-pointer absolute top-0 right-0",size:"icon",children:a?r.jsx(R.Minus,{}):r.jsx(R.Plus,{})}),a&&r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Developer Panel"}),r.jsx("p",{className:"text-gray-500 mb-5",children:"Welcome to the developer panel!"}),r.jsx(o.Button,{onClick:e,className:"cursor-pointer relative w-20",variant:"destructive",disabled:n,children:n?r.jsx(R.Loader2Icon,{className:"animate-spin"}):"reset"})]})]})},F={loginForm:{emailInput:"login-form-email-input",passwordInput:"login-form-password-input",submitButton:"login-form-submit-button",signUpFormLink:"login-form-signup-link"},signupForm:{emailInput:"signup-form-email-input",passwordInput:"signup-form-password-input",submitButton:"signup-form-submit-button"},verifyEmailForm:{authCodeInput:"verify-email-form-auth-code-input",submitButton:"verify-email-form-submit-button"}};function Ve(e){const[n,a]=w.useState(!1);return r.jsx("div",{className:"flex flex-col gap-6",children:r.jsxs(o.Card,{className:o.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[r.jsxs(o.CardHeader,{children:[r.jsx(o.CardTitle,{className:"text-2xl",children:e.loginFormTitle}),r.jsx(o.CardDescription,{children:e.loginFormDescription})]}),r.jsx(o.CardContent,{children:r.jsx(o.Form,{...e.form,children:r.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:r.jsxs("div",{className:"flex flex-col gap-6",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(o.Label,{htmlFor:"email",children:e.emailLabel}),r.jsx(o.FormField,{control:e.form.control,name:"email",render:({field:s})=>r.jsxs(o.FormItem,{children:[r.jsx(o.FormControl,{children:r.jsx(o.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":F.loginForm.emailInput,...s})}),r.jsx(o.FormMessage,{})]})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx(o.Label,{htmlFor:"password",children:e.passwordLabel}),e.resetPasswordLinkComponent?e.resetPasswordLinkComponent():null]}),r.jsx(o.FormField,{control:e.form.control,name:"password",render:({field:s})=>r.jsxs(o.FormItem,{children:[r.jsx(o.FormControl,{className:"relative",children:r.jsxs("div",{className:"relative",children:[n?r.jsx(R.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{a(!1)}}):r.jsx(R.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{a(!0)}}),r.jsx(o.Input,{placeholder:"********",disabled:e.form.formState.isSubmitting,"data-testid":F.loginForm.passwordInput,...s,className:"pr-10","aria-invalid":!!e.form.formState.errors?.password,type:n?"text":"password"})]})}),r.jsx(o.FormMessage,{})]})})]}),r.jsxs(o.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":F.loginForm.submitButton,children:[e.submitButtonLabel,e.form.formState.isSubmitting&&r.jsx(R.Loader2Icon,{className:"animate-spin"})]}),e.signUpLinkComponent?r.jsx(o.FieldDescription,{className:"text-center",children:e.signUpLinkComponent()}):null]})})})})]})})}function We(e){const[n,a]=w.useState(!1);return r.jsx("div",{className:"flex flex-col gap-6",children:r.jsxs(o.Card,{className:o.cn({"opacity-50":e.form.formState.isSubmitting}),children:[r.jsxs(o.CardHeader,{children:[r.jsx(o.CardTitle,{className:"text-2xl",children:e.signUpFormTitle}),r.jsx(o.CardDescription,{children:e.signUpFormDescription})]}),r.jsx(o.CardContent,{children:r.jsx(o.Form,{...e.form,children:r.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:r.jsxs("div",{className:"flex flex-col gap-6",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(o.Label,{children:e.emailLabel}),r.jsx(o.FormField,{control:e.form.control,name:"email",render:({field:s})=>r.jsx(o.FormItem,{children:r.jsx(o.FormControl,{children:r.jsx(o.Input,{disabled:e.form.formState.isSubmitting,type:"email","data-testid":F.signupForm.emailInput,placeholder:"m@example.com",required:!0,...s})})})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx(o.Label,{children:e.passwordLabel}),e.resetPasswordLinkComponent?e.resetPasswordLinkComponent():null]}),r.jsx(o.FormField,{control:e.form.control,name:"password",render:({field:s,fieldState:u})=>r.jsx(o.FormItem,{children:r.jsx(o.FormControl,{className:"relative",children:r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[n?r.jsx(R.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{a(!1)}}):r.jsx(R.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{a(!0)}}),r.jsx(o.Input,{disabled:e.form.formState.isSubmitting,type:n?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":F.signupForm.passwordInput,...s,className:"pr-10"})]}),u.invalid&&r.jsx(o.FieldError,{errors:[u.error]})]})})})})]}),r.jsxs(o.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":F.signupForm.submitButton,children:[e.submitButtonLabel,e.form.formState.isSubmitting&&r.jsx(R.Loader2Icon,{className:"animate-spin"})]}),e.loginLinkComponent?r.jsx(o.FieldDescription,{className:"text-center",children:e.loginLinkComponent()}):null]})})})})]})})}function ze(e){return r.jsx("div",{className:"flex flex-col gap-6",children:r.jsxs(o.Card,{children:[r.jsxs(o.CardHeader,{children:[r.jsx(o.CardTitle,{className:"text-2xl",children:e.verifyEmailTitle}),r.jsx(o.CardDescription,{children:e.verifyEmailDescription})]}),r.jsx(o.CardContent,{children:r.jsx(o.Form,{...e.form,children:r.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:r.jsxs("div",{className:"flex flex-col gap-6",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(o.Label,{children:e.codeLabel}),r.jsx(o.FormField,{control:e.form.control,name:"code",render:({field:n})=>r.jsx(o.FormItem,{children:r.jsx(o.FormControl,{children:r.jsx(o.Input,{type:"text",placeholder:"00001234","data-testid":F.verifyEmailForm.authCodeInput,required:!0,...n})})})})]}),r.jsx(o.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":F.verifyEmailForm.submitButton,children:e.submitButtonLabel}),e.loginLinkComponent?r.jsx(o.FieldDescription,{className:"text-center",children:e.loginLinkComponent()}):null]})})})})]})})}const J="Authorization",he=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),A=new re.Store(he()),Ye=new re.Derived({fn:()=>!!A.state.user?.roles.find(e=>e.name==="admin"),deps:[A]});class $e{accountStore;httpClient;constructor(n){this.httpClient=n,this.accountStore=A}initAuthData(){const n=localStorage.getItem("token");n&&(this.httpClient.defaults.headers.common[J]=n)}async load(){try{const{data:n}=await this.httpClient.get("/api/auth/account/me");A.setState(()=>({user:n.user,sessionID:n.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{A.setState(n=>({...n,isLoaded:!0}))}}async login(n){const a=await this.httpClient.post("/api/auth/account/login",n),{user:s,token:u,session_id:h}=a.data;return this._initUserData({user:s,token:u,sessionID:h}),s}signup(n){return this.httpClient.post("/api/auth/account/signup",n)}async verifyEmail(n){const a=await this.httpClient.post("/api/auth/account/verify-email",n);this._initUserData(a.data)}logout(){A.setState(()=>({...he(),isLoaded:!0})),this._clearAuthData()}startResetPassword(n){return this.httpClient.post("/api/auth/account/start-reset-password",n)}async resetPassword(n){const a=await this.httpClient.post("/api/auth/account/reset-password",n);this._initUserData(a.data)}_initUserData({user:n,token:a,sessionID:s}){this._setAuthData(a),A.setState(()=>({user:n,isAuthenticated:!0,isLoaded:!0,sessionID:s}))}_setAuthData(n){localStorage.setItem("token",n),this.httpClient.defaults.headers.common[J]=n}_clearAuthData(){localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[J]}}const Ge={notificationsErrorsMap:{"User is not enabled":"auth.loginForm.errors.notifications.userIsNotEnabled","Email not verified":"auth.loginForm.errors.notifications.emailNotVerified","Email not found":"auth.loginForm.errors.notifications.emailNotFound","Invalid password":"auth.loginForm.errors.notifications.invalidPassword","Email is already used":"auth.signUpForm.errors.notifications.emailAlreadyExists","Wrong verification code":"auth.verifyEmailForm.errors.notifications.wrongAuthCode"},fieldsErrorsMap:{"User is not enabled":"email","Email not verified":"email","Email not found":"email","Invalid password":"password","Email is already used":"email"},ru:{verifyEmailForm:{form:{title:"Подтверждение почты",submitButtonLabel:"Подтвердить",codeLabel:"Код подтверждения",verifyEmailDescription:"Введите код подтверждения, отправленный на вашу почту.",loginLinkMessage:"Почта уже подтверждена?",loginLink:"Войти"},success:{notifications:{verifyEmailSuccess:"Почта успешно подтверждена"}},errors:{notifications:{wrongAuthCode:"Неверный код подтверждения",unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз, либо обратитесь в службу поддержки"}}},loginForm:{form:{title:"Вход",description:"Введите данные для входа",emailLabel:"Email",passwordLabel:"Пароль",forgotPasswordMessage:"Забыли пароль?",submitButtonLabel:"Войти",dontHaveAccountMessage:"Нет аккаунта?",dontHaveAccountLink:"Зарегистрироваться"},errors:{notifications:{emailNotFound:"Пользователь с email {{email}} не найден",userIsNotEnabled:"Пользователь не активирован",emailNotVerified:"Почта не подтверждена",invalidPassword:"Неверный пароль",unknownError:"Не удалось войти в систему",unknownErrorDescription:"Попробуйте войти позже, либо обратитесь в службу поддержки"}},success:{notifications:{loginSuccess:"Вы успешно вошли в систему"}}},signUpForm:{form:{title:"Регистрация",description:"Введите данные для регистрации",emailLabel:"Email",passwordLabel:"Пароль",submitButtonLabel:"Зарегистрироваться",forgotPasswordMessage:"Забыли пароль?",loginLinkMessage:"Уже есть аккаунт?",loginLink:"Войти"},errors:{notifications:{unknownError:"Ошибка регистрации",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь к администратору",emailAlreadyExists:"Пользователь с email {{email}} уже существует"},fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"}},success:{notifications:{signUpSuccess:"Вы успешно зарегистрированы"}}}},en:{verifyEmailForm:{form:{title:"Verify email",submitButtonLabel:"Verify",codeLabel:"Verification code",verifyEmailDescription:"Enter the verification code sent to your email.",loginLinkMessage:"Email already verified?",loginLink:"Login"},success:{notifications:{verifyEmailSuccess:"Email successfully verified"}},errors:{notifications:{wrongAuthCode:"Wrong verification code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},loginForm:{form:{title:"Login",description:"Enter your login details",emailLabel:"Email",passwordLabel:"Password",forgotPasswordMessage:"Forgot password?",submitButtonLabel:"Login",dontHaveAccountMessage:"Don't have an account?",dontHaveAccountLink:"Register"},errors:{notifications:{emailNotFound:"User with email {{email}} not found",userIsNotEnabled:"User is not enabled",emailNotVerified:"Email not verified",invalidPassword:"Invalid password"}},success:{notifications:{loginSuccess:"You have successfully logged in"}}},signUpForm:{form:{title:"Registration",description:"Enter your registration details",emailLabel:"Email",passwordLabel:"Password",submitButtonLabel:"Register",forgotPasswordMessage:"Forgot password?",loginLinkMessage:"Already have an account?",loginLink:"Login"},errors:{notifications:{unknownError:"Signup failed",unknownErrorDescription:"Please try again or contact the administrator",emailAlreadyExists:"User with email {{email}} already exists"}},success:{notifications:{signUpSuccess:"You have successfully registered"}}}}};x.Auth=$e,x.AuthWrapper=Me,x.DevPanel=Ue,x.LoginForm=Ve,x.SignUpForm=We,x.VerifyEmailForm=ze,x.authE2EConfig=F,x.isAdmin=Ye,x.locale=Ge,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,D,A,ee,A),ze[A+D]=!0)}if(A=null,j!==void 0&&(r(j),A=""+j),s(S)&&(r(S.key),A=""+S.key),"key"in S){j={};for(var ge in S)ge!=="key"&&(j[ge]=S[ge])}else j=S;return A&&a(j,typeof u=="function"?u.displayName||u.name||"Unknown":u),h(u,A,j,o(),pe,ie)}function g(u){v(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===fe&&(u._payload.status==="fulfilled"?v(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function v(u){return typeof u=="object"&&u!==null&&u.$$typeof===O}var p=N,O=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),P=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),Se=Symbol.for("react.client.reference"),C=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,G=Array.isArray,H=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(u){return u()}};var de,se={},Oe=p.react_stack_bottom_frame.bind(p,i)(),xe=H(n(i)),ze={};rt.Fragment=I,rt.jsx=function(u,S,j){var D=1e4>C.recentlyCreatedOwnerStacks++;return b(u,S,j,!1,D?Error("react-stack-top-frame"):Oe,D?H(n(u)):xe)},rt.jsxs=function(u,S,j){var D=1e4>C.recentlyCreatedOwnerStacks++;return b(u,S,j,!0,D?Error("react-stack-top-frame"):Oe,D?H(n(u)):xe)}})()),rt}var zr;function po(){return zr||(zr=1,process.env.NODE_ENV==="production"?_t.exports=mo():_t.exports=ho()),_t.exports}var m=po();function go(e){return typeof e=="function"}function Tr(e,t){return go(e)?e(t):e}const _o=Object.prototype.hasOwnProperty;function Pr(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=t,o=Ar(e)&&Ar(n);if(!o&&!(yt(e)&&yt(n)))return n;const i=o?e:Fr(e);if(!i)return n;const s=o?n:Fr(n);if(!s)return n;const a=i.length,l=s.length,h=o?new Array(l):{};let b=0;for(let g=0;g<l;g++){const v=o?g:s[g],p=e[v],O=n[v];if(p===O){h[v]=p,(o?g<a:_o.call(e,v))&&b++;continue}if(p===null||O===null||typeof p!="object"||typeof O!="object"){h[v]=O;continue}const x=Pr(p,O,r+1);h[v]=x,x===p&&b++}return a===l&&b===a?e:h}function Fr(e){const t=[],r=Object.getOwnPropertyNames(e);for(const o of r){if(!Object.prototype.propertyIsEnumerable.call(e,o))return!1;t.push(o)}const n=Object.getOwnPropertySymbols(e);for(const o of n){if(!Object.prototype.propertyIsEnumerable.call(e,o))return!1;t.push(o)}return t}function yt(e){if(!jr(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const r=t.prototype;return!(!jr(r)||!r.hasOwnProperty("isPrototypeOf"))}function jr(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ar(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vt(e,t,r){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0,o=e.length;n<o;n++)if(!vt(e[n],t[n],r))return!1;return!0}if(yt(e)&&yt(t)){const n=r?.ignoreUndefined??!0;if(r?.partial){for(const s in t)if((!n||t[s]!==void 0)&&!vt(e[s],t[s],r))return!1;return!0}let o=0;if(!n)o=Object.keys(e).length;else for(const s in e)e[s]!==void 0&&o++;let i=0;for(const s in t)if((!n||t[s]!==void 0)&&(i++,i>o||!vt(e[s],t[s],r)))return!1;return o===i}return!1}const yo=["http:","https:","mailto:","tel:"];function Rr(e){if(!e)return!1;try{const t=new URL(e);return!yo.includes(t.protocol)}catch{return!1}}function bt(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function vo(e,t,r){return bt(e,r)===bt(t,r)}const bo="Error preloading route! ☝️";var wt={exports:{}},nt={};var $r;function wo(){if($r)return nt;$r=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var a in o)a!=="key"&&(i[a]=o[a])}else i=o;return o=i.ref,{$$typeof:e,type:n,key:s,ref:o!==void 0?o:null,props:i}}return nt.Fragment=t,nt.jsx=r,nt.jsxs=r,nt}var ot={};var Cr;function Eo(){return Cr||(Cr=1,process.env.NODE_ENV!=="production"&&(function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Se?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case I:return"Fragment";case F:return"Profiler";case V:return"StrictMode";case U:return"Suspense";case J:return"SuspenseList";case oe:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case x:return"Portal";case P:return u.displayName||"Context";case L:return(u._context.displayName||"Context")+".Consumer";case $:var S=u.render;return u=u.displayName,u||(u=S.displayName||S.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case te:return S=u.displayName||null,S!==null?S:e(u.type)||"Memo";case fe:S=u._payload,u=u._init;try{return e(u(S))}catch{}}return null}function t(u){return""+u}function r(u){try{t(u);var S=!1}catch{S=!0}if(S){S=console;var j=S.error,D=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return j.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",D),t(u)}}function n(u){if(u===I)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===fe)return"<...>";try{var S=e(u);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function o(){var u=C.A;return u===null?null:u.getOwner()}function i(){return Error("react-stack-top-frame")}function s(u){if(Z.call(u,"key")){var S=Object.getOwnPropertyDescriptor(u,"key").get;if(S&&S.isReactWarning)return!1}return u.key!==void 0}function a(u,S){function j(){de||(de=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",S))}j.isReactWarning=!0,Object.defineProperty(u,"key",{get:j,configurable:!0})}function l(){var u=e(this.type);return se[u]||(se[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function h(u,S,j,D,pe,ie){var A=j.ref;return u={$$typeof:O,type:u,key:S,props:j,_owner:D},(A!==void 0?A:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:l}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:pe}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ie}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function b(u,S,j,D,pe,ie){var A=S.children;if(A!==void 0)if(D)if(G(A)){for(D=0;D<A.length;D++)g(A[D]);Object.freeze&&Object.freeze(A)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(A);if(Z.call(S,"key")){A=e(u);var ee=Object.keys(S).filter(function(je){return je!=="key"});D=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",ze[A+D]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
7
|
+
let props = %s;
|
|
8
|
+
<%s {...props} />
|
|
9
|
+
React keys must be passed directly to JSX without using spread:
|
|
10
|
+
let props = %s;
|
|
11
|
+
<%s key={someKey} {...props} />`,D,A,ee,A),ze[A+D]=!0)}if(A=null,j!==void 0&&(r(j),A=""+j),s(S)&&(r(S.key),A=""+S.key),"key"in S){j={};for(var ge in S)ge!=="key"&&(j[ge]=S[ge])}else j=S;return A&&a(j,typeof u=="function"?u.displayName||u.name||"Unknown":u),h(u,A,j,o(),pe,ie)}function g(u){v(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===fe&&(u._payload.status==="fulfilled"?v(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function v(u){return typeof u=="object"&&u!==null&&u.$$typeof===O}var p=N,O=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),P=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),Se=Symbol.for("react.client.reference"),C=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,G=Array.isArray,H=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(u){return u()}};var de,se={},Oe=p.react_stack_bottom_frame.bind(p,i)(),xe=H(n(i)),ze={};ot.Fragment=I,ot.jsx=function(u,S,j){var D=1e4>C.recentlyCreatedOwnerStacks++;return b(u,S,j,!1,D?Error("react-stack-top-frame"):Oe,D?H(n(u)):xe)},ot.jsxs=function(u,S,j){var D=1e4>C.recentlyCreatedOwnerStacks++;return b(u,S,j,!0,D?Error("react-stack-top-frame"):Oe,D?H(n(u)):xe)}})()),ot}var Ir;function ko(){return Ir||(Ir=1,process.env.NODE_ENV==="production"?wt.exports=wo():wt.exports=Eo()),wt.exports}ko();function So(e,t,r={},n={}){me.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([i])=>{t(i)},r);return o.observe(e.current),()=>{o.disconnect()}},[t,r,n.disabled,e])}function Oo(e){const t=me.useRef(null);return me.useImperativeHandle(e,()=>t.current,[]),t}var xo=process.env.NODE_ENV==="production";function zo(e,t){if(!xo){if(e)return;var r="Warning: "+t;typeof console<"u"&&console.warn(r);try{throw Error(r)}catch{}}}var Et={exports:{}},Mt={},kt={exports:{}},Wt={};var Dr;function To(){if(Dr)return Wt;Dr=1;var e=N;function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(g,v){var p=v(),O=n({inst:{value:p,getSnapshot:v}}),x=O[0].inst,I=O[1];return i(function(){x.value=p,x.getSnapshot=v,l(x)&&I({inst:x})},[g,p,v]),o(function(){return l(x)&&I({inst:x}),g(function(){l(x)&&I({inst:x})})},[g]),s(p),p}function l(g){var v=g.getSnapshot;g=g.value;try{var p=v();return!r(g,p)}catch{return!0}}function h(g,v){return v()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:a;return Wt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,Wt}var Bt={};var Nr;function Po(){return Nr||(Nr=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,O){return p===O&&(p!==0||1/p===1/O)||p!==p&&O!==O}function t(p,O){b||o.startTransition===void 0||(b=!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 x=O();if(!g){var I=O();i(x,I)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}I=s({inst:{value:x,getSnapshot:O}});var V=I[0].inst,F=I[1];return l(function(){V.value=x,V.getSnapshot=O,r(V)&&F({inst:V})},[p,x,O]),a(function(){return r(V)&&F({inst:V}),p(function(){r(V)&&F({inst:V})})},[p]),h(x),x}function r(p){var O=p.getSnapshot;p=p.value;try{var x=O();return!i(p,x)}catch{return!0}}function n(p,O){return O()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=N,i=typeof Object.is=="function"?Object.is:e,s=o.useState,a=o.useEffect,l=o.useLayoutEffect,h=o.useDebugValue,b=!1,g=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Bt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Bt}var Lr;function Zr(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?kt.exports=To():kt.exports=Po()),kt.exports}var Vr;function Fo(){if(Vr)return Mt;Vr=1;var e=N,t=Zr();function r(h,b){return h===b&&(h!==0||1/h===1/b)||h!==h&&b!==b}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Mt.useSyncExternalStoreWithSelector=function(h,b,g,v,p){var O=i(null);if(O.current===null){var x={hasValue:!1,value:null};O.current=x}else x=O.current;O=a(function(){function V(U){if(!F){if(F=!0,L=U,U=v(U),p!==void 0&&x.hasValue){var J=x.value;if(p(J,U))return P=J}return P=U}if(J=P,n(L,U))return J;var te=v(U);return p!==void 0&&p(J,te)?(L=U,J):(L=U,P=te)}var F=!1,L,P,$=g===void 0?null:g;return[function(){return V(b())},$===null?void 0:function(){return V($())}]},[b,g,v,p]);var I=o(h,O[0],O[1]);return s(function(){x.hasValue=!0,x.value=I},[I]),l(I),I},Mt}var Jt={};var Ur;function jo(){return Ur||(Ur=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,b){return h===b&&(h!==0||1/h===1/b)||h!==h&&b!==b}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=N,r=Zr(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;Jt.useSyncExternalStoreWithSelector=function(h,b,g,v,p){var O=i(null);if(O.current===null){var x={hasValue:!1,value:null};O.current=x}else x=O.current;O=a(function(){function V(U){if(!F){if(F=!0,L=U,U=v(U),p!==void 0&&x.hasValue){var J=x.value;if(p(J,U))return P=J}return P=U}if(J=P,n(L,U))return J;var te=v(U);return p!==void 0&&p(J,te)?(L=U,J):(L=U,P=te)}var F=!1,L,P,$=g===void 0?null:g;return[function(){return V(b())},$===null?void 0:function(){return V($())}]},[b,g,v,p]);var I=o(h,O[0],O[1]);return s(function(){x.hasValue=!0,x.value=I},[I]),l(I),I},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Jt}var Mr;function Ao(){return Mr||(Mr=1,process.env.NODE_ENV==="production"?Et.exports=Fo():Et.exports=jo()),Et.exports}var Ro=Ao();function Wr(e,t=n=>n,r={}){const n=r.equal??$o;return Ro.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function $o(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!t.has(n)||!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const r=Br(e);if(r.length!==Br(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}function Br(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const qt=me.createContext(null);function Co(){return typeof document>"u"?qt:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=qt,qt)}function Yt(e){const t=me.useContext(Co());return zo(!((e?.warn??!0)&&!t),"useRouter must be used inside a <RouterProvider> component!"),t}function Jr(e){const t=Yt({warn:e?.router===void 0}),r=e?.router||t,n=N.useRef(void 0);return Wr(r.__store,o=>{if(e?.select){if(e.structuralSharing??r.options.defaultStructuralSharing){const i=Pr(n.current,e.select(o));return n.current=i,i}return e.select(o)}return o})}function He(e){const t=Yt();return me.useCallback(r=>t.navigate({...r,from:r.from??e?.from}),[e?.from,t])}function Io(e,t){const r=Yt(),[n,o]=me.useState(!1),i=me.useRef(!1),s=Oo(t),{activeProps:a,inactiveProps:l,activeOptions:h,to:b,preload:g,preloadDelay:v,hashScrollIntoView:p,replace:O,startTransition:x,resetScroll:I,viewTransition:V,children:F,target:L,disabled:P,style:$,className:U,onClick:J,onFocus:te,onMouseEnter:fe,onMouseLeave:oe,onTouchStart:Se,ignoreBlocker:C,params:Z,search:G,hash:H,state:de,mask:se,reloadDocument:Oe,unsafeRelative:xe,from:ze,_fromLocation:u,...S}=e,j=Jr({select:d=>d.location.search,structuralSharing:!0}),D=e.from,pe=me.useMemo(()=>({...e,from:D}),[r,j,D,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ie=me.useMemo(()=>r.buildLocation({...pe}),[r,pe]),A=me.useMemo(()=>{if(P)return;let d=ie.maskedLocation?ie.maskedLocation.url.href:ie.url.href,k=!1;return r.origin&&(d.startsWith(r.origin)?d=r.history.createHref(d.replace(r.origin,""))||"/":k=!0),{href:d,external:k}},[P,ie.maskedLocation,ie.url,r.origin,r.history]),ee=me.useMemo(()=>{if(A?.external){if(Rr(A.href)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${A.href}`);return}return A.href}try{if(new URL(b),Rr(b)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${b}`);return}return b}catch{}},[b,A]),ge=e.reloadDocument||ee?!1:g??r.options.defaultPreload,je=v??r.options.defaultPreloadDelay??0,Je=Jr({select:d=>{if(ee)return!1;if(h?.exact){if(!vo(d.location.pathname,ie.pathname,r.basepath))return!1}else{const k=bt(d.location.pathname,r.basepath),w=bt(ie.pathname,r.basepath);if(!(k.startsWith(w)&&(k.length===w.length||k[w.length]==="/")))return!1}return(h?.includeSearch??!0)&&!vt(d.location.search,ie.search,{partial:!h?.exact,ignoreUndefined:!h?.explicitUndefined})?!1:h?.includeHash?d.location.hash===ie.hash:!0}}),Ce=me.useCallback(()=>{r.preloadRoute({...pe}).catch(d=>{console.warn(d),console.warn(bo)})},[r,pe]),Vt=me.useCallback(d=>{d?.isIntersecting&&Ce()},[Ce]);So(s,Vt,Vo,{disabled:!!P||ge!=="viewport"}),me.useEffect(()=>{i.current||!P&&ge==="render"&&(Ce(),i.current=!0)},[P,Ce,ge]);const vr=d=>{const k=d.currentTarget.getAttribute("target"),w=L!==void 0?L:k;if(!P&&!Uo(d)&&!d.defaultPrevented&&(!w||w==="_self")&&d.button===0){d.preventDefault(),lo.flushSync(()=>{o(!0)});const E=r.subscribe("onResolved",()=>{E(),o(!1)});r.navigate({...pe,replace:O,resetScroll:I,hashScrollIntoView:p,startTransition:x,viewTransition:V,ignoreBlocker:C})}};if(ee)return{...S,ref:s,href:ee,...F&&{children:F},...L&&{target:L},...P&&{disabled:P},...$&&{style:$},...U&&{className:U},...J&&{onClick:J},...te&&{onFocus:te},...fe&&{onMouseEnter:fe},...oe&&{onMouseLeave:oe},...Se&&{onTouchStart:Se}};const pt=d=>{P||ge&&Ce()},Ut=pt,br=d=>{if(!(P||!ge))if(!je)Ce();else{const k=d.target;if(st.has(k))return;const w=setTimeout(()=>{st.delete(k),Ce()},je);st.set(k,w)}},wr=d=>{if(P||!ge||!je)return;const k=d.target,w=st.get(k);w&&(clearTimeout(w),st.delete(k))},gt=Je?Tr(a,{})??Do:Ht,qe=Je?Ht:Tr(l,{})??Ht,c=[U,gt.className,qe.className].filter(Boolean).join(" "),f=($||gt.style||qe.style)&&{...$,...gt.style,...qe.style};return{...S,...gt,...qe,href:A?.href,ref:s,onClick:it([J,vr]),onFocus:it([te,pt]),onMouseEnter:it([fe,br]),onMouseLeave:it([oe,wr]),onTouchStart:it([Se,Ut]),disabled:!!P,target:L,...f&&{style:f},...c&&{className:c},...P&&No,...Je&&Lo,...n&&Zo}}const Ht={},Do={className:"active"},No={role:"link","aria-disabled":!0},Lo={"data-status":"active","aria-current":"page"},Zo={"data-transitioning":"transitioning"},st=new WeakMap,Vo={rootMargin:"100px"},it=e=>t=>{for(const r of e)if(r){if(t.defaultPrevented)return;r(t)}},Ze=me.forwardRef((e,t)=>{const{_asChild:r,...n}=e,{type:o,ref:i,...s}=Io(n,t),a=typeof n.children=="function"?n.children({isActive:s["data-status"]==="active"}):n.children;return r===void 0&&delete s.disabled,me.createElement(r||"a",{...s,ref:i},a)});function Uo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Mo(e){const[t,r]=N.useState(!1);return m.jsx("div",{className:"flex flex-col gap-6",children:m.jsxs(_.Card,{className:_.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[m.jsxs(_.CardHeader,{children:[m.jsx(_.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.loginForm.form.title")}),m.jsx(_.CardDescription,{children:e.i18n.t("auth.loginForm.form.description")})]}),m.jsx(_.CardContent,{children:m.jsx(_.Form,{...e.form,children:m.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"grid gap-2",children:[m.jsx(_.Label,{htmlFor:"email",children:e.i18n.t("auth.loginForm.form.emailLabel")}),m.jsx(_.FormField,{control:e.form.control,name:"email",render:({field:n})=>m.jsxs(_.FormItem,{children:[m.jsx(_.FormControl,{children:m.jsx(_.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":_e.loginForm.emailInput,...n})}),m.jsx(_.FormMessage,{})]})})]}),m.jsxs("div",{className:"grid gap-2",children:[m.jsxs("div",{className:"flex items-center",children:[m.jsx(_.Label,{htmlFor:"password",children:e.i18n.t("auth.loginForm.form.passwordLabel")}),m.jsx(Ze,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline","data-testid":_e.loginForm.resetPasswordLink,children:e.i18n.t("auth.loginForm.form.forgotPasswordMessage")})]}),m.jsx(_.FormField,{control:e.form.control,name:"password",render:({field:n})=>m.jsxs(_.FormItem,{children:[m.jsx(_.FormControl,{className:"relative",children:m.jsxs("div",{className:"relative",children:[t?m.jsx(Te.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):m.jsx(Te.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),m.jsx(_.Input,{placeholder:"********",disabled:e.form.formState.isSubmitting,"data-testid":_e.loginForm.passwordInput,...n,className:"pr-10","aria-invalid":!!e.form.formState.errors?.password,type:t?"text":"password"})]})}),m.jsx(_.FormMessage,{})]})})]}),m.jsxs(_.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":_e.loginForm.submitButton,children:[e.i18n.t("auth.loginForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&m.jsx(Te.Loader2Icon,{className:"animate-spin"})]}),m.jsxs(_.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.loginForm.form.dontHaveAccountMessage")," ",m.jsx(Ze,{to:"/auth/signup","data-testid":_e.loginForm.signUpFormLink,children:e.i18n.t("auth.loginForm.form.dontHaveAccountLink")})]})]})})})})]})})}function Wo(e){const[t,r]=N.useState(!1);return m.jsx("div",{className:"flex flex-col gap-6",children:m.jsxs(_.Card,{className:_.cn({"opacity-50":e.form.formState.isSubmitting}),children:[m.jsxs(_.CardHeader,{children:[m.jsx(_.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.signUpForm.form.title")}),m.jsx(_.CardDescription,{children:e.i18n.t("auth.signUpForm.form.description")})]}),m.jsx(_.CardContent,{children:m.jsx(_.Form,{...e.form,children:m.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"grid gap-2",children:[m.jsx(_.Label,{children:e.i18n.t("auth.signUpForm.form.emailLabel")}),m.jsx(_.FormField,{control:e.form.control,name:"email",render:({field:n})=>m.jsx(_.FormItem,{children:m.jsx(_.FormControl,{children:m.jsx(_.Input,{disabled:e.form.formState.isSubmitting,type:"email","data-testid":_e.signupForm.emailInput,placeholder:"m@example.com",required:!0,...n})})})})]}),m.jsxs("div",{className:"grid gap-2",children:[m.jsxs("div",{className:"flex items-center",children:[m.jsx(_.Label,{children:e.i18n.t("auth.signUpForm.form.passwordLabel")}),m.jsx(Ze,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:e.i18n.t("auth.signUpForm.form.forgotPasswordMessage")})]}),m.jsx(_.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:o})=>m.jsx(_.FormItem,{children:m.jsx(_.FormControl,{className:"relative",children:m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative",children:[t?m.jsx(Te.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):m.jsx(Te.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),m.jsx(_.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":_e.signupForm.passwordInput,...n,className:"pr-10"})]}),o.invalid&&m.jsx(_.FieldError,{errors:[o.error]})]})})})})]}),m.jsxs(_.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":_e.signupForm.submitButton,children:[e.i18n.t("auth.signUpForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&m.jsx(Te.Loader2Icon,{className:"animate-spin"})]}),m.jsxs(_.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.signUpForm.form.loginLinkMessage")," ",m.jsx(Ze,{to:"/auth/login",children:e.i18n.t("auth.signUpForm.form.loginLink")})]})]})})})})]})})}function Bo(e){return m.jsx("div",{className:"flex flex-col gap-6",children:m.jsxs(_.Card,{className:_.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[m.jsxs(_.CardHeader,{children:[m.jsx(_.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.startResetPasswordForm.form.title")}),m.jsx(_.CardDescription,{children:e.i18n.t("auth.startResetPasswordForm.form.description")})]}),m.jsx(_.CardContent,{children:m.jsx(_.Form,{...e.form,children:m.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"grid gap-2",children:[m.jsx(_.Label,{htmlFor:"email",children:e.i18n.t("auth.startResetPasswordForm.form.emailLabel")}),m.jsx(_.FormField,{control:e.form.control,name:"email",render:({field:t})=>m.jsxs(_.FormItem,{children:[m.jsx(_.FormControl,{children:m.jsx(_.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":_e.startResetPasswordForm.emailInput,...t})}),m.jsx(_.FormMessage,{})]})})]}),m.jsxs(_.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":_e.startResetPasswordForm.submitButton,children:[e.i18n.t("auth.startResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&m.jsx(Te.Loader2Icon,{className:"animate-spin"})]}),m.jsxs(_.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.startResetPasswordForm.form.loginLinkMessage")," ",m.jsx(Ze,{to:"/auth/login",children:e.i18n.t("auth.startResetPasswordForm.form.loginLink")})]})]})})})})]})})}function Jo(e){return m.jsx("div",{className:"flex flex-col gap-6",children:m.jsxs(_.Card,{children:[m.jsxs(_.CardHeader,{children:[m.jsx(_.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.verifyEmailForm.form.title")}),m.jsx(_.CardDescription,{children:e.i18n.t("auth.verifyEmailForm.form.verifyEmailDescription")})]}),m.jsx(_.CardContent,{children:m.jsx(_.Form,{...e.form,children:m.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"grid gap-2",children:[m.jsx(_.Label,{children:e.i18n.t("auth.verifyEmailForm.form.codeLabel")}),m.jsx(_.FormField,{control:e.form.control,name:"code",render:({field:t})=>m.jsx(_.FormItem,{children:m.jsx(_.FormControl,{children:m.jsx(_.Input,{type:"text",placeholder:"00001234","data-testid":_e.verifyEmailForm.authCodeInput,required:!0,...t})})})})]}),m.jsx(_.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":_e.verifyEmailForm.submitButton,children:e.i18n.t("auth.verifyEmailForm.form.submitButtonLabel")}),m.jsxs(_.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.verifyEmailForm.form.loginLinkMessage")," ",m.jsx(Ze,{to:"/auth/login",children:e.i18n.t("auth.verifyEmailForm.form.loginLink")})]})]})})})})]})})}function qo(e){const[t,r]=N.useState(!1);return m.jsx("div",{className:"flex flex-col gap-6",children:m.jsxs(_.Card,{children:[m.jsxs(_.CardHeader,{children:[m.jsx(_.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.confirmResetPasswordForm.form.title")}),m.jsx(_.CardDescription,{children:e.i18n.t("auth.confirmResetPasswordForm.form.description")})]}),m.jsx(_.CardContent,{children:m.jsx(_.Form,{...e.form,children:m.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"grid gap-2",children:[m.jsx(_.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.authCodeInputLabel")}),m.jsx(_.FormField,{control:e.form.control,name:"code",render:({field:n})=>m.jsx(_.FormItem,{children:m.jsx(_.FormControl,{children:m.jsx(_.Input,{type:"text",placeholder:"00001234","data-testid":_e.confirmResetPasswordForm.authCodeInput,required:!0,...n})})})})]}),m.jsxs("div",{className:"grid gap-2",children:[m.jsx("div",{className:"flex items-center",children:m.jsx(_.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.passwordInputLabel")})}),m.jsx(_.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:o})=>m.jsx(_.FormItem,{children:m.jsx(_.FormControl,{className:"relative",children:m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative",children:[t?m.jsx(Te.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):m.jsx(Te.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),m.jsx(_.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":_e.confirmResetPasswordForm.newPasswordInput,...n,className:"pr-10"})]}),o.invalid&&m.jsx(_.FieldError,{errors:[o.error]})]})})})})]}),m.jsxs(_.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":_e.confirmResetPasswordForm.submitButton,children:[e.i18n.t("auth.confirmResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&m.jsx(Te.Loader2Icon,{className:"animate-spin"})]}),m.jsxs(_.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.confirmResetPasswordForm.form.loginLinkMessage")," ",m.jsx(Ze,{to:"/auth/login",children:e.i18n.t("auth.confirmResetPasswordForm.form.loginLink")})]})]})})})})]})})}const Kt="Authorization",qr=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),Ve=new Sr.Store(qr()),Yo=new Sr.Derived({fn:()=>!!Ve.state.user?.roles.find(e=>e.name==="admin"),deps:[Ve]});class Ho{accountStore;httpClient;constructor(t){this.httpClient=t,this.accountStore=Ve}initAuthData=()=>{const t=localStorage.getItem("token");t&&(this.httpClient.defaults.headers.common[Kt]=t)};load=async()=>{try{const{data:t}=await this.httpClient.get("/api/auth/account/me");Ve.setState(()=>({user:t.user,sessionID:t.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{Ve.setState(t=>({...t,isLoaded:!0}))}};login=async t=>{const r=await this.httpClient.post("/api/auth/account/login",t),{user:n,token:o,session_id:i}=r.data;return this._initUserData({user:n,token:o,sessionID:i}),n};signup=async t=>this.httpClient.post("/api/auth/account/signup",t);verifyEmail=async t=>{const r=await this.httpClient.post("/api/auth/account/verify-email",t);this._initUserData(r.data)};logout=()=>{Ve.setState(()=>({...qr(),isLoaded:!0})),this._clearAuthData()};startResetPassword=t=>this.httpClient.post("/api/auth/account/start-reset-password",t);confirmResetPassword=async t=>{const r=await this.httpClient.post("/api/auth/account/confirm-reset-password",t);this._initUserData(r.data)};_initUserData=({user:t,token:r,sessionID:n})=>{this._setAuthData(r),Ve.setState(()=>({user:t,isAuthenticated:!0,isLoaded:!0,sessionID:n}))};_setAuthData=t=>{localStorage.setItem("token",t),this.httpClient.defaults.headers.common[Kt]=t};_clearAuthData=()=>{localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[Kt]}}const Ko=({auth:e,children:t})=>{const r=He(),{isLoaded:n,isAuthenticated:o}=Wr(e.accountStore,a=>a),[i,s]=N.useState(0);return N.useEffect(()=>{const a=setInterval(()=>{s(l=>l===100?(clearInterval(a),l):l+1)},100);return()=>clearInterval(a)},[]),N.useEffect(()=>{e.initAuthData(),e.load()},[e]),N.useEffect(()=>{n&&!o&&r({to:"/auth/login"})},[n,o,r]),n&&o?t:i>5?m.jsx("div",{className:"flex items-center justify-center h-screen",children:m.jsxs("div",{className:"p-4 rounded w-1/2",children:[m.jsx("h2",{className:"text-center",children:"account loading..."}),m.jsx(_.Progress,{value:i})]})}):null},Go=({reset:e,processing:t})=>m.jsxs("div",{className:"fixed right-0 top-0 py-5 px-10 bg-white border-grey border-2 w-100 h-45",children:[m.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Developer Panel"}),m.jsx("p",{className:"text-gray-500 mb-5",children:"Welcome to the developer panel!"}),m.jsx(_.Button,{onClick:e,className:"cursor-pointer relative w-20 rounded-none",variant:"destructive",disabled:t,children:t?m.jsx(Te.Loader2Icon,{className:"animate-spin"}):"reset"})]}),le={notificationsErrorsMap:{"User is not enabled":"auth.loginForm.errors.notifications.userIsNotEnabled","Email not verified":"auth.loginForm.errors.notifications.emailNotVerified","Email not found":"auth.loginForm.errors.notifications.emailNotFound","Invalid password":"auth.loginForm.errors.notifications.invalidPassword","Email is already used":"auth.signUpForm.errors.notifications.emailAlreadyExists","Wrong verification code":"auth.verifyEmailForm.errors.notifications.wrongAuthCode","Start reset password failed, email not found":"auth.startResetPasswordForm.errors.notifications.emailNotFound","Confirm reset password failed, wrong code":"auth.confirmResetPasswordForm.errors.notifications.wrongAuthCode"},fieldsErrorsMap:{"User is not enabled":"email","Email not verified":"email","Email not found":"email","Invalid password":"password","Email is already used":"email","Start reset password failed, email not found":"email"},ru:{confirmResetPasswordForm:{form:{title:"Подтверждение сброса пароля",description:"Введите код подтверждения, чтобы сбросить пароль.",passwordInputLabel:"Новый пароль",authCodeInputLabel:"Код подтверждения",submitButtonLabel:"Сбросить пароль",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},success:{notifications:{confirmResetPasswordSuccess:"Пароль успешно сброшен"}},errors:{fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"},notifications:{unknownError:"Не удалось сбросить пароль",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь в службу поддержки",wrongAuthCode:"Неверный код подтверждения"}}},startResetPasswordForm:{form:{title:"Сброс пароля",description:"Введите вашу почту, чтобы получить ссылку на сброс пароля.",emailLabel:"Электронная почта",submitButtonLabel:"Отправить ссылку на сброс пароля",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},errors:{notifications:{unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз позже, либо обратитесь в службу поддержки",emailNotFound:"Пользователь с email {{email}} не найден"}},success:{notifications:{startResetPasswordSuccess:"Ссылка на сброс пароля отправлена на вашу почту"}}},verifyEmailForm:{form:{title:"Подтверждение почты",submitButtonLabel:"Подтвердить",codeLabel:"Код подтверждения",verifyEmailDescription:"Введите код подтверждения, отправленный на вашу почту.",loginLinkMessage:"Почта уже подтверждена?",loginLink:"Войти"},success:{notifications:{verifyEmailSuccess:"Почта успешно подтверждена"}},errors:{notifications:{wrongAuthCode:"Неверный код подтверждения",unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз, либо обратитесь в службу поддержки"}}},loginForm:{form:{title:"Вход",description:"Введите данные для входа",emailLabel:"Email",passwordLabel:"Пароль",forgotPasswordMessage:"Забыли пароль?",submitButtonLabel:"Войти",dontHaveAccountMessage:"Нет аккаунта?",dontHaveAccountLink:"Зарегистрироваться"},errors:{notifications:{emailNotFound:"Пользователь с email {{email}} не найден",userIsNotEnabled:"Пользователь не активирован",emailNotVerified:"Почта не подтверждена",invalidPassword:"Неверный пароль",unknownError:"Не удалось войти в систему",unknownErrorDescription:"Попробуйте войти позже, либо обратитесь в службу поддержки"}},success:{notifications:{loginSuccess:"Вы успешно вошли в систему"}}},signUpForm:{form:{title:"Регистрация",description:"Введите данные для регистрации",emailLabel:"Email",passwordLabel:"Пароль",submitButtonLabel:"Зарегистрироваться",forgotPasswordMessage:"Забыли пароль?",loginLinkMessage:"Уже есть аккаунт?",loginLink:"Войти"},errors:{notifications:{unknownError:"Ошибка регистрации",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь к администратору",emailAlreadyExists:"Пользователь с email {{email}} уже существует"},fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"}},success:{notifications:{signUpSuccess:"Вы успешно зарегистрированы"}}}},en:{verifyEmailForm:{form:{title:"Verify email",submitButtonLabel:"Verify",codeLabel:"Verification code",verifyEmailDescription:"Enter the verification code sent to your email.",loginLinkMessage:"Email already verified?",loginLink:"Login"},success:{notifications:{verifyEmailSuccess:"Email successfully verified"}},errors:{notifications:{wrongAuthCode:"Wrong verification code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},loginForm:{form:{title:"Login",description:"Enter your login details",emailLabel:"Email",passwordLabel:"Password",forgotPasswordMessage:"Forgot password?",submitButtonLabel:"Login",dontHaveAccountMessage:"Don't have an account?",dontHaveAccountLink:"Register"},errors:{notifications:{emailNotFound:"User with email {{email}} not found",userIsNotEnabled:"User is not enabled",emailNotVerified:"Email not verified",invalidPassword:"Invalid password"}},success:{notifications:{loginSuccess:"You have successfully logged in"}}},signUpForm:{form:{title:"Registration",description:"Enter your registration details",emailLabel:"Email",passwordLabel:"Password",submitButtonLabel:"Register",forgotPasswordMessage:"Forgot password?",loginLinkMessage:"Already have an account?",loginLink:"Login"},errors:{notifications:{unknownError:"Signup failed",unknownErrorDescription:"Please try again or contact the administrator",emailAlreadyExists:"User with email {{email}} already exists"}},success:{notifications:{signUpSuccess:"You have successfully registered"}}}}};var at=e=>e.type==="checkbox",Ue=e=>e instanceof Date,we=e=>e==null;const Yr=e=>typeof e=="object";var re=e=>!we(e)&&!Array.isArray(e)&&Yr(e)&&!Ue(e),Xo=e=>re(e)&&e.target?at(e.target)?e.target.checked:e.target.value:e,Qo=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,es=(e,t)=>e.has(Qo(t)),ts=e=>{const t=e.constructor&&e.constructor.prototype;return re(t)&&t.hasOwnProperty("isPrototypeOf")},Gt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ae(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Gt&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(re(e)&&ts(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=ae(e[o]));return n}var St=e=>/^\w*$/.test(e),X=e=>e===void 0,Xt=e=>Array.isArray(e)?e.filter(Boolean):[],Qt=e=>Xt(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,t,r)=>{if(!t||!re(e))return r;const n=(St(t)?[t]:Qt(t)).reduce((o,i)=>we(o)?o:o[i],e);return X(n)||n===e?X(e[t])?r:e[t]:n},Ae=e=>typeof e=="boolean",Pe=e=>typeof e=="function",q=(e,t,r)=>{let n=-1;const o=St(t)?[t]:Qt(t),i=o.length,s=i-1;for(;++n<i;){const a=o[n];let l=r;if(n!==s){const h=e[a];l=re(h)||Array.isArray(h)?h:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const Hr={BLUR:"blur",FOCUS_OUT:"focusout"},Fe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},$e={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},rs=N.createContext(null);rs.displayName="HookFormControlContext";var ns=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Fe.all&&(t._proxyFormState[s]=!n||Fe.all),e[s]}});return o};const os=typeof window<"u"?N.useLayoutEffect:N.useEffect;var Ee=e=>typeof e=="string",ss=(e,t,r,n,o)=>Ee(e)?(n&&t.watch.add(e),z(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),z(r,i))):(n&&(t.watchAll=!0),r),er=e=>we(e)||!Yr(e);function Ie(e,t,r=new WeakSet){if(er(e)||er(t))return Object.is(e,t);if(Ue(e)&&Ue(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const i of n){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Ue(s)&&Ue(a)||re(s)&&re(a)||Array.isArray(s)&&Array.isArray(a)?!Ie(s,a,r):!Object.is(s,a))return!1}}return!0}const is=N.createContext(null);is.displayName="HookFormContext";var tr=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},ct=e=>Array.isArray(e)?e:[e],Kr=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function Gr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const o=e[n],i=t[n];if(o&&re(o)&&i){const s=Gr(o,i);re(s)&&(r[n]=s)}else e[n]&&(r[n]=i)}return r}var ye=e=>re(e)&&!Object.keys(e).length,rr=e=>e.type==="file",Ot=e=>{if(!Gt)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xr=e=>e.type==="select-multiple",nr=e=>e.type==="radio",as=e=>nr(e)||at(e),or=e=>Ot(e)&&e.isConnected;function cs(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=X(e)?n++:e[t[n++]];return e}function us(e){for(const t in e)if(e.hasOwnProperty(t)&&!X(e[t]))return!1;return!0}function ne(e,t){const r=Array.isArray(t)?t:St(t)?[t]:Qt(t),n=r.length===1?e:cs(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(re(n)&&ye(n)||Array.isArray(n)&&us(n))&&ne(e,r.slice(0,-1)),e}var ls=e=>{for(const t in e)if(Pe(e[t]))return!0;return!1};function Qr(e){return Array.isArray(e)||re(e)&&!ls(e)}function sr(e,t={}){for(const r in e){const n=e[r];Qr(n)?(t[r]=Array.isArray(n)?[]:{},sr(n,t[r])):X(n)||(t[r]=!0)}return t}function Ke(e,t,r){r||(r=sr(t));for(const n in e){const o=e[n];if(Qr(o))X(t)||er(r[n])?r[n]=sr(o,Array.isArray(o)?[]:{}):Ke(o,we(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Ie(o,i)}}return r}const en={value:!1,isValid:!1},tn={value:!0,isValid:!0};var rn=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!X(e[0].attributes.value)?X(e[0].value)||e[0].value===""?tn:{value:e[0].value,isValid:!0}:tn:en}return en},nn=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>X(e)?e:t?e===""?NaN:e&&+e:r&&Ee(e)?new Date(e):n?n(e):e;const on={isValid:!1,value:null};var sn=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,on):on;function an(e){const t=e.ref;return rr(t)?t.files:nr(t)?sn(e.refs).value:Xr(t)?[...t.selectedOptions].map(({value:r})=>r):at(t)?rn(e.refs).value:nn(X(t.value)?e.ref.value:t.value,e)}var fs=(e,t,r,n)=>{const o={};for(const i of e){const s=z(t,i);s&&q(o,i,s._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},xt=e=>e instanceof RegExp,ut=e=>X(e)?e:xt(e)?e.source:re(e)?xt(e.value)?e.value.source:e.value:e,cn=e=>({isOnSubmit:!e||e===Fe.onSubmit,isOnBlur:e===Fe.onBlur,isOnChange:e===Fe.onChange,isOnAll:e===Fe.all,isOnTouch:e===Fe.onTouched});const un="AsyncFunction";var ds=e=>!!e&&!!e.validate&&!!(Pe(e.validate)&&e.validate.constructor.name===un||re(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===un)),ms=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ln=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const lt=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=z(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(lt(a,t))break}else if(re(a)&<(a,t))break}}};function fn(e,t,r){const n=z(e,r);if(n||St(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),s=z(t,i),a=z(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:r}}var hs=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ye(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||Fe.all))},ps=(e,t,r)=>!e||!t||e===t||ct(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),gs=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,_s=(e,t)=>!Xt(z(e,t)).length&&ne(e,t),ys=(e,t,r)=>{const n=ct(z(e,r));return q(n,"root",t[r]),q(e,r,n),e};function dn(e,t,r="validate"){if(Ee(e)||Array.isArray(e)&&e.every(Ee)||Ae(e)&&!e)return{type:r,message:Ee(e)?e:"",ref:t}}var Ge=e=>re(e)&&!xt(e)?e:{value:e,message:""},mn=async(e,t,r,n,o,i)=>{const{ref:s,refs:a,required:l,maxLength:h,minLength:b,min:g,max:v,pattern:p,validate:O,name:x,valueAsNumber:I,mount:V}=e._f,F=z(r,x);if(!V||t.has(x))return{};const L=a?a[0]:s,P=C=>{o&&L.reportValidity&&(L.setCustomValidity(Ae(C)?"":C||""),L.reportValidity())},$={},U=nr(s),J=at(s),te=U||J,fe=(I||rr(s))&&X(s.value)&&X(F)||Ot(s)&&s.value===""||F===""||Array.isArray(F)&&!F.length,oe=tr.bind(null,x,n,$),Se=(C,Z,G,H=$e.maxLength,de=$e.minLength)=>{const se=C?Z:G;$[x]={type:C?H:de,message:se,ref:s,...oe(C?H:de,se)}};if(i?!Array.isArray(F)||!F.length:l&&(!te&&(fe||we(F))||Ae(F)&&!F||J&&!rn(a).isValid||U&&!sn(a).isValid)){const{value:C,message:Z}=Ee(l)?{value:!!l,message:l}:Ge(l);if(C&&($[x]={type:$e.required,message:Z,ref:L,...oe($e.required,Z)},!n))return P(Z),$}if(!fe&&(!we(g)||!we(v))){let C,Z;const G=Ge(v),H=Ge(g);if(!we(F)&&!isNaN(F)){const de=s.valueAsNumber||F&&+F;we(G.value)||(C=de>G.value),we(H.value)||(Z=de<H.value)}else{const de=s.valueAsDate||new Date(F),se=ze=>new Date(new Date().toDateString()+" "+ze),Oe=s.type=="time",xe=s.type=="week";Ee(G.value)&&F&&(C=Oe?se(F)>se(G.value):xe?F>G.value:de>new Date(G.value)),Ee(H.value)&&F&&(Z=Oe?se(F)<se(H.value):xe?F<H.value:de<new Date(H.value))}if((C||Z)&&(Se(!!C,G.message,H.message,$e.max,$e.min),!n))return P($[x].message),$}if((h||b)&&!fe&&(Ee(F)||i&&Array.isArray(F))){const C=Ge(h),Z=Ge(b),G=!we(C.value)&&F.length>+C.value,H=!we(Z.value)&&F.length<+Z.value;if((G||H)&&(Se(G,C.message,Z.message),!n))return P($[x].message),$}if(p&&!fe&&Ee(F)){const{value:C,message:Z}=Ge(p);if(xt(C)&&!F.match(C)&&($[x]={type:$e.pattern,message:Z,ref:s,...oe($e.pattern,Z)},!n))return P(Z),$}if(O){if(Pe(O)){const C=await O(F,r),Z=dn(C,L);if(Z&&($[x]={...Z,...oe($e.validate,Z.message)},!n))return P(Z.message),$}else if(re(O)){let C={};for(const Z in O){if(!ye(C)&&!n)break;const G=dn(await O[Z](F,r),L,Z);G&&(C={...G,...oe(Z,G.message)},P(G.message),n&&($[x]=C))}if(!ye(C)&&($[x]={ref:L,...C},!n))return $}}return P(!0),$};const vs={mode:Fe.onSubmit,reValidateMode:Fe.onChange,shouldFocusError:!0};function bs(e={}){let t={...vs,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Pe(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=re(t.defaultValues)||re(t.values)?ae(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ae(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,h=0;const b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...b};let v={...g};const p={array:Kr(),state:Kr()},O=t.criteriaMode===Fe.all,x=c=>f=>{clearTimeout(h),h=setTimeout(c,f)},I=async c=>{if(!s.keepIsValid&&!t.disabled&&(g.isValid||v.isValid||c)){let f;t.resolver?(f=ye((await te()).errors),V()):f=await oe(n,!0),f!==r.isValid&&p.state.next({isValid:f})}},V=(c,f)=>{!t.disabled&&(g.isValidating||g.validatingFields||v.isValidating||v.validatingFields)&&((c||Array.from(a.mount)).forEach(d=>{d&&(f?q(r.validatingFields,d,f):ne(r.validatingFields,d))}),p.state.next({validatingFields:r.validatingFields,isValidating:!ye(r.validatingFields)}))},F=(c,f=[],d,k,w=!0,E=!0)=>{if(k&&d&&!t.disabled){if(s.action=!0,E&&Array.isArray(z(n,c))){const T=d(z(n,c),k.argA,k.argB);w&&q(n,c,T)}if(E&&Array.isArray(z(r.errors,c))){const T=d(z(r.errors,c),k.argA,k.argB);w&&q(r.errors,c,T),_s(r.errors,c)}if((g.touchedFields||v.touchedFields)&&E&&Array.isArray(z(r.touchedFields,c))){const T=d(z(r.touchedFields,c),k.argA,k.argB);w&&q(r.touchedFields,c,T)}(g.dirtyFields||v.dirtyFields)&&(r.dirtyFields=Ke(o,i)),p.state.next({name:c,isDirty:C(c,f),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else q(i,c,f)},L=(c,f)=>{q(r.errors,c,f),p.state.next({errors:r.errors})},P=c=>{r.errors=c,p.state.next({errors:r.errors,isValid:!1})},$=(c,f,d,k)=>{const w=z(n,c);if(w){const E=z(i,c,X(d)?z(o,c):d);X(E)||k&&k.defaultChecked||f?q(i,c,f?E:an(w._f)):H(c,E),s.mount&&!s.action&&I()}},U=(c,f,d,k,w)=>{let E=!1,T=!1;const W={name:c};if(!t.disabled){if(!d||k){(g.isDirty||v.isDirty)&&(T=r.isDirty,r.isDirty=W.isDirty=C(),E=T!==W.isDirty);const B=Ie(z(o,c),f);T=!!z(r.dirtyFields,c),B?ne(r.dirtyFields,c):q(r.dirtyFields,c,!0),W.dirtyFields=r.dirtyFields,E=E||(g.dirtyFields||v.dirtyFields)&&T!==!B}if(d){const B=z(r.touchedFields,c);B||(q(r.touchedFields,c,d),W.touchedFields=r.touchedFields,E=E||(g.touchedFields||v.touchedFields)&&B!==d)}E&&w&&p.state.next(W)}return E?W:{}},J=(c,f,d,k)=>{const w=z(r.errors,c),E=(g.isValid||v.isValid)&&Ae(f)&&r.isValid!==f;if(t.delayError&&d?(l=x(()=>L(c,d)),l(t.delayError)):(clearTimeout(h),l=null,d?q(r.errors,c,d):ne(r.errors,c)),(d?!Ie(w,d):w)||!ye(k)||E){const T={...k,...E&&Ae(f)?{isValid:f}:{},errors:r.errors,name:c};r={...r,...T},p.state.next(T)}},te=async c=>(V(c,!0),await t.resolver(i,t.context,fs(c||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),fe=async c=>{const{errors:f}=await te(c);if(V(c),c)for(const d of c){const k=z(f,d);k?q(r.errors,d,k):ne(r.errors,d)}else r.errors=f;return f},oe=async(c,f,d={valid:!0})=>{for(const k in c){const w=c[k];if(w){const{_f:E,...T}=w;if(E){const W=a.array.has(E.name),B=w._f&&ds(w._f);B&&g.validatingFields&&V([E.name],!0);const be=await mn(w,a.disabled,i,O,t.shouldUseNativeValidation&&!f,W);if(B&&g.validatingFields&&V([E.name]),be[E.name]&&(d.valid=!1,f||e.shouldUseNativeValidation))break;!f&&(z(be,E.name)?W?ys(r.errors,be,E.name):q(r.errors,E.name,be[E.name]):ne(r.errors,E.name))}!ye(T)&&await oe(T,f,d)}}return d.valid},Se=()=>{for(const c of a.unMount){const f=z(n,c);f&&(f._f.refs?f._f.refs.every(d=>!or(d)):!or(f._f.ref))&&ee(c)}a.unMount=new Set},C=(c,f)=>!t.disabled&&(c&&f&&q(i,c,f),!Ie(u(),o)),Z=(c,f,d)=>ss(c,a,{...s.mount?i:X(f)?o:Ee(c)?{[c]:f}:f},d,f),G=c=>Xt(z(s.mount?i:o,c,t.shouldUnregister?z(o,c,[]):[])),H=(c,f,d={})=>{const k=z(n,c);let w=f;if(k){const E=k._f;E&&(!E.disabled&&q(i,c,nn(f,E)),w=Ot(E.ref)&&we(f)?"":f,Xr(E.ref)?[...E.ref.options].forEach(T=>T.selected=w.includes(T.value)):E.refs?at(E.ref)?E.refs.forEach(T=>{(!T.defaultChecked||!T.disabled)&&(Array.isArray(w)?T.checked=!!w.find(W=>W===T.value):T.checked=w===T.value||!!w)}):E.refs.forEach(T=>T.checked=T.value===w):rr(E.ref)?E.ref.value="":(E.ref.value=w,E.ref.type||p.state.next({name:c,values:ae(i)})))}(d.shouldDirty||d.shouldTouch)&&U(c,w,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&ze(c)},de=(c,f,d)=>{for(const k in f){if(!f.hasOwnProperty(k))return;const w=f[k],E=c+"."+k,T=z(n,E);(a.array.has(c)||re(w)||T&&!T._f)&&!Ue(w)?de(E,w,d):H(E,w,d)}},se=(c,f,d={})=>{const k=z(n,c),w=a.array.has(c),E=ae(f);q(i,c,E),w?(p.array.next({name:c,values:ae(i)}),(g.isDirty||g.dirtyFields||v.isDirty||v.dirtyFields)&&d.shouldDirty&&p.state.next({name:c,dirtyFields:Ke(o,i),isDirty:C(c,E)})):k&&!k._f&&!we(E)?de(c,E,d):H(c,E,d),ln(c,a)?p.state.next({...r,name:c,values:ae(i)}):p.state.next({name:s.mount?c:void 0,values:ae(i)})},Oe=async c=>{s.mount=!0;const f=c.target;let d=f.name,k=!0;const w=z(n,d),E=B=>{k=Number.isNaN(B)||Ue(B)&&isNaN(B.getTime())||Ie(B,z(i,d,B))},T=cn(t.mode),W=cn(t.reValidateMode);if(w){let B,be;const Ye=f.type?an(w._f):Xo(c),Le=c.type===Hr.BLUR||c.type===Hr.FOCUS_OUT,Bu=!ms(w._f)&&!t.resolver&&!z(r.errors,d)&&!w._f.deps||gs(Le,z(r.touchedFields,d),r.isSubmitted,W,T),Er=ln(d,a,Le);q(i,d,Ye),Le?(!f||!f.readOnly)&&(w._f.onBlur&&w._f.onBlur(c),l&&l(0)):w._f.onChange&&w._f.onChange(c);const kr=U(d,Ye,Le),Ju=!ye(kr)||Er;if(!Le&&p.state.next({name:d,type:c.type,values:ae(i)}),Bu)return(g.isValid||v.isValid)&&(t.mode==="onBlur"?Le&&I():Le||I()),Ju&&p.state.next({name:d,...Er?{}:kr});if(!Le&&Er&&p.state.next({...r}),t.resolver){const{errors:co}=await te([d]);if(V([d]),E(Ye),k){const qu=fn(r.errors,n,d),uo=fn(co,n,qu.name||d);B=uo.error,d=uo.name,be=ye(co)}}else V([d],!0),B=(await mn(w,a.disabled,i,O,t.shouldUseNativeValidation))[d],V([d]),E(Ye),k&&(B?be=!1:(g.isValid||v.isValid)&&(be=await oe(n,!0)));k&&(w._f.deps&&(!Array.isArray(w._f.deps)||w._f.deps.length>0)&&ze(w._f.deps),J(d,be,B,kr))}},xe=(c,f)=>{if(z(r.errors,f)&&c.focus)return c.focus(),1},ze=async(c,f={})=>{let d,k;const w=ct(c);if(t.resolver){const E=await fe(X(c)?c:w);d=ye(E),k=c?!w.some(T=>z(E,T)):d}else c?(k=(await Promise.all(w.map(async E=>{const T=z(n,E);return await oe(T&&T._f?{[E]:T}:T)}))).every(Boolean),!(!k&&!r.isValid)&&I()):k=d=await oe(n);return p.state.next({...!Ee(c)||(g.isValid||v.isValid)&&d!==r.isValid?{}:{name:c},...t.resolver||!c?{isValid:d}:{},errors:r.errors}),f.shouldFocus&&!k&<(n,xe,c?w:a.mount),k},u=(c,f)=>{let d={...s.mount?i:o};return f&&(d=Gr(f.dirtyFields?r.dirtyFields:r.touchedFields,d)),X(c)?d:Ee(c)?z(d,c):c.map(k=>z(d,k))},S=(c,f)=>({invalid:!!z((f||r).errors,c),isDirty:!!z((f||r).dirtyFields,c),error:z((f||r).errors,c),isValidating:!!z(r.validatingFields,c),isTouched:!!z((f||r).touchedFields,c)}),j=c=>{c&&ct(c).forEach(f=>ne(r.errors,f)),p.state.next({errors:c?r.errors:{}})},D=(c,f,d)=>{const k=(z(n,c,{_f:{}})._f||{}).ref,w=z(r.errors,c)||{},{ref:E,message:T,type:W,...B}=w;q(r.errors,c,{...B,...f,ref:k}),p.state.next({name:c,errors:r.errors,isValid:!1}),d&&d.shouldFocus&&k&&k.focus&&k.focus()},pe=(c,f)=>Pe(c)?p.state.subscribe({next:d=>"values"in d&&c(Z(void 0,f),d)}):Z(c,f,!0),ie=c=>p.state.subscribe({next:f=>{ps(c.name,f.name,c.exact)&&hs(f,c.formState||g,wr,c.reRenderRoot)&&c.callback({values:{...i},...r,...f,defaultValues:o})}}).unsubscribe,A=c=>(s.mount=!0,v={...v,...c.formState},ie({...c,formState:{...b,...c.formState}})),ee=(c,f={})=>{for(const d of c?ct(c):a.mount)a.mount.delete(d),a.array.delete(d),f.keepValue||(ne(n,d),ne(i,d)),!f.keepError&&ne(r.errors,d),!f.keepDirty&&ne(r.dirtyFields,d),!f.keepTouched&&ne(r.touchedFields,d),!f.keepIsValidating&&ne(r.validatingFields,d),!t.shouldUnregister&&!f.keepDefaultValue&&ne(o,d);p.state.next({values:ae(i)}),p.state.next({...r,...f.keepDirty?{isDirty:C()}:{}}),!f.keepIsValid&&I()},ge=({disabled:c,name:f})=>{if(Ae(c)&&s.mount||c||a.disabled.has(f)){const w=a.disabled.has(f)!==!!c;c?a.disabled.add(f):a.disabled.delete(f),w&&s.mount&&!s.action&&I()}},je=(c,f={})=>{let d=z(n,c);const k=Ae(f.disabled)||Ae(t.disabled);return q(n,c,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:c}},name:c,mount:!0,...f}}),a.mount.add(c),d?ge({disabled:Ae(f.disabled)?f.disabled:t.disabled,name:c}):$(c,!0,f.value),{...k?{disabled:f.disabled||t.disabled}:{},...t.progressive?{required:!!f.required,min:ut(f.min),max:ut(f.max),minLength:ut(f.minLength),maxLength:ut(f.maxLength),pattern:ut(f.pattern)}:{},name:c,onChange:Oe,onBlur:Oe,ref:w=>{if(w){je(c,f),d=z(n,c);const E=X(w.value)&&w.querySelectorAll&&w.querySelectorAll("input,select,textarea")[0]||w,T=as(E),W=d._f.refs||[];if(T?W.find(B=>B===E):E===d._f.ref)return;q(n,c,{_f:{...d._f,...T?{refs:[...W.filter(or),E,...Array.isArray(z(o,c))?[{}]:[]],ref:{type:E.type,name:c}}:{ref:E}}}),$(c,!1,void 0,E)}else d=z(n,c,{}),d._f&&(d._f.mount=!1),(t.shouldUnregister||f.shouldUnregister)&&!(es(a.array,c)&&s.action)&&a.unMount.add(c)}}},Je=()=>t.shouldFocusError&<(n,xe,a.mount),Ce=c=>{Ae(c)&&(p.state.next({disabled:c}),lt(n,(f,d)=>{const k=z(n,d);k&&(f.disabled=k._f.disabled||c,Array.isArray(k._f.refs)&&k._f.refs.forEach(w=>{w.disabled=k._f.disabled||c}))},0,!1))},Vt=(c,f)=>async d=>{let k;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let w=ae(i);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:E,values:T}=await te();V(),r.errors=E,w=ae(T)}else await oe(n);if(a.disabled.size)for(const E of a.disabled)ne(w,E);if(ne(r.errors,"root"),ye(r.errors)){p.state.next({errors:{}});try{await c(w,d)}catch(E){k=E}}else f&&await f({...r.errors},d),Je(),setTimeout(Je);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ye(r.errors)&&!k,submitCount:r.submitCount+1,errors:r.errors}),k)throw k},vr=(c,f={})=>{z(n,c)&&(X(f.defaultValue)?se(c,ae(z(o,c))):(se(c,f.defaultValue),q(o,c,ae(f.defaultValue))),f.keepTouched||ne(r.touchedFields,c),f.keepDirty||(ne(r.dirtyFields,c),r.isDirty=f.defaultValue?C(c,ae(z(o,c))):C()),f.keepError||(ne(r.errors,c),g.isValid&&I()),p.state.next({...r}))},pt=(c,f={})=>{const d=c?ae(c):o,k=ae(d),w=ye(c),E=w?o:k;if(f.keepDefaultValues||(o=d),!f.keepValues){if(f.keepDirtyValues){const T=new Set([...a.mount,...Object.keys(Ke(o,i))]);for(const W of Array.from(T)){const B=z(r.dirtyFields,W),be=z(i,W),Ye=z(E,W);B&&!X(be)?q(E,W,be):!B&&!X(Ye)&&se(W,Ye)}}else{if(Gt&&X(c))for(const T of a.mount){const W=z(n,T);if(W&&W._f){const B=Array.isArray(W._f.refs)?W._f.refs[0]:W._f.ref;if(Ot(B)){const be=B.closest("form");if(be){be.reset();break}}}}if(f.keepFieldsRef)for(const T of a.mount)se(T,z(E,T));else n={}}i=t.shouldUnregister?f.keepDefaultValues?ae(o):{}:ae(E),p.array.next({values:{...E}}),p.state.next({values:{...E}})}a={mount:f.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!g.isValid||!!f.keepIsValid||!!f.keepDirtyValues||!t.shouldUnregister&&!ye(E),s.watch=!!t.shouldUnregister,s.keepIsValid=!!f.keepIsValid,s.action=!1,f.keepErrors||(r.errors={}),p.state.next({submitCount:f.keepSubmitCount?r.submitCount:0,isDirty:w?!1:f.keepDirty?r.isDirty:!!(f.keepDefaultValues&&!Ie(c,o)),isSubmitted:f.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:w?{}:f.keepDirtyValues?f.keepDefaultValues&&i?Ke(o,i):r.dirtyFields:f.keepDefaultValues&&c?Ke(o,c):f.keepDirty?r.dirtyFields:{},touchedFields:f.keepTouched?r.touchedFields:{},errors:f.keepErrors?r.errors:{},isSubmitSuccessful:f.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ut=(c,f)=>pt(Pe(c)?c(i):c,{...t.resetOptions,...f}),br=(c,f={})=>{const d=z(n,c),k=d&&d._f;if(k){const w=k.refs?k.refs[0]:k.ref;w.focus&&setTimeout(()=>{w.focus(),f.shouldSelect&&Pe(w.select)&&w.select()})}},wr=c=>{r={...r,...c}},qe={control:{register:je,unregister:ee,getFieldState:S,handleSubmit:Vt,setError:D,_subscribe:ie,_runSchema:te,_updateIsValidating:V,_focusError:Je,_getWatch:Z,_getDirty:C,_setValid:I,_setFieldArray:F,_setDisabledField:ge,_setErrors:P,_getFieldArray:G,_reset:pt,_resetDefaultValues:()=>Pe(t.defaultValues)&&t.defaultValues().then(c=>{Ut(c,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:Se,_disableForm:Ce,_subjects:p,_proxyFormState:g,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state(c){s=c},get _defaultValues(){return o},get _names(){return a},set _names(c){a=c},get _formState(){return r},get _options(){return t},set _options(c){t={...t,...c}}},subscribe:A,trigger:ze,register:je,handleSubmit:Vt,watch:pe,setValue:se,getValues:u,reset:Ut,resetField:vr,clearErrors:j,unregister:ee,setError:D,setFocus:br,getFieldState:S};return{...qe,formControl:qe}}function ft(e={}){const t=N.useRef(void 0),r=N.useRef(void 0),[n,o]=N.useState({isDirty:!1,isValidating:!1,isLoading:Pe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Pe(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Pe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=bs(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,os(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),N.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),N.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),N.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),N.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),N.useEffect(()=>{var s;e.values&&!Ie(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),r.current=e.values,o(a=>({...a}))):i._resetDefaultValues()},[i,e.values]),N.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=N.useMemo(()=>ns(n,i),[i,n]),t.current}const ws=({auth:e,i18n:t})=>{const r=He(),n=ft({defaultValues:{email:"",password:""}}),o=N.useCallback(i=>{e.login(i).then(()=>{r({to:"/"}),_.toast.success(t.t("auth.loginForm.success.notifications.loginSuccess"))}).catch(s=>{if(s.status===400&&(le.fieldsErrorsMap[s.response.data.detail]&&n.setError(le.fieldsErrorsMap[s.response.data.detail],{}),le.notificationsErrorsMap[s.response.data.detail])){_.toast.error(t.t(le.notificationsErrorsMap[s.response.data.detail],i));return}_.toast.error(t.t("auth.loginForm.errors.notifications.unknownError"),{description:t.t("auth.loginForm.errors.notifications.unknownErrorDescription")})})},[]);return{form:n,submit:o}},hn=(e,t,r)=>{if(e&&"reportValidity"in e){const n=z(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ir=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?hn(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>hn(o,r,e))}},pn=(e,t)=>{t.shouldUseNativeValidation&&ir(e,t);const r={};for(const n in e){const o=z(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(Es(t.names||Object.keys(e),n)){const s=Object.assign({},z(r,n));q(s,"root",i),q(r,n,s)}else q(r,n,i)}return r},Es=(e,t)=>{const r=gn(t);return e.some(n=>gn(n).match(`^${r}\\.\\d+`))};function gn(e){return e.replace(/\]|\[/g,"")}function y(e,t,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const h=s.prototype,b=Object.keys(h);for(let g=0;g<b.length;g++){const v=b[g];v in a||(a[v]=h[v].bind(a))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const h=r?.Parent?new i:this;n(h,a),(l=h._zod).deferred??(l.deferred=[]);for(const b of h._zod.deferred)b();return h}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Xe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _n extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const yn={};function Me(e){return yn}function vn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ar(e,t){return typeof t=="bigint"?t.toString():t}function cr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ur(e){return e==null}function lr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const bn=Symbol("evaluating");function M(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==bn)return n===void 0&&(n=bn,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function We(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function De(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function wn(e){return JSON.stringify(e)}function ks(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const En="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ss=cr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dt(e){if(zt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(zt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function kn(e){return dt(e)?{...e}:Array.isArray(e)?[...e]:e}const Os=new Set(["string","number","symbol"]);function Tt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ne(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function R(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function zs(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=De(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=r.shape[a])}return We(this,"shape",s),s},checks:[]});return Ne(e,i)}function Ts(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=De(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return We(this,"shape",s),s},checks:[]});return Ne(e,i)}function Ps(e,t){if(!dt(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=De(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return We(this,"shape",i),i}});return Ne(e,o)}function Fs(e,t){if(!dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=De(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return We(this,"shape",n),n}});return Ne(e,r)}function js(e,t){const r=De(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return We(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ne(e,r)}function As(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=De(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(r)for(const h in r){if(!(h in a))throw new Error(`Unrecognized key: "${h}"`);r[h]&&(l[h]=e?new e({type:"optional",innerType:a[h]}):a[h])}else for(const h in a)l[h]=e?new e({type:"optional",innerType:a[h]}):a[h];return We(this,"shape",l),l},checks:[]});return Ne(t,s)}function Rs(e,t,r){const n=De(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return We(this,"shape",i),i}});return Ne(t,n)}function Qe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Sn(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Pt(e){return typeof e=="string"?e:e?.message}function Be(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Pt(e.inst?._zod.def?.error?.(e))??Pt(t?.error?.(e))??Pt(r.customError?.(e))??Pt(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function fr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function mt(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const On=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ar,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},dr=y("$ZodError",On),Ft=y("$ZodError",On,{Parent:Error});function $s(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Cs(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(e),r}const jt=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Xe;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Be(l,i,Me())));throw En(a,o?.callee),a}return s.value},Is=jt(Ft),At=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Be(l,i,Me())));throw En(a,o?.callee),a}return s.value},Ds=At(Ft),Rt=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Xe;return i.issues.length?{success:!1,error:new(e??dr)(i.issues.map(s=>Be(s,o,Me())))}:{success:!0,data:i.value}},Ns=Rt(Ft),$t=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Be(s,o,Me())))}:{success:!0,data:i.value}},Ls=$t(Ft),Zs=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jt(e)(t,r,o)},Vs=e=>(t,r,n)=>jt(e)(t,r,n),Us=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return At(e)(t,r,o)},Ms=e=>async(t,r,n)=>At(e)(t,r,n),Ws=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Rt(e)(t,r,o)},Bs=e=>(t,r,n)=>Rt(e)(t,r,n),Js=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $t(e)(t,r,o)},qs=e=>async(t,r,n)=>$t(e)(t,r,n),Ys=/^[cC][^\s-]{8,}$/,Hs=/^[0-9a-z]+$/,Ks=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gs=/^[0-9a-vA-V]{20}$/,Xs=/^[A-Za-z0-9]{27}$/,Qs=/^[a-zA-Z0-9_-]{21}$/,ei=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ti=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ri=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ni="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oi(){return new RegExp(ni,"u")}const 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])$/,ii=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ai=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ci=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ui=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zn=/^[A-Za-z0-9_-]*$/,li=/^\+[1-9]\d{6,14}$/,Tn="(?:(?:\\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])))",fi=new RegExp(`^${Tn}$`);function Pn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function di(e){return new RegExp(`^${Pn(e)}$`)}function mi(e){const t=Pn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Tn}T(?:${n})$`)}const hi=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},pi=/^[^A-Z]*$/,gi=/^[^a-z]*$/,Re=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),_i=y("$ZodCheckMaxLength",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!ur(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const s=fr(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),yi=y("$ZodCheckMinLength",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!ur(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const s=fr(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),vi=y("$ZodCheckLengthEquals",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!ur(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const s=fr(o),a=i>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ct=y("$ZodCheckStringFormat",(e,t)=>{var r,n;Re.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),bi=y("$ZodCheckRegex",(e,t)=>{Ct.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wi=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pi),Ct.init(e,t)}),Ei=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gi),Ct.init(e,t)}),ki=y("$ZodCheckIncludes",(e,t)=>{Re.init(e,t);const r=Tt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Si=y("$ZodCheckStartsWith",(e,t)=>{Re.init(e,t);const r=new RegExp(`^${Tt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Oi=y("$ZodCheckEndsWith",(e,t)=>{Re.init(e,t);const r=new RegExp(`.*${Tt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),xi=y("$ZodCheckOverwrite",(e,t)=>{Re.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class zi{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
12
|
+
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
13
|
+
`))}}const Ti={major:4,minor:3,patch:5},ce=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ti;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,l)=>{let h=Qe(s),b;for(const g of a){if(g._zod.def.when){if(!g._zod.def.when(s))continue}else if(h)continue;const v=s.issues.length,p=g._zod.check(s);if(p instanceof Promise&&l?.async===!1)throw new Xe;if(b||p instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await p,s.issues.length!==v&&(h||(h=Qe(s,v)))});else{if(s.issues.length===v)continue;h||(h=Qe(s,v))}}return b?b.then(()=>s):s},i=(s,a,l)=>{if(Qe(s))return s.aborted=!0,s;const h=o(a,n,l);if(h instanceof Promise){if(l.async===!1)throw new Xe;return h.then(b=>e._zod.parse(b,l))}return e._zod.parse(h,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const h=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return h instanceof Promise?h.then(b=>i(b,s,a)):i(h,s,a)}const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Xe;return l.then(h=>o(h,n,a))}return o(l,n,a)}}M(e,"~standard",()=>({validate:o=>{try{const i=Ns(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ls(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),mr=y("$ZodString",(e,t)=>{ce.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hi(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),K=y("$ZodStringFormat",(e,t)=>{Ct.init(e,t),mr.init(e,t)}),Pi=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ti),K.init(e,t)}),Fi=y("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xn(n))}else t.pattern??(t.pattern=xn());K.init(e,t)}),ji=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ri),K.init(e,t)}),Ai=y("$ZodURL",(e,t)=>{K.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ri=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oi()),K.init(e,t)}),$i=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Qs),K.init(e,t)}),Ci=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ys),K.init(e,t)}),Ii=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Hs),K.init(e,t)}),Di=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ks),K.init(e,t)}),Ni=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Gs),K.init(e,t)}),Li=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Xs),K.init(e,t)}),Zi=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mi(t)),K.init(e,t)}),Vi=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fi),K.init(e,t)}),Ui=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=di(t)),K.init(e,t)}),Mi=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ei),K.init(e,t)}),Wi=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=si),K.init(e,t),e._zod.bag.format="ipv4"}),Bi=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ii),K.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ji=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ai),K.init(e,t)}),qi=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ci),K.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Fn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Yi=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ui),K.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Fn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Hi(e){if(!zn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fn(r)}const Ki=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zn),K.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Hi(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Gi=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=li),K.init(e,t)});function Xi(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Qi=y("$ZodJWT",(e,t)=>{K.init(e,t),e._zod.check=r=>{Xi(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ea=y("$ZodUnknown",(e,t)=>{ce.init(e,t),e._zod.parse=r=>r}),ta=y("$ZodNever",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function jn(e,t,r){e.issues.length&&t.issues.push(...Sn(r,e.issues)),t.value[r]=e.value}const ra=y("$ZodArray",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},n);l instanceof Promise?i.push(l.then(h=>jn(h,r,s))):jn(l,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function It(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Sn(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function An(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=xs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Rn(e,t,r,n,o,i){const s=[],a=o.keySet,l=o.catchall._zod,h=l.def.type,b=l.optout==="optional";for(const g in t){if(a.has(g))continue;if(h==="never"){s.push(g);continue}const v=l.run({value:t[g],issues:[]},n);v instanceof Promise?e.push(v.then(p=>It(p,r,g,t,b))):It(v,r,g,t,b)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const na=y("$ZodObject",(e,t)=>{if(ce.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const n=cr(()=>An(t));M(e._zod,"propValues",()=>{const a=t.shape,l={};for(const h in a){const b=a[h]._zod;if(b.values){l[h]??(l[h]=new Set);for(const g of b.values)l[h].add(g)}}return l});const o=zt,i=t.catchall;let s;e._zod.parse=(a,l)=>{s??(s=n.value);const h=a.value;if(!o(h))return a.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),a;a.value={};const b=[],g=s.shape;for(const v of s.keys){const p=g[v],O=p._zod.optout==="optional",x=p._zod.run({value:h[v],issues:[]},l);x instanceof Promise?b.push(x.then(I=>It(I,a,v,h,O))):It(x,a,v,h,O)}return i?Rn(b,h,a,l,n.value,e):b.length?Promise.all(b).then(()=>a):a}}),oa=y("$ZodObjectJIT",(e,t)=>{na.init(e,t);const r=e._zod.parse,n=cr(()=>An(t)),o=v=>{const p=new zi(["shape","payload","ctx"]),O=n.value,x=L=>{const P=wn(L);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};p.write("const input = payload.value;");const I=Object.create(null);let V=0;for(const L of O.keys)I[L]=`key_${V++}`;p.write("const newResult = {};");for(const L of O.keys){const P=I[L],$=wn(L),J=v[L]?._zod?.optout==="optional";p.write(`const ${P} = ${x(L)};`),J?p.write(`
|
|
14
|
+
if (${P}.issues.length) {
|
|
15
|
+
if (${$} in input) {
|
|
16
|
+
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
|
|
17
|
+
...iss,
|
|
18
|
+
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
19
|
+
})));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${P}.value === undefined) {
|
|
24
|
+
if (${$} in input) {
|
|
25
|
+
newResult[${$}] = undefined;
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${$}] = ${P}.value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
`):p.write(`
|
|
32
|
+
if (${P}.issues.length) {
|
|
33
|
+
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
|
|
34
|
+
...iss,
|
|
35
|
+
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (${P}.value === undefined) {
|
|
40
|
+
if (${$} in input) {
|
|
41
|
+
newResult[${$}] = undefined;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
newResult[${$}] = ${P}.value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const F=p.compile();return(L,P)=>F(v,L,P)};let i;const s=zt,a=!yn.jitless,h=a&&Ss.value,b=t.catchall;let g;e._zod.parse=(v,p)=>{g??(g=n.value);const O=v.value;return s(O)?a&&h&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),v=i(v,p),b?Rn([],O,v,p,g,e):v):r(v,p):(v.issues.push({expected:"object",code:"invalid_type",input:O,inst:e}),v)}});function $n(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Qe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Be(s,n,Me())))}),t)}const sa=y("$ZodUnion",(e,t)=>{ce.init(e,t),M(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),M(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),M(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),M(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>lr(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const l of t.options){const h=l._zod.run({value:o.value,issues:[]},i);if(h instanceof Promise)a.push(h),s=!0;else{if(h.issues.length===0)return h;a.push(h)}}return s?Promise.all(a).then(l=>$n(l,o,e,i)):$n(a,o,e,i)}}),ia=y("$ZodIntersection",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,h])=>Cn(r,l,h)):Cn(r,i,s)}});function hr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dt(e)&&dt(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=hr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],i=t[n],s=hr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Cn(e,t,r){const n=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else e.issues.push(a);const i=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),Qe(e))return e;const s=hr(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const aa=y("$ZodEnum",(e,t)=>{ce.init(e,t);const r=vn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Os.has(typeof o)).map(o=>typeof o=="string"?Tt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),ca=y("$ZodTransform",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _n(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Xe;return r.value=o,r}});function In(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Dn=y("$ZodOptional",(e,t)=>{ce.init(e,t),e._zod.optin="optional",e._zod.optout="optional",M(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),M(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${lr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>In(i,r.value)):In(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ua=y("$ZodExactOptional",(e,t)=>{Dn.init(e,t),M(e._zod,"values",()=>t.innerType._zod.values),M(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),la=y("$ZodNullable",(e,t)=>{ce.init(e,t),M(e._zod,"optin",()=>t.innerType._zod.optin),M(e._zod,"optout",()=>t.innerType._zod.optout),M(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${lr(r.source)}|null)$`):void 0}),M(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),fa=y("$ZodDefault",(e,t)=>{ce.init(e,t),e._zod.optin="optional",M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Nn(i,t)):Nn(o,t)}});function Nn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const da=y("$ZodPrefault",(e,t)=>{ce.init(e,t),e._zod.optin="optional",M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ma=y("$ZodNonOptional",(e,t)=>{ce.init(e,t),M(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Ln(i,e)):Ln(o,e)}});function Ln(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ha=y("$ZodCatch",(e,t)=>{ce.init(e,t),M(e._zod,"optin",()=>t.innerType._zod.optin),M(e._zod,"optout",()=>t.innerType._zod.optout),M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Be(s,n,Me()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Be(i,n,Me()))},input:r.value}),r.issues=[]),r)}}),pa=y("$ZodPipe",(e,t)=>{ce.init(e,t),M(e._zod,"values",()=>t.in._zod.values),M(e._zod,"optin",()=>t.in._zod.optin),M(e._zod,"optout",()=>t.out._zod.optout),M(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Dt(s,t.in,n)):Dt(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Dt(i,t.out,n)):Dt(o,t.out,n)}});function Dt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const ga=y("$ZodReadonly",(e,t)=>{ce.init(e,t),M(e._zod,"propValues",()=>t.innerType._zod.propValues),M(e._zod,"values",()=>t.innerType._zod.values),M(e._zod,"optin",()=>t.innerType?._zod?.optin),M(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Zn):Zn(o)}});function Zn(e){return e.value=Object.freeze(e.value),e}const _a=y("$ZodCustom",(e,t)=>{Re.init(e,t),ce.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Vn(i,r,n,e));Vn(o,r,n,e)}});function Vn(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(mt(o))}}var Un;class ya{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function va(){return new ya}(Un=globalThis).__zod_globalRegistry??(Un.__zod_globalRegistry=va());const ht=globalThis.__zod_globalRegistry;function ba(e,t){return new e({type:"string",...R(t)})}function Mn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Wn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function Sa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Oa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function xa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Ta(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Pa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Fa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function ja(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function Aa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function Ra(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function $a(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function Ca(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function Ia(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Da(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function Na(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function La(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Za(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Va(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Ua(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Ma(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Wa(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Ba(e){return new e({type:"unknown"})}function Ja(e,t){return new e({type:"never",...R(t)})}function Bn(e,t){return new _i({check:"max_length",...R(t),maximum:e})}function Nt(e,t){return new yi({check:"min_length",...R(t),minimum:e})}function Jn(e,t){return new vi({check:"length_equals",...R(t),length:e})}function qa(e,t){return new bi({check:"string_format",format:"regex",...R(t),pattern:e})}function Ya(e){return new wi({check:"string_format",format:"lowercase",...R(e)})}function Ha(e){return new Ei({check:"string_format",format:"uppercase",...R(e)})}function Ka(e,t){return new ki({check:"string_format",format:"includes",...R(t),includes:e})}function Ga(e,t){return new Si({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Xa(e,t){return new Oi({check:"string_format",format:"ends_with",...R(t),suffix:e})}function et(e){return new xi({check:"overwrite",tx:e})}function Qa(e){return et(t=>t.normalize(e))}function ec(){return et(e=>e.trim())}function tc(){return et(e=>e.toLowerCase())}function rc(){return et(e=>e.toUpperCase())}function nc(){return et(e=>ks(e))}function oc(e,t,r){return new e({type:"array",element:t,...R(r)})}function sc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function ic(e){const t=ac(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(mt(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(mt(o))}},e(r.value,r)));return t}function ac(e,t){const r=new Re({check:"custom",...R(t)});return r._zod.check=e,r}function qn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ht,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function he(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const b={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,b);else{const v=s.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,v,b)}const g=e._zod.parent;g&&(s.ref||(s.ref=g),he(g,t,b),t.seen.get(g).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io==="input"&&ve(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Yn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const l=n.get(a);if(l&&l!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(s[0])?.id,v=e.external.uri??(O=>O);if(g)return{ref:v(g)};const p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${v("__shared")}#/${a}/${p}`}}if(s[1]===r)return{ref:"#"};const h=`#/${a}/`,b=s[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:h+b}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:l,defId:h}=o(s);a.def={...a.schema},h&&(a.defId=h);const b=a.schema;for(const g in b)delete b[g];b.$ref=l};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
48
|
+
|
|
49
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const h=e.external.registry.get(s[0])?.id;if(t!==s[0]&&h){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function Hn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=s=>{const a=e.seen.get(s);if(a.ref===null)return;const l=a.def??a.schema,h={...l},b=a.ref;if(a.ref=null,b){n(b);const v=e.seen.get(b),p=v.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(p)):Object.assign(l,p),Object.assign(l,h),s._zod.parent===b)for(const x in l)x==="$ref"||x==="allOf"||x in h||delete l[x];if(p.$ref)for(const x in l)x==="$ref"||x==="allOf"||x in v.def&&JSON.stringify(l[x])===JSON.stringify(v.def[x])&&delete l[x]}const g=s._zod.parent;if(g&&g!==b){n(g);const v=e.seen.get(g);if(v?.schema.$ref&&(l.$ref=v.schema.$ref,v.def))for(const p in l)p==="$ref"||p==="allOf"||p in v.def&&JSON.stringify(l[p])===JSON.stringify(v.def[p])&&delete l[p]}e.override({zodSchema:s,jsonSchema:l,path:a.path??[]})};for(const s of[...e.seen.entries()].reverse())n(s[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const a=s[1];a.def&&a.defId&&(i[a.defId]=a.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Lt(t,"input",e.processors),output:Lt(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ve(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ve(n.element,r);if(n.type==="set")return ve(n.valueType,r);if(n.type==="lazy")return ve(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ve(n.innerType,r);if(n.type==="intersection")return ve(n.left,r)||ve(n.right,r);if(n.type==="record"||n.type==="map")return ve(n.keyType,r)||ve(n.valueType,r);if(n.type==="pipe")return ve(n.in,r)||ve(n.out,r);if(n.type==="object"){for(const o in n.shape)if(ve(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(ve(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(ve(o,r))return!0;return!!(n.rest&&ve(n.rest,r))}return!1}const cc=(e,t={})=>r=>{const n=qn({...r,processors:t});return he(e,n),Yn(n,e),Hn(n,e)},Lt=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=qn({...o??{},target:i,io:t,processors:r});return he(e,s),Yn(s,e),Hn(s,e)},uc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},lc=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:h}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=uc[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),h&&(o.contentEncoding=h),l&&l.size>0){const b=[...l];b.length===1?o.pattern=b[0].source:b.length>1&&(o.allOf=[...b.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},fc=(e,t,r,n)=>{r.not={}},dc=(e,t,r,n)=>{},mc=(e,t,r,n)=>{const o=e._zod.def,i=vn(o.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},hc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},pc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gc=(e,t,r,n)=>{const o=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=he(i.element,t,{...n,path:[...n.path,"items"]})},_c=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const h in s)o.properties[h]=he(s[h],t,{...n,path:[...n.path,"properties",h]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(h=>{const b=i.shape[h]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));l.size>0&&(o.required=Array.from(l)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=he(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},yc=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,l)=>he(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=s:r.anyOf=s},vc=(e,t,r,n)=>{const o=e._zod.def,i=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=he(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=h=>"allOf"in h&&Object.keys(h).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=l},bc=(e,t,r,n)=>{const o=e._zod.def,i=he(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},wc=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Ec=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},kc=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Sc=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},Oc=(e,t,r,n)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;he(i,t,n);const s=t.seen.get(e);s.ref=i},xc=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Kn=(e,t,r,n)=>{const o=e._zod.def;he(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};function Gn(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function zc(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(b){return b.errors.forEach(function(g){return e.push(g)})}),t){var l=r[s].types,h=l&&l[n.code];r[s]=tr(s,t,r,o,h?[].concat(h,n.message):n.message)}e.shift()}return r}function Tc(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(b){return b.forEach(function(g){return e.push(g)})}),t){var l=r[s].types,h=l&&l[n.code];r[s]=tr(s,t,r,o,h?[].concat(h,n.message):n.message)}e.shift()}return r}function pr(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,i){try{return Promise.resolve(Gn(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&ir({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:pn(zc(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,i){try{return Promise.resolve(Gn(function(){return Promise.resolve((r.mode==="sync"?Is:Ds)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&ir({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof dr})(s))return{values:{},errors:pn(Tc(s.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const Pc=y("ZodISODateTime",(e,t)=>{Zi.init(e,t),Q.init(e,t)});function Fc(e){return Va(Pc,e)}const jc=y("ZodISODate",(e,t)=>{Vi.init(e,t),Q.init(e,t)});function Ac(e){return Ua(jc,e)}const Rc=y("ZodISOTime",(e,t)=>{Ui.init(e,t),Q.init(e,t)});function $c(e){return Ma(Rc,e)}const Cc=y("ZodISODuration",(e,t)=>{Mi.init(e,t),Q.init(e,t)});function Ic(e){return Wa(Cc,e)}const ke=y("ZodError",(e,t)=>{dr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Cs(e,r)},flatten:{value:r=>$s(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ar,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ar,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dc=jt(ke),Nc=At(ke),Lc=Rt(ke),Zc=$t(ke),Vc=Zs(ke),Uc=Vs(ke),Mc=Us(ke),Wc=Ms(ke),Bc=Ws(ke),Jc=Bs(ke),qc=Js(ke),Yc=qs(ke),ue=y("ZodType",(e,t)=>(ce.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Lt(e,"input"),output:Lt(e,"output")}}),e.toJSONSchema=cc(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(De(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ne(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Dc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Lc(e,r,n),e.parseAsync=async(r,n)=>Nc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Zc(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Vc(e,r,n),e.decode=(r,n)=>Uc(e,r,n),e.encodeAsync=async(r,n)=>Mc(e,r,n),e.decodeAsync=async(r,n)=>Wc(e,r,n),e.safeEncode=(r,n)=>Bc(e,r,n),e.safeDecode=(r,n)=>Jc(e,r,n),e.safeEncodeAsync=async(r,n)=>qc(e,r,n),e.safeDecodeAsync=async(r,n)=>Yc(e,r,n),e.refine=(r,n)=>e.check(Lu(r,n)),e.superRefine=r=>e.check(Zu(r)),e.overwrite=r=>e.check(et(r)),e.optional=()=>oo(e),e.exactOptional=()=>xu(e),e.nullable=()=>so(e),e.nullish=()=>oo(so(e)),e.nonoptional=r=>Au(e,r),e.array=()=>gu(e),e.or=r=>vu([e,r]),e.and=r=>wu(e,r),e.transform=r=>ao(e,Su(r)),e.default=r=>Pu(e,r),e.prefault=r=>ju(e,r),e.catch=r=>$u(e,r),e.pipe=r=>ao(e,r),e.readonly=()=>Du(e),e.describe=r=>{const n=e.clone();return ht.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return ht.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ht.get(e);const n=e.clone();return ht.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Xn=y("_ZodString",(e,t)=>{mr.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(n,o,i)=>lc(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(qa(...n)),e.includes=(...n)=>e.check(Ka(...n)),e.startsWith=(...n)=>e.check(Ga(...n)),e.endsWith=(...n)=>e.check(Xa(...n)),e.min=(...n)=>e.check(Nt(...n)),e.max=(...n)=>e.check(Bn(...n)),e.length=(...n)=>e.check(Jn(...n)),e.nonempty=(...n)=>e.check(Nt(1,...n)),e.lowercase=n=>e.check(Ya(n)),e.uppercase=n=>e.check(Ha(n)),e.trim=()=>e.check(ec()),e.normalize=(...n)=>e.check(Qa(...n)),e.toLowerCase=()=>e.check(tc()),e.toUpperCase=()=>e.check(rc()),e.slugify=()=>e.check(nc())}),Hc=y("ZodString",(e,t)=>{mr.init(e,t),Xn.init(e,t),e.email=r=>e.check(Mn(Qn,r)),e.url=r=>e.check(Oa(Kc,r)),e.jwt=r=>e.check(Za(fu,r)),e.emoji=r=>e.check(xa(Gc,r)),e.guid=r=>e.check(Wn(to,r)),e.uuid=r=>e.check(wa(Zt,r)),e.uuidv4=r=>e.check(Ea(Zt,r)),e.uuidv6=r=>e.check(ka(Zt,r)),e.uuidv7=r=>e.check(Sa(Zt,r)),e.nanoid=r=>e.check(za(Xc,r)),e.guid=r=>e.check(Wn(to,r)),e.cuid=r=>e.check(Ta(Qc,r)),e.cuid2=r=>e.check(Pa(eu,r)),e.ulid=r=>e.check(Fa(tu,r)),e.base64=r=>e.check(Da(cu,r)),e.base64url=r=>e.check(Na(uu,r)),e.xid=r=>e.check(ja(ru,r)),e.ksuid=r=>e.check(Aa(nu,r)),e.ipv4=r=>e.check(Ra(ou,r)),e.ipv6=r=>e.check($a(su,r)),e.cidrv4=r=>e.check(Ca(iu,r)),e.cidrv6=r=>e.check(Ia(au,r)),e.e164=r=>e.check(La(lu,r)),e.datetime=r=>e.check(Fc(r)),e.date=r=>e.check(Ac(r)),e.time=r=>e.check($c(r)),e.duration=r=>e.check(Ic(r))});function gr(e){return ba(Hc,e)}const Q=y("ZodStringFormat",(e,t)=>{K.init(e,t),Xn.init(e,t)}),Qn=y("ZodEmail",(e,t)=>{ji.init(e,t),Q.init(e,t)});function eo(e){return Mn(Qn,e)}const to=y("ZodGUID",(e,t)=>{Pi.init(e,t),Q.init(e,t)}),Zt=y("ZodUUID",(e,t)=>{Fi.init(e,t),Q.init(e,t)}),Kc=y("ZodURL",(e,t)=>{Ai.init(e,t),Q.init(e,t)}),Gc=y("ZodEmoji",(e,t)=>{Ri.init(e,t),Q.init(e,t)}),Xc=y("ZodNanoID",(e,t)=>{$i.init(e,t),Q.init(e,t)}),Qc=y("ZodCUID",(e,t)=>{Ci.init(e,t),Q.init(e,t)}),eu=y("ZodCUID2",(e,t)=>{Ii.init(e,t),Q.init(e,t)}),tu=y("ZodULID",(e,t)=>{Di.init(e,t),Q.init(e,t)}),ru=y("ZodXID",(e,t)=>{Ni.init(e,t),Q.init(e,t)}),nu=y("ZodKSUID",(e,t)=>{Li.init(e,t),Q.init(e,t)}),ou=y("ZodIPv4",(e,t)=>{Wi.init(e,t),Q.init(e,t)}),su=y("ZodIPv6",(e,t)=>{Bi.init(e,t),Q.init(e,t)}),iu=y("ZodCIDRv4",(e,t)=>{Ji.init(e,t),Q.init(e,t)}),au=y("ZodCIDRv6",(e,t)=>{qi.init(e,t),Q.init(e,t)}),cu=y("ZodBase64",(e,t)=>{Yi.init(e,t),Q.init(e,t)}),uu=y("ZodBase64URL",(e,t)=>{Ki.init(e,t),Q.init(e,t)}),lu=y("ZodE164",(e,t)=>{Gi.init(e,t),Q.init(e,t)}),fu=y("ZodJWT",(e,t)=>{Qi.init(e,t),Q.init(e,t)}),du=y("ZodUnknown",(e,t)=>{ea.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dc()});function ro(){return Ba(du)}const mu=y("ZodNever",(e,t)=>{ta.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fc(e,r,n)});function hu(e){return Ja(mu,e)}const pu=y("ZodArray",(e,t)=>{ra.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gc(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Nt(r,n)),e.nonempty=r=>e.check(Nt(1,r)),e.max=(r,n)=>e.check(Bn(r,n)),e.length=(r,n)=>e.check(Jn(r,n)),e.unwrap=()=>e.element});function gu(e,t){return oc(pu,e,t)}const _u=y("ZodObject",(e,t)=>{oa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_c(e,r,n,o),M(e,"shape",()=>t.shape),e.keyof=()=>Eu(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:hu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ps(e,r),e.safeExtend=r=>Fs(e,r),e.merge=r=>js(e,r),e.pick=r=>zs(e,r),e.omit=r=>Ts(e,r),e.partial=(...r)=>As(no,e,r[0]),e.required=(...r)=>Rs(io,e,r[0])});function _r(e,t){const r={type:"object",shape:e??{},...R(t)};return new _u(r)}const yu=y("ZodUnion",(e,t)=>{sa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yc(e,r,n,o),e.options=t.options});function vu(e,t){return new yu({type:"union",options:e,...R(t)})}const bu=y("ZodIntersection",(e,t)=>{ia.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vc(e,r,n,o)});function wu(e,t){return new bu({type:"intersection",left:e,right:t})}const yr=y("ZodEnum",(e,t)=>{aa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(n,o,i)=>mc(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new yr({...t,checks:[],...R(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new yr({...t,checks:[],...R(o),entries:i})}});function Eu(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new yr({type:"enum",entries:r,...R(t)})}const ku=y("ZodTransform",(e,t)=>{ca.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _n(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(mt(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(mt(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Su(e){return new ku({type:"transform",transform:e})}const no=y("ZodOptional",(e,t)=>{Dn.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new no({type:"optional",innerType:e})}const Ou=y("ZodExactOptional",(e,t)=>{ua.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xu(e){return new Ou({type:"optional",innerType:e})}const zu=y("ZodNullable",(e,t)=>{la.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function so(e){return new zu({type:"nullable",innerType:e})}const Tu=y("ZodDefault",(e,t)=>{fa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ec(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pu(e,t){return new Tu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():kn(t)}})}const Fu=y("ZodPrefault",(e,t)=>{da.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new Fu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():kn(t)}})}const io=y("ZodNonOptional",(e,t)=>{ma.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Au(e,t){return new io({type:"nonoptional",innerType:e,...R(t)})}const Ru=y("ZodCatch",(e,t)=>{ha.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $u(e,t){return new Ru({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Cu=y("ZodPipe",(e,t)=>{pa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oc(e,r,n,o),e.in=t.in,e.out=t.out});function ao(e,t){return new Cu({type:"pipe",in:e,out:t})}const Iu=y("ZodReadonly",(e,t)=>{ga.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Du(e){return new Iu({type:"readonly",innerType:e})}const Nu=y("ZodCustom",(e,t)=>{_a.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hc(e,r)});function Lu(e,t={}){return sc(Nu,e,t)}function Zu(e){return ic(e)}const Vu=({auth:e,i18n:t})=>{const r=N.useMemo(()=>_r({email:eo(),password:gr().min(8,{message:t.t("auth.signUpForm.errors.fields.passwordToSmall")})}),[]),n=ft({resolver:pr(r),defaultValues:{email:"",password:""}}),o=He();return{submit:N.useCallback(s=>{e.signup(s).then(()=>{o({to:"/auth/verify-email"}).then(()=>{_.toast.success(t.t("auth.signUpForm.success.notifications.signUpSuccess"))})}).catch(a=>{if(a.status===400){le.fieldsErrorsMap[a.response.data.detail]&&n.setError(le.fieldsErrorsMap[a.response.data.detail],{});const l=a.response.data.detail;if(le.notificationsErrorsMap[l]){const h=le.notificationsErrorsMap[l];_.toast.error(t.t(h,s))}return}_.toast.error(t.t("auth.signUpForm.errors.notifications.unknownError"),{description:t.t("auth.signUpForm.errors.notifications.unknownErrorDescription")})})},[n.setError,o]),form:n}},Uu=({i18n:e,auth:t})=>{const r=He(),n=N.useMemo(()=>_r({email:eo()}),[]),o=ft({resolver:pr(n),defaultValues:{email:""}}),i=N.useCallback(s=>{t.startResetPassword(s).then(()=>{_.toast.success(e.t("auth.startResetPasswordForm.success.notifications.startResetPasswordSuccess")),r({to:"/auth/confirm-reset-password"})}).catch(a=>{if(a.status===400&&(le.fieldsErrorsMap[a.response.data.detail]&&o.setError(le.fieldsErrorsMap[a.response.data.detail],{}),le.notificationsErrorsMap[a.response.data.detail])){_.toast.error(e.t(le.notificationsErrorsMap[a.response.data.detail],s));return}_.toast.error(e.t("auth.startResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.startResetPasswordForm.errors.notifications.unknownErrorDescription")})})},[]);return{form:o,submit:i}},Mu=({i18n:e,auth:t})=>{const r=N.useMemo(()=>_r({code:gr(),password:gr().min(8,{message:e.t("auth.confirmResetPasswordForm.errors.fields.passwordToSmall")})}),[]),n=ft({resolver:pr(r),defaultValues:{code:"",password:""}}),o=He();return{submit:N.useCallback(s=>{t.confirmResetPassword(s).then(()=>{_.toast.success(e.t("auth.confirmResetPasswordForm.success.notifications.confirmResetPasswordSuccess")),o({to:"/"})}).catch(a=>{if(a.status===400){const l=a.response.data.detail;if(le.fieldsErrorsMap[l]&&n.setError(le.fieldsErrorsMap[l],{}),le.notificationsErrorsMap[l]){const h=le.notificationsErrorsMap[l];_.toast.error(e.t(h,s));return}_.toast.error(e.t("auth.confirmResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.confirmResetPasswordForm.errors.notifications.unknownErrorDescription")})}})},[]),form:n}},Wu=({auth:e,i18n:t})=>{const r=ft({defaultValues:{code:""}}),n=He();return{submit:N.useCallback(i=>{e.verifyEmail(i).then(()=>{n({to:"/"}).then(()=>{_.toast.success(t.t("auth.verifyEmailForm.success.notifications.verifyEmailSuccess"))})}).catch(s=>{if(s.status===400){const a=s.response.data.detail,l=le.notificationsErrorsMap[a];if(l){_.toast.error(t.t(l));return}}_.toast.error(t.t("auth.verifyEmailForm.errors.notifications.unknownError"),{description:t.t("auth.verifyEmailForm.errors.notifications.unknownErrorDescription")})})},[]),form:r}};Y.Auth=Ho,Y.AuthWrapper=Ko,Y.ConfirmResetPasswordForm=qo,Y.DevPanel=Go,Y.LoginForm=Mo,Y.SignUpForm=Wo,Y.StartResetPasswordForm=Bo,Y.VerifyEmailForm=Jo,Y.authE2EConfig=_e,Y.isAdmin=Yo,Y.locale=le,Y.useConfirmResetPasswordForm=Mu,Y.useLoginForm=ws,Y.useSignUpForm=Vu,Y.useStartResetPasswordForm=Uu,Y.useVerifyEmailForm=Wu,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
"name": "@service_laboratory/auth",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.umd.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "tsc && vite build",
|
|
13
|
+
"preview": "vite preview",
|
|
14
|
+
"pack": "npm pack"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.umd.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@service_laboratory/ui": "1.0.17",
|
|
25
|
+
"@tanstack/store": "^0.8.0",
|
|
26
|
+
"react": "^19.2.0",
|
|
27
|
+
"react-dom": "19.2.0",
|
|
28
|
+
"lucide-react": "^0.561.0",
|
|
29
|
+
"axios": "^1.13.2"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^24.5.2",
|
|
33
|
+
"@types/react": "^19.1.11",
|
|
34
|
+
"@types/react-dom": "^19.1.9",
|
|
35
|
+
"@vitejs/plugin-react": "^5.0.3",
|
|
36
|
+
"typescript": "~5.8.3",
|
|
37
|
+
"vite": "^7.1.11",
|
|
38
|
+
"vite-plugin-dts": "^4.5.4"
|
|
39
|
+
}
|
|
40
40
|
}
|