@service_laboratory/auth 5.0.1 → 5.0.2
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 +18 -0
- package/dist/index.js +18 -0
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,15 @@ export declare const locale: {
|
|
|
119
119
|
"Start reset password failed, email not found": string;
|
|
120
120
|
};
|
|
121
121
|
ru: {
|
|
122
|
+
asideMenu: {
|
|
123
|
+
title: string;
|
|
124
|
+
menuItems: {
|
|
125
|
+
users: string;
|
|
126
|
+
roles: string;
|
|
127
|
+
permissions: string;
|
|
128
|
+
sessions: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
122
131
|
confirmResetPasswordForm: {
|
|
123
132
|
form: {
|
|
124
133
|
title: string;
|
|
@@ -245,6 +254,15 @@ export declare const locale: {
|
|
|
245
254
|
};
|
|
246
255
|
};
|
|
247
256
|
en: {
|
|
257
|
+
asideMenu: {
|
|
258
|
+
title: string;
|
|
259
|
+
menuItems: {
|
|
260
|
+
users: string;
|
|
261
|
+
roles: string;
|
|
262
|
+
permissions: string;
|
|
263
|
+
sessions: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
248
266
|
confirmResetPasswordForm: {
|
|
249
267
|
form: {
|
|
250
268
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -2938,6 +2938,15 @@ const I = {
|
|
|
2938
2938
|
"Start reset password failed, email not found": "email"
|
|
2939
2939
|
},
|
|
2940
2940
|
ru: {
|
|
2941
|
+
asideMenu: {
|
|
2942
|
+
title: "Управление доступом",
|
|
2943
|
+
menuItems: {
|
|
2944
|
+
users: "Пользователи",
|
|
2945
|
+
roles: "Роли",
|
|
2946
|
+
permissions: "Права доступа",
|
|
2947
|
+
sessions: "Сессии"
|
|
2948
|
+
}
|
|
2949
|
+
},
|
|
2941
2950
|
confirmResetPasswordForm: {
|
|
2942
2951
|
form: {
|
|
2943
2952
|
title: "Подтверждение сброса пароля",
|
|
@@ -3064,6 +3073,15 @@ const I = {
|
|
|
3064
3073
|
}
|
|
3065
3074
|
},
|
|
3066
3075
|
en: {
|
|
3076
|
+
asideMenu: {
|
|
3077
|
+
title: "Access Management",
|
|
3078
|
+
menuItems: {
|
|
3079
|
+
users: "Users",
|
|
3080
|
+
roles: "Roles",
|
|
3081
|
+
permissions: "Permissions",
|
|
3082
|
+
sessions: "Sessions"
|
|
3083
|
+
}
|
|
3084
|
+
},
|
|
3067
3085
|
confirmResetPasswordForm: {
|
|
3068
3086
|
form: {
|
|
3069
3087
|
title: "Confirm password reset",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -41,4 +41,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
41
41
|
|
|
42
42
|
`)}m.write("payload.value = newResult;"),m.write("return payload;");const W=m.compile();return(P,O)=>W(_,P,O)};let i;const s=me,a=!ct.jitless,l=a&&Sr.value,h=t.catchall;let g;e._zod.parse=(_,m)=>{g??(g=n.value);const v=_.value;return s(v)?a&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),_=i(_,m),h?kt([],v,_,m,g,e):_):r(_,m):(_.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),_)}});function St(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=>!se(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=>te(s,n,q())))}),t)}const io=f("$ZodUnion",(e,t)=>{F.init(e,t),S(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),S(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=>Ie(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 u of t.options){const l=u._zod.run({value:o.value,issues:[]},i);if(l instanceof Promise)a.push(l),s=!0;else{if(l.issues.length===0)return l;a.push(l)}}return s?Promise.all(a).then(u=>St(u,o,e,i)):St(a,o,e,i)}}),ao=f("$ZodIntersection",(e,t)=>{F.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(([u,l])=>zt(r,u,l)):zt(r,i,s)}});function $e(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(le(e)&&le(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=$e(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=$e(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 zt(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 u of a.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).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}),se(e))return e;const s=$e(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 co=f("$ZodEnum",(e,t)=>{F.init(e,t);const r=ut(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>zr.has(typeof o)).map(o=>typeof o=="string"?he(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}}),uo=f("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new at(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 oe;return r.value=o,r}});function Ot(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const jt=f("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ie(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=>Ot(i,r.value)):Ot(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),lo=f("$ZodExactOptional",(e,t)=>{jt.init(e,t),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),fo=f("$ZodNullable",(e,t)=>{F.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ie(r.source)}|null)$`):void 0}),S(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)}),po=f("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",S(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=>xt(i,t)):xt(o,t)}});function xt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const mo=f("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",S(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))}),ho=f("$ZodNonOptional",(e,t)=>{F.init(e,t),S(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=>Pt(i,e)):Pt(o,e)}});function Pt(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 go=f("$ZodCatch",(e,t)=>{F.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(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=>te(s,n,q()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>te(i,n,q()))},input:r.value}),r.issues=[]),r)}}),_o=f("$ZodPipe",(e,t)=>{F.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(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=>Se(s,t.in,n)):Se(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Se(i,t.out,n)):Se(o,t.out,n)}});function Se(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const vo=f("$ZodReadonly",(e,t)=>{F.init(e,t),S(e._zod,"propValues",()=>t.innerType._zod.propValues),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"optin",()=>t.innerType?._zod?.optin),S(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(Zt):Zt(o)}});function Zt(e){return e.value=Object.freeze(e.value),e}const wo=f("$ZodCustom",(e,t)=>{Y.init(e,t),F.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=>Ct(i,r,n,e));Ct(o,r,n,e)}});function Ct(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(de(o))}}var Ft;class yo{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 bo(){return new yo}(Ft=globalThis).__zod_globalRegistry??(Ft.__zod_globalRegistry=bo());const fe=globalThis.__zod_globalRegistry;function Eo(e,t){return new e({type:"string",...y(t)})}function Tt(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function Rt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function ko(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function So(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function Oo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function jo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function xo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function Po(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function Zo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function Co(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function Fo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function To(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function Ro(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function Io(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function Lo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function No(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function Ao(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function $o(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function Do(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function Uo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function Mo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function Vo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function Jo(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function Wo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function Bo(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function Ko(e){return new e({type:"unknown"})}function Go(e,t){return new e({type:"never",...y(t)})}function It(e,t){return new vn({check:"max_length",...y(t),maximum:e})}function ze(e,t){return new wn({check:"min_length",...y(t),minimum:e})}function Lt(e,t){return new yn({check:"length_equals",...y(t),length:e})}function Yo(e,t){return new bn({check:"string_format",format:"regex",...y(t),pattern:e})}function Ho(e){return new En({check:"string_format",format:"lowercase",...y(e)})}function Xo(e){return new kn({check:"string_format",format:"uppercase",...y(e)})}function Qo(e,t){return new Sn({check:"string_format",format:"includes",...y(t),includes:e})}function qo(e,t){return new zn({check:"string_format",format:"starts_with",...y(t),prefix:e})}function es(e,t){return new On({check:"string_format",format:"ends_with",...y(t),suffix:e})}function ie(e){return new jn({check:"overwrite",tx:e})}function ts(e){return ie(t=>t.normalize(e))}function rs(){return ie(e=>e.trim())}function ns(){return ie(e=>e.toLowerCase())}function os(){return ie(e=>e.toUpperCase())}function ss(){return ie(e=>kr(e))}function is(e,t,r){return new e({type:"array",element:t,...y(r)})}function as(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function cs(e){const t=us(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(de(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(de(o))}},e(r.value,r)));return t}function us(e,t){const r=new Y({check:"custom",...y(t)});return r._zod.check=e,r}function Nt(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??fe,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 $(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 h={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{const _=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,_,h)}const g=e._zod.parent;g&&(s.ref||(s.ref=g),$(g,t,h),t.seen.get(g).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&M(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 At(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 u=n.get(a);if(u&&u!==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,_=e.external.uri??(v=>v);if(g)return{ref:_(g)};const m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${_("__shared")}#/${a}/${m}`}}if(s[1]===r)return{ref:"#"};const l=`#/${a}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:l}=o(s);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const g in h)delete h[g];h.$ref=u};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>
|
|
43
43
|
|
|
44
|
-
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 l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){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 $t(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 u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){n(h);const _=e.seen.get(h),m=_.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),s._zod.parent===h)for(const w in u)w==="$ref"||w==="allOf"||w in l||delete u[w];if(m.$ref&&_.def)for(const w in u)w==="$ref"||w==="allOf"||w in _.def&&JSON.stringify(u[w])===JSON.stringify(_.def[w])&&delete u[w]}const g=s._zod.parent;if(g&&g!==h){n(g);const _=e.seen.get(g);if(_?.schema.$ref&&(u.$ref=_.schema.$ref,_.def))for(const m in u)m==="$ref"||m==="allOf"||m in _.def&&JSON.stringify(u[m])===JSON.stringify(_.def[m])&&delete u[m]}e.override({zodSchema:s,jsonSchema:u,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:Oe(t,"input",e.processors),output:Oe(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function M(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 M(n.element,r);if(n.type==="set")return M(n.valueType,r);if(n.type==="lazy")return M(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 M(n.innerType,r);if(n.type==="intersection")return M(n.left,r)||M(n.right,r);if(n.type==="record"||n.type==="map")return M(n.keyType,r)||M(n.valueType,r);if(n.type==="pipe")return M(n.in,r)||M(n.out,r);if(n.type==="object"){for(const o in n.shape)if(M(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(M(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(M(o,r))return!0;return!!(n.rest&&M(n.rest,r))}return!1}const ls=(e,t={})=>r=>{const n=Nt({...r,processors:t});return $(e,n),At(n,e),$t(n,e)},Oe=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=Nt({...o??{},target:i,io:t,processors:r});return $(e,s),At(s,e),$t(s,e)},ds={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fs=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=ds[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},ps=(e,t,r,n)=>{r.not={}},ms=(e,t,r,n)=>{},hs=(e,t,r,n)=>{const o=e._zod.def,i=ut(o.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},gs=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_s=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vs=(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=$(i.element,t,{...n,path:[...n.path,"items"]})},ws=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const l in s)o.properties[l]=$(s[l],t,{...n,path:[...n.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=i.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(o.required=Array.from(u)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=$(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ys=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,u)=>$(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=s:r.anyOf=s},bs=(e,t,r,n)=>{const o=e._zod.def,i=$(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=$(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=u},Es=(e,t,r,n)=>{const o=e._zod.def,i=$(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"}]},ks=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Ss=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},zs=(e,t,r,n)=>{const o=e._zod.def;$(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)))},Os=(e,t,r,n)=>{const o=e._zod.def;$(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},js=(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;$(i,t,n);const s=t.seen.get(e);s.ref=i},xs=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Dt=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};function Ut(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Ps(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(h){return h.errors.forEach(function(g){return e.push(g)})}),t){var u=r[s].types,l=u&&u[n.code];r[s]=J.appendErrors(s,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Zs(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(h){return h.forEach(function(g){return e.push(g)})}),t){var u=r[s].types,l=u&&u[n.code];r[s]=J.appendErrors(s,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function De(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(Ut(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&Ce({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:st(Ps(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(Ut(function(){return Promise.resolve((r.mode==="sync"?Lr:Nr)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&Ce({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof Ne})(s))return{values:{},errors:st(Zs(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 Cs=f("ZodISODateTime",(e,t)=>{Un.init(e,t),x.init(e,t)});function Fs(e){return Vo(Cs,e)}const Ts=f("ZodISODate",(e,t)=>{Mn.init(e,t),x.init(e,t)});function Rs(e){return Jo(Ts,e)}const Is=f("ZodISOTime",(e,t)=>{Vn.init(e,t),x.init(e,t)});function Ls(e){return Wo(Is,e)}const Ns=f("ZodISODuration",(e,t)=>{Jn.init(e,t),x.init(e,t)});function As(e){return Bo(Ns,e)}const B=f("ZodError",(e,t)=>{Ne.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ir(e,r)},flatten:{value:r=>Rr(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fe,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$s=ve(B),Ds=we(B),Us=ye(B),Ms=be(B),Vs=Dr(B),Js=Ur(B),Ws=Mr(B),Bs=Vr(B),Ks=Jr(B),Gs=Wr(B),Ys=Br(B),Hs=Kr(B),T=f("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oe(e,"input"),output:Oe(e,"output")}}),e.toJSONSchema=ls(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(H(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)=>X(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>$s(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Us(e,r,n),e.parseAsync=async(r,n)=>Ds(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ms(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Vs(e,r,n),e.decode=(r,n)=>Js(e,r,n),e.encodeAsync=async(r,n)=>Ws(e,r,n),e.decodeAsync=async(r,n)=>Bs(e,r,n),e.safeEncode=(r,n)=>Ks(e,r,n),e.safeDecode=(r,n)=>Gs(e,r,n),e.safeEncodeAsync=async(r,n)=>Ys(e,r,n),e.safeDecodeAsync=async(r,n)=>Hs(e,r,n),e.refine=(r,n)=>e.check(Ui(r,n)),e.superRefine=r=>e.check(Mi(r)),e.overwrite=r=>e.check(ie(r)),e.optional=()=>Gt(e),e.exactOptional=()=>xi(e),e.nullable=()=>Yt(e),e.nullish=()=>Gt(Yt(e)),e.nonoptional=r=>Ri(e,r),e.array=()=>vi(e),e.or=r=>bi([e,r]),e.and=r=>ki(e,r),e.transform=r=>Xt(e,Oi(r)),e.default=r=>Ci(e,r),e.prefault=r=>Ti(e,r),e.catch=r=>Li(e,r),e.pipe=r=>Xt(e,r),e.readonly=()=>$i(e),e.describe=r=>{const n=e.clone();return fe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return fe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return fe.get(e);const n=e.clone();return fe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Mt=f("_ZodString",(e,t)=>{Ae.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fs(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(Yo(...n)),e.includes=(...n)=>e.check(Qo(...n)),e.startsWith=(...n)=>e.check(qo(...n)),e.endsWith=(...n)=>e.check(es(...n)),e.min=(...n)=>e.check(ze(...n)),e.max=(...n)=>e.check(It(...n)),e.length=(...n)=>e.check(Lt(...n)),e.nonempty=(...n)=>e.check(ze(1,...n)),e.lowercase=n=>e.check(Ho(n)),e.uppercase=n=>e.check(Xo(n)),e.trim=()=>e.check(rs()),e.normalize=(...n)=>e.check(ts(...n)),e.toLowerCase=()=>e.check(ns()),e.toUpperCase=()=>e.check(os()),e.slugify=()=>e.check(ss())}),Xs=f("ZodString",(e,t)=>{Ae.init(e,t),Mt.init(e,t),e.email=r=>e.check(Tt(Vt,r)),e.url=r=>e.check(jo(Qs,r)),e.jwt=r=>e.check(Mo(pi,r)),e.emoji=r=>e.check(xo(qs,r)),e.guid=r=>e.check(Rt(Wt,r)),e.uuid=r=>e.check(ko(je,r)),e.uuidv4=r=>e.check(So(je,r)),e.uuidv6=r=>e.check(zo(je,r)),e.uuidv7=r=>e.check(Oo(je,r)),e.nanoid=r=>e.check(Po(ei,r)),e.guid=r=>e.check(Rt(Wt,r)),e.cuid=r=>e.check(Zo(ti,r)),e.cuid2=r=>e.check(Co(ri,r)),e.ulid=r=>e.check(Fo(ni,r)),e.base64=r=>e.check($o(li,r)),e.base64url=r=>e.check(Do(di,r)),e.xid=r=>e.check(To(oi,r)),e.ksuid=r=>e.check(Ro(si,r)),e.ipv4=r=>e.check(Io(ii,r)),e.ipv6=r=>e.check(Lo(ai,r)),e.cidrv4=r=>e.check(No(ci,r)),e.cidrv6=r=>e.check(Ao(ui,r)),e.e164=r=>e.check(Uo(fi,r)),e.datetime=r=>e.check(Fs(r)),e.date=r=>e.check(Rs(r)),e.time=r=>e.check(Ls(r)),e.duration=r=>e.check(As(r))});function Ue(e){return Eo(Xs,e)}const x=f("ZodStringFormat",(e,t)=>{j.init(e,t),Mt.init(e,t)}),Vt=f("ZodEmail",(e,t)=>{Fn.init(e,t),x.init(e,t)});function Jt(e){return Tt(Vt,e)}const Wt=f("ZodGUID",(e,t)=>{Zn.init(e,t),x.init(e,t)}),je=f("ZodUUID",(e,t)=>{Cn.init(e,t),x.init(e,t)}),Qs=f("ZodURL",(e,t)=>{Tn.init(e,t),x.init(e,t)}),qs=f("ZodEmoji",(e,t)=>{Rn.init(e,t),x.init(e,t)}),ei=f("ZodNanoID",(e,t)=>{In.init(e,t),x.init(e,t)}),ti=f("ZodCUID",(e,t)=>{Ln.init(e,t),x.init(e,t)}),ri=f("ZodCUID2",(e,t)=>{Nn.init(e,t),x.init(e,t)}),ni=f("ZodULID",(e,t)=>{An.init(e,t),x.init(e,t)}),oi=f("ZodXID",(e,t)=>{$n.init(e,t),x.init(e,t)}),si=f("ZodKSUID",(e,t)=>{Dn.init(e,t),x.init(e,t)}),ii=f("ZodIPv4",(e,t)=>{Wn.init(e,t),x.init(e,t)}),ai=f("ZodIPv6",(e,t)=>{Bn.init(e,t),x.init(e,t)}),ci=f("ZodCIDRv4",(e,t)=>{Kn.init(e,t),x.init(e,t)}),ui=f("ZodCIDRv6",(e,t)=>{Gn.init(e,t),x.init(e,t)}),li=f("ZodBase64",(e,t)=>{Yn.init(e,t),x.init(e,t)}),di=f("ZodBase64URL",(e,t)=>{Xn.init(e,t),x.init(e,t)}),fi=f("ZodE164",(e,t)=>{Qn.init(e,t),x.init(e,t)}),pi=f("ZodJWT",(e,t)=>{eo.init(e,t),x.init(e,t)}),mi=f("ZodUnknown",(e,t)=>{to.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms()});function Bt(){return Ko(mi)}const hi=f("ZodNever",(e,t)=>{ro.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n)});function gi(e){return Go(hi,e)}const _i=f("ZodArray",(e,t)=>{no.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(ze(r,n)),e.nonempty=r=>e.check(ze(1,r)),e.max=(r,n)=>e.check(It(r,n)),e.length=(r,n)=>e.check(Lt(r,n)),e.unwrap=()=>e.element});function vi(e,t){return is(_i,e,t)}const wi=f("ZodObject",(e,t)=>{so.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o),S(e,"shape",()=>t.shape),e.keyof=()=>Si(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bt()}),e.strict=()=>e.clone({...e._zod.def,catchall:gi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Pr(e,r),e.safeExtend=r=>Zr(e,r),e.merge=r=>Cr(e,r),e.pick=r=>jr(e,r),e.omit=r=>xr(e,r),e.partial=(...r)=>Fr(Kt,e,r[0]),e.required=(...r)=>Tr(Ht,e,r[0])});function Me(e,t){const r={type:"object",shape:e??{},...y(t)};return new wi(r)}const yi=f("ZodUnion",(e,t)=>{io.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ys(e,r,n,o),e.options=t.options});function bi(e,t){return new yi({type:"union",options:e,...y(t)})}const Ei=f("ZodIntersection",(e,t)=>{ao.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o)});function ki(e,t){return new Ei({type:"intersection",left:e,right:t})}const Ve=f("ZodEnum",(e,t)=>{co.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hs(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 Ve({...t,checks:[],...y(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 Ve({...t,checks:[],...y(o),entries:i})}});function Si(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ve({type:"enum",entries:r,...y(t)})}const zi=f("ZodTransform",(e,t)=>{uo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_s(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new at(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(de(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(de(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Oi(e){return new zi({type:"transform",transform:e})}const Kt=f("ZodOptional",(e,t)=>{jt.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gt(e){return new Kt({type:"optional",innerType:e})}const ji=f("ZodExactOptional",(e,t)=>{lo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xi(e){return new ji({type:"optional",innerType:e})}const Pi=f("ZodNullable",(e,t)=>{fo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yt(e){return new Pi({type:"nullable",innerType:e})}const Zi=f("ZodDefault",(e,t)=>{po.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ci(e,t){return new Zi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pt(t)}})}const Fi=f("ZodPrefault",(e,t)=>{mo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ti(e,t){return new Fi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pt(t)}})}const Ht=f("ZodNonOptional",(e,t)=>{ho.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ri(e,t){return new Ht({type:"nonoptional",innerType:e,...y(t)})}const Ii=f("ZodCatch",(e,t)=>{go.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Li(e,t){return new Ii({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ni=f("ZodPipe",(e,t)=>{_o.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>js(e,r,n,o),e.in=t.in,e.out=t.out});function Xt(e,t){return new Ni({type:"pipe",in:e,out:t})}const Ai=f("ZodReadonly",(e,t)=>{vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $i(e){return new Ai({type:"readonly",innerType:e})}const Di=f("ZodCustom",(e,t)=>{wo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gs(e,r)});function Ui(e,t={}){return as(Di,e,t)}function Mi(e){return cs(e)}const N={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:{confirmResetPasswordForm:{form:{title:"Confirm password reset",description:"Enter your new password to confirm the reset.",submitButtonLabel:"Confirm reset",passwordInputLabel:"New password",authCodeInputLabel:"Auth code",confirmPasswordLabel:"Confirm new password",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{confirmResetPasswordSuccess:"Password reset confirmed"}},errors:{fields:{passwordToSmall:"Minimum password length is 8 characters"},notifications:{wrongAuthCode:"Wrong auth code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},startResetPasswordForm:{form:{title:"Start password reset",description:"Enter your email to receive a password reset link.",submitButtonLabel:"Send reset link",emailLabel:"Email",resetPasswordDescription:"Enter your email to receive a password reset link.",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{startResetPasswordSuccess:"Reset link sent successfully"}},errors:{notifications:{emailNotFound:"User with email {{email}} not found",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},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",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}},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"}}}}},Q=b.createContext({}),Qt=()=>{const{i18n:e}=b.useContext(G.LocaleContext),{auth:t}=b.useContext(Q),r=b.useMemo(()=>Me({code:Ue(),password:Ue().min(8,{message:e.t("auth.confirmResetPasswordForm.errors.fields.passwordToSmall")})}),[]),n=J.useForm({resolver:De(r),defaultValues:{code:"",password:""}}),o=V.useNavigate();return{submit:b.useCallback(s=>{t.confirmResetPassword(s).then(()=>{d.toast.success(e.t("auth.confirmResetPasswordForm.success.notifications.confirmResetPasswordSuccess")),o({to:"/"})}).catch(a=>{if(a.status===400){const u=a.response.data.detail;if(N.fieldsErrorsMap[u]&&n.setError(N.fieldsErrorsMap[u],{}),N.notificationsErrorsMap[u]){const l=N.notificationsErrorsMap[u];d.toast.error(e.t(l,s));return}d.toast.error(e.t("auth.confirmResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.confirmResetPasswordForm.errors.notifications.unknownErrorDescription")})}})},[]),form:n}};function Vi(){const[e,t]=b.useState(!1),{form:r,submit:n}=Qt(),{i18n:o}=b.useContext(G.LocaleContext);return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:o.t("auth.confirmResetPasswordForm.form.title")}),c.jsx(d.CardDescription,{children:o.t("auth.confirmResetPasswordForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...r,children:c.jsx("form",{onSubmit:r.handleSubmit(n),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:o.t("auth.confirmResetPasswordForm.form.authCodeInputLabel")}),c.jsx(d.FormField,{control:r.control,name:"code",render:({field:i})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{type:"text",placeholder:"00001234","data-testid":U.confirmResetPasswordForm.authCodeInput,required:!0,...i})})})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("div",{className:"flex items-center",children:c.jsx(d.Label,{children:o.t("auth.confirmResetPasswordForm.form.passwordInputLabel")})}),c.jsx(d.FormField,{control:r.control,name:"password",render:({field:i,fieldState:s})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{className:"relative",children:c.jsxs("div",{className:"form-control-wrapper",children:[c.jsxs("div",{className:"relative",children:[e?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!0)}}),c.jsx(d.Input,{disabled:r.formState.isSubmitting,type:e?"text":"password",placeholder:"********","aria-invalid":!!r.formState.errors?.password,"data-testid":U.confirmResetPasswordForm.newPasswordInput,...i,className:"pr-10"})]}),s.invalid&&c.jsx(d.FieldError,{errors:[s.error]})]})})})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":U.confirmResetPasswordForm.submitButton,children:[o.t("auth.confirmResetPasswordForm.form.submitButtonLabel"),r.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[o.t("auth.confirmResetPasswordForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:o.t("auth.confirmResetPasswordForm.form.loginLink")})]})]})})})})]})})}const qt=()=>{const e=V.useNavigate(),{auth:t}=b.useContext(Q),{i18n:r}=b.useContext(G.LocaleContext),n=J.useForm({defaultValues:{email:"",password:""}}),o=b.useCallback(i=>t.login(i).then(()=>{e({to:"/"}),d.toast.success(r.t("auth.loginForm.success.notifications.loginSuccess"))}).catch(s=>{if(s.status===400&&(N.fieldsErrorsMap[s.response.data.detail]&&n.setError(N.fieldsErrorsMap[s.response.data.detail],{}),N.notificationsErrorsMap[s.response.data.detail])){d.toast.error(r.t(N.notificationsErrorsMap[s.response.data.detail],i));return}d.toast.error(r.t("auth.loginForm.errors.notifications.unknownError"),{description:r.t("auth.loginForm.errors.notifications.unknownErrorDescription")})}),[t.login,r,n.setError,e]);return{form:n,submit:o}};function Ji(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=qt(),[n,o]=b.useState(!1);return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn("transition-opacity",{"opacity-50":t.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.loginForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.loginForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{htmlFor:"email",children:e.t("auth.loginForm.form.emailLabel")}),c.jsx(d.FormField,{control:t.control,name:"email",render:({field:i})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:t.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":U.loginForm.emailInput,...i})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(d.Label,{htmlFor:"password",children:e.t("auth.loginForm.form.passwordLabel")}),c.jsx(V.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline","data-testid":U.loginForm.resetPasswordLink,children:e.t("auth.loginForm.form.forgotPasswordMessage")})]}),c.jsx(d.FormField,{control:t.control,name:"password",render:({field:i})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{className:"relative",children:c.jsxs("div",{className:"relative",children:[n?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{o(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{o(!0)}}),c.jsx(d.Input,{placeholder:"********",disabled:t.formState.isSubmitting,"data-testid":U.loginForm.passwordInput,...i,className:"pr-10","aria-invalid":!!t.formState.errors?.password,type:n?"text":"password"})]})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:t.formState.isSubmitting,"data-testid":U.loginForm.submitButton,children:[e.t("auth.loginForm.form.submitButtonLabel"),t.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.loginForm.form.dontHaveAccountMessage")," ",c.jsx(V.Link,{to:"/auth/signup","data-testid":U.loginForm.signUpFormLink,children:e.t("auth.loginForm.form.dontHaveAccountLink")})]})]})})})})]})})}const er=()=>{const{i18n:e}=b.useContext(G.LocaleContext),{auth:t}=b.useContext(Q),r=b.useMemo(()=>Me({email:Jt(),password:Ue().min(8,{message:e.t("auth.signUpForm.errors.fields.passwordToSmall")})}),[e]),n=J.useForm({resolver:De(r),defaultValues:{email:"",password:""}}),o=V.useNavigate();return{submit:b.useCallback(s=>{t.signup(s).then(()=>{o({to:"/auth/verify-email"}).then(()=>{d.toast.success(e.t("auth.signUpForm.success.notifications.signUpSuccess"))})}).catch(a=>{if(a.status===400){N.fieldsErrorsMap[a.response.data.detail]&&n.setError(N.fieldsErrorsMap[a.response.data.detail],{});const u=a.response.data.detail;if(N.notificationsErrorsMap[u]){const l=N.notificationsErrorsMap[u];d.toast.error(e.t(l,s))}return}d.toast.error(e.t("auth.signUpForm.errors.notifications.unknownError"),{description:e.t("auth.signUpForm.errors.notifications.unknownErrorDescription")})})},[n.setError,o]),form:n}};function Wi(){const[e,t]=b.useState(!1),{i18n:r}=b.useContext(G.LocaleContext),{form:n,submit:o}=er();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn({"opacity-50":n.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:r.t("auth.signUpForm.form.title")}),c.jsx(d.CardDescription,{children:r.t("auth.signUpForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...n,children:c.jsx("form",{onSubmit:n.handleSubmit(o),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:r.t("auth.signUpForm.form.emailLabel")}),c.jsx(d.FormField,{control:n.control,name:"email",render:({field:i})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:n.formState.isSubmitting,type:"email","data-testid":U.signupForm.emailInput,placeholder:"m@example.com",required:!0,...i})})})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(d.Label,{children:r.t("auth.signUpForm.form.passwordLabel")}),c.jsx(V.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:r.t("auth.signUpForm.form.forgotPasswordMessage")})]}),c.jsx(d.FormField,{control:n.control,name:"password",render:({field:i,fieldState:s})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{className:"relative",children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"relative",children:[e?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!0)}}),c.jsx(d.Input,{disabled:n.formState.isSubmitting,type:e?"text":"password",placeholder:"********","aria-invalid":!!n.formState.errors?.password,"data-testid":U.signupForm.passwordInput,...i,className:"pr-10"})]}),s.invalid&&c.jsx(d.FieldError,{errors:[s.error]})]})})})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:n.formState.isSubmitting,"data-testid":U.signupForm.submitButton,children:[r.t("auth.signUpForm.form.submitButtonLabel"),n.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[r.t("auth.signUpForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:r.t("auth.signUpForm.form.loginLink")})]})]})})})})]})})}const tr=()=>{const e=V.useNavigate(),{i18n:t}=b.useContext(G.LocaleContext),{auth:r}=b.useContext(Q),n=b.useMemo(()=>Me({email:Jt()}),[]),o=J.useForm({resolver:De(n),defaultValues:{email:""}}),i=b.useCallback(s=>{r.startResetPassword(s).then(()=>{d.toast.success(t.t("auth.startResetPasswordForm.success.notifications.startResetPasswordSuccess")),e({to:"/auth/confirm-reset-password"})}).catch(a=>{if(a.status===400&&(N.fieldsErrorsMap[a.response.data.detail]&&o.setError(N.fieldsErrorsMap[a.response.data.detail],{}),N.notificationsErrorsMap[a.response.data.detail])){d.toast.error(t.t(N.notificationsErrorsMap[a.response.data.detail],s));return}d.toast.error(t.t("auth.startResetPasswordForm.errors.notifications.unknownError"),{description:t.t("auth.startResetPasswordForm.errors.notifications.unknownErrorDescription")})})},[t,r,o.setError,e]);return{form:o,submit:i}};function Bi(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=tr();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn("transition-opacity",{"opacity-50":t.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.startResetPasswordForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.startResetPasswordForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{htmlFor:"email",children:e.t("auth.startResetPasswordForm.form.emailLabel")}),c.jsx(d.FormField,{control:t.control,name:"email",render:({field:n})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:t.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":U.startResetPasswordForm.emailInput,...n})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:t.formState.isSubmitting,"data-testid":U.startResetPasswordForm.submitButton,children:[e.t("auth.startResetPasswordForm.form.submitButtonLabel"),t.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.startResetPasswordForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:e.t("auth.startResetPasswordForm.form.loginLink")})]})]})})})})]})})}const rr=()=>{const e=J.useForm({defaultValues:{code:""}}),{auth:t}=b.useContext(Q),{i18n:r}=b.useContext(G.LocaleContext),n=V.useNavigate();return{submit:b.useCallback(i=>{t.verifyEmail(i).then(()=>{n({to:"/"}).then(()=>{d.toast.success(r.t("auth.verifyEmailForm.success.notifications.verifyEmailSuccess"))})}).catch(s=>{if(s.status===400){const a=s.response.data.detail,u=N.notificationsErrorsMap[a];if(u){d.toast.error(r.t(u));return}}d.toast.error(r.t("auth.verifyEmailForm.errors.notifications.unknownError"),{description:r.t("auth.verifyEmailForm.errors.notifications.unknownErrorDescription")})})},[r,t.verifyEmail,n]),form:e}};function Ki(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=rr();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.verifyEmailForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.verifyEmailForm.form.verifyEmailDescription")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:e.t("auth.verifyEmailForm.form.codeLabel")}),c.jsx(d.FormField,{control:t.control,name:"code",render:({field:n})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{type:"text",placeholder:"00001234","data-testid":U.verifyEmailForm.authCodeInput,required:!0,...n})})})})]}),c.jsx(d.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":U.verifyEmailForm.submitButton,children:e.t("auth.verifyEmailForm.form.submitButtonLabel")}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.verifyEmailForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:e.t("auth.verifyEmailForm.form.loginLink")})]})]})})})})]})})}const Je="Authorization",nr=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),re=new et.Store(nr()),Gi=new et.Derived({fn:()=>!!re.state.user?.roles.find(e=>e.name==="admin"),deps:[re]});class Yi{accountStore;httpClient;constructor(t){this.httpClient=t,this.accountStore=re}initAuthData=()=>{const t=localStorage.getItem("token");t&&(this.httpClient.defaults.headers.common[Je]=t)};load=async()=>{try{const{data:t}=await this.httpClient.get("/api/auth/account/me");re.setState(()=>({user:t.user,sessionID:t.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{re.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=()=>{re.setState(()=>({...nr(),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),re.setState(()=>({user:t,isAuthenticated:!0,isLoaded:!0,sessionID:n}))};_setAuthData=t=>{localStorage.setItem("token",t),this.httpClient.defaults.headers.common[Je]=t};_clearAuthData=()=>{localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[Je]}}var xe={exports:{}},We={},Pe={exports:{}},Be={};var or;function Hi(){if(or)return Be;or=1;var e=b;function t(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(g,_){var m=_(),v=n({inst:{value:m,getSnapshot:_}}),w=v[0].inst,z=v[1];return i(function(){w.value=m,w.getSnapshot=_,u(w)&&z({inst:w})},[g,m,_]),o(function(){return u(w)&&z({inst:w}),g(function(){u(w)&&z({inst:w})})},[g]),s(m),m}function u(g){var _=g.getSnapshot;g=g.value;try{var m=_();return!r(g,m)}catch{return!0}}function l(g,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Be.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Be}var Ke={};var sr;function Xi(){return sr||(sr=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function t(m,v){h||o.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var w=v();if(!g){var z=v();i(w,z)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}z=s({inst:{value:w,getSnapshot:v}});var A=z[0].inst,W=z[1];return u(function(){A.value=w,A.getSnapshot=v,r(A)&&W({inst:A})},[m,w,v]),a(function(){return r(A)&&W({inst:A}),m(function(){r(A)&&W({inst:A})})},[m]),l(w),w}function r(m){var v=m.getSnapshot;m=m.value;try{var w=v();return!i(m,w)}catch{return!0}}function n(m,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=b,i=typeof Object.is=="function"?Object.is:e,s=o.useState,a=o.useEffect,u=o.useLayoutEffect,l=o.useDebugValue,h=!1,g=!1,_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ke.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:_,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ke}var ir;function ar(){return ir||(ir=1,process.env.NODE_ENV==="production"?Pe.exports=Hi():Pe.exports=Xi()),Pe.exports}var cr;function Qi(){if(cr)return We;cr=1;var e=b,t=ar();function r(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,u=e.useDebugValue;return We.useSyncExternalStoreWithSelector=function(l,h,g,_,m){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=a(function(){function A(Z){if(!W){if(W=!0,P=Z,Z=_(Z),m!==void 0&&w.hasValue){var D=w.value;if(m(D,Z))return O=D}return O=Z}if(D=O,n(P,Z))return D;var ne=_(Z);return m!==void 0&&m(D,ne)?(P=Z,D):(P=Z,O=ne)}var W=!1,P,O,R=g===void 0?null:g;return[function(){return A(h())},R===null?void 0:function(){return A(R())}]},[h,g,_,m]);var z=o(l,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=z},[z]),u(z),z},We}var Ge={};var ur;function qi(){return ur||(ur=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=b,r=ar(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,u=t.useDebugValue;Ge.useSyncExternalStoreWithSelector=function(l,h,g,_,m){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=a(function(){function A(Z){if(!W){if(W=!0,P=Z,Z=_(Z),m!==void 0&&w.hasValue){var D=w.value;if(m(D,Z))return O=D}return O=Z}if(D=O,n(P,Z))return D;var ne=_(Z);return m!==void 0&&m(D,ne)?(P=Z,D):(P=Z,O=ne)}var W=!1,P,O,R=g===void 0?null:g;return[function(){return A(h())},R===null?void 0:function(){return A(R())}]},[h,g,_,m]);var z=o(l,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=z},[z]),u(z),z},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ge}var lr;function ea(){return lr||(lr=1,process.env.NODE_ENV==="production"?xe.exports=Qi():xe.exports=qi()),xe.exports}var ta=ea();function ra(e,t=n=>n,r={}){const n=r.equal??na;return ta.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function na(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=dr(e);if(r.length!==dr(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 dr(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const oa=({auth:e,children:t})=>{const r=V.useNavigate(),n=V.useLocation(),{isLoaded:o,isAuthenticated:i}=ra(e.accountStore,u=>u),[s,a]=b.useState(0);return b.useEffect(()=>{const u=setInterval(()=>{a(l=>l===100?(clearInterval(u),l):l+1)},100);return()=>clearInterval(u)},[]),b.useEffect(()=>{e.initAuthData(),e.load().then(()=>{a(100)})},[e]),b.useEffect(()=>{o&&!i&&(n.pathname.startsWith("/auth")||r({to:"/auth/login"}))},[o,i,r,n.pathname.startsWith]),n.pathname.startsWith("/auth")?c.jsx(Q,{value:{auth:e},children:t}):o&&i?c.jsx(Q,{value:{auth:e},children:t}):s>5?c.jsx("div",{className:"flex items-center justify-center h-screen",children:c.jsxs("div",{className:"p-4 rounded w-1/2",children:[c.jsx("h2",{className:"text-center",children:"account loading..."}),c.jsx(d.Progress,{value:s})]})}):null};k.Auth=Yi,k.AuthContext=Q,k.AuthContextProvider=oa,k.ConfirmResetPasswordForm=Vi,k.DevPanel=br,k.LoginForm=Ji,k.SignUpForm=Wi,k.StartResetPasswordForm=Bi,k.VerifyEmailForm=Ki,k.authE2EConfig=U,k.isAdmin=Gi,k.locale=N,k.useConfirmResetPasswordForm=Qt,k.useLoginForm=qt,k.useSignUpForm=er,k.useStartResetPasswordForm=tr,k.useVerifyEmailForm=rr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
44
|
+
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 l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){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 $t(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 u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){n(h);const _=e.seen.get(h),m=_.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),s._zod.parent===h)for(const w in u)w==="$ref"||w==="allOf"||w in l||delete u[w];if(m.$ref&&_.def)for(const w in u)w==="$ref"||w==="allOf"||w in _.def&&JSON.stringify(u[w])===JSON.stringify(_.def[w])&&delete u[w]}const g=s._zod.parent;if(g&&g!==h){n(g);const _=e.seen.get(g);if(_?.schema.$ref&&(u.$ref=_.schema.$ref,_.def))for(const m in u)m==="$ref"||m==="allOf"||m in _.def&&JSON.stringify(u[m])===JSON.stringify(_.def[m])&&delete u[m]}e.override({zodSchema:s,jsonSchema:u,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:Oe(t,"input",e.processors),output:Oe(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function M(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 M(n.element,r);if(n.type==="set")return M(n.valueType,r);if(n.type==="lazy")return M(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 M(n.innerType,r);if(n.type==="intersection")return M(n.left,r)||M(n.right,r);if(n.type==="record"||n.type==="map")return M(n.keyType,r)||M(n.valueType,r);if(n.type==="pipe")return M(n.in,r)||M(n.out,r);if(n.type==="object"){for(const o in n.shape)if(M(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(M(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(M(o,r))return!0;return!!(n.rest&&M(n.rest,r))}return!1}const ls=(e,t={})=>r=>{const n=Nt({...r,processors:t});return $(e,n),At(n,e),$t(n,e)},Oe=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=Nt({...o??{},target:i,io:t,processors:r});return $(e,s),At(s,e),$t(s,e)},ds={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fs=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=ds[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},ps=(e,t,r,n)=>{r.not={}},ms=(e,t,r,n)=>{},hs=(e,t,r,n)=>{const o=e._zod.def,i=ut(o.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},gs=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_s=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vs=(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=$(i.element,t,{...n,path:[...n.path,"items"]})},ws=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const l in s)o.properties[l]=$(s[l],t,{...n,path:[...n.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=i.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(o.required=Array.from(u)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=$(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ys=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,u)=>$(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=s:r.anyOf=s},bs=(e,t,r,n)=>{const o=e._zod.def,i=$(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=$(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=u},Es=(e,t,r,n)=>{const o=e._zod.def,i=$(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"}]},ks=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Ss=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},zs=(e,t,r,n)=>{const o=e._zod.def;$(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)))},Os=(e,t,r,n)=>{const o=e._zod.def;$(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},js=(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;$(i,t,n);const s=t.seen.get(e);s.ref=i},xs=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Dt=(e,t,r,n)=>{const o=e._zod.def;$(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};function Ut(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Ps(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(h){return h.errors.forEach(function(g){return e.push(g)})}),t){var u=r[s].types,l=u&&u[n.code];r[s]=J.appendErrors(s,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Zs(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(h){return h.forEach(function(g){return e.push(g)})}),t){var u=r[s].types,l=u&&u[n.code];r[s]=J.appendErrors(s,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function De(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(Ut(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&Ce({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:st(Ps(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(Ut(function(){return Promise.resolve((r.mode==="sync"?Lr:Nr)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&Ce({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof Ne})(s))return{values:{},errors:st(Zs(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 Cs=f("ZodISODateTime",(e,t)=>{Un.init(e,t),x.init(e,t)});function Fs(e){return Vo(Cs,e)}const Ts=f("ZodISODate",(e,t)=>{Mn.init(e,t),x.init(e,t)});function Rs(e){return Jo(Ts,e)}const Is=f("ZodISOTime",(e,t)=>{Vn.init(e,t),x.init(e,t)});function Ls(e){return Wo(Is,e)}const Ns=f("ZodISODuration",(e,t)=>{Jn.init(e,t),x.init(e,t)});function As(e){return Bo(Ns,e)}const B=f("ZodError",(e,t)=>{Ne.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ir(e,r)},flatten:{value:r=>Rr(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fe,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$s=ve(B),Ds=we(B),Us=ye(B),Ms=be(B),Vs=Dr(B),Js=Ur(B),Ws=Mr(B),Bs=Vr(B),Ks=Jr(B),Gs=Wr(B),Ys=Br(B),Hs=Kr(B),T=f("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oe(e,"input"),output:Oe(e,"output")}}),e.toJSONSchema=ls(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(H(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)=>X(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>$s(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Us(e,r,n),e.parseAsync=async(r,n)=>Ds(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ms(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Vs(e,r,n),e.decode=(r,n)=>Js(e,r,n),e.encodeAsync=async(r,n)=>Ws(e,r,n),e.decodeAsync=async(r,n)=>Bs(e,r,n),e.safeEncode=(r,n)=>Ks(e,r,n),e.safeDecode=(r,n)=>Gs(e,r,n),e.safeEncodeAsync=async(r,n)=>Ys(e,r,n),e.safeDecodeAsync=async(r,n)=>Hs(e,r,n),e.refine=(r,n)=>e.check(Ui(r,n)),e.superRefine=r=>e.check(Mi(r)),e.overwrite=r=>e.check(ie(r)),e.optional=()=>Gt(e),e.exactOptional=()=>xi(e),e.nullable=()=>Yt(e),e.nullish=()=>Gt(Yt(e)),e.nonoptional=r=>Ri(e,r),e.array=()=>vi(e),e.or=r=>bi([e,r]),e.and=r=>ki(e,r),e.transform=r=>Xt(e,Oi(r)),e.default=r=>Ci(e,r),e.prefault=r=>Ti(e,r),e.catch=r=>Li(e,r),e.pipe=r=>Xt(e,r),e.readonly=()=>$i(e),e.describe=r=>{const n=e.clone();return fe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return fe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return fe.get(e);const n=e.clone();return fe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Mt=f("_ZodString",(e,t)=>{Ae.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fs(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(Yo(...n)),e.includes=(...n)=>e.check(Qo(...n)),e.startsWith=(...n)=>e.check(qo(...n)),e.endsWith=(...n)=>e.check(es(...n)),e.min=(...n)=>e.check(ze(...n)),e.max=(...n)=>e.check(It(...n)),e.length=(...n)=>e.check(Lt(...n)),e.nonempty=(...n)=>e.check(ze(1,...n)),e.lowercase=n=>e.check(Ho(n)),e.uppercase=n=>e.check(Xo(n)),e.trim=()=>e.check(rs()),e.normalize=(...n)=>e.check(ts(...n)),e.toLowerCase=()=>e.check(ns()),e.toUpperCase=()=>e.check(os()),e.slugify=()=>e.check(ss())}),Xs=f("ZodString",(e,t)=>{Ae.init(e,t),Mt.init(e,t),e.email=r=>e.check(Tt(Vt,r)),e.url=r=>e.check(jo(Qs,r)),e.jwt=r=>e.check(Mo(pi,r)),e.emoji=r=>e.check(xo(qs,r)),e.guid=r=>e.check(Rt(Wt,r)),e.uuid=r=>e.check(ko(je,r)),e.uuidv4=r=>e.check(So(je,r)),e.uuidv6=r=>e.check(zo(je,r)),e.uuidv7=r=>e.check(Oo(je,r)),e.nanoid=r=>e.check(Po(ei,r)),e.guid=r=>e.check(Rt(Wt,r)),e.cuid=r=>e.check(Zo(ti,r)),e.cuid2=r=>e.check(Co(ri,r)),e.ulid=r=>e.check(Fo(ni,r)),e.base64=r=>e.check($o(li,r)),e.base64url=r=>e.check(Do(di,r)),e.xid=r=>e.check(To(oi,r)),e.ksuid=r=>e.check(Ro(si,r)),e.ipv4=r=>e.check(Io(ii,r)),e.ipv6=r=>e.check(Lo(ai,r)),e.cidrv4=r=>e.check(No(ci,r)),e.cidrv6=r=>e.check(Ao(ui,r)),e.e164=r=>e.check(Uo(fi,r)),e.datetime=r=>e.check(Fs(r)),e.date=r=>e.check(Rs(r)),e.time=r=>e.check(Ls(r)),e.duration=r=>e.check(As(r))});function Ue(e){return Eo(Xs,e)}const x=f("ZodStringFormat",(e,t)=>{j.init(e,t),Mt.init(e,t)}),Vt=f("ZodEmail",(e,t)=>{Fn.init(e,t),x.init(e,t)});function Jt(e){return Tt(Vt,e)}const Wt=f("ZodGUID",(e,t)=>{Zn.init(e,t),x.init(e,t)}),je=f("ZodUUID",(e,t)=>{Cn.init(e,t),x.init(e,t)}),Qs=f("ZodURL",(e,t)=>{Tn.init(e,t),x.init(e,t)}),qs=f("ZodEmoji",(e,t)=>{Rn.init(e,t),x.init(e,t)}),ei=f("ZodNanoID",(e,t)=>{In.init(e,t),x.init(e,t)}),ti=f("ZodCUID",(e,t)=>{Ln.init(e,t),x.init(e,t)}),ri=f("ZodCUID2",(e,t)=>{Nn.init(e,t),x.init(e,t)}),ni=f("ZodULID",(e,t)=>{An.init(e,t),x.init(e,t)}),oi=f("ZodXID",(e,t)=>{$n.init(e,t),x.init(e,t)}),si=f("ZodKSUID",(e,t)=>{Dn.init(e,t),x.init(e,t)}),ii=f("ZodIPv4",(e,t)=>{Wn.init(e,t),x.init(e,t)}),ai=f("ZodIPv6",(e,t)=>{Bn.init(e,t),x.init(e,t)}),ci=f("ZodCIDRv4",(e,t)=>{Kn.init(e,t),x.init(e,t)}),ui=f("ZodCIDRv6",(e,t)=>{Gn.init(e,t),x.init(e,t)}),li=f("ZodBase64",(e,t)=>{Yn.init(e,t),x.init(e,t)}),di=f("ZodBase64URL",(e,t)=>{Xn.init(e,t),x.init(e,t)}),fi=f("ZodE164",(e,t)=>{Qn.init(e,t),x.init(e,t)}),pi=f("ZodJWT",(e,t)=>{eo.init(e,t),x.init(e,t)}),mi=f("ZodUnknown",(e,t)=>{to.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms()});function Bt(){return Ko(mi)}const hi=f("ZodNever",(e,t)=>{ro.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n)});function gi(e){return Go(hi,e)}const _i=f("ZodArray",(e,t)=>{no.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(ze(r,n)),e.nonempty=r=>e.check(ze(1,r)),e.max=(r,n)=>e.check(It(r,n)),e.length=(r,n)=>e.check(Lt(r,n)),e.unwrap=()=>e.element});function vi(e,t){return is(_i,e,t)}const wi=f("ZodObject",(e,t)=>{so.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o),S(e,"shape",()=>t.shape),e.keyof=()=>Si(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bt()}),e.strict=()=>e.clone({...e._zod.def,catchall:gi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Pr(e,r),e.safeExtend=r=>Zr(e,r),e.merge=r=>Cr(e,r),e.pick=r=>jr(e,r),e.omit=r=>xr(e,r),e.partial=(...r)=>Fr(Kt,e,r[0]),e.required=(...r)=>Tr(Ht,e,r[0])});function Me(e,t){const r={type:"object",shape:e??{},...y(t)};return new wi(r)}const yi=f("ZodUnion",(e,t)=>{io.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ys(e,r,n,o),e.options=t.options});function bi(e,t){return new yi({type:"union",options:e,...y(t)})}const Ei=f("ZodIntersection",(e,t)=>{ao.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o)});function ki(e,t){return new Ei({type:"intersection",left:e,right:t})}const Ve=f("ZodEnum",(e,t)=>{co.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hs(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 Ve({...t,checks:[],...y(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 Ve({...t,checks:[],...y(o),entries:i})}});function Si(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ve({type:"enum",entries:r,...y(t)})}const zi=f("ZodTransform",(e,t)=>{uo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_s(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new at(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(de(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(de(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Oi(e){return new zi({type:"transform",transform:e})}const Kt=f("ZodOptional",(e,t)=>{jt.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gt(e){return new Kt({type:"optional",innerType:e})}const ji=f("ZodExactOptional",(e,t)=>{lo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xi(e){return new ji({type:"optional",innerType:e})}const Pi=f("ZodNullable",(e,t)=>{fo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yt(e){return new Pi({type:"nullable",innerType:e})}const Zi=f("ZodDefault",(e,t)=>{po.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ci(e,t){return new Zi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pt(t)}})}const Fi=f("ZodPrefault",(e,t)=>{mo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ti(e,t){return new Fi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pt(t)}})}const Ht=f("ZodNonOptional",(e,t)=>{ho.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ri(e,t){return new Ht({type:"nonoptional",innerType:e,...y(t)})}const Ii=f("ZodCatch",(e,t)=>{go.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Li(e,t){return new Ii({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ni=f("ZodPipe",(e,t)=>{_o.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>js(e,r,n,o),e.in=t.in,e.out=t.out});function Xt(e,t){return new Ni({type:"pipe",in:e,out:t})}const Ai=f("ZodReadonly",(e,t)=>{vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $i(e){return new Ai({type:"readonly",innerType:e})}const Di=f("ZodCustom",(e,t)=>{wo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gs(e,r)});function Ui(e,t={}){return as(Di,e,t)}function Mi(e){return cs(e)}const N={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:{asideMenu:{title:"Управление доступом",menuItems:{users:"Пользователи",roles:"Роли",permissions:"Права доступа",sessions:"Сессии"}},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:{asideMenu:{title:"Access Management",menuItems:{users:"Users",roles:"Roles",permissions:"Permissions",sessions:"Sessions"}},confirmResetPasswordForm:{form:{title:"Confirm password reset",description:"Enter your new password to confirm the reset.",submitButtonLabel:"Confirm reset",passwordInputLabel:"New password",authCodeInputLabel:"Auth code",confirmPasswordLabel:"Confirm new password",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{confirmResetPasswordSuccess:"Password reset confirmed"}},errors:{fields:{passwordToSmall:"Minimum password length is 8 characters"},notifications:{wrongAuthCode:"Wrong auth code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},startResetPasswordForm:{form:{title:"Start password reset",description:"Enter your email to receive a password reset link.",submitButtonLabel:"Send reset link",emailLabel:"Email",resetPasswordDescription:"Enter your email to receive a password reset link.",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{startResetPasswordSuccess:"Reset link sent successfully"}},errors:{notifications:{emailNotFound:"User with email {{email}} not found",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},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",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}},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"}}}}},Q=b.createContext({}),Qt=()=>{const{i18n:e}=b.useContext(G.LocaleContext),{auth:t}=b.useContext(Q),r=b.useMemo(()=>Me({code:Ue(),password:Ue().min(8,{message:e.t("auth.confirmResetPasswordForm.errors.fields.passwordToSmall")})}),[]),n=J.useForm({resolver:De(r),defaultValues:{code:"",password:""}}),o=V.useNavigate();return{submit:b.useCallback(s=>{t.confirmResetPassword(s).then(()=>{d.toast.success(e.t("auth.confirmResetPasswordForm.success.notifications.confirmResetPasswordSuccess")),o({to:"/"})}).catch(a=>{if(a.status===400){const u=a.response.data.detail;if(N.fieldsErrorsMap[u]&&n.setError(N.fieldsErrorsMap[u],{}),N.notificationsErrorsMap[u]){const l=N.notificationsErrorsMap[u];d.toast.error(e.t(l,s));return}d.toast.error(e.t("auth.confirmResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.confirmResetPasswordForm.errors.notifications.unknownErrorDescription")})}})},[]),form:n}};function Vi(){const[e,t]=b.useState(!1),{form:r,submit:n}=Qt(),{i18n:o}=b.useContext(G.LocaleContext);return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:o.t("auth.confirmResetPasswordForm.form.title")}),c.jsx(d.CardDescription,{children:o.t("auth.confirmResetPasswordForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...r,children:c.jsx("form",{onSubmit:r.handleSubmit(n),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:o.t("auth.confirmResetPasswordForm.form.authCodeInputLabel")}),c.jsx(d.FormField,{control:r.control,name:"code",render:({field:i})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{type:"text",placeholder:"00001234","data-testid":U.confirmResetPasswordForm.authCodeInput,required:!0,...i})})})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("div",{className:"flex items-center",children:c.jsx(d.Label,{children:o.t("auth.confirmResetPasswordForm.form.passwordInputLabel")})}),c.jsx(d.FormField,{control:r.control,name:"password",render:({field:i,fieldState:s})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{className:"relative",children:c.jsxs("div",{className:"form-control-wrapper",children:[c.jsxs("div",{className:"relative",children:[e?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!0)}}),c.jsx(d.Input,{disabled:r.formState.isSubmitting,type:e?"text":"password",placeholder:"********","aria-invalid":!!r.formState.errors?.password,"data-testid":U.confirmResetPasswordForm.newPasswordInput,...i,className:"pr-10"})]}),s.invalid&&c.jsx(d.FieldError,{errors:[s.error]})]})})})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":U.confirmResetPasswordForm.submitButton,children:[o.t("auth.confirmResetPasswordForm.form.submitButtonLabel"),r.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[o.t("auth.confirmResetPasswordForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:o.t("auth.confirmResetPasswordForm.form.loginLink")})]})]})})})})]})})}const qt=()=>{const e=V.useNavigate(),{auth:t}=b.useContext(Q),{i18n:r}=b.useContext(G.LocaleContext),n=J.useForm({defaultValues:{email:"",password:""}}),o=b.useCallback(i=>t.login(i).then(()=>{e({to:"/"}),d.toast.success(r.t("auth.loginForm.success.notifications.loginSuccess"))}).catch(s=>{if(s.status===400&&(N.fieldsErrorsMap[s.response.data.detail]&&n.setError(N.fieldsErrorsMap[s.response.data.detail],{}),N.notificationsErrorsMap[s.response.data.detail])){d.toast.error(r.t(N.notificationsErrorsMap[s.response.data.detail],i));return}d.toast.error(r.t("auth.loginForm.errors.notifications.unknownError"),{description:r.t("auth.loginForm.errors.notifications.unknownErrorDescription")})}),[t.login,r,n.setError,e]);return{form:n,submit:o}};function Ji(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=qt(),[n,o]=b.useState(!1);return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn("transition-opacity",{"opacity-50":t.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.loginForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.loginForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{htmlFor:"email",children:e.t("auth.loginForm.form.emailLabel")}),c.jsx(d.FormField,{control:t.control,name:"email",render:({field:i})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:t.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":U.loginForm.emailInput,...i})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(d.Label,{htmlFor:"password",children:e.t("auth.loginForm.form.passwordLabel")}),c.jsx(V.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline","data-testid":U.loginForm.resetPasswordLink,children:e.t("auth.loginForm.form.forgotPasswordMessage")})]}),c.jsx(d.FormField,{control:t.control,name:"password",render:({field:i})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{className:"relative",children:c.jsxs("div",{className:"relative",children:[n?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{o(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{o(!0)}}),c.jsx(d.Input,{placeholder:"********",disabled:t.formState.isSubmitting,"data-testid":U.loginForm.passwordInput,...i,className:"pr-10","aria-invalid":!!t.formState.errors?.password,type:n?"text":"password"})]})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:t.formState.isSubmitting,"data-testid":U.loginForm.submitButton,children:[e.t("auth.loginForm.form.submitButtonLabel"),t.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.loginForm.form.dontHaveAccountMessage")," ",c.jsx(V.Link,{to:"/auth/signup","data-testid":U.loginForm.signUpFormLink,children:e.t("auth.loginForm.form.dontHaveAccountLink")})]})]})})})})]})})}const er=()=>{const{i18n:e}=b.useContext(G.LocaleContext),{auth:t}=b.useContext(Q),r=b.useMemo(()=>Me({email:Jt(),password:Ue().min(8,{message:e.t("auth.signUpForm.errors.fields.passwordToSmall")})}),[e]),n=J.useForm({resolver:De(r),defaultValues:{email:"",password:""}}),o=V.useNavigate();return{submit:b.useCallback(s=>{t.signup(s).then(()=>{o({to:"/auth/verify-email"}).then(()=>{d.toast.success(e.t("auth.signUpForm.success.notifications.signUpSuccess"))})}).catch(a=>{if(a.status===400){N.fieldsErrorsMap[a.response.data.detail]&&n.setError(N.fieldsErrorsMap[a.response.data.detail],{});const u=a.response.data.detail;if(N.notificationsErrorsMap[u]){const l=N.notificationsErrorsMap[u];d.toast.error(e.t(l,s))}return}d.toast.error(e.t("auth.signUpForm.errors.notifications.unknownError"),{description:e.t("auth.signUpForm.errors.notifications.unknownErrorDescription")})})},[n.setError,o]),form:n}};function Wi(){const[e,t]=b.useState(!1),{i18n:r}=b.useContext(G.LocaleContext),{form:n,submit:o}=er();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn({"opacity-50":n.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:r.t("auth.signUpForm.form.title")}),c.jsx(d.CardDescription,{children:r.t("auth.signUpForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...n,children:c.jsx("form",{onSubmit:n.handleSubmit(o),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:r.t("auth.signUpForm.form.emailLabel")}),c.jsx(d.FormField,{control:n.control,name:"email",render:({field:i})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:n.formState.isSubmitting,type:"email","data-testid":U.signupForm.emailInput,placeholder:"m@example.com",required:!0,...i})})})})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(d.Label,{children:r.t("auth.signUpForm.form.passwordLabel")}),c.jsx(V.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:r.t("auth.signUpForm.form.forgotPasswordMessage")})]}),c.jsx(d.FormField,{control:n.control,name:"password",render:({field:i,fieldState:s})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{className:"relative",children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"relative",children:[e?c.jsx(K.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!1)}}):c.jsx(K.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{t(!0)}}),c.jsx(d.Input,{disabled:n.formState.isSubmitting,type:e?"text":"password",placeholder:"********","aria-invalid":!!n.formState.errors?.password,"data-testid":U.signupForm.passwordInput,...i,className:"pr-10"})]}),s.invalid&&c.jsx(d.FieldError,{errors:[s.error]})]})})})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:n.formState.isSubmitting,"data-testid":U.signupForm.submitButton,children:[r.t("auth.signUpForm.form.submitButtonLabel"),n.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[r.t("auth.signUpForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:r.t("auth.signUpForm.form.loginLink")})]})]})})})})]})})}const tr=()=>{const e=V.useNavigate(),{i18n:t}=b.useContext(G.LocaleContext),{auth:r}=b.useContext(Q),n=b.useMemo(()=>Me({email:Jt()}),[]),o=J.useForm({resolver:De(n),defaultValues:{email:""}}),i=b.useCallback(s=>{r.startResetPassword(s).then(()=>{d.toast.success(t.t("auth.startResetPasswordForm.success.notifications.startResetPasswordSuccess")),e({to:"/auth/confirm-reset-password"})}).catch(a=>{if(a.status===400&&(N.fieldsErrorsMap[a.response.data.detail]&&o.setError(N.fieldsErrorsMap[a.response.data.detail],{}),N.notificationsErrorsMap[a.response.data.detail])){d.toast.error(t.t(N.notificationsErrorsMap[a.response.data.detail],s));return}d.toast.error(t.t("auth.startResetPasswordForm.errors.notifications.unknownError"),{description:t.t("auth.startResetPasswordForm.errors.notifications.unknownErrorDescription")})})},[t,r,o.setError,e]);return{form:o,submit:i}};function Bi(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=tr();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{className:d.cn("transition-opacity",{"opacity-50":t.formState.isSubmitting}),children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.startResetPasswordForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.startResetPasswordForm.form.description")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{htmlFor:"email",children:e.t("auth.startResetPasswordForm.form.emailLabel")}),c.jsx(d.FormField,{control:t.control,name:"email",render:({field:n})=>c.jsxs(d.FormItem,{children:[c.jsx(d.FormControl,{children:c.jsx(d.Input,{disabled:t.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":U.startResetPasswordForm.emailInput,...n})}),c.jsx(d.FormMessage,{})]})})]}),c.jsxs(d.Button,{type:"submit",className:"w-full cursor-pointer",disabled:t.formState.isSubmitting,"data-testid":U.startResetPasswordForm.submitButton,children:[e.t("auth.startResetPasswordForm.form.submitButtonLabel"),t.formState.isSubmitting&&c.jsx(K.Loader2Icon,{className:"animate-spin"})]}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.startResetPasswordForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:e.t("auth.startResetPasswordForm.form.loginLink")})]})]})})})})]})})}const rr=()=>{const e=J.useForm({defaultValues:{code:""}}),{auth:t}=b.useContext(Q),{i18n:r}=b.useContext(G.LocaleContext),n=V.useNavigate();return{submit:b.useCallback(i=>{t.verifyEmail(i).then(()=>{n({to:"/"}).then(()=>{d.toast.success(r.t("auth.verifyEmailForm.success.notifications.verifyEmailSuccess"))})}).catch(s=>{if(s.status===400){const a=s.response.data.detail,u=N.notificationsErrorsMap[a];if(u){d.toast.error(r.t(u));return}}d.toast.error(r.t("auth.verifyEmailForm.errors.notifications.unknownError"),{description:r.t("auth.verifyEmailForm.errors.notifications.unknownErrorDescription")})})},[r,t.verifyEmail,n]),form:e}};function Ki(){const{i18n:e}=b.useContext(G.LocaleContext),{form:t,submit:r}=rr();return c.jsx("div",{className:"flex flex-col gap-6",children:c.jsxs(d.Card,{children:[c.jsxs(d.CardHeader,{children:[c.jsx(d.CardTitle,{className:"text-2xl",children:e.t("auth.verifyEmailForm.form.title")}),c.jsx(d.CardDescription,{children:e.t("auth.verifyEmailForm.form.verifyEmailDescription")})]}),c.jsx(d.CardContent,{children:c.jsx(d.Form,{...t,children:c.jsx("form",{onSubmit:t.handleSubmit(r),children:c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(d.Label,{children:e.t("auth.verifyEmailForm.form.codeLabel")}),c.jsx(d.FormField,{control:t.control,name:"code",render:({field:n})=>c.jsx(d.FormItem,{children:c.jsx(d.FormControl,{children:c.jsx(d.Input,{type:"text",placeholder:"00001234","data-testid":U.verifyEmailForm.authCodeInput,required:!0,...n})})})})]}),c.jsx(d.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":U.verifyEmailForm.submitButton,children:e.t("auth.verifyEmailForm.form.submitButtonLabel")}),c.jsxs(d.FieldDescription,{className:"text-center",children:[e.t("auth.verifyEmailForm.form.loginLinkMessage")," ",c.jsx(V.Link,{to:"/auth/login",children:e.t("auth.verifyEmailForm.form.loginLink")})]})]})})})})]})})}const Je="Authorization",nr=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),re=new et.Store(nr()),Gi=new et.Derived({fn:()=>!!re.state.user?.roles.find(e=>e.name==="admin"),deps:[re]});class Yi{accountStore;httpClient;constructor(t){this.httpClient=t,this.accountStore=re}initAuthData=()=>{const t=localStorage.getItem("token");t&&(this.httpClient.defaults.headers.common[Je]=t)};load=async()=>{try{const{data:t}=await this.httpClient.get("/api/auth/account/me");re.setState(()=>({user:t.user,sessionID:t.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{re.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=()=>{re.setState(()=>({...nr(),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),re.setState(()=>({user:t,isAuthenticated:!0,isLoaded:!0,sessionID:n}))};_setAuthData=t=>{localStorage.setItem("token",t),this.httpClient.defaults.headers.common[Je]=t};_clearAuthData=()=>{localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[Je]}}var xe={exports:{}},We={},Pe={exports:{}},Be={};var or;function Hi(){if(or)return Be;or=1;var e=b;function t(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(g,_){var m=_(),v=n({inst:{value:m,getSnapshot:_}}),w=v[0].inst,z=v[1];return i(function(){w.value=m,w.getSnapshot=_,u(w)&&z({inst:w})},[g,m,_]),o(function(){return u(w)&&z({inst:w}),g(function(){u(w)&&z({inst:w})})},[g]),s(m),m}function u(g){var _=g.getSnapshot;g=g.value;try{var m=_();return!r(g,m)}catch{return!0}}function l(g,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Be.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Be}var Ke={};var sr;function Xi(){return sr||(sr=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function t(m,v){h||o.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var w=v();if(!g){var z=v();i(w,z)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}z=s({inst:{value:w,getSnapshot:v}});var A=z[0].inst,W=z[1];return u(function(){A.value=w,A.getSnapshot=v,r(A)&&W({inst:A})},[m,w,v]),a(function(){return r(A)&&W({inst:A}),m(function(){r(A)&&W({inst:A})})},[m]),l(w),w}function r(m){var v=m.getSnapshot;m=m.value;try{var w=v();return!i(m,w)}catch{return!0}}function n(m,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=b,i=typeof Object.is=="function"?Object.is:e,s=o.useState,a=o.useEffect,u=o.useLayoutEffect,l=o.useDebugValue,h=!1,g=!1,_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ke.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:_,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ke}var ir;function ar(){return ir||(ir=1,process.env.NODE_ENV==="production"?Pe.exports=Hi():Pe.exports=Xi()),Pe.exports}var cr;function Qi(){if(cr)return We;cr=1;var e=b,t=ar();function r(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,u=e.useDebugValue;return We.useSyncExternalStoreWithSelector=function(l,h,g,_,m){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=a(function(){function A(Z){if(!W){if(W=!0,P=Z,Z=_(Z),m!==void 0&&w.hasValue){var D=w.value;if(m(D,Z))return O=D}return O=Z}if(D=O,n(P,Z))return D;var ne=_(Z);return m!==void 0&&m(D,ne)?(P=Z,D):(P=Z,O=ne)}var W=!1,P,O,R=g===void 0?null:g;return[function(){return A(h())},R===null?void 0:function(){return A(R())}]},[h,g,_,m]);var z=o(l,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=z},[z]),u(z),z},We}var Ge={};var ur;function qi(){return ur||(ur=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=b,r=ar(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,u=t.useDebugValue;Ge.useSyncExternalStoreWithSelector=function(l,h,g,_,m){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=a(function(){function A(Z){if(!W){if(W=!0,P=Z,Z=_(Z),m!==void 0&&w.hasValue){var D=w.value;if(m(D,Z))return O=D}return O=Z}if(D=O,n(P,Z))return D;var ne=_(Z);return m!==void 0&&m(D,ne)?(P=Z,D):(P=Z,O=ne)}var W=!1,P,O,R=g===void 0?null:g;return[function(){return A(h())},R===null?void 0:function(){return A(R())}]},[h,g,_,m]);var z=o(l,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=z},[z]),u(z),z},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ge}var lr;function ea(){return lr||(lr=1,process.env.NODE_ENV==="production"?xe.exports=Qi():xe.exports=qi()),xe.exports}var ta=ea();function ra(e,t=n=>n,r={}){const n=r.equal??na;return ta.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function na(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=dr(e);if(r.length!==dr(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 dr(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const oa=({auth:e,children:t})=>{const r=V.useNavigate(),n=V.useLocation(),{isLoaded:o,isAuthenticated:i}=ra(e.accountStore,u=>u),[s,a]=b.useState(0);return b.useEffect(()=>{const u=setInterval(()=>{a(l=>l===100?(clearInterval(u),l):l+1)},100);return()=>clearInterval(u)},[]),b.useEffect(()=>{e.initAuthData(),e.load().then(()=>{a(100)})},[e]),b.useEffect(()=>{o&&!i&&(n.pathname.startsWith("/auth")||r({to:"/auth/login"}))},[o,i,r,n.pathname.startsWith]),n.pathname.startsWith("/auth")?c.jsx(Q,{value:{auth:e},children:t}):o&&i?c.jsx(Q,{value:{auth:e},children:t}):s>5?c.jsx("div",{className:"flex items-center justify-center h-screen",children:c.jsxs("div",{className:"p-4 rounded w-1/2",children:[c.jsx("h2",{className:"text-center",children:"account loading..."}),c.jsx(d.Progress,{value:s})]})}):null};k.Auth=Yi,k.AuthContext=Q,k.AuthContextProvider=oa,k.ConfirmResetPasswordForm=Vi,k.DevPanel=br,k.LoginForm=Ji,k.SignUpForm=Wi,k.StartResetPasswordForm=Bi,k.VerifyEmailForm=Ki,k.authE2EConfig=U,k.isAdmin=Gi,k.locale=N,k.useConfirmResetPasswordForm=Qt,k.useLoginForm=qt,k.useSignUpForm=er,k.useStartResetPasswordForm=tr,k.useVerifyEmailForm=rr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|