@aranova/tracking-browser 0.7.2 → 0.8.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.
package/README.md CHANGED
@@ -13,7 +13,7 @@ Place the script in the document `<head>` before the rest of the page can run.
13
13
  <script>
14
14
  window.AranovaTracking.init({
15
15
  apiKey: 'aranv_pk_...',
16
- endpoint: 'https://api.internal.aranova.io/tracking',
16
+ endpoint: 'https://aranovainternal-production.up.railway.app/tracking',
17
17
  gtagId: 'AW-XXXXXXXXXX',
18
18
  renderConsentBanner: true,
19
19
  triggers: {
@@ -46,7 +46,7 @@ To install multiple Google Ads tags simultaneously (for example a production MCC
46
46
  <script>
47
47
  window.AranovaTracking.init({
48
48
  apiKey: 'aranv_pk_...',
49
- endpoint: 'https://api.internal.aranova.io/tracking',
49
+ endpoint: 'https://aranovainternal-production.up.railway.app/tracking',
50
50
  environment: 'production', // 'production' | 'development'
51
51
  gtagIds: {
52
52
  production: 'AW-111111111', // real client account
@@ -130,8 +130,14 @@ window.AranovaTracking.getTrackingParams();
130
130
  window.AranovaTracking.getConsentState();
131
131
  window.AranovaTracking.setConsentState('granted');
132
132
  window.AranovaTracking.setConsentState('denied');
133
+ window.AranovaTracking.sales().record({ ... }); // record a sale / conversion
133
134
  ```
134
135
 
136
+ `sales()` returns a client bound to the **public** key and endpoint you passed to
137
+ `init()`, so it can only **write** conversions (`record`). Reading, listing,
138
+ updating, and deleting sales require a **secret** key (`aranv_sk_…`) and must run
139
+ server-side — see the [sales-tracking guide](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/sales-tracking.md).
140
+
135
141
  ## Automatic Events
136
142
 
137
143
  Configured automatic events are fired by the SDK:
@@ -1,2 +1,2 @@
1
- "use strict";var AranovaTracking=(()=>{var Ye=Object.defineProperty;var jn=Object.getOwnPropertyDescriptor;var Vn=Object.getOwnPropertyNames;var Dn=Object.prototype.hasOwnProperty;var Ot=(t,e)=>{for(var n in e)Ye(t,n,{get:e[n],enumerable:!0})},Ln=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Vn(e))!Dn.call(t,a)&&a!==n&&Ye(t,a,{get:()=>e[a],enumerable:!(r=jn(e,a))||r.enumerable});return t};var zn=t=>Ln(Ye({},"__esModule",{value:!0}),t);var ga={};Ot(ga,{default:()=>ma,init:()=>On});var Mt="0.7.2";var We="consent_state",Nt="consent_timestamp";function qe(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function G(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(We);return t==="granted"||t==="denied"?t:"pending"}function pe(t){typeof window>"u"||(window.localStorage.setItem(We,t),window.localStorage.setItem(Nt,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",qe(t)))}function Me(){let t=G();return(t==="granted"||t==="denied")&&pe(t),t}var jt="https://www.googletagmanager.com/gtag/js",Je="data-aranova-tracking";function Fn(t){return`aranova-${t}`}var Hn=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function Xe(t){return Hn.test(t)}function Ne(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function Qe(){Ne()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function et(t){if(typeof document>"u")return;let e=Fn("gtag-loader");if(document.querySelector(`script[${Je}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${jt}?id=${encodeURIComponent(t)}`,r.setAttribute(Je,e),document.head.appendChild(r)}function Vt(t){let e=Ne();e("js",new Date),e("config",t)}function tt(t){typeof window>"u"||typeof document>"u"||Xe(t)&&(Qe(),et(t),Vt(t),Me())}function nt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(Xe);if(e.length===0)return;Qe(),et(e[0]);let n=Ne();n("js",new Date);for(let r of e)n("config",r);Me()}var rt=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function je(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function at(t){return typeof t=="string"&&t.length>0?t:null}function me(t){return rt.reduce((e,n)=>(e[n]=at(t(n)),e),je())}function Dt(t){return rt.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}function ge(t){if(typeof document>"u")return null;let n=(document.cookie?document.cookie.split("; "):[]).find(a=>a.startsWith(`${t}=`));if(!n)return null;let[,r=""]=n.split("=");return at(decodeURIComponent(r))}function Lt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function zt(t,e=7776e3){let n=Dt(t);return Object.entries(n).forEach(([r,a])=>{Lt(r,a,e)}),n}function he(t=typeof window>"u"?"":window.location.href,e=7776e3){let n=typeof window>"u"?new URL(t||"https://example.invalid"):new URL(t,window.location.origin);return zt(n.searchParams,e),me(ge)}var it="aranova_tracking_visitor",Ve="aranova_tracking_session";function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`}function $t(t){try{return window.localStorage.getItem(t)}catch{return null}}function st(t,e){try{window.localStorage.setItem(t,e)}catch{}}function ot(){if(typeof window>"u")return De();let t=$t(it);if(t&&t.length>0)return t;let e=De();return st(it,e),e}function ye(t=Date.now()){if(typeof window>"u")return{id:De(),isNew:!0};let e=$t(Ve);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=18e5){let a={id:r.id,last_event_at:t};return st(Ve,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:De(),last_event_at:t};return st(Ve,JSON.stringify(n)),{id:n.id,isNew:!0}}var d={};Ot(d,{BRAND:()=>mr,DIRTY:()=>J,EMPTY_PATH:()=>Gn,INVALID:()=>h,NEVER:()=>Xr,OK:()=>R,ParseStatus:()=>E,Schema:()=>k,ZodAny:()=>W,ZodArray:()=>K,ZodBigInt:()=>Q,ZodBoolean:()=>ee,ZodBranded:()=>Ae,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>$e,ZodEffects:()=>j,ZodEnum:()=>ce,ZodError:()=>A,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>He,ZodIntersection:()=>ie,ZodIssueCode:()=>u,ZodLazy:()=>se,ZodLiteral:()=>oe,ZodMap:()=>we,ZodNaN:()=>be,ZodNativeEnum:()=>de,ZodNever:()=>V,ZodNull:()=>re,ZodNullable:()=>$,ZodNumber:()=>X,ZodObject:()=>I,ZodOptional:()=>M,ZodParsedType:()=>m,ZodPipeline:()=>Ie,ZodPromise:()=>q,ZodReadonly:()=>fe,ZodRecord:()=>Fe,ZodSchema:()=>k,ZodSet:()=>Te,ZodString:()=>Y,ZodSymbol:()=>ke,ZodTransformer:()=>j,ZodTuple:()=>z,ZodType:()=>k,ZodUndefined:()=>ne,ZodUnion:()=>ae,ZodUnknown:()=>Z,ZodVoid:()=>xe,addIssueToContext:()=>p,any:()=>wr,array:()=>Er,bigint:()=>_r,boolean:()=>Jt,coerce:()=>Jr,custom:()=>Yt,date:()=>vr,datetimeRegex:()=>Gt,defaultErrorMap:()=>H,discriminatedUnion:()=>Pr,effect:()=>Ur,enum:()=>$r,function:()=>Dr,getErrorMap:()=>_e,getParsedType:()=>L,instanceof:()=>hr,intersection:()=>Or,isAborted:()=>Le,isAsync:()=>ve,isDirty:()=>ze,isValid:()=>B,late:()=>gr,lazy:()=>Lr,literal:()=>zr,makeIssue:()=>Re,map:()=>jr,nan:()=>yr,nativeEnum:()=>Fr,never:()=>br,null:()=>xr,nullable:()=>Kr,number:()=>qt,object:()=>Rr,objectUtil:()=>ct,oboolean:()=>qr,onumber:()=>Wr,optional:()=>Zr,ostring:()=>Yr,pipeline:()=>Br,preprocess:()=>Gr,promise:()=>Hr,quotelessJson:()=>Un,record:()=>Nr,set:()=>Vr,setErrorMap:()=>Kn,strictObject:()=>Ar,string:()=>Wt,symbol:()=>Sr,transformer:()=>Ur,tuple:()=>Mr,undefined:()=>kr,union:()=>Ir,unknown:()=>Tr,util:()=>x,void:()=>Cr});var x;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let i={};for(let s of a)i[s]=s;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return t.objectValues(s)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(let s of a)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(x||(x={}));var ct;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ct||(ct={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?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(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}};var u=x.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"]),Un=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),A=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},a=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return a(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};A.create=t=>new A(t);var Zn=(t,e)=>{let n;switch(t.code){case u.invalid_type:t.received===m.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case u.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:n=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case u.invalid_union:n="Invalid input";break;case u.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case u.invalid_enum_value:n=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case u.invalid_arguments:n="Invalid function arguments";break;case u.invalid_return_type:n="Invalid function return type";break;case u.invalid_date:n="Invalid date";break;case u.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:x.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case u.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case u.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case u.custom:n="Invalid input";break;case u.invalid_intersection_types:n="Intersection results could not be merged";break;case u.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case u.not_finite:n="Number must be finite";break;default:n=e.defaultError,x.assertNever(t)}return{message:n}},H=Zn;var Ft=H;function Kn(t){Ft=t}function _e(){return Ft}var Re=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)o=c(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}},Gn=[];function p(t,e){let n=_e(),r=Re({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===H?void 0:H].filter(a=>!!a)});t.common.issues.push(r)}var E=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let a of n){if(a.status==="aborted")return h;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n){let i=await a.key,s=await a.value;r.push({key:i,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return h;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),J=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),Le=t=>t.status==="aborted",ze=t=>t.status==="dirty",B=t=>t.status==="valid",ve=t=>typeof Promise<"u"&&t instanceof Promise;var g;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));var N=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}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}},Ht=(t,e)=>{if(B(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new A(t.common.issues);return this._error=n,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:a}}var k=class{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ve(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Ht(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return B(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>B(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ve(a)?a:Promise.resolve(a));return Ht(r,i)}refine(e,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let s=e(a),o=()=>i.addIssue({code:u.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new j({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return M.create(this,this._def)}nullable(){return $.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return q.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new j({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ue({..._(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Ae({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new le({..._(this._def),innerType:this,catchValue:n,typeName:y.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bn=/^c[^\s-]{8,}$/i,Yn=/^[0-9a-z]+$/,Wn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qn=/^[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,Jn=/^[a-z0-9_-]{21}$/i,Xn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qn=/^[-+]?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)?)??$/,er=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dt,nr=/^(?:(?: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])$/,rr=/^(?:(?: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])$/,ar=/^(([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]))$/,ir=/^(([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])$/,sr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,or=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zt="((\\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(`^${Zt}$`);function Kt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function dr(t){return new RegExp(`^${Kt(t)}$`)}function Gt(t){let e=`${Zt}T${Kt(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ur(t,e){return!!((e==="v4"||!e)&&nr.test(t)||(e==="v6"||!e)&&ar.test(t))}function lr(t,e){if(!Xn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function fr(t,e){return!!((e==="v4"||!e)&&rr.test(t)||(e==="v6"||!e)&&ir.test(t))}var Y=class t extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let i=this._getOrReturnCtx(e);return p(i,{code:u.invalid_type,expected:m.string,received:i.parsedType}),h}let r=new E,a;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?p(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")er.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")dt||(dt=new RegExp(tr,"u")),dt.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")qn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Jn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Bn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Yn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Wn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),p(a,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Gt(i).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?cr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?dr(i).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Qn.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ur(e.data,i.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?lr(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?fr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?sr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?or.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):x.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:u.invalid_string,...g.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(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?.precision>"u"?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...g.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...g.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...g.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...g.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...g.errToObj(n)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Y.create=t=>new Y({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});function pr(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}var X=class t extends k{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){let i=this._getOrReturnCtx(e);return p(i,{code:u.invalid_type,expected:m.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?pr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:u.not_finite,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};X.create=t=>new X({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var Q=class t extends k{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 r,a=new E;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),p(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return p(n,{code:u.invalid_type,expected:m.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Q.create=t=>new Q({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var ee=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.boolean,received:r.parsedType}),h}return R(e.data)}};ee.create=t=>new ee({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var te=class t extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let i=this._getOrReturnCtx(e);return p(i,{code:u.invalid_type,expected:m.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return p(i,{code:u.invalid_date}),h}let r=new E,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):x.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};te.create=t=>new te({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var ke=class extends k{_parse(e){if(this._getType(e)!==m.symbol){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.symbol,received:r.parsedType}),h}return R(e.data)}};ke.create=t=>new ke({typeName:y.ZodSymbol,..._(t)});var ne=class extends k{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.undefined,received:r.parsedType}),h}return R(e.data)}};ne.create=t=>new ne({typeName:y.ZodUndefined,..._(t)});var re=class extends k{_parse(e){if(this._getType(e)!==m.null){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.null,received:r.parsedType}),h}return R(e.data)}};re.create=t=>new re({typeName:y.ZodNull,..._(t)});var W=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};W.create=t=>new W({typeName:y.ZodAny,..._(t)});var Z=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};Z.create=t=>new Z({typeName:y.ZodUnknown,..._(t)});var V=class extends k{_parse(e){let n=this._getOrReturnCtx(e);return p(n,{code:u.invalid_type,expected:m.never,received:n.parsedType}),h}};V.create=t=>new V({typeName:y.ZodNever,..._(t)});var xe=class extends k{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.void,received:r.parsedType}),h}return R(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});var K=class t extends k{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==m.array)return p(n,{code:u.invalid_type,expected:m.array,received:n.parsedType}),h;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(p(n,{code:s?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(p(n,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(p(n,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new N(n,s,n.path,o)))).then(s=>E.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new N(n,s,n.path,o)));return E.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:g.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};K.create=(t,e)=>new K({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function Se(t){if(t instanceof I){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=M.create(Se(r))}return new I({...t._def,shape:()=>e})}else return t instanceof K?new K({...t._def,type:Se(t.element)}):t instanceof M?M.create(Se(t.unwrap())):t instanceof $?$.create(Se(t.unwrap())):t instanceof z?z.create(t.items.map(e=>Se(e))):t}var I=class t extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=x.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==m.object){let c=this._getOrReturnCtx(e);return p(c,{code:u.invalid_type,expected:m.object,received:c.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let c in a.data)s.includes(c)||o.push(c);let l=[];for(let c of s){let f=i[c],S=a.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new N(a,S,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof V){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:a.data[f]}});else if(c==="strict")o.length>0&&(p(a,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of o){let S=a.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new N(a,S,a.path,f)),alwaysSet:f in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of l){let S=await f.key,w=await f.value;c.push({key:S,value:w,alwaysSet:f.alwaysSet})}return c}).then(c=>E.mergeObjectSync(r,c)):E.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of x.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of x.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Se(this)}partial(e){let n={};for(let r of x.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of x.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof M;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return Bt(x.objectKeys(this.shape))}};I.create=(t,e)=>new I({shape:()=>t,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,..._(e)});I.strictCreate=(t,e)=>new I({shape:()=>t,unknownKeys:"strict",catchall:V.create(),typeName:y.ZodObject,..._(e)});I.lazycreate=(t,e)=>new I({shape:t,unknownKeys:"strip",catchall:V.create(),typeName:y.ZodObject,..._(e)});var ae=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new A(o.ctx.common.issues));return p(n,{code:u.invalid_union,unionErrors:s}),h}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(l=>new A(l));return p(n,{code:u.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};ae.create=(t,e)=>new ae({options:t,typeName:y.ZodUnion,..._(e)});var U=t=>t instanceof se?U(t.schema):t instanceof j?U(t.innerType()):t instanceof oe?[t.value]:t instanceof ce?t.options:t instanceof de?x.objectValues(t.enum):t instanceof ue?U(t._def.innerType):t instanceof ne?[void 0]:t instanceof re?[null]:t instanceof M?[void 0,...U(t.unwrap())]:t instanceof $?[null,...U(t.unwrap())]:t instanceof Ae||t instanceof fe?U(t.unwrap()):t instanceof le?U(t._def.innerType):[],$e=class t extends k{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:u.invalid_type,expected:m.object,received:n.parsedType}),h;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(p(n,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let a=new Map;for(let i of n){let s=U(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function ut(t,e){let n=L(t),r=L(e);if(t===e)return{valid:!0,data:t};if(n===m.object&&r===m.object){let a=x.objectKeys(e),i=x.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(let o of i){let l=ut(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===m.array&&r===m.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let s=t[i],o=e[i],l=ut(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===m.date&&r===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ie=class extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(Le(i)||Le(s))return h;let o=ut(i.value,s.value);return o.valid?((ze(i)||ze(s))&&n.dirty(),{status:n.value,value:o.data}):(p(r,{code:u.invalid_intersection_types}),h)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ie.create=(t,e,n)=>new ie({left:t,right:e,typeName:y.ZodIntersection,..._(n)});var z=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return p(r,{code:u.invalid_type,expected:m.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return p(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(p(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new N(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>E.mergeArray(n,s)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var Fe=class t extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return p(r,{code:u.invalid_type,expected:m.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new N(r,o,r.path,o)),value:s._parse(new N(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?E.mergeObjectAsync(n,a):E.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof k?new t({keyType:e,valueType:n,typeName:y.ZodRecord,..._(r)}):new t({keyType:Y.create(),valueType:e,typeName:y.ZodRecord,..._(n)})}},we=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.map)return p(r,{code:u.invalid_type,expected:m.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,l],c)=>({key:a._parse(new N(r,o,r.path,[c,"key"])),value:i._parse(new N(r,l,r.path,[c,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return h;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),o.set(c.value,f.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let l of s){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return h;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),o.set(c.value,f.value)}return{status:n.value,value:o}}}};we.create=(t,e,n)=>new we({valueType:e,keyType:t,typeName:y.ZodMap,..._(n)});var Te=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return p(r,{code:u.invalid_type,expected:m.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(p(r,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(p(r,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let f of l){if(f.status==="aborted")return h;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}let o=[...r.data.values()].map((l,c)=>i._parse(new N(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Te.create=(t,e)=>new Te({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var He=class t extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.function)return p(n,{code:u.invalid_type,expected:m.function,received:n.parsedType}),h;function r(o,l){return Re({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:u.invalid_arguments,argumentsError:l}})}function a(o,l){return Re({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:u.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof q){let o=this;return R(async function(...l){let c=new A([]),f=await o._def.args.parseAsync(l,i).catch(C=>{throw c.addIssue(r(l,C)),c}),S=await Reflect.apply(s,this,f);return await o._def.returns._def.type.parseAsync(S,i).catch(C=>{throw c.addIssue(a(S,C)),c})})}else{let o=this;return R(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new A([r(l,c.error)]);let f=Reflect.apply(s,this,c.data),S=o._def.returns.safeParse(f,i);if(!S.success)throw new A([a(f,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:z.create(e).rest(Z.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||z.create([]).rest(Z.create()),returns:n||Z.create(),typeName:y.ZodFunction,..._(r)})}},se=class extends k{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};se.create=(t,e)=>new se({getter:t,typeName:y.ZodLazy,..._(e)});var oe=class extends k{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return p(n,{received:n.data,code:u.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(t,e)=>new oe({value:t,typeName:y.ZodLiteral,..._(e)});function Bt(t,e){return new ce({values:t,typeName:y.ZodEnum,..._(e)})}var ce=class t extends k{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return p(n,{expected:x.joinValues(r),received:n.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return p(n,{received:n.data,code:u.invalid_enum_value,options:r}),h}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ce.create=Bt;var de=class extends k{_parse(e){let n=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==m.string&&r.parsedType!==m.number){let a=x.objectValues(n);return p(r,{expected:x.joinValues(a),received:r.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=x.objectValues(n);return p(r,{received:r.data,code:u.invalid_enum_value,options:a}),h}return R(e.data)}get enum(){return this._def.values}};de.create=(t,e)=>new de({values:t,typeName:y.ZodNativeEnum,..._(e)});var q=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.promise&&n.common.async===!1)return p(n,{code:u.invalid_type,expected:m.promise,received:n.parsedType}),h;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return R(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};q.create=(t,e)=>new q({type:t,typeName:y.ZodPromise,..._(e)});var j=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{p(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return h;let l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?h:l.status==="dirty"?J(l.value):n.value==="dirty"?J(l.value):l});{if(n.value==="aborted")return h;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?h:o.status==="dirty"?J(o.value):n.value==="dirty"?J(o.value):o}}if(a.type==="refinement"){let s=o=>{let l=a.refinement(o,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(s))return h;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>B(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):h);x.assertNever(a)}};j.create=(t,e,n)=>new j({schema:t,typeName:y.ZodEffects,effect:e,..._(n)});j.createWithPreprocess=(t,e,n)=>new j({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(n)});var M=class extends k{_parse(e){return this._getType(e)===m.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:y.ZodOptional,..._(e)});var $=class extends k{_parse(e){return this._getType(e)===m.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$.create=(t,e)=>new $({innerType:t,typeName:y.ZodNullable,..._(e)});var ue=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===m.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ue.create=(t,e)=>new ue({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var le=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ve(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var be=class extends k{_parse(e){if(this._getType(e)!==m.nan){let r=this._getOrReturnCtx(e);return p(r,{code:u.invalid_type,expected:m.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};be.create=t=>new be({typeName:y.ZodNaN,..._(t)});var mr=Symbol("zod_brand"),Ae=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Ie=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?h:i.status==="dirty"?(n.dirty(),J(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?h:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:y.ZodPipeline})}},fe=class extends k{_parse(e){let n=this._def.innerType._parse(e),r=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return ve(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:y.ZodReadonly,..._(e)});function Ut(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Yt(t,e={},n){return t?W.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=Ut(e,r),l=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:l})}});if(!i){let s=Ut(e,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):W.create()}var gr={object:I.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var hr=(t,e={message:`Input not instance of ${t.name}`})=>Yt(n=>n instanceof t,e),Wt=Y.create,qt=X.create,yr=be.create,_r=Q.create,Jt=ee.create,vr=te.create,Sr=ke.create,kr=ne.create,xr=re.create,wr=W.create,Tr=Z.create,br=V.create,Cr=xe.create,Er=K.create,Rr=I.create,Ar=I.strictCreate,Ir=ae.create,Pr=$e.create,Or=ie.create,Mr=z.create,Nr=Fe.create,jr=we.create,Vr=Te.create,Dr=He.create,Lr=se.create,zr=oe.create,$r=ce.create,Fr=de.create,Hr=q.create,Ur=j.create,Zr=M.create,Kr=$.create,Gr=j.createWithPreprocess,Br=Ie.create,Yr=()=>Wt().optional(),Wr=()=>qt().optional(),qr=()=>Jt().optional(),Jr={string:(t=>Y.create({...t,coerce:!0})),number:(t=>X.create({...t,coerce:!0})),boolean:(t=>ee.create({...t,coerce:!0})),bigint:(t=>Q.create({...t,coerce:!0})),date:(t=>te.create({...t,coerce:!0}))};var Xr=h;var Ue=d.object({page:d.object({title:d.string().nullable(),path:d.string(),search:d.string(),hash:d.string()}).strict(),referrer:d.string().nullable(),viewport:d.object({w:d.number(),h:d.number()}).strict().nullable().optional()}).strict(),Xt=d.object({}).strict();var pt="aranova_tracking_last_fired_url",lt=null,ft=!1;function Qr(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function ea(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function ta(){if(!ft){ft=!0;let t=Qr(pt);t!==null&&(lt=t)}return lt}function na(t){lt=t,ft=!0,ea(pt,t)}function Qt(t){return typeof window>"u"||typeof document>"u"?null:Ue.parse({page:{title:document.title||null,path:window.location.pathname,search:window.location.search,hash:window.location.hash},referrer:t!==void 0?t:document.referrer||null,viewport:{w:window.innerWidth,h:window.innerHeight}})}function Pe(t){if(typeof window>"u")return;let e=window.location.href,n=ta(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,s=Qt(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&na(e)}function mt(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Pe(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function gt(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let c=window.location.pathname+window.location.search;c!==n&&(n=c,Pe(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function s(...c){a(...c),setTimeout(r,0)}function o(...c){i(...c),setTimeout(r,0)}function l(c){c.persisted&&Pe(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",l),e.skipInitial||Pe(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",l)}}function Ze(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(Ze);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ze(r);return e}return t}function ht(t,e,n,r,a=null){let i=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let l={};for(let[c,f]of Object.entries(r.automatic)){let S=Ze(f);Object.keys(S).length>0&&(l[c]=S)}if(r.manual)for(let[c,f]of Object.entries(r.manual)){if(f===void 0)continue;let S=Ze(f);Object.keys(S).length>0&&(l[c]=S)}Object.keys(l).length>0&&(o=l)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:i,manual:s},trigger_config:o,configured_gtag_ids:a}}var tn=2e3,nn=10,Ke=50,rn="X-Aranova-Api-Key",an="X-Aranova-Sdk-Version",sn="X-Aranova-Sdk-Package",on="X-Aranova-Sdk-Surface",cn="X-Aranova-Sdk-Environment";function aa(t,e,n,r,a){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null,environment:r,active_gtag_ids:a}}function ia(){if(typeof window>"u")return je();try{he()}catch{}return me(ge)}function sa(){try{return{state:G()}}catch{return null}}async function en(t,e,n,r,a){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[rn]:n,[an]:r.sdkVersion,[sn]:r.packageName,[on]:r.surface,[cn]:r.environment},body:e,keepalive:a,credentials:"omit",mode:"cors"})}catch{}}function yt(t){let e=t.flushIntervalMs??tn,n=Math.min(t.maxQueueSize??nn,Ke),r=t.sdkVersion??null,a=t.packageName??null,i=t.environment??"production",s=t.activeGtagIds??null,l=`${t.endpoint.replace(/\/$/,"")}/events`,c={sdkVersion:r??"",packageName:a??"",surface:t.surface,environment:i},f=[],S=null,w=null,C=!1,v=ot(),b=ye(),D=b.id;typeof window<"u"&&(w=window.location.href);function Ce(){let T=ht(t.surface,r,a,t.triggers??null,s);f.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:T,occurred_at:new Date().toISOString()})}b.isNew&&Ce();function Pt(){let T=ye();T.isNew&&T.id!==D&&Ce(),D=T.id;let P=ia(),Ee=aa(t.surface,r,a,i,s);return{session_id:D,visitor_id:v,gclid:P.gclid,fbclid:P.fbclid,utm_source:P.utm_source,utm_medium:P.utm_medium,utm_campaign:P.utm_campaign,utm_term:P.utm_term,utm_content:P.utm_content,first_page:w,consent_state:sa(),context:Ee}}function Mn(){S!==null||C||(S=setTimeout(()=>{S=null,Be()},e))}function Ge(){S!==null&&(clearTimeout(S),S=null)}async function Be(){if(f.length===0)return;let T=f.slice(0,Ke);f=f.slice(T.length),Ge();let P={session:Pt(),events:T},Ee=JSON.stringify(P);await en(l,Ee,t.apiKey,c,!1)}function Nn(T){if(C||!T||typeof T.eventType!="string"||T.eventType.length===0)return;let P=T.occurredAt instanceof Date?T.occurredAt.toISOString():typeof T.occurredAt=="string"?T.occurredAt:new Date().toISOString();f.push({event_type:T.eventType,page_url:T.pageUrl??(typeof window>"u"?null:window.location.href),metadata:T.metadata??null,occurred_at:P}),f.length>=n?Be():Mn()}function Oe(){if(f.length===0)return;let T=f.slice(0,Ke);f=f.slice(T.length),Ge();let P={session:Pt(),events:T},Ee=JSON.stringify(P);en(l,Ee,t.apiKey,c,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Oe),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Oe()})),{trackEvent:Nn,flush:Be,getSessionId:()=>D,getVisitorId:()=>v,destroy:()=>{C=!0,f.length>0&&Oe(),Ge(),f=[],typeof window<"u"&&window.removeEventListener("pagehide",Oe)}}}var dn=d.object({cta_name:d.string(),page:d.object({path:d.string()}).strict(),section:d.string().nullable().optional(),destination_url:d.string().nullable().optional()}).strict(),un=d.object({}).strict();var oa=d.object({automatic:d.array(d.string()),manual:d.array(d.string())}).strict(),ln=d.object({sdk_version:d.string(),package_name:d.string().nullable(),surface:d.enum(["next","react","script"]),triggers:oa,trigger_config:d.record(d.string(),d.record(d.string(),d.unknown())).nullable().optional(),configured_gtag_ids:d.record(d.string(),d.string()).nullable().optional()}).strict(),fn=d.object({}).strict();var pn=d.object({form:d.object({id:d.string(),action:d.string().nullable()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),mn=d.object({selector:d.string().optional()}).strict();var _t=d.lazy(()=>d.union([d.string(),d.number().finite(),d.boolean(),d.null(),d.array(_t),d.record(_t)])),gn=d.object({form:d.object({id:d.string(),action:d.string().nullable(),fields:d.array(d.object({name:d.string(),type:d.string(),label:d.string().nullable(),value:_t}).strict()).optional()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),hn=d.object({}).strict();var yn=d.object({page_count:d.number().int().min(2),page:d.object({path:d.string()}).strict()}).strict(),_n=d.object({pageThreshold:d.number().int().min(2)}).strict();var vn=d.object({phone_number:d.string(),page:d.object({path:d.string()}).strict(),section:d.string().nullable().optional()}).strict(),Sn=d.object({}).strict();var kn=d.object({depth_percent:d.number().int().min(1).max(100),page:d.object({path:d.string()}).strict()}).strict(),xn=d.object({thresholds:d.array(d.number().int().min(1).max(100)).min(1)}).strict();var ca=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],wn=d.enum(ca),Tn=d.object({page_name:wn,page:d.object({path:d.string()}).strict()}).strict(),bn=d.object({pages:d.array(d.object({name:wn,pathPattern:d.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var Cn=d.object({duration_ms:d.number().int().nonnegative(),page:d.object({path:d.string()}).strict()}).strict(),En=d.object({thresholdSeconds:d.number().int().positive()}).strict();var vt={page_view:{kind:"automatic",metadataSchema:Ue,configSchema:Xt},time_on_site:{kind:"automatic",metadataSchema:Cn,configSchema:En},specific_page_visit:{kind:"automatic",metadataSchema:Tn,configSchema:bn},scroll_depth:{kind:"automatic",metadataSchema:kn,configSchema:xn},multi_page_session:{kind:"automatic",metadataSchema:yn,configSchema:_n},form_start:{kind:"automatic",metadataSchema:pn,configSchema:mn},sdk_heartbeat:{kind:"automatic",metadataSchema:ln,configSchema:fn},form_submit:{kind:"manual",metadataSchema:gn,configSchema:hn},phone_click:{kind:"manual",metadataSchema:vn,configSchema:Sn},cta_click:{kind:"manual",metadataSchema:dn,configSchema:un}},ji=Object.entries(vt).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Vi=Object.entries(vt).filter(([,t])=>t.kind==="manual").map(([t])=>t);function St(t){return vt[t]}function kt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,a=document.visibilityState==="visible"?Date.now():null,i=null,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function l(){if(s||a===null)return;let S=n-r;if(S<=0){o();return}i=setTimeout(o,S)}function c(){i!==null&&(clearTimeout(i),i=null)}function f(){s||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),c()):(a=Date.now(),l()))}return document.addEventListener("visibilitychange",f),l(),()=>{c(),document.removeEventListener("visibilitychange",f)}}function xt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function a(){let c=window.location.pathname;for(let{name:f,pathPattern:S}of n){if(S.lastIndex=0,!S.test(c))continue;let w=`${f}:${c}`;r.has(w)||(r.add(w),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:f,page:{path:c}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...c){i(...c),setTimeout(a,0)}function l(...c){s(...c),setTimeout(a,0)}return history.pushState=o,history.replaceState=l,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=s,window.removeEventListener("popstate",a)}}function wt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=new Set(e.thresholds),r=new Set,a=window.location.pathname,i=null;function s(){let v=document.documentElement,b=window.scrollY||v.scrollTop,D=v.scrollHeight,Ce=v.clientHeight;return D<=Ce?100:Math.round((b+Ce)/D*100)}function o(){let v=s();for(let b of n)v>=b&&!r.has(b)&&(r.add(b),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:b,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function l(){i===null&&(i=requestAnimationFrame(()=>{i=null,o()}))}function c(){let v=window.location.pathname;v!==a&&(a=v,r=new Set,setTimeout(o,0))}let f=history.pushState.bind(history),S=history.replaceState.bind(history);function w(...v){f(...v),setTimeout(c,0)}function C(...v){S(...v),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),window.addEventListener("scroll",l,{passive:!0}),setTimeout(o,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=f,history.replaceState=S,window.removeEventListener("popstate",c),window.removeEventListener("scroll",l)}}var Tt="aranova_tracking_mps_paths",Rn="aranova_tracking_mps_session",bt="aranova_tracking_mps_fired";function da(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function Ct(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=da();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let v=n.getItem(Tt);return v?new Set(JSON.parse(v)):new Set}catch{return new Set}}function s(v){try{n.setItem(Tt,JSON.stringify([...v]))}catch{}}function o(){let v=ye().id;n.getItem(Rn)!==v&&(n.setItem(Rn,v),n.removeItem(Tt),n.removeItem(bt))}function l(){return n.getItem(bt)==="1"}function c(){let v=window.location.pathname;if(v===a||(a=v,o(),l()))return;let b=i();b.add(v),s(b),b.size>=r&&(n.setItem(bt,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:b.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let f=history.pushState.bind(history),S=history.replaceState.bind(history);function w(...v){f(...v),setTimeout(c,0)}function C(...v){S(...v),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),c(),()=>{history.pushState=f,history.replaceState=S,window.removeEventListener("popstate",c)}}function Et(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,a=window.location.pathname;function i(w){if(w.id)return`id:${w.id}`;let C=w.getAttribute("action");return C?`action:${C}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(w)}`}function s(w){let C=w.target;if(!(C instanceof HTMLElement))return;let v=C.closest(n);if(!v||v.tagName!=="FORM")return;let b=i(v);r.has(b)||(r.add(b),t.trackEvent({eventType:"form_start",metadata:{form:{id:v.id||"",action:v.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function o(){let w=window.location.pathname;w!==a&&(a=w,r=new Set)}let l=history.pushState.bind(history),c=history.replaceState.bind(history);function f(...w){l(...w),setTimeout(o,0)}function S(...w){c(...w),setTimeout(o,0)}return history.pushState=f,history.replaceState=S,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=l,history.replaceState=c,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}var Rt="aranova-tracking-consent-banner";function ua(){return me(ge)}function In(){document.getElementById(Rt)?.remove()}function Pn(t,e,n){let r=document.createElement("button");return r.type="button",r.textContent=t,Object.assign(r.style,{borderRadius:"6px",padding:"10px 16px",fontSize:"14px",fontWeight:"600",cursor:"pointer",border:"1px solid #d1d5db",background:"#ffffff",color:"#374151"},n),r.addEventListener("click",e),r}function la(){if(typeof document>"u"||G()!=="pending"||document.getElementById(Rt))return;let t=document.createElement("div");t.id=Rt,Object.assign(t.style,{position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483647",background:"#ffffff",borderTop:"1px solid #e5e7eb",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.12)",padding:"16px",fontFamily:"Inter, system-ui, sans-serif"});let e=document.createElement("div");Object.assign(e.style,{maxWidth:"960px",margin:"0 auto",display:"flex",flexDirection:"column",gap:"12px"});let n=document.createElement("p");n.textContent="We use cookies to understand ad performance and improve how our marketing works across visits. You can accept or decline this tracking.",Object.assign(n.style,{margin:"0",color:"#374151",fontSize:"14px",lineHeight:"1.5"});let r=document.createElement("div");Object.assign(r.style,{display:"flex",gap:"8px",flexWrap:"wrap"});let a=Pn("Decline",()=>{pe("denied"),In()},{}),i=Pn("Accept",()=>{pe("granted"),In()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.appendChild(a),r.appendChild(i),e.appendChild(n),e.appendChild(r),t.appendChild(e),document.body.appendChild(t)}var O=null,At=null,F=[];function fa(){for(let t=F.length-1;t>=0;t--)F[t]();F=[],O!==null&&(O.destroy(),O=null),At=null}function On(t={}){if(typeof window>"u")return;window.AranovaTracking=It;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,gtagIds:s,environment:o,renderConsentBanner:l=!0,triggers:c}=t;if(r&&he(window.location.href,a),s&&Object.keys(s).length>0?nt(s):i&&tt(i),l&&la(),fa(),!e||!n){(e||n)&&console.warn("[AranovaTracking] init() requires both `apiKey` and `endpoint` to enable first-party event ingest. Page-view events will not be sent.");return}let f=c??{automatic:{page_view:{}},manual:{}};At=f,O=yt({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:Mt,triggers:f,environment:o,activeGtagIds:s??(i?{default:i}:void 0)}),F.push(gt(O)),F.push(mt(O));let w=f.automatic.time_on_site;w&&F.push(kt(O,w));let C=f.automatic.specific_page_visit;C&&F.push(xt(O,C));let v=f.automatic.scroll_depth;v&&F.push(wt(O,v));let b=f.automatic.multi_page_session;b&&F.push(Ct(O,b));let D=f.automatic.form_start;D&&F.push(Et(O,D))}function pa(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=At;if(n===null){console.warn("[AranovaTracking] trackEvent called but no trigger registry was passed to init()");return}let r=n.manual??{};if(!(t in r)){console.warn(`[AranovaTracking] trackEvent: event "${t}" is not registered as a manual trigger. Register it under \`triggers.manual\` in init().`);return}try{St(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}O.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}var It={init:On,captureTrackingParams:()=>he(),getTrackingParams:ua,getConsentState:G,setConsentState:pe,trackEvent:pa};typeof window<"u"&&(window.AranovaTracking=It);var ma=It;return zn(ga);})();
1
+ "use strict";var AranovaTracking=(()=>{var nt=Object.defineProperty;var $n=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var Fn=Object.prototype.hasOwnProperty;var Ft=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},Hn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of zn(e))!Fn.call(t,a)&&a!==n&&nt(t,a,{get:()=>e[a],enumerable:!(r=$n(e,a))||r.enumerable});return t};var Un=t=>Hn(nt({},"__esModule",{value:!0}),t);var xa={};Ft(xa,{default:()=>ka,init:()=>jn});var Ht="0.8.0";var rt="consent_state",Ut="consent_timestamp";function at(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function G(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(rt);return t==="granted"||t==="denied"?t:"pending"}function me(t){typeof window>"u"||(window.localStorage.setItem(rt,t),window.localStorage.setItem(Ut,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",at(t)))}function Ve(){let t=G();return(t==="granted"||t==="denied")&&me(t),t}var Kt="https://www.googletagmanager.com/gtag/js",it="data-aranova-tracking";function Zn(t){return`aranova-${t}`}var Gn=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function st(t){return Gn.test(t)}function je(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function ot(){je()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function ct(t){if(typeof document>"u")return;let e=Zn("gtag-loader");if(document.querySelector(`script[${it}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${Kt}?id=${encodeURIComponent(t)}`,r.setAttribute(it,e),document.head.appendChild(r)}function Zt(t){let e=je();e("js",new Date),e("config",t)}function dt(t){typeof window>"u"||typeof document>"u"||st(t)&&(ot(),ct(t),Zt(t),Ve())}function ut(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(st);if(e.length===0)return;ot(),ct(e[0]);let n=je();n("js",new Date);for(let r of e)n("config",r);Ve()}var lt=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function De(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function pt(t){return typeof t=="string"&&t.length>0?t:null}function ge(t){return lt.reduce((e,n)=>(e[n]=pt(t(n)),e),De())}function Gt(t){return lt.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}function he(t){if(typeof document>"u")return null;let n=(document.cookie?document.cookie.split("; "):[]).find(a=>a.startsWith(`${t}=`));if(!n)return null;let[,r=""]=n.split("=");return pt(decodeURIComponent(r))}function Bt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function qt(t,e=7776e3){let n=Gt(t);return Object.entries(n).forEach(([r,a])=>{Bt(r,a,e)}),n}function ye(t=typeof window>"u"?"":window.location.href,e=7776e3){let n=typeof window>"u"?new URL(t||"https://example.invalid"):new URL(t,window.location.origin);return qt(n.searchParams,e),ge(he)}var ft="aranova_tracking_visitor",Le="aranova_tracking_session";function $e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`}function Yt(t){try{return window.localStorage.getItem(t)}catch{return null}}function mt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function gt(){if(typeof window>"u")return $e();let t=Yt(ft);if(t&&t.length>0)return t;let e=$e();return mt(ft,e),e}function _e(t=Date.now()){if(typeof window>"u")return{id:$e(),isNew:!0};let e=Yt(Le);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=18e5){let a={id:r.id,last_event_at:t};return mt(Le,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:$e(),last_event_at:t};return mt(Le,JSON.stringify(n)),{id:n.id,isNew:!0}}var d={};Ft(d,{BRAND:()=>_r,DIRTY:()=>J,EMPTY_PATH:()=>Wn,INVALID:()=>h,NEVER:()=>na,OK:()=>R,ParseStatus:()=>E,Schema:()=>k,ZodAny:()=>Y,ZodArray:()=>Z,ZodBigInt:()=>Q,ZodBoolean:()=>ee,ZodBranded:()=>Ie,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>He,ZodEffects:()=>V,ZodEnum:()=>ce,ZodError:()=>A,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>Ke,ZodIntersection:()=>ie,ZodIssueCode:()=>u,ZodLazy:()=>se,ZodLiteral:()=>oe,ZodMap:()=>Te,ZodNaN:()=>Ce,ZodNativeEnum:()=>de,ZodNever:()=>j,ZodNull:()=>re,ZodNullable:()=>z,ZodNumber:()=>X,ZodObject:()=>I,ZodOptional:()=>M,ZodParsedType:()=>m,ZodPipeline:()=>Pe,ZodPromise:()=>W,ZodReadonly:()=>pe,ZodRecord:()=>Ue,ZodSchema:()=>k,ZodSet:()=>be,ZodString:()=>q,ZodSymbol:()=>xe,ZodTransformer:()=>V,ZodTuple:()=>$,ZodType:()=>k,ZodUndefined:()=>ne,ZodUnion:()=>ae,ZodUnknown:()=>K,ZodVoid:()=>we,addIssueToContext:()=>f,any:()=>Er,array:()=>Pr,bigint:()=>xr,boolean:()=>on,coerce:()=>ta,custom:()=>rn,date:()=>wr,datetimeRegex:()=>tn,defaultErrorMap:()=>H,discriminatedUnion:()=>Vr,effect:()=>Br,enum:()=>Kr,function:()=>Fr,getErrorMap:()=>ve,getParsedType:()=>L,instanceof:()=>Sr,intersection:()=>jr,isAborted:()=>ze,isAsync:()=>Se,isDirty:()=>Fe,isValid:()=>B,late:()=>vr,lazy:()=>Hr,literal:()=>Ur,makeIssue:()=>Ae,map:()=>$r,nan:()=>kr,nativeEnum:()=>Zr,never:()=>Ar,null:()=>Cr,nullable:()=>Yr,number:()=>sn,object:()=>Or,objectUtil:()=>ht,oboolean:()=>ea,onumber:()=>Qr,optional:()=>qr,ostring:()=>Xr,pipeline:()=>Jr,preprocess:()=>Wr,promise:()=>Gr,quotelessJson:()=>Bn,record:()=>Lr,set:()=>zr,setErrorMap:()=>Yn,strictObject:()=>Mr,string:()=>an,symbol:()=>Tr,transformer:()=>Br,tuple:()=>Dr,undefined:()=>br,union:()=>Nr,unknown:()=>Rr,util:()=>x,void:()=>Ir});var x;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let i={};for(let s of a)i[s]=s;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return t.objectValues(s)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(let s of a)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(x||(x={}));var ht;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ht||(ht={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?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(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}};var u=x.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"]),Bn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),A=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},a=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return a(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};A.create=t=>new A(t);var qn=(t,e)=>{let n;switch(t.code){case u.invalid_type:t.received===m.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case u.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:n=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case u.invalid_union:n="Invalid input";break;case u.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case u.invalid_enum_value:n=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case u.invalid_arguments:n="Invalid function arguments";break;case u.invalid_return_type:n="Invalid function return type";break;case u.invalid_date:n="Invalid date";break;case u.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:x.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case u.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case u.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case u.custom:n="Invalid input";break;case u.invalid_intersection_types:n="Intersection results could not be merged";break;case u.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case u.not_finite:n="Number must be finite";break;default:n=e.defaultError,x.assertNever(t)}return{message:n}},H=qn;var Wt=H;function Yn(t){Wt=t}function ve(){return Wt}var Ae=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)o=c(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}},Wn=[];function f(t,e){let n=ve(),r=Ae({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===H?void 0:H].filter(a=>!!a)});t.common.issues.push(r)}var E=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let a of n){if(a.status==="aborted")return h;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n){let i=await a.key,s=await a.value;r.push({key:i,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return h;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),J=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),ze=t=>t.status==="aborted",Fe=t=>t.status==="dirty",B=t=>t.status==="valid",Se=t=>typeof Promise<"u"&&t instanceof Promise;var g;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));var N=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}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}},Jt=(t,e)=>{if(B(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new A(t.common.issues);return this._error=n,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:a}}var k=class{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Se(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Jt(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return B(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>B(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(Se(a)?a:Promise.resolve(a));return Jt(r,i)}refine(e,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let s=e(a),o=()=>i.addIssue({code:u.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return M.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return W.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new V({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ue({..._(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Ie({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new le({..._(this._def),innerType:this,catchValue:n,typeName:y.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Pe.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Jn=/^c[^\s-]{8,}$/i,Xn=/^[0-9a-z]+$/,Qn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,er=/^[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,tr=/^[a-z0-9_-]{21}$/i,nr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rr=/^[-+]?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,ir="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yt,sr=/^(?:(?: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])$/,or=/^(?:(?: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])$/,cr=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ur=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt="((\\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])))",pr=new RegExp(`^${Qt}$`);function en(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function fr(t){return new RegExp(`^${en(t)}$`)}function tn(t){let e=`${Qt}T${en(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function mr(t,e){return!!((e==="v4"||!e)&&sr.test(t)||(e==="v6"||!e)&&cr.test(t))}function gr(t,e){if(!nr.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function hr(t,e){return!!((e==="v4"||!e)&&or.test(t)||(e==="v6"||!e)&&dr.test(t))}var q=class t extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.string,received:i.parsedType}),h}let r=new E,a;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")ar.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")yt||(yt=new RegExp(ir,"u")),yt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")er.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")tr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Jn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Xn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Qn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),f(a,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?tn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?fr(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?rr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?mr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?gr(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?hr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ur.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?lr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):x.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:u.invalid_string,...g.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(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?.precision>"u"?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...g.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...g.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...g.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...g.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...g.errToObj(n)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};q.create=t=>new q({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});function yr(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}var X=class t extends k{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){let i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?yr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.not_finite,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};X.create=t=>new X({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var Q=class t extends k{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 r,a=new E;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Q.create=t=>new Q({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var ee=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.boolean,received:r.parsedType}),h}return R(e.data)}};ee.create=t=>new ee({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var te=class t extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_date}),h}let r=new E,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):x.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};te.create=t=>new te({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var xe=class extends k{_parse(e){if(this._getType(e)!==m.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.symbol,received:r.parsedType}),h}return R(e.data)}};xe.create=t=>new xe({typeName:y.ZodSymbol,..._(t)});var ne=class extends k{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.undefined,received:r.parsedType}),h}return R(e.data)}};ne.create=t=>new ne({typeName:y.ZodUndefined,..._(t)});var re=class extends k{_parse(e){if(this._getType(e)!==m.null){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.null,received:r.parsedType}),h}return R(e.data)}};re.create=t=>new re({typeName:y.ZodNull,..._(t)});var Y=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};Y.create=t=>new Y({typeName:y.ZodAny,..._(t)});var K=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};K.create=t=>new K({typeName:y.ZodUnknown,..._(t)});var j=class extends k{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.never,received:n.parsedType}),h}};j.create=t=>new j({typeName:y.ZodNever,..._(t)});var we=class extends k{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.void,received:r.parsedType}),h}return R(e.data)}};we.create=t=>new we({typeName:y.ZodVoid,..._(t)});var Z=class t extends k{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==m.array)return f(n,{code:u.invalid_type,expected:m.array,received:n.parsedType}),h;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(f(n,{code:s?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(f(n,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(f(n,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new N(n,s,n.path,o)))).then(s=>E.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new N(n,s,n.path,o)));return E.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:g.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};Z.create=(t,e)=>new Z({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function ke(t){if(t instanceof I){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=M.create(ke(r))}return new I({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:ke(t.element)}):t instanceof M?M.create(ke(t.unwrap())):t instanceof z?z.create(ke(t.unwrap())):t instanceof $?$.create(t.items.map(e=>ke(e))):t}var I=class t extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=x.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==m.object){let c=this._getOrReturnCtx(e);return f(c,{code:u.invalid_type,expected:m.object,received:c.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let c in a.data)s.includes(c)||o.push(c);let l=[];for(let c of s){let p=i[c],S=a.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new N(a,S,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof j){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(c==="strict")o.length>0&&(f(a,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let p of o){let S=a.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new N(a,S,a.path,p)),alwaysSet:p in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let S=await p.key,w=await p.value;c.push({key:S,value:w,alwaysSet:p.alwaysSet})}return c}).then(c=>E.mergeObjectSync(r,c)):E.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of x.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of x.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ke(this)}partial(e){let n={};for(let r of x.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of x.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof M;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return nn(x.objectKeys(this.shape))}};I.create=(t,e)=>new I({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:y.ZodObject,..._(e)});I.strictCreate=(t,e)=>new I({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:y.ZodObject,..._(e)});I.lazycreate=(t,e)=>new I({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:y.ZodObject,..._(e)});var ae=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new A(o.ctx.common.issues));return f(n,{code:u.invalid_union,unionErrors:s}),h}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},p=l._parseSync({data:n.data,path:n.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(l=>new A(l));return f(n,{code:u.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};ae.create=(t,e)=>new ae({options:t,typeName:y.ZodUnion,..._(e)});var U=t=>t instanceof se?U(t.schema):t instanceof V?U(t.innerType()):t instanceof oe?[t.value]:t instanceof ce?t.options:t instanceof de?x.objectValues(t.enum):t instanceof ue?U(t._def.innerType):t instanceof ne?[void 0]:t instanceof re?[null]:t instanceof M?[void 0,...U(t.unwrap())]:t instanceof z?[null,...U(t.unwrap())]:t instanceof Ie||t instanceof pe?U(t.unwrap()):t instanceof le?U(t._def.innerType):[],He=class t extends k{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return f(n,{code:u.invalid_type,expected:m.object,received:n.parsedType}),h;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let a=new Map;for(let i of n){let s=U(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function _t(t,e){let n=L(t),r=L(e);if(t===e)return{valid:!0,data:t};if(n===m.object&&r===m.object){let a=x.objectKeys(e),i=x.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(let o of i){let l=_t(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===m.array&&r===m.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let s=t[i],o=e[i],l=_t(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===m.date&&r===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ie=class extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(ze(i)||ze(s))return h;let o=_t(i.value,s.value);return o.valid?((Fe(i)||Fe(s))&&n.dirty(),{status:n.value,value:o.data}):(f(r,{code:u.invalid_intersection_types}),h)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ie.create=(t,e,n)=>new ie({left:t,right:e,typeName:y.ZodIntersection,..._(n)});var $=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return f(r,{code:u.invalid_type,expected:m.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new N(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>E.mergeArray(n,s)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};$.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var Ue=class t extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return f(r,{code:u.invalid_type,expected:m.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new N(r,o,r.path,o)),value:s._parse(new N(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?E.mergeObjectAsync(n,a):E.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof k?new t({keyType:e,valueType:n,typeName:y.ZodRecord,..._(r)}):new t({keyType:q.create(),valueType:e,typeName:y.ZodRecord,..._(n)})}},Te=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.map)return f(r,{code:u.invalid_type,expected:m.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,l],c)=>({key:a._parse(new N(r,o,r.path,[c,"key"])),value:i._parse(new N(r,l,r.path,[c,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return h;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(c.value,p.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return h;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(c.value,p.value)}return{status:n.value,value:o}}}};Te.create=(t,e,n)=>new Te({valueType:e,keyType:t,typeName:y.ZodMap,..._(n)});var be=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return f(r,{code:u.invalid_type,expected:m.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(f(r,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return h;p.status==="dirty"&&n.dirty(),c.add(p.value)}return{status:n.value,value:c}}let o=[...r.data.values()].map((l,c)=>i._parse(new N(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};be.create=(t,e)=>new be({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var Ke=class t extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.function)return f(n,{code:u.invalid_type,expected:m.function,received:n.parsedType}),h;function r(o,l){return Ae({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ve(),H].filter(c=>!!c),issueData:{code:u.invalid_arguments,argumentsError:l}})}function a(o,l){return Ae({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ve(),H].filter(c=>!!c),issueData:{code:u.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof W){let o=this;return R(async function(...l){let c=new A([]),p=await o._def.args.parseAsync(l,i).catch(C=>{throw c.addIssue(r(l,C)),c}),S=await Reflect.apply(s,this,p);return await o._def.returns._def.type.parseAsync(S,i).catch(C=>{throw c.addIssue(a(S,C)),c})})}else{let o=this;return R(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new A([r(l,c.error)]);let p=Reflect.apply(s,this,c.data),S=o._def.returns.safeParse(p,i);if(!S.success)throw new A([a(p,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:$.create(e).rest(K.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||$.create([]).rest(K.create()),returns:n||K.create(),typeName:y.ZodFunction,..._(r)})}},se=class extends k{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};se.create=(t,e)=>new se({getter:t,typeName:y.ZodLazy,..._(e)});var oe=class extends k{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:u.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(t,e)=>new oe({value:t,typeName:y.ZodLiteral,..._(e)});function nn(t,e){return new ce({values:t,typeName:y.ZodEnum,..._(e)})}var ce=class t extends k{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:x.joinValues(r),received:n.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{received:n.data,code:u.invalid_enum_value,options:r}),h}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ce.create=nn;var de=class extends k{_parse(e){let n=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==m.string&&r.parsedType!==m.number){let a=x.objectValues(n);return f(r,{expected:x.joinValues(a),received:r.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=x.objectValues(n);return f(r,{received:r.data,code:u.invalid_enum_value,options:a}),h}return R(e.data)}get enum(){return this._def.values}};de.create=(t,e)=>new de({values:t,typeName:y.ZodNativeEnum,..._(e)});var W=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.promise&&n.common.async===!1)return f(n,{code:u.invalid_type,expected:m.promise,received:n.parsedType}),h;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return R(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};W.create=(t,e)=>new W({type:t,typeName:y.ZodPromise,..._(e)});var V=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{f(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return h;let l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?h:l.status==="dirty"?J(l.value):n.value==="dirty"?J(l.value):l});{if(n.value==="aborted")return h;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?h:o.status==="dirty"?J(o.value):n.value==="dirty"?J(o.value):o}}if(a.type==="refinement"){let s=o=>{let l=a.refinement(o,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(s))return h;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>B(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):h);x.assertNever(a)}};V.create=(t,e,n)=>new V({schema:t,typeName:y.ZodEffects,effect:e,..._(n)});V.createWithPreprocess=(t,e,n)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(n)});var M=class extends k{_parse(e){return this._getType(e)===m.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:y.ZodOptional,..._(e)});var z=class extends k{_parse(e){return this._getType(e)===m.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};z.create=(t,e)=>new z({innerType:t,typeName:y.ZodNullable,..._(e)});var ue=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===m.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ue.create=(t,e)=>new ue({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var le=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Se(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Ce=class extends k{_parse(e){if(this._getType(e)!==m.nan){let r=this._getOrReturnCtx(e);return f(r,{code:u.invalid_type,expected:m.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Ce.create=t=>new Ce({typeName:y.ZodNaN,..._(t)});var _r=Symbol("zod_brand"),Ie=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Pe=class t extends k{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?h:i.status==="dirty"?(n.dirty(),J(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?h:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:y.ZodPipeline})}},pe=class extends k{_parse(e){let n=this._def.innerType._parse(e),r=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return Se(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};pe.create=(t,e)=>new pe({innerType:t,typeName:y.ZodReadonly,..._(e)});function Xt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function rn(t,e={},n){return t?Y.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=Xt(e,r),l=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:l})}});if(!i){let s=Xt(e,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):Y.create()}var vr={object:I.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var Sr=(t,e={message:`Input not instance of ${t.name}`})=>rn(n=>n instanceof t,e),an=q.create,sn=X.create,kr=Ce.create,xr=Q.create,on=ee.create,wr=te.create,Tr=xe.create,br=ne.create,Cr=re.create,Er=Y.create,Rr=K.create,Ar=j.create,Ir=we.create,Pr=Z.create,Or=I.create,Mr=I.strictCreate,Nr=ae.create,Vr=He.create,jr=ie.create,Dr=$.create,Lr=Ue.create,$r=Te.create,zr=be.create,Fr=Ke.create,Hr=se.create,Ur=oe.create,Kr=ce.create,Zr=de.create,Gr=W.create,Br=V.create,qr=M.create,Yr=z.create,Wr=V.createWithPreprocess,Jr=Pe.create,Xr=()=>an().optional(),Qr=()=>sn().optional(),ea=()=>on().optional(),ta={string:(t=>q.create({...t,coerce:!0})),number:(t=>X.create({...t,coerce:!0})),boolean:(t=>ee.create({...t,coerce:!0})),bigint:(t=>Q.create({...t,coerce:!0})),date:(t=>te.create({...t,coerce:!0}))};var na=h;var Ze=d.object({page:d.object({title:d.string().nullable(),path:d.string(),search:d.string(),hash:d.string()}).strict(),referrer:d.string().nullable(),viewport:d.object({w:d.number(),h:d.number()}).strict().nullable().optional()}).strict(),cn=d.object({}).strict();var kt="aranova_tracking_last_fired_url",vt=null,St=!1;function ra(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function aa(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function ia(){if(!St){St=!0;let t=ra(kt);t!==null&&(vt=t)}return vt}function sa(t){vt=t,St=!0,aa(kt,t)}function dn(t){return typeof window>"u"||typeof document>"u"?null:Ze.parse({page:{title:document.title||null,path:window.location.pathname,search:window.location.search,hash:window.location.hash},referrer:t!==void 0?t:document.referrer||null,viewport:{w:window.innerWidth,h:window.innerHeight}})}function Oe(t){if(typeof window>"u")return;let e=window.location.href,n=ia(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,s=dn(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&sa(e)}function xt(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Oe(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function wt(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let c=window.location.pathname+window.location.search;c!==n&&(n=c,Oe(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function s(...c){a(...c),setTimeout(r,0)}function o(...c){i(...c),setTimeout(r,0)}function l(c){c.persisted&&Oe(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",l),e.skipInitial||Oe(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",l)}}function Ge(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(Ge);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ge(r);return e}return t}function Tt(t,e,n,r,a=null){let i=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let l={};for(let[c,p]of Object.entries(r.automatic)){let S=Ge(p);Object.keys(S).length>0&&(l[c]=S)}if(r.manual)for(let[c,p]of Object.entries(r.manual)){if(p===void 0)continue;let S=Ge(p);Object.keys(S).length>0&&(l[c]=S)}Object.keys(l).length>0&&(o=l)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:i,manual:s},trigger_config:o,configured_gtag_ids:a}}var ln=2e3,pn=10,Be=50,qe="X-Aranova-Api-Key",Ye="X-Aranova-Sdk-Version",We="X-Aranova-Sdk-Package",Je="X-Aranova-Sdk-Surface",Xe="X-Aranova-Sdk-Environment";function ca(t,e,n,r,a){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null,environment:r,active_gtag_ids:a}}function da(){if(typeof window>"u")return De();try{ye()}catch{}return ge(he)}function ua(){try{return{state:G()}}catch{return null}}async function un(t,e,n,r,a){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[qe]:n,[Ye]:r.sdkVersion,[We]:r.packageName,[Je]:r.surface,[Xe]:r.environment},body:e,keepalive:a,credentials:"omit",mode:"cors"})}catch{}}function bt(t){let e=t.flushIntervalMs??ln,n=Math.min(t.maxQueueSize??pn,Be),r=t.sdkVersion??null,a=t.packageName??null,i=t.environment??"production",s=t.activeGtagIds??null,l=`${t.endpoint.replace(/\/$/,"")}/events`,c={sdkVersion:r??"",packageName:a??"",surface:t.surface,environment:i},p=[],S=null,w=null,C=!1,v=gt(),b=_e(),D=b.id;typeof window<"u"&&(w=window.location.href);function Ee(){let T=Tt(t.surface,r,a,t.triggers??null,s);p.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:T,occurred_at:new Date().toISOString()})}b.isNew&&Ee();function zt(){let T=_e();T.isNew&&T.id!==D&&Ee(),D=T.id;let P=da(),Re=ca(t.surface,r,a,i,s);return{session_id:D,visitor_id:v,gclid:P.gclid,fbclid:P.fbclid,utm_source:P.utm_source,utm_medium:P.utm_medium,utm_campaign:P.utm_campaign,utm_term:P.utm_term,utm_content:P.utm_content,first_page:w,consent_state:ua(),context:Re}}function Dn(){S!==null||C||(S=setTimeout(()=>{S=null,tt()},e))}function et(){S!==null&&(clearTimeout(S),S=null)}async function tt(){if(p.length===0)return;let T=p.slice(0,Be);p=p.slice(T.length),et();let P={session:zt(),events:T},Re=JSON.stringify(P);await un(l,Re,t.apiKey,c,!1)}function Ln(T){if(C||!T||typeof T.eventType!="string"||T.eventType.length===0)return;let P=T.occurredAt instanceof Date?T.occurredAt.toISOString():typeof T.occurredAt=="string"?T.occurredAt:new Date().toISOString();p.push({event_type:T.eventType,page_url:T.pageUrl??(typeof window>"u"?null:window.location.href),metadata:T.metadata??null,occurred_at:P}),p.length>=n?tt():Dn()}function Ne(){if(p.length===0)return;let T=p.slice(0,Be);p=p.slice(T.length),et();let P={session:zt(),events:T},Re=JSON.stringify(P);un(l,Re,t.apiKey,c,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Ne),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ne()})),{trackEvent:Ln,flush:tt,getSessionId:()=>D,getVisitorId:()=>v,destroy:()=>{C=!0,p.length>0&&Ne(),et(),p=[],typeof window<"u"&&window.removeEventListener("pagehide",Ne)}}}var fn=d.object({cta_name:d.string(),page:d.object({path:d.string()}).strict(),section:d.string().nullable().optional(),destination_url:d.string().nullable().optional()}).strict(),mn=d.object({}).strict();var la=d.object({automatic:d.array(d.string()),manual:d.array(d.string())}).strict(),gn=d.object({sdk_version:d.string(),package_name:d.string().nullable(),surface:d.enum(["next","react","script"]),triggers:la,trigger_config:d.record(d.string(),d.record(d.string(),d.unknown())).nullable().optional(),configured_gtag_ids:d.record(d.string(),d.string()).nullable().optional()}).strict(),hn=d.object({}).strict();var yn=d.object({form:d.object({id:d.string(),action:d.string().nullable()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),_n=d.object({selector:d.string().optional()}).strict();var Ct=d.lazy(()=>d.union([d.string(),d.number().finite(),d.boolean(),d.null(),d.array(Ct),d.record(Ct)])),vn=d.object({form:d.object({id:d.string(),action:d.string().nullable(),fields:d.array(d.object({name:d.string(),type:d.string(),label:d.string().nullable(),value:Ct}).strict()).optional()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),Sn=d.object({}).strict();var kn=d.object({page_count:d.number().int().min(2),page:d.object({path:d.string()}).strict()}).strict(),xn=d.object({pageThreshold:d.number().int().min(2)}).strict();var wn=d.object({phone_number:d.string(),page:d.object({path:d.string()}).strict(),section:d.string().nullable().optional()}).strict(),Tn=d.object({}).strict();var bn=d.object({depth_percent:d.number().int().min(1).max(100),page:d.object({path:d.string()}).strict()}).strict(),Cn=d.object({thresholds:d.array(d.number().int().min(1).max(100)).min(1)}).strict();var pa=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],En=d.enum(pa),Rn=d.object({page_name:En,page:d.object({path:d.string()}).strict()}).strict(),An=d.object({pages:d.array(d.object({name:En,pathPattern:d.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var In=d.object({duration_ms:d.number().int().nonnegative(),page:d.object({path:d.string()}).strict()}).strict(),Pn=d.object({thresholdSeconds:d.number().int().positive()}).strict();var Et={page_view:{kind:"automatic",metadataSchema:Ze,configSchema:cn},time_on_site:{kind:"automatic",metadataSchema:In,configSchema:Pn},specific_page_visit:{kind:"automatic",metadataSchema:Rn,configSchema:An},scroll_depth:{kind:"automatic",metadataSchema:bn,configSchema:Cn},multi_page_session:{kind:"automatic",metadataSchema:kn,configSchema:xn},form_start:{kind:"automatic",metadataSchema:yn,configSchema:_n},sdk_heartbeat:{kind:"automatic",metadataSchema:gn,configSchema:hn},form_submit:{kind:"manual",metadataSchema:vn,configSchema:Sn},phone_click:{kind:"manual",metadataSchema:wn,configSchema:Tn},cta_click:{kind:"manual",metadataSchema:fn,configSchema:mn}},Hi=Object.entries(Et).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Ui=Object.entries(Et).filter(([,t])=>t.kind==="manual").map(([t])=>t);function Rt(t){return Et[t]}function At(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,a=document.visibilityState==="visible"?Date.now():null,i=null,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function l(){if(s||a===null)return;let S=n-r;if(S<=0){o();return}i=setTimeout(o,S)}function c(){i!==null&&(clearTimeout(i),i=null)}function p(){s||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),c()):(a=Date.now(),l()))}return document.addEventListener("visibilitychange",p),l(),()=>{c(),document.removeEventListener("visibilitychange",p)}}function It(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function a(){let c=window.location.pathname;for(let{name:p,pathPattern:S}of n){if(S.lastIndex=0,!S.test(c))continue;let w=`${p}:${c}`;r.has(w)||(r.add(w),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:p,page:{path:c}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...c){i(...c),setTimeout(a,0)}function l(...c){s(...c),setTimeout(a,0)}return history.pushState=o,history.replaceState=l,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=s,window.removeEventListener("popstate",a)}}function Pt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=new Set(e.thresholds),r=new Set,a=window.location.pathname,i=null;function s(){let v=document.documentElement,b=window.scrollY||v.scrollTop,D=v.scrollHeight,Ee=v.clientHeight;return D<=Ee?100:Math.round((b+Ee)/D*100)}function o(){let v=s();for(let b of n)v>=b&&!r.has(b)&&(r.add(b),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:b,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function l(){i===null&&(i=requestAnimationFrame(()=>{i=null,o()}))}function c(){let v=window.location.pathname;v!==a&&(a=v,r=new Set,setTimeout(o,0))}let p=history.pushState.bind(history),S=history.replaceState.bind(history);function w(...v){p(...v),setTimeout(c,0)}function C(...v){S(...v),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),window.addEventListener("scroll",l,{passive:!0}),setTimeout(o,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=p,history.replaceState=S,window.removeEventListener("popstate",c),window.removeEventListener("scroll",l)}}var Ot="aranova_tracking_mps_paths",On="aranova_tracking_mps_session",Mt="aranova_tracking_mps_fired";function fa(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function Nt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=fa();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let v=n.getItem(Ot);return v?new Set(JSON.parse(v)):new Set}catch{return new Set}}function s(v){try{n.setItem(Ot,JSON.stringify([...v]))}catch{}}function o(){let v=_e().id;n.getItem(On)!==v&&(n.setItem(On,v),n.removeItem(Ot),n.removeItem(Mt))}function l(){return n.getItem(Mt)==="1"}function c(){let v=window.location.pathname;if(v===a||(a=v,o(),l()))return;let b=i();b.add(v),s(b),b.size>=r&&(n.setItem(Mt,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:b.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let p=history.pushState.bind(history),S=history.replaceState.bind(history);function w(...v){p(...v),setTimeout(c,0)}function C(...v){S(...v),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),c(),()=>{history.pushState=p,history.replaceState=S,window.removeEventListener("popstate",c)}}function Vt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,a=window.location.pathname;function i(w){if(w.id)return`id:${w.id}`;let C=w.getAttribute("action");return C?`action:${C}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(w)}`}function s(w){let C=w.target;if(!(C instanceof HTMLElement))return;let v=C.closest(n);if(!v||v.tagName!=="FORM")return;let b=i(v);r.has(b)||(r.add(b),t.trackEvent({eventType:"form_start",metadata:{form:{id:v.id||"",action:v.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function o(){let w=window.location.pathname;w!==a&&(a=w,r=new Set)}let l=history.pushState.bind(history),c=history.replaceState.bind(history);function p(...w){l(...w),setTimeout(o,0)}function S(...w){c(...w),setTimeout(o,0)}return history.pushState=p,history.replaceState=S,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=l,history.replaceState=c,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}var Me=class extends Error{constructor(e,n){super(e),this.name="AranovaApiError",this.status=n.status,this.code=n.code,this.requestId=n.requestId}};function ma(t){let e={[qe]:t.apiKey};return t.sdkVersion&&(e[Ye]=t.sdkVersion),t.packageName&&(e[We]=t.packageName),t.surface&&(e[Je]=t.surface),t.environment&&(e[Xe]=t.environment),e}function ga(t,e){return`${t.replace(/\/$/,"")}${e}`}async function fe(t,e,n,r){let a=ma(t);r!==void 0&&(a["Content-Type"]="application/json");let i=await fetch(ga(t.endpoint,n),{method:e,headers:a,body:r===void 0?void 0:JSON.stringify(r)});if(!i.ok){let s,o;try{let l=await i.json();if(l&&typeof l=="object"){let c=l;typeof c.detail=="string"&&(s=c.detail),typeof c.code=="string"&&(o=c.code)}}catch{}throw new Me(s??i.statusText??"Request failed",{status:i.status,code:o,requestId:i.headers.get("x-request-id")??void 0})}if(i.status!==204)return await i.json()}function jt(t){return{async record(e){let n=e.currency??t.defaultCurrency;if(!n)throw new Error("record: `currency` is required (pass it on the sale or set config.defaultCurrency)");let r={...e,currency:n,occurred_at:e.occurred_at??new Date().toISOString()};return fe(t,"POST","/sales",r)},async list(e){let{cursor:n,limit:r,...a}=e??{};return fe(t,"POST","/sales/query",{filters:a,...r!==void 0?{limit:r}:{},...n!==void 0?{cursor:n}:{}})},async get(e){return fe(t,"GET",`/sales/${e}`)},async update(e,n){return fe(t,"PATCH",`/sales/${e}`,n)},async delete(e){await fe(t,"DELETE",`/sales/${e}`)}}}var Dt="aranova-tracking-consent-banner";function ha(){return ge(he)}function Nn(){document.getElementById(Dt)?.remove()}function Vn(t,e,n){let r=document.createElement("button");return r.type="button",r.textContent=t,Object.assign(r.style,{borderRadius:"6px",padding:"10px 16px",fontSize:"14px",fontWeight:"600",cursor:"pointer",border:"1px solid #d1d5db",background:"#ffffff",color:"#374151"},n),r.addEventListener("click",e),r}function ya(){if(typeof document>"u"||G()!=="pending"||document.getElementById(Dt))return;let t=document.createElement("div");t.id=Dt,Object.assign(t.style,{position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483647",background:"#ffffff",borderTop:"1px solid #e5e7eb",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.12)",padding:"16px",fontFamily:"Inter, system-ui, sans-serif"});let e=document.createElement("div");Object.assign(e.style,{maxWidth:"960px",margin:"0 auto",display:"flex",flexDirection:"column",gap:"12px"});let n=document.createElement("p");n.textContent="We use cookies to understand ad performance and improve how our marketing works across visits. You can accept or decline this tracking.",Object.assign(n.style,{margin:"0",color:"#374151",fontSize:"14px",lineHeight:"1.5"});let r=document.createElement("div");Object.assign(r.style,{display:"flex",gap:"8px",flexWrap:"wrap"});let a=Vn("Decline",()=>{me("denied"),Nn()},{}),i=Vn("Accept",()=>{me("granted"),Nn()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.appendChild(a),r.appendChild(i),e.appendChild(n),e.appendChild(r),t.appendChild(e),document.body.appendChild(t)}var O=null,Lt=null,F=[],Qe=null;function _a(){for(let t=F.length-1;t>=0;t--)F[t]();F=[],O!==null&&(O.destroy(),O=null),Lt=null,Qe=null}function jn(t={}){if(typeof window>"u")return;window.AranovaTracking=$t;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,gtagIds:s,environment:o,renderConsentBanner:l=!0,triggers:c}=t;if(r&&ye(window.location.href,a),s&&Object.keys(s).length>0?ut(s):i&&dt(i),l&&ya(),_a(),!e||!n){(e||n)&&console.warn("[AranovaTracking] init() requires both `apiKey` and `endpoint` to enable first-party event ingest. Page-view events will not be sent.");return}Qe=jt({apiKey:e,endpoint:n});let p=c??{automatic:{page_view:{}},manual:{}};Lt=p,O=bt({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:Ht,triggers:p,environment:o,activeGtagIds:s??(i?{default:i}:void 0)}),F.push(wt(O)),F.push(xt(O));let w=p.automatic.time_on_site;w&&F.push(At(O,w));let C=p.automatic.specific_page_visit;C&&F.push(It(O,C));let v=p.automatic.scroll_depth;v&&F.push(Pt(O,v));let b=p.automatic.multi_page_session;b&&F.push(Nt(O,b));let D=p.automatic.form_start;D&&F.push(Vt(O,D))}function va(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=Lt;if(n===null){console.warn("[AranovaTracking] trackEvent called but no trigger registry was passed to init()");return}let r=n.manual??{};if(!(t in r)){console.warn(`[AranovaTracking] trackEvent: event "${t}" is not registered as a manual trigger. Register it under \`triggers.manual\` in init().`);return}try{Rt(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}O.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}function Sa(){if(Qe===null)throw new Error("[AranovaTracking] sales() called before init({ apiKey, endpoint })");return Qe}var $t={init:jn,captureTrackingParams:()=>ye(),getTrackingParams:ha,getConsentState:G,setConsentState:me,trackEvent:va,sales:Sa};typeof window<"u"&&(window.AranovaTracking=$t);var ka=$t;return Un(xa);})();
2
2
  //# sourceMappingURL=aranova-tracking.global.js.map