1import{j as e,bk as t,bl as n,bm as r,bn as s,bf as o,aX as i,bj as a,aG as c,bi as d}from"./ui-vendor-B6qDrwDU.js";import{j as u,a as l}from"./react-vendor-CWdWklYc.js";import{a0 as f,a1 as p,a2 as h,l as m,u as g,a3 as y,a4 as v,a5 as w,a6 as _,C as x,b as z,c as b,d as j,a as k,L as $,I as N,a7 as O,A as S,z as P,r as E,y as Z,B as T,Q as A,R as I,U as C,V as D,W as U,X as F,a8 as J}from"./index-lqK706Ou.js";import{b as R,c as L}from"./clerk-vendor-D3H2MyHf.js";import{D as V}from"./DashboardLayout-DnCA3ayu.js";import{L as M}from"./loading-overlay-DqCJoqDT.js";import"./convex-vendor-CExL1t8U.js";import"./clerk-auth.service-DFa_3oME.js";import"./mode-toggle-D4o8gWHn.js";const W=(e,t,n)=>{if(e&&"reportValidity"in e){const r=f(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},B=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?W(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>W(t,n,e))}},Y=(e,t)=>{t.shouldUseNativeValidation&&B(e,t);const n={};for(const r in e){const s=f(t.fields,r),o=Object.assign(e[r]||{},{ref:s&&s.ref});if(q(t.names||Object.keys(e),r)){const e=Object.assign({},f(n,r));p(e,"root",o),p(n,r,e)}else p(n,r,o)}return n},q=(e,t)=>{const n=K(t);return e.some(e=>K(e).match(`^${n}\\.\\d+`))};function K(e){return e.replace(/\]|\[/g,"")}function G(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:i,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const s=i.prototype,o=Object.keys(s);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=s[t].bind(n))}}const s=n?.Parent??Object;class o extends s{}function i(e){var t;const s=n?.Parent?new o:this;r(s,e),(t=s._zod).deferred??(t.deferred=[]);for(const n of s._zod.deferred)n();return s}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class X extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}
vendor: 4,855 bytes, line 1
1class H extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Q={};function ee(e){return Q}function te(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function ne(e,t){return"bigint"==typeof t?t.toString():t}function re(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function se(e){return null==e}function oe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const ie=Symbol("evaluating");function ae(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ie)return void 0===r&&(r=ie,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ce(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function de(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ue(e){return JSON.stringify(e)}const le="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function fe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const pe=re(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function he(e){if(!1===fe(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==fe(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function me(e){return he(e)?{...e}:Array.isArray(e)?[...e]:e}const ge=new Set(["string","number","symbol"]);function ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ve(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function we(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function _e(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function xe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ze(e){return"string"==typeof e?e:e?.message}function be(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const s=ze(e.inst?._zod.def?.error?.(e))??ze(t?.error?.(e))??ze(n.customError?.(e))??ze(n.localeError?.(e))??"Invalid input";r.message=s}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function je(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ke(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const $e=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ne,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ne=G("$ZodError",$e),Oe=G("$ZodError",$e,{Parent:Error});const Se=e=>(t,n,r,s)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new X;if(i.issues.length){const t=new(s?.Err??e)(i.issues.map(e=>be(e,o,ee())));throw le(t,s?.callee),t}return i.value},Pe=Se(Oe),Ee=e=>async(t,n,r,s)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(s?.Err??e)(i.issues.map(e=>be(e,o,ee())));throw le(t,s?.callee),t}return i.value},Ze=Ee(Oe),Te=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new X;return o.issues.length?{success:!1,error:new(e??Ne)(o.issues.map(e=>be(e,s,ee())))}:{success:!0,data:o.value}},Ae=Te(Oe),Ie=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>be(e,s,ee())))}:{success:!0,data:o.value}},Ce=Ie(Oe),De=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Se(e)(t,n,s)},Ue=e=>(t,n,r)=>Se(e)(t,n,r),Fe=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ee(e)(t,n,s)},Je=e=>async(t,n,r)=>Ee(e)(t,n,r),Re=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Te(e)(t,n,s)},Le=e=>(t,n,r)=>Te(e)(t,n,r),Ve=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ie(e)(t,n,s)},Me=e=>async(t,n,r)=>Ie(e)(t,n,r),We=/^[cC][^\s-]{8,}
1$/,Be=/^[0-9a-z]+$/,Ye=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qe=/^[0-9a-vA-V]{20}$/,Ke=/^[A-Za-z0-9]{27}$/,Ge=/^[a-zA-Z0-9_-]{21}$/,Xe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,He=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,et=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const tt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,st=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ot=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,it=/^[A-Za-z0-9_-]*$/,at=/^\+[1-9]\d{6,14}$/,ct="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dt=new RegExp(`^${ct}$`);function ut(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const lt=/^[^A-Z]*$/,ft=/^[^a-z]*$/,pt=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ht=G("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!se(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const s=je(r);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mt=G("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!se(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const s=je(r);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gt=G("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!se(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,s=r.length;if(s===t.length)return;const o=je(r),i=s>t.length;n.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yt=G("$ZodCheckStringFormat",(e,t)=>{var n,r;pt.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),vt=G("$ZodCheckRegex",(e,t)=>{yt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wt=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lt),yt.init(e,t)}),_t=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ft),yt.init(e,t)}),xt=G("$ZodCheckIncludes",(e,t)=>
1{pt.init(e,t);const n=ye(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),zt=G("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`^${ye(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bt=G("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`.*${ye(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),jt=G("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class kt{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const s of r)this.content.push(s)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const $t={major:4,minor:3,patch:5},Nt=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$t;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const t of s._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,s=_e(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(s)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new X;if(r||i instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(s||(s=_e(e,t)))});else{if(e.issues.length===t)continue;s||(s=_e(e,t))}}return r?r.then(()=>e):e},n=(n,s,o)=>{if(_e(n))return n.aborted=!0,n;const i=t(s,r,o);if(i instanceof Promise){if(!1===o.async)throw new X;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(s,o)=>{if(o.skipChecks)return e._zod.parse(s,o);if("backward"===o.direction){const t=e._zod.parse({value:s.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,s,o)):n(t,s,o)}const i=e._zod.parse(s,o);if(i instanceof Promise){if(!1===o.async)throw new X;return i.then(e=>t(e,r,o))}return t(i,r,o)}}ae(e,"~standard",()=>({validate:t=>{try{const n=Ae(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Ce(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ot=G("$ZodString",(e,t)=>{var n;Nt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(s){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),St=G("$ZodStringFormat",(e,t)=>{yt.init(e,t),Ot.init(e,t)}),Pt=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=He),St.init(e,t)}),Et=G("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Qe(e))}else t.pattern??(t.pattern=Qe());St.init(e,t)}),Zt=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=et),St.init(e,t)}),Tt=G("$ZodURL",(e,t)=>{St.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",n
1ote:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=s.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),At=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),St.init(e,t)}),It=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ge),St.init(e,t)}),Ct=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=We),St.init(e,t)}),Dt=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Be),St.init(e,t)}),Ut=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ye),St.init(e,t)}),Ft=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qe),St.init(e,t)}),Jt=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ke),St.init(e,t)}),Rt=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ut({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ct}T(?:${r})$`)}(t)),St.init(e,t)}),Lt=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=dt),St.init(e,t)}),Vt=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ut(t)}$`)),St.init(e,t)}),Mt=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xe),St.init(e,t)}),Wt=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tt),St.init(e,t),e._zod.bag.format="ipv4"}),Bt=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nt),St.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Yt=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rt),St.init(e,t)}),qt=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=st),St.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Kt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Gt=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ot),St.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Kt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const Xt=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=it),St.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!it.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Kt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ht=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=at),St.init(e,t)});const Qt=G("$ZodJWT",(e,t)=>{St.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&"JWT"!==s?.typ||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),en=G("$ZodUnknown",(e,t)=>{Nt.init(e,t),e._zod.parse=e=>e}),tn=G("$ZodNever",(e,t)=>{Nt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function nn(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}const rn=G("$ZodArray",(e,t)=>{Nt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let e=0;e<s.length;e++){const i=s[e],a=t.element._zod.run({value:i,issues:[]},r);a instanceof Promise?o.push(a.then(t=>nn(t,n,e))):nn(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});
1function sn(e,t,n,r,s){if(e.issues.length){if(s&&!(n in r))return;t.issues.push(...xe(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function on(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function an(e,t,n,r,s,o){const i=[],a=s.keySet,c=s.catchall._zod,d=c.def.type,u="optional"===c.optout;for(const l in t){if(a.has(l))continue;if("never"===d){i.push(l);continue}const s=c.run({value:t[l],issues:[]},r);s instanceof Promise?e.push(s.then(e=>sn(e,n,l,t,u))):sn(s,n,l,t,u)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const cn=G("$ZodObject",(e,t)=>{Nt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=re(()=>on(t));ae(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const s=fe,o=t.catchall;let i;e._zod.parse=(t,n)=>{i??(i=r.value);const a=t.value;if(!s(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],d=i.shape;for(const e of i.keys){const r=d[e],s="optional"===r._zod.optout,o=r._zod.run({value:a[e],issues:[]},n);o instanceof Promise?c.push(o.then(n=>sn(n,t,e,a,s))):sn(o,t,e,a,s)}return o?an(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),dn=G("$ZodObjectJIT",(e,t)=>{cn.init(e,t);const n=e._zod.parse,r=re(()=>on(t));let s;const o=fe,i=!Q.jitless,a=i&&pe.value,c=t.catchall;let d;e._zod.parse=(u,l)=>{d??(d=r.value);const f=u.value;return o(f)?i&&a&&!1===l?.async&&!0!==l.jitless?(s||(s=(e=>{const t=new kt(["shape","payload","ctx"]),n=r.value,s=e=>{const t=ue(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const r of n.keys)o[r]="key_"+i++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],i=ue(r),a=e[r],c="optional"===a?._zod?.optout;t.write(`const ${n} = ${s(r)};`),c?t.write(`\n if (${n}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),u=s(u,l),c?an([],f,u,l,d,e):u):n(u,l):(u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u)}});function un(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const s=e.filter(e=>!_e(e));return 1===s.length?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>be(e,r,ee())))}),t)}const ln=G("$ZodUnion",(e,t)=>{Nt.init(e,t),ae(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ae(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ae(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ae(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>oe(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(s,o)=>
1{if(n)return r(s,o);let i=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:s.value,issues:[]},o);if(t instanceof Promise)a.push(t),i=!0;else{if(0===t.issues.length)return t;a.push(t)}}return i?Promise.all(a).then(t=>un(t,s,e,o)):un(a,s,e,o)}}),fn=G("$ZodIntersection",(e,t)=>{Nt.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,s=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([t,n])=>hn(e,t,n)):hn(e,s,o)}});function pn(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(he(e)&&he(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),s={...e,...t};for(const o of r){const n=pn(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};s[o]=n.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=pn(e[r],t[r]);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hn(e,t,n){const r=new Map;let s;for(const a of t.issues)if("unrecognized_keys"===a.code){s??(s=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&s&&e.issues.push({...s,keys:o}),_e(e))return e;const i=pn(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const mn=G("$ZodEnum",(e,t)=>{Nt.init(e,t);const n=te(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>ge.has(typeof e)).map(e=>"string"==typeof e?ye(e):e.toString()).join("|")})$`),e._zod.parse=(t,s)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),gn=G("$ZodTransform",(e,t)=>{Nt.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new H(e.constructor.name);const s=t.transform(n.value,n);if(r.async){return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(n.value=e,n))}if(s instanceof Promise)throw new X;return n.value=s,n}});function yn(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const vn=G("$ZodOptional",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ae(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${oe(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yn(t,e.value)):yn(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),wn=G("$ZodExactOptional",(e,t)=>{vn.init(e,t),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),_n=G("$ZodNullable",(e,t)=>{Nt.init(e,t),ae(e._zod,"optin",()=>t.innerType._zod.optin),ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${oe(e.source)}|null)$`):void 0}),ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),xn=G("$ZodDefault",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zn(e,t)):zn(r,t)}});function zn(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const bn=G("$ZodPrefault",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),jn=G("$ZodNonOptional",(e,t)=>{Nt.init(e,t),ae(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(t=>kn(t,e)):kn(s,e)}});function kn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const $n=G("$ZodCatch",(e,t)=>{Nt.init(e,t),ae(e._zod,"optin",()=>t.innerType._zod.optin),ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>be(e,n,ee()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>be(e,n,ee()))},input:e.value}),e.issues=[]),e)}}),Nn=G("$ZodPipe",(e,t)=>{Nt.init(e,t),ae(e._zod,"values",()=>t.in._zod.values),ae(e._zod,"optin",()=>t.in._zod.optin),ae(e._zod,"optout",()=>t.out._zod.optout),ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>On(e,t.in,n)):On(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>On(e,t.out,n)):On(r,t.out,n)}});function On(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Sn=G("$ZodReadonly",(e,t)=>{Nt.init(e,t),ae(e._zod,"propValues",()=>t.innerType._zod.propValues),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"optin",()=>t.innerType?._zod?.optin),ae(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Pn):Pn(r)}});function Pn(e){return e.value=Object.freeze(e.value),e}const En=G("$ZodCustom",(e,t)=>
vendor: 4,291 bytes, line 1
1{pt.init(e,t),Nt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(t=>Zn(t,n,r,e));Zn(s,n,r,e)}});function Zn(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ke(e))}}var Tn;class An{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(Tn=globalThis).__zod_globalRegistry??(Tn.__zod_globalRegistry=new An);const In=globalThis.__zod_globalRegistry;function Cn(e,t){return new e({type:"string",...we(t)})}function Dn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...we(t)})}function Un(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...we(t)})}function Fn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...we(t)})}function Jn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...we(t)})}function Rn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...we(t)})}function Ln(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...we(t)})}function Vn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...we(t)})}function Mn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...we(t)})}function Wn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...we(t)})}function Bn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...we(t)})}function Yn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...we(t)})}function qn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...we(t)})}function Kn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...we(t)})}function Gn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...we(t)})}function Xn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...we(t)})}function Hn(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...we(t)})}function Qn(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...we(t)})}function er(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...we(t)})}function tr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...we(t)})}function nr(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...we(t)})}function rr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...we(t)})}function sr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...we(t)})}function or(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...we(t)})}function ir(e,t){return new e({type:"string",format:"date",check:"string_format",...we(t)})}function ar(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...we(t)})}function cr(e,t){return new e({type:"string",format:"duration",check:"string_format",...we(t)})}function dr(e){return new e({type:"unknown"})}function ur(e,t){return new e({type:"never",...we(t)})}function lr(e,t){return new ht({check:"max_length",...we(t),maximum:e})}function fr(e,t){return new mt({check:"min_length",...we(t),minimum:e})}function pr(e,t){return new gt({check:"length_equals",...we(t),length:e})}function hr(e,t){return new vt({check:"string_format",format:"regex",...we(t),pattern:e})}function mr(e){return new wt({check:"string_format",format:"lowercase",...we(e)})}
vendor: 4,988 bytes, line 1
1function gr(e){return new _t({check:"string_format",format:"uppercase",...we(e)})}function yr(e,t){return new xt({check:"string_format",format:"includes",...we(t),includes:e})}function vr(e,t){return new zt({check:"string_format",format:"starts_with",...we(t),prefix:e})}function wr(e,t){return new bt({check:"string_format",format:"ends_with",...we(t),suffix:e})}function _r(e){return new jt({check:"overwrite",tx:e})}function xr(e){return _r(t=>t.normalize(e))}function zr(){return _r(e=>e.trim())}function br(){return _r(e=>e.toLowerCase())}function jr(){return _r(e=>e.toUpperCase())}function kr(){return _r(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))}function $r(e,t,n){return new e({type:"array",element:t,...we(n)})}function Nr(e,t,n){return new e({type:"custom",check:"custom",fn:t,...we(n)})}function Or(e){const t=Sr(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(ke(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ke(r))}},e(n.value,n)));return t}function Sr(e,t){const n=new pt({check:"custom",...we(t)});return n._zod.check=e,n}function Pr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??In,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 Er(e,t,n={path:[],schemaPath:[]}){var r;const s=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,r);else{const n=i.schema,o=t.processors[s.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),Er(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(i.schema,c),"input"===t.io&&Ar(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function Zr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,o[0])}}const s=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:s,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,s=e.external.uri??(e=>e);if(n)return{ref:s(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${s("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const s=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:s+o}})(t);r.def={...r.schema},o&&(r.defId=o);const i=r.schema;for(const e in i)delete i[e];i.$ref=s};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const n=o[1];if(t===o[0]){s(o);continue}if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){s(o);continue}}const r=e.metadataRegistry.get(o[0])?.id;r?s(o):(n.cycle||n.count>1&&"ref"===e.reused)&&s(o)}}function Tr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const s=n.def??n.schema,o={...s},i=n.ref;if(n.ref=null,i){r(i);const n=e.seen.get(i),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(s,a):(s.allOf=s.allOf??[],s.allOf.push(a)),Object.assign(s,o);if(t._zod.parent===i)for(const e in s)"$ref"!==e&&"allOf"!==e&&(e in o||delete s[e]);if(a.$ref)for(const e in s)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(s[e])===JSON.stringify(n.def[e])&&delete s[e]}const a=t._zod.parent;if(a&&a!==i){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(s.$ref=t.schema.$ref,t.def))for(const e in s)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(s[e])===JSON.stringify(t.def[e])&&delete s[e]}e.override({zodSchema:t,jsonSchema:s,path:n.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const s={};
1if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(n)}Object.assign(s,n.def??n.schema);const o=e.external?.defs??{};for(const a of e.seen.entries()){const e=a[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?s.$defs=o:s.definitions=o);try{const n=JSON.parse(JSON.stringify(s));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ir(t,"input",e.processors),output:Ir(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(i){throw new Error("Error converting schema to JSON.")}}function Ar(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Ar(r.element,n);if("set"===r.type)return Ar(r.valueType,n);if("lazy"===r.type)return Ar(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return Ar(r.innerType,n);if("intersection"===r.type)return Ar(r.left,n)||Ar(r.right,n);if("record"===r.type||"map"===r.type)return Ar(r.keyType,n)||Ar(r.valueType,n);if("pipe"===r.type)return Ar(r.in,n)||Ar(r.out,n);if("object"===r.type){for(const e in r.shape)if(Ar(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Ar(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Ar(e,n))return!0;return!(!r.rest||!Ar(r.rest,n))}return!1}const Ir=(e,t,n={})=>r=>{const{libraryOptions:s,target:o}=r??{},i=Pr({...s??{},target:o,io:t,processors:n});return Er(e,i),Zr(i,e),Tr(i,e)},Cr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dr=(e,t,n,r)=>{const s=e._zod.def;Er(s.innerType,t,r);t.seen.get(e).ref=s.innerType};function Ur(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function Fr(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[i].types,d=c&&c[r.code];n[i]=h(i,t,n,s,d?[].concat(d,r.message):r.message)}e.shift()}return n}function Jr(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("invalid_union"===r.code&&r.errors.length>0){var a=r.errors[0][0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if("invalid_union"===r.code&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=n[i].types,d=c&&c[r.code];n[i]=h(i,t,n,s,d?[].concat(d,r.message):r.message)}e.shift()}return n}function Rr(e,t,n){if(void 0===n&&(n={}),"_def"in(r=e)&&"object"==typeof r._def&&"typeName"in r._def)return function(s,o,i){try{return Promise.resolve(Ur(function(){return Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](s,t)).then(function(e){return i.shouldUseNativeValidation&&B({},i),{errors:{},values:n.raw?Object.assign({},s):e}})},function(e){if(t=e,Array.isArray(null==t?void 0:t.issues))return{values:{},errors:Y(Fr(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e}))}catch(r){return Promise.reject(r)}};var r;if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(s,o,i){try{return Promise.resolve(Ur(function(){return Promise.resolve(("sync"===n.mode?Pe:Ze)(e,s,t)).then(function(e){return i.shouldUseNativeValidation&&B({},i),{errors:{},values:n.raw?Object.assign({},s):e}})},function(e){if(e instanceof Ne)return{values:{},errors:Y(Jr(e.issues,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}const Lr=G("ZodISODateTime",(e,t)=>{Rt.init(e,t),ds.init(e,t)});const Vr=G("ZodISODate",(e,t)=>{Lt.init(e,t),ds.init(e,t)});const Mr=G("ZodISOTime",(e,t)=>{Vt.init(e,t),ds.init(e,t)});const Wr=G("ZodISODuration",(e,t)=>{Mt.init(e,t),ds.init(e,t)});const Br=G("ZodError",(e,t)=>{Ne.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>
1{for(const s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>r({issues:e}));else if("invalid_key"===s.code)r({issues:s.issues});else if("invalid_element"===s.code)r({issues:s.issues});else if(0===s.path.length)n._errors.push(t(s));else{let e=n,r=0;for(;r<s.path.length;){const n=s.path[r];r===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ne,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ne,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Yr=Se(Br),qr=Ee(Br),Kr=Te(Br),Gr=Ie(Br),Xr=De(Br),Hr=Ue(Br),Qr=Fe(Br),es=Je(Br),ts=Re(Br),ns=Le(Br),rs=Ve(Br),ss=Me(Br),os=G("ZodType",(e,t)=>(Nt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ir(e,"input"),output:Ir(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Pr({...n,processors:t});return Er(e,r),Zr(r,e),Tr(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(de(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>ve(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Yr(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Kr(e,t,n),e.parseAsync=async(t,n)=>qr(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Gr(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Xr(e,t,n),e.decode=(t,n)=>Hr(e,t,n),e.encodeAsync=async(t,n)=>Qr(e,t,n),e.decodeAsync=async(t,n)=>es(e,t,n),e.safeEncode=(t,n)=>ts(e,t,n),e.safeDecode=(t,n)=>ns(e,t,n),e.safeEncodeAsync=async(t,n)=>rs(e,t,n),e.safeDecodeAsync=async(t,n)=>ss(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return Nr(Gs,e,t)}(t,n)),e.superRefine=t=>e.check(Or(t)),e.overwrite=t=>e.check(_r(t)),e.optional=()=>Fs(e),e.exactOptional=()=>new Js({type:"optional",innerType:e}),e.nullable=()=>Ls(e),e.nullish=()=>Fs(Ls(e)),e.nonoptional=t=>function(e,t){return new Ws({type:"nonoptional",innerType:e,...we(t)})}(e,t),e.array=()=>{return $r(Zs,e,t);var t},e.or=t=>{return new As({type:"union",options:[e,t],...we(n)});var n},e.and=t=>new Is({type:"intersection",left:e,right:t}),e.transform=t=>qs(e,new Ds({type:"transform",transform:t})),e.default=t=>{return n=t,new Vs({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():me(n)}});var n},e.prefault=t=>{return n=t,new Ms({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():me(n)}});var n},e.catch=t=>{return new Bs({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>qs(e,t),e.readonly=()=>new Ks({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return In.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>In.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return In.get(e);const n=e.clone();return In.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),is=G("_ZodString",(e,t)=>{Ot.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:s,maximum:o,format:i,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof s&&(r.minLength=s),"number"==typeof o&&(r.maxLength=o),i&&(r.format=Cr[i]??i,""===r.format&&delete r.format,"time"===i&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(hr(...t)),e.includes=(...t)=>e.check(yr(...t)),e.startsWith=(...t)=>e.check(vr(...t)),e.endsWith=(...t)=>e.check(wr(...t)),e.min=(...t)=>e.check(fr(...t)),e.max=(...t)=>e.check(lr(...t)),e.length=(...t)=>e.check(pr(...t)),e.nonempty=(...t)=>e.check(fr(1,...t)),e.lowercase=t=>e.check(mr(t)),e.uppercase=t=>e.check(gr(t)),e.trim=()=>e.check(zr()),e.normalize=(...t)=>e.check(xr(...t)),e.toLowerCase=()=>e.check(br()),e.toUpperCase=()=>e.check(jr()),e.slugify=()=>e.check(kr())}),as=G("ZodString",(e,t)=>{Ot.init(e,t),is.init(e,t),e.email=t=>e.check(Dn(us,t)),e.url=t=>e.check(Vn(ps,t)),e.jwt=t=>e.check(sr(Os,t)),e.emoji=t=>e.check(Mn(hs,t)),e.guid=t=>e.check(Un(ls,t)),e.uuid=t=>e.check(Fn(fs,t)),e.uuidv4=t=>e.check(Jn(fs,t)),e.uuidv6=t=>e.check(Rn(fs,t)),e.uuidv7=t=>e.check(Ln(fs,t)),e.nanoid=t=>e.check(Wn(ms,t)),e.guid=t=>e.check(Un(ls,t)),e.cuid=t=>e.check(Bn(gs,t)),e.cuid2=t=>e.check(Yn(ys,t)),e.ulid=t=>e.check(qn(vs,t)),e.base64=t=>e.check(tr(ks,t)),e.base64url=t=>e.check(nr($s,t)),e.xid=t=>e.check(Kn(ws,t)),e.ksuid=t=>e.check(Gn(_s,t)),e.ipv4=t=>e.check(Xn(xs,t)),e.ipv6=t=>e.check(Hn(zs,t)),e.cidrv4=t=>e.check(Qn(bs,t)),e.cidrv6=t=>e.check(er(js,t)),e.e164=t=>e.check(rr(Ns,t)),e.datetime=t=>e.check(function(e){return or(Lr,e)}(t)),e.date=t=>e.check(function(e){return ir(Vr,e)}(t)),e.time=t=>e.check(function(e){return ar(Mr,e)}(t)),e.duration=t=>e.check(function(e){return cr(Wr,e)}(t))});function cs(e){return Cn(as,e)}const ds=G("ZodStringFormat",(e,t)=>{St.init(e,t),is.init(e,t)}),us=G("ZodEmail",(e,t)=>{Zt.init(e,t),ds.init(e,t)}),ls=G("ZodGUID",(e,t)=>{Pt.init(e,t),ds.init(e,t)}),fs=G("ZodUUID",(e,t)=>{Et.init(e,t),ds.init(e,t)}),ps=G("ZodURL",(e,t)=>{Tt.init(e,t),ds.init(e,t)}),hs=G("ZodEmoji",(e,t)=>{At.init(e,t),ds.init(e,t)}),ms=G("ZodNanoID",(e,t)=>{It.init(e,t),ds.init(e,t)}),gs=G("ZodCUID",(e,t)=>{Ct.init(e,t),ds.init(e,t)}),ys=G("ZodCUID2",(e,t)=>{Dt.init(e,t),ds.init(e,t)}
1),vs=G("ZodULID",(e,t)=>{Ut.init(e,t),ds.init(e,t)}),ws=G("ZodXID",(e,t)=>{Ft.init(e,t),ds.init(e,t)}),_s=G("ZodKSUID",(e,t)=>{Jt.init(e,t),ds.init(e,t)}),xs=G("ZodIPv4",(e,t)=>{Wt.init(e,t),ds.init(e,t)}),zs=G("ZodIPv6",(e,t)=>{Bt.init(e,t),ds.init(e,t)}),bs=G("ZodCIDRv4",(e,t)=>{Yt.init(e,t),ds.init(e,t)}),js=G("ZodCIDRv6",(e,t)=>{qt.init(e,t),ds.init(e,t)}),ks=G("ZodBase64",(e,t)=>{Gt.init(e,t),ds.init(e,t)}),$s=G("ZodBase64URL",(e,t)=>{Xt.init(e,t),ds.init(e,t)}),Ns=G("ZodE164",(e,t)=>{Ht.init(e,t),ds.init(e,t)}),Os=G("ZodJWT",(e,t)=>{Qt.init(e,t),ds.init(e,t)}),Ss=G("ZodUnknown",(e,t)=>{en.init(e,t),os.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Ps(){return dr(Ss)}const Es=G("ZodNever",(e,t)=>{tn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const Zs=G("ZodArray",(e,t)=>{rn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=n,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;"number"==typeof i&&(s.minItems=i),"number"==typeof a&&(s.maxItems=a),s.type="array",s.items=Er(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(fr(t,n)),e.nonempty=t=>e.check(fr(1,t)),e.max=(t,n)=>e.check(lr(t,n)),e.length=(t,n)=>e.check(pr(t,n)),e.unwrap=()=>e.element});const Ts=G("ZodObject",(e,t)=>{dn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=n,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const d in i)s.properties[d]=Er(i[d],t,{...r,path:[...r.path,"properties",d]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(s.required=Array.from(c)),"never"===o.catchall?._zod.def.type?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Er(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(s.additionalProperties=!1)})(e,t,n,r),ae(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Cs({type:"enum",entries:n,...we(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ps()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ps()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:ur(Es,t)});var t},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!he(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=de(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ce(this,"shape",n),n}});return ve(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!he(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=de(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ce(this,"shape",n),n}});return ve(e,n)}(e,t),e.merge=t=>function(e,t){const n=de(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ce(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ve(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ve(e,de(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ce(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=de(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ce(this,"shape",r),r},checks:[]});return ve(e,s)}(e,t),e.partial=(...t)=>function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=de(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)s[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return ce(this,"shape",s),s},checks:[]});return ve(t,s)}(Us,e,t[0]),e.required=(...t)=>function(e,t,n){const r=de(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const t in n){if(!(t in s))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)s[t]=new e({type:"nonoptional",innerType:r[t]});return ce(this,"shape",s),s}});return ve(t,r)}(Ws,e,t[0])});const As=G("ZodUnion",(e,t)=>{ln.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def,o=!1===s.inclusive,i=s.options.map((e,n)=>Er(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=i:n.anyOf=i})(e,t,n,r),e.options=t.options});const Is=G("ZodIntersection",(e,t)=>{fn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def,o=Er(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=Er(s.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];n.allOf=c})(e,t,n,r)});const Cs=G("ZodEnum",(e,t)=>{mn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=te(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const s={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);s[o]=t.entries[o]}return new Cs({...t,checks:[],...we(r),entries:s})},e.exclude=(e,r)=>{const s={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete s[t]}return new Cs({...t,checks:[],...we(r),entries:s})}});const Ds=G("ZodTransform",(e,t)=>{gn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new H(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ke(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ke(t))}};
1const s=t.transform(n.value,n);return s instanceof Promise?s.then(e=>(n.value=e,n)):(n.value=s,n)}});const Us=G("ZodOptional",(e,t)=>{vn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e){return new Us({type:"optional",innerType:e})}const Js=G("ZodExactOptional",(e,t)=>{wn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const Rs=G("ZodNullable",(e,t)=>{_n.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def,o=Er(s.innerType,t,r),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ls(e){return new Rs({type:"nullable",innerType:e})}const Vs=G("ZodDefault",(e,t)=>{xn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def;Er(s.innerType,t,r),t.seen.get(e).ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Ms=G("ZodPrefault",(e,t)=>{bn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def;Er(s.innerType,t,r),t.seen.get(e).ref=s.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Ws=G("ZodNonOptional",(e,t)=>{jn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def;Er(s.innerType,t,r),t.seen.get(e).ref=s.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const Bs=G("ZodCatch",(e,t)=>{$n.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def;let o;Er(s.innerType,t,r),t.seen.get(e).ref=s.innerType;try{o=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Ys=G("ZodPipe",(e,t)=>{Nn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def,o="input"===t.io?"transform"===s.in._zod.def.type?s.out:s.in:s.out;Er(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function qs(e,t){return new Ys({type:"pipe",in:e,out:t})}const Ks=G("ZodReadonly",(e,t)=>{Sn.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const s=e._zod.def;Er(s.innerType,t,r),t.seen.get(e).ref=s.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Gs=G("ZodCustom",(e,t)=>{En.init(e,t),os.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function Xs(){const{t:f}=g("settings"),{t:p}=g("common"),{user:h}=R(),{signOut:W}=L(),B=u(),Y=y(),q=v(),{consent:K,consentTimestamp:G}=w(),[X,H]=l.useState(!1),Q=function(e,t){const n={type:"object",shape:e??{},...we(t)};return new Ts(n)}({currentPassword:cs().min(1,f("security.currentPasswordLabel")),newPassword:cs().min(8,f("security.newPasswordLabel")),confirmPassword:cs().min(1,f("security.confirmPasswordLabel"))}).refine(e=>e.newPassword===e.confirmPassword,{message:f("security.updatePasswordSuccess"),path:["confirmPassword"]}),[ee,te]=l.useState(!1),[ne,re]=l.useState(!1),[se,oe]=l.useState(null),[ie,ae]=l.useState(!1),[ce,de]=l.useState(""),[ue,le]=l.useState(!1),[fe,pe]=l.useState(null),[he,me]=l.useState(!1),{register:ge,handleSubmit:ye,formState:{errors:ve},reset:_e}=_({resolver:Rr(Q)}),xe=e=>{(async()=>{te(!0),oe(null),re(!1);try{if(!h)throw new Error("User not found");if(!h.passwordEnabled)throw new Error("Password authentication is not enabled for your account. You may have signed in with Google or another OAuth provider.");await h.updatePassword({currentPassword:e.currentPassword,newPassword:e.newPassword}),re(!0),_e(),m.info("Password changed successfully"),setTimeout(()=>re(!1),5e3)}catch(t){let e="Failed to change password";const n=t;if(n.errors&&n.errors[0]){const t=n.errors[0];e=t.message||t.longMessage||e,"form_password_incorrect"===t.code?e="Current password is incorrect":"form_password_pwned"===t.code?e="This password has been found in a data breach and cannot be used":"form_password_too_common"===t.code?e="This password is too common. Please choose a stronger password":"Reverification required"!==t.message&&"reverification_required"!==t.code||(e="For security reasons, please sign out and sign back in before changing your password. This helps ensure it's really you making this change.")}else n.message&&(e=n.message.includes("Reverification required")||n.message.includes("reverification")?"For security reasons, please sign out and sign back in before changing your password. This helps ensure it's really you making this change.":n.message);oe(e),m.error("Password change failed",t instanceof Error?t:new Error(String(t)))}finally{te(!1)}})()},ze=e=>{if(!e)return"Unknown";try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return"Unknown"}};return e.jsxs(V,{children:[e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:f("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:f("profile.title")})]}),e.jsxs(x,{className:"border",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg",children:f("sections.profile")}),e.jsx(j,{children:f("profile.title")})]}),e.jsx(t,{className:"h-5 w-5 text-muted-foreground"})]})}),e.jsxs(k,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"email",children:f("profile.emailLabel")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{id:"email",type:"email",value:h?.primaryEmailAddress?.emailAddress||"",disabled:!0,className:"bg-muted"}),"verified"===h?.primaryEmailAddress?.verification.status&&e.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap text-xs text-muted-foreground",children:[e.jsx(n,{className:"h-3 w-3 text-green-600"}),"Verified"]})]})]}),e.jsx(O,{}),e.jsxs("div",{className:"grid gap-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Account created"}),e.jsx("span",{className:"font-medium",children:ze(h?.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last login"}),e.jsx("span",{className:"font-medium",children:ze(h?.lastSignInAt)})]})]})]})]}),e.jsxs(x,{className:"border",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg",children:"Language & Region"}),e.jsx(j,{children:"Choose your preferred language for the interface"})]}),e.jsx(r,{className:"h-5 w-5 text-muted-foreground"})]})}),e.jsx(k,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"language",children:"Display Language"}),e.jsx(M,{className:"w-full sm:w-[300px]"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The language will change immediately and be saved to your account."})]})})]}),h?.passwordEnabled&&e.jsxs(x,{className:"border",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg",children:"Change Password"}),e.jsx(j,{children:"Update your password to keep your account secure"})]}),e.jsx(s,{className:"h-5 w-5 text-muted-foreground"})]})}),e.jsxs("form",{onSubmit:e=>{ye(xe)(e)},children:[e.jsxs(k,{className:"space-y-4",children:[ne&&e.jsxs(S,{className:"border-green-600 bg-green-50 text-green-900 dark:border-green-500 dark:bg-green-900/20 dark:text-green-100",children:[e.jsx(n,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),e.jsx(P,{children:"Password changed successfully"}),e.jsx(E,{children:"Your password has been updated. Please use your new password on your next login."})]}),se&&e.jsxs(S,{variant:"destructive",children:[e.jsx(o,{className:"h-4 w-4"}),e.jsx(P,{children:"Failed to change password"}),e.jsx(E,{children:se})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"currentPassword",children:"Current Password"}),e.jsx(N,{id:"currentPassword",type:"password",...ge("currentPassword"),disabled:ee}),ve.currentPassword&&e.jsx("p",{className:"text-sm text-destructive",children:ve.currentPassword.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"newPassword",children:"New Password"}),e.jsx(N,{id:"newPassword",type:"password",...ge("newPassword"),disabled:ee}),ve.newPassword&&e.jsx("p",{className:"text-sm text-destructive",children:ve.newPassword.message}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Must be at least 8 characters with 1 uppercase letter and 1 number"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"confirmPassword",children:"Confirm New Password"}),e.jsx(N,{id:"confirmPassword",type:"password",...ge("confirmPassword"),disabled:ee}),ve.confirmPassword&&e.jsx("p",{className:"text-sm text-destructive",children:ve.confirmPassword.message})]})]}),e.jsx(Z,{children:e.jsxs(T,{type:"submit",disabled:ee,children:[ee&&e.jsx(i,{className:"mr-2 h-4 w-4 animate-spin"}),"Change Password"]})})]})]}),e.jsxs(x,{className:"border",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg",children:"Export Your Data"}),e.jsx(j,{children:"Download a copy of all your data (GDPR Article 20 - Right to Data Portability)"})]}),e.jsx(a,{className:"h-5 w-5 text-muted-foreground"})]})}),e.jsxs(k,{children:[e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Export all your transformations, favorites, and account information in JSON format."}),e.jsxs(T,{variant:"outline",onClick:()=>{(async()=>{me(!0);try{if(!Y)throw new Error("No data available to export. Please try again.");const e=(new Date).toISOString().split("T")[0];!function(e,t="tonesmith-data-export.json"){try{const n=JSON.stringify(e,null,2),r=new Blob([n],{type:"application/json"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s),m.info("User data downloaded",{filename:t})}catch(n){throw m.error("Error downloading user data",n instanceof Error?n:void 0),n}}(Y,`tonesmith-data-export-${e}.json`),m.info("User data exported successfully")}catch(e){m.error("Error exporting data",e instanceof Error?e:new Error(String(e))),alert(e instanceof Error?e.message:"Failed to export data. Please try again.")}finally{me(!1)}})()},disabled:he,children:[he&&e.jsx(i,{className:"mr-2 h-4 w-4 animate-spin"}),he?"Exporting...":"Export Data"]})]})]}),e.jsxs(x,{className:"border",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg",children:p("cookies.settings.title")}),e.jsx(j,{children:p("cookies.settings.description")})]}),e.jsx(c,{className:"h-5 w-5 text-muted-foreground"})]})}),e.jsxs(k,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:p("cookies.categories.analytics.title")}),e.jsx("span",{className:"font-medium",children:K.analytics?p("cookies.settings.enabled"):p("cookies.settings.disabled")})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:p("cookies.categories.marketing.title")}),e.jsx("span",{className:"font-medium",children:K.marketing?p("cookies.settings.enabled"):p("cookies.settings.disabled")})]}),G&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:p("cookies.settings.lastUpdated")}),e.jsx("span",{className:"font-medium",children:ze(G)}
1)]})]}),e.jsx(T,{variant:"outline",onClick:()=>H(!0),children:p("cookies.settings.manage")})]})]}),e.jsxs(x,{className:"border border-destructive",children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-lg text-destructive",children:"Danger Zone"}),e.jsx(j,{children:"Permanent actions that cannot be undone"})]}),e.jsx(d,{className:"h-5 w-5 text-destructive"})]})}),e.jsx(k,{children:e.jsxs("div",{className:"rounded-lg border border-destructive/50 bg-destructive/5 p-4",children:[e.jsx("h4",{className:"mb-2 font-semibold text-destructive",children:"Delete Account"}),e.jsx("p",{className:"mb-4 text-sm leading-relaxed text-muted-foreground",children:"Once you delete your account, there is no going back. This will permanently delete your profile, transformations, and all associated data."}),e.jsxs(T,{variant:"destructive",onClick:()=>{ae(!0),de(""),pe(null)},children:[e.jsx(d,{className:"mr-2 h-4 w-4"}),"Delete Account"]})]})})]})]}),e.jsx(A,{open:ie,onOpenChange:ae,children:e.jsxs(I,{className:"max-w-md",children:[e.jsxs(C,{children:[e.jsx(D,{className:"text-destructive",children:"Delete Account Permanently?"}),e.jsxs(U,{children:["This action ",e.jsx("strong",{children:"cannot be undone"}),". This will permanently delete your account and remove all your data from our servers."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-destructive/10 rounded-lg p-4",children:[e.jsx("p",{className:"mb-2 text-sm font-semibold",children:"The following data will be deleted:"}),e.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Your profile and account information"}),e.jsx("li",{children:"All transformation history (including favorites)"}),e.jsx("li",{children:"Subscription data"}),e.jsx("li",{children:"Usage records"}),e.jsx("li",{children:"Stripe customer data"}),e.jsx("li",{children:"Audit logs (anonymized for compliance)"})]})]}),fe&&e.jsxs(S,{variant:"destructive",children:[e.jsx(o,{className:"h-4 w-4"}),e.jsx(P,{children:"Deletion Failed"}),e.jsx(E,{children:fe})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs($,{htmlFor:"delete-confirmation",children:["Type ",e.jsx("strong",{children:"DELETE"})," to confirm"]}),e.jsx(N,{id:"delete-confirmation",type:"text",placeholder:"DELETE",value:ce,onChange:e=>de(e.target.value),disabled:ue,className:"font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This confirms you understand this action is permanent and irreversible."})]})]}),e.jsxs(F,{className:"flex-col gap-2 sm:flex-row",children:[e.jsx(T,{variant:"outline",onClick:()=>{ae(!1),de(""),pe(null)},disabled:ue,className:"w-full sm:w-auto",children:"Cancel"}),e.jsxs(T,{variant:"destructive",onClick:()=>{(async()=>{if("DELETE"===ce){le(!0),pe(null);try{m.info("Initiating account deletion");const t=await q();if(m.info("Convex data deleted successfully",{deleted:t.deleted}),h)try{await h.delete(),m.info("Clerk account deleted successfully")}catch(e){m.error("Failed to delete Clerk account",e instanceof Error?e:void 0)}m.info("Account deletion completed"),await W(),B("/",{replace:!0,state:{message:"Your account has been permanently deleted. Thank you for using ToneSmith."}})}catch(t){const e=t instanceof Error?t.message:"An unexpected error occurred";pe(e),m.error("Account deletion error",t instanceof Error?t:new Error(String(t)))}finally{le(!1)}}else pe("Please type DELETE to confirm")})()}
1,disabled:ue||"DELETE"!==ce,className:"w-full sm:w-auto",children:[ue&&e.jsx(i,{className:"mr-2 h-4 w-4 animate-spin"}),ue?"Deleting...":"Delete My Account Permanently"]})]})]})}),e.jsx(J,{open:X,onOpenChange:H})]})}export{Xs as SettingsPage}; 2//# sourceMappingURL=SettingsPage-CzUiLtb-.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.