@genspectrum/dashboard-components 1.11.1 → 1.12.0

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.
@@ -4032,7 +4032,8 @@ Fc(
4032
4032
  coverage: T.number()
4033
4033
  })
4034
4034
  )
4035
- )
4035
+ ),
4036
+ totalCountsByDateRange: T.array(T.number())
4036
4037
  })
4037
4038
  );
4038
4039
  const f2 = T.object({
@@ -25970,7 +25971,7 @@ fo([
25970
25971
  vr = fo([
25971
25972
  an("gs-number-sequences-over-time")
25972
25973
  ], vr);
25973
- const mk = '(function(){"use strict";var k;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`\'${i}\'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(k||(k={}));var et;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),B=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},d=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),yr=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class E extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof E))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}E.create=r=>new E(r);const de=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received \'${r.received}\'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}};let vt=de;function gr(r){vt=r}function We(){return vt}const Ve=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},vr=[];function f(r,e){const t=We(),n=Ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===de?void 0:de].filter(s=>!!s)});r.common.issues.push(n)}class N{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return N.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),le=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),tt=r=>r.status==="aborted",rt=r=>r.status==="dirty",te=r=>r.status==="valid",we=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class V{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const _t=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new E(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return B(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(we(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parseSync({data:e,path:n.path,parent:n});return _t(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return te(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>te(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(we(s)?s:Promise.resolve(s));return _t(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Y({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return L.create(this,this._def)}nullable(){return ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this)}promise(){return pe.create(this,this._def)}or(e){return $e.create([this,e],this._def)}and(e){return Me.create(this,e,this._def)}transform(e){return new Y({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ee({..._(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new at({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({..._(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _r=/^c[^\\s-]{8,}$/i,xr=/^[0-9a-z]+$/,kr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,br=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,wr=/^[a-z0-9_-]{21}$/i,Sr=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Tr=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Ar=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,$r="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let nt;const Mr=/^(?:(?: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])$/,Dr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Or=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Er=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xt="((\\\\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])))",Cr=new RegExp(`^${xt}$`);function kt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);const t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Ir(r){return new RegExp(`^${kt(r)}$`)}function bt(r){let e=`${xt}T${kt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Zr(r,e){return!!((e==="v4"||!e)&&Mr.test(r)||(e==="v6"||!e)&&Or.test(r))}function jr(r,e){if(!Sr.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Yr(r,e){return!!((e==="v4"||!e)&&Dr.test(r)||(e==="v6"||!e)&&Nr.test(r))}class Z extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),y}const n=new N;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ar.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")nt||(nt=new RegExp($r,"u")),nt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")br.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")wr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")_r.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")xr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")kr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?bt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Cr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Ir(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Tr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Zr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?jr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Yr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Rr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Er.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):k.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...p.errToObj(n)})}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new Z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Z.create=r=>new Z({checks:[],typeName:g.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function Fr(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class K extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),y}let n;const s=new N;for(const a of this._def.checks)a.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Fr(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_finite,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}K.create=r=>new K({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class Q extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const s=new N;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Q.create=r=>new Q({checks:[],typeName:g.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class Se extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),y}return R(e.data)}}Se.create=r=>new Se({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class re extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}const n=new N;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):k.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}re.create=r=>new re({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,..._(r)});class ze extends x{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),y}return R(e.data)}}ze.create=r=>new ze({typeName:g.ZodSymbol,..._(r)});class Te extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),y}return R(e.data)}}Te.create=r=>new Te({typeName:g.ZodUndefined,..._(r)});class Ae extends x{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),y}return R(e.data)}}Ae.create=r=>new Ae({typeName:g.ZodNull,..._(r)});class he extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}he.create=r=>new he({typeName:g.ZodAny,..._(r)});class ne extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}ne.create=r=>new ne({typeName:g.ZodUnknown,..._(r)});class H extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),y}}H.create=r=>new H({typeName:g.ZodNever,..._(r)});class Le extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),y}return R(e.data)}}Le.create=r=>new Le({typeName:g.ZodVoid,..._(r)});class j extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return f(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(f(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(f(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new V(t,i,t.path,o)))).then(i=>N.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new V(t,i,t.path,o)));return N.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new j({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new j({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new j({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}j.create=(r,e)=>new j({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});function fe(r){if(r instanceof A){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=L.create(fe(n))}return new A({...r._def,shape:()=>e})}else return r instanceof j?new j({...r._def,type:fe(r.element)}):r instanceof L?L.create(fe(r.unwrap())):r instanceof ee?ee.create(fe(r.unwrap())):r instanceof z?z.create(r.items.map(e=>fe(e))):r}class A extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof H&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const h=a[u],v=s.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new V(s,v,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof H){const u=this._def.unknownKeys;if(u==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(u==="strict")o.length>0&&(f(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const h of o){const v=s.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new V(s,v,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const h of c){const v=await h.key,S=await h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u}).then(u=>N.mergeObjectSync(n,u)):N.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of k.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of k.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return fe(this)}partial(e){const t={};for(const n of k.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of k.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof L;)a=a._def.innerType;t[n]=a}return new A({...this._def,shape:()=>t})}keyof(){return wt(k.objectKeys(this.shape))}}A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:H.create(),typeName:g.ZodObject,..._(e)}),A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:H.create(),typeName:g.ZodObject,..._(e)}),A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:H.create(),typeName:g.ZodObject,..._(e)});class $e extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new E(o.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const u={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new E(c));return f(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}$e.create=(r,e)=>new $e({options:r,typeName:g.ZodUnion,..._(e)});const q=r=>r instanceof Oe?q(r.schema):r instanceof Y?q(r.innerType()):r instanceof Ne?[r.value]:r instanceof X?r.options:r instanceof Re?k.objectValues(r.enum):r instanceof Ee?q(r._def.innerType):r instanceof Te?[void 0]:r instanceof Ae?[null]:r instanceof L?[void 0,...q(r.unwrap())]:r instanceof ee?[null,...q(r.unwrap())]:r instanceof at||r instanceof Ze?q(r.unwrap()):r instanceof Ce?q(r._def.innerType):[];class Ue extends x{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:d.invalid_type,expected:m.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Ue({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function st(r,e){const t=B(r),n=B(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){const s=k.objectKeys(e),a=k.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=st(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=st(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Me extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(tt(a)||tt(i))return y;const o=st(a.value,i.value);return o.valid?((rt(a)||rt(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:d.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Me.create=(r,e,t)=>new Me({left:r,right:e,typeName:g.ZodIntersection,..._(t)});class z extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return f(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new V(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>N.mergeArray(t,i)):N.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:r,typeName:g.ZodTuple,rest:null,..._(e)})};class De extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return f(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new V(n,o,n.path,o)),value:i._parse(new V(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?N.mergeObjectAsync(t,s):N.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new De({keyType:e,valueType:t,typeName:g.ZodRecord,..._(n)}):new De({keyType:Z.create(),valueType:e,typeName:g.ZodRecord,..._(t)})}}class Be extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return f(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new V(n,o,n.path,[u,"key"])),value:a._parse(new V(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,h=await c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}}Be.create=(r,e,t)=>new Be({valueType:e,keyType:r,typeName:g.ZodMap,..._(t)});class se extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(f(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new V(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new se({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(r,e)=>new se({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});class me extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),y;function n(o,c){return Ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),de].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(o,c){return Ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),de].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof pe){const o=this;return R(async function(...c){const u=new E([]),h=await o._def.args.parseAsync(c,a).catch($=>{throw u.addIssue(n(c,$)),u}),v=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(v,a).catch($=>{throw u.addIssue(s(v,$)),u})})}else{const o=this;return R(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new E([n(c,u.error)]);const h=Reflect.apply(i,this,u.data),v=o._def.returns.safeParse(h,a);if(!v.success)throw new E([s(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new me({...this._def,args:z.create(e).rest(ne.create())})}returns(e){return new me({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new me({args:e||z.create([]).rest(ne.create()),returns:t||ne.create(),typeName:g.ZodFunction,..._(n)})}}class Oe extends x{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Oe.create=(r,e)=>new Oe({getter:r,typeName:g.ZodLazy,..._(e)});class Ne extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ne.create=(r,e)=>new Ne({value:r,typeName:g.ZodLiteral,..._(e)});function wt(r,e){return new X({values:r,typeName:g.ZodEnum,..._(e)})}class X extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:k.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return R(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return X.create(e,{...this._def,...t})}exclude(e,t=this._def){return X.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}X.create=wt;class Re extends x{_parse(e){const t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=k.objectValues(t);return f(n,{expected:k.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=k.objectValues(t);return f(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return R(e.data)}get enum(){return this._def.values}}Re.create=(r,e)=>new Re({values:r,typeName:g.ZodNativeEnum,..._(e)});class pe extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),y;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return R(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}pe.create=(r,e)=>new pe({type:r,typeName:g.ZodPromise,..._(e)});class Y extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{f(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?le(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?le(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!te(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);k.assertNever(s)}}Y.create=(r,e,t)=>new Y({schema:r,typeName:g.ZodEffects,effect:e,..._(t)}),Y.createWithPreprocess=(r,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,..._(t)});class L extends x{_parse(e){return this._getType(e)===m.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(r,e)=>new L({innerType:r,typeName:g.ZodOptional,..._(e)});class ee extends x{_parse(e){return this._getType(e)===m.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ee.create=(r,e)=>new ee({innerType:r,typeName:g.ZodNullable,..._(e)});class Ee extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class Ce extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return we(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class He extends x{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}He.create=r=>new He({typeName:g.ZodNaN,..._(r)});const Pr=Symbol("zod_brand");class at extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ie extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),le(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ie({in:e,out:t,typeName:g.ZodPipeline})}}class Ze extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return we(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:g.ZodReadonly,..._(e)});function St(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Tt(r,e={},t){return r?he.create().superRefine((n,s)=>{const a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){const o=St(e,n),c=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){const i=St(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):he.create()}const Wr={object:A.lazycreate};var g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));const Vr=(r,e={message:`Input not instance of ${r.name}`})=>Tt(t=>t instanceof r,e),At=Z.create,$t=K.create,zr=He.create,Lr=Q.create,Mt=Se.create,Ur=re.create,Br=ze.create,Hr=Te.create,qr=Ae.create,Gr=he.create,Jr=ne.create,Kr=H.create,Qr=Le.create,Xr=j.create,en=A.create,tn=A.strictCreate,rn=$e.create,nn=Ue.create,sn=Me.create,an=z.create,on=De.create,cn=Be.create,un=se.create,dn=me.create,ln=Oe.create,hn=Ne.create,fn=X.create,mn=Re.create,pn=pe.create,Dt=Y.create,yn=L.create,gn=ee.create,vn=Y.createWithPreprocess,_n=Ie.create;var l=Object.freeze({__proto__:null,BRAND:Pr,DIRTY:le,EMPTY_PATH:vr,INVALID:y,NEVER:y,OK:R,ParseStatus:N,Schema:x,ZodAny:he,ZodArray:j,ZodBigInt:Q,ZodBoolean:Se,ZodBranded:at,ZodCatch:Ce,ZodDate:re,ZodDefault:Ee,ZodDiscriminatedUnion:Ue,ZodEffects:Y,ZodEnum:X,ZodError:E,get ZodFirstPartyTypeKind(){return g},ZodFunction:me,ZodIntersection:Me,ZodIssueCode:d,ZodLazy:Oe,ZodLiteral:Ne,ZodMap:Be,ZodNaN:He,ZodNativeEnum:Re,ZodNever:H,ZodNull:Ae,ZodNullable:ee,ZodNumber:K,ZodObject:A,ZodOptional:L,ZodParsedType:m,ZodPipeline:Ie,ZodPromise:pe,ZodReadonly:Ze,ZodRecord:De,ZodSchema:x,ZodSet:se,ZodString:Z,ZodSymbol:ze,ZodTransformer:Y,ZodTuple:z,ZodType:x,ZodUndefined:Te,ZodUnion:$e,ZodUnknown:ne,ZodVoid:Le,addIssueToContext:f,any:Gr,array:Xr,bigint:Lr,boolean:Mt,coerce:{string:r=>Z.create({...r,coerce:!0}),number:r=>K.create({...r,coerce:!0}),boolean:r=>Se.create({...r,coerce:!0}),bigint:r=>Q.create({...r,coerce:!0}),date:r=>re.create({...r,coerce:!0})},custom:Tt,date:Ur,datetimeRegex:bt,defaultErrorMap:de,discriminatedUnion:nn,effect:Dt,enum:fn,function:dn,getErrorMap:We,getParsedType:B,instanceof:Vr,intersection:sn,isAborted:tt,isAsync:we,isDirty:rt,isValid:te,late:Wr,lazy:ln,literal:hn,makeIssue:Ve,map:cn,nan:zr,nativeEnum:mn,never:Kr,null:qr,nullable:gn,number:$t,object:en,get objectUtil(){return et},oboolean:()=>Mt().optional(),onumber:()=>$t().optional(),optional:yn,ostring:()=>At().optional(),pipeline:_n,preprocess:vn,promise:pn,quotelessJson:yr,record:on,set:un,setErrorMap:gr,strictObject:tn,string:At,symbol:Br,transformer:Dt,tuple:an,undefined:Hr,union:rn,unknown:Jr,get util(){return k},void:Qr});l.object({nucleotideSequences:l.array(l.object({name:l.string(),sequence:l.string()})),genes:l.array(l.object({name:l.string(),sequence:l.string()}))});const xn=l.enum(["ascending","descending"]),kn=l.object({field:l.string(),type:xn}),Ot=l.union([l.string(),l.number(),l.boolean(),l.null(),l.undefined(),l.array(l.string())]),Nt=l.object({dateFrom:l.string(),dateTo:l.string()});l.object({limit:l.number().optional(),offset:l.number().optional(),fields:l.array(l.string()).optional(),orderBy:l.array(kn).optional()}).catchall(Ot).extend({minProportion:l.number().optional()});const bn=l.object({mutation:l.string(),proportion:l.number(),count:l.number(),sequenceName:l.union([l.string(),l.null()]),mutationFrom:l.string(),mutationTo:l.string(),position:l.number()}),wn=je(l.array(bn));l.object({filters:l.record(Ot),downloadAsFile:l.boolean().optional(),downloadFileBasename:l.string().optional(),compression:l.enum(["gzip","none"]).optional(),includeMutations:l.array(l.string()).optional(),dateRanges:l.array(Nt).optional(),dateField:l.string().optional()});const Sn=je(l.object({mutations:l.array(l.string()),dateRanges:l.array(Nt),data:l.array(l.array(l.object({count:l.number(),coverage:l.number()})))})),Tn=l.object({insertion:l.string(),count:l.number(),insertedSymbols:l.string(),position:l.number(),sequenceName:l.union([l.string(),l.null()])});je(l.array(Tn));const Rt=l.union([l.string(),l.number(),l.boolean(),l.null()]),An=l.object({count:l.number()}).catchall(Rt),$n=je(l.array(An)),Mn=l.object({}).catchall(Rt);je(l.array(Mn));function je(r){return l.object({data:r})}const Et=l.object({title:l.string().optional(),status:l.number(),detail:l.string().optional(),type:l.string(),instance:l.string().optional()}),Dn=l.object({error:Et}),On=l.object({parents:l.array(l.string()).optional(),aliases:l.array(l.string()).optional()});l.record(On);class it extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Ct extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function Nn(r,e,t){const n=await ot(In(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return $n.parse(await n.json())}async function Rn(r,e,t,n){const s=await ot(Zn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return wn.parse(await s.json())}async function En(r,e,t,n){const s=await ot(jn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations over time`);return Sn.parse(await s.json())}async function ot(r,e,t){try{const n=await fetch(r,e);return await Cn(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new it(`Failed to connect to LAPIS: ${s}`,500,t)}}const Cn=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=Dn.safeParse(t);if(n.success)throw new Ct(r.statusText+(n.data.error.detail??""),r.status,n.data.error,e);const s=Et.safeParse(t);throw s.success?new Ct(r.statusText+(s.data.detail??""),r.status,s.data,e):new it(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new it(`${r.statusText}: ${r.status}`,r.status,e)}},In=r=>`${r}/sample/aggregated`,Zn=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`,jn=(r,e)=>e==="amino acid"?`${r}/component/aminoAcidMutationsOverTime`:`${r}/component/nucleotideMutationsOverTime`;class It{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await Nn(e,{...this.filter,fields:this.fields},t)).data;if(Yn(n))return{content:n};throw new Error("Aggregated response does not have count")}}function Yn(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class Fn{constructor(e,t,n){this.child=e,this.field=t,this.aggregate=n}async evaluate(e,t){const n=await this.child.evaluate(e,t),s=new Map;for(const i of n.content){const o=i[this.field];s.has(o)||s.set(o,[]),s.get(o).push(i)}const a=new Array;for(const[,i]of s)a.push(this.aggregate(i));return{content:a}}}class Pn extends Fn{constructor(e,t,n){super(e,t,s=>{let a=0;for(const i of s)a+=i[n];return{[t]:s[0][t],[n]:a}})}}class ct{constructor(e,t){this.child=e,this.func=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.map(this.func)}}}class Wn extends ct{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class Vn{constructor(e,t){this.child=e,this.compareFn=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.sort(this.compareFn)}}}var Zt=60,jt=Zt*60,Yt=jt*24,zn=Yt*7,ye=1e3,ut=Zt*ye,Ft=jt*ye,Ln=Yt*ye,Un=zn*ye,dt="millisecond",ge="second",ve="minute",_e="hour",F="day",Ye="week",P="month",Pt="quarter",G="year",xe="date",Wt="YYYY-MM-DDTHH:mm:ssZ",Vt="Invalid Date",Bn=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Hn=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,qn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},lt=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},Gn=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+lt(s,2,"0")+":"+lt(a,2,"0")},Jn=function r(e,t){if(e.date()<t.date())return-r(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,P),a=t-s<0,i=e.clone().add(n+(a?-1:1),P);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Kn=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Qn=function(e){var t={M:P,y:G,w:Ye,d:F,D:xe,h:_e,m:ve,s:ge,ms:dt,Q:Pt};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},Xn=function(e){return e===void 0},es={s:lt,z:Gn,m:Jn,a:Kn,p:Qn,u:Xn},Fe="en",ae={};ae[Fe]=qn;var zt="$isDayjsObject",ht=function(e){return e instanceof Ge||!!(e&&e[zt])},qe=function r(e,t,n){var s;if(!e)return Fe;if(typeof e=="string"){var a=e.toLowerCase();ae[a]&&(s=a),t&&(ae[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;ae[o]=e,s=o}return!n&&s&&(Fe=s),s||!n&&Fe},T=function(e,t){if(ht(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new Ge(n)},ts=function(e,t){return T(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},w=es;w.l=qe,w.i=ht,w.w=ts;var rs=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var s=t.match(Bn);if(s){var a=s[2]-1||0,i=(s[7]||"0").substring(0,3);return n?new Date(Date.UTC(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)):new Date(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)}}return new Date(t)},Ge=function(){function r(t){this.$L=qe(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[zt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=rs(n),this.init()},e.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},e.$utils=function(){return w},e.isValid=function(){return this.$d.toString()!==Vt},e.isSame=function(n,s){var a=T(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return T(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<T(n)},e.$g=function(n,s,a){return w.u(n)?this[s]:this.set(a,n)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(n,s){var a=this,i=w.u(s)?!0:s,o=w.p(n),c=function(W,C){var M=w.w(a.$u?Date.UTC(a.$y,C,W):new Date(a.$y,C,W),a);return i?M:M.endOf(F)},u=function(W,C){var M=[0,0,0,0],J=[23,59,59,999];return w.w(a.toDate()[W].apply(a.toDate("s"),(i?M:J).slice(C)),a)},h=this.$W,v=this.$M,S=this.$D,$="set"+(this.$u?"UTC":"");switch(o){case G:return i?c(1,0):c(31,11);case P:return i?c(1,v):c(0,v+1);case Ye:{var b=this.$locale().weekStart||0,O=(h<b?h+7:h)-b;return c(i?S-O:S+(6-O),v)}case F:case xe:return u($+"Hours",0);case _e:return u($+"Minutes",1);case ve:return u($+"Seconds",2);case ge:return u($+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=w.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[F]=o+"Date",a[xe]=o+"Date",a[P]=o+"Month",a[G]=o+"FullYear",a[_e]=o+"Hours",a[ve]=o+"Minutes",a[ge]=o+"Seconds",a[dt]=o+"Milliseconds",a)[i],u=i===F?this.$D+(s-this.$W):s;if(i===P||i===G){var h=this.clone().set(xe,1);h.$d[c](u),h.init(),this.$d=h.set(xe,Math.min(this.$D,h.daysInMonth())).$d}else c&&this.$d[c](u);return this.init(),this},e.set=function(n,s){return this.clone().$set(n,s)},e.get=function(n){return this[w.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=w.p(s),c=function(S){var $=T(a);return w.w($.date($.date()+Math.round(S*n)),a)};if(o===P)return this.set(P,this.$M+n);if(o===G)return this.set(G,this.$y+n);if(o===F)return c(1);if(o===Ye)return c(7);var u=(i={},i[ve]=ut,i[_e]=Ft,i[ge]=ye,i)[o]||1,h=this.$d.getTime()+n*u;return w.w(h,this)},e.subtract=function(n,s){return this.add(n*-1,s)},e.format=function(n){var s=this,a=this.$locale();if(!this.isValid())return a.invalidDate||Vt;var i=n||Wt,o=w.z(this),c=this.$H,u=this.$m,h=this.$M,v=a.weekdays,S=a.months,$=a.meridiem,b=function(M,J,Xe,Ws){return M&&(M[J]||M(s,i))||Xe[J].slice(0,Ws)},O=function(M){return w.s(c%12||12,M,"0")},I=$||function(C,M,J){var Xe=C<12?"AM":"PM";return J?Xe.toLowerCase():Xe},W=function(M){switch(M){case"YY":return String(s.$y).slice(-2);case"YYYY":return w.s(s.$y,4,"0");case"M":return h+1;case"MM":return w.s(h+1,2,"0");case"MMM":return b(a.monthsShort,h,S,3);case"MMMM":return b(S,h);case"D":return s.$D;case"DD":return w.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return b(a.weekdaysMin,s.$W,v,2);case"ddd":return b(a.weekdaysShort,s.$W,v,3);case"dddd":return v[s.$W];case"H":return String(c);case"HH":return w.s(c,2,"0");case"h":return O(1);case"hh":return O(2);case"a":return I(c,u,!0);case"A":return I(c,u,!1);case"m":return String(u);case"mm":return w.s(u,2,"0");case"s":return String(s.$s);case"ss":return w.s(s.$s,2,"0");case"SSS":return w.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Hn,function(C,M){return M||W(C)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=w.p(s),c=T(n),u=(c.utcOffset()-this.utcOffset())*ut,h=this-c,v=function(){return w.m(i,c)},S;switch(o){case G:S=v()/12;break;case P:S=v();break;case Pt:S=v()/3;break;case Ye:S=(h-u)/Un;break;case F:S=(h-u)/Ln;break;case _e:S=h/Ft;break;case ve:S=h/ut;break;case ge:S=h/ye;break;default:S=h;break}return a?S:w.a(S)},e.daysInMonth=function(){return this.endOf(P).$D},e.$locale=function(){return ae[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=qe(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return w.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},r}(),Lt=Ge.prototype;T.prototype=Lt,[["$ms",dt],["$s",ge],["$m",ve],["$H",_e],["$W",F],["$M",P],["$y",G],["$D",xe]].forEach(function(r){Lt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),T.extend=function(r,e){return r.$i||(r(e,Ge,T),r.$i=!0),T},T.locale=qe,T.isDayjs=ht,T.unix=function(r){return T(r*1e3)},T.en=ae[Fe],T.Ls=ae,T.p={};var ns=function(r,e){var t=e.prototype,n=t.format;t.format=function(s){var a=this,i=this.$locale();if(!this.isValid())return n.bind(this)(s);var o=this.$utils(),c=s||Wt,u=c.replace(/\\[([^\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return i.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return i.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return n.bind(this)(u)}},ss="isoweek",as=function(r,e,t){var n=function(c,u){var h=(u?t.utc:t)().year(c).startOf(G),v=4-h.isoWeekday();return h.isoWeekday()>4&&(v+=7),h.add(v,F)},s=function(c){return c.add(4-c.isoWeekday(),F)},a=e.prototype;a.isoWeekYear=function(){var o=s(this);return o.year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add((o-this.isoWeek())*7,F);var c=s(this),u=n(this.isoWeekYear(),this.$u);return c.diff(u,Ye)+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var i=a.startOf;a.startOf=function(o,c){var u=this.$utils(),h=u.u(c)?!0:c,v=u.p(o);return v===ss?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):i.bind(this)(o,c)}};T.extend(as),T.extend(ns);const ft="GGGG-[W]WW",Qe=class Qe{constructor(){this.yearMonthDayCache=new Map,this.yearWeekCache=new Map,this.yearMonthCache=new Map,this.yearCache=new Map}getYearMonthDay(e){return this.yearMonthDayCache.has(e)||this.yearMonthDayCache.set(e,ie.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,ce.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,oe.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ue.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};Qe.instance=new Qe;let mt=Qe;class ie{constructor(e,t,n,s){this.yearNumber=e,this.monthNumber=t,this.dayNumber=n,this.cache=s,this.type="YearMonthDay",this.date=new Date(this.yearNumber,this.monthNumber-1,this.dayNumber),this.dayjs=T(this.date),this.dateString=this.toString()}get text(){return this.dayjs.format("YYYY-MM-DD")}toString(){return this.text}englishName(){return this.dayjs.format("dddd, MMMM D, YYYY")}get firstDay(){return this}get lastDay(){return this}get year(){return this.cache.getYear(`${this.yearNumber}`)}get month(){return this.cache.getYearMonth(this.dayjs.format("YYYY-MM"))}get week(){return this.cache.getYearWeek(this.dayjs.format(ft))}addDays(e){const n=this.dayjs.add(e,"day").format("YYYY-MM-DD");return this.cache.getYearMonthDay(n)}minus(e){return this.dayjs.diff(e.dayjs,"day")}static parse(e,t){const[n,s,a]=e.split("-").map(i=>parseInt(i,10));return new ie(n,s,a,t)}}class oe{constructor(e,t,n){this.isoYearNumber=e,this.isoWeekNumber=t,this.cache=n,this.type="YearWeek",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format(ft)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=T().year(this.isoYearNumber).month(1).date(4).isoWeek(this.isoWeekNumber).startOf("isoWeek");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get lastDay(){const e=this.firstDay.dayjs.add(6,"days");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.isoYearNumber}`)}addWeeks(e){const n=this.firstDay.dayjs.add(e,"week").format(ft);return this.cache.getYearWeek(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"week")}static parse(e,t){const[n,s]=e.split("-W").map(a=>parseInt(a,10));return new oe(n,s,t)}}class ce{constructor(e,t,n){this.yearNumber=e,this.monthNumber=t,this.cache=n,this.type="YearMonth",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY-MM")}toString(){return this.text}englishName(){return`${is(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).endOf("month").format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.yearNumber}`)}addMonths(e){const n=this.firstDay.dayjs.add(e,"month").format("YYYY-MM");return this.cache.getYearMonth(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"month")}static parse(e,t){const[n,s]=e.split("-").map(a=>parseInt(a,10));return new ce(n,s,t)}}class ue{constructor(e,t){this.year=e,this.cache=t,this.type="Year",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY")}toString(){return this.text}englishName(){return this.year.toString()}get firstMonth(){return this.cache.getYearMonth(`${this.year}-01`)}get lastMonth(){return this.cache.getYearMonth(`${this.year}-12`)}get firstDay(){return this.firstMonth.firstDay}get lastDay(){return this.lastMonth.lastDay}addYears(e){const n=this.firstDay.dayjs.add(e,"year").format("YYYY");return this.cache.getYear(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"year")}static parse(e,t){const n=parseInt(e,10);return new ue(n,t)}}function is(r){return T().month(r-1).format("MMMM")}function Ut(r){switch(r.type){case"YearMonthDay":return{type:"YearMonthDay",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dayNumber:r.dayNumber,dateString:r.dateString};case"YearWeek":return{type:"YearWeek",isoYearNumber:r.isoYearNumber,isoWeekNumber:r.isoWeekNumber,dateString:r.dateString};case"YearMonth":return{type:"YearMonth",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dateString:r.dateString};case"Year":return{type:"Year",year:r.year,dateString:r.dateString}}}function os(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function cs(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function us(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function ds(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Bt(r,e){if(r===null||e===null)return[];if(r instanceof ie&&e instanceof ie)return os(r,e);if(r instanceof oe&&e instanceof oe)return cs(r,e);if(r instanceof ce&&e instanceof ce)return us(r,e);if(r instanceof ue&&e instanceof ue)return ds(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function ls(r,e){if(r instanceof ie&&e instanceof ie||r instanceof oe&&e instanceof oe||r instanceof ce&&e instanceof ce||r instanceof ue&&e instanceof ue)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function Je(r,e){if(r===null)return 1;if(e===null)return-1;const t=ls(r,e);return t<0?-1:t>0?1:0}function hs(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||Je(n,e)<0)&&(e=n),(t===null||Je(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function Pe(r,e){const n=mt.getInstance().getYearMonthDay(r);switch(e){case"day":return n;case"week":return n.week;case"month":return n.month;case"year":return n.year}}function fs(r,e){return r.dateRange===null?1:e.dateRange===null?-1:Je(r.dateRange,e.dateRange)}function ms(r,e){return{dateRange:r.date===null?null:Pe(r.date,e),count:r.count}}const Ht="ACGTRYKMSWBDHVN",qt="ACDEFGHIKLMNPQRSTVWY";function Gt(r){const e="(?<segment>[A-Z0-9_-]+):";return r?`(${e})?`:e}function pt(r,e){const t=r==="nucleotide"?Ht:qt;return new RegExp(`^${Gt(e)}(?<valueAtReference>[${t}*])?(?<position>\\\\d+)(?<substitutionValue>[${t}.*])?$`,"i")}const ps=pt("nucleotide",!0),ys=pt("aminoAcid",!1),gs=pt("aminoAcid",!0);class ke{constructor(e,t,n,s){this.segment=e,this.valueAtReference=t,this.substitutionValue=n,this.position=s,this.type="substitution";const a=this.segment?`${this.segment}:`:"",i=this.valueAtReference??"",o=this.substitutionValue??"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof ke?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.substitutionValue===e.substitutionValue&&this.position===e.position:!1}toString(){return this.code}static parse(e,t=!1){const n=ps.exec(e),s=ys.exec(e),a=t?gs.exec(e):void 0,i=n??s??a;return(i==null?void 0:i.groups)===void 0?null:new ke(i.groups.segment,i.groups.valueAtReference,i.groups.substitutionValue,parseInt(i.groups.position,10))}}function Jt(r){const e=r==="nucleotide"?Ht:qt;return new RegExp(`^${Gt(r==="nucleotide")}(?<valueAtReference>[${e}*])?(?<position>\\\\d+)(-)$`,"i")}const vs=Jt("nucleotide"),_s=Jt("aminoAcid");class be{constructor(e,t,n){this.segment=e,this.valueAtReference=t,this.position=n,this.type="deletion";const s=this.segment?`${this.segment}:`:"",a=this.valueAtReference??"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof be?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=vs.exec(e),n=_s.exec(e),s=t??n;return(s==null?void 0:s.groups)===void 0?null:new be(s.groups.segment,s.groups.valueAtReference,parseInt(s.groups.position,10))}}function Kt(r){switch(r.type){case"substitution":return{type:"substitution",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference,substitutionValue:r.substitutionValue};case"deletion":return{type:"deletion",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference}}}class xs{constructor(e,t,n){this.filter=e,this.sequenceType=t,this.minProportion=n}async evaluate(e,t){return{content:(await this.fetchMutations(e,t)).map(({count:a,proportion:i,mutationFrom:o,mutationTo:c,position:u,sequenceName:h})=>c==="-"?{type:"deletion",mutation:new be(h??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new ke(h??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return Rn(e,n,this.sequenceType,t).then(s=>s.data)}}var Qt;Qt={__e:function(r,e,t,n){for(var s,a,i;e=e.__;)if((s=e.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(r)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(r,n||{}),i=s.__d),i)return s.__E=s}catch(o){r=o}throw r}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var U,yt,Xt,er=[],D=Qt,tr=D.__b,rr=D.__r,nr=D.diffed,sr=D.__c,ar=D.unmount,ir=D.__;function ks(){for(var r;r=er.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Ke),r.__H.__h.forEach(gt),r.__H.__h=[]}catch(e){r.__H.__h=[],D.__e(e,r.__v)}}D.__b=function(r){U=null,tr&&tr(r)},D.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),ir&&ir(r,e)},D.__r=function(r){rr&&rr(r);var e=(U=r.__c).__H;e&&(yt===U?(e.__h=[],U.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ke),e.__h.forEach(gt),e.__h=[])),yt=U},D.diffed=function(r){nr&&nr(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(er.push(e)!==1&&Xt===D.requestAnimationFrame||((Xt=D.requestAnimationFrame)||bs)(ks)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),yt=U=null},D.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Ke),t.__h=t.__h.filter(function(n){return!n.__||gt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],D.__e(n,t.__v)}}),sr&&sr(r,e)},D.unmount=function(r){ar&&ar(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Ke(n)}catch(s){e=s}}),t.__H=void 0,e&&D.__e(e,t.__v))};var or=typeof requestAnimationFrame=="function";function bs(r){var e,t=function(){clearTimeout(n),or&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);or&&(e=requestAnimationFrame(t))}function Ke(r){var e=U,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),U=e}function gt(r){var e=U;r.__c=r.__(),U=e}class cr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class ws{constructor(e,t,n){this.serializeFirstAxis=e,this.serializeSecondAxis=t,this.data=new Map,this.keysFirstAxis=new Map,this.keysSecondAxis=new Map,n&&(this.keysFirstAxis=new Map(n.keysFirstAxis),this.keysSecondAxis=new Map(n.keysSecondAxis),this.data=new Map(n.data))}get(e,t){var a;const n=this.serializeFirstAxis(e),s=this.serializeSecondAxis(t);return(a=this.data.get(n))==null?void 0:a.get(s)}getRow(e){const t=this.serializeFirstAxis(e),n=this.data.get(t);return n===void 0?[]:Array.from(this.keysSecondAxis.keys()).map(s=>n.get(s))}set(e,t,n){const s=this.serializeFirstAxis(e),a=this.serializeSecondAxis(t);this.data.has(s)||this.data.set(s,new Map),this.data.get(s).set(a,n),this.keysFirstAxis.set(s,e),this.keysSecondAxis.set(a,t)}deleteRow(e){const t=this.serializeFirstAxis(e);this.data.delete(t),this.keysFirstAxis.delete(t)}getFirstAxisKeys(){return Array.from(this.keysFirstAxis.values())}getSecondAxisKeys(){return Array.from(this.keysSecondAxis.values())}getAsArray(){return this.getFirstAxisKeys().map(e=>this.getSecondAxisKeys().map(t=>this.get(e,t)))}getContents(){return{keysFirstAxis:this.keysFirstAxis,keysSecondAxis:this.keysSecondAxis,data:this.data}}}class ur extends ws{constructor(e){super(Zs,js,e)}}const dr=(r,e)=>{if(r.segment!==e.segment)return Ss(r.segment,e.segment);if(r.position!==e.position)return Ts(r.position,e.position);const t=r.type==="deletion",n=e.type==="deletion";return t!==n?t?1:-1:!t&&!n&&r.substitutionValue!==e.substitutionValue?As(r.substitutionValue,e.substitutionValue):0},Ss=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),Ts=(r,e)=>r-e,As=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),lr=200,$s=.001;function hr(r){const e=be.parse(r);if(e)return{type:"deletion",mutation:e,count:0,proportion:0};const t=ke.parse(r);return t?{type:"substitution",mutation:t,count:0,proportion:0}:null}async function Ms({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,includeMutations:a,signal:i}){const o=await fr(r,t,n,s,i);if(o.length===0)return a?{content:a.map(hr).filter(h=>h!==null)}:{content:[]};const c={...r,[`${s}From`]:o[0].firstDay.toString(),[`${s}To`]:o[o.length-1].lastDay.toString()};let u=mr(c,e).evaluate(t,i);return a&&(u=u.then(h=>({content:a.map(v=>h.content.find($=>$.mutation.code===v)??hr(v)).filter(v=>v!==null)}))),u}async function Ds(r){const{lapisFilter:e,displayMutations:t,sequenceType:n,lapis:s,lapisDateField:a,granularity:i,useNewEndpoint:o,signal:c}=r,u=await fr(e,s,i,a,c);if(u.length>lr)throw new cr("Too many dates",`The dataset would contain ${u.length} date intervals. Please reduce the number to below ${lr} to display the data. You can achieve this by either narrowing the date range in the provided LAPIS filter or by selecting a larger granularity.`);const h=Ms({lapisFilter:e,sequenceType:n,lapis:s,lapisDateField:a,includeMutations:t,granularity:i}).then(v=>v.content);return o===!0?Ns(u,h,r):Os(u,h,r)}async function Os(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=r.map(async h=>{const v=h.firstDay.toString(),S=h.lastDay.toString(),$={...t,[`${a}From`]:v,[`${a}To`]:S},[b,O]=await Promise.all([mr($,n).evaluate(s,i),pr($).evaluate(s,i)]);return{date:h,mutations:b.content,totalCount:O.content[0].count}}),c=await Promise.all(o),u=await e;return{mutationOverTimeData:Ys(c,u),overallMutationData:u}}async function Ns(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=await e;o.sort((b,O)=>dr(b.mutation,O.mutation));const c=await Promise.all(r.map(async b=>{const O={...t,[`${a}From`]:b.firstDay.toString(),[`${a}To`]:b.lastDay.toString()};return(await pr(O).evaluate(s,i)).content[0].count})),u=o.map(b=>b.mutation.code),h=await En(s,{filters:t,dateRanges:r.map(b=>({dateFrom:b.firstDay.toString(),dateTo:b.lastDay.toString()})),includeMutations:u,dateField:a},n,i),v=h.data.mutations.map(Rs),S=v.map((b,O)=>{const I={count:o[O].count,proportion:o[O].proportion};return b.type==="deletion"?{type:"deletion",mutation:b,...I}:{type:"substitution",mutation:b,...I}}),$={keysFirstAxis:new Map(v.map(b=>[b.code,b])),keysSecondAxis:new Map(r.map(b=>[b.dateString,b])),data:new Map(v.map((b,O)=>[b.code,new Map(r.map((I,W)=>{if(c[W]===0)return[I.dateString,null];const C=h.data.data[O][W].count,M=h.data.data[O][W].coverage,J=c[W];return M===0?[I.dateString,{type:"belowThreshold",totalCount:J}]:[I.dateString,{type:"valueWithCoverage",count:C,coverage:M,totalCount:J}]}))]))};return{mutationOverTimeData:new ur($),overallMutationData:S}}function Rs(r){const e=be.parse(r);if(e)return e;const t=ke.parse(r);if(t)return t;throw Error(`Given code is not valid: ${r}`)}async function fr(r,e,t,n,s){const{dateFrom:a,dateTo:i}=Es(r,n,t);if(a!==null&&i!==null)return Bt(a,i);const{content:o}=await Cs(r,e,t,n,s),{min:c,max:u}=hs(o);return Bt(a??c,i??u)}function Es(r,e,t){const n=r[e];if(n)return{dateFrom:Pe(n,t),dateTo:Pe(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?Pe(s,t):null,dateTo:a?Pe(a,t):null}}function Cs(r,e,t,n,s){return Is(r,t,n).evaluate(e,s)}function Is(r,e,t){const n=new It(r,[t]),s=new Wn(n,t,"date"),a=new ct(s,c=>ms(c,e)),i=new Pn(a,"dateRange","count"),o=new Vn(i,fs);return new ct(o,c=>c.dateRange)}function mr(r,e){return new xs(r,e,$s)}function Zs(r){return r.code}function js(r){return r.dateString}function Ys(r,e){const t=new ur,n=r.map(i=>i.date),s=e.sort((i,o)=>dr(i.mutation,o.mutation)).map(i=>Kt(i.mutation)),a=n.sort((i,o)=>Je(i,o)).map(i=>Ut(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Ut(i.date);i.mutations.forEach(c=>{const u=Kt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{type:"value",count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{type:"belowThreshold",totalCount:i.totalCount})}),t}function pr(r){return new It(r)}async function Fs(r){try{postMessage({status:"loading"});const e=await r();postMessage({status:"success",data:e})}catch(e){postMessage(e instanceof cr?{status:"error",userFacing:!0,headline:e.headline,error:e}:{status:"error",userFacing:!1,error:e instanceof Error?e:new Error(`${e}`)})}}async function Ps(r){const e=await Ds(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await Fs(()=>Ps(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-DIpJukJC.js.map\n', qb = typeof self < "u" && self.Blob && new Blob([mk], { type: "text/javascript;charset=utf-8" });
25974
+ const mk = '(function(){"use strict";var k;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`\'${i}\'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(k||(k={}));var et;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),B=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},d=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),pr=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class E extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof E))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}E.create=r=>new E(r);const de=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received \'${r.received}\'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}};let vt=de;function yr(r){vt=r}function We(){return vt}const Ve=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},gr=[];function f(r,e){const t=We(),n=Ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===de?void 0:de].filter(s=>!!s)});r.common.issues.push(n)}class O{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return O.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),le=r=>({status:"dirty",value:r}),N=r=>({status:"valid",value:r}),tt=r=>r.status==="aborted",rt=r=>r.status==="dirty",te=r=>r.status==="valid",we=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class V{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const _t=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new E(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return B(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(we(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parseSync({data:e,path:n.path,parent:n});return _t(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return te(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>te(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(we(s)?s:Promise.resolve(s));return _t(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new j({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return L.create(this,this._def)}nullable(){return ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return pe.create(this,this._def)}or(e){return $e.create([this,e],this._def)}and(e){return Me.create(this,e,this._def)}transform(e){return new j({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ee({..._(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new at({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({..._(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vr=/^c[^\\s-]{8,}$/i,_r=/^[0-9a-z]+$/,xr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kr=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,br=/^[a-z0-9_-]{21}$/i,wr=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Sr=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Tr=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Ar="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let nt;const $r=/^(?:(?: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])$/,Mr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Dr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Or=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xt="((\\\\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])))",Er=new RegExp(`^${xt}$`);function kt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);const t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Cr(r){return new RegExp(`^${kt(r)}$`)}function bt(r){let e=`${xt}T${kt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ir(r,e){return!!((e==="v4"||!e)&&$r.test(r)||(e==="v6"||!e)&&Dr.test(r))}function Zr(r,e){if(!wr.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function jr(r,e){return!!((e==="v4"||!e)&&Mr.test(r)||(e==="v6"||!e)&&Or.test(r))}class I extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),y}const n=new O;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Tr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")nt||(nt=new RegExp(Ar,"u")),nt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")kr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")br.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")vr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")_r.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")xr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?bt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Er.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Cr(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Sr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ir(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Zr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?jr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Nr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Rr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):k.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...p.errToObj(n)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}I.create=r=>new I({checks:[],typeName:g.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function Yr(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class K extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),y}let n;const s=new O;for(const a of this._def.checks)a.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Yr(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_finite,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}K.create=r=>new K({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class Q extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const s=new O;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Q.create=r=>new Q({checks:[],typeName:g.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class Se extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),y}return N(e.data)}}Se.create=r=>new Se({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class re extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}const n=new O;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):k.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}re.create=r=>new re({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,..._(r)});class ze extends x{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),y}return N(e.data)}}ze.create=r=>new ze({typeName:g.ZodSymbol,..._(r)});class Te extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),y}return N(e.data)}}Te.create=r=>new Te({typeName:g.ZodUndefined,..._(r)});class Ae extends x{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),y}return N(e.data)}}Ae.create=r=>new Ae({typeName:g.ZodNull,..._(r)});class he extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}}he.create=r=>new he({typeName:g.ZodAny,..._(r)});class ne extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}}ne.create=r=>new ne({typeName:g.ZodUnknown,..._(r)});class H extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),y}}H.create=r=>new H({typeName:g.ZodNever,..._(r)});class Le extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),y}return N(e.data)}}Le.create=r=>new Le({typeName:g.ZodVoid,..._(r)});class Z extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return f(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(f(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(f(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new V(t,i,t.path,o)))).then(i=>O.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new V(t,i,t.path,o)));return O.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});function fe(r){if(r instanceof A){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=L.create(fe(n))}return new A({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:fe(r.element)}):r instanceof L?L.create(fe(r.unwrap())):r instanceof ee?ee.create(fe(r.unwrap())):r instanceof z?z.create(r.items.map(e=>fe(e))):r}class A extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof H&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const h=a[u],v=s.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new V(s,v,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof H){const u=this._def.unknownKeys;if(u==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(u==="strict")o.length>0&&(f(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const h of o){const v=s.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new V(s,v,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const h of c){const v=await h.key,S=await h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u}).then(u=>O.mergeObjectSync(n,u)):O.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of k.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of k.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return fe(this)}partial(e){const t={};for(const n of k.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of k.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof L;)a=a._def.innerType;t[n]=a}return new A({...this._def,shape:()=>t})}keyof(){return wt(k.objectKeys(this.shape))}}A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:H.create(),typeName:g.ZodObject,..._(e)}),A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:H.create(),typeName:g.ZodObject,..._(e)}),A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:H.create(),typeName:g.ZodObject,..._(e)});class $e extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new E(o.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const u={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new E(c));return f(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}$e.create=(r,e)=>new $e({options:r,typeName:g.ZodUnion,..._(e)});const q=r=>r instanceof Oe?q(r.schema):r instanceof j?q(r.innerType()):r instanceof Ne?[r.value]:r instanceof X?r.options:r instanceof Re?k.objectValues(r.enum):r instanceof Ee?q(r._def.innerType):r instanceof Te?[void 0]:r instanceof Ae?[null]:r instanceof L?[void 0,...q(r.unwrap())]:r instanceof ee?[null,...q(r.unwrap())]:r instanceof at||r instanceof Ze?q(r.unwrap()):r instanceof Ce?q(r._def.innerType):[];class Ue extends x{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:d.invalid_type,expected:m.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=q(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Ue({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function st(r,e){const t=B(r),n=B(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){const s=k.objectKeys(e),a=k.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=st(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=st(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Me extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(tt(a)||tt(i))return y;const o=st(a.value,i.value);return o.valid?((rt(a)||rt(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:d.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Me.create=(r,e,t)=>new Me({left:r,right:e,typeName:g.ZodIntersection,..._(t)});class z extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return f(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new V(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>O.mergeArray(t,i)):O.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:r,typeName:g.ZodTuple,rest:null,..._(e)})};class De extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return f(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new V(n,o,n.path,o)),value:i._parse(new V(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?O.mergeObjectAsync(t,s):O.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new De({keyType:e,valueType:t,typeName:g.ZodRecord,..._(n)}):new De({keyType:I.create(),valueType:e,typeName:g.ZodRecord,..._(t)})}}class Be extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return f(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new V(n,o,n.path,[u,"key"])),value:a._parse(new V(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,h=await c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}}Be.create=(r,e,t)=>new Be({valueType:e,keyType:r,typeName:g.ZodMap,..._(t)});class se extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(f(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new V(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new se({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(r,e)=>new se({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});class me extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),y;function n(o,c){return Ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),de].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(o,c){return Ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),de].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof pe){const o=this;return N(async function(...c){const u=new E([]),h=await o._def.args.parseAsync(c,a).catch($=>{throw u.addIssue(n(c,$)),u}),v=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(v,a).catch($=>{throw u.addIssue(s(v,$)),u})})}else{const o=this;return N(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new E([n(c,u.error)]);const h=Reflect.apply(i,this,u.data),v=o._def.returns.safeParse(h,a);if(!v.success)throw new E([s(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new me({...this._def,args:z.create(e).rest(ne.create())})}returns(e){return new me({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new me({args:e||z.create([]).rest(ne.create()),returns:t||ne.create(),typeName:g.ZodFunction,..._(n)})}}class Oe extends x{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Oe.create=(r,e)=>new Oe({getter:r,typeName:g.ZodLazy,..._(e)});class Ne extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ne.create=(r,e)=>new Ne({value:r,typeName:g.ZodLiteral,..._(e)});function wt(r,e){return new X({values:r,typeName:g.ZodEnum,..._(e)})}class X extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:k.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return N(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return X.create(e,{...this._def,...t})}exclude(e,t=this._def){return X.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}X.create=wt;class Re extends x{_parse(e){const t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=k.objectValues(t);return f(n,{expected:k.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=k.objectValues(t);return f(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return N(e.data)}get enum(){return this._def.values}}Re.create=(r,e)=>new Re({values:r,typeName:g.ZodNativeEnum,..._(e)});class pe extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),y;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return N(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}pe.create=(r,e)=>new pe({type:r,typeName:g.ZodPromise,..._(e)});class j extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{f(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?le(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?le(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!te(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);k.assertNever(s)}}j.create=(r,e,t)=>new j({schema:r,typeName:g.ZodEffects,effect:e,..._(t)}),j.createWithPreprocess=(r,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,..._(t)});class L extends x{_parse(e){return this._getType(e)===m.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(r,e)=>new L({innerType:r,typeName:g.ZodOptional,..._(e)});class ee extends x{_parse(e){return this._getType(e)===m.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ee.create=(r,e)=>new ee({innerType:r,typeName:g.ZodNullable,..._(e)});class Ee extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class Ce extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return we(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class He extends x{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}He.create=r=>new He({typeName:g.ZodNaN,..._(r)});const Fr=Symbol("zod_brand");class at extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ie extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),le(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ie({in:e,out:t,typeName:g.ZodPipeline})}}class Ze extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return we(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:g.ZodReadonly,..._(e)});function St(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Tt(r,e={},t){return r?he.create().superRefine((n,s)=>{const a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){const o=St(e,n),c=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){const i=St(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):he.create()}const Pr={object:A.lazycreate};var g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));const Wr=(r,e={message:`Input not instance of ${r.name}`})=>Tt(t=>t instanceof r,e),At=I.create,$t=K.create,Vr=He.create,zr=Q.create,Mt=Se.create,Lr=re.create,Ur=ze.create,Br=Te.create,Hr=Ae.create,qr=he.create,Gr=ne.create,Jr=H.create,Kr=Le.create,Qr=Z.create,Xr=A.create,en=A.strictCreate,tn=$e.create,rn=Ue.create,nn=Me.create,sn=z.create,an=De.create,on=Be.create,cn=se.create,un=me.create,dn=Oe.create,ln=Ne.create,hn=X.create,fn=Re.create,mn=pe.create,Dt=j.create,pn=L.create,yn=ee.create,gn=j.createWithPreprocess,vn=Ie.create;var l=Object.freeze({__proto__:null,BRAND:Fr,DIRTY:le,EMPTY_PATH:gr,INVALID:y,NEVER:y,OK:N,ParseStatus:O,Schema:x,ZodAny:he,ZodArray:Z,ZodBigInt:Q,ZodBoolean:Se,ZodBranded:at,ZodCatch:Ce,ZodDate:re,ZodDefault:Ee,ZodDiscriminatedUnion:Ue,ZodEffects:j,ZodEnum:X,ZodError:E,get ZodFirstPartyTypeKind(){return g},ZodFunction:me,ZodIntersection:Me,ZodIssueCode:d,ZodLazy:Oe,ZodLiteral:Ne,ZodMap:Be,ZodNaN:He,ZodNativeEnum:Re,ZodNever:H,ZodNull:Ae,ZodNullable:ee,ZodNumber:K,ZodObject:A,ZodOptional:L,ZodParsedType:m,ZodPipeline:Ie,ZodPromise:pe,ZodReadonly:Ze,ZodRecord:De,ZodSchema:x,ZodSet:se,ZodString:I,ZodSymbol:ze,ZodTransformer:j,ZodTuple:z,ZodType:x,ZodUndefined:Te,ZodUnion:$e,ZodUnknown:ne,ZodVoid:Le,addIssueToContext:f,any:qr,array:Qr,bigint:zr,boolean:Mt,coerce:{string:r=>I.create({...r,coerce:!0}),number:r=>K.create({...r,coerce:!0}),boolean:r=>Se.create({...r,coerce:!0}),bigint:r=>Q.create({...r,coerce:!0}),date:r=>re.create({...r,coerce:!0})},custom:Tt,date:Lr,datetimeRegex:bt,defaultErrorMap:de,discriminatedUnion:rn,effect:Dt,enum:hn,function:un,getErrorMap:We,getParsedType:B,instanceof:Wr,intersection:nn,isAborted:tt,isAsync:we,isDirty:rt,isValid:te,late:Pr,lazy:dn,literal:ln,makeIssue:Ve,map:on,nan:Vr,nativeEnum:fn,never:Jr,null:Hr,nullable:yn,number:$t,object:Xr,get objectUtil(){return et},oboolean:()=>Mt().optional(),onumber:()=>$t().optional(),optional:pn,ostring:()=>At().optional(),pipeline:vn,preprocess:gn,promise:mn,quotelessJson:pr,record:an,set:cn,setErrorMap:yr,strictObject:en,string:At,symbol:Ur,transformer:Dt,tuple:sn,undefined:Br,union:tn,unknown:Gr,get util(){return k},void:Kr});l.object({nucleotideSequences:l.array(l.object({name:l.string(),sequence:l.string()})),genes:l.array(l.object({name:l.string(),sequence:l.string()}))});const _n=l.enum(["ascending","descending"]),xn=l.object({field:l.string(),type:_n}),Ot=l.union([l.string(),l.number(),l.boolean(),l.null(),l.undefined(),l.array(l.string())]),Nt=l.object({dateFrom:l.string(),dateTo:l.string()});l.object({limit:l.number().optional(),offset:l.number().optional(),fields:l.array(l.string()).optional(),orderBy:l.array(xn).optional()}).catchall(Ot).extend({minProportion:l.number().optional()});const kn=l.object({mutation:l.string(),proportion:l.number(),count:l.number(),sequenceName:l.union([l.string(),l.null()]),mutationFrom:l.string(),mutationTo:l.string(),position:l.number()}),bn=je(l.array(kn));l.object({filters:l.record(Ot),downloadAsFile:l.boolean().optional(),downloadFileBasename:l.string().optional(),compression:l.enum(["gzip","none"]).optional(),includeMutations:l.array(l.string()).optional(),dateRanges:l.array(Nt).optional(),dateField:l.string().optional()});const wn=je(l.object({mutations:l.array(l.string()),dateRanges:l.array(Nt),data:l.array(l.array(l.object({count:l.number(),coverage:l.number()}))),totalCountsByDateRange:l.array(l.number())})),Sn=l.object({insertion:l.string(),count:l.number(),insertedSymbols:l.string(),position:l.number(),sequenceName:l.union([l.string(),l.null()])});je(l.array(Sn));const Rt=l.union([l.string(),l.number(),l.boolean(),l.null()]),Tn=l.object({count:l.number()}).catchall(Rt),An=je(l.array(Tn)),$n=l.object({}).catchall(Rt);je(l.array($n));function je(r){return l.object({data:r})}const Et=l.object({title:l.string().optional(),status:l.number(),detail:l.string().optional(),type:l.string(),instance:l.string().optional()}),Mn=l.object({error:Et}),Dn=l.object({parents:l.array(l.string()).optional(),aliases:l.array(l.string()).optional()});l.record(Dn);class it extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Ct extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function On(r,e,t){const n=await ot(Cn(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return An.parse(await n.json())}async function Nn(r,e,t,n){const s=await ot(In(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return bn.parse(await s.json())}async function Rn(r,e,t,n){const s=await ot(Zn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations over time`);return wn.parse(await s.json())}async function ot(r,e,t){try{const n=await fetch(r,e);return await En(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new it(`Failed to connect to LAPIS: ${s}`,500,t)}}const En=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=Mn.safeParse(t);if(n.success)throw new Ct(r.statusText+(n.data.error.detail??""),r.status,n.data.error,e);const s=Et.safeParse(t);throw s.success?new Ct(r.statusText+(s.data.detail??""),r.status,s.data,e):new it(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new it(`${r.statusText}: ${r.status}`,r.status,e)}},Cn=r=>`${r}/sample/aggregated`,In=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`,Zn=(r,e)=>e==="amino acid"?`${r}/component/aminoAcidMutationsOverTime`:`${r}/component/nucleotideMutationsOverTime`;class It{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await On(e,{...this.filter,fields:this.fields},t)).data;if(jn(n))return{content:n};throw new Error("Aggregated response does not have count")}}function jn(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class Yn{constructor(e,t,n){this.child=e,this.field=t,this.aggregate=n}async evaluate(e,t){const n=await this.child.evaluate(e,t),s=new Map;for(const i of n.content){const o=i[this.field];s.has(o)||s.set(o,[]),s.get(o).push(i)}const a=new Array;for(const[,i]of s)a.push(this.aggregate(i));return{content:a}}}class Fn extends Yn{constructor(e,t,n){super(e,t,s=>{let a=0;for(const i of s)a+=i[n];return{[t]:s[0][t],[n]:a}})}}class ct{constructor(e,t){this.child=e,this.func=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.map(this.func)}}}class Pn extends ct{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class Wn{constructor(e,t){this.child=e,this.compareFn=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.sort(this.compareFn)}}}var Zt=60,jt=Zt*60,Yt=jt*24,Vn=Yt*7,ye=1e3,ut=Zt*ye,Ft=jt*ye,zn=Yt*ye,Ln=Vn*ye,dt="millisecond",ge="second",ve="minute",_e="hour",Y="day",Ye="week",F="month",Pt="quarter",G="year",xe="date",Wt="YYYY-MM-DDTHH:mm:ssZ",Vt="Invalid Date",Un=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Bn=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Hn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},lt=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},qn=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+lt(s,2,"0")+":"+lt(a,2,"0")},Gn=function r(e,t){if(e.date()<t.date())return-r(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,F),a=t-s<0,i=e.clone().add(n+(a?-1:1),F);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Jn=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Kn=function(e){var t={M:F,y:G,w:Ye,d:Y,D:xe,h:_e,m:ve,s:ge,ms:dt,Q:Pt};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},Qn=function(e){return e===void 0},Xn={s:lt,z:qn,m:Gn,a:Jn,p:Kn,u:Qn},Fe="en",ae={};ae[Fe]=Hn;var zt="$isDayjsObject",ht=function(e){return e instanceof Ge||!!(e&&e[zt])},qe=function r(e,t,n){var s;if(!e)return Fe;if(typeof e=="string"){var a=e.toLowerCase();ae[a]&&(s=a),t&&(ae[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;ae[o]=e,s=o}return!n&&s&&(Fe=s),s||!n&&Fe},T=function(e,t){if(ht(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new Ge(n)},es=function(e,t){return T(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},b=Xn;b.l=qe,b.i=ht,b.w=es;var ts=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(b.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var s=t.match(Un);if(s){var a=s[2]-1||0,i=(s[7]||"0").substring(0,3);return n?new Date(Date.UTC(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)):new Date(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)}}return new Date(t)},Ge=function(){function r(t){this.$L=qe(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[zt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=ts(n),this.init()},e.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},e.$utils=function(){return b},e.isValid=function(){return this.$d.toString()!==Vt},e.isSame=function(n,s){var a=T(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return T(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<T(n)},e.$g=function(n,s,a){return b.u(n)?this[s]:this.set(a,n)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(n,s){var a=this,i=b.u(s)?!0:s,o=b.p(n),c=function(W,C){var M=b.w(a.$u?Date.UTC(a.$y,C,W):new Date(a.$y,C,W),a);return i?M:M.endOf(Y)},u=function(W,C){var M=[0,0,0,0],J=[23,59,59,999];return b.w(a.toDate()[W].apply(a.toDate("s"),(i?M:J).slice(C)),a)},h=this.$W,v=this.$M,S=this.$D,$="set"+(this.$u?"UTC":"");switch(o){case G:return i?c(1,0):c(31,11);case F:return i?c(1,v):c(0,v+1);case Ye:{var w=this.$locale().weekStart||0,R=(h<w?h+7:h)-w;return c(i?S-R:S+(6-R),v)}case Y:case xe:return u($+"Hours",0);case _e:return u($+"Minutes",1);case ve:return u($+"Seconds",2);case ge:return u($+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=b.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[Y]=o+"Date",a[xe]=o+"Date",a[F]=o+"Month",a[G]=o+"FullYear",a[_e]=o+"Hours",a[ve]=o+"Minutes",a[ge]=o+"Seconds",a[dt]=o+"Milliseconds",a)[i],u=i===Y?this.$D+(s-this.$W):s;if(i===F||i===G){var h=this.clone().set(xe,1);h.$d[c](u),h.init(),this.$d=h.set(xe,Math.min(this.$D,h.daysInMonth())).$d}else c&&this.$d[c](u);return this.init(),this},e.set=function(n,s){return this.clone().$set(n,s)},e.get=function(n){return this[b.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=b.p(s),c=function(S){var $=T(a);return b.w($.date($.date()+Math.round(S*n)),a)};if(o===F)return this.set(F,this.$M+n);if(o===G)return this.set(G,this.$y+n);if(o===Y)return c(1);if(o===Ye)return c(7);var u=(i={},i[ve]=ut,i[_e]=Ft,i[ge]=ye,i)[o]||1,h=this.$d.getTime()+n*u;return b.w(h,this)},e.subtract=function(n,s){return this.add(n*-1,s)},e.format=function(n){var s=this,a=this.$locale();if(!this.isValid())return a.invalidDate||Vt;var i=n||Wt,o=b.z(this),c=this.$H,u=this.$m,h=this.$M,v=a.weekdays,S=a.months,$=a.meridiem,w=function(M,J,Xe,Ws){return M&&(M[J]||M(s,i))||Xe[J].slice(0,Ws)},R=function(M){return b.s(c%12||12,M,"0")},P=$||function(C,M,J){var Xe=C<12?"AM":"PM";return J?Xe.toLowerCase():Xe},W=function(M){switch(M){case"YY":return String(s.$y).slice(-2);case"YYYY":return b.s(s.$y,4,"0");case"M":return h+1;case"MM":return b.s(h+1,2,"0");case"MMM":return w(a.monthsShort,h,S,3);case"MMMM":return w(S,h);case"D":return s.$D;case"DD":return b.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return w(a.weekdaysMin,s.$W,v,2);case"ddd":return w(a.weekdaysShort,s.$W,v,3);case"dddd":return v[s.$W];case"H":return String(c);case"HH":return b.s(c,2,"0");case"h":return R(1);case"hh":return R(2);case"a":return P(c,u,!0);case"A":return P(c,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(s.$s);case"ss":return b.s(s.$s,2,"0");case"SSS":return b.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Bn,function(C,M){return M||W(C)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=b.p(s),c=T(n),u=(c.utcOffset()-this.utcOffset())*ut,h=this-c,v=function(){return b.m(i,c)},S;switch(o){case G:S=v()/12;break;case F:S=v();break;case Pt:S=v()/3;break;case Ye:S=(h-u)/Ln;break;case Y:S=(h-u)/zn;break;case _e:S=h/Ft;break;case ve:S=h/ut;break;case ge:S=h/ye;break;default:S=h;break}return a?S:b.a(S)},e.daysInMonth=function(){return this.endOf(F).$D},e.$locale=function(){return ae[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=qe(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return b.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},r}(),Lt=Ge.prototype;T.prototype=Lt,[["$ms",dt],["$s",ge],["$m",ve],["$H",_e],["$W",Y],["$M",F],["$y",G],["$D",xe]].forEach(function(r){Lt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),T.extend=function(r,e){return r.$i||(r(e,Ge,T),r.$i=!0),T},T.locale=qe,T.isDayjs=ht,T.unix=function(r){return T(r*1e3)},T.en=ae[Fe],T.Ls=ae,T.p={};var rs=function(r,e){var t=e.prototype,n=t.format;t.format=function(s){var a=this,i=this.$locale();if(!this.isValid())return n.bind(this)(s);var o=this.$utils(),c=s||Wt,u=c.replace(/\\[([^\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return i.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return i.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return n.bind(this)(u)}},ns="isoweek",ss=function(r,e,t){var n=function(c,u){var h=(u?t.utc:t)().year(c).startOf(G),v=4-h.isoWeekday();return h.isoWeekday()>4&&(v+=7),h.add(v,Y)},s=function(c){return c.add(4-c.isoWeekday(),Y)},a=e.prototype;a.isoWeekYear=function(){var o=s(this);return o.year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add((o-this.isoWeek())*7,Y);var c=s(this),u=n(this.isoWeekYear(),this.$u);return c.diff(u,Ye)+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var i=a.startOf;a.startOf=function(o,c){var u=this.$utils(),h=u.u(c)?!0:c,v=u.p(o);return v===ns?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):i.bind(this)(o,c)}};T.extend(ss),T.extend(rs);const ft="GGGG-[W]WW",Qe=class Qe{constructor(){this.yearMonthDayCache=new Map,this.yearWeekCache=new Map,this.yearMonthCache=new Map,this.yearCache=new Map}getYearMonthDay(e){return this.yearMonthDayCache.has(e)||this.yearMonthDayCache.set(e,ie.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,ce.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,oe.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ue.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};Qe.instance=new Qe;let mt=Qe;class ie{constructor(e,t,n,s){this.yearNumber=e,this.monthNumber=t,this.dayNumber=n,this.cache=s,this.type="YearMonthDay",this.date=new Date(this.yearNumber,this.monthNumber-1,this.dayNumber),this.dayjs=T(this.date),this.dateString=this.toString()}get text(){return this.dayjs.format("YYYY-MM-DD")}toString(){return this.text}englishName(){return this.dayjs.format("dddd, MMMM D, YYYY")}get firstDay(){return this}get lastDay(){return this}get year(){return this.cache.getYear(`${this.yearNumber}`)}get month(){return this.cache.getYearMonth(this.dayjs.format("YYYY-MM"))}get week(){return this.cache.getYearWeek(this.dayjs.format(ft))}addDays(e){const n=this.dayjs.add(e,"day").format("YYYY-MM-DD");return this.cache.getYearMonthDay(n)}minus(e){return this.dayjs.diff(e.dayjs,"day")}static parse(e,t){const[n,s,a]=e.split("-").map(i=>parseInt(i,10));return new ie(n,s,a,t)}}class oe{constructor(e,t,n){this.isoYearNumber=e,this.isoWeekNumber=t,this.cache=n,this.type="YearWeek",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format(ft)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=T().year(this.isoYearNumber).month(1).date(4).isoWeek(this.isoWeekNumber).startOf("isoWeek");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get lastDay(){const e=this.firstDay.dayjs.add(6,"days");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.isoYearNumber}`)}addWeeks(e){const n=this.firstDay.dayjs.add(e,"week").format(ft);return this.cache.getYearWeek(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"week")}static parse(e,t){const[n,s]=e.split("-W").map(a=>parseInt(a,10));return new oe(n,s,t)}}class ce{constructor(e,t,n){this.yearNumber=e,this.monthNumber=t,this.cache=n,this.type="YearMonth",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY-MM")}toString(){return this.text}englishName(){return`${as(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).endOf("month").format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.yearNumber}`)}addMonths(e){const n=this.firstDay.dayjs.add(e,"month").format("YYYY-MM");return this.cache.getYearMonth(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"month")}static parse(e,t){const[n,s]=e.split("-").map(a=>parseInt(a,10));return new ce(n,s,t)}}class ue{constructor(e,t){this.year=e,this.cache=t,this.type="Year",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY")}toString(){return this.text}englishName(){return this.year.toString()}get firstMonth(){return this.cache.getYearMonth(`${this.year}-01`)}get lastMonth(){return this.cache.getYearMonth(`${this.year}-12`)}get firstDay(){return this.firstMonth.firstDay}get lastDay(){return this.lastMonth.lastDay}addYears(e){const n=this.firstDay.dayjs.add(e,"year").format("YYYY");return this.cache.getYear(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"year")}static parse(e,t){const n=parseInt(e,10);return new ue(n,t)}}function as(r){return T().month(r-1).format("MMMM")}function Ut(r){switch(r.type){case"YearMonthDay":return{type:"YearMonthDay",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dayNumber:r.dayNumber,dateString:r.dateString};case"YearWeek":return{type:"YearWeek",isoYearNumber:r.isoYearNumber,isoWeekNumber:r.isoWeekNumber,dateString:r.dateString};case"YearMonth":return{type:"YearMonth",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dateString:r.dateString};case"Year":return{type:"Year",year:r.year,dateString:r.dateString}}}function is(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function os(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function cs(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function us(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Bt(r,e){if(r===null||e===null)return[];if(r instanceof ie&&e instanceof ie)return is(r,e);if(r instanceof oe&&e instanceof oe)return os(r,e);if(r instanceof ce&&e instanceof ce)return cs(r,e);if(r instanceof ue&&e instanceof ue)return us(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function ds(r,e){if(r instanceof ie&&e instanceof ie||r instanceof oe&&e instanceof oe||r instanceof ce&&e instanceof ce||r instanceof ue&&e instanceof ue)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function Je(r,e){if(r===null)return 1;if(e===null)return-1;const t=ds(r,e);return t<0?-1:t>0?1:0}function ls(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||Je(n,e)<0)&&(e=n),(t===null||Je(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function Pe(r,e){const n=mt.getInstance().getYearMonthDay(r);switch(e){case"day":return n;case"week":return n.week;case"month":return n.month;case"year":return n.year}}function hs(r,e){return r.dateRange===null?1:e.dateRange===null?-1:Je(r.dateRange,e.dateRange)}function fs(r,e){return{dateRange:r.date===null?null:Pe(r.date,e),count:r.count}}const Ht="ACGTRYKMSWBDHVN",qt="ACDEFGHIKLMNPQRSTVWY";function Gt(r){const e="(?<segment>[A-Z0-9_-]+):";return r?`(${e})?`:e}function pt(r,e){const t=r==="nucleotide"?Ht:qt;return new RegExp(`^${Gt(e)}(?<valueAtReference>[${t}*])?(?<position>\\\\d+)(?<substitutionValue>[${t}.*])?$`,"i")}const ms=pt("nucleotide",!0),ps=pt("aminoAcid",!1),ys=pt("aminoAcid",!0);class ke{constructor(e,t,n,s){this.segment=e,this.valueAtReference=t,this.substitutionValue=n,this.position=s,this.type="substitution";const a=this.segment?`${this.segment}:`:"",i=this.valueAtReference??"",o=this.substitutionValue??"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof ke?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.substitutionValue===e.substitutionValue&&this.position===e.position:!1}toString(){return this.code}static parse(e,t=!1){const n=ms.exec(e),s=ps.exec(e),a=t?ys.exec(e):void 0,i=n??s??a;return(i==null?void 0:i.groups)===void 0?null:new ke(i.groups.segment,i.groups.valueAtReference,i.groups.substitutionValue,parseInt(i.groups.position,10))}}function Jt(r){const e=r==="nucleotide"?Ht:qt;return new RegExp(`^${Gt(r==="nucleotide")}(?<valueAtReference>[${e}*])?(?<position>\\\\d+)(-)$`,"i")}const gs=Jt("nucleotide"),vs=Jt("aminoAcid");class be{constructor(e,t,n){this.segment=e,this.valueAtReference=t,this.position=n,this.type="deletion";const s=this.segment?`${this.segment}:`:"",a=this.valueAtReference??"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof be?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=gs.exec(e),n=vs.exec(e),s=t??n;return(s==null?void 0:s.groups)===void 0?null:new be(s.groups.segment,s.groups.valueAtReference,parseInt(s.groups.position,10))}}function Kt(r){switch(r.type){case"substitution":return{type:"substitution",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference,substitutionValue:r.substitutionValue};case"deletion":return{type:"deletion",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference}}}class _s{constructor(e,t,n){this.filter=e,this.sequenceType=t,this.minProportion=n}async evaluate(e,t){return{content:(await this.fetchMutations(e,t)).map(({count:a,proportion:i,mutationFrom:o,mutationTo:c,position:u,sequenceName:h})=>c==="-"?{type:"deletion",mutation:new be(h??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new ke(h??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return Nn(e,n,this.sequenceType,t).then(s=>s.data)}}var Qt;Qt={__e:function(r,e,t,n){for(var s,a,i;e=e.__;)if((s=e.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(r)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(r,n||{}),i=s.__d),i)return s.__E=s}catch(o){r=o}throw r}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var U,yt,Xt,er=[],D=Qt,tr=D.__b,rr=D.__r,nr=D.diffed,sr=D.__c,ar=D.unmount,ir=D.__;function xs(){for(var r;r=er.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Ke),r.__H.__h.forEach(gt),r.__H.__h=[]}catch(e){r.__H.__h=[],D.__e(e,r.__v)}}D.__b=function(r){U=null,tr&&tr(r)},D.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),ir&&ir(r,e)},D.__r=function(r){rr&&rr(r);var e=(U=r.__c).__H;e&&(yt===U?(e.__h=[],U.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ke),e.__h.forEach(gt),e.__h=[])),yt=U},D.diffed=function(r){nr&&nr(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(er.push(e)!==1&&Xt===D.requestAnimationFrame||((Xt=D.requestAnimationFrame)||ks)(xs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),yt=U=null},D.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Ke),t.__h=t.__h.filter(function(n){return!n.__||gt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],D.__e(n,t.__v)}}),sr&&sr(r,e)},D.unmount=function(r){ar&&ar(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Ke(n)}catch(s){e=s}}),t.__H=void 0,e&&D.__e(e,t.__v))};var or=typeof requestAnimationFrame=="function";function ks(r){var e,t=function(){clearTimeout(n),or&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);or&&(e=requestAnimationFrame(t))}function Ke(r){var e=U,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),U=e}function gt(r){var e=U;r.__c=r.__(),U=e}class cr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class bs{constructor(e,t,n){this.serializeFirstAxis=e,this.serializeSecondAxis=t,this.data=new Map,this.keysFirstAxis=new Map,this.keysSecondAxis=new Map,n&&(this.keysFirstAxis=new Map(n.keysFirstAxis),this.keysSecondAxis=new Map(n.keysSecondAxis),this.data=new Map(n.data))}get(e,t){var a;const n=this.serializeFirstAxis(e),s=this.serializeSecondAxis(t);return(a=this.data.get(n))==null?void 0:a.get(s)}getRow(e){const t=this.serializeFirstAxis(e),n=this.data.get(t);return n===void 0?[]:Array.from(this.keysSecondAxis.keys()).map(s=>n.get(s))}set(e,t,n){const s=this.serializeFirstAxis(e),a=this.serializeSecondAxis(t);this.data.has(s)||this.data.set(s,new Map),this.data.get(s).set(a,n),this.keysFirstAxis.set(s,e),this.keysSecondAxis.set(a,t)}deleteRow(e){const t=this.serializeFirstAxis(e);this.data.delete(t),this.keysFirstAxis.delete(t)}getFirstAxisKeys(){return Array.from(this.keysFirstAxis.values())}getSecondAxisKeys(){return Array.from(this.keysSecondAxis.values())}getAsArray(){return this.getFirstAxisKeys().map(e=>this.getSecondAxisKeys().map(t=>this.get(e,t)))}getContents(){return{keysFirstAxis:this.keysFirstAxis,keysSecondAxis:this.keysSecondAxis,data:this.data}}}class ur extends bs{constructor(e){super(Is,Zs,e)}}const dr=(r,e)=>{if(r.segment!==e.segment)return ws(r.segment,e.segment);if(r.position!==e.position)return Ss(r.position,e.position);const t=r.type==="deletion",n=e.type==="deletion";return t!==n?t?1:-1:!t&&!n&&r.substitutionValue!==e.substitutionValue?Ts(r.substitutionValue,e.substitutionValue):0},ws=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),Ss=(r,e)=>r-e,Ts=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),lr=200,As=.001;function hr(r){const e=be.parse(r);if(e)return{type:"deletion",mutation:e,count:0,proportion:0};const t=ke.parse(r);return t?{type:"substitution",mutation:t,count:0,proportion:0}:null}async function $s({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,includeMutations:a,signal:i}){const o=await fr(r,t,n,s,i);if(o.length===0)return a?{content:a.map(hr).filter(h=>h!==null)}:{content:[]};const c={...r,[`${s}From`]:o[0].firstDay.toString(),[`${s}To`]:o[o.length-1].lastDay.toString()};let u=mr(c,e).evaluate(t,i);return a&&(u=u.then(h=>({content:a.map(v=>h.content.find($=>$.mutation.code===v)??hr(v)).filter(v=>v!==null)}))),u}async function Ms(r){const{lapisFilter:e,displayMutations:t,sequenceType:n,lapis:s,lapisDateField:a,granularity:i,useNewEndpoint:o,signal:c}=r,u=await fr(e,s,i,a,c);if(u.length>lr)throw new cr("Too many dates",`The dataset would contain ${u.length} date intervals. Please reduce the number to below ${lr} to display the data. You can achieve this by either narrowing the date range in the provided LAPIS filter or by selecting a larger granularity.`);const h=$s({lapisFilter:e,sequenceType:n,lapis:s,lapisDateField:a,includeMutations:t,granularity:i}).then(v=>v.content);return o===!0?Os(u,h,r):Ds(u,h,r)}async function Ds(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=r.map(async h=>{const v=h.firstDay.toString(),S=h.lastDay.toString(),$={...t,[`${a}From`]:v,[`${a}To`]:S},[w,R]=await Promise.all([mr($,n).evaluate(s,i),Ys($).evaluate(s,i)]);return{date:h,mutations:w.content,totalCount:R.content[0].count}}),c=await Promise.all(o),u=await e;return{mutationOverTimeData:js(c,u),overallMutationData:u}}async function Os(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=await e;o.sort((w,R)=>dr(w.mutation,R.mutation));const c=o.map(w=>w.mutation.code),u=await Rn(s,{filters:t,dateRanges:r.map(w=>({dateFrom:w.firstDay.toString(),dateTo:w.lastDay.toString()})),includeMutations:c,dateField:a},n,i),h=u.data.totalCountsByDateRange,v=u.data.mutations.map(Ns),S=v.map((w,R)=>{const P={count:o[R].count,proportion:o[R].proportion};return w.type==="deletion"?{type:"deletion",mutation:w,...P}:{type:"substitution",mutation:w,...P}}),$={keysFirstAxis:new Map(v.map(w=>[w.code,w])),keysSecondAxis:new Map(r.map(w=>[w.dateString,w])),data:new Map(v.map((w,R)=>[w.code,new Map(r.map((P,W)=>{if(h[W]===0)return[P.dateString,null];const C=u.data.data[R][W].count,M=u.data.data[R][W].coverage,J=h[W];return M===0?[P.dateString,{type:"belowThreshold",totalCount:J}]:[P.dateString,{type:"valueWithCoverage",count:C,coverage:M,totalCount:J}]}))]))};return{mutationOverTimeData:new ur($),overallMutationData:S}}function Ns(r){const e=be.parse(r);if(e)return e;const t=ke.parse(r);if(t)return t;throw Error(`Given code is not valid: ${r}`)}async function fr(r,e,t,n,s){const{dateFrom:a,dateTo:i}=Rs(r,n,t);if(a!==null&&i!==null)return Bt(a,i);const{content:o}=await Es(r,e,t,n,s),{min:c,max:u}=ls(o);return Bt(a??c,i??u)}function Rs(r,e,t){const n=r[e];if(n)return{dateFrom:Pe(n,t),dateTo:Pe(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?Pe(s,t):null,dateTo:a?Pe(a,t):null}}function Es(r,e,t,n,s){return Cs(r,t,n).evaluate(e,s)}function Cs(r,e,t){const n=new It(r,[t]),s=new Pn(n,t,"date"),a=new ct(s,c=>fs(c,e)),i=new Fn(a,"dateRange","count"),o=new Wn(i,hs);return new ct(o,c=>c.dateRange)}function mr(r,e){return new _s(r,e,As)}function Is(r){return r.code}function Zs(r){return r.dateString}function js(r,e){const t=new ur,n=r.map(i=>i.date),s=e.sort((i,o)=>dr(i.mutation,o.mutation)).map(i=>Kt(i.mutation)),a=n.sort((i,o)=>Je(i,o)).map(i=>Ut(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Ut(i.date);i.mutations.forEach(c=>{const u=Kt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{type:"value",count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{type:"belowThreshold",totalCount:i.totalCount})}),t}function Ys(r){return new It(r)}async function Fs(r){try{postMessage({status:"loading"});const e=await r();postMessage({status:"success",data:e})}catch(e){postMessage(e instanceof cr?{status:"error",userFacing:!0,headline:e.headline,error:e}:{status:"error",userFacing:!1,error:e instanceof Error?e:new Error(`${e}`)})}}async function Ps(r){const e=await Ms(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await Fs(()=>Ps(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-AhhjjklP.js.map\n', qb = typeof self < "u" && self.Blob && new Blob([mk], { type: "text/javascript;charset=utf-8" });
25974
25975
  function A$(n) {
25975
25976
  let e;
25976
25977
  try {