@aranova/tracking-browser 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -120,6 +120,38 @@ The browser package validates manual events at runtime. If an event is not regis
|
|
|
120
120
|
</a>
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
### CTA clicks — manual or auto-capture
|
|
124
|
+
|
|
125
|
+
Fire `cta_click` per element with an inline handler, or opt into **auto-capture** and skip the
|
|
126
|
+
handlers entirely. Add `autoCapture` to the `cta_click` registration in `init()`:
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
manual: {
|
|
130
|
+
cta_click: { autoCapture: {} }, // default selector: [data-aranova-cta]
|
|
131
|
+
// or target existing classes: { autoCapture: { selector: "a.cta, .btn-primary" } }
|
|
132
|
+
},
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then tag your CTAs with data attributes — a single delegated listener does the rest:
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<a href="/booking" data-aranova-cta="Book now" data-aranova-section="hero">Book now</a>
|
|
139
|
+
<button data-aranova-cta="Get a quote">Get a quote</button>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`cta_name` resolves to the `data-aranova-cta` value, else the element's trimmed text
|
|
143
|
+
(capped 120 chars), else `tag#id`. `section` comes from an optional `data-aranova-section`;
|
|
144
|
+
`href`/`destination_url` and a short `element` descriptor are captured automatically. Point
|
|
145
|
+
the selector at real CTAs (an explicit attribute is the safe default) — every matching click
|
|
146
|
+
is counted, including ones that later `stopPropagation`.
|
|
147
|
+
|
|
148
|
+
### Automatic dwell + exit (`page_exit`)
|
|
149
|
+
|
|
150
|
+
`page_exit` is captured automatically — no registration. On navigation, tab hide, and page
|
|
151
|
+
unload it records the **active** (visible) time spent on the page plus the max scroll depth
|
|
152
|
+
reached, delivered via a keepalive beacon so the final page still counts. This powers per-page
|
|
153
|
+
dwell and drop-off in the dashboard Analytics tab; there is nothing to configure.
|
|
154
|
+
|
|
123
155
|
## Global API
|
|
124
156
|
|
|
125
157
|
```js
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var AranovaTracking=(()=>{var Tt=Object.defineProperty;var Vr=Object.getOwnPropertyDescriptor;var Fr=Object.getOwnPropertyNames;var jr=Object.prototype.hasOwnProperty;var Cn=(t,e)=>{for(var n in e)Tt(t,n,{get:e[n],enumerable:!0})},Lr=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Fr(e))!jr.call(t,i)&&i!==n&&Tt(t,i,{get:()=>e[i],enumerable:!(r=Vr(e,i))||r.enumerable});return t};var $r=t=>Lr(Tt({},"__esModule",{value:!0}),t);var Za={};Cn(Za,{default:()=>qa,init:()=>Mr});var xn="0.15.0";var Xe="consent_state",Je="consent_timestamp",ye="consent_expires_at";var Et={state:"granted",source:"default",updatedAt:null,expiresAt:null},Kr=new Set;function wn(t){for(let e of Kr)try{e(t)}catch{}}function Qe(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function _e(){if(typeof window>"u")return Et;try{let t=window.localStorage.getItem(Xe),e=window.localStorage.getItem(Je);if(t==="granted")return{state:"granted",source:"explicit",updatedAt:e,expiresAt:null};if(t==="denied"){let n=window.localStorage.getItem(ye);if(!n){n=new Date(Date.now()+90*864e5).toISOString();try{window.localStorage.setItem(ye,n)}catch{}}if(!(Date.parse(n)<=Date.now()))return{state:"denied",source:"explicit",updatedAt:e,expiresAt:n}}}catch{}return Et}function U(){return _e().state}function kn(t){typeof window>"u"||(typeof window.gtag=="function"&&window.gtag("consent","update",Qe(t)),typeof window.fbq=="function"&&window.fbq("consent",t==="granted"?"grant":"revoke"))}function Le(t,e){if(typeof window>"u")return;let n=e?.declineTtlDays,r=typeof n=="number"&&Number.isFinite(n)&&n>0?n:90,i=new Date().toISOString(),a=t==="denied"?new Date(Date.now()+r*864e5).toISOString():null;try{window.localStorage.setItem(Xe,t),window.localStorage.setItem(Je,i),a!==null?window.localStorage.setItem(ye,a):window.localStorage.removeItem(ye)}catch{}kn(t),wn({state:t,source:"explicit",updatedAt:i,expiresAt:a})}function Rt(){Le("granted")}function It(t){Le("denied",t)}function Pt(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Xe),window.localStorage.removeItem(Je),window.localStorage.removeItem(ye)}catch{}kn("granted"),wn(Et)}}var ve=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Se(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function et(t){return typeof t=="string"&&t.length>0?t:null}function Ce(t){return ve.reduce((e,n)=>(e[n]=et(t(n)),e),Se())}function tt(t){return ve.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}var Ur="_aranova_track_";function bn(t){return`${Ur}${t}`}function nt(t,e,n=7776e3){let r=encodeURIComponent(e);if(typeof document<"u")try{document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}catch{}if(typeof window<"u")try{window.localStorage.setItem(bn(t),r)}catch{}}function xe(t){if(typeof document<"u"){let n=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(`${t}=`));if(n){let[,r=""]=n.split("=");return et(decodeURIComponent(r))}}if(typeof window<"u")try{let e=window.localStorage.getItem(bn(t));if(e)return et(decodeURIComponent(e))}catch{}return null}function we(t){return xe(t)}function Tn(t,e,n=7776e3){nt(t,e,n)}function At(t,e){return ve.reduce((n,r)=>(n[r]=t[r]??e[r],n),Se())}function En(t,e=7776e3){let n=tt(t);return Object.entries(n).forEach(([r,i])=>{Tn(r,i,e)}),n}function Q(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 En(n.searchParams,e),Ce(we)}var In="https://www.googletagmanager.com/gtag/js",ke="data-aranova-tracking";function zr(t){return`aranova-${t}`}var Hr=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function Ot(t){return Hr.test(t)}function rt(){if(window.dataLayer=window.dataLayer||[],typeof window.gtag=="function")return window.gtag;function t(){window.dataLayer?.push(arguments)}return window.gtag=t,window.gtag}var qr=/^AW-[A-Za-z0-9]+\/[A-Za-z0-9_-]+$/;function Pn(t){return qr.test(t)}function Nt(t){if(typeof window>"u"||typeof window.gtag!="function"||!Pn(t.sendTo))return!1;let e={send_to:t.sendTo};t.value!=null&&(e.value=t.value),t.currency&&(e.currency=t.currency),t.transactionId&&(e.transaction_id=t.transactionId);try{return window.gtag("event","conversion",e),!0}catch{return!1}}function Mt(){rt()("consent","default",Qe(U()==="denied"?"denied":"granted"))}function Dt(t){if(typeof document>"u")return;let e=zr("gtag-loader");if(document.querySelector(`script[${ke}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${In}?id=${encodeURIComponent(t)}`,r.setAttribute(ke,e),document.head.append(r)}function An(t){let e=rt();e("js",new Date),e("config",t)}function Vt(t){typeof window>"u"||typeof document>"u"||Ot(t)&&(Mt(),Dt(t),An(t))}function Ft(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&Ot(r));if(e.length===0)return;Mt(),Dt(e[0]);let n=rt();n("js",new Date);for(let r of e)n("config",r)}var On="https://connect.facebook.net/en_US/fbevents.js",jt="_fbc",Nn="_fbp",Zr=/^\d{15,16}$/;function Lt(t){return Zr.test(t)}function Mn(t){let e=t.split(".").filter(Boolean);return Math.max(0,e.length-1)}function Dn(t,e,n){let r=n??(typeof window>"u"?"":window.location.hostname);return`fb.${Mn(r)}.${e}.${t}`}function $e(){return xe(jt)}function at(){return xe(Nn)}function Br(){if(typeof window>"u")return null;try{let t=new URL(window.location.href).searchParams.get("fbclid");return t&&t.trim().length>0?t:null}catch{return null}}function Ge(t=typeof Date>"u"?0:Date.now()){if(typeof window>"u"||$e())return;let e=Br()??xe("fbclid");e&&nt(jt,Dn(e,t),7776e3)}function Yr(t){return`aranova-${t}`}function st(){let t=window;if(typeof t.fbq=="function")return t.fbq;let e=function(...n){e.callMethod?e.callMethod.apply(e,n):e.queue.push(n)};return e.push=e,e.loaded=!0,e.version="2.0",e.queue=[],t.fbq=e,t._fbq||(t._fbq=e),e}function $t(){st()("consent",U()==="denied"?"revoke":"grant")}function Gt(){if(typeof document>"u")return;let t=Yr("fbq-loader");if(document.querySelector(`script[${ke}="${t}"]`))return;let n=document.createElement("script");n.async=!0,n.src=On,n.setAttribute(ke,t),document.head.append(n)}function Vn(t){let e=st();e("init",t),e("track","PageView")}function Kt(t){typeof window>"u"||typeof document>"u"||Lt(t)&&($t(),Gt(),Vn(t),Ge())}function Ut(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&Lt(r));if(e.length===0)return;$t(),Gt();let n=st();for(let r of e)n("init",r);n("track","PageView"),Ge()}var zt="_aranova_track_landing",Ke=null;function Wr(t){if(typeof t!="object"||t===null)return{};let e=t;return ve.reduce((n,r)=>{let i=e[r];return typeof i=="string"&&i.length>0&&(n[r]=i),n},{})}function Xr(){try{let t=window.localStorage.getItem(zt);if(!t)return null;let e=JSON.parse(t);return typeof e.session_id!="string"||e.session_id.length===0?null:{session_id:e.session_id,params:Wr(e.params)}}catch{return null}}function Jr(t){Ke=t;try{window.localStorage.setItem(zt,JSON.stringify(t))}catch{}}function Qr(t){try{let e=new URL(t??window.location.href,window.location.origin);return tt(e.searchParams)}catch{return{}}}function ot(t,e){if(typeof window>"u")return{};let n=Xr();if(n&&n.session_id===t)return Ke=n,n.params;if(Ke&&Ke.session_id===t)return Ke.params;let r={session_id:t,params:Qr(e)};return Jr(r),r.params}function ct(t,e){let n=e??(typeof window>"u"?null:ot(t));return n===null?{}:{landing_gclid:n.gclid??null,landing_fbclid:n.fbclid??null,landing_utm_source:n.utm_source??null,landing_utm_medium:n.utm_medium??null,landing_utm_campaign:n.utm_campaign??null,landing_utm_term:n.utm_term??null,landing_utm_content:n.utm_content??null}}var ei="_aranova_conv_";function Fn(t){return`${ei}${t.transactionId??""}:${t.sendTo}`}function ti(t){if(!t.transactionId||typeof window>"u")return!1;try{return window.sessionStorage.getItem(Fn(t))!==null}catch{return!1}}function ni(t){if(!(!t.transactionId||typeof window>"u"))try{window.sessionStorage.setItem(Fn(t),"1")}catch{}}function ri(t){ti(t)||Nt(t)&&ni(t)}function be(t){U()!=="denied"&&ri(t)}function jn(t){return typeof t=="object"&&t!==null&&Object.values(t).every(e=>typeof e=="string")}function Ln(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.send_to!="string"?null:{send_to:e.send_to,value_cents:typeof e.value_cents=="number"?e.value_cents:null,currency:typeof e.currency=="string"?e.currency:null}}function ii(t){if(!t||typeof t!="object")return null;let e=t;if(typeof e.event_type!="string")return null;let n={event_type:e.event_type};return typeof e.threshold_percent=="number"&&(n.threshold_percent=e.threshold_percent),typeof e.threshold_seconds=="number"&&(n.threshold_seconds=e.threshold_seconds),typeof e.page_threshold=="number"&&(n.page_threshold=e.page_threshold),typeof e.page_name=="string"&&(n.page_name=e.page_name),n}function Ht(t){if(!t||typeof t!="object")return null;let e=t,r=(Array.isArray(e.services)?e.services:[]).flatMap(s=>{if(!s||typeof s!="object")return[];let o=s;return typeof o.key!="string"?[]:[{key:o.key,label:typeof o.label=="string"?o.label:void 0,firing:Ln(o.firing)}]}),i=Array.isArray(e.goals)?e.goals:null,a=i?i.flatMap(s=>{if(!s||typeof s!="object")return[];let o=s;return typeof o.key!="string"?[]:[{key:o.key,label:typeof o.label=="string"?o.label:void 0,kind:o.kind==="event"?"event":"sale",trigger:ii(o.trigger),firing:Ln(o.firing)}]}):r.map(s=>({key:s.key,label:s.label,kind:"sale",trigger:null,firing:s.firing}));return{schema_version:typeof e.schema_version=="number"?e.schema_version:1,config_version:typeof e.config_version=="number"?e.config_version:0,business_id:typeof e.business_id=="string"?e.business_id:void 0,customer_id:typeof e.customer_id=="string"?e.customer_id:null,environment:typeof e.environment=="string"?e.environment:void 0,gtag_ids:jn(e.gtag_ids)?e.gtag_ids:{},meta_pixel_ids:jn(e.meta_pixel_ids)?e.meta_pixel_ids:{},services:r,goals:a}}var ai="_aranova_cfg_";function $n(t){return`${ai}${t}`}function si(t){if(typeof window>"u")return null;try{let e=window.sessionStorage.getItem($n(t));if(!e)return null;let n=JSON.parse(e),r=Ht(n.config);return r?{etag:typeof n.etag=="string"?n.etag:null,config:r}:null}catch{return null}}function oi(t,e){if(!(typeof window>"u"))try{window.sessionStorage.setItem($n(t),JSON.stringify(e))}catch{}}function qt(t){let e=si(t.cdnUrl),n=e?.config??t.baked??null,r=e?.etag??null,i=new Map,a=new Set;function s(){i.clear();for(let p of n?.goals??[])i.set(p.key,p)}function o(){let p=[...a];a.clear();for(let h of p)try{h()}catch{}}function l(p,h){if(!p||n&&p.config_version<=n.config_version)return;let x=n===null;n=p,r=h,s(),oi(t.cdnUrl,{etag:r,config:p}),x&&o()}async function u(){if(!(typeof window>"u"))try{let p=t.fetchImpl??globalThis.fetch;if(!p)return;let h={};r&&(h["If-None-Match"]=r);let x=await p(t.cdnUrl,{method:"GET",headers:h});if(x.status===304||!x.ok)return;l(Ht(await x.json()),x.headers.get("ETag"))}catch{}}return s(),u(),{getFiring:p=>i.get(p)?.firing??null,getGoal:p=>i.get(p)??null,listGoals:()=>[...i.values()],current:()=>n,isReady:()=>n!==null,onResolve:p=>n!==null?(p(),()=>{}):(a.add(p),()=>a.delete(p)),revalidate:u}}var ci={USD:2,CAD:2};function ui(t){return ci[t]??2}function Ue(t,e){return t/10**ui(e)}function li(t,e,n){let r=t.trigger;if(!r||r.event_type!==e)return!1;switch(e){case"scroll_depth":return typeof n.depth_percent=="number"&&r.threshold_percent!=null&&n.depth_percent>=r.threshold_percent;case"time_on_site":return typeof n.duration_ms=="number"&&r.threshold_seconds!=null&&n.duration_ms>=r.threshold_seconds*1e3;case"multi_page_session":return typeof n.page_count=="number"&&r.page_threshold!=null&&n.page_count>=r.page_threshold;case"specific_page_visit":return typeof n.page_name=="string"&&n.page_name===r.page_name;case"page_view":case"form_start":return!0;default:return!1}}function di(){return typeof window>"u"?"":window.location.pathname}var pi=50;function Zt(t){let e=[],n=!1;function r(i,a){for(let s of t.listGoals()){if(s.kind!=="event"||!s.firing||!li(s,i,a))continue;let o=s.firing,l=o.value_cents??null,u=o.currency??null;be({sendTo:o.send_to,value:l!=null&&u?Ue(l,u):null,currency:u,transactionId:`auto:${s.key}:${di()}`})}}return{onAutomaticEvent(i,a){if(t.isReady()){r(i,a);return}e.length<pi&&e.push({eventType:i,metadata:a}),n||(n=!0,t.onResolve(()=>{let s=e.splice(0);for(let o of s)r(o.eventType,o.metadata)}))}}}function Bt(t,e){return{...t,trackEvent:n=>{t.trackEvent(n);try{e.onAutomaticEvent(n.eventType,n.metadata??{})}catch{}}}}var Yt="aranova_tracking_visitor",ut="aranova_tracking_session",Gn=1800*1e3;function lt(){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 Kn(t){try{return window.localStorage.getItem(t)}catch{return null}}function Wt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function Xt(){if(typeof window>"u")return lt();let t=Kn(Yt);if(t&&t.length>0)return t;let e=lt();return Wt(Yt,e),e}function Te(t=Date.now()){if(typeof window>"u")return{id:lt(),isNew:!0};let e=Kn(ut);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=Gn){let i={id:r.id,last_event_at:t};return Wt(ut,JSON.stringify(i)),{id:r.id,isNew:!1}}}catch{}let n={id:lt(),last_event_at:t};return Wt(ut,JSON.stringify(n)),{id:n.id,isNew:!0}}var c={};Cn(c,{BRAND:()=>Li,DIRTY:()=>ee,EMPTY_PATH:()=>yi,INVALID:()=>y,NEVER:()=>wa,OK:()=>R,ParseStatus:()=>E,Schema:()=>C,ZodAny:()=>X,ZodArray:()=>Z,ZodBigInt:()=>ne,ZodBoolean:()=>re,ZodBranded:()=>He,ZodCatch:()=>me,ZodDate:()=>ie,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>ft,ZodEffects:()=>V,ZodEnum:()=>de,ZodError:()=>I,ZodFirstPartyTypeKind:()=>_,ZodFunction:()=>gt,ZodIntersection:()=>ce,ZodIssueCode:()=>d,ZodLazy:()=>ue,ZodLiteral:()=>le,ZodMap:()=>Oe,ZodNaN:()=>Me,ZodNativeEnum:()=>pe,ZodNever:()=>j,ZodNull:()=>se,ZodNullable:()=>G,ZodNumber:()=>te,ZodObject:()=>P,ZodOptional:()=>M,ZodParsedType:()=>m,ZodPipeline:()=>qe,ZodPromise:()=>J,ZodReadonly:()=>ge,ZodRecord:()=>mt,ZodSchema:()=>C,ZodSet:()=>Ne,ZodString:()=>W,ZodSymbol:()=>Pe,ZodTransformer:()=>V,ZodTuple:()=>$,ZodType:()=>C,ZodUndefined:()=>ae,ZodUnion:()=>oe,ZodUnknown:()=>q,ZodVoid:()=>Ae,addIssueToContext:()=>f,any:()=>Bi,array:()=>Ji,bigint:()=>Ui,boolean:()=>Qn,coerce:()=>xa,custom:()=>Wn,date:()=>zi,datetimeRegex:()=>Bn,defaultErrorMap:()=>z,discriminatedUnion:()=>na,effect:()=>ma,enum:()=>da,function:()=>ca,getErrorMap:()=>Ee,getParsedType:()=>L,instanceof:()=>Gi,intersection:()=>ra,isAborted:()=>dt,isAsync:()=>Re,isDirty:()=>pt,isValid:()=>Y,late:()=>$i,lazy:()=>ua,literal:()=>la,makeIssue:()=>ze,map:()=>sa,nan:()=>Ki,nativeEnum:()=>pa,never:()=>Wi,null:()=>Zi,nullable:()=>ha,number:()=>Jn,object:()=>Qi,objectUtil:()=>Jt,oboolean:()=>Ca,onumber:()=>Sa,optional:()=>ga,ostring:()=>va,pipeline:()=>_a,preprocess:()=>ya,promise:()=>fa,quotelessJson:()=>mi,record:()=>aa,set:()=>oa,setErrorMap:()=>hi,strictObject:()=>ea,string:()=>Xn,symbol:()=>Hi,transformer:()=>ma,tuple:()=>ia,undefined:()=>qi,union:()=>ta,unknown:()=>Yi,util:()=>w,void:()=>Xi});var w;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let a={};for(let s of i)a[s]=s;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(let o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(let s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(w||(w={}));var Jt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Jt||(Jt={}));var m=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}};var d=w.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"]),mi=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),I=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(a){return a.message},r={_errors:[]},i=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){let u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(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,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};I.create=t=>new I(t);var gi=(t,e)=>{let n;switch(t.code){case d.invalid_type:t.received===m.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,w.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${w.joinValues(t.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${w.joinValues(t.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${w.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.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}"`:w.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case d.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 d.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 d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=e.defaultError,w.assertNever(t)}return{message:n}},z=gi;var Un=z;function hi(t){Un=t}function Ee(){return Un}var ze=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],s={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let o="",l=r.filter(u=>!!u).slice().reverse();for(let u of l)o=u(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},yi=[];function f(t,e){let n=Ee(),r=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===z?void 0:z].filter(i=>!!i)});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 i of n){if(i.status==="aborted")return y;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,s=await i.value;r.push({key:a,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:s}=i;if(a.status==="aborted"||s.status==="aborted")return y;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},y=Object.freeze({status:"aborted"}),ee=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),dt=t=>t.status==="aborted",pt=t=>t.status==="dirty",Y=t=>t.status==="valid",Re=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 D=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}},zn=(t,e)=>{if(Y(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 I(t.common.issues);return this._error=n,this._error}}};function S(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=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:i}:{errorMap:(s,o)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:i}}var C=class{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Re(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},i=this._parseSync({data:e,path:r.path,parent:r});return zn(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Y(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=>Y(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(Re(i)?i:Promise.resolve(i));return zn(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let s=e(i),o=()=>a.addIssue({code:d.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new V({schema:this,typeName:_.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 G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return J.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new V({...S(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new fe({...S(this._def),innerType:this,defaultValue:n,typeName:_.ZodDefault})}brand(){return new He({typeName:_.ZodBranded,type:this,...S(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new me({...S(this._def),innerType:this,catchValue:n,typeName:_.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return qe.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_i=/^c[^\s-]{8,}$/i,vi=/^[0-9a-z]+$/,Si=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ci=/^[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,xi=/^[a-z0-9_-]{21}$/i,wi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ki=/^[-+]?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)?)??$/,bi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ti="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qt,Ei=/^(?:(?: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])$/,Ri=/^(?:(?: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])$/,Ii=/^(([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]))$/,Pi=/^(([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])$/,Ai=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Oi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qn="((\\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])))",Ni=new RegExp(`^${qn}$`);function Zn(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 Mi(t){return new RegExp(`^${Zn(t)}$`)}function Bn(t){let e=`${qn}T${Zn(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 Di(t,e){return!!((e==="v4"||!e)&&Ei.test(t)||(e==="v6"||!e)&&Ii.test(t))}function Vi(t,e){if(!wi.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,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Fi(t,e){return!!((e==="v4"||!e)&&Ri.test(t)||(e==="v6"||!e)&&Pi.test(t))}var W=class t extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),y}let r=new E,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(i=this._getOrReturnCtx(e,i),s?f(i,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(i,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")bi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"email",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Qt||(Qt=new RegExp(Ti,"u")),Qt.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"emoji",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Ci.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"uuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")xi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"nanoid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")_i.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")vi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cuid2",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Si.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"ulid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),f(i,{validation:"url",code:d.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"regex",code:d.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Bn(a).test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Ni.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?Mi(a).test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:d.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?ki.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Di(e.data,a.version)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"ip",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Vi(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"jwt",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Fi(e.data,a.version)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cidr",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Ai.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Oi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"base64url",code:d.invalid_string,message:a.message}),r.dirty()):w.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:d.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}};W.create=t=>new W({checks:[],typeName:_.ZodString,coerce:t?.coerce??!1,...S(t)});function ji(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var te=class t extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),y}let r,i=new E;for(let a of this._def.checks)a.kind==="int"?w.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?ji(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_finite,message:a.message}),i.dirty()):w.assertNever(a);return{status:i.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,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_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"&&w.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)}};te.create=t=>new te({checks:[],typeName:_.ZodNumber,coerce:t?.coerce||!1,...S(t)});var ne=class t extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let r,i=new E;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):w.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.bigint,received:n.parsedType}),y}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,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_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}};ne.create=t=>new ne({checks:[],typeName:_.ZodBigInt,coerce:t?.coerce??!1,...S(t)});var re=class extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.boolean,received:r.parsedType}),y}return R(e.data)}};re.create=t=>new re({typeName:_.ZodBoolean,coerce:t?.coerce||!1,...S(t)});var ie=class t extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}let r=new E,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):w.assertNever(a);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}};ie.create=t=>new ie({checks:[],coerce:t?.coerce||!1,typeName:_.ZodDate,...S(t)});var Pe=class extends C{_parse(e){if(this._getType(e)!==m.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.symbol,received:r.parsedType}),y}return R(e.data)}};Pe.create=t=>new Pe({typeName:_.ZodSymbol,...S(t)});var ae=class extends C{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.undefined,received:r.parsedType}),y}return R(e.data)}};ae.create=t=>new ae({typeName:_.ZodUndefined,...S(t)});var se=class extends C{_parse(e){if(this._getType(e)!==m.null){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.null,received:r.parsedType}),y}return R(e.data)}};se.create=t=>new se({typeName:_.ZodNull,...S(t)});var X=class extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};X.create=t=>new X({typeName:_.ZodAny,...S(t)});var q=class extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};q.create=t=>new q({typeName:_.ZodUnknown,...S(t)});var j=class extends C{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.never,received:n.parsedType}),y}};j.create=t=>new j({typeName:_.ZodNever,...S(t)});var Ae=class extends C{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.void,received:r.parsedType}),y}return R(e.data)}};Ae.create=t=>new Ae({typeName:_.ZodVoid,...S(t)});var Z=class t extends C{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==m.array)return f(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),y;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,o=n.data.length<i.exactLength.value;(s||o)&&(f(n,{code:s?d.too_big:d.too_small,minimum:o?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(f(n,{code:d.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(f(n,{code:d.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>i.type._parseAsync(new D(n,s,n.path,o)))).then(s=>E.mergeArray(r,s));let a=[...n.data].map((s,o)=>i.type._parseSync(new D(n,s,n.path,o)));return E.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:g.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};Z.create=(t,e)=>new Z({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...S(e)});function Ie(t){if(t instanceof P){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=M.create(Ie(r))}return new P({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:Ie(t.element)}):t instanceof M?M.create(Ie(t.unwrap())):t instanceof G?G.create(Ie(t.unwrap())):t instanceof $?$.create(t.items.map(e=>Ie(e))):t}var P=class t extends C{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=w.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),y}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||o.push(u);let l=[];for(let u of s){let p=a[u],h=i.data[u];l.push({key:{status:"valid",value:u},value:p._parse(new D(i,h,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof j){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(u==="strict")o.length>0&&(f(i,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of o){let h=i.data[p];l.push({key:{status:"valid",value:p},value:u._parse(new D(i,h,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of l){let h=await p.key,x=await p.value;u.push({key:h,value:x,alwaysSet:p.alwaysSet})}return u}).then(u=>E.mergeObjectSync(r,u)):E.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(e).message??i}:{message:i}}}:{}})}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:_.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 w.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 w.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ie(this)}partial(e){let n={};for(let r of w.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of w.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof M;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return Yn(w.objectKeys(this.shape))}};P.create=(t,e)=>new P({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:_.ZodObject,...S(e)});P.strictCreate=(t,e)=>new P({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:_.ZodObject,...S(e)});P.lazycreate=(t,e)=>new P({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:_.ZodObject,...S(e)});var oe=class extends C{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(o=>new I(o.ctx.common.issues));return f(n,{code:d.invalid_union,unionErrors:s}),y}if(n.common.async)return Promise.all(r.map(async a=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let a,s=[];for(let l of r){let u={...n,common:{...n.common,issues:[]},parent:null},p=l._parseSync({data:n.data,path:n.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(l=>new I(l));return f(n,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}};oe.create=(t,e)=>new oe({options:t,typeName:_.ZodUnion,...S(e)});var H=t=>t instanceof ue?H(t.schema):t instanceof V?H(t.innerType()):t instanceof le?[t.value]:t instanceof de?t.options:t instanceof pe?w.objectValues(t.enum):t instanceof fe?H(t._def.innerType):t instanceof ae?[void 0]:t instanceof se?[null]:t instanceof M?[void 0,...H(t.unwrap())]:t instanceof G?[null,...H(t.unwrap())]:t instanceof He||t instanceof ge?H(t.unwrap()):t instanceof me?H(t._def.innerType):[],ft=class t extends C{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return f(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),y;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let s=H(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,a)}}return new t({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...S(r)})}};function en(t,e){let n=L(t),r=L(e);if(t===e)return{valid:!0,data:t};if(n===m.object&&r===m.object){let i=w.objectKeys(e),a=w.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(let o of a){let l=en(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===m.array&&r===m.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let s=t[a],o=e[a],l=en(s,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===m.date&&r===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ce=class extends C{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,s)=>{if(dt(a)||dt(s))return y;let o=en(a.value,s.value);return o.valid?((pt(a)||pt(s))&&n.dirty(),{status:n.value,value:o.data}):(f(r,{code:d.invalid_intersection_types}),y)};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(([a,s])=>i(a,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ce.create=(t,e,n)=>new ce({left:t,right:e,typeName:_.ZodIntersection,...S(n)});var $=class t extends C{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return f(r,{code:d.invalid_type,expected:m.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return f(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new D(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>E.mergeArray(n,s)):E.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};$.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $({items:t,typeName:_.ZodTuple,rest:null,...S(e)})};var mt=class t extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return f(r,{code:d.invalid_type,expected:m.object,received:r.parsedType}),y;let i=[],a=this._def.keyType,s=this._def.valueType;for(let o in r.data)i.push({key:a._parse(new D(r,o,r.path,o)),value:s._parse(new D(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?E.mergeObjectAsync(n,i):E.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof C?new t({keyType:e,valueType:n,typeName:_.ZodRecord,...S(r)}):new t({keyType:W.create(),valueType:e,typeName:_.ZodRecord,...S(n)})}},Oe=class extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.map)return f(r,{code:d.invalid_type,expected:m.map,received:r.parsedType}),y;let i=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([o,l],u)=>({key:i._parse(new D(r,o,r.path,[u,"key"])),value:a._parse(new D(r,l,r.path,[u,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let u=await l.key,p=await l.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(u.value,p.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let l of s){let u=l.key,p=l.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(u.value,p.value)}return{status:n.value,value:o}}}};Oe.create=(t,e,n)=>new Oe({valueType:e,keyType:t,typeName:_.ZodMap,...S(n)});var Ne=class t extends C{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return f(r,{code:d.invalid_type,expected:m.set,received:r.parsedType}),y;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(f(r,{code:d.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(f(r,{code:d.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function s(l){let u=new Set;for(let p of l){if(p.status==="aborted")return y;p.status==="dirty"&&n.dirty(),u.add(p.value)}return{status:n.value,value:u}}let o=[...r.data.values()].map((l,u)=>a._parse(new D(r,l,r.path,u)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Ne.create=(t,e)=>new Ne({valueType:t,minSize:null,maxSize:null,typeName:_.ZodSet,...S(e)});var gt=class t extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.function)return f(n,{code:d.invalid_type,expected:m.function,received:n.parsedType}),y;function r(o,l){return ze({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ee(),z].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:l}})}function i(o,l){return ze({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ee(),z].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:l}})}let a={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof J){let o=this;return R(async function(...l){let u=new I([]),p=await o._def.args.parseAsync(l,a).catch(b=>{throw u.addIssue(r(l,b)),u}),h=await Reflect.apply(s,this,p);return await o._def.returns._def.type.parseAsync(h,a).catch(b=>{throw u.addIssue(i(h,b)),u})})}else{let o=this;return R(function(...l){let u=o._def.args.safeParse(l,a);if(!u.success)throw new I([r(l,u.error)]);let p=Reflect.apply(s,this,u.data),h=o._def.returns.safeParse(p,a);if(!h.success)throw new I([i(p,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:$.create(e).rest(q.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||$.create([]).rest(q.create()),returns:n||q.create(),typeName:_.ZodFunction,...S(r)})}},ue=class extends C{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})}};ue.create=(t,e)=>new ue({getter:t,typeName:_.ZodLazy,...S(e)});var le=class extends C{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}};le.create=(t,e)=>new le({value:t,typeName:_.ZodLiteral,...S(e)});function Yn(t,e){return new de({values:t,typeName:_.ZodEnum,...S(e)})}var de=class t extends C{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:w.joinValues(r),received:n.parsedType,code:d.invalid_type}),y}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:d.invalid_enum_value,options:r}),y}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})}};de.create=Yn;var pe=class extends C{_parse(e){let n=w.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==m.string&&r.parsedType!==m.number){let i=w.objectValues(n);return f(r,{expected:w.joinValues(i),received:r.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=w.objectValues(n);return f(r,{received:r.data,code:d.invalid_enum_value,options:i}),y}return R(e.data)}get enum(){return this._def.values}};pe.create=(t,e)=>new pe({values:t,typeName:_.ZodNativeEnum,...S(e)});var J=class extends C{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.promise&&n.common.async===!1)return f(n,{code:d.invalid_type,expected:m.promise,received:n.parsedType}),y;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return R(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};J.create=(t,e)=>new J({type:t,typeName:_.ZodPromise,...S(e)});var V=class extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:s=>{f(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let s=i.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return y;let l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?y:l.status==="dirty"?ee(l.value):n.value==="dirty"?ee(l.value):l});{if(n.value==="aborted")return y;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?y:o.status==="dirty"?ee(o.value):n.value==="dirty"?ee(o.value):o}}if(i.type==="refinement"){let s=o=>{let l=i.refinement(o,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?y:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Y(s))return y;let o=i.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Y(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:n.value,value:o})):y);w.assertNever(i)}};V.create=(t,e,n)=>new V({schema:t,typeName:_.ZodEffects,effect:e,...S(n)});V.createWithPreprocess=(t,e,n)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:_.ZodEffects,...S(n)});var M=class extends C{_parse(e){return this._getType(e)===m.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:_.ZodOptional,...S(e)});var G=class extends C{_parse(e){return this._getType(e)===m.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(t,e)=>new G({innerType:t,typeName:_.ZodNullable,...S(e)});var fe=class extends C{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===m.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var me=class extends C{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Re(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};me.create=(t,e)=>new me({innerType:t,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var Me=class extends C{_parse(e){if(this._getType(e)!==m.nan){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:m.nan,received:r.parsedType}),y}return{status:"valid",value:e.data}}};Me.create=t=>new Me({typeName:_.ZodNaN,...S(t)});var Li=Symbol("zod_brand"),He=class extends C{_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}},qe=class t extends C{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?y:a.status==="dirty"?(n.dirty(),ee(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?y:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:_.ZodPipeline})}},ge=class extends C{_parse(e){let n=this._def.innerType._parse(e),r=i=>(Y(i)&&(i.value=Object.freeze(i.value)),i);return Re(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};ge.create=(t,e)=>new ge({innerType:t,typeName:_.ZodReadonly,...S(e)});function Hn(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Wn(t,e={},n){return t?X.create().superRefine((r,i)=>{let a=t(r);if(a instanceof Promise)return a.then(s=>{if(!s){let o=Hn(e,r),l=o.fatal??n??!0;i.addIssue({code:"custom",...o,fatal:l})}});if(!a){let s=Hn(e,r),o=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:o})}}):X.create()}var $i={object:P.lazycreate},_;(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"})(_||(_={}));var Gi=(t,e={message:`Input not instance of ${t.name}`})=>Wn(n=>n instanceof t,e),Xn=W.create,Jn=te.create,Ki=Me.create,Ui=ne.create,Qn=re.create,zi=ie.create,Hi=Pe.create,qi=ae.create,Zi=se.create,Bi=X.create,Yi=q.create,Wi=j.create,Xi=Ae.create,Ji=Z.create,Qi=P.create,ea=P.strictCreate,ta=oe.create,na=ft.create,ra=ce.create,ia=$.create,aa=mt.create,sa=Oe.create,oa=Ne.create,ca=gt.create,ua=ue.create,la=le.create,da=de.create,pa=pe.create,fa=J.create,ma=V.create,ga=M.create,ha=G.create,ya=V.createWithPreprocess,_a=qe.create,va=()=>Xn().optional(),Sa=()=>Jn().optional(),Ca=()=>Qn().optional(),xa={string:(t=>W.create({...t,coerce:!0})),number:(t=>te.create({...t,coerce:!0})),boolean:(t=>re.create({...t,coerce:!0})),bigint:(t=>ne.create({...t,coerce:!0})),date:(t=>ie.create({...t,coerce:!0}))};var wa=y;var ht=c.object({page:c.object({title:c.string().nullable(),path:c.string(),search:c.string(),hash:c.string()}).strict(),referrer:c.string().nullable(),viewport:c.object({w:c.number(),h:c.number()}).strict().nullable().optional()}).strict(),er=c.object({}).strict();var rn="aranova_tracking_last_fired_url",tn=null,nn=!1;function ka(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function ba(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Ta(){if(!nn){nn=!0;let t=ka(rn);t!==null&&(tn=t)}return tn}function Ea(t){tn=t,nn=!0,ba(rn,t)}function tr(t){return typeof window>"u"||typeof document>"u"?null:ht.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 Ze(t){if(typeof window>"u")return;let e=window.location.href,n=Ta(),r=n!==null&&n!==e?n:null,i=typeof document<"u"&&document.referrer||null,s=tr(r??i);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&Ea(e)}function an(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Ze(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function sn(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let u=window.location.pathname+window.location.search;u!==n&&(n=u,Ze(t))}let i=history.pushState.bind(history),a=history.replaceState.bind(history);function s(...u){i(...u),setTimeout(r,0)}function o(...u){a(...u),setTimeout(r,0)}function l(u){u.persisted&&Ze(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",l),e.skipInitial||Ze(t),()=>{history.pushState=i,history.replaceState=a,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",l)}}function yt(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(yt);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=yt(r);return e}return t}function on(t,e,n,r,i=null){let a=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let l={};for(let[u,p]of Object.entries(r.automatic)){let h=yt(p);Object.keys(h).length>0&&(l[u]=h)}if(r.manual)for(let[u,p]of Object.entries(r.manual)){if(p===void 0)continue;let h=yt(p);Object.keys(h).length>0&&(l[u]=h)}Object.keys(l).length>0&&(o=l)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:a,manual:s},trigger_config:o,configured_gtag_ids:i}}var rr=2e3,ir=10,_t=50,vt="X-Aranova-Api-Key",St="X-Aranova-Sdk-Version",Ct="X-Aranova-Sdk-Package",xt="X-Aranova-Sdk-Surface",wt="X-Aranova-Sdk-Environment";function Ia(t,e,n,r,i){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null,environment:r,active_gtag_ids:i}}function Pa(){if(typeof window>"u")return Se();try{Q()}catch{}return Ce(we)}function Aa(){try{let t=_e();return{state:t.state,source:t.source,updated_at:t.updatedAt,expires_at:t.expiresAt}}catch{return null}}async function nr(t,e,n,r,i){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[vt]:n,[St]:r.sdkVersion,[Ct]:r.packageName,[xt]:r.surface,[wt]:r.environment},body:e,keepalive:i,credentials:"omit",mode:"cors"})}catch{}}function cn(t){let e=t.flushIntervalMs??rr,n=Math.min(t.maxQueueSize??ir,_t),r=t.sdkVersion??null,i=t.packageName??null,a=t.environment??"production",s=t.activeGtagIds??null,l=`${t.endpoint.replace(/\/$/,"")}/events`,u={sdkVersion:r??"",packageName:i??"",surface:t.surface,environment:a},p=[],h=null,x=null,b=Se(),v=!1,T=Xt(),B=Te(),N=B.id;if(typeof window<"u"){x=window.location.href;try{b=Q()}catch{}ot(N);try{Ge()}catch{}}function De(){let k=on(t.surface,r,i,t.triggers??null,s);p.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:k,occurred_at:new Date().toISOString()})}B.isNew&&De();function Ve(){let k=Te();k.isNew&&k.id!==N&&De(),N=k.id;let A=At(Pa(),b),je=Ia(t.surface,r,i,a,s);return{session_id:N,visitor_id:T,gclid:A.gclid,fbclid:A.fbclid,fbc:$e(),fbp:at(),utm_source:A.utm_source,utm_medium:A.utm_medium,utm_campaign:A.utm_campaign,utm_term:A.utm_term,utm_content:A.utm_content,...ct(N),first_page:x,consent_state:Aa(),context:je}}function Ye(){h!==null||v||(h=setTimeout(()=>{h=null,Fe()},e))}function he(){h!==null&&(clearTimeout(h),h=null)}async function Fe(){if(p.length===0)return;let k=p.slice(0,_t);p=p.slice(k.length),he();let A={session:Ve(),events:k},je=JSON.stringify(A);await nr(l,je,t.apiKey,u,!1)}function Dr(k){if(v||!k||typeof k.eventType!="string"||k.eventType.length===0)return;let A=k.occurredAt instanceof Date?k.occurredAt.toISOString():typeof k.occurredAt=="string"?k.occurredAt:new Date().toISOString();p.push({event_type:k.eventType,page_url:k.pageUrl??(typeof window>"u"?null:window.location.href),metadata:k.metadata??null,occurred_at:A}),p.length>=n?Fe():Ye()}function We(){if(p.length===0)return;let k=p.slice(0,_t);p=p.slice(k.length),he();let A={session:Ve(),events:k},je=JSON.stringify(A);nr(l,je,t.apiKey,u,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",We),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&We()})),{trackEvent:Dr,flush:Fe,getSessionId:()=>N,getVisitorId:()=>T,destroy:()=>{v=!0,p.length>0&&We(),he(),p=[],typeof window<"u"&&window.removeEventListener("pagehide",We)}}}var ar=c.object({cta_name:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional(),destination_url:c.string().nullable().optional()}).strict(),sr=c.object({}).strict();var Oa=c.object({automatic:c.array(c.string()),manual:c.array(c.string())}).strict(),or=c.object({sdk_version:c.string(),package_name:c.string().nullable(),surface:c.enum(["next","react","script"]),triggers:Oa,trigger_config:c.record(c.string(),c.record(c.string(),c.unknown())).nullable().optional(),configured_gtag_ids:c.record(c.string(),c.string()).nullable().optional()}).strict(),cr=c.object({}).strict();var ur=c.object({form:c.object({id:c.string(),action:c.string().nullable()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),lr=c.object({selector:c.string().optional()}).strict();var un=c.lazy(()=>c.union([c.string(),c.number().finite(),c.boolean(),c.null(),c.array(un),c.record(un)])),dr=c.object({form:c.object({id:c.string(),action:c.string().nullable(),fields:c.array(c.object({name:c.string(),type:c.string(),label:c.string().nullable(),value:un}).strict()).optional()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),pr=c.object({}).strict();var fr=c.object({page_count:c.number().int().min(2),page:c.object({path:c.string()}).strict()}).strict(),mr=c.object({pageThreshold:c.number().int().min(2)}).strict();var gr=c.object({phone_number:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional()}).strict(),hr=c.object({}).strict();var yr=c.object({depth_percent:c.number().int().min(1).max(100),page:c.object({path:c.string()}).strict()}).strict(),_r=c.object({thresholds:c.array(c.number().int().min(1).max(100)).min(1)}).strict();var Na=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],vr=c.enum(Na),Sr=c.object({page_name:vr,page:c.object({path:c.string()}).strict()}).strict(),Cr=c.object({pages:c.array(c.object({name:vr,pathPattern:c.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var xr=c.object({duration_ms:c.number().int().nonnegative(),page:c.object({path:c.string()}).strict()}).strict(),wr=c.object({thresholdSeconds:c.number().int().positive()}).strict();var ln={page_view:{kind:"automatic",metadataSchema:ht,configSchema:er},time_on_site:{kind:"automatic",metadataSchema:xr,configSchema:wr},specific_page_visit:{kind:"automatic",metadataSchema:Sr,configSchema:Cr},scroll_depth:{kind:"automatic",metadataSchema:yr,configSchema:_r},multi_page_session:{kind:"automatic",metadataSchema:fr,configSchema:mr},form_start:{kind:"automatic",metadataSchema:ur,configSchema:lr},sdk_heartbeat:{kind:"automatic",metadataSchema:or,configSchema:cr},form_submit:{kind:"manual",metadataSchema:dr,configSchema:pr},phone_click:{kind:"manual",metadataSchema:gr,configSchema:hr},cta_click:{kind:"manual",metadataSchema:ar,configSchema:sr}},No=Object.entries(ln).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Mo=Object.entries(ln).filter(([,t])=>t.kind==="manual").map(([t])=>t);function dn(t){return ln[t]}function pn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,i=document.visibilityState==="visible"?Date.now():null,a=null,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function l(){if(s||i===null)return;let h=n-r;if(h<=0){o();return}a=setTimeout(o,h)}function u(){a!==null&&(clearTimeout(a),a=null)}function p(){s||(document.visibilityState==="hidden"?(i!==null&&(r+=Date.now()-i,i=null),u()):(i=Date.now(),l()))}return document.addEventListener("visibilitychange",p),l(),()=>{u(),document.removeEventListener("visibilitychange",p)}}function fn(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function i(){let u=window.location.pathname;for(let{name:p,pathPattern:h}of n){if(h.lastIndex=0,!h.test(u))continue;let x=`${p}:${u}`;r.has(x)||(r.add(x),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:p,page:{path:u}},pageUrl:window.location.href,occurredAt:null}))}}let a=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...u){a(...u),setTimeout(i,0)}function l(...u){s(...u),setTimeout(i,0)}return history.pushState=o,history.replaceState=l,window.addEventListener("popstate",i),i(),()=>{history.pushState=a,history.replaceState=s,window.removeEventListener("popstate",i)}}function mn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=new Set(e.thresholds),r=new Set,i=window.location.pathname,a=null;function s(){let v=document.documentElement,T=window.scrollY||v.scrollTop,B=v.scrollHeight,N=v.clientHeight;return B<=N?100:Math.round((T+N)/B*100)}function o(){let v=s();for(let T of n)v>=T&&!r.has(T)&&(r.add(T),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:T,page:{path:i}},pageUrl:window.location.href,occurredAt:null}))}function l(){a===null&&(a=requestAnimationFrame(()=>{a=null,o()}))}function u(){let v=window.location.pathname;v!==i&&(i=v,r=new Set,setTimeout(o,0))}let p=history.pushState.bind(history),h=history.replaceState.bind(history);function x(...v){p(...v),setTimeout(u,0)}function b(...v){h(...v),setTimeout(u,0)}return history.pushState=x,history.replaceState=b,window.addEventListener("popstate",u),window.addEventListener("scroll",l,{passive:!0}),setTimeout(o,0),()=>{a!==null&&cancelAnimationFrame(a),history.pushState=p,history.replaceState=h,window.removeEventListener("popstate",u),window.removeEventListener("scroll",l)}}var gn="aranova_tracking_mps_paths",kr="aranova_tracking_mps_session",hn="aranova_tracking_mps_fired";function Ma(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function yn(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=Ma();if(!n)return()=>{};let{pageThreshold:r}=e,i="";function a(){try{let v=n.getItem(gn);return v?new Set(JSON.parse(v)):new Set}catch{return new Set}}function s(v){try{n.setItem(gn,JSON.stringify([...v]))}catch{}}function o(){let v=Te().id;n.getItem(kr)!==v&&(n.setItem(kr,v),n.removeItem(gn),n.removeItem(hn))}function l(){return n.getItem(hn)==="1"}function u(){let v=window.location.pathname;if(v===i||(i=v,o(),l()))return;let T=a();T.add(v),s(T),T.size>=r&&(n.setItem(hn,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:T.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let p=history.pushState.bind(history),h=history.replaceState.bind(history);function x(...v){p(...v),setTimeout(u,0)}function b(...v){h(...v),setTimeout(u,0)}return history.pushState=x,history.replaceState=b,window.addEventListener("popstate",u),u(),()=>{history.pushState=p,history.replaceState=h,window.removeEventListener("popstate",u)}}function _n(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,i=window.location.pathname;function a(x){if(x.id)return`id:${x.id}`;let b=x.getAttribute("action");return b?`action:${b}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(x)}`}function s(x){let b=x.target;if(!(b instanceof HTMLElement))return;let v=b.closest(n);if(!v||v.tagName!=="FORM")return;let T=a(v);r.has(T)||(r.add(T),t.trackEvent({eventType:"form_start",metadata:{form:{id:v.id||"",action:v.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function o(){let x=window.location.pathname;x!==i&&(i=x,r=new Set)}let l=history.pushState.bind(history),u=history.replaceState.bind(history);function p(...x){l(...x),setTimeout(o,0)}function h(...x){u(...x),setTimeout(o,0)}return history.pushState=p,history.replaceState=h,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=l,history.replaceState=u,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}var kt=class extends Error{constructor(e,n){super(e),this.name="AranovaApiError",this.status=n.status,this.code=n.code,this.requestId=n.requestId}};function Da(t){let e={[vt]:t.apiKey};return t.sdkVersion&&(e[St]=t.sdkVersion),t.packageName&&(e[Ct]=t.packageName),t.surface&&(e[xt]=t.surface),t.environment&&(e[wt]=t.environment),e}function Va(t,e){return`${t.replace(/\/$/,"")}${e}`}async function F(t,e,n,r){let i=Da(t);r!==void 0&&(i["Content-Type"]="application/json");let a=await fetch(Va(t.endpoint,n),{method:e,headers:i,body:r===void 0?void 0:JSON.stringify(r)});if(!a.ok){let s,o;try{let l=await a.json();if(l&&typeof l=="object"){let u=l;typeof u.detail=="string"&&(s=u.detail),typeof u.code=="string"&&(o=u.code)}}catch{}throw new kt(s??a.statusText??"Request failed",{status:a.status,code:o,requestId:a.headers.get("x-request-id")??void 0})}if(a.status!==204)return await a.json()}function Fa(t,e,n,r,i){if(!t)return;let a=e.external_id??r.id;for(let s of n){if(!s.service)continue;let o=t.getFiring(s.service);if(!o)continue;let l=s.amount_cents??o.value_cents??null;be({sendTo:o.send_to,value:l!=null?Ue(l,i):null,currency:o.currency??i,transactionId:`${a}:${s.service}`})}}function br(t){async function e(n){let r=n.currency??t.defaultCurrency;if(!r)throw new Error("record: `currency` is required (pass it on the sale or set config.defaultCurrency)");let i={...n,currency:r,occurred_at:n.occurred_at??new Date().toISOString()},a=await F(t,"POST","/sales",i),s=n.services?.length?n.services.map(o=>({service:o.service,amount_cents:o.amount_cents})):[{service:n.service,amount_cents:n.amount_total_cents??null}];return Fa(t.firing,n,s,a,r),a}return{record:e,recordSale:e,trackConversion(n,r){let i=t.firing?.getFiring(n);if(!i)return;let a=i.currency??r?.currency??t.defaultCurrency??null,s=i.value_cents??null,o=r?.value??(s!=null&&a?Ue(s,a):null);be({sendTo:i.send_to,value:o,currency:a,transactionId:r?.transactionId??null})},async list(n){let{cursor:r,limit:i,sort:a,order:s,want_total:o,...l}=n??{};return F(t,"POST","/sales/query",{filters:l,...i!==void 0?{limit:i}:{},...r!==void 0?{cursor:r}:{},...a!==void 0?{sort:a}:{},...s!==void 0?{order:s}:{},...o!==void 0?{want_total:o}:{}})},async summary(n){let{range:r,include_categories:i,include_deleted_services:a,top_n:s,since:o,until:l,timezone:u,granularity:p,compare_to:h,...x}=n;return F(t,"POST","/sales/summary",{filters:x,...r!==void 0?{range:r}:{},...i!==void 0?{include_categories:i}:{},...a!==void 0?{include_deleted_services:a}:{},...s!==void 0?{top_n:s}:{},...o!==void 0?{since:o}:{},...l!==void 0?{until:l}:{},...u!==void 0?{timezone:u}:{},...p!==void 0?{granularity:p}:{},...h!==void 0?{compare_to:h}:{}})},async get(n){return F(t,"GET",`/sales/${n}`)},async update(n,r){return F(t,"PATCH",`/sales/${n}`,r)},async delete(n){await F(t,"DELETE",`/sales/${n}`)},customers:{async list(n){let{segment:r,sort:i,order:a,cursor:s,limit:o,want_total:l,...u}=n??{};return F(t,"POST","/customers/query",{filters:u,...r!==void 0?{segment:r}:{},...i!==void 0?{sort:i}:{},...a!==void 0?{order:a}:{},...s!==void 0?{cursor:s}:{},...o!==void 0?{limit:o}:{},...l!==void 0?{want_total:l}:{}})},async get(n,r){let i=new URLSearchParams;r?.include_sales!==void 0&&i.set("include_sales",String(r.include_sales)),r?.limit!==void 0&&i.set("limit",String(r.limit)),r?.cursor!=null&&i.set("cursor",r.cursor);let a=i.toString();return F(t,"GET",`/customers/${encodeURIComponent(n)}${a?`?${a}`:""}`)},async summary(n){let{range:r,since:i,until:a,timezone:s,compare_to:o,...l}=n??{};return F(t,"POST","/customers/summary",{filters:l,...r!==void 0?{range:r}:{},...i!==void 0?{since:i}:{},...a!==void 0?{until:a}:{},...s!==void 0?{timezone:s}:{},...o!==void 0?{compare_to:o}:{}})}},business:{async config(){return F(t,"GET","/business/config")}}}}var ja=["USD","CAD"],La=["production","development"],Tr=c.enum(ja),Be=c.number().int().nonnegative(),$a=c.string().regex(/^\d+(\.\d{1,3})?$/),Er=c.record(c.unknown()),Rr=c.object({external_item_id:c.string().nullable().optional(),name:c.string().nullable().optional(),category:c.string().nullable().optional(),quantity:$a,unit_price_cents:Be,unit_cost_cents:Be.nullable().optional()}).strict(),Ir=c.object({service:c.string(),amount_cents:Be}).strict(),Pr=c.string().max(200),Ar=c.string().max(64),Or=c.string().max(320).email();function Nr(t,e,{requireAmount:n}){if(t.services!=null){t.service!=null&&e.addIssue({code:c.ZodIssueCode.custom,message:"pass either `service` or `services`, not both",path:["services"]}),t.services.length===0&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not be empty",path:["services"]});let r=t.services.map(i=>i.service);if(new Set(r).size!==r.length&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not list the same service more than once",path:["services"]}),t.amount_total_cents!=null){let i=t.services.reduce((a,s)=>a+s.amount_cents,0);t.amount_total_cents!==i&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",path:["amount_total_cents"]})}}else n&&t.amount_total_cents==null&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents is required unless `services` is provided",path:["amount_total_cents"]})}var Qo=c.object({external_id:c.string().nullable().optional(),description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Ir).nullable().optional(),currency:Tr,amount_total_cents:Be.nullable().optional(),occurred_at:c.string().datetime(),environment:c.enum(La).default("production"),items:c.array(Rr).default([]),metadata:Er.nullable().optional(),customer_name:Pr.nullable().optional(),customer_phone:Ar.nullable().optional(),customer_email:Or.nullable().optional()}).strict().superRefine((t,e)=>Nr(t,e,{requireAmount:!0})),ec=c.object({description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Ir).nullable().optional(),currency:Tr.optional(),amount_total_cents:Be.optional(),occurred_at:c.string().datetime().optional(),items:c.array(Rr).optional(),metadata:Er.nullable().optional(),customer_name:Pr.nullable().optional(),customer_phone:Ar.nullable().optional(),customer_email:Or.nullable().optional()}).strict().superRefine((t,e)=>Nr(t,e,{requireAmount:!1}));function Ka(){return Ce(we)}var O=null,vn=null,K=[],bt=null;function Ua(){for(let t=K.length-1;t>=0;t--)K[t]();K=[],O!==null&&(O.destroy(),O=null),vn=null,bt=null}function Mr(t={}){if(typeof window>"u")return;window.AranovaTracking=Sn;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:i=7776e3,gtagId:a,gtagIds:s,metaPixelId:o,metaPixelIds:l,environment:u,renderConsentBanner:p,triggers:h,conversionConfig:x}=t;if(r&&Q(window.location.href,i),s&&Object.keys(s).length>0?Ft(s):a&&Vt(a),l&&Object.keys(l).length>0?Ut(l):o&&Kt(o),Ua(),!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 b=x?qt({cdnUrl:x.cdnUrl,baked:x.baked}):null;bt=br({apiKey:e,endpoint:n,firing:b??void 0});let v=h??{automatic:{page_view:{}},manual:{}};vn=v;let T=s?Object.fromEntries(Object.entries(s).filter(Fe=>Fe[1]!=null)):a?{default:a}:void 0,B=cn({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:xn,triggers:v,environment:u,activeGtagIds:T});O=b?Bt(B,Zt(b)):B,K.push(sn(O)),K.push(an(O));let N=v.automatic.time_on_site;N&&K.push(pn(O,N));let De=v.automatic.specific_page_visit;De&&K.push(fn(O,De));let Ve=v.automatic.scroll_depth;Ve&&K.push(mn(O,Ve));let Ye=v.automatic.multi_page_session;Ye&&K.push(yn(O,Ye));let he=v.automatic.form_start;he&&K.push(_n(O,he))}function za(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=vn;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{dn(t).metadataSchema.parse(e)}catch(i){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,i);return}O.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}function Ha(){if(bt===null)throw new Error("[AranovaTracking] sales() called before init({ apiKey, endpoint })");return bt}var Sn={init:Mr,captureTrackingParams:()=>Q(),getTrackingParams:Ka,getConsentState:U,setConsentState:Le,getConsentChoice:_e,optIn:Rt,optOut:It,resetConsent:Pt,trackEvent:za,sales:Ha};typeof window<"u"&&(window.AranovaTracking=Sn);var qa=Sn;return $r(Za);})();
|
|
1
|
+
"use strict";var AranovaTracking=(()=>{var Et=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var Ur=Object.getOwnPropertyNames;var zr=Object.prototype.hasOwnProperty;var bn=(t,e)=>{for(var n in e)Et(t,n,{get:e[n],enumerable:!0})},Hr=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ur(e))!zr.call(t,i)&&i!==n&&Et(t,i,{get:()=>e[i],enumerable:!(r=Kr(e,i))||r.enumerable});return t};var qr=t=>Hr(Et({},"__esModule",{value:!0}),t);var es={};bn(es,{default:()=>Qa,init:()=>Gr});var kn="0.16.0";var Xe="consent_state",Je="consent_timestamp",Ce="consent_expires_at";var Rt={state:"granted",source:"default",updatedAt:null,expiresAt:null},Br=new Set;function Tn(t){for(let e of Br)try{e(t)}catch{}}function Qe(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function xe(){if(typeof window>"u")return Rt;try{let t=window.localStorage.getItem(Xe),e=window.localStorage.getItem(Je);if(t==="granted")return{state:"granted",source:"explicit",updatedAt:e,expiresAt:null};if(t==="denied"){let n=window.localStorage.getItem(Ce);if(!n){n=new Date(Date.now()+90*864e5).toISOString();try{window.localStorage.setItem(Ce,n)}catch{}}if(!(Date.parse(n)<=Date.now()))return{state:"denied",source:"explicit",updatedAt:e,expiresAt:n}}}catch{}return Rt}function q(){return xe().state}function En(t){typeof window>"u"||(typeof window.gtag=="function"&&window.gtag("consent","update",Qe(t)),typeof window.fbq=="function"&&window.fbq("consent",t==="granted"?"grant":"revoke"))}function Ge(t,e){if(typeof window>"u")return;let n=e?.declineTtlDays,r=typeof n=="number"&&Number.isFinite(n)&&n>0?n:90,i=new Date().toISOString(),a=t==="denied"?new Date(Date.now()+r*864e5).toISOString():null;try{window.localStorage.setItem(Xe,t),window.localStorage.setItem(Je,i),a!==null?window.localStorage.setItem(Ce,a):window.localStorage.removeItem(Ce)}catch{}En(t),Tn({state:t,source:"explicit",updatedAt:i,expiresAt:a})}function Pt(){Ge("granted")}function It(t){Ge("denied",t)}function At(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Xe),window.localStorage.removeItem(Je),window.localStorage.removeItem(Ce)}catch{}En("granted"),Tn(Rt)}}var we=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function be(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function et(t){return typeof t=="string"&&t.length>0?t:null}function ke(t){return we.reduce((e,n)=>(e[n]=et(t(n)),e),be())}function tt(t){return we.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}var Yr="_aranova_track_";function Rn(t){return`${Yr}${t}`}function nt(t,e,n=7776e3){let r=encodeURIComponent(e);if(typeof document<"u")try{document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}catch{}if(typeof window<"u")try{window.localStorage.setItem(Rn(t),r)}catch{}}function Te(t){if(typeof document<"u"){let n=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(`${t}=`));if(n){let[,r=""]=n.split("=");return et(decodeURIComponent(r))}}if(typeof window<"u")try{let e=window.localStorage.getItem(Rn(t));if(e)return et(decodeURIComponent(e))}catch{}return null}function Ee(t){return Te(t)}function Pn(t,e,n=7776e3){nt(t,e,n)}function Ot(t,e){return we.reduce((n,r)=>(n[r]=t[r]??e[r],n),be())}function In(t,e=7776e3){let n=tt(t);return Object.entries(n).forEach(([r,i])=>{Pn(r,i,e)}),n}function ne(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 In(n.searchParams,e),ke(Ee)}var On="https://www.googletagmanager.com/gtag/js",Re="data-aranova-tracking";function Wr(t){return`aranova-${t}`}var Xr=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function Nt(t){return Xr.test(t)}function rt(){if(window.dataLayer=window.dataLayer||[],typeof window.gtag=="function")return window.gtag;function t(){window.dataLayer?.push(arguments)}return window.gtag=t,window.gtag}var Jr=/^AW-[A-Za-z0-9]+\/[A-Za-z0-9_-]+$/;function Nn(t){return Jr.test(t)}function Mt(t){if(typeof window>"u"||typeof window.gtag!="function"||!Nn(t.sendTo))return!1;let e={send_to:t.sendTo};t.value!=null&&(e.value=t.value),t.currency&&(e.currency=t.currency),t.transactionId&&(e.transaction_id=t.transactionId);try{return window.gtag("event","conversion",e),!0}catch{return!1}}function Dt(){rt()("consent","default",Qe(q()==="denied"?"denied":"granted"))}function Vt(t){if(typeof document>"u")return;let e=Wr("gtag-loader");if(document.querySelector(`script[${Re}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${On}?id=${encodeURIComponent(t)}`,r.setAttribute(Re,e),document.head.append(r)}function Mn(t){let e=rt();e("js",new Date),e("config",t)}function Ft(t){typeof window>"u"||typeof document>"u"||Nt(t)&&(Dt(),Vt(t),Mn(t))}function jt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&Nt(r));if(e.length===0)return;Dt(),Vt(e[0]);let n=rt();n("js",new Date);for(let r of e)n("config",r)}var Dn="https://connect.facebook.net/en_US/fbevents.js",Lt="_fbc",Vn="_fbp",Qr=/^\d{15,16}$/;function $t(t){return Qr.test(t)}function Fn(t){let e=t.split(".").filter(Boolean);return Math.max(0,e.length-1)}function jn(t,e,n){let r=n??(typeof window>"u"?"":window.location.hostname);return`fb.${Fn(r)}.${e}.${t}`}function Ke(){return Te(Lt)}function at(){return Te(Vn)}function ei(){if(typeof window>"u")return null;try{let t=new URL(window.location.href).searchParams.get("fbclid");return t&&t.trim().length>0?t:null}catch{return null}}function Ue(t=typeof Date>"u"?0:Date.now()){if(typeof window>"u"||Ke())return;let e=ei()??Te("fbclid");e&&nt(Lt,jn(e,t),7776e3)}function ti(t){return`aranova-${t}`}function st(){let t=window;if(typeof t.fbq=="function")return t.fbq;let e=function(...n){e.callMethod?e.callMethod.apply(e,n):e.queue.push(n)};return e.push=e,e.loaded=!0,e.version="2.0",e.queue=[],t.fbq=e,t._fbq||(t._fbq=e),e}function Gt(){st()("consent",q()==="denied"?"revoke":"grant")}function Kt(){if(typeof document>"u")return;let t=ti("fbq-loader");if(document.querySelector(`script[${Re}="${t}"]`))return;let n=document.createElement("script");n.async=!0,n.src=Dn,n.setAttribute(Re,t),document.head.append(n)}function Ln(t){let e=st();e("init",t),e("track","PageView")}function Ut(t){typeof window>"u"||typeof document>"u"||$t(t)&&(Gt(),Kt(),Ln(t),Ue())}function zt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&$t(r));if(e.length===0)return;Gt(),Kt();let n=st();for(let r of e)n("init",r);n("track","PageView"),Ue()}var Ht="_aranova_track_landing",ze=null;function ni(t){if(typeof t!="object"||t===null)return{};let e=t;return we.reduce((n,r)=>{let i=e[r];return typeof i=="string"&&i.length>0&&(n[r]=i),n},{})}function ri(){try{let t=window.localStorage.getItem(Ht);if(!t)return null;let e=JSON.parse(t);return typeof e.session_id!="string"||e.session_id.length===0?null:{session_id:e.session_id,params:ni(e.params)}}catch{return null}}function ii(t){ze=t;try{window.localStorage.setItem(Ht,JSON.stringify(t))}catch{}}function ai(t){try{let e=new URL(t??window.location.href,window.location.origin);return tt(e.searchParams)}catch{return{}}}function ot(t,e){if(typeof window>"u")return{};let n=ri();if(n&&n.session_id===t)return ze=n,n.params;if(ze&&ze.session_id===t)return ze.params;let r={session_id:t,params:ai(e)};return ii(r),r.params}function ct(t,e){let n=e??(typeof window>"u"?null:ot(t));return n===null?{}:{landing_gclid:n.gclid??null,landing_fbclid:n.fbclid??null,landing_utm_source:n.utm_source??null,landing_utm_medium:n.utm_medium??null,landing_utm_campaign:n.utm_campaign??null,landing_utm_term:n.utm_term??null,landing_utm_content:n.utm_content??null}}var si="_aranova_conv_";function $n(t){return`${si}${t.transactionId??""}:${t.sendTo}`}function oi(t){if(!t.transactionId||typeof window>"u")return!1;try{return window.sessionStorage.getItem($n(t))!==null}catch{return!1}}function ci(t){if(!(!t.transactionId||typeof window>"u"))try{window.sessionStorage.setItem($n(t),"1")}catch{}}function ui(t){oi(t)||Mt(t)&&ci(t)}function Pe(t){q()!=="denied"&&ui(t)}function Gn(t){return typeof t=="object"&&t!==null&&Object.values(t).every(e=>typeof e=="string")}function Kn(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.send_to!="string"?null:{send_to:e.send_to,value_cents:typeof e.value_cents=="number"?e.value_cents:null,currency:typeof e.currency=="string"?e.currency:null}}function li(t){if(!t||typeof t!="object")return null;let e=t;if(typeof e.event_type!="string")return null;let n={event_type:e.event_type};return typeof e.threshold_percent=="number"&&(n.threshold_percent=e.threshold_percent),typeof e.threshold_seconds=="number"&&(n.threshold_seconds=e.threshold_seconds),typeof e.page_threshold=="number"&&(n.page_threshold=e.page_threshold),typeof e.page_name=="string"&&(n.page_name=e.page_name),n}function qt(t){if(!t||typeof t!="object")return null;let e=t,r=(Array.isArray(e.services)?e.services:[]).flatMap(s=>{if(!s||typeof s!="object")return[];let o=s;return typeof o.key!="string"?[]:[{key:o.key,label:typeof o.label=="string"?o.label:void 0,firing:Kn(o.firing)}]}),i=Array.isArray(e.goals)?e.goals:null,a=i?i.flatMap(s=>{if(!s||typeof s!="object")return[];let o=s;return typeof o.key!="string"?[]:[{key:o.key,label:typeof o.label=="string"?o.label:void 0,kind:o.kind==="event"?"event":"sale",trigger:li(o.trigger),firing:Kn(o.firing)}]}):r.map(s=>({key:s.key,label:s.label,kind:"sale",trigger:null,firing:s.firing}));return{schema_version:typeof e.schema_version=="number"?e.schema_version:1,config_version:typeof e.config_version=="number"?e.config_version:0,business_id:typeof e.business_id=="string"?e.business_id:void 0,customer_id:typeof e.customer_id=="string"?e.customer_id:null,environment:typeof e.environment=="string"?e.environment:void 0,gtag_ids:Gn(e.gtag_ids)?e.gtag_ids:{},meta_pixel_ids:Gn(e.meta_pixel_ids)?e.meta_pixel_ids:{},services:r,goals:a}}var di="_aranova_cfg_";function Un(t){return`${di}${t}`}function pi(t){if(typeof window>"u")return null;try{let e=window.sessionStorage.getItem(Un(t));if(!e)return null;let n=JSON.parse(e),r=qt(n.config);return r?{etag:typeof n.etag=="string"?n.etag:null,config:r}:null}catch{return null}}function fi(t,e){if(!(typeof window>"u"))try{window.sessionStorage.setItem(Un(t),JSON.stringify(e))}catch{}}function Zt(t){let e=pi(t.cdnUrl),n=e?.config??t.baked??null,r=e?.etag??null,i=new Map,a=new Set;function s(){i.clear();for(let d of n?.goals??[])i.set(d.key,d)}function o(){let d=[...a];a.clear();for(let h of d)try{h()}catch{}}function l(d,h){if(!d||n&&d.config_version<=n.config_version)return;let S=n===null;n=d,r=h,s(),fi(t.cdnUrl,{etag:r,config:d}),S&&o()}async function u(){if(!(typeof window>"u"))try{let d=t.fetchImpl??globalThis.fetch;if(!d)return;let h={};r&&(h["If-None-Match"]=r);let S=await d(t.cdnUrl,{method:"GET",headers:h});if(S.status===304||!S.ok)return;l(qt(await S.json()),S.headers.get("ETag"))}catch{}}return s(),u(),{getFiring:d=>i.get(d)?.firing??null,getGoal:d=>i.get(d)??null,listGoals:()=>[...i.values()],current:()=>n,isReady:()=>n!==null,onResolve:d=>n!==null?(d(),()=>{}):(a.add(d),()=>a.delete(d)),revalidate:u}}var mi={USD:2,CAD:2};function gi(t){return mi[t]??2}function He(t,e){return t/10**gi(e)}function hi(t,e,n){let r=t.trigger;if(!r||r.event_type!==e)return!1;switch(e){case"scroll_depth":return typeof n.depth_percent=="number"&&r.threshold_percent!=null&&n.depth_percent>=r.threshold_percent;case"time_on_site":return typeof n.duration_ms=="number"&&r.threshold_seconds!=null&&n.duration_ms>=r.threshold_seconds*1e3;case"multi_page_session":return typeof n.page_count=="number"&&r.page_threshold!=null&&n.page_count>=r.page_threshold;case"specific_page_visit":return typeof n.page_name=="string"&&n.page_name===r.page_name;case"page_view":case"form_start":return!0;default:return!1}}function yi(){return typeof window>"u"?"":window.location.pathname}var _i=50;function Bt(t){let e=[],n=!1;function r(i,a){for(let s of t.listGoals()){if(s.kind!=="event"||!s.firing||!hi(s,i,a))continue;let o=s.firing,l=o.value_cents??null,u=o.currency??null;Pe({sendTo:o.send_to,value:l!=null&&u?He(l,u):null,currency:u,transactionId:`auto:${s.key}:${yi()}`})}}return{onAutomaticEvent(i,a){if(t.isReady()){r(i,a);return}e.length<_i&&e.push({eventType:i,metadata:a}),n||(n=!0,t.onResolve(()=>{let s=e.splice(0);for(let o of s)r(o.eventType,o.metadata)}))}}}function Yt(t,e){return{...t,trackEvent:n=>{t.trackEvent(n);try{e.onAutomaticEvent(n.eventType,n.metadata??{})}catch{}}}}var Wt="aranova_tracking_visitor",ut="aranova_tracking_session",zn=1800*1e3;function lt(){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 Hn(t){try{return window.localStorage.getItem(t)}catch{return null}}function Xt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function Jt(){if(typeof window>"u")return lt();let t=Hn(Wt);if(t&&t.length>0)return t;let e=lt();return Xt(Wt,e),e}function Ie(t=Date.now()){if(typeof window>"u")return{id:lt(),isNew:!0};let e=Hn(ut);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=zn){let i={id:r.id,last_event_at:t};return Xt(ut,JSON.stringify(i)),{id:r.id,isNew:!1}}}catch{}let n={id:lt(),last_event_at:t};return Xt(ut,JSON.stringify(n)),{id:n.id,isNew:!0}}var c={};bn(c,{BRAND:()=>Hi,DIRTY:()=>re,EMPTY_PATH:()=>wi,INVALID:()=>_,NEVER:()=>Pa,OK:()=>P,ParseStatus:()=>R,Schema:()=>x,ZodAny:()=>Q,ZodArray:()=>W,ZodBigInt:()=>ae,ZodBoolean:()=>se,ZodBranded:()=>Ze,ZodCatch:()=>ye,ZodDate:()=>oe,ZodDefault:()=>he,ZodDiscriminatedUnion:()=>ft,ZodEffects:()=>V,ZodEnum:()=>me,ZodError:()=>A,ZodFirstPartyTypeKind:()=>v,ZodFunction:()=>gt,ZodIntersection:()=>de,ZodIssueCode:()=>p,ZodLazy:()=>pe,ZodLiteral:()=>fe,ZodMap:()=>Ve,ZodNaN:()=>je,ZodNativeEnum:()=>ge,ZodNever:()=>$,ZodNull:()=>ue,ZodNullable:()=>z,ZodNumber:()=>ie,ZodObject:()=>O,ZodOptional:()=>M,ZodParsedType:()=>m,ZodPipeline:()=>Be,ZodPromise:()=>ee,ZodReadonly:()=>_e,ZodRecord:()=>mt,ZodSchema:()=>x,ZodSet:()=>Fe,ZodString:()=>J,ZodSymbol:()=>Me,ZodTransformer:()=>V,ZodTuple:()=>U,ZodType:()=>x,ZodUndefined:()=>ce,ZodUnion:()=>le,ZodUnknown:()=>Y,ZodVoid:()=>De,addIssueToContext:()=>f,any:()=>ea,array:()=>ia,bigint:()=>Yi,boolean:()=>nr,coerce:()=>Ra,custom:()=>Qn,date:()=>Wi,datetimeRegex:()=>Xn,defaultErrorMap:()=>Z,discriminatedUnion:()=>ca,effect:()=>Sa,enum:()=>ya,function:()=>ma,getErrorMap:()=>Ae,getParsedType:()=>K,instanceof:()=>Zi,intersection:()=>ua,isAborted:()=>dt,isAsync:()=>Oe,isDirty:()=>pt,isValid:()=>X,late:()=>qi,lazy:()=>ga,literal:()=>ha,makeIssue:()=>qe,map:()=>pa,nan:()=>Bi,nativeEnum:()=>_a,never:()=>na,null:()=>Qi,nullable:()=>xa,number:()=>tr,object:()=>aa,objectUtil:()=>Qt,oboolean:()=>Ea,onumber:()=>Ta,optional:()=>Ca,ostring:()=>ka,pipeline:()=>ba,preprocess:()=>wa,promise:()=>va,quotelessJson:()=>Si,record:()=>da,set:()=>fa,setErrorMap:()=>xi,strictObject:()=>sa,string:()=>er,symbol:()=>Xi,transformer:()=>Sa,tuple:()=>la,undefined:()=>Ji,union:()=>oa,unknown:()=>ta,util:()=>w,void:()=>ra});var w;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let a={};for(let s of i)a[s]=s;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(let o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(let s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(w||(w={}));var Qt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Qt||(Qt={}));var m=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}};var p=w.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"]),Si=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(a){return a.message},r={_errors:[]},i=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){let u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(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,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};A.create=t=>new A(t);var Ci=(t,e)=>{let n;switch(t.code){case p.invalid_type:t.received===m.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,w.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:n=`Unrecognized key(s) in object: ${w.joinValues(t.keys,", ")}`;break;case p.invalid_union:n="Invalid input";break;case p.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${w.joinValues(t.options)}`;break;case p.invalid_enum_value:n=`Invalid enum value. Expected ${w.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:n="Invalid function arguments";break;case p.invalid_return_type:n="Invalid function return type";break;case p.invalid_date:n="Invalid date";break;case p.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}"`:w.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case p.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 p.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 p.custom:n="Invalid input";break;case p.invalid_intersection_types:n="Intersection results could not be merged";break;case p.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:n="Number must be finite";break;default:n=e.defaultError,w.assertNever(t)}return{message:n}},Z=Ci;var qn=Z;function xi(t){qn=t}function Ae(){return qn}var qe=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],s={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let o="",l=r.filter(u=>!!u).slice().reverse();for(let u of l)o=u(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},wi=[];function f(t,e){let n=Ae(),r=qe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Z?void 0:Z].filter(i=>!!i)});t.common.issues.push(r)}var R=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 i of n){if(i.status==="aborted")return _;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,s=await i.value;r.push({key:a,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:s}=i;if(a.status==="aborted"||s.status==="aborted")return _;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},_=Object.freeze({status:"aborted"}),re=t=>({status:"dirty",value:t}),P=t=>({status:"valid",value:t}),dt=t=>t.status==="aborted",pt=t=>t.status==="dirty",X=t=>t.status==="valid",Oe=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 D=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}},Zn=(t,e)=>{if(X(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 C(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=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:i}:{errorMap:(s,o)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return K(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Oe(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:K(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Zn(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return X(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=>X(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:K(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(Oe(i)?i:Promise.resolve(i));return Zn(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let s=e(i),o=()=>a.addIssue({code:p.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new V({schema:this,typeName:v.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 W.create(this)}promise(){return ee.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new V({...C(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new he({...C(this._def),innerType:this,defaultValue:n,typeName:v.ZodDefault})}brand(){return new Ze({typeName:v.ZodBranded,type:this,...C(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ye({...C(this._def),innerType:this,catchValue:n,typeName:v.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Be.create(this,e)}readonly(){return _e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},bi=/^c[^\s-]{8,}$/i,ki=/^[0-9a-z]+$/,Ti=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ei=/^[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,Ri=/^[a-z0-9_-]{21}$/i,Pi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ii=/^[-+]?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)?)??$/,Ai=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",en,Ni=/^(?:(?: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])$/,Mi=/^(?:(?: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])$/,Di=/^(([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]))$/,Vi=/^(([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])$/,Fi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ji=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yn="((\\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])))",Li=new RegExp(`^${Yn}$`);function Wn(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 $i(t){return new RegExp(`^${Wn(t)}$`)}function Xn(t){let e=`${Yn}T${Wn(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 Gi(t,e){return!!((e==="v4"||!e)&&Ni.test(t)||(e==="v6"||!e)&&Di.test(t))}function Ki(t,e){if(!Pi.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,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ui(t,e){return!!((e==="v4"||!e)&&Mi.test(t)||(e==="v6"||!e)&&Vi.test(t))}var J=class t extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.string,received:a.parsedType}),_}let r=new R,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(i=this._getOrReturnCtx(e,i),s?f(i,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(i,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Ai.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"email",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")en||(en=new RegExp(Oi,"u")),en.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"emoji",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Ei.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"uuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ri.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"nanoid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")bi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")ki.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cuid2",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ti.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"ulid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),f(i,{validation:"url",code:p.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"regex",code:p.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Xn(a).test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Li.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?$i(a).test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{code:p.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Ii.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"duration",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Gi(e.data,a.version)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"ip",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Ki(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"jwt",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Ui(e.data,a.version)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"cidr",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Fi.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"base64",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ji.test(e.data)||(i=this._getOrReturnCtx(e,i),f(i,{validation:"base64url",code:p.invalid_string,message:a.message}),r.dirty()):w.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:p.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}};J.create=t=>new J({checks:[],typeName:v.ZodString,coerce:t?.coerce??!1,...C(t)});function zi(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var ie=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.number,received:a.parsedType}),_}let r,i=new R;for(let a of this._def.checks)a.kind==="int"?w.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?zi(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.not_finite,message:a.message}),i.dirty()):w.assertNever(a);return{status:i.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,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_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"&&w.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)}};ie.create=t=>new ie({checks:[],typeName:v.ZodNumber,coerce:t?.coerce||!1,...C(t)});var ae=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let r,i=new R;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):w.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),_}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,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_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}};ae.create=t=>new ae({checks:[],typeName:v.ZodBigInt,coerce:t?.coerce??!1,...C(t)});var se=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.boolean,received:r.parsedType}),_}return P(e.data)}};se.create=t=>new se({typeName:v.ZodBoolean,coerce:t?.coerce||!1,...C(t)});var oe=class t extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.date,received:a.parsedType}),_}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_date}),_}let r=new R,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:p.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):w.assertNever(a);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}};oe.create=t=>new oe({checks:[],coerce:t?.coerce||!1,typeName:v.ZodDate,...C(t)});var Me=class extends x{_parse(e){if(this._getType(e)!==m.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.symbol,received:r.parsedType}),_}return P(e.data)}};Me.create=t=>new Me({typeName:v.ZodSymbol,...C(t)});var ce=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.undefined,received:r.parsedType}),_}return P(e.data)}};ce.create=t=>new ce({typeName:v.ZodUndefined,...C(t)});var ue=class extends x{_parse(e){if(this._getType(e)!==m.null){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.null,received:r.parsedType}),_}return P(e.data)}};ue.create=t=>new ue({typeName:v.ZodNull,...C(t)});var Q=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}};Q.create=t=>new Q({typeName:v.ZodAny,...C(t)});var Y=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}};Y.create=t=>new Y({typeName:v.ZodUnknown,...C(t)});var $=class extends x{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.never,received:n.parsedType}),_}};$.create=t=>new $({typeName:v.ZodNever,...C(t)});var De=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.void,received:r.parsedType}),_}return P(e.data)}};De.create=t=>new De({typeName:v.ZodVoid,...C(t)});var W=class t extends x{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==m.array)return f(n,{code:p.invalid_type,expected:m.array,received:n.parsedType}),_;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,o=n.data.length<i.exactLength.value;(s||o)&&(f(n,{code:s?p.too_big:p.too_small,minimum:o?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(f(n,{code:p.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(f(n,{code:p.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>i.type._parseAsync(new D(n,s,n.path,o)))).then(s=>R.mergeArray(r,s));let a=[...n.data].map((s,o)=>i.type._parseSync(new D(n,s,n.path,o)));return R.mergeArray(r,a)}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)}};W.create=(t,e)=>new W({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...C(e)});function Ne(t){if(t instanceof O){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=M.create(Ne(r))}return new O({...t._def,shape:()=>e})}else return t instanceof W?new W({...t._def,type:Ne(t.element)}):t instanceof M?M.create(Ne(t.unwrap())):t instanceof z?z.create(Ne(t.unwrap())):t instanceof U?U.create(t.items.map(e=>Ne(e))):t}var O=class t extends x{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=w.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return f(u,{code:p.invalid_type,expected:m.object,received:u.parsedType}),_}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||o.push(u);let l=[];for(let u of s){let d=a[u],h=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new D(i,h,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof $){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")o.length>0&&(f(i,{code:p.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of o){let h=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new D(i,h,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of l){let h=await d.key,S=await d.value;u.push({key:h,value:S,alwaysSet:d.alwaysSet})}return u}).then(u=>R.mergeObjectSync(r,u)):R.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(e).message??i}:{message:i}}}:{}})}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:v.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 w.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 w.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ne(this)}partial(e){let n={};for(let r of w.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of w.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof M;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return Jn(w.objectKeys(this.shape))}};O.create=(t,e)=>new O({shape:()=>t,unknownKeys:"strip",catchall:$.create(),typeName:v.ZodObject,...C(e)});O.strictCreate=(t,e)=>new O({shape:()=>t,unknownKeys:"strict",catchall:$.create(),typeName:v.ZodObject,...C(e)});O.lazycreate=(t,e)=>new O({shape:t,unknownKeys:"strip",catchall:$.create(),typeName:v.ZodObject,...C(e)});var le=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(o=>new A(o.ctx.common.issues));return f(n,{code:p.invalid_union,unionErrors:s}),_}if(n.common.async)return Promise.all(r.map(async a=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let a,s=[];for(let l of r){let u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(l=>new A(l));return f(n,{code:p.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}};le.create=(t,e)=>new le({options:t,typeName:v.ZodUnion,...C(e)});var B=t=>t instanceof pe?B(t.schema):t instanceof V?B(t.innerType()):t instanceof fe?[t.value]:t instanceof me?t.options:t instanceof ge?w.objectValues(t.enum):t instanceof he?B(t._def.innerType):t instanceof ce?[void 0]:t instanceof ue?[null]:t instanceof M?[void 0,...B(t.unwrap())]:t instanceof z?[null,...B(t.unwrap())]:t instanceof Ze||t instanceof _e?B(t.unwrap()):t instanceof ye?B(t._def.innerType):[],ft=class t extends x{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return f(n,{code:p.invalid_type,expected:m.object,received:n.parsedType}),_;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let s=B(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,a)}}return new t({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...C(r)})}};function tn(t,e){let n=K(t),r=K(e);if(t===e)return{valid:!0,data:t};if(n===m.object&&r===m.object){let i=w.objectKeys(e),a=w.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(let o of a){let l=tn(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===m.array&&r===m.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let s=t[a],o=e[a],l=tn(s,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===m.date&&r===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var de=class extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,s)=>{if(dt(a)||dt(s))return _;let o=tn(a.value,s.value);return o.valid?((pt(a)||pt(s))&&n.dirty(),{status:n.value,value:o.data}):(f(r,{code:p.invalid_intersection_types}),_)};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(([a,s])=>i(a,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};de.create=(t,e,n)=>new de({left:t,right:e,typeName:v.ZodIntersection,...C(n)});var U=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return f(r,{code:p.invalid_type,expected:m.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return f(r,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new D(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>R.mergeArray(n,s)):R.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};U.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new U({items:t,typeName:v.ZodTuple,rest:null,...C(e)})};var mt=class t extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return f(r,{code:p.invalid_type,expected:m.object,received:r.parsedType}),_;let i=[],a=this._def.keyType,s=this._def.valueType;for(let o in r.data)i.push({key:a._parse(new D(r,o,r.path,o)),value:s._parse(new D(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?R.mergeObjectAsync(n,i):R.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof x?new t({keyType:e,valueType:n,typeName:v.ZodRecord,...C(r)}):new t({keyType:J.create(),valueType:e,typeName:v.ZodRecord,...C(n)})}},Ve=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.map)return f(r,{code:p.invalid_type,expected:m.map,received:r.parsedType}),_;let i=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([o,l],u)=>({key:i._parse(new D(r,o,r.path,[u,"key"])),value:a._parse(new D(r,l,r.path,[u,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return _;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let l of s){let u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return _;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}}}};Ve.create=(t,e,n)=>new Ve({valueType:e,keyType:t,typeName:v.ZodMap,...C(n)});var Fe=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return f(r,{code:p.invalid_type,expected:m.set,received:r.parsedType}),_;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(f(r,{code:p.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(f(r,{code:p.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function s(l){let u=new Set;for(let d of l){if(d.status==="aborted")return _;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}let o=[...r.data.values()].map((l,u)=>a._parse(new D(r,l,r.path,u)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Fe.create=(t,e)=>new Fe({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...C(e)});var gt=class t extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.function)return f(n,{code:p.invalid_type,expected:m.function,received:n.parsedType}),_;function r(o,l){return qe({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ae(),Z].filter(u=>!!u),issueData:{code:p.invalid_arguments,argumentsError:l}})}function i(o,l){return qe({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ae(),Z].filter(u=>!!u),issueData:{code:p.invalid_return_type,returnTypeError:l}})}let a={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof ee){let o=this;return P(async function(...l){let u=new A([]),d=await o._def.args.parseAsync(l,a).catch(k=>{throw u.addIssue(r(l,k)),u}),h=await Reflect.apply(s,this,d);return await o._def.returns._def.type.parseAsync(h,a).catch(k=>{throw u.addIssue(i(h,k)),u})})}else{let o=this;return P(function(...l){let u=o._def.args.safeParse(l,a);if(!u.success)throw new A([r(l,u.error)]);let d=Reflect.apply(s,this,u.data),h=o._def.returns.safeParse(d,a);if(!h.success)throw new A([i(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:U.create(e).rest(Y.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||U.create([]).rest(Y.create()),returns:n||Y.create(),typeName:v.ZodFunction,...C(r)})}},pe=class extends x{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})}};pe.create=(t,e)=>new pe({getter:t,typeName:v.ZodLazy,...C(e)});var fe=class extends x{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:p.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};fe.create=(t,e)=>new fe({value:t,typeName:v.ZodLiteral,...C(e)});function Jn(t,e){return new me({values:t,typeName:v.ZodEnum,...C(e)})}var me=class t extends x{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:w.joinValues(r),received:n.parsedType,code:p.invalid_type}),_}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:p.invalid_enum_value,options:r}),_}return P(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})}};me.create=Jn;var ge=class extends x{_parse(e){let n=w.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==m.string&&r.parsedType!==m.number){let i=w.objectValues(n);return f(r,{expected:w.joinValues(i),received:r.parsedType,code:p.invalid_type}),_}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=w.objectValues(n);return f(r,{received:r.data,code:p.invalid_enum_value,options:i}),_}return P(e.data)}get enum(){return this._def.values}};ge.create=(t,e)=>new ge({values:t,typeName:v.ZodNativeEnum,...C(e)});var ee=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.promise&&n.common.async===!1)return f(n,{code:p.invalid_type,expected:m.promise,received:n.parsedType}),_;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return P(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:v.ZodPromise,...C(e)});var V=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:s=>{f(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let s=i.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return _;let l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?_:l.status==="dirty"?re(l.value):n.value==="dirty"?re(l.value):l});{if(n.value==="aborted")return _;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"?re(o.value):n.value==="dirty"?re(o.value):o}}if(i.type==="refinement"){let s=o=>{let l=i.refinement(o,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!X(s))return _;let o=i.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>X(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:n.value,value:o})):_);w.assertNever(i)}};V.create=(t,e,n)=>new V({schema:t,typeName:v.ZodEffects,effect:e,...C(n)});V.createWithPreprocess=(t,e,n)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...C(n)});var M=class extends x{_parse(e){return this._getType(e)===m.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:v.ZodOptional,...C(e)});var z=class extends x{_parse(e){return this._getType(e)===m.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};z.create=(t,e)=>new z({innerType:t,typeName:v.ZodNullable,...C(e)});var he=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===m.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};he.create=(t,e)=>new he({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var ye=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Oe(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new A(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ye.create=(t,e)=>new ye({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var je=class extends x{_parse(e){if(this._getType(e)!==m.nan){let r=this._getOrReturnCtx(e);return f(r,{code:p.invalid_type,expected:m.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}};je.create=t=>new je({typeName:v.ZodNaN,...C(t)});var Hi=Symbol("zod_brand"),Ze=class extends x{_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}},Be=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(n.dirty(),re(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?_:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:v.ZodPipeline})}},_e=class extends x{_parse(e){let n=this._def.innerType._parse(e),r=i=>(X(i)&&(i.value=Object.freeze(i.value)),i);return Oe(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};_e.create=(t,e)=>new _e({innerType:t,typeName:v.ZodReadonly,...C(e)});function Bn(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Qn(t,e={},n){return t?Q.create().superRefine((r,i)=>{let a=t(r);if(a instanceof Promise)return a.then(s=>{if(!s){let o=Bn(e,r),l=o.fatal??n??!0;i.addIssue({code:"custom",...o,fatal:l})}});if(!a){let s=Bn(e,r),o=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:o})}}):Q.create()}var qi={object:O.lazycreate},v;(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"})(v||(v={}));var Zi=(t,e={message:`Input not instance of ${t.name}`})=>Qn(n=>n instanceof t,e),er=J.create,tr=ie.create,Bi=je.create,Yi=ae.create,nr=se.create,Wi=oe.create,Xi=Me.create,Ji=ce.create,Qi=ue.create,ea=Q.create,ta=Y.create,na=$.create,ra=De.create,ia=W.create,aa=O.create,sa=O.strictCreate,oa=le.create,ca=ft.create,ua=de.create,la=U.create,da=mt.create,pa=Ve.create,fa=Fe.create,ma=gt.create,ga=pe.create,ha=fe.create,ya=me.create,_a=ge.create,va=ee.create,Sa=V.create,Ca=M.create,xa=z.create,wa=V.createWithPreprocess,ba=Be.create,ka=()=>er().optional(),Ta=()=>tr().optional(),Ea=()=>nr().optional(),Ra={string:(t=>J.create({...t,coerce:!0})),number:(t=>ie.create({...t,coerce:!0})),boolean:(t=>se.create({...t,coerce:!0})),bigint:(t=>ae.create({...t,coerce:!0})),date:(t=>oe.create({...t,coerce:!0}))};var Pa=_;var ht=c.object({page:c.object({title:c.string().nullable(),path:c.string(),search:c.string(),hash:c.string()}).strict(),referrer:c.string().nullable(),viewport:c.object({w:c.number(),h:c.number()}).strict().nullable().optional()}).strict(),rr=c.object({}).strict();var an="aranova_tracking_last_fired_url",nn=null,rn=!1;function Ia(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function Aa(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Oa(){if(!rn){rn=!0;let t=Ia(an);t!==null&&(nn=t)}return nn}function Na(t){nn=t,rn=!0,Aa(an,t)}function ir(t){return typeof window>"u"||typeof document>"u"?null:ht.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 Ye(t){if(typeof window>"u")return;let e=window.location.href,n=Oa(),r=n!==null&&n!==e?n:null,i=typeof document<"u"&&document.referrer||null,s=ir(r??i);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&Na(e)}function sn(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Ye(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function on(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let u=window.location.pathname+window.location.search;u!==n&&(n=u,Ye(t))}let i=history.pushState.bind(history),a=history.replaceState.bind(history);function s(...u){i(...u),setTimeout(r,0)}function o(...u){a(...u),setTimeout(r,0)}function l(u){u.persisted&&Ye(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",l),e.skipInitial||Ye(t),()=>{history.pushState=i,history.replaceState=a,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",l)}}function yt(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(yt);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=yt(r);return e}return t}function cn(t,e,n,r,i=null){let a=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let l={};for(let[u,d]of Object.entries(r.automatic)){let h=yt(d);Object.keys(h).length>0&&(l[u]=h)}if(r.manual)for(let[u,d]of Object.entries(r.manual)){if(d===void 0)continue;let h=yt(d);Object.keys(h).length>0&&(l[u]=h)}Object.keys(l).length>0&&(o=l)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:a,manual:s},trigger_config:o,configured_gtag_ids:i}}var sr=2e3,or=10,_t=50,vt="X-Aranova-Api-Key",St="X-Aranova-Sdk-Version",Ct="X-Aranova-Sdk-Package",xt="X-Aranova-Sdk-Surface",wt="X-Aranova-Sdk-Environment";function Da(t,e,n,r,i){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null,environment:r,active_gtag_ids:i}}function Va(){if(typeof window>"u")return be();try{ne()}catch{}return ke(Ee)}function Fa(){try{let t=xe();return{state:t.state,source:t.source,updated_at:t.updatedAt,expires_at:t.expiresAt}}catch{return null}}async function ar(t,e,n,r,i){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[vt]:n,[St]:r.sdkVersion,[Ct]:r.packageName,[xt]:r.surface,[wt]:r.environment},body:e,keepalive:i,credentials:"omit",mode:"cors"})}catch{}}function un(t){let e=t.flushIntervalMs??sr,n=Math.min(t.maxQueueSize??or,_t),r=t.sdkVersion??null,i=t.packageName??null,a=t.environment??"production",s=t.activeGtagIds??null,l=`${t.endpoint.replace(/\/$/,"")}/events`,u={sdkVersion:r??"",packageName:i??"",surface:t.surface,environment:a},d=[],h=null,S=null,k=be(),y=!1,T=Jt(),G=Ie(),b=G.id;if(typeof window<"u"){S=window.location.href;try{k=ne()}catch{}ot(b);try{Ue()}catch{}}function H(){let E=cn(t.surface,r,i,t.triggers??null,s);d.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:E,occurred_at:new Date().toISOString()})}G.isNew&&H();function L(){let E=Ie();E.isNew&&E.id!==b&&H(),b=E.id;let N=Ot(Va(),k),$e=Da(t.surface,r,i,a,s);return{session_id:b,visitor_id:T,gclid:N.gclid,fbclid:N.fbclid,fbc:Ke(),fbp:at(),utm_source:N.utm_source,utm_medium:N.utm_medium,utm_campaign:N.utm_campaign,utm_term:N.utm_term,utm_content:N.utm_content,...ct(b),first_page:S,consent_state:Fa(),context:$e}}function te(){h!==null||y||(h=setTimeout(()=>{h=null,Se()},e))}function ve(){h!==null&&(clearTimeout(h),h=null)}async function Se(){if(d.length===0)return;let E=d.slice(0,_t);d=d.slice(E.length),ve();let N={session:L(),events:E},$e=JSON.stringify(N);await ar(l,$e,t.apiKey,u,!1)}function Tt(E){if(y||!E||typeof E.eventType!="string"||E.eventType.length===0)return;let N=E.occurredAt instanceof Date?E.occurredAt.toISOString():typeof E.occurredAt=="string"?E.occurredAt:new Date().toISOString();d.push({event_type:E.eventType,page_url:E.pageUrl??(typeof window>"u"?null:window.location.href),metadata:E.metadata??null,occurred_at:N}),d.length>=n?Se():te()}function Le(){if(d.length===0)return;let E=d.slice(0,_t);d=d.slice(E.length),ve();let N={session:L(),events:E},$e=JSON.stringify(N);ar(l,$e,t.apiKey,u,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Le),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Le()})),{trackEvent:Tt,flush:Se,flushBeacon:Le,getSessionId:()=>b,getVisitorId:()=>T,destroy:()=>{y=!0,d.length>0&&Le(),ve(),d=[],typeof window<"u"&&window.removeEventListener("pagehide",Le)}}}var cr=c.object({cta_name:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional(),destination_url:c.string().nullable().optional(),href:c.string().nullable().optional(),element:c.string().nullable().optional()}).strict(),ur=c.object({autoCapture:c.object({selector:c.string().optional()}).strict().optional()}).strict();var ja=c.object({automatic:c.array(c.string()),manual:c.array(c.string())}).strict(),lr=c.object({sdk_version:c.string(),package_name:c.string().nullable(),surface:c.enum(["next","react","script"]),triggers:ja,trigger_config:c.record(c.string(),c.record(c.string(),c.unknown())).nullable().optional(),configured_gtag_ids:c.record(c.string(),c.string()).nullable().optional()}).strict(),dr=c.object({}).strict();var pr=c.object({form:c.object({id:c.string(),action:c.string().nullable()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),fr=c.object({selector:c.string().optional()}).strict();var ln=c.lazy(()=>c.union([c.string(),c.number().finite(),c.boolean(),c.null(),c.array(ln),c.record(ln)])),mr=c.object({form:c.object({id:c.string(),action:c.string().nullable(),fields:c.array(c.object({name:c.string(),type:c.string(),label:c.string().nullable(),value:ln}).strict()).optional()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),gr=c.object({}).strict();var hr=c.object({page_count:c.number().int().min(2),page:c.object({path:c.string()}).strict()}).strict(),yr=c.object({pageThreshold:c.number().int().min(2)}).strict();var _r=c.object({dwell_ms:c.number().int().min(0),max_scroll_percent:c.number().int().min(0).max(100).nullable(),page:c.object({path:c.string()}).strict()}).strict(),vr=c.object({}).strict();var Sr=c.object({phone_number:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional()}).strict(),Cr=c.object({}).strict();var xr=c.object({depth_percent:c.number().int().min(1).max(100),page:c.object({path:c.string()}).strict()}).strict(),wr=c.object({thresholds:c.array(c.number().int().min(1).max(100)).min(1)}).strict();var La=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],br=c.enum(La),kr=c.object({page_name:br,page:c.object({path:c.string()}).strict()}).strict(),Tr=c.object({pages:c.array(c.object({name:br,pathPattern:c.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var Er=c.object({duration_ms:c.number().int().nonnegative(),page:c.object({path:c.string()}).strict()}).strict(),Rr=c.object({thresholdSeconds:c.number().int().positive()}).strict();var dn={page_view:{kind:"automatic",metadataSchema:ht,configSchema:rr},time_on_site:{kind:"automatic",metadataSchema:Er,configSchema:Rr},specific_page_visit:{kind:"automatic",metadataSchema:kr,configSchema:Tr},scroll_depth:{kind:"automatic",metadataSchema:xr,configSchema:wr},multi_page_session:{kind:"automatic",metadataSchema:hr,configSchema:yr},form_start:{kind:"automatic",metadataSchema:pr,configSchema:fr},sdk_heartbeat:{kind:"automatic",metadataSchema:lr,configSchema:dr},page_exit:{kind:"automatic",metadataSchema:_r,configSchema:vr},form_submit:{kind:"manual",metadataSchema:mr,configSchema:gr},phone_click:{kind:"manual",metadataSchema:Sr,configSchema:Cr},cta_click:{kind:"manual",metadataSchema:cr,configSchema:ur}},Uo=Object.entries(dn).filter(([,t])=>t.kind==="automatic").map(([t])=>t),zo=Object.entries(dn).filter(([,t])=>t.kind==="manual").map(([t])=>t);function pn(t){return dn[t]}function fn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,i=document.visibilityState==="visible"?Date.now():null,a=null,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function l(){if(s||i===null)return;let h=n-r;if(h<=0){o();return}a=setTimeout(o,h)}function u(){a!==null&&(clearTimeout(a),a=null)}function d(){s||(document.visibilityState==="hidden"?(i!==null&&(r+=Date.now()-i,i=null),u()):(i=Date.now(),l()))}return document.addEventListener("visibilitychange",d),l(),()=>{u(),document.removeEventListener("visibilitychange",d)}}function mn(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function i(){let u=window.location.pathname;for(let{name:d,pathPattern:h}of n){if(h.lastIndex=0,!h.test(u))continue;let S=`${d}:${u}`;r.has(S)||(r.add(S),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:d,page:{path:u}},pageUrl:window.location.href,occurredAt:null}))}}let a=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...u){a(...u),setTimeout(i,0)}function l(...u){s(...u),setTimeout(i,0)}return history.pushState=o,history.replaceState=l,window.addEventListener("popstate",i),i(),()=>{history.pushState=a,history.replaceState=s,window.removeEventListener("popstate",i)}}function gn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=new Set(e.thresholds),r=new Set,i=window.location.pathname,a=null;function s(){let y=document.documentElement,T=window.scrollY||y.scrollTop,G=y.scrollHeight,b=y.clientHeight;return G<=b?100:Math.round((T+b)/G*100)}function o(){let y=s();for(let T of n)y>=T&&!r.has(T)&&(r.add(T),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:T,page:{path:i}},pageUrl:window.location.href,occurredAt:null}))}function l(){a===null&&(a=requestAnimationFrame(()=>{a=null,o()}))}function u(){let y=window.location.pathname;y!==i&&(i=y,r=new Set,setTimeout(o,0))}let d=history.pushState.bind(history),h=history.replaceState.bind(history);function S(...y){d(...y),setTimeout(u,0)}function k(...y){h(...y),setTimeout(u,0)}return history.pushState=S,history.replaceState=k,window.addEventListener("popstate",u),window.addEventListener("scroll",l,{passive:!0}),setTimeout(o,0),()=>{a!==null&&cancelAnimationFrame(a),history.pushState=d,history.replaceState=h,window.removeEventListener("popstate",u),window.removeEventListener("scroll",l)}}var hn="aranova_tracking_mps_paths",Pr="aranova_tracking_mps_session",yn="aranova_tracking_mps_fired";function $a(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function _n(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=$a();if(!n)return()=>{};let{pageThreshold:r}=e,i="";function a(){try{let y=n.getItem(hn);return y?new Set(JSON.parse(y)):new Set}catch{return new Set}}function s(y){try{n.setItem(hn,JSON.stringify([...y]))}catch{}}function o(){let y=Ie().id;n.getItem(Pr)!==y&&(n.setItem(Pr,y),n.removeItem(hn),n.removeItem(yn))}function l(){return n.getItem(yn)==="1"}function u(){let y=window.location.pathname;if(y===i||(i=y,o(),l()))return;let T=a();T.add(y),s(T),T.size>=r&&(n.setItem(yn,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:T.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let d=history.pushState.bind(history),h=history.replaceState.bind(history);function S(...y){d(...y),setTimeout(u,0)}function k(...y){h(...y),setTimeout(u,0)}return history.pushState=S,history.replaceState=k,window.addEventListener("popstate",u),u(),()=>{history.pushState=d,history.replaceState=h,window.removeEventListener("popstate",u)}}function vn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,i=window.location.pathname;function a(S){if(S.id)return`id:${S.id}`;let k=S.getAttribute("action");return k?`action:${k}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(S)}`}function s(S){let k=S.target;if(!(k instanceof HTMLElement))return;let y=k.closest(n);if(!y||y.tagName!=="FORM")return;let T=a(y);r.has(T)||(r.add(T),t.trackEvent({eventType:"form_start",metadata:{form:{id:y.id||"",action:y.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function o(){let S=window.location.pathname;S!==i&&(i=S,r=new Set)}let l=history.pushState.bind(history),u=history.replaceState.bind(history);function d(...S){l(...S),setTimeout(o,0)}function h(...S){u(...S),setTimeout(o,0)}return history.pushState=d,history.replaceState=h,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=l,history.replaceState=u,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}function Sn(t){if(typeof window>"u"||typeof document>"u")return()=>{};let e=window.location.pathname,n=document.visibilityState==="visible"?Date.now():null,r=0,i=null,a=null;function s(){let b=document.documentElement,H=window.scrollY||b.scrollTop,L=b.scrollHeight,te=b.clientHeight;return L<=te?100:Math.round((H+te)/L*100)}function o(){a===null&&(a=requestAnimationFrame(()=>{a=null;let b=s();b>=1&&(i===null||b>i)&&(i=Math.min(b,100))}))}function l(){let b=r;return n!==null&&(b+=Date.now()-n),Math.max(0,Math.round(b))}function u(b,H){let L=l();L!==0&&(t.trackEvent({eventType:"page_exit",metadata:{dwell_ms:L,max_scroll_percent:i,page:{path:b}},pageUrl:window.location.href,occurredAt:null}),H&&t.flushBeacon(),r=0,n=document.visibilityState==="visible"?Date.now():null)}function d(){let b=window.location.pathname;b!==e&&(u(e,!1),e=b,i=null,r=0,n=document.visibilityState==="visible"?Date.now():null)}function h(){document.visibilityState==="hidden"?u(e,!0):n=Date.now()}function S(){u(e,!0)}let k=history.pushState.bind(history),y=history.replaceState.bind(history);function T(...b){k(...b),setTimeout(d,0)}function G(...b){y(...b),setTimeout(d,0)}return history.pushState=T,history.replaceState=G,window.addEventListener("popstate",d),window.addEventListener("scroll",o,{passive:!0}),document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",S),()=>{a!==null&&cancelAnimationFrame(a),history.pushState=k,history.replaceState=y,window.removeEventListener("popstate",d),window.removeEventListener("scroll",o),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",S)}}var Ir="[data-aranova-cta]";function Ar(t){let e=t.tagName.toLowerCase();return t.id?`${e}#${t.id}`:e}function Ga(t){let e=t.getAttribute("data-aranova-cta");if(e&&e.trim().length>0)return e.trim();let n=(t.textContent??"").trim().replace(/\s+/g," ");return n.length>0?n.slice(0,120):Ar(t)}function Cn(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.autoCapture;if(!n)return()=>{};let r=n.selector??Ir;function i(a){let s=a.target;if(!(s instanceof Element))return;let o=null;try{o=s.closest(r)}catch{return}if(o===null)return;let l=o instanceof HTMLAnchorElement?o.href||null:o.getAttribute("href");t.trackEvent({eventType:"cta_click",metadata:{cta_name:Ga(o),page:{path:window.location.pathname},section:o.getAttribute("data-aranova-section"),destination_url:l,href:l,element:Ar(o)},pageUrl:window.location.href,occurredAt:null})}return document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)}}var bt=class extends Error{constructor(e,n){super(e),this.name="AranovaApiError",this.status=n.status,this.code=n.code,this.requestId=n.requestId}};function Ka(t){let e={[vt]:t.apiKey};return t.sdkVersion&&(e[St]=t.sdkVersion),t.packageName&&(e[Ct]=t.packageName),t.surface&&(e[xt]=t.surface),t.environment&&(e[wt]=t.environment),e}function Ua(t,e){return`${t.replace(/\/$/,"")}${e}`}async function F(t,e,n,r){let i=Ka(t);r!==void 0&&(i["Content-Type"]="application/json");let a=await fetch(Ua(t.endpoint,n),{method:e,headers:i,body:r===void 0?void 0:JSON.stringify(r)});if(!a.ok){let s,o;try{let l=await a.json();if(l&&typeof l=="object"){let u=l;typeof u.detail=="string"&&(s=u.detail),typeof u.code=="string"&&(o=u.code)}}catch{}throw new bt(s??a.statusText??"Request failed",{status:a.status,code:o,requestId:a.headers.get("x-request-id")??void 0})}if(a.status!==204)return await a.json()}function za(t,e,n,r,i){if(!t)return;let a=e.external_id??r.id;for(let s of n){if(!s.service)continue;let o=t.getFiring(s.service);if(!o)continue;let l=s.amount_cents??o.value_cents??null;Pe({sendTo:o.send_to,value:l!=null?He(l,i):null,currency:o.currency??i,transactionId:`${a}:${s.service}`})}}function Or(t){async function e(n){let r=n.currency??t.defaultCurrency;if(!r)throw new Error("record: `currency` is required (pass it on the sale or set config.defaultCurrency)");let i={...n,currency:r,occurred_at:n.occurred_at??new Date().toISOString()},a=await F(t,"POST","/sales",i),s=n.services?.length?n.services.map(o=>({service:o.service,amount_cents:o.amount_cents})):[{service:n.service,amount_cents:n.amount_total_cents??null}];return za(t.firing,n,s,a,r),a}return{record:e,recordSale:e,trackConversion(n,r){let i=t.firing?.getFiring(n);if(!i)return;let a=i.currency??r?.currency??t.defaultCurrency??null,s=i.value_cents??null,o=r?.value??(s!=null&&a?He(s,a):null);Pe({sendTo:i.send_to,value:o,currency:a,transactionId:r?.transactionId??null})},async list(n){let{cursor:r,limit:i,sort:a,order:s,want_total:o,...l}=n??{};return F(t,"POST","/sales/query",{filters:l,...i!==void 0?{limit:i}:{},...r!==void 0?{cursor:r}:{},...a!==void 0?{sort:a}:{},...s!==void 0?{order:s}:{},...o!==void 0?{want_total:o}:{}})},async summary(n){let{range:r,include_categories:i,include_deleted_services:a,top_n:s,since:o,until:l,timezone:u,granularity:d,compare_to:h,...S}=n;return F(t,"POST","/sales/summary",{filters:S,...r!==void 0?{range:r}:{},...i!==void 0?{include_categories:i}:{},...a!==void 0?{include_deleted_services:a}:{},...s!==void 0?{top_n:s}:{},...o!==void 0?{since:o}:{},...l!==void 0?{until:l}:{},...u!==void 0?{timezone:u}:{},...d!==void 0?{granularity:d}:{},...h!==void 0?{compare_to:h}:{}})},async get(n){return F(t,"GET",`/sales/${n}`)},async update(n,r){return F(t,"PATCH",`/sales/${n}`,r)},async delete(n){await F(t,"DELETE",`/sales/${n}`)},customers:{async list(n){let{segment:r,sort:i,order:a,cursor:s,limit:o,want_total:l,...u}=n??{};return F(t,"POST","/customers/query",{filters:u,...r!==void 0?{segment:r}:{},...i!==void 0?{sort:i}:{},...a!==void 0?{order:a}:{},...s!==void 0?{cursor:s}:{},...o!==void 0?{limit:o}:{},...l!==void 0?{want_total:l}:{}})},async get(n,r){let i=new URLSearchParams;r?.include_sales!==void 0&&i.set("include_sales",String(r.include_sales)),r?.limit!==void 0&&i.set("limit",String(r.limit)),r?.cursor!=null&&i.set("cursor",r.cursor);let a=i.toString();return F(t,"GET",`/customers/${encodeURIComponent(n)}${a?`?${a}`:""}`)},async summary(n){let{range:r,since:i,until:a,timezone:s,compare_to:o,...l}=n??{};return F(t,"POST","/customers/summary",{filters:l,...r!==void 0?{range:r}:{},...i!==void 0?{since:i}:{},...a!==void 0?{until:a}:{},...s!==void 0?{timezone:s}:{},...o!==void 0?{compare_to:o}:{}})}},business:{async config(){return F(t,"GET","/business/config")}}}}var Ha=["USD","CAD"],qa=["production","development"],Nr=c.enum(Ha),We=c.number().int().nonnegative(),Za=c.string().regex(/^\d+(\.\d{1,3})?$/),Mr=c.record(c.unknown()),Dr=c.object({external_item_id:c.string().nullable().optional(),name:c.string().nullable().optional(),category:c.string().nullable().optional(),quantity:Za,unit_price_cents:We,unit_cost_cents:We.nullable().optional()}).strict(),Vr=c.object({service:c.string(),amount_cents:We}).strict(),Fr=c.string().max(200),jr=c.string().max(64),Lr=c.string().max(320).email();function $r(t,e,{requireAmount:n}){if(t.services!=null){t.service!=null&&e.addIssue({code:c.ZodIssueCode.custom,message:"pass either `service` or `services`, not both",path:["services"]}),t.services.length===0&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not be empty",path:["services"]});let r=t.services.map(i=>i.service);if(new Set(r).size!==r.length&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not list the same service more than once",path:["services"]}),t.amount_total_cents!=null){let i=t.services.reduce((a,s)=>a+s.amount_cents,0);t.amount_total_cents!==i&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",path:["amount_total_cents"]})}}else n&&t.amount_total_cents==null&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents is required unless `services` is provided",path:["amount_total_cents"]})}var dc=c.object({external_id:c.string().nullable().optional(),description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Vr).nullable().optional(),currency:Nr,amount_total_cents:We.nullable().optional(),occurred_at:c.string().datetime(),environment:c.enum(qa).default("production"),items:c.array(Dr).default([]),metadata:Mr.nullable().optional(),customer_name:Fr.nullable().optional(),customer_phone:jr.nullable().optional(),customer_email:Lr.nullable().optional()}).strict().superRefine((t,e)=>$r(t,e,{requireAmount:!0})),pc=c.object({description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Vr).nullable().optional(),currency:Nr.optional(),amount_total_cents:We.optional(),occurred_at:c.string().datetime().optional(),items:c.array(Dr).optional(),metadata:Mr.nullable().optional(),customer_name:Fr.nullable().optional(),customer_phone:jr.nullable().optional(),customer_email:Lr.nullable().optional()}).strict().superRefine((t,e)=>$r(t,e,{requireAmount:!1}));function Ya(){return ke(Ee)}var I=null,xn=null,j=[],kt=null;function Wa(){for(let t=j.length-1;t>=0;t--)j[t]();j=[],I!==null&&(I.destroy(),I=null),xn=null,kt=null}function Gr(t={}){if(typeof window>"u")return;window.AranovaTracking=wn;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:i=7776e3,gtagId:a,gtagIds:s,metaPixelId:o,metaPixelIds:l,environment:u,renderConsentBanner:d,triggers:h,conversionConfig:S}=t;if(r&&ne(window.location.href,i),s&&Object.keys(s).length>0?jt(s):a&&Ft(a),l&&Object.keys(l).length>0?zt(l):o&&Ut(o),Wa(),!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 k=S?Zt({cdnUrl:S.cdnUrl,baked:S.baked}):null;kt=Or({apiKey:e,endpoint:n,firing:k??void 0});let y=h??{automatic:{page_view:{}},manual:{}};xn=y;let T=s?Object.fromEntries(Object.entries(s).filter(Tt=>Tt[1]!=null)):a?{default:a}:void 0,G=un({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:kn,triggers:y,environment:u,activeGtagIds:T});I=k?Yt(G,Bt(k)):G,j.push(on(I)),j.push(sn(I)),j.push(Sn(I));let b=y.automatic.time_on_site;b&&j.push(fn(I,b));let H=y.automatic.specific_page_visit;H&&j.push(mn(I,H));let L=y.automatic.scroll_depth;L&&j.push(gn(I,L));let te=y.automatic.multi_page_session;te&&j.push(_n(I,te));let ve=y.automatic.form_start;ve&&j.push(vn(I,ve));let Se=y.manual?.cta_click;Se&&j.push(Cn(I,Se))}function Xa(t,e){if(I===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=xn;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{pn(t).metadataSchema.parse(e)}catch(i){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,i);return}I.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}function Ja(){if(kt===null)throw new Error("[AranovaTracking] sales() called before init({ apiKey, endpoint })");return kt}var wn={init:Gr,captureTrackingParams:()=>ne(),getTrackingParams:Ya,getConsentState:q,setConsentState:Ge,getConsentChoice:xe,optIn:Pt,optOut:It,resetConsent:At,trackEvent:Xa,sales:Ja};typeof window<"u"&&(window.AranovaTracking=wn);var Qa=wn;return qr(es);})();
|
|
2
2
|
//# sourceMappingURL=aranova-tracking.global.js.map
|