@aranova/tracking-browser 0.5.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # @aranova/tracking-browser
2
+
3
+ Global browser script for Aranova tracking on sites that cannot use the React or Next.js packages.
4
+
5
+ This package is intended for CDN/script-tag installs, not application imports.
6
+
7
+ ## Install
8
+
9
+ Place the script in the document `<head>` before the rest of the page can run.
10
+
11
+ ```html
12
+ <script src="https://cdn.jsdelivr.net/npm/@aranova/tracking-browser@0/dist/browser/aranova-tracking.global.js"></script>
13
+ <script>
14
+ window.AranovaTracking.init({
15
+ apiKey: 'aranv_pk_...',
16
+ endpoint: 'https://api.internal.aranova.io/tracking',
17
+ gtagId: 'AW-XXXXXXXXXX',
18
+ renderConsentBanner: true,
19
+ triggers: {
20
+ automatic: {
21
+ page_view: {},
22
+ time_on_site: { thresholdSeconds: 60 },
23
+ specific_page_visit: {
24
+ pages: [
25
+ { name: 'contact_page', pathPattern: /^\/(contact|book|get-started)/ },
26
+ ],
27
+ },
28
+ },
29
+ manual: {
30
+ form_submit: {},
31
+ phone_click: {},
32
+ cta_click: {},
33
+ },
34
+ },
35
+ });
36
+ </script>
37
+ ```
38
+
39
+ Pin an exact version for production when possible, for example `@aranova/tracking-browser@0.5.1`.
40
+
41
+ ## Manual Events
42
+
43
+ The browser package validates manual events at runtime. If an event is not registered under `triggers.manual`, or the metadata shape is invalid, the SDK warns and drops the event.
44
+
45
+ ```html
46
+ <form id="lead-form" action="/api/lead">
47
+ <select name="service_interest" aria-label="Service interest">
48
+ <option value="cleaning">Cleaning</option>
49
+ <option value="teeth_whitening">Teeth whitening</option>
50
+ </select>
51
+ <label>
52
+ <input name="is_existing_patient" type="checkbox" />
53
+ Existing patient
54
+ </label>
55
+ <button type="submit">Submit</button>
56
+ </form>
57
+
58
+ <script>
59
+ document.getElementById('lead-form').addEventListener('submit', function (event) {
60
+ var form = event.currentTarget;
61
+ var data = new FormData(form);
62
+
63
+ window.AranovaTracking.trackEvent('form_submit', {
64
+ form: {
65
+ id: form.id,
66
+ action: form.getAttribute('action'),
67
+ fields: [
68
+ {
69
+ name: 'service_interest',
70
+ type: 'select',
71
+ label: 'Service interest',
72
+ value: String(data.get('service_interest') || ''),
73
+ },
74
+ {
75
+ name: 'is_existing_patient',
76
+ type: 'checkbox',
77
+ label: 'Existing patient',
78
+ value: data.get('is_existing_patient') === 'on',
79
+ },
80
+ ],
81
+ },
82
+ page: { path: window.location.pathname },
83
+ });
84
+ });
85
+ </script>
86
+ ```
87
+
88
+ `fields[].value` can be any JSON value: string, number, boolean, null, array, or object. Only send reviewed, allowlisted, non-sensitive values; do not send names, emails, phone numbers entered by the visitor, addresses, payment data, medical details, passwords, file contents, or free-text messages.
89
+
90
+ ```html
91
+ <a href="tel:+14165550199" onclick="window.AranovaTracking.trackEvent('phone_click', {
92
+ phone_number: '+14165550199',
93
+ page: { path: window.location.pathname },
94
+ section: 'header'
95
+ })">
96
+ (416) 555-0199
97
+ </a>
98
+ ```
99
+
100
+ ## Global API
101
+
102
+ ```js
103
+ window.AranovaTracking.init(config);
104
+ window.AranovaTracking.trackEvent(eventType, metadata);
105
+ window.AranovaTracking.captureTrackingParams();
106
+ window.AranovaTracking.getTrackingParams();
107
+ window.AranovaTracking.getConsentState();
108
+ window.AranovaTracking.setConsentState('granted');
109
+ window.AranovaTracking.setConsentState('denied');
110
+ ```
111
+
112
+ ## Automatic Events
113
+
114
+ Configured automatic events are fired by the SDK:
115
+
116
+ - `page_view`
117
+ - `time_on_site`
118
+ - `specific_page_visit`
119
+ - `scroll_depth`
120
+ - `multi_page_session`
121
+ - `form_start`
122
+
@@ -1,2 +1,2 @@
1
- "use strict";var AranovaTracking=(()=>{var Ke=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var En=Object.prototype.hasOwnProperty;var bt=(t,e)=>{for(var n in e)Ke(t,n,{get:e[n],enumerable:!0})},Rn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Cn(e))!En.call(t,a)&&a!==n&&Ke(t,a,{get:()=>e[a],enumerable:!(r=bn(e,a))||r.enumerable});return t};var An=t=>Rn(Ke({},"__esModule",{value:!0}),t);var aa={};bt(aa,{default:()=>ra,init:()=>wn});var Ct="0.5.1";var Ge="consent_state",Et="consent_timestamp";function Be(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function K(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(Ge);return t==="granted"||t==="denied"?t:"pending"}function pe(t){typeof window>"u"||(window.localStorage.setItem(Ge,t),window.localStorage.setItem(Et,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",Be(t)))}function Ye(){let t=K();return(t==="granted"||t==="denied")&&pe(t),t}var Rt="https://www.googletagmanager.com/gtag/js",We="data-aranova-tracking";function Pn(t){return`aranova-${t}`}function qe(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function At(){qe()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function It(t){if(typeof document>"u")return;let e=Pn("gtag-loader");if(document.querySelector(`script[${We}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${Rt}?id=${encodeURIComponent(t)}`,r.setAttribute(We,e),document.head.appendChild(r)}function Pt(t){let e=qe();e("js",new Date),e("config",t)}function Je(t){typeof window>"u"||typeof document>"u"||(At(),It(t),Pt(t),Ye())}var Xe=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Me(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function Qe(t){return typeof t=="string"&&t.length>0?t:null}function me(t){return Xe.reduce((e,n)=>(e[n]=Qe(t(n)),e),Me())}function Ot(t){return Xe.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 Qe(decodeURIComponent(r))}function Mt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function Nt(t,e=7776e3){let n=Ot(t);return Object.entries(n).forEach(([r,a])=>{Mt(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 Nt(n.searchParams,e),me(ge)}var et="aranova_tracking_visitor",Ne="aranova_tracking_session";function je(){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 jt(t){try{return window.localStorage.getItem(t)}catch{return null}}function tt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function nt(){if(typeof window>"u")return je();let t=jt(et);if(t&&t.length>0)return t;let e=je();return tt(et,e),e}function ye(t=Date.now()){if(typeof window>"u")return{id:je(),isNew:!0};let e=jt(Ne);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 tt(Ne,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:je(),last_event_at:t};return tt(Ne,JSON.stringify(n)),{id:n.id,isNew:!0}}var u={};bt(u,{BRAND:()=>rr,DIRTY:()=>q,EMPTY_PATH:()=>jn,INVALID:()=>h,NEVER:()=>Fr,OK:()=>R,ParseStatus:()=>E,Schema:()=>v,ZodAny:()=>Y,ZodArray:()=>H,ZodBigInt:()=>X,ZodBoolean:()=>Q,ZodBranded:()=>Re,ZodCatch:()=>ue,ZodDate:()=>ee,ZodDefault:()=>de,ZodDiscriminatedUnion:()=>Le,ZodEffects:()=>j,ZodEnum:()=>oe,ZodError:()=>A,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>$e,ZodIntersection:()=>ae,ZodIssueCode:()=>l,ZodLazy:()=>ie,ZodLiteral:()=>se,ZodMap:()=>we,ZodNaN:()=>be,ZodNativeEnum:()=>ce,ZodNever:()=>V,ZodNull:()=>ne,ZodNullable:()=>z,ZodNumber:()=>J,ZodObject:()=>I,ZodOptional:()=>M,ZodParsedType:()=>p,ZodPipeline:()=>Ae,ZodPromise:()=>W,ZodReadonly:()=>le,ZodRecord:()=>ze,ZodSchema:()=>v,ZodSet:()=>Te,ZodString:()=>B,ZodSymbol:()=>ke,ZodTransformer:()=>j,ZodTuple:()=>L,ZodType:()=>v,ZodUndefined:()=>te,ZodUnion:()=>re,ZodUnknown:()=>Z,ZodVoid:()=>xe,addIssueToContext:()=>f,any:()=>fr,array:()=>hr,bigint:()=>or,boolean:()=>Gt,coerce:()=>$r,custom:()=>Zt,date:()=>cr,datetimeRegex:()=>Ft,defaultErrorMap:()=>F,discriminatedUnion:()=>Sr,effect:()=>Or,enum:()=>Ar,function:()=>Cr,getErrorMap:()=>_e,getParsedType:()=>D,instanceof:()=>ir,intersection:()=>kr,isAborted:()=>Ve,isAsync:()=>ve,isDirty:()=>De,isValid:()=>G,late:()=>ar,lazy:()=>Er,literal:()=>Rr,makeIssue:()=>Ee,map:()=>Tr,nan:()=>sr,nativeEnum:()=>Ir,never:()=>mr,null:()=>lr,nullable:()=>Nr,number:()=>Kt,object:()=>yr,objectUtil:()=>rt,oboolean:()=>zr,onumber:()=>Lr,optional:()=>Mr,ostring:()=>Dr,pipeline:()=>Vr,preprocess:()=>jr,promise:()=>Pr,quotelessJson:()=>On,record:()=>wr,set:()=>br,setErrorMap:()=>Nn,strictObject:()=>_r,string:()=>Ht,symbol:()=>dr,transformer:()=>Or,tuple:()=>xr,undefined:()=>ur,union:()=>vr,unknown:()=>pr,util:()=>k,void:()=>gr});var k;(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 o of a)i[o]=o;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(let s of i)o[s]=a[s];return t.objectValues(o)},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 o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(let o of a)if(i(o))return o},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(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var rt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(rt||(rt={}));var p=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var l=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),On=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 o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,d=0;for(;d<o.path.length;){let c=o.path[d];d===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(o))):s[c]=s[c]||{_errors:[]},s=s[c],d++}}};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,k.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 Mn=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.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}"`:k.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.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 l.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 l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,k.assertNever(t)}return{message:n}},F=Mn;var Vt=F;function Nn(t){Vt=t}function _e(){return Vt}var Ee=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="",d=r.filter(c=>!!c).slice().reverse();for(let c of d)s=c(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}},jn=[];function f(t,e){let n=_e(),r=Ee({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===F?void 0:F].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,o=await a.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return h;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),q=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),Ve=t=>t.status==="aborted",De=t=>t.status==="dirty",G=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}},Dt=(t,e)=>{if(G(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:(o,s)=>{let{message:d}=t;return o.code==="invalid_enum_value"?{message:d??s.defaultError}:typeof s.data>"u"?{message:d??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:d??n??s.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:D(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:D(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:D(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Dt(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return G(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=>G(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:D(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ve(a)?a:Promise.resolve(a));return Dt(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 o=e(a),s=()=>i.addIssue({code:l.custom,...r(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(s(),!1)):o?!0:(s(),!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 z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return H.create(this)}promise(){return W.create(this,this._def)}or(e){return re.create([this,e],this._def)}and(e){return ae.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 de({..._(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Re({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ue({..._(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 Ae.create(this,e)}readonly(){return le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vn=/^c[^\s-]{8,}$/i,Dn=/^[0-9a-z]+$/,Ln=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zn=/^[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,$n=/^[a-z0-9_-]{21}$/i,Fn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Un=/^[-+]?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)?)??$/,Zn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",at,Kn=/^(?:(?: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])$/,Gn=/^(?:(?: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])$/,Bn=/^(([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]))$/,Yn=/^(([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])$/,Wn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qn=/^([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])))",Jn=new RegExp(`^${zt}$`);function $t(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 Xn(t){return new RegExp(`^${$t(t)}$`)}function Ft(t){let e=`${zt}T${$t(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 Qn(t,e){return!!((e==="v4"||!e)&&Kn.test(t)||(e==="v6"||!e)&&Bn.test(t))}function er(t,e){if(!Fn.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 tr(t,e){return!!((e==="v4"||!e)&&Gn.test(t)||(e==="v6"||!e)&&Yn.test(t))}var B=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.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:l.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:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?f(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&f(a,{code:l.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Zn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")at||(at=new RegExp(Hn,"u")),at.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")zn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")$n.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Vn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Dn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Ln.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:l.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:l.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:l.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:l.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:l.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:l.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ft(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Jn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Xn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Un.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Qn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?er(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?tr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Wn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?qn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:l.invalid_string,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:l.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}};B.create=t=>new B({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});function nr(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(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}var J=class t extends v{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)!==p.number){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:l.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:l.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:l.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?nr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:l.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:l.not_finite,message:i.message}),a.dirty()):k.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"&&k.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)}};J.create=t=>new J({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var X=class t extends v{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)!==p.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:l.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:l.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:l.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:l.invalid_type,expected:p.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}};X.create=t=>new X({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var Q=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.boolean,received:r.parsedType}),h}return R(e.data)}};Q.create=t=>new Q({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var ee=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return f(i,{code:l.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:l.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:l.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):k.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}};ee.create=t=>new ee({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var ke=class extends v{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.symbol,received:r.parsedType}),h}return R(e.data)}};ke.create=t=>new ke({typeName:y.ZodSymbol,..._(t)});var te=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.undefined,received:r.parsedType}),h}return R(e.data)}};te.create=t=>new te({typeName:y.ZodUndefined,..._(t)});var ne=class extends v{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.null,received:r.parsedType}),h}return R(e.data)}};ne.create=t=>new ne({typeName:y.ZodNull,..._(t)});var Y=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};Y.create=t=>new Y({typeName:y.ZodAny,..._(t)});var Z=class extends v{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 v{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:l.invalid_type,expected:p.never,received:n.parsedType}),h}};V.create=t=>new V({typeName:y.ZodNever,..._(t)});var xe=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.void,received:r.parsedType}),h}return R(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});var H=class t extends v{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==p.array)return f(n,{code:l.invalid_type,expected:p.array,received:n.parsedType}),h;if(a.exactLength!==null){let o=n.data.length>a.exactLength.value,s=n.data.length<a.exactLength.value;(o||s)&&(f(n,{code:o?l.too_big:l.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?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:l.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:l.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((o,s)=>a.type._parseAsync(new N(n,o,n.path,s)))).then(o=>E.mergeArray(r,o));let i=[...n.data].map((o,s)=>a.type._parseSync(new N(n,o,n.path,s)));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)}};H.create=(t,e)=>new H({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 H?new H({...t._def,type:Se(t.element)}):t instanceof M?M.create(Se(t.unwrap())):t instanceof z?z.create(Se(t.unwrap())):t instanceof L?L.create(t.items.map(e=>Se(e))):t}var I=class t extends v{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=k.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let c=this._getOrReturnCtx(e);return f(c,{code:l.invalid_type,expected:p.object,received:c.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let c in a.data)o.includes(c)||s.push(c);let d=[];for(let c of o){let m=i[c],x=a.data[c];d.push({key:{status:"valid",value:c},value:m._parse(new N(a,x,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof V){let c=this._def.unknownKeys;if(c==="passthrough")for(let m of s)d.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(c==="strict")s.length>0&&(f(a,{code:l.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let m of s){let x=a.data[m];d.push({key:{status:"valid",value:m},value:c._parse(new N(a,x,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let c=[];for(let m of d){let x=await m.key,w=await m.value;c.push({key:x,value:w,alwaysSet:m.alwaysSet})}return c}).then(c=>E.mergeObjectSync(r,c)):E.mergeObjectSync(r,d)}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 k.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 k.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 k.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 k.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 Ut(k.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 re=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new A(s.ctx.common.issues));return f(n,{code:l.invalid_union,unionErrors:o}),h}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(a);{let i,o=[];for(let d of r){let c={...n,common:{...n.common,issues:[]},parent:null},m=d._parseSync({data:n.data,path:n.path,parent:c});if(m.status==="valid")return m;m.status==="dirty"&&!i&&(i={result:m,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(d=>new A(d));return f(n,{code:l.invalid_union,unionErrors:s}),h}}get options(){return this._def.options}};re.create=(t,e)=>new re({options:t,typeName:y.ZodUnion,..._(e)});var U=t=>t instanceof ie?U(t.schema):t instanceof j?U(t.innerType()):t instanceof se?[t.value]:t instanceof oe?t.options:t instanceof ce?k.objectValues(t.enum):t instanceof de?U(t._def.innerType):t instanceof te?[void 0]:t instanceof ne?[null]:t instanceof M?[void 0,...U(t.unwrap())]:t instanceof z?[null,...U(t.unwrap())]:t instanceof Re||t instanceof le?U(t.unwrap()):t instanceof ue?U(t._def.innerType):[],Le=class t extends v{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:l.invalid_type,expected:p.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:l.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 o=U(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function it(t,e){let n=D(t),r=D(e);if(t===e)return{valid:!0,data:t};if(n===p.object&&r===p.object){let a=k.objectKeys(e),i=k.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(let s of i){let d=it(t[s],e[s]);if(!d.valid)return{valid:!1};o[s]=d.data}return{valid:!0,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let o=t[i],s=e[i],d=it(o,s);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return n===p.date&&r===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ae=class extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,o)=>{if(Ve(i)||Ve(o))return h;let s=it(i.value,o.value);return s.valid?((De(i)||De(o))&&n.dirty(),{status:n.value,value:s.data}):(f(r,{code:l.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,o])=>a(i,o)):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}))}};ae.create=(t,e,n)=>new ae({left:t,right:e,typeName:y.ZodIntersection,..._(n)});var L=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:l.invalid_type,expected:p.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:l.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:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,s)=>{let d=this._def.items[s]||this._def.rest;return d?d._parse(new N(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>E.mergeArray(n,o)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};L.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var ze=class t extends v{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!==p.object)return f(r,{code:l.invalid_type,expected:p.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)a.push({key:i._parse(new N(r,s,r.path,s)),value:o._parse(new N(r,r.data[s],r.path,s)),alwaysSet:s 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 v?new t({keyType:e,valueType:n,typeName:y.ZodRecord,..._(r)}):new t({keyType:B.create(),valueType:e,typeName:y.ZodRecord,..._(n)})}},we=class extends v{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!==p.map)return f(r,{code:l.invalid_type,expected:p.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,d],c)=>({key:a._parse(new N(r,s,r.path,[c,"key"])),value:i._parse(new N(r,d,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let d of o){let c=await d.key,m=await d.value;if(c.status==="aborted"||m.status==="aborted")return h;(c.status==="dirty"||m.status==="dirty")&&n.dirty(),s.set(c.value,m.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let d of o){let c=d.key,m=d.value;if(c.status==="aborted"||m.status==="aborted")return h;(c.status==="dirty"||m.status==="dirty")&&n.dirty(),s.set(c.value,m.value)}return{status:n.value,value:s}}}};we.create=(t,e,n)=>new we({valueType:e,keyType:t,typeName:y.ZodMap,..._(n)});var Te=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:l.invalid_type,expected:p.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:l.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:l.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function o(d){let c=new Set;for(let m of d){if(m.status==="aborted")return h;m.status==="dirty"&&n.dirty(),c.add(m.value)}return{status:n.value,value:c}}let s=[...r.data.values()].map((d,c)=>i._parse(new N(r,d,r.path,c)));return r.common.async?Promise.all(s).then(d=>o(d)):o(s)}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 $e=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return f(n,{code:l.invalid_type,expected:p.function,received:n.parsedType}),h;function r(s,d){return Ee({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),F].filter(c=>!!c),issueData:{code:l.invalid_arguments,argumentsError:d}})}function a(s,d){return Ee({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),F].filter(c=>!!c),issueData:{code:l.invalid_return_type,returnTypeError:d}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof W){let s=this;return R(async function(...d){let c=new A([]),m=await s._def.args.parseAsync(d,i).catch(b=>{throw c.addIssue(r(d,b)),c}),x=await Reflect.apply(o,this,m);return await s._def.returns._def.type.parseAsync(x,i).catch(b=>{throw c.addIssue(a(x,b)),c})})}else{let s=this;return R(function(...d){let c=s._def.args.safeParse(d,i);if(!c.success)throw new A([r(d,c.error)]);let m=Reflect.apply(o,this,c.data),x=s._def.returns.safeParse(m,i);if(!x.success)throw new A([a(m,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:L.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||L.create([]).rest(Z.create()),returns:n||Z.create(),typeName:y.ZodFunction,..._(r)})}},ie=class extends v{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})}};ie.create=(t,e)=>new ie({getter:t,typeName:y.ZodLazy,..._(e)});var se=class extends v{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};se.create=(t,e)=>new se({value:t,typeName:y.ZodLiteral,..._(e)});function Ut(t,e){return new oe({values:t,typeName:y.ZodEnum,..._(e)})}var oe=class t extends v{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:k.joinValues(r),received:n.parsedType,code:l.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:l.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})}};oe.create=Ut;var ce=class extends v{_parse(e){let n=k.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let a=k.objectValues(n);return f(r,{expected:k.joinValues(a),received:r.parsedType,code:l.invalid_type}),h}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=k.objectValues(n);return f(r,{received:r.data,code:l.invalid_enum_value,options:a}),h}return R(e.data)}get enum(){return this._def.values}};ce.create=(t,e)=>new ce({values:t,typeName:y.ZodNativeEnum,..._(e)});var W=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===!1)return f(n,{code:l.invalid_type,expected:p.promise,received:n.parsedType}),h;let r=n.parsedType===p.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 j=class extends v{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:o=>{f(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let o=a.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return h;let d=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return d.status==="aborted"?h:d.status==="dirty"?q(d.value):n.value==="dirty"?q(d.value):d});{if(n.value==="aborted")return h;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?h:s.status==="dirty"?q(s.value):n.value==="dirty"?q(s.value):s}}if(a.type==="refinement"){let o=s=>{let d=a.refinement(s,i);if(r.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!G(o))return h;let s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>G(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:n.value,value:s})):h);k.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 v{_parse(e){return this._getType(e)===p.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 v{_parse(e){return this._getType(e)===p.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 de=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};de.create=(t,e)=>new de({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ue=class extends v{_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}};ue.create=(t,e)=>new ue({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var be=class extends v{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};be.create=t=>new be({typeName:y.ZodNaN,..._(t)});var rr=Symbol("zod_brand"),Re=class extends v{_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}},Ae=class t extends v{_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(),q(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})}},le=class extends v{_parse(e){let n=this._def.innerType._parse(e),r=a=>(G(a)&&(a.value=Object.freeze(a.value)),a);return ve(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodReadonly,..._(e)});function Lt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Zt(t,e={},n){return t?Y.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let s=Lt(e,r),d=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:d})}});if(!i){let o=Lt(e,r),s=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:s})}}):Y.create()}var ar={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 ir=(t,e={message:`Input not instance of ${t.name}`})=>Zt(n=>n instanceof t,e),Ht=B.create,Kt=J.create,sr=be.create,or=X.create,Gt=Q.create,cr=ee.create,dr=ke.create,ur=te.create,lr=ne.create,fr=Y.create,pr=Z.create,mr=V.create,gr=xe.create,hr=H.create,yr=I.create,_r=I.strictCreate,vr=re.create,Sr=Le.create,kr=ae.create,xr=L.create,wr=ze.create,Tr=we.create,br=Te.create,Cr=$e.create,Er=ie.create,Rr=se.create,Ar=oe.create,Ir=ce.create,Pr=W.create,Or=j.create,Mr=M.create,Nr=z.create,jr=j.createWithPreprocess,Vr=Ae.create,Dr=()=>Ht().optional(),Lr=()=>Kt().optional(),zr=()=>Gt().optional(),$r={string:(t=>B.create({...t,coerce:!0})),number:(t=>J.create({...t,coerce:!0})),boolean:(t=>Q.create({...t,coerce:!0})),bigint:(t=>X.create({...t,coerce:!0})),date:(t=>ee.create({...t,coerce:!0}))};var Fr=h;var Fe=u.object({page:u.object({title:u.string().nullable(),path:u.string(),search:u.string(),hash:u.string()}),referrer:u.string().nullable(),viewport:u.object({w:u.number(),h:u.number()}).nullable().optional()}).strict(),Bt=u.object({}).strict();var ct="aranova_tracking_last_fired_url",st=null,ot=!1;function Ur(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function Zr(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Hr(){if(!ot){ot=!0;let t=Ur(ct);t!==null&&(st=t)}return st}function Kr(t){st=t,ot=!0,Zr(ct,t)}function Yt(t){return typeof window>"u"||typeof document>"u"?null:Fe.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 Ie(t){if(typeof window>"u")return;let e=window.location.href,n=Hr(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,o=Yt(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:o}),e!==n&&Kr(e)}function dt(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Ie(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function ut(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,Ie(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function o(...c){a(...c),setTimeout(r,0)}function s(...c){i(...c),setTimeout(r,0)}function d(c){c.persisted&&Ie(t)}return history.pushState=o,history.replaceState=s,window.addEventListener("popstate",r),window.addEventListener("pageshow",d),e.skipInitial||Ie(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",d)}}function Ue(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(Ue);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ue(r);return e}return t}function lt(t,e,n,r){let a=r?Object.keys(r.automatic):[],i=r?.manual?Object.keys(r.manual):[],o=null;if(r){let s={};for(let[d,c]of Object.entries(r.automatic)){let m=Ue(c);Object.keys(m).length>0&&(s[d]=m)}if(r.manual)for(let[d,c]of Object.entries(r.manual)){if(c===void 0)continue;let m=Ue(c);Object.keys(m).length>0&&(s[d]=m)}Object.keys(s).length>0&&(o=s)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:a,manual:i},trigger_config:o}}var qt=2e3,Jt=10,Ze=50,Xt="X-Aranova-Api-Key";function Br(t,e,n){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}}function Yr(){if(typeof window>"u")return Me();try{he()}catch{}return me(ge)}function Wr(){try{return{state:K()}}catch{return null}}async function Wt(t,e,n,r){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[Xt]:n},body:e,keepalive:r,credentials:"omit",mode:"cors"})}catch{}}function ft(t){let e=t.flushIntervalMs??qt,n=Math.min(t.maxQueueSize??Jt,Ze),r=t.sdkVersion??null,a=t.packageName??null,o=`${t.endpoint.replace(/\/$/,"")}/events`,s=[],d=null,c=null,m=!1,x=nt(),w=ye(),b=w.id;typeof window<"u"&&(c=window.location.href);function S(){let T=lt(t.surface,r,a,t.triggers??null);s.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:T,occurred_at:new Date().toISOString()})}w.isNew&&S();function C(){let T=ye();T.isNew&&T.id!==b&&S(),b=T.id;let P=Yr(),Ce=Br(t.surface,r,a);return{session_id:b,visitor_id:x,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:c,consent_state:Wr(),context:Ce}}function Pe(){d!==null||m||(d=setTimeout(()=>{d=null,He()},e))}function fe(){d!==null&&(clearTimeout(d),d=null)}async function He(){if(s.length===0)return;let T=s.slice(0,Ze);s=s.slice(T.length),fe();let P={session:C(),events:T},Ce=JSON.stringify(P);await Wt(o,Ce,t.apiKey,!1)}function Tn(T){if(m||!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();s.push({event_type:T.eventType,page_url:T.pageUrl??(typeof window>"u"?null:window.location.href),metadata:T.metadata??null,occurred_at:P}),s.length>=n?He():Pe()}function Oe(){if(s.length===0)return;let T=s.slice(0,Ze);s=s.slice(T.length),fe();let P={session:C(),events:T},Ce=JSON.stringify(P);Wt(o,Ce,t.apiKey,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Oe),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Oe()})),{trackEvent:Tn,flush:He,getSessionId:()=>b,getVisitorId:()=>x,destroy:()=>{m=!0,s.length>0&&Oe(),fe(),s=[],typeof window<"u"&&window.removeEventListener("pagehide",Oe)}}}var Qt=u.object({cta_name:u.string(),page:u.object({path:u.string()}),section:u.string().nullable().optional(),destination_url:u.string().nullable().optional()}).strict(),en=u.object({}).strict();var qr=u.object({automatic:u.array(u.string()),manual:u.array(u.string())}).strict(),tn=u.object({sdk_version:u.string(),package_name:u.string().nullable(),surface:u.enum(["next","react","script"]),triggers:qr,trigger_config:u.record(u.string(),u.record(u.string(),u.unknown())).nullable().optional()}).strict(),nn=u.object({}).strict();var rn=u.object({form:u.object({id:u.string(),action:u.string().nullable()}),page:u.object({path:u.string()})}).strict(),an=u.object({selector:u.string().optional()}).strict();var sn=u.object({form:u.object({id:u.string(),action:u.string().nullable(),fields:u.array(u.object({name:u.string(),type:u.string(),label:u.string().nullable(),has_value:u.boolean()})).optional()}),page:u.object({path:u.string()})}).strict(),on=u.object({}).strict();var cn=u.object({page_count:u.number().int().min(2),page:u.object({path:u.string()})}).strict(),dn=u.object({pageThreshold:u.number().int().min(2)}).strict();var un=u.object({phone_number:u.string(),page:u.object({path:u.string()}),section:u.string().nullable().optional()}).strict(),ln=u.object({}).strict();var fn=u.object({depth_percent:u.number().int().min(1).max(100),page:u.object({path:u.string()})}).strict(),pn=u.object({thresholds:u.array(u.number().int().min(1).max(100)).min(1)}).strict();var Jr=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],mn=u.enum(Jr),gn=u.object({page_name:mn,page:u.object({path:u.string()})}).strict(),hn=u.object({pages:u.array(u.object({name:mn,pathPattern:u.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})})).min(1)}).strict();var yn=u.object({duration_ms:u.number().int().nonnegative(),page:u.object({path:u.string()})}).strict(),_n=u.object({thresholdSeconds:u.number().int().positive()}).strict();var pt={page_view:{kind:"automatic",metadataSchema:Fe,configSchema:Bt},time_on_site:{kind:"automatic",metadataSchema:yn,configSchema:_n},specific_page_visit:{kind:"automatic",metadataSchema:gn,configSchema:hn},scroll_depth:{kind:"automatic",metadataSchema:fn,configSchema:pn},multi_page_session:{kind:"automatic",metadataSchema:cn,configSchema:dn},form_start:{kind:"automatic",metadataSchema:rn,configSchema:an},sdk_heartbeat:{kind:"automatic",metadataSchema:tn,configSchema:nn},form_submit:{kind:"manual",metadataSchema:sn,configSchema:on},phone_click:{kind:"manual",metadataSchema:un,configSchema:ln},cta_click:{kind:"manual",metadataSchema:Qt,configSchema:en}},Ti=Object.entries(pt).filter(([,t])=>t.kind==="automatic").map(([t])=>t),bi=Object.entries(pt).filter(([,t])=>t.kind==="manual").map(([t])=>t);function mt(t){return pt[t]}function gt(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,o=!1;function s(){o||(o=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function d(){if(o||a===null)return;let x=n-r;if(x<=0){s();return}i=setTimeout(s,x)}function c(){i!==null&&(clearTimeout(i),i=null)}function m(){o||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),c()):(a=Date.now(),d()))}return document.addEventListener("visibilitychange",m),d(),()=>{c(),document.removeEventListener("visibilitychange",m)}}function ht(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:m,pathPattern:x}of n){if(x.lastIndex=0,!x.test(c))continue;let w=`${m}:${c}`;r.has(w)||(r.add(w),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:m,page:{path:c}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),o=history.replaceState.bind(history);function s(...c){i(...c),setTimeout(a,0)}function d(...c){o(...c),setTimeout(a,0)}return history.pushState=s,history.replaceState=d,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=o,window.removeEventListener("popstate",a)}}function yt(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 o(){let S=document.documentElement,C=window.scrollY||S.scrollTop,Pe=S.scrollHeight,fe=S.clientHeight;return Pe<=fe?100:Math.round((C+fe)/Pe*100)}function s(){let S=o();for(let C of n)S>=C&&!r.has(C)&&(r.add(C),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:C,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function d(){i===null&&(i=requestAnimationFrame(()=>{i=null,s()}))}function c(){let S=window.location.pathname;S!==a&&(a=S,r=new Set,setTimeout(s,0))}let m=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){m(...S),setTimeout(c,0)}function b(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=b,window.addEventListener("popstate",c),window.addEventListener("scroll",d,{passive:!0}),setTimeout(s,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=m,history.replaceState=x,window.removeEventListener("popstate",c),window.removeEventListener("scroll",d)}}var _t="aranova_tracking_mps_paths",vn="aranova_tracking_mps_session",vt="aranova_tracking_mps_fired";function Xr(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function St(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=Xr();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let S=n.getItem(_t);return S?new Set(JSON.parse(S)):new Set}catch{return new Set}}function o(S){try{n.setItem(_t,JSON.stringify([...S]))}catch{}}function s(){let S=ye().id;n.getItem(vn)!==S&&(n.setItem(vn,S),n.removeItem(_t),n.removeItem(vt))}function d(){return n.getItem(vt)==="1"}function c(){let S=window.location.pathname;if(S===a||(a=S,s(),d()))return;let C=i();C.add(S),o(C),C.size>=r&&(n.setItem(vt,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:C.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let m=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){m(...S),setTimeout(c,0)}function b(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=b,window.addEventListener("popstate",c),c(),()=>{history.pushState=m,history.replaceState=x,window.removeEventListener("popstate",c)}}function kt(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 b=w.getAttribute("action");return b?`action:${b}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(w)}`}function o(w){let b=w.target;if(!(b instanceof HTMLElement))return;let S=b.closest(n);if(!S||S.tagName!=="FORM")return;let C=i(S);r.has(C)||(r.add(C),t.trackEvent({eventType:"form_start",metadata:{form:{id:S.id||"",action:S.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function s(){let w=window.location.pathname;w!==a&&(a=w,r=new Set)}let d=history.pushState.bind(history),c=history.replaceState.bind(history);function m(...w){d(...w),setTimeout(s,0)}function x(...w){c(...w),setTimeout(s,0)}return history.pushState=m,history.replaceState=x,window.addEventListener("popstate",s),document.addEventListener("focusin",o),()=>{history.pushState=d,history.replaceState=c,window.removeEventListener("popstate",s),document.removeEventListener("focusin",o)}}var xt="aranova-tracking-consent-banner";function Qr(){return me(ge)}function kn(){document.getElementById(xt)?.remove()}function xn(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 ea(){if(typeof document>"u"||K()!=="pending"||document.getElementById(xt))return;let t=document.createElement("div");t.id=xt,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=xn("Decline",()=>{pe("denied"),kn()},{}),i=xn("Accept",()=>{pe("granted"),kn()},{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,wt=null,$=[];function ta(){for(let t=$.length-1;t>=0;t--)$[t]();$=[],O!==null&&(O.destroy(),O=null),wt=null}function wn(t={}){if(typeof window>"u")return;window.AranovaTracking=Tt;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,renderConsentBanner:o=!0,triggers:s}=t;if(r&&he(window.location.href,a),i&&Je(i),o&&ea(),ta(),!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 d=s??{automatic:{page_view:{}},manual:{}};wt=d,O=ft({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:Ct,triggers:d}),$.push(ut(O)),$.push(dt(O));let c=d.automatic.time_on_site;c&&$.push(gt(O,c));let m=d.automatic.specific_page_visit;m&&$.push(ht(O,m));let x=d.automatic.scroll_depth;x&&$.push(yt(O,x));let w=d.automatic.multi_page_session;w&&$.push(St(O,w));let b=d.automatic.form_start;b&&$.push(kt(O,b))}function na(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=wt;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{mt(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 Tt={init:wn,captureTrackingParams:()=>he(),getTrackingParams:Qr,getConsentState:K,setConsentState:pe,trackEvent:na};typeof window<"u"&&(window.AranovaTracking=Tt);var ra=Tt;return An(aa);})();
1
+ "use strict";var AranovaTracking=(()=>{var Ke=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Rn=Object.prototype.hasOwnProperty;var Ct=(t,e)=>{for(var n in e)Ke(t,n,{get:e[n],enumerable:!0})},An=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of En(e))!Rn.call(t,a)&&a!==n&&Ke(t,a,{get:()=>e[a],enumerable:!(r=Cn(e,a))||r.enumerable});return t};var In=t=>An(Ke({},"__esModule",{value:!0}),t);var ia={};Ct(ia,{default:()=>aa,init:()=>Tn});var Et="0.6.1";var Ge="consent_state",Rt="consent_timestamp";function Be(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function K(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(Ge);return t==="granted"||t==="denied"?t:"pending"}function pe(t){typeof window>"u"||(window.localStorage.setItem(Ge,t),window.localStorage.setItem(Rt,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",Be(t)))}function Ye(){let t=K();return(t==="granted"||t==="denied")&&pe(t),t}var At="https://www.googletagmanager.com/gtag/js",We="data-aranova-tracking";function On(t){return`aranova-${t}`}function qe(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function It(){qe()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function Pt(t){if(typeof document>"u")return;let e=On("gtag-loader");if(document.querySelector(`script[${We}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${At}?id=${encodeURIComponent(t)}`,r.setAttribute(We,e),document.head.appendChild(r)}function Ot(t){let e=qe();e("js",new Date),e("config",t)}function Je(t){typeof window>"u"||typeof document>"u"||(It(),Pt(t),Ot(t),Ye())}var Xe=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Me(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function Qe(t){return typeof t=="string"&&t.length>0?t:null}function me(t){return Xe.reduce((e,n)=>(e[n]=Qe(t(n)),e),Me())}function Mt(t){return Xe.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 Qe(decodeURIComponent(r))}function Nt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function jt(t,e=7776e3){let n=Mt(t);return Object.entries(n).forEach(([r,a])=>{Nt(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 jt(n.searchParams,e),me(ge)}var et="aranova_tracking_visitor",Ne="aranova_tracking_session";function je(){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 Vt(t){try{return window.localStorage.getItem(t)}catch{return null}}function tt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function nt(){if(typeof window>"u")return je();let t=Vt(et);if(t&&t.length>0)return t;let e=je();return tt(et,e),e}function ye(t=Date.now()){if(typeof window>"u")return{id:je(),isNew:!0};let e=Vt(Ne);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 tt(Ne,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:je(),last_event_at:t};return tt(Ne,JSON.stringify(n)),{id:n.id,isNew:!0}}var d={};Ct(d,{BRAND:()=>ar,DIRTY:()=>q,EMPTY_PATH:()=>Vn,INVALID:()=>h,NEVER:()=>Ur,OK:()=>R,ParseStatus:()=>E,Schema:()=>v,ZodAny:()=>Y,ZodArray:()=>H,ZodBigInt:()=>X,ZodBoolean:()=>Q,ZodBranded:()=>Re,ZodCatch:()=>ue,ZodDate:()=>ee,ZodDefault:()=>de,ZodDiscriminatedUnion:()=>Le,ZodEffects:()=>j,ZodEnum:()=>oe,ZodError:()=>A,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>$e,ZodIntersection:()=>ae,ZodIssueCode:()=>l,ZodLazy:()=>ie,ZodLiteral:()=>se,ZodMap:()=>we,ZodNaN:()=>be,ZodNativeEnum:()=>ce,ZodNever:()=>V,ZodNull:()=>ne,ZodNullable:()=>z,ZodNumber:()=>J,ZodObject:()=>I,ZodOptional:()=>M,ZodParsedType:()=>p,ZodPipeline:()=>Ae,ZodPromise:()=>W,ZodReadonly:()=>le,ZodRecord:()=>ze,ZodSchema:()=>v,ZodSet:()=>Te,ZodString:()=>B,ZodSymbol:()=>ke,ZodTransformer:()=>j,ZodTuple:()=>L,ZodType:()=>v,ZodUndefined:()=>te,ZodUnion:()=>re,ZodUnknown:()=>Z,ZodVoid:()=>xe,addIssueToContext:()=>f,any:()=>pr,array:()=>yr,bigint:()=>cr,boolean:()=>Bt,coerce:()=>Fr,custom:()=>Ht,date:()=>dr,datetimeRegex:()=>Ut,defaultErrorMap:()=>F,discriminatedUnion:()=>kr,effect:()=>Mr,enum:()=>Ir,function:()=>Er,getErrorMap:()=>_e,getParsedType:()=>D,instanceof:()=>sr,intersection:()=>xr,isAborted:()=>Ve,isAsync:()=>ve,isDirty:()=>De,isValid:()=>G,late:()=>ir,lazy:()=>Rr,literal:()=>Ar,makeIssue:()=>Ee,map:()=>br,nan:()=>or,nativeEnum:()=>Pr,never:()=>gr,null:()=>fr,nullable:()=>jr,number:()=>Gt,object:()=>_r,objectUtil:()=>rt,oboolean:()=>$r,onumber:()=>zr,optional:()=>Nr,ostring:()=>Lr,pipeline:()=>Dr,preprocess:()=>Vr,promise:()=>Or,quotelessJson:()=>Mn,record:()=>Tr,set:()=>Cr,setErrorMap:()=>jn,strictObject:()=>vr,string:()=>Kt,symbol:()=>ur,transformer:()=>Mr,tuple:()=>wr,undefined:()=>lr,union:()=>Sr,unknown:()=>mr,util:()=>k,void:()=>hr});var k;(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 o of a)i[o]=o;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(let s of i)o[s]=a[s];return t.objectValues(o)},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 o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(let o of a)if(i(o))return o},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(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var rt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(rt||(rt={}));var p=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var l=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Mn=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 o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(o))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};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,k.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 Nn=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.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}"`:k.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.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 l.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 l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,k.assertNever(t)}return{message:n}},F=Nn;var Dt=F;function jn(t){Dt=t}function _e(){return Dt}var Ee=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="",u=r.filter(c=>!!c).slice().reverse();for(let c of u)s=c(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}},Vn=[];function f(t,e){let n=_e(),r=Ee({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===F?void 0:F].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,o=await a.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return h;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),q=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),Ve=t=>t.status==="aborted",De=t=>t.status==="dirty",G=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}},Lt=(t,e)=>{if(G(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:(o,s)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:u??n??s.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:D(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:D(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:D(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Lt(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return G(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=>G(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:D(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ve(a)?a:Promise.resolve(a));return Lt(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 o=e(a),s=()=>i.addIssue({code:l.custom,...r(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(s(),!1)):o?!0:(s(),!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 z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return H.create(this)}promise(){return W.create(this,this._def)}or(e){return re.create([this,e],this._def)}and(e){return ae.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 de({..._(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Re({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ue({..._(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 Ae.create(this,e)}readonly(){return le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dn=/^c[^\s-]{8,}$/i,Ln=/^[0-9a-z]+$/,zn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$n=/^[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,Fn=/^[a-z0-9_-]{21}$/i,Un=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zn=/^[-+]?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)?)??$/,Hn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",at,Gn=/^(?:(?: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])$/,Bn=/^(?:(?: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])$/,Yn=/^(([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]))$/,Wn=/^(([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])$/,qn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$t="((\\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])))",Xn=new RegExp(`^${$t}$`);function Ft(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 Qn(t){return new RegExp(`^${Ft(t)}$`)}function Ut(t){let e=`${$t}T${Ft(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 er(t,e){return!!((e==="v4"||!e)&&Gn.test(t)||(e==="v6"||!e)&&Yn.test(t))}function tr(t,e){if(!Un.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 nr(t,e){return!!((e==="v4"||!e)&&Bn.test(t)||(e==="v6"||!e)&&Wn.test(t))}var B=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.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:l.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:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?f(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&f(a,{code:l.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Hn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")at||(at=new RegExp(Kn,"u")),at.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")$n.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Fn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Dn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Ln.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")zn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:l.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:l.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:l.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:l.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:l.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:l.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ut(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Xn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Qn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:l.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Zn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?er(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?tr(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?nr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?qn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Jn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:l.invalid_string,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:l.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}};B.create=t=>new B({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});function rr(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(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}var J=class t extends v{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)!==p.number){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:l.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:l.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:l.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?rr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:l.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:l.not_finite,message:i.message}),a.dirty()):k.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"&&k.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)}};J.create=t=>new J({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var X=class t extends v{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)!==p.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:l.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:l.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:l.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:l.invalid_type,expected:p.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}};X.create=t=>new X({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var Q=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.boolean,received:r.parsedType}),h}return R(e.data)}};Q.create=t=>new Q({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var ee=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let i=this._getOrReturnCtx(e);return f(i,{code:l.invalid_type,expected:p.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return f(i,{code:l.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:l.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:l.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):k.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}};ee.create=t=>new ee({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var ke=class extends v{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.symbol,received:r.parsedType}),h}return R(e.data)}};ke.create=t=>new ke({typeName:y.ZodSymbol,..._(t)});var te=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.undefined,received:r.parsedType}),h}return R(e.data)}};te.create=t=>new te({typeName:y.ZodUndefined,..._(t)});var ne=class extends v{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.null,received:r.parsedType}),h}return R(e.data)}};ne.create=t=>new ne({typeName:y.ZodNull,..._(t)});var Y=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};Y.create=t=>new Y({typeName:y.ZodAny,..._(t)});var Z=class extends v{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 v{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:l.invalid_type,expected:p.never,received:n.parsedType}),h}};V.create=t=>new V({typeName:y.ZodNever,..._(t)});var xe=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.void,received:r.parsedType}),h}return R(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});var H=class t extends v{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==p.array)return f(n,{code:l.invalid_type,expected:p.array,received:n.parsedType}),h;if(a.exactLength!==null){let o=n.data.length>a.exactLength.value,s=n.data.length<a.exactLength.value;(o||s)&&(f(n,{code:o?l.too_big:l.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?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:l.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:l.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((o,s)=>a.type._parseAsync(new N(n,o,n.path,s)))).then(o=>E.mergeArray(r,o));let i=[...n.data].map((o,s)=>a.type._parseSync(new N(n,o,n.path,s)));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)}};H.create=(t,e)=>new H({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 H?new H({...t._def,type:Se(t.element)}):t instanceof M?M.create(Se(t.unwrap())):t instanceof z?z.create(Se(t.unwrap())):t instanceof L?L.create(t.items.map(e=>Se(e))):t}var I=class t extends v{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=k.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let c=this._getOrReturnCtx(e);return f(c,{code:l.invalid_type,expected:p.object,received:c.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let c in a.data)o.includes(c)||s.push(c);let u=[];for(let c of o){let m=i[c],x=a.data[c];u.push({key:{status:"valid",value:c},value:m._parse(new N(a,x,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof V){let c=this._def.unknownKeys;if(c==="passthrough")for(let m of s)u.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(c==="strict")s.length>0&&(f(a,{code:l.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let m of s){let x=a.data[m];u.push({key:{status:"valid",value:m},value:c._parse(new N(a,x,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let c=[];for(let m of u){let x=await m.key,w=await m.value;c.push({key:x,value:w,alwaysSet:m.alwaysSet})}return c}).then(c=>E.mergeObjectSync(r,c)):E.mergeObjectSync(r,u)}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 k.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 k.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 k.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 k.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 Zt(k.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 re=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new A(s.ctx.common.issues));return f(n,{code:l.invalid_union,unionErrors:o}),h}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(a);{let i,o=[];for(let u of r){let c={...n,common:{...n.common,issues:[]},parent:null},m=u._parseSync({data:n.data,path:n.path,parent:c});if(m.status==="valid")return m;m.status==="dirty"&&!i&&(i={result:m,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(u=>new A(u));return f(n,{code:l.invalid_union,unionErrors:s}),h}}get options(){return this._def.options}};re.create=(t,e)=>new re({options:t,typeName:y.ZodUnion,..._(e)});var U=t=>t instanceof ie?U(t.schema):t instanceof j?U(t.innerType()):t instanceof se?[t.value]:t instanceof oe?t.options:t instanceof ce?k.objectValues(t.enum):t instanceof de?U(t._def.innerType):t instanceof te?[void 0]:t instanceof ne?[null]:t instanceof M?[void 0,...U(t.unwrap())]:t instanceof z?[null,...U(t.unwrap())]:t instanceof Re||t instanceof le?U(t.unwrap()):t instanceof ue?U(t._def.innerType):[],Le=class t extends v{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:l.invalid_type,expected:p.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:l.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 o=U(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function it(t,e){let n=D(t),r=D(e);if(t===e)return{valid:!0,data:t};if(n===p.object&&r===p.object){let a=k.objectKeys(e),i=k.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(let s of i){let u=it(t[s],e[s]);if(!u.valid)return{valid:!1};o[s]=u.data}return{valid:!0,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let o=t[i],s=e[i],u=it(o,s);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return n===p.date&&r===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ae=class extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,o)=>{if(Ve(i)||Ve(o))return h;let s=it(i.value,o.value);return s.valid?((De(i)||De(o))&&n.dirty(),{status:n.value,value:s.data}):(f(r,{code:l.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,o])=>a(i,o)):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}))}};ae.create=(t,e,n)=>new ae({left:t,right:e,typeName:y.ZodIntersection,..._(n)});var L=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:l.invalid_type,expected:p.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:l.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:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new N(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>E.mergeArray(n,o)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};L.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var ze=class t extends v{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!==p.object)return f(r,{code:l.invalid_type,expected:p.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)a.push({key:i._parse(new N(r,s,r.path,s)),value:o._parse(new N(r,r.data[s],r.path,s)),alwaysSet:s 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 v?new t({keyType:e,valueType:n,typeName:y.ZodRecord,..._(r)}):new t({keyType:B.create(),valueType:e,typeName:y.ZodRecord,..._(n)})}},we=class extends v{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!==p.map)return f(r,{code:l.invalid_type,expected:p.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,u],c)=>({key:a._parse(new N(r,s,r.path,[c,"key"])),value:i._parse(new N(r,u,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,m=await u.value;if(c.status==="aborted"||m.status==="aborted")return h;(c.status==="dirty"||m.status==="dirty")&&n.dirty(),s.set(c.value,m.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let u of o){let c=u.key,m=u.value;if(c.status==="aborted"||m.status==="aborted")return h;(c.status==="dirty"||m.status==="dirty")&&n.dirty(),s.set(c.value,m.value)}return{status:n.value,value:s}}}};we.create=(t,e,n)=>new we({valueType:e,keyType:t,typeName:y.ZodMap,..._(n)});var Te=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:l.invalid_type,expected:p.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:l.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:l.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function o(u){let c=new Set;for(let m of u){if(m.status==="aborted")return h;m.status==="dirty"&&n.dirty(),c.add(m.value)}return{status:n.value,value:c}}let s=[...r.data.values()].map((u,c)=>i._parse(new N(r,u,r.path,c)));return r.common.async?Promise.all(s).then(u=>o(u)):o(s)}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 $e=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return f(n,{code:l.invalid_type,expected:p.function,received:n.parsedType}),h;function r(s,u){return Ee({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),F].filter(c=>!!c),issueData:{code:l.invalid_arguments,argumentsError:u}})}function a(s,u){return Ee({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),F].filter(c=>!!c),issueData:{code:l.invalid_return_type,returnTypeError:u}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof W){let s=this;return R(async function(...u){let c=new A([]),m=await s._def.args.parseAsync(u,i).catch(b=>{throw c.addIssue(r(u,b)),c}),x=await Reflect.apply(o,this,m);return await s._def.returns._def.type.parseAsync(x,i).catch(b=>{throw c.addIssue(a(x,b)),c})})}else{let s=this;return R(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new A([r(u,c.error)]);let m=Reflect.apply(o,this,c.data),x=s._def.returns.safeParse(m,i);if(!x.success)throw new A([a(m,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:L.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||L.create([]).rest(Z.create()),returns:n||Z.create(),typeName:y.ZodFunction,..._(r)})}},ie=class extends v{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})}};ie.create=(t,e)=>new ie({getter:t,typeName:y.ZodLazy,..._(e)});var se=class extends v{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};se.create=(t,e)=>new se({value:t,typeName:y.ZodLiteral,..._(e)});function Zt(t,e){return new oe({values:t,typeName:y.ZodEnum,..._(e)})}var oe=class t extends v{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:k.joinValues(r),received:n.parsedType,code:l.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:l.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})}};oe.create=Zt;var ce=class extends v{_parse(e){let n=k.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let a=k.objectValues(n);return f(r,{expected:k.joinValues(a),received:r.parsedType,code:l.invalid_type}),h}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=k.objectValues(n);return f(r,{received:r.data,code:l.invalid_enum_value,options:a}),h}return R(e.data)}get enum(){return this._def.values}};ce.create=(t,e)=>new ce({values:t,typeName:y.ZodNativeEnum,..._(e)});var W=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===!1)return f(n,{code:l.invalid_type,expected:p.promise,received:n.parsedType}),h;let r=n.parsedType===p.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 j=class extends v{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:o=>{f(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let o=a.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return h;let u=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return u.status==="aborted"?h:u.status==="dirty"?q(u.value):n.value==="dirty"?q(u.value):u});{if(n.value==="aborted")return h;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?h:s.status==="dirty"?q(s.value):n.value==="dirty"?q(s.value):s}}if(a.type==="refinement"){let o=s=>{let u=a.refinement(s,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!G(o))return h;let s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>G(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:n.value,value:s})):h);k.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 v{_parse(e){return this._getType(e)===p.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 v{_parse(e){return this._getType(e)===p.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 de=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};de.create=(t,e)=>new de({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ue=class extends v{_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}};ue.create=(t,e)=>new ue({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var be=class extends v{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return f(r,{code:l.invalid_type,expected:p.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};be.create=t=>new be({typeName:y.ZodNaN,..._(t)});var ar=Symbol("zod_brand"),Re=class extends v{_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}},Ae=class t extends v{_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(),q(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})}},le=class extends v{_parse(e){let n=this._def.innerType._parse(e),r=a=>(G(a)&&(a.value=Object.freeze(a.value)),a);return ve(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodReadonly,..._(e)});function zt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Ht(t,e={},n){return t?Y.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let s=zt(e,r),u=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:u})}});if(!i){let o=zt(e,r),s=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:s})}}):Y.create()}var ir={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}`})=>Ht(n=>n instanceof t,e),Kt=B.create,Gt=J.create,or=be.create,cr=X.create,Bt=Q.create,dr=ee.create,ur=ke.create,lr=te.create,fr=ne.create,pr=Y.create,mr=Z.create,gr=V.create,hr=xe.create,yr=H.create,_r=I.create,vr=I.strictCreate,Sr=re.create,kr=Le.create,xr=ae.create,wr=L.create,Tr=ze.create,br=we.create,Cr=Te.create,Er=$e.create,Rr=ie.create,Ar=se.create,Ir=oe.create,Pr=ce.create,Or=W.create,Mr=j.create,Nr=M.create,jr=z.create,Vr=j.createWithPreprocess,Dr=Ae.create,Lr=()=>Kt().optional(),zr=()=>Gt().optional(),$r=()=>Bt().optional(),Fr={string:(t=>B.create({...t,coerce:!0})),number:(t=>J.create({...t,coerce:!0})),boolean:(t=>Q.create({...t,coerce:!0})),bigint:(t=>X.create({...t,coerce:!0})),date:(t=>ee.create({...t,coerce:!0}))};var Ur=h;var Fe=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(),Yt=d.object({}).strict();var ct="aranova_tracking_last_fired_url",st=null,ot=!1;function Zr(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function Hr(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Kr(){if(!ot){ot=!0;let t=Zr(ct);t!==null&&(st=t)}return st}function Gr(t){st=t,ot=!0,Hr(ct,t)}function Wt(t){return typeof window>"u"||typeof document>"u"?null:Fe.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 Ie(t){if(typeof window>"u")return;let e=window.location.href,n=Kr(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,o=Wt(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:o}),e!==n&&Gr(e)}function dt(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Ie(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function ut(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,Ie(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function o(...c){a(...c),setTimeout(r,0)}function s(...c){i(...c),setTimeout(r,0)}function u(c){c.persisted&&Ie(t)}return history.pushState=o,history.replaceState=s,window.addEventListener("popstate",r),window.addEventListener("pageshow",u),e.skipInitial||Ie(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",u)}}function Ue(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(Ue);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ue(r);return e}return t}function lt(t,e,n,r){let a=r?Object.keys(r.automatic):[],i=r?.manual?Object.keys(r.manual):[],o=null;if(r){let s={};for(let[u,c]of Object.entries(r.automatic)){let m=Ue(c);Object.keys(m).length>0&&(s[u]=m)}if(r.manual)for(let[u,c]of Object.entries(r.manual)){if(c===void 0)continue;let m=Ue(c);Object.keys(m).length>0&&(s[u]=m)}Object.keys(s).length>0&&(o=s)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:a,manual:i},trigger_config:o}}var Jt=2e3,Xt=10,Ze=50,Qt="X-Aranova-Api-Key";function Yr(t,e,n){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}}function Wr(){if(typeof window>"u")return Me();try{he()}catch{}return me(ge)}function qr(){try{return{state:K()}}catch{return null}}async function qt(t,e,n,r){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[Qt]:n},body:e,keepalive:r,credentials:"omit",mode:"cors"})}catch{}}function ft(t){let e=t.flushIntervalMs??Jt,n=Math.min(t.maxQueueSize??Xt,Ze),r=t.sdkVersion??null,a=t.packageName??null,o=`${t.endpoint.replace(/\/$/,"")}/events`,s=[],u=null,c=null,m=!1,x=nt(),w=ye(),b=w.id;typeof window<"u"&&(c=window.location.href);function S(){let T=lt(t.surface,r,a,t.triggers??null);s.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:T,occurred_at:new Date().toISOString()})}w.isNew&&S();function C(){let T=ye();T.isNew&&T.id!==b&&S(),b=T.id;let P=Wr(),Ce=Yr(t.surface,r,a);return{session_id:b,visitor_id:x,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:c,consent_state:qr(),context:Ce}}function Pe(){u!==null||m||(u=setTimeout(()=>{u=null,He()},e))}function fe(){u!==null&&(clearTimeout(u),u=null)}async function He(){if(s.length===0)return;let T=s.slice(0,Ze);s=s.slice(T.length),fe();let P={session:C(),events:T},Ce=JSON.stringify(P);await qt(o,Ce,t.apiKey,!1)}function bn(T){if(m||!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();s.push({event_type:T.eventType,page_url:T.pageUrl??(typeof window>"u"?null:window.location.href),metadata:T.metadata??null,occurred_at:P}),s.length>=n?He():Pe()}function Oe(){if(s.length===0)return;let T=s.slice(0,Ze);s=s.slice(T.length),fe();let P={session:C(),events:T},Ce=JSON.stringify(P);qt(o,Ce,t.apiKey,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Oe),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Oe()})),{trackEvent:bn,flush:He,getSessionId:()=>b,getVisitorId:()=>x,destroy:()=>{m=!0,s.length>0&&Oe(),fe(),s=[],typeof window<"u"&&window.removeEventListener("pagehide",Oe)}}}var en=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(),tn=d.object({}).strict();var Jr=d.object({automatic:d.array(d.string()),manual:d.array(d.string())}).strict(),nn=d.object({sdk_version:d.string(),package_name:d.string().nullable(),surface:d.enum(["next","react","script"]),triggers:Jr,trigger_config:d.record(d.string(),d.record(d.string(),d.unknown())).nullable().optional()}).strict(),rn=d.object({}).strict();var an=d.object({form:d.object({id:d.string(),action:d.string().nullable()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),sn=d.object({selector:d.string().optional()}).strict();var pt=d.lazy(()=>d.union([d.string(),d.number().finite(),d.boolean(),d.null(),d.array(pt),d.record(pt)])),on=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:pt}).strict()).optional()}).strict(),page:d.object({path:d.string()}).strict()}).strict(),cn=d.object({}).strict();var dn=d.object({page_count:d.number().int().min(2),page:d.object({path:d.string()}).strict()}).strict(),un=d.object({pageThreshold:d.number().int().min(2)}).strict();var ln=d.object({phone_number:d.string(),page:d.object({path:d.string()}).strict(),section:d.string().nullable().optional()}).strict(),fn=d.object({}).strict();var pn=d.object({depth_percent:d.number().int().min(1).max(100),page:d.object({path:d.string()}).strict()}).strict(),mn=d.object({thresholds:d.array(d.number().int().min(1).max(100)).min(1)}).strict();var Xr=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],gn=d.enum(Xr),hn=d.object({page_name:gn,page:d.object({path:d.string()}).strict()}).strict(),yn=d.object({pages:d.array(d.object({name:gn,pathPattern:d.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var _n=d.object({duration_ms:d.number().int().nonnegative(),page:d.object({path:d.string()}).strict()}).strict(),vn=d.object({thresholdSeconds:d.number().int().positive()}).strict();var mt={page_view:{kind:"automatic",metadataSchema:Fe,configSchema:Yt},time_on_site:{kind:"automatic",metadataSchema:_n,configSchema:vn},specific_page_visit:{kind:"automatic",metadataSchema:hn,configSchema:yn},scroll_depth:{kind:"automatic",metadataSchema:pn,configSchema:mn},multi_page_session:{kind:"automatic",metadataSchema:dn,configSchema:un},form_start:{kind:"automatic",metadataSchema:an,configSchema:sn},sdk_heartbeat:{kind:"automatic",metadataSchema:nn,configSchema:rn},form_submit:{kind:"manual",metadataSchema:on,configSchema:cn},phone_click:{kind:"manual",metadataSchema:ln,configSchema:fn},cta_click:{kind:"manual",metadataSchema:en,configSchema:tn}},bi=Object.entries(mt).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Ci=Object.entries(mt).filter(([,t])=>t.kind==="manual").map(([t])=>t);function gt(t){return mt[t]}function ht(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,o=!1;function s(){o||(o=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function u(){if(o||a===null)return;let x=n-r;if(x<=0){s();return}i=setTimeout(s,x)}function c(){i!==null&&(clearTimeout(i),i=null)}function m(){o||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),c()):(a=Date.now(),u()))}return document.addEventListener("visibilitychange",m),u(),()=>{c(),document.removeEventListener("visibilitychange",m)}}function yt(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:m,pathPattern:x}of n){if(x.lastIndex=0,!x.test(c))continue;let w=`${m}:${c}`;r.has(w)||(r.add(w),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:m,page:{path:c}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),o=history.replaceState.bind(history);function s(...c){i(...c),setTimeout(a,0)}function u(...c){o(...c),setTimeout(a,0)}return history.pushState=s,history.replaceState=u,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=o,window.removeEventListener("popstate",a)}}function _t(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 o(){let S=document.documentElement,C=window.scrollY||S.scrollTop,Pe=S.scrollHeight,fe=S.clientHeight;return Pe<=fe?100:Math.round((C+fe)/Pe*100)}function s(){let S=o();for(let C of n)S>=C&&!r.has(C)&&(r.add(C),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:C,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function u(){i===null&&(i=requestAnimationFrame(()=>{i=null,s()}))}function c(){let S=window.location.pathname;S!==a&&(a=S,r=new Set,setTimeout(s,0))}let m=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){m(...S),setTimeout(c,0)}function b(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=b,window.addEventListener("popstate",c),window.addEventListener("scroll",u,{passive:!0}),setTimeout(s,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=m,history.replaceState=x,window.removeEventListener("popstate",c),window.removeEventListener("scroll",u)}}var vt="aranova_tracking_mps_paths",Sn="aranova_tracking_mps_session",St="aranova_tracking_mps_fired";function Qr(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function kt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=Qr();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let S=n.getItem(vt);return S?new Set(JSON.parse(S)):new Set}catch{return new Set}}function o(S){try{n.setItem(vt,JSON.stringify([...S]))}catch{}}function s(){let S=ye().id;n.getItem(Sn)!==S&&(n.setItem(Sn,S),n.removeItem(vt),n.removeItem(St))}function u(){return n.getItem(St)==="1"}function c(){let S=window.location.pathname;if(S===a||(a=S,s(),u()))return;let C=i();C.add(S),o(C),C.size>=r&&(n.setItem(St,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:C.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let m=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){m(...S),setTimeout(c,0)}function b(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=b,window.addEventListener("popstate",c),c(),()=>{history.pushState=m,history.replaceState=x,window.removeEventListener("popstate",c)}}function xt(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 b=w.getAttribute("action");return b?`action:${b}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(w)}`}function o(w){let b=w.target;if(!(b instanceof HTMLElement))return;let S=b.closest(n);if(!S||S.tagName!=="FORM")return;let C=i(S);r.has(C)||(r.add(C),t.trackEvent({eventType:"form_start",metadata:{form:{id:S.id||"",action:S.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function s(){let w=window.location.pathname;w!==a&&(a=w,r=new Set)}let u=history.pushState.bind(history),c=history.replaceState.bind(history);function m(...w){u(...w),setTimeout(s,0)}function x(...w){c(...w),setTimeout(s,0)}return history.pushState=m,history.replaceState=x,window.addEventListener("popstate",s),document.addEventListener("focusin",o),()=>{history.pushState=u,history.replaceState=c,window.removeEventListener("popstate",s),document.removeEventListener("focusin",o)}}var wt="aranova-tracking-consent-banner";function ea(){return me(ge)}function xn(){document.getElementById(wt)?.remove()}function wn(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 ta(){if(typeof document>"u"||K()!=="pending"||document.getElementById(wt))return;let t=document.createElement("div");t.id=wt,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=wn("Decline",()=>{pe("denied"),xn()},{}),i=wn("Accept",()=>{pe("granted"),xn()},{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,Tt=null,$=[];function na(){for(let t=$.length-1;t>=0;t--)$[t]();$=[],O!==null&&(O.destroy(),O=null),Tt=null}function Tn(t={}){if(typeof window>"u")return;window.AranovaTracking=bt;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,renderConsentBanner:o=!0,triggers:s}=t;if(r&&he(window.location.href,a),i&&Je(i),o&&ta(),na(),!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 u=s??{automatic:{page_view:{}},manual:{}};Tt=u,O=ft({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:Et,triggers:u}),$.push(ut(O)),$.push(dt(O));let c=u.automatic.time_on_site;c&&$.push(ht(O,c));let m=u.automatic.specific_page_visit;m&&$.push(yt(O,m));let x=u.automatic.scroll_depth;x&&$.push(_t(O,x));let w=u.automatic.multi_page_session;w&&$.push(kt(O,w));let b=u.automatic.form_start;b&&$.push(xt(O,b))}function ra(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=Tt;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{gt(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 bt={init:Tn,captureTrackingParams:()=>he(),getTrackingParams:ea,getConsentState:K,setConsentState:pe,trackEvent:ra};typeof window<"u"&&(window.AranovaTracking=bt);var aa=bt;return In(ia);})();
2
2
  //# sourceMappingURL=aranova-tracking.global.js.map