@v-tilt/browser 1.0.11 → 1.1.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/dist/module.d.ts CHANGED
@@ -13,6 +13,7 @@ interface VTiltConfig {
13
13
  globalAttributes?: Record<string, string>;
14
14
  persistence?: "localStorage" | "cookie";
15
15
  crossSubdomainCookie?: boolean;
16
+ disable_compression?: boolean;
16
17
  }
17
18
  interface SessionData {
18
19
  value: string;
@@ -84,21 +85,41 @@ declare class HistoryAutocapture {
84
85
  private _setupPopstateListener;
85
86
  }
86
87
 
88
+ /**
89
+ * Request Queue - Event Batching (PostHog-style)
90
+ *
91
+ * Batches multiple events together and sends them at configurable intervals.
92
+ * This reduces the number of HTTP requests significantly for active users.
93
+ *
94
+ * Features:
95
+ * - Configurable flush interval (default 3 seconds)
96
+ * - Batches events by URL/batchKey
97
+ * - Uses sendBeacon on page unload for reliable delivery
98
+ * - Converts absolute timestamps to relative offsets before sending
99
+ */
100
+
87
101
  interface QueuedRequest {
88
102
  url: string;
89
- event: any;
103
+ event: TrackingEvent;
104
+ batchKey?: string;
105
+ transport?: "xhr" | "sendBeacon";
90
106
  }
107
+
91
108
  declare class VTilt {
92
109
  private configManager;
93
110
  private sessionManager;
94
111
  private userManager;
95
112
  private webVitalsManager;
113
+ private requestQueue;
114
+ private retryQueue;
115
+ private rateLimiter;
96
116
  historyAutocapture?: HistoryAutocapture;
97
117
  __loaded: boolean;
98
118
  private _initialPageviewCaptured;
99
119
  private _visibilityStateListener;
100
120
  __request_queue: QueuedRequest[];
101
121
  private _hasWarnedAboutConfig;
122
+ private _setOncePropertiesSent;
102
123
  constructor(config?: Partial<VTiltConfig>);
103
124
  /**
104
125
  * Initializes a new instance of the VTilt tracking object.
@@ -136,6 +157,11 @@ declare class VTilt {
136
157
  * This internal method should only be called by `init()`.
137
158
  */
138
159
  private _init;
160
+ /**
161
+ * Set up handler to flush event queue on page unload
162
+ * Uses both beforeunload and pagehide for maximum compatibility
163
+ */
164
+ private _setupUnloadHandler;
139
165
  /**
140
166
  * Returns a string representation of the instance name
141
167
  * Used for debugging and logging
@@ -161,8 +187,26 @@ declare class VTilt {
161
187
  /**
162
188
  * Send HTTP request
163
189
  * This is the central entry point for all tracking requests
190
+ * Events are batched and sent every 3 seconds for better performance
164
191
  */
165
192
  private sendRequest;
193
+ /**
194
+ * Send a batched request with multiple events
195
+ * Called by RequestQueue when flushing
196
+ * Uses RetryQueue for automatic retry on failure
197
+ */
198
+ private _sendBatchedRequest;
199
+ /**
200
+ * Send HTTP request and return status code
201
+ * Uses GZip compression for payloads > 1KB
202
+ * Used by RetryQueue for retryable requests
203
+ */
204
+ private _sendHttpRequest;
205
+ /**
206
+ * Send request using sendBeacon for reliable delivery on page unload
207
+ * Uses GZip compression for payloads > 1KB
208
+ */
209
+ private _sendBeaconRequest;
166
210
  /**
167
211
  * Send a queued request (called after DOM is loaded)
168
212
  */
@@ -176,8 +220,16 @@ declare class VTilt {
176
220
  *
177
221
  * @param name - Event name
178
222
  * @param payload - Event payload
223
+ * @param options - Optional capture options
224
+ */
225
+ capture(name: string, payload: EventPayload, options?: {
226
+ skip_client_rate_limiting?: boolean;
227
+ }): void;
228
+ /**
229
+ * Internal capture method that bypasses rate limiting
230
+ * Used for system events like rate limit warnings
179
231
  */
180
- capture(name: string, payload: EventPayload): void;
232
+ private _captureInternal;
181
233
  /**
182
234
  * Track a custom event (alias for capture)
183
235
  */
@@ -298,7 +350,7 @@ declare class VTilt {
298
350
  */
299
351
  _execute_array(array: any[]): void;
300
352
  /**
301
- * Called when DOM is loaded - processes queued requests
353
+ * Called when DOM is loaded - processes queued requests and enables batching
302
354
  */
303
355
  _dom_loaded(): void;
304
356
  }
package/dist/module.js CHANGED
@@ -1,2 +1,2 @@
1
- function i(){return i=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var t in a)({}).hasOwnProperty.call(a,t)&&(i[t]=a[t])}return i},i.apply(null,arguments)}class e{constructor(i){void 0===i&&(i={}),this.config=this.parseConfigFromScript(i)}parseConfigFromScript(e){if(!document.currentScript)return i({projectId:e.projectId||"",token:e.token||""},e);var a=document.currentScript,t=i({projectId:"",token:""},e);if(t.host=a.getAttribute("data-host")||e.host,t.proxy=a.getAttribute("data-proxy")||e.proxy,t.proxyUrl=a.getAttribute("data-proxy-url")||e.proxyUrl,t.token=a.getAttribute("data-token")||e.token||"",t.projectId=a.getAttribute("data-project-id")||e.projectId||"",t.domain=a.getAttribute("data-domain")||e.domain,t.storage=a.getAttribute("data-storage")||e.storage,t.stringifyPayload="false"!==a.getAttribute("data-stringify-payload"),t.webVitals="true"===a.getAttribute("web-vitals")||"true"===a.getAttribute("data-web-vitals")||e.webVitals,t.proxy&&t.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var r of(t.globalAttributes=i({},e.globalAttributes),Array.from(a.attributes)))r.name.startsWith("tb_")&&(t.globalAttributes[r.name.slice(3).replace(/-/g,"_")]=r.value),r.name.startsWith("data-tb-")&&(t.globalAttributes[r.name.slice(8).replace(/-/g,"_")]=r.value);return t}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}var a="vt_session_id",t="vt_window_id",r="vt_primary_window_exists",n="vt_anonymous_id",s="vt_distinct_id",o="vt_device_id",c="vt_user_properties",u="vt_user_state",l="$initial_person_info",h="localStorage",A="sessionStorage",d={"Asia/Barnaul":"RU","Africa/Nouakchott":"MR","Africa/Lusaka":"ZM","Asia/Pyongyang":"KP","Europe/Bratislava":"SK","America/Belize":"BZ","America/Maceio":"BR","Pacific/Chuuk":"FM","Indian/Comoro":"KM","Pacific/Palau":"PW","Asia/Jakarta":"ID","Africa/Windhoek":"NA","America/Chihuahua":"MX","America/Nome":"US","Africa/Mbabane":"SZ","Africa/Porto-Novo":"BJ","Europe/San_Marino":"SM","Pacific/Fakaofo":"TK","America/Denver":"US","Europe/Belgrade":"RS","America/Indiana/Tell_City":"US","America/Fortaleza":"BR","America/Halifax":"CA","Europe/Bucharest":"RO","America/Indiana/Petersburg":"US","Europe/Kirov":"RU","Europe/Athens":"GR","America/Argentina/Ushuaia":"AR","Europe/Monaco":"MC","Europe/Vilnius":"LT","Europe/Copenhagen":"DK","Pacific/Kanton":"KI","America/Caracas":"VE","Asia/Almaty":"KZ","Europe/Paris":"FR","Africa/Blantyre":"MW","Asia/Muscat":"OM","America/North_Dakota/Beulah":"US","America/Matamoros":"MX","Asia/Irkutsk":"RU","America/Costa_Rica":"CR","America/Araguaina":"BR","Atlantic/Canary":"ES","America/Santo_Domingo":"DO","America/Vancouver":"CA","Africa/Addis_Ababa":"ET","Africa/Accra":"GH","Pacific/Kwajalein":"MH","Asia/Baghdad":"IQ","Australia/Adelaide":"AU","Australia/Hobart":"AU","America/Guayaquil":"EC","America/Argentina/Tucuman":"AR","Australia/Lindeman":"AU","America/New_York":"US","Pacific/Fiji":"FJ","America/Antigua":"AG","Africa/Casablanca":"MA","America/Paramaribo":"SR","Africa/Cairo":"EG","America/Cayenne":"GF","America/Detroit":"US","Antarctica/Syowa":"AQ","Africa/Douala":"CM","America/Argentina/La_Rioja":"AR","Africa/Lagos":"NG","America/St_Barthelemy":"BL","Asia/Nicosia":"CY","Asia/Macau":"MO","Europe/Riga":"LV","Asia/Ashgabat":"TM","Indian/Antananarivo":"MG","America/Argentina/San_Juan":"AR","Asia/Aden":"YE","Asia/Tomsk":"RU","America/Asuncion":"PY","Pacific/Bougainville":"PG","Asia/Vientiane":"LA","America/Mazatlan":"MX","Africa/Luanda":"AO","Europe/Oslo":"NO","Africa/Kinshasa":"CD","Europe/Warsaw":"PL","America/Grand_Turk":"TC","Asia/Seoul":"KR","Africa/Tripoli":"LY","America/St_Thomas":"VI","Asia/Kathmandu":"NP","Pacific/Pitcairn":"PN","Pacific/Nauru":"NR","America/Curacao":"CW","Asia/Kabul":"AF","Pacific/Tongatapu":"TO","Europe/Simferopol":"UA","Asia/Ust-Nera":"RU","Africa/Mogadishu":"SO","Indian/Mayotte":"YT","Pacific/Niue":"NU","America/Thunder_Bay":"CA","Atlantic/Azores":"PT","Pacific/Gambier":"PF","Europe/Stockholm":"SE","Africa/Libreville":"GA","America/Punta_Arenas":"CL","America/Guatemala":"GT","America/Noronha":"BR","Europe/Helsinki":"FI","Asia/Gaza":"PS","Pacific/Kosrae":"FM","America/Aruba":"AW","America/Nassau":"BS","Asia/Choibalsan":"MN","America/Winnipeg":"CA","America/Anguilla":"AI","Asia/Thimphu":"BT","Asia/Beirut":"LB","Atlantic/Faroe":"FO","Europe/Berlin":"DE","Europe/Amsterdam":"NL","Pacific/Honolulu":"US","America/Regina":"CA","America/Scoresbysund":"GL","Europe/Vienna":"AT","Europe/Tirane":"AL","Africa/El_Aaiun":"EH","America/Creston":"CA","Asia/Qostanay":"KZ","Asia/Ho_Chi_Minh":"VN","Europe/Samara":"RU","Europe/Rome":"IT","Australia/Eucla":"AU","America/El_Salvador":"SV","America/Chicago":"US","Africa/Abidjan":"CI","Asia/Kamchatka":"RU","Pacific/Tarawa":"KI","America/Santiago":"CL","America/Bahia":"BR","Indian/Christmas":"CX","Asia/Atyrau":"KZ","Asia/Dushanbe":"TJ","Europe/Ulyanovsk":"RU","America/Yellowknife":"CA","America/Recife":"BR","Australia/Sydney":"AU","America/Fort_Nelson":"CA","Pacific/Efate":"VU","Europe/Saratov":"RU","Africa/Banjul":"GM","Asia/Omsk":"RU","Europe/Ljubljana":"SI","Europe/Budapest":"HU","Europe/Astrakhan":"RU","America/Argentina/Buenos_Aires":"AR","Pacific/Chatham":"NZ","America/Argentina/Salta":"AR","Africa/Niamey":"NE","Asia/Pontianak":"ID","Indian/Reunion":"RE","Asia/Hong_Kong":"HK","Antarctica/McMurdo":"AQ","Africa/Malabo":"GQ","America/Los_Angeles":"US","America/Argentina/Cordoba":"AR","Pacific/Pohnpei":"FM","America/Tijuana":"MX","America/Campo_Grande":"BR","America/Dawson_Creek":"CA","Asia/Novosibirsk":"RU","Pacific/Pago_Pago":"AS","Asia/Jerusalem":"IL","Europe/Sarajevo":"BA","Africa/Freetown":"SL","Asia/Yekaterinburg":"RU","America/Juneau":"US","Africa/Ouagadougou":"BF","Africa/Monrovia":"LR","Europe/Kiev":"UA","America/Argentina/San_Luis":"AR","Asia/Tokyo":"JP","Asia/Qatar":"QA","America/La_Paz":"BO","America/Bogota":"CO","America/Thule":"GL","Asia/Manila":"PH","Asia/Hovd":"MN","Asia/Tehran":"IR","Atlantic/Madeira":"PT","America/Metlakatla":"US","Europe/Vatican":"VA","Asia/Bishkek":"KG","Asia/Dili":"TL","Antarctica/Palmer":"AQ","Atlantic/Cape_Verde":"CV","Indian/Chagos":"IO","America/Kentucky/Monticello":"US","Africa/Algiers":"DZ","Africa/Maseru":"LS","Asia/Kuala_Lumpur":"MY","Africa/Khartoum":"SD","America/Argentina/Rio_Gallegos":"AR","America/Blanc-Sablon":"CA","Africa/Maputo":"MZ","America/Tortola":"VG","Atlantic/Bermuda":"BM","America/Argentina/Catamarca":"AR","America/Cayman":"KY","America/Puerto_Rico":"PR","Pacific/Majuro":"MH","Europe/Busingen":"DE","Pacific/Midway":"UM","Indian/Cocos":"CC","Asia/Singapore":"SG","America/Boise":"US","America/Nuuk":"GL","America/Goose_Bay":"CA","Australia/Broken_Hill":"AU","Africa/Dar_es_Salaam":"TZ","Africa/Asmara":"ER","Asia/Samarkand":"UZ","Asia/Tbilisi":"GE","America/Argentina/Jujuy":"AR","America/Indiana/Winamac":"US","America/Porto_Velho":"BR","Asia/Magadan":"RU","Europe/Zaporozhye":"UA","Antarctica/Casey":"AQ","Asia/Shanghai":"CN","Pacific/Norfolk":"NF","Europe/Guernsey":"GG","Australia/Brisbane":"AU","Antarctica/DumontDUrville":"AQ","America/Havana":"CU","America/Atikokan":"CA","America/Mexico_City":"MX","America/Rankin_Inlet":"CA","America/Cuiaba":"BR","America/Resolute":"CA","Africa/Ceuta":"ES","Arctic/Longyearbyen":"SJ","Pacific/Guam":"GU","Asia/Damascus":"SY","Asia/Colombo":"LK","Asia/Yerevan":"AM","America/Montserrat":"MS","America/Belem":"BR","Europe/Kaliningrad":"RU","Atlantic/South_Georgia":"GS","Asia/Tashkent":"UZ","Asia/Kolkata":"IN","America/St_Johns":"CA","Asia/Srednekolymsk":"RU","Asia/Yakutsk":"RU","Europe/Prague":"CZ","Africa/Djibouti":"DJ","Asia/Dubai":"AE","Europe/Uzhgorod":"UA","America/Edmonton":"CA","Asia/Famagusta":"CY","America/Indiana/Knox":"US","Asia/Hebron":"PS","Asia/Taipei":"TW","Europe/London":"GB","Africa/Dakar":"SN","Australia/Darwin":"AU","America/Glace_Bay":"CA","Antarctica/Vostok":"AQ","America/Indiana/Vincennes":"US","America/Nipigon":"CA","Asia/Kuwait":"KW","Pacific/Guadalcanal":"SB","America/Toronto":"CA","Africa/Gaborone":"BW","Africa/Bujumbura":"BI","Africa/Lubumbashi":"CD","America/Merida":"MX","America/Marigot":"MF","Europe/Zagreb":"HR","Pacific/Easter":"CL","America/Santarem":"BR","Pacific/Noumea":"NC","America/Sitka":"US","Atlantic/Stanley":"FK","Pacific/Funafuti":"TV","America/Iqaluit":"CA","America/Rainy_River":"CA","America/Anchorage":"US","America/Lima":"PE","Asia/Baku":"AZ","America/Indiana/Vevay":"US","Asia/Ulaanbaatar":"MN","America/Managua":"NI","Asia/Krasnoyarsk":"RU","Asia/Qyzylorda":"KZ","America/Eirunepe":"BR","Europe/Podgorica":"ME","Europe/Chisinau":"MD","Europe/Mariehamn":"AX","Europe/Volgograd":"RU","Africa/Nairobi":"KE","Europe/Isle_of_Man":"IM","America/Menominee":"US","Africa/Harare":"ZW","Asia/Anadyr":"RU","America/Moncton":"CA","Indian/Maldives":"MV","America/Whitehorse":"CA","Antarctica/Mawson":"AQ","Europe/Madrid":"ES","America/Argentina/Mendoza":"AR","America/Manaus":"BR","Africa/Bangui":"CF","Indian/Mauritius":"MU","Africa/Tunis":"TN","Australia/Lord_Howe":"AU","America/Kentucky/Louisville":"US","America/North_Dakota/Center":"US","Asia/Novokuznetsk":"RU","Asia/Makassar":"ID","America/Port_of_Spain":"TT","America/Bahia_Banderas":"MX","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","Asia/Dhaka":"BD","America/Pangnirtung":"CA","Europe/Dublin":"IE","Asia/Brunei":"BN","Africa/Brazzaville":"CG","America/Montevideo":"UY","America/Jamaica":"JM","America/Indiana/Indianapolis":"US","America/Kralendijk":"BQ","Europe/Gibraltar":"GI","Pacific/Marquesas":"PF","Pacific/Apia":"WS","Europe/Jersey":"JE","America/Phoenix":"US","Africa/Ndjamena":"TD","Asia/Karachi":"PK","Africa/Kampala":"UG","Asia/Sakhalin":"RU","America/Martinique":"MQ","Europe/Moscow":"RU","Africa/Conakry":"GN","America/Barbados":"BB","Africa/Lome":"TG","America/Ojinaga":"MX","America/Tegucigalpa":"HN","Asia/Bangkok":"TH","Africa/Johannesburg":"ZA","Europe/Vaduz":"LI","Africa/Sao_Tome":"ST","America/Cambridge_Bay":"CA","America/Lower_Princes":"SX","America/Miquelon":"PM","America/St_Kitts":"KN","Australia/Melbourne":"AU","Europe/Minsk":"BY","Asia/Vladivostok":"RU","Europe/Sofia":"BG","Antarctica/Davis":"AQ","Pacific/Galapagos":"EC","America/North_Dakota/New_Salem":"US","Asia/Amman":"JO","Pacific/Wallis":"WF","America/Hermosillo":"MX","Pacific/Kiritimati":"KI","Antarctica/Macquarie":"AU","America/Guyana":"GY","Asia/Riyadh":"SA","Pacific/Tahiti":"PF","America/St_Vincent":"VC","America/Cancun":"MX","America/Grenada":"GD","Pacific/Wake":"UM","America/Dawson":"CA","Europe/Brussels":"BE","Indian/Kerguelen":"TF","America/Yakutat":"US","Indian/Mahe":"SC","Atlantic/Reykjavik":"IS","America/Panama":"PA","America/Guadeloupe":"GP","Europe/Malta":"MT","Antarctica/Troll":"AQ","Asia/Jayapura":"ID","Asia/Bahrain":"BH","Asia/Chita":"RU","Europe/Tallinn":"EE","Asia/Khandyga":"RU","America/Rio_Branco":"BR","Atlantic/St_Helena":"SH","Africa/Juba":"SS","America/Adak":"US","Pacific/Saipan":"MP","America/St_Lucia":"LC","America/Inuvik":"CA","Europe/Luxembourg":"LU","Africa/Bissau":"GW","Asia/Oral":"KZ","America/Boa_Vista":"BR","Europe/Skopje":"MK","America/Port-au-Prince":"HT","Pacific/Port_Moresby":"PG","Europe/Andorra":"AD","America/Indiana/Marengo":"US","Africa/Kigali":"RW","Africa/Bamako":"ML","America/Dominica":"DM","Asia/Aqtobe":"KZ","Europe/Istanbul":"TR","Pacific/Rarotonga":"CK","America/Danmarkshavn":"GL","Europe/Zurich":"CH","Asia/Yangon":"MM","America/Monterrey":"MX","Europe/Lisbon":"PT","Asia/Kuching":"MY","Antarctica/Rothera":"AQ","Australia/Perth":"AU","Asia/Phnom_Penh":"KH","America/Swift_Current":"CA","Asia/Aqtau":"KZ","Asia/Urumqi":"CN","Asia/Calcutta":"IN"};function f(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16))}function m(i){return!(!i||"string"!=typeof i)&&!(i.length<2||i.length>10240)}function v(i,e,a){if(i)if(Array.isArray(i))i.forEach((i,t)=>{e.call(a,i,t)});else for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.call(a,i[t],t)}function p(i,e,a,t){var{capture:r=!1,passive:n=!0}=null!=t?t:{};null==i||i.addEventListener(e,a,{capture:r,passive:n})}function g(i,e){if(!e)return i;for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(i[a]=e[a]);return i}function _(i){for(var e=arguments.length,a=new Array(e>1?e-1:0),t=1;t<e;t++)a[t-1]=arguments[t];for(var r of a)for(var n of r)i.push(n);return i}var S="undefined"!=typeof window?window:void 0,E="undefined"!=typeof globalThis?globalThis:S,y=null==E?void 0:E.navigator,w=null==E?void 0:E.document,b=null==E?void 0:E.location,C=null==E?void 0:E.fetch,P=(null==E?void 0:E.XMLHttpRequest)&&"withCredentials"in new E.XMLHttpRequest?E.XMLHttpRequest:void 0;null==E||E.AbortController;var M=null==y?void 0:y.userAgent;class R{constructor(i,e){void 0===i&&(i="cookie"),this.storageMethod=i,this.domain=e,this.i=void 0,this.t()}o(){return this.storageMethod===h||this.storageMethod===A}l(){return this.o()?this.storageMethod===h?localStorage:sessionStorage:null}h(i){return{value:i,expiry:(new Date).getTime()+18e5}}A(i){var e=this.l();if(e){var t=this.h(i);e.setItem(a,JSON.stringify(t))}}getSessionIdFromCookie(){var i={};return document.cookie.split(";").forEach(function(e){var[a,t]=e.split("=");i[a.trim()]=t}),i[a]||null}setSessionIdFromCookie(i){var e=a+"="+i+"; Max-Age=1800; path=/; secure";this.domain&&(e+="; domain="+this.domain),document.cookie=e}m(i){this.o()?this.A(i):this.setSessionIdFromCookie(i)}v(){var i=this.l();if(i){var e=i.getItem(a);if(!e)return null;var t=null;try{t=JSON.parse(e)}catch(i){return null}return"object"!=typeof t||null===t?null:(new Date).getTime()>t.expiry?(i.removeItem(a),null):t.value}return this.getSessionIdFromCookie()}getSessionId(){var i=this.v();return i||(i=f(),this.m(i)),i}setSessionId(){var i=this.v()||f();return this.m(i),i}p(){var i=this.l();if(i)i.removeItem(a);else{var e="Thu, 01 Jan 1970 00:00:00 UTC";document.cookie=a+"=; expires="+e+"; path=/;",this.domain&&(document.cookie=a+"=; expires="+e+"; path=/; domain="+this.domain+";")}}resetSessionId(){this.p(),this.setSessionId(),this.S(f())}getWindowId(){if(this.i)return this.i;if(this.C()&&S){var i=S.sessionStorage.getItem(t);if(i)return this.i=i,i}var e=f();return this.S(e),e}S(i){i!==this.i&&(this.i=i,this.C()&&S&&S.sessionStorage.setItem(t,i))}C(){if(void 0===S||!S.sessionStorage)return!1;try{var i="__vt_session_storage_test__";return S.sessionStorage.setItem(i,"test"),S.sessionStorage.removeItem(i),!0}catch(i){return!1}}t(){if(this.C()&&S){var i=S.sessionStorage.getItem(r),e=S.sessionStorage.getItem(t);e&&!i?this.i=e:(e&&S.sessionStorage.removeItem(t),this.S(f())),S.sessionStorage.setItem(r,"true"),this.P()}else this.i=f()}P(){S&&this.C()&&p(S,"beforeunload",()=>{S&&S.sessionStorage&&S.sessionStorage.removeItem(r)},{capture:!1})}}function U(i){if(!w)return null;var e=w.createElement("a");return e.href=i,e}function k(i,e){for(var a=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),t=0;t<a.length;t++){var r=a[t].split("=");if(r[0]===e){if(r.length<2)return"";var n=r[1];try{n=decodeURIComponent(n)}catch(i){}return n.replace(/\+/g," ")}}return""}function I(i,e,a){if(!i||!e||!e.length)return i;for(var t=i.split("#"),r=t[0]||"",n=t[1],s=r.split("?"),o=s[1],c=s[0],u=(o||"").split("&"),l=[],h=0;h<u.length;h++){var A=u[h].split("="),d=A[0],f=A.slice(1).join("=");-1!==e.indexOf(d)?l.push(d+"="+a):d&&l.push(d+(f?"="+f:""))}var m=l.join("&");return c+(m?"?"+m:"")+(n?"#"+n:"")}function T(i){return"function"==typeof i}var B="Mobile",N="iOS",x="Android",D="Tablet",O=x+" "+D,K="iPad",L="Apple",G=L+" Watch",j="Safari",V="BlackBerry",F="Samsung",W=F+"Browser",H=F+" Internet",J="Chrome",z=J+" OS",Z=J+" "+N,q="Internet Explorer",X=q+" "+B,Y="Opera",Q=Y+" Mini",ii="Edge",ei="Microsoft "+ii,ai="Firefox",ti=ai+" "+N,ri="Nintendo",ni="PlayStation",si="Xbox",oi=x+" "+B,ci=B+" "+j,ui="Windows",li=ui+" Phone",hi="Nokia",Ai="Ouya",di="Generic",fi=di+" "+B.toLowerCase(),mi=di+" "+D.toLowerCase(),vi="Konqueror",pi="(\\d+(\\.\\d+)?)",gi=new RegExp("Version/"+pi),_i=new RegExp(si,"i"),Si=new RegExp(ni+" \\w+","i"),Ei=new RegExp(ri+" \\w+","i"),yi=new RegExp(V+"|PlayBook|BB10","i"),wi={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function bi(i,e){return i.toLowerCase().includes(e.toLowerCase())}var Ci=(i,e)=>e&&bi(e,L)||function(i){return bi(i,j)&&!bi(i,J)&&!bi(i,x)}(i),Pi=function(i,e){return e=e||"",bi(i," OPR/")&&bi(i,"Mini")?Q:bi(i," OPR/")?Y:yi.test(i)?V:bi(i,"IE"+B)||bi(i,"WPDesktop")?X:bi(i,W)?H:bi(i,ii)||bi(i,"Edg/")?ei:bi(i,"FBIOS")?"Facebook "+B:bi(i,"UCWEB")||bi(i,"UCBrowser")?"UC Browser":bi(i,"CriOS")?Z:bi(i,"CrMo")||bi(i,J)?J:bi(i,x)&&bi(i,j)?oi:bi(i,"FxiOS")?ti:bi(i.toLowerCase(),vi.toLowerCase())?vi:Ci(i,e)?bi(i,B)?ci:j:bi(i,ai)?ai:bi(i,"MSIE")||bi(i,"Trident/")?q:bi(i,"Gecko")?ai:""},Mi={[X]:[new RegExp("rv:"+pi)],[ei]:[new RegExp(ii+"?\\/"+pi)],[J]:[new RegExp("("+J+"|CrMo)\\/"+pi)],[Z]:[new RegExp("CriOS\\/"+pi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pi)],[j]:[gi],[ci]:[gi],[Y]:[new RegExp("(Opera|OPR)\\/"+pi)],[ai]:[new RegExp(ai+"\\/"+pi)],[ti]:[new RegExp("FxiOS\\/"+pi)],[vi]:[new RegExp("Konqueror[:/]?"+pi,"i")],[V]:[new RegExp(V+" "+pi),gi],[oi]:[new RegExp("android\\s"+pi,"i")],[H]:[new RegExp(W+"\\/"+pi)],[q]:[new RegExp("(rv:|MSIE )"+pi)],Mozilla:[new RegExp("rv:"+pi)]},Ri=function(i,e){var a=Pi(i,e),t=Mi[a];if(void 0===t)return null;for(var r=0;r<t.length;r++){var n=t[r],s=i.match(n);if(s)return parseFloat(s[s.length-2])}return null},Ui=[[new RegExp(si+"; "+si+" (.*?)[);]","i"),i=>[si,i&&i[1]||""]],[new RegExp(ri,"i"),[ri,""]],[new RegExp(ni,"i"),[ni,""]],[yi,[V,""]],[new RegExp(ui,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[li,""];if(new RegExp(B).test(e)&&!/IEMobile\b/.test(e))return[ui+" "+B,""];var a=/Windows NT ([0-9.]+)/i.exec(e);if(a&&a[1]){var t=a[1],r=wi[t]||"";return/arm/i.test(e)&&(r="RT"),[ui,r]}return[ui,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[N,e.join(".")]}return[N,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=void 0===i[2]?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+x+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+x+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[x,e.join(".")]}return[x,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var a=[i[1],i[2],i[3]||"0"];e[1]=a.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[z,""]],[/Linux|debian/i,["Linux",""]]],ki=function(i){return Ei.test(i)?ri:Si.test(i)?ni:_i.test(i)?si:new RegExp(Ai,"i").test(i)?Ai:new RegExp("("+li+"|WPDesktop)","i").test(i)?li:/iPad/.test(i)?K:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?G:yi.test(i)?V:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(hi,"i").test(i)?hi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(B).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?x:O:x:new RegExp("(pda|"+B+")","i").test(i)?fi:new RegExp(D,"i").test(i)&&!new RegExp(D+" pc","i").test(i)?mi:""},Ii="https?://(.*)",Ti=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Bi=_(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ti),Ni="<masked>";function xi(i){var e=function(i){return i?0===i.search(Ii+"google.([^/?]*)")?"google":0===i.search(Ii+"bing.com")?"bing":0===i.search(Ii+"yahoo.com")?"yahoo":0===i.search(Ii+"duckduckgo.com")?"duckduckgo":null:null}(i),a="yahoo"!=e?"q":"p",t={};if(null!==e){t.$search_engine=e;var r=w?k(w.referrer,a):"";r.length&&(t.ph_keyword=r)}return t}function Di(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Oi(){return(null==w?void 0:w.referrer)||"$direct"}function Ki(i){var e,{r:a,u:t}=i,r={$referrer:a,$referring_domain:null==a?void 0:"$direct"==a?"$direct":null===(e=U(a))||void 0===e?void 0:e.host};if(t){r.$current_url=t;var n=U(t);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var s=function(i){var e=Bi.concat([]),a={};return v(e,function(e){var t=k(i,e);a[e]=t||null}),a}(t);g(r,s)}a&&g(r,xi(a));return r}function Li(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}function $i(){try{return(new Date).getTimezoneOffset()}catch(i){return}}function Gi(i,e){if(!M)return{};var a,t,r,[n,s]=function(i){for(var e=0;e<Ui.length;e++){var[a,t]=Ui[e],r=a.exec(i),n=r&&(T(t)?t(r,i):t);if(n)return n}return["",""]}(M);return g(function(i){var e={};for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a)){var t=i[a];null!=t&&""!==t&&(e[a]=t)}return e}({$os:n,$os_version:s,$browser:Pi(M,navigator.vendor),$device:ki(M),$device_type:(t=M,r=ki(t),r===K||r===O||"Kobo"===r||"Kindle Fire"===r||r===mi?D:r===ri||r===si||r===ni||r===Ai?"Console":r===G?"Wearable":r?B:"Desktop"),$timezone:Li(),$timezone_offset:$i()}),{$current_url:I(null==b?void 0:b.href,[],Ni),$host:null==b?void 0:b.host,$pathname:null==b?void 0:b.pathname,$raw_user_agent:M.length>1e3?M.substring(0,997)+"...":M,$browser_version:Ri(M,navigator.vendor),$browser_language:Di(),$browser_language_prefix:(a=Di(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==S?void 0:S.screen.height,$screen_width:null==S?void 0:S.screen.width,$viewport_height:null==S?void 0:S.innerHeight,$viewport_width:null==S?void 0:S.innerWidth,$lib:"web",$lib_version:"1.0.7",$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class ji{constructor(i,e){void 0===i&&(i="localStorage"),this.M=null,this.storageMethod=i,this.domain=e,this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.saveUserIdentity()),this.userIdentity.anonymous_id}getUserProperties(){return i({},this.userIdentity.properties)}identify(e,a,t){if("number"==typeof e&&(e=e.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.isDistinctIdStringLike(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=e,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}e!==r&&(this.userIdentity.distinct_id=e);var s="anonymous"===this.userIdentity.user_state;e!==r&&s?(this.userIdentity.user_state="identified",a&&(this.userIdentity.properties=i({},this.userIdentity.properties,a)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity()):a||t?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),a&&(this.userIdentity.properties=i({},this.userIdentity.properties,a)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity()):e!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,a){if(!e&&!a)return!1;var t=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(t,e,a);return this.M===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),a&&Object.keys(a).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=a[i])}),this.saveUserIdentity(),this.M=r,!0)}getPersonPropertiesHash(i,e,a){return JSON.stringify({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:a})}reset(e){var a=this.generateAnonymousId(),t=this.userIdentity.device_id,r=e?this.generateDeviceId():t;this.userIdentity={distinct_id:null,anonymous_id:a,device_id:r,properties:{},user_state:"anonymous"},this.M=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}setDistinctId(i){this.userIdentity.distinct_id=i,this.saveUserIdentity()}setUserState(i){this.userIdentity.user_state=i,this.saveUserIdentity()}updateUserProperties(e,a){e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),a&&Object.keys(a).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=a[i])}),this.saveUserIdentity()}ensureDeviceId(e){this.userIdentity.device_id||(this.userIdentity.device_id=e,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:e}),this.saveUserIdentity())}isDistinctIdStringLikePublic(i){return this.isDistinctIdStringLike(i)}createAlias(i,e){return this.isValidDistinctId(i)?(void 0===e&&(e=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(e)?i===e?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:i,original:e}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isValidDistinctId(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(e)&&0!==i.trim().length}isDistinctIdStringLike(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(e)}loadUserIdentity(){var i=this.getStoredValue(n)||this.generateAnonymousId(),e=this.getStoredValue(s)||null,a=this.getStoredValue(o)||this.generateDeviceId(),t=this.getStoredUserProperties(),r=this.getStoredValue(u)||"anonymous";return{distinct_id:e,anonymous_id:i||this.generateAnonymousId(),device_id:a,properties:t,user_state:r}}saveUserIdentity(){this.setStoredValue(n,this.userIdentity.anonymous_id),this.setStoredValue(o,this.userIdentity.device_id),this.setStoredValue(u,this.userIdentity.user_state),this.userIdentity.distinct_id?this.setStoredValue(s,this.userIdentity.distinct_id):this.removeStoredValue(s),this.setStoredUserProperties(this.userIdentity.properties)}generateAnonymousId(){return"anon_"+f()}generateDeviceId(){return"device_"+f()}getStoredValue(i){try{return this.storageMethod===h?localStorage.getItem(i):this.storageMethod===A?sessionStorage.getItem(i):this.getCookieValue(i)}catch(i){return console.warn("Failed to access storage:",i),null}}setStoredValue(i,e){try{this.storageMethod===h?localStorage.setItem(i,e):this.storageMethod===A?sessionStorage.setItem(i,e):this.setCookieValue(i,e)}catch(i){console.warn("Failed to save to storage:",i)}}removeStoredValue(i){this.storageMethod===h?localStorage.removeItem(i):this.storageMethod===A?sessionStorage.removeItem(i):this.removeCookieValue(i)}getStoredUserProperties(){var i=this.getStoredValue(c);if(!i)return{};try{return JSON.parse(i)}catch(i){return{}}}setStoredUserProperties(i){this.setStoredValue(c,JSON.stringify(i))}getCookieValue(i){var e=document.cookie.split(";");for(var a of e){var[t,r]=a.trim().split("=");if(t===i)return decodeURIComponent(r)}return null}setCookieValue(i,e){var a=i+"="+encodeURIComponent(e)+"; Max-Age=31536000; path=/; secure; SameSite=Lax";this.domain&&(a+="; domain="+this.domain),document.cookie=a}removeCookieValue(i){var e=i+"=; Max-Age=0; path=/";this.domain&&(e+="; domain="+this.domain),document.cookie=e}register_once(i,e){var a=this.getStoredUserProperties(),t=!1;for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(r in a||(a[r]=i[r],t=!0));if(e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(n in a||(a[n]=e[n],t=!0));t&&this.setStoredUserProperties(a)}set_initial_person_info(i,e){if(!this.getStoredUserProperties()[l]){var a=function(i,e){var a=i?_([],Ti,e||[]):[],t=null==b?void 0:b.href.substring(0,1e3);return{r:Oi().substring(0,1e3),u:t?I(t,a,Ni):void 0}}(i,e);this.register_once({[l]:a},void 0)}}get_initial_props(){var i,e,a=this.getStoredUserProperties()[l];return a?(i=Ki(a),e={},v(i,function(i,a){var t;e["$initial_"+(t=String(a),t.startsWith("$")?t.substring(1):t)]=i}),e):{}}update_referrer_info(){var i,e={$referrer:Oi(),$referring_domain:(null==w?void 0:w.referrer)&&(null===(i=U(w.referrer))||void 0===i?void 0:i.host)||"$direct"};this.register_once(e,void 0)}}class Vi{constructor(i,e){if(this.instance=e,i.webVitals&&S)try{this.webVitals=require("web-vitals"),this.initializeWebVitals()}catch(i){console.warn("web-vitals library not found. Please install it to enable web vitals tracking.",i)}}initializeWebVitals(){if(this.webVitals){var i=i=>{try{if(!(S&&w&&y&&b))return;var{country:e,locale:a}=function(){var i,e;if(!y)return{country:i,locale:e};try{var a=Intl.DateTimeFormat().resolvedOptions().timeZone;i=d[a],e=y.languages&&y.languages.length?y.languages[0]:y.userLanguage||y.language||y.browserLanguage||"en"}catch(i){}return{country:i,locale:e}}();this.instance.capture("web_vital",{name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,pathname:b.pathname,href:b.href,"user-agent":y.userAgent,locale:a,location:e,referrer:w.referrer})}catch(i){console.error("Error sending web vital:",i)}};this.webVitals.onCLS&&this.webVitals.onCLS(i),this.webVitals.onFCP&&this.webVitals.onFCP(i),this.webVitals.onLCP&&this.webVitals.onLCP(i),this.webVitals.onTTFB&&this.webVitals.onTTFB(i),this.webVitals.onINP&&this.webVitals.onINP(i)}}}function Fi(i,e,a){try{if(!(e in i))return()=>{};var t=i[e],r=a(t);return T(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=t}}catch(i){return()=>{}}}class Wi{constructor(i){var e;this._instance=i,this.R=(null===(e=null==S?void 0:S.location)||void 0===e?void 0:e.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.U&&this.U(),this.U=void 0}monitorHistoryChanges(){var i,e;if(S&&b&&(this.R=b.pathname||"",S.history)){var a=this;(null===(i=S.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||Fi(S.history,"pushState",i=>function(e,t,r){i.call(this,e,t,r),a.k("pushState")}),(null===(e=S.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||Fi(S.history,"replaceState",i=>function(e,t,r){i.call(this,e,t,r),a.k("replaceState")}),this.I()}}k(i){var e;try{var a=null===(e=null==S?void 0:S.location)||void 0===e?void 0:e.pathname;if(!a||!b||!w)return;if(a!==this.R&&this.isEnabled){var t={navigation_type:i};this._instance.capture("$pageview",t)}this.R=a}catch(e){console.error("Error capturing "+i+" pageview",e)}}I(){if(!this.U&&S){var i=()=>{this.k("popstate")};p(S,"popstate",i),this.U=()=>{S&&S.removeEventListener("popstate",i)}}}}class Hi{constructor(i){void 0===i&&(i={}),this.__loaded=!1,this.T=!1,this.B=null,this.__request_queue=[],this.N=!1,this.configManager=new e(i);var a=this.configManager.getConfig(),t=a.domain;!t&&b&&(t=this.getCurrentDomain()),this.sessionManager=new R(a.storage||"cookie",t),this.userManager=new ji(a.persistence||"localStorage",t),this.webVitalsManager=new Vi(a,this)}init(i,e,a){var t;if(a&&a!==zi){var r=null!==(t=Ji[a])&&void 0!==t?t:new Hi;return r._init(i,e,a),Ji[a]=r,Ji[zi][a]=r,r}return this._init(i,e,a)}_init(e,a,t){if(void 0===a&&(a={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(i({},a,{projectId:e||a.projectId,name:t})),this.__loaded=!0;var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this.historyAutocapture=new Wi(this),this.historyAutocapture.startIfEnabled(),this.D(),this}toString(){var i,e=null!==(i=this.configManager.getConfig().name)&&void 0!==i?i:zi;return e!==zi&&(e=zi+"."+e),e}getCurrentDomain(){if(!b)return"";var i=b.protocol,e=b.hostname,a=b.port;return i+"//"+e+(a?":"+a:"")}O(){var i=this.configManager.getConfig();return!(!i.projectId||!i.token)||(this.N||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.N=!0),!1)}buildUrl(){var i=this.configManager.getConfig(),{proxyUrl:e,proxy:a,host:t,token:r}=i;return e||(a?a+"/api/tracking?token="+r:t?t.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(i,e,a){if(this.O()){if(a&&void 0!==S)if(S.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});var t=new XMLHttpRequest;t.open("POST",i,!0),t.setRequestHeader("Content-Type","application/json"),t.send(JSON.stringify(e))}}K(i){this.sendRequest(i.url,i.event,!1)}capture(e,a){if(this.sessionManager.setSessionId(),y&&y.userAgent&&function(i){return!(i&&"string"==typeof i&&i.length>500)}(y.userAgent)){var t=this.buildUrl(),r=Gi(),n=this.userManager.getUserProperties(),s=this.userManager.get_initial_props(),o=this.sessionManager.getSessionId(),c=this.sessionManager.getWindowId(),u=this.userManager.getAnonymousId(),l={};Object.keys(s).length>0&&Object.assign(l,s),a.$set_once&&Object.assign(l,a.$set_once);var h=i({},r,n,{$session_id:o,$window_id:c},u?{$anon_distinct_id:u}:{},Object.keys(l).length>0?{$set_once:l}:{},a.$set?{$set:a.$set}:{},a);"$pageview"===e&&w&&(h.title=w.title);var A,d,f=this.configManager.getConfig();if(!1!==f.stringifyPayload){if(A=Object.assign({},h,f.globalAttributes),!m(A=JSON.stringify(A)))return}else if(A=Object.assign({},h,f.globalAttributes),!m(JSON.stringify(A)))return;d="$identify"===e?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var v={timestamp:(new Date).toISOString(),event:e,project_id:f.projectId||"",domain:f.domain||this.getCurrentDomain(),payload:A,distinct_id:d,anonymous_id:u};this.sendRequest(t,v,!0)}}trackEvent(i,e){void 0===e&&(e={}),this.capture(i,e)}identify(i,e,a){if("number"==typeof i&&(i=String(i),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),i)if(this.userManager.isDistinctIdStringLikePublic(i))console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==i){var t=this.userManager.getDistinctId(),r=this.userManager.getAnonymousId(),n=this.userManager.getDeviceId(),s="anonymous"===this.userManager.getUserState();if(!n){var o=t||r;this.userManager.ensureDeviceId(o)}i!==t&&s?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(e,a),this.capture("$identify",{distinct_id:i,$anon_distinct_id:t||r,$set:e||{},$set_once:a||{}}),this.userManager.setDistinctId(i)):e||a?(s&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(e,a),this.capture("$set",{$set:e||{},$set_once:a||{}})):i!==t&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(i))}else console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(i,e){this.userManager.setUserProperties(i,e)&&this.capture("$set",{$set:i||{},$set_once:e||{}})}resetUser(i){this.sessionManager.resetSessionId(),this.userManager.reset(i)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(i,e){var a=this.userManager.createAlias(i,e);a?this.capture("$alias",{$original_id:a.original,$alias_id:a.distinct_id}):i===(e||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(i)}D(){w&&("visible"===w.visibilityState?this.T||(this.T=!0,setTimeout(()=>{if(w&&b){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.B&&(w.removeEventListener("visibilitychange",this.B),this.B=null)):this.B||(this.B=()=>{this.D()},p(w,"visibilitychange",this.B)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}updateConfig(i){this.configManager.updateConfig(i);var e=this.configManager.getConfig(),a=e.domain;!a&&b&&(a=this.getCurrentDomain()),this.sessionManager=new R(e.storage||"cookie",a),this.userManager=new ji(e.persistence||"localStorage",a),this.webVitalsManager=new Vi(e,this)}_execute_array(i){Array.isArray(i)&&i.forEach(i=>{if(i&&Array.isArray(i)&&i.length>0){var e=i[0],a=i.slice(1);if("function"==typeof this[e])try{this[e](...a)}catch(i){console.error("vTilt: Error executing queued call "+e+":",i)}}})}_dom_loaded(){this.__request_queue.forEach(i=>{this.K(i)}),this.__request_queue=[]}}var Ji={},zi="vt",Zi=!(void 0!==P||void 0!==C)&&-1===(null==M?void 0:M.indexOf("MSIE"))&&-1===(null==M?void 0:M.indexOf("Mozilla"));S&&(S.__VTILT_ENQUEUE_REQUESTS=Zi);var qi,Xi=(qi=Ji[zi]=new Hi,function(){function i(){i.done||(i.done=!0,Zi=!1,void 0!==S&&(S.__VTILT_ENQUEUE_REQUESTS=!1),v(Ji,function(i){i._dom_loaded()}))}w&&"function"==typeof w.addEventListener?"complete"===w.readyState?i():p(w,"DOMContentLoaded",i,{capture:!1}):S&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),qi);export{Hi as VTilt,Xi as default,Xi as vt};
1
+ function i(i,e,t,a,r,n,s){try{var o=i[n](s),c=o.value}catch(i){return void t(i)}o.done?e(c):Promise.resolve(c).then(a,r)}function e(e){return function(){var t=this,a=arguments;return new Promise(function(r,n){var s=e.apply(t,a);function o(e){i(s,r,n,o,c,"next",e)}function c(e){i(s,r,n,o,c,"throw",e)}o(void 0)})}}function t(){return t=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)({}).hasOwnProperty.call(t,a)&&(i[a]=t[a])}return i},t.apply(null,arguments)}class a{constructor(i){void 0===i&&(i={}),this.config=this.parseConfigFromScript(i)}parseConfigFromScript(i){if(!document.currentScript)return t({projectId:i.projectId||"",token:i.token||""},i);var e=document.currentScript,a=t({projectId:"",token:""},i);if(a.host=e.getAttribute("data-host")||i.host,a.proxy=e.getAttribute("data-proxy")||i.proxy,a.proxyUrl=e.getAttribute("data-proxy-url")||i.proxyUrl,a.token=e.getAttribute("data-token")||i.token||"",a.projectId=e.getAttribute("data-project-id")||i.projectId||"",a.domain=e.getAttribute("data-domain")||i.domain,a.storage=e.getAttribute("data-storage")||i.storage,a.stringifyPayload="false"!==e.getAttribute("data-stringify-payload"),a.webVitals="true"===e.getAttribute("web-vitals")||"true"===e.getAttribute("data-web-vitals")||i.webVitals,a.proxy&&a.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var r of(a.globalAttributes=t({},i.globalAttributes),Array.from(e.attributes)))r.name.startsWith("tb_")&&(a.globalAttributes[r.name.slice(3).replace(/-/g,"_")]=r.value),r.name.startsWith("data-tb-")&&(a.globalAttributes[r.name.slice(8).replace(/-/g,"_")]=r.value);return a}getConfig(){return t({},this.config)}updateConfig(i){this.config=t({},this.config,i)}}var r="vt_session_id",n="vt_window_id",s="vt_primary_window_exists",o="vt_anonymous_id",c="vt_distinct_id",u="vt_device_id",h="vt_user_properties",l="vt_user_state",d="$initial_person_info",f="localStorage",A="sessionStorage",v={"Asia/Barnaul":"RU","Africa/Nouakchott":"MR","Africa/Lusaka":"ZM","Asia/Pyongyang":"KP","Europe/Bratislava":"SK","America/Belize":"BZ","America/Maceio":"BR","Pacific/Chuuk":"FM","Indian/Comoro":"KM","Pacific/Palau":"PW","Asia/Jakarta":"ID","Africa/Windhoek":"NA","America/Chihuahua":"MX","America/Nome":"US","Africa/Mbabane":"SZ","Africa/Porto-Novo":"BJ","Europe/San_Marino":"SM","Pacific/Fakaofo":"TK","America/Denver":"US","Europe/Belgrade":"RS","America/Indiana/Tell_City":"US","America/Fortaleza":"BR","America/Halifax":"CA","Europe/Bucharest":"RO","America/Indiana/Petersburg":"US","Europe/Kirov":"RU","Europe/Athens":"GR","America/Argentina/Ushuaia":"AR","Europe/Monaco":"MC","Europe/Vilnius":"LT","Europe/Copenhagen":"DK","Pacific/Kanton":"KI","America/Caracas":"VE","Asia/Almaty":"KZ","Europe/Paris":"FR","Africa/Blantyre":"MW","Asia/Muscat":"OM","America/North_Dakota/Beulah":"US","America/Matamoros":"MX","Asia/Irkutsk":"RU","America/Costa_Rica":"CR","America/Araguaina":"BR","Atlantic/Canary":"ES","America/Santo_Domingo":"DO","America/Vancouver":"CA","Africa/Addis_Ababa":"ET","Africa/Accra":"GH","Pacific/Kwajalein":"MH","Asia/Baghdad":"IQ","Australia/Adelaide":"AU","Australia/Hobart":"AU","America/Guayaquil":"EC","America/Argentina/Tucuman":"AR","Australia/Lindeman":"AU","America/New_York":"US","Pacific/Fiji":"FJ","America/Antigua":"AG","Africa/Casablanca":"MA","America/Paramaribo":"SR","Africa/Cairo":"EG","America/Cayenne":"GF","America/Detroit":"US","Antarctica/Syowa":"AQ","Africa/Douala":"CM","America/Argentina/La_Rioja":"AR","Africa/Lagos":"NG","America/St_Barthelemy":"BL","Asia/Nicosia":"CY","Asia/Macau":"MO","Europe/Riga":"LV","Asia/Ashgabat":"TM","Indian/Antananarivo":"MG","America/Argentina/San_Juan":"AR","Asia/Aden":"YE","Asia/Tomsk":"RU","America/Asuncion":"PY","Pacific/Bougainville":"PG","Asia/Vientiane":"LA","America/Mazatlan":"MX","Africa/Luanda":"AO","Europe/Oslo":"NO","Africa/Kinshasa":"CD","Europe/Warsaw":"PL","America/Grand_Turk":"TC","Asia/Seoul":"KR","Africa/Tripoli":"LY","America/St_Thomas":"VI","Asia/Kathmandu":"NP","Pacific/Pitcairn":"PN","Pacific/Nauru":"NR","America/Curacao":"CW","Asia/Kabul":"AF","Pacific/Tongatapu":"TO","Europe/Simferopol":"UA","Asia/Ust-Nera":"RU","Africa/Mogadishu":"SO","Indian/Mayotte":"YT","Pacific/Niue":"NU","America/Thunder_Bay":"CA","Atlantic/Azores":"PT","Pacific/Gambier":"PF","Europe/Stockholm":"SE","Africa/Libreville":"GA","America/Punta_Arenas":"CL","America/Guatemala":"GT","America/Noronha":"BR","Europe/Helsinki":"FI","Asia/Gaza":"PS","Pacific/Kosrae":"FM","America/Aruba":"AW","America/Nassau":"BS","Asia/Choibalsan":"MN","America/Winnipeg":"CA","America/Anguilla":"AI","Asia/Thimphu":"BT","Asia/Beirut":"LB","Atlantic/Faroe":"FO","Europe/Berlin":"DE","Europe/Amsterdam":"NL","Pacific/Honolulu":"US","America/Regina":"CA","America/Scoresbysund":"GL","Europe/Vienna":"AT","Europe/Tirane":"AL","Africa/El_Aaiun":"EH","America/Creston":"CA","Asia/Qostanay":"KZ","Asia/Ho_Chi_Minh":"VN","Europe/Samara":"RU","Europe/Rome":"IT","Australia/Eucla":"AU","America/El_Salvador":"SV","America/Chicago":"US","Africa/Abidjan":"CI","Asia/Kamchatka":"RU","Pacific/Tarawa":"KI","America/Santiago":"CL","America/Bahia":"BR","Indian/Christmas":"CX","Asia/Atyrau":"KZ","Asia/Dushanbe":"TJ","Europe/Ulyanovsk":"RU","America/Yellowknife":"CA","America/Recife":"BR","Australia/Sydney":"AU","America/Fort_Nelson":"CA","Pacific/Efate":"VU","Europe/Saratov":"RU","Africa/Banjul":"GM","Asia/Omsk":"RU","Europe/Ljubljana":"SI","Europe/Budapest":"HU","Europe/Astrakhan":"RU","America/Argentina/Buenos_Aires":"AR","Pacific/Chatham":"NZ","America/Argentina/Salta":"AR","Africa/Niamey":"NE","Asia/Pontianak":"ID","Indian/Reunion":"RE","Asia/Hong_Kong":"HK","Antarctica/McMurdo":"AQ","Africa/Malabo":"GQ","America/Los_Angeles":"US","America/Argentina/Cordoba":"AR","Pacific/Pohnpei":"FM","America/Tijuana":"MX","America/Campo_Grande":"BR","America/Dawson_Creek":"CA","Asia/Novosibirsk":"RU","Pacific/Pago_Pago":"AS","Asia/Jerusalem":"IL","Europe/Sarajevo":"BA","Africa/Freetown":"SL","Asia/Yekaterinburg":"RU","America/Juneau":"US","Africa/Ouagadougou":"BF","Africa/Monrovia":"LR","Europe/Kiev":"UA","America/Argentina/San_Luis":"AR","Asia/Tokyo":"JP","Asia/Qatar":"QA","America/La_Paz":"BO","America/Bogota":"CO","America/Thule":"GL","Asia/Manila":"PH","Asia/Hovd":"MN","Asia/Tehran":"IR","Atlantic/Madeira":"PT","America/Metlakatla":"US","Europe/Vatican":"VA","Asia/Bishkek":"KG","Asia/Dili":"TL","Antarctica/Palmer":"AQ","Atlantic/Cape_Verde":"CV","Indian/Chagos":"IO","America/Kentucky/Monticello":"US","Africa/Algiers":"DZ","Africa/Maseru":"LS","Asia/Kuala_Lumpur":"MY","Africa/Khartoum":"SD","America/Argentina/Rio_Gallegos":"AR","America/Blanc-Sablon":"CA","Africa/Maputo":"MZ","America/Tortola":"VG","Atlantic/Bermuda":"BM","America/Argentina/Catamarca":"AR","America/Cayman":"KY","America/Puerto_Rico":"PR","Pacific/Majuro":"MH","Europe/Busingen":"DE","Pacific/Midway":"UM","Indian/Cocos":"CC","Asia/Singapore":"SG","America/Boise":"US","America/Nuuk":"GL","America/Goose_Bay":"CA","Australia/Broken_Hill":"AU","Africa/Dar_es_Salaam":"TZ","Africa/Asmara":"ER","Asia/Samarkand":"UZ","Asia/Tbilisi":"GE","America/Argentina/Jujuy":"AR","America/Indiana/Winamac":"US","America/Porto_Velho":"BR","Asia/Magadan":"RU","Europe/Zaporozhye":"UA","Antarctica/Casey":"AQ","Asia/Shanghai":"CN","Pacific/Norfolk":"NF","Europe/Guernsey":"GG","Australia/Brisbane":"AU","Antarctica/DumontDUrville":"AQ","America/Havana":"CU","America/Atikokan":"CA","America/Mexico_City":"MX","America/Rankin_Inlet":"CA","America/Cuiaba":"BR","America/Resolute":"CA","Africa/Ceuta":"ES","Arctic/Longyearbyen":"SJ","Pacific/Guam":"GU","Asia/Damascus":"SY","Asia/Colombo":"LK","Asia/Yerevan":"AM","America/Montserrat":"MS","America/Belem":"BR","Europe/Kaliningrad":"RU","Atlantic/South_Georgia":"GS","Asia/Tashkent":"UZ","Asia/Kolkata":"IN","America/St_Johns":"CA","Asia/Srednekolymsk":"RU","Asia/Yakutsk":"RU","Europe/Prague":"CZ","Africa/Djibouti":"DJ","Asia/Dubai":"AE","Europe/Uzhgorod":"UA","America/Edmonton":"CA","Asia/Famagusta":"CY","America/Indiana/Knox":"US","Asia/Hebron":"PS","Asia/Taipei":"TW","Europe/London":"GB","Africa/Dakar":"SN","Australia/Darwin":"AU","America/Glace_Bay":"CA","Antarctica/Vostok":"AQ","America/Indiana/Vincennes":"US","America/Nipigon":"CA","Asia/Kuwait":"KW","Pacific/Guadalcanal":"SB","America/Toronto":"CA","Africa/Gaborone":"BW","Africa/Bujumbura":"BI","Africa/Lubumbashi":"CD","America/Merida":"MX","America/Marigot":"MF","Europe/Zagreb":"HR","Pacific/Easter":"CL","America/Santarem":"BR","Pacific/Noumea":"NC","America/Sitka":"US","Atlantic/Stanley":"FK","Pacific/Funafuti":"TV","America/Iqaluit":"CA","America/Rainy_River":"CA","America/Anchorage":"US","America/Lima":"PE","Asia/Baku":"AZ","America/Indiana/Vevay":"US","Asia/Ulaanbaatar":"MN","America/Managua":"NI","Asia/Krasnoyarsk":"RU","Asia/Qyzylorda":"KZ","America/Eirunepe":"BR","Europe/Podgorica":"ME","Europe/Chisinau":"MD","Europe/Mariehamn":"AX","Europe/Volgograd":"RU","Africa/Nairobi":"KE","Europe/Isle_of_Man":"IM","America/Menominee":"US","Africa/Harare":"ZW","Asia/Anadyr":"RU","America/Moncton":"CA","Indian/Maldives":"MV","America/Whitehorse":"CA","Antarctica/Mawson":"AQ","Europe/Madrid":"ES","America/Argentina/Mendoza":"AR","America/Manaus":"BR","Africa/Bangui":"CF","Indian/Mauritius":"MU","Africa/Tunis":"TN","Australia/Lord_Howe":"AU","America/Kentucky/Louisville":"US","America/North_Dakota/Center":"US","Asia/Novokuznetsk":"RU","Asia/Makassar":"ID","America/Port_of_Spain":"TT","America/Bahia_Banderas":"MX","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","Asia/Dhaka":"BD","America/Pangnirtung":"CA","Europe/Dublin":"IE","Asia/Brunei":"BN","Africa/Brazzaville":"CG","America/Montevideo":"UY","America/Jamaica":"JM","America/Indiana/Indianapolis":"US","America/Kralendijk":"BQ","Europe/Gibraltar":"GI","Pacific/Marquesas":"PF","Pacific/Apia":"WS","Europe/Jersey":"JE","America/Phoenix":"US","Africa/Ndjamena":"TD","Asia/Karachi":"PK","Africa/Kampala":"UG","Asia/Sakhalin":"RU","America/Martinique":"MQ","Europe/Moscow":"RU","Africa/Conakry":"GN","America/Barbados":"BB","Africa/Lome":"TG","America/Ojinaga":"MX","America/Tegucigalpa":"HN","Asia/Bangkok":"TH","Africa/Johannesburg":"ZA","Europe/Vaduz":"LI","Africa/Sao_Tome":"ST","America/Cambridge_Bay":"CA","America/Lower_Princes":"SX","America/Miquelon":"PM","America/St_Kitts":"KN","Australia/Melbourne":"AU","Europe/Minsk":"BY","Asia/Vladivostok":"RU","Europe/Sofia":"BG","Antarctica/Davis":"AQ","Pacific/Galapagos":"EC","America/North_Dakota/New_Salem":"US","Asia/Amman":"JO","Pacific/Wallis":"WF","America/Hermosillo":"MX","Pacific/Kiritimati":"KI","Antarctica/Macquarie":"AU","America/Guyana":"GY","Asia/Riyadh":"SA","Pacific/Tahiti":"PF","America/St_Vincent":"VC","America/Cancun":"MX","America/Grenada":"GD","Pacific/Wake":"UM","America/Dawson":"CA","Europe/Brussels":"BE","Indian/Kerguelen":"TF","America/Yakutat":"US","Indian/Mahe":"SC","Atlantic/Reykjavik":"IS","America/Panama":"PA","America/Guadeloupe":"GP","Europe/Malta":"MT","Antarctica/Troll":"AQ","Asia/Jayapura":"ID","Asia/Bahrain":"BH","Asia/Chita":"RU","Europe/Tallinn":"EE","Asia/Khandyga":"RU","America/Rio_Branco":"BR","Atlantic/St_Helena":"SH","Africa/Juba":"SS","America/Adak":"US","Pacific/Saipan":"MP","America/St_Lucia":"LC","America/Inuvik":"CA","Europe/Luxembourg":"LU","Africa/Bissau":"GW","Asia/Oral":"KZ","America/Boa_Vista":"BR","Europe/Skopje":"MK","America/Port-au-Prince":"HT","Pacific/Port_Moresby":"PG","Europe/Andorra":"AD","America/Indiana/Marengo":"US","Africa/Kigali":"RW","Africa/Bamako":"ML","America/Dominica":"DM","Asia/Aqtobe":"KZ","Europe/Istanbul":"TR","Pacific/Rarotonga":"CK","America/Danmarkshavn":"GL","Europe/Zurich":"CH","Asia/Yangon":"MM","America/Monterrey":"MX","Europe/Lisbon":"PT","Asia/Kuching":"MY","Antarctica/Rothera":"AQ","Australia/Perth":"AU","Asia/Phnom_Penh":"KH","America/Swift_Current":"CA","Asia/Aqtau":"KZ","Asia/Urumqi":"CN","Asia/Calcutta":"IN"};function m(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16))}function p(i){return!(!i||"string"!=typeof i)&&!(i.length<2||i.length>10240)}function g(i,e,t){if(i)if(Array.isArray(i))i.forEach((i,a)=>{e.call(t,i,a)});else for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&e.call(t,i[a],a)}function _(i,e,t,a){var{capture:r=!1,passive:n=!0}=null!=a?a:{};null==i||i.addEventListener(e,t,{capture:r,passive:n})}function S(i,e){if(!e)return i;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i}function y(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),a=1;a<e;a++)t[a-1]=arguments[a];for(var r of t)for(var n of r)i.push(n);return i}var w="undefined"!=typeof window?window:void 0,b="undefined"!=typeof globalThis?globalThis:w,E=null==b?void 0:b.navigator,M=null==b?void 0:b.document,C=null==b?void 0:b.location,P=null==b?void 0:b.fetch,R=(null==b?void 0:b.XMLHttpRequest)&&"withCredentials"in new b.XMLHttpRequest?b.XMLHttpRequest:void 0;null==b||b.AbortController;var T=null==E?void 0:E.userAgent;class U{constructor(i,e){void 0===i&&(i="cookie"),this.storageMethod=i,this.domain=e,this.o=void 0,this.A()}v(){return this.storageMethod===f||this.storageMethod===A}m(){return this.v()?this.storageMethod===f?localStorage:sessionStorage:null}S(i){return{value:i,expiry:(new Date).getTime()+18e5}}M(i){var e=this.m();if(e){var t=this.S(i);e.setItem(r,JSON.stringify(t))}}getSessionIdFromCookie(){var i={};return document.cookie.split(";").forEach(function(e){var[t,a]=e.split("=");i[t.trim()]=a}),i[r]||null}setSessionIdFromCookie(i){var e=r+"="+i+"; Max-Age=1800; path=/; secure";this.domain&&(e+="; domain="+this.domain),document.cookie=e}C(i){this.v()?this.M(i):this.setSessionIdFromCookie(i)}P(){var i=this.m();if(i){var e=i.getItem(r);if(!e)return null;var t=null;try{t=JSON.parse(e)}catch(i){return null}return"object"!=typeof t||null===t?null:(new Date).getTime()>t.expiry?(i.removeItem(r),null):t.value}return this.getSessionIdFromCookie()}getSessionId(){var i=this.P();return i||(i=m(),this.C(i)),i}setSessionId(){var i=this.P()||m();return this.C(i),i}R(){var i=this.m();if(i)i.removeItem(r);else{var e="Thu, 01 Jan 1970 00:00:00 UTC";document.cookie=r+"=; expires="+e+"; path=/;",this.domain&&(document.cookie=r+"=; expires="+e+"; path=/; domain="+this.domain+";")}}resetSessionId(){this.R(),this.setSessionId(),this.T(m())}getWindowId(){if(this.o)return this.o;if(this.U()&&w){var i=w.sessionStorage.getItem(n);if(i)return this.o=i,i}var e=m();return this.T(e),e}T(i){i!==this.o&&(this.o=i,this.U()&&w&&w.sessionStorage.setItem(n,i))}U(){if(void 0===w||!w.sessionStorage)return!1;try{var i="__vt_session_storage_test__";return w.sessionStorage.setItem(i,"test"),w.sessionStorage.removeItem(i),!0}catch(i){return!1}}A(){if(this.U()&&w){var i=w.sessionStorage.getItem(s),e=w.sessionStorage.getItem(n);e&&!i?this.o=e:(e&&w.sessionStorage.removeItem(n),this.T(m())),w.sessionStorage.setItem(s,"true"),this.k()}else this.o=m()}k(){w&&this.U()&&_(w,"beforeunload",()=>{w&&w.sessionStorage&&w.sessionStorage.removeItem(s)},{capture:!1})}}function k(i){if(!M)return null;var e=M.createElement("a");return e.href=i,e}function I(i,e){for(var t=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;a<t.length;a++){var r=t[a].split("=");if(r[0]===e){if(r.length<2)return"";var n=r[1];try{n=decodeURIComponent(n)}catch(i){}return n.replace(/\+/g," ")}}return""}function B(i,e,t){if(!i||!e||!e.length)return i;for(var a=i.split("#"),r=a[0]||"",n=a[1],s=r.split("?"),o=s[1],c=s[0],u=(o||"").split("&"),h=[],l=0;l<u.length;l++){var d=u[l].split("="),f=d[0],A=d.slice(1).join("=");-1!==e.indexOf(f)?h.push(f+"="+t):f&&h.push(f+(A?"="+A:""))}var v=h.join("&");return c+(v?"?"+v:"")+(n?"#"+n:"")}function x(i){return"function"==typeof i}var D="Mobile",N="iOS",O="Android",L="Tablet",K=O+" "+L,G="iPad",j="Apple",F=j+" Watch",V="Safari",H="BlackBerry",q="Samsung",W=q+"Browser",z=q+" Internet",J="Chrome",Z=J+" OS",X=J+" "+N,Q="Internet Explorer",Y=Q+" "+D,ii="Opera",ei=ii+" Mini",ti="Edge",ai="Microsoft "+ti,ri="Firefox",ni=ri+" "+N,si="Nintendo",oi="PlayStation",ci="Xbox",ui=O+" "+D,hi=D+" "+V,li="Windows",di=li+" Phone",fi="Nokia",Ai="Ouya",vi="Generic",mi=vi+" "+D.toLowerCase(),pi=vi+" "+L.toLowerCase(),gi="Konqueror",_i="(\\d+(\\.\\d+)?)",Si=new RegExp("Version/"+_i),yi=new RegExp(ci,"i"),wi=new RegExp(oi+" \\w+","i"),bi=new RegExp(si+" \\w+","i"),Ei=new RegExp(H+"|PlayBook|BB10","i"),Mi={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function Ci(i,e){return i.toLowerCase().includes(e.toLowerCase())}var Pi=(i,e)=>e&&Ci(e,j)||function(i){return Ci(i,V)&&!Ci(i,J)&&!Ci(i,O)}(i),Ri=function(i,e){return e=e||"",Ci(i," OPR/")&&Ci(i,"Mini")?ei:Ci(i," OPR/")?ii:Ei.test(i)?H:Ci(i,"IE"+D)||Ci(i,"WPDesktop")?Y:Ci(i,W)?z:Ci(i,ti)||Ci(i,"Edg/")?ai:Ci(i,"FBIOS")?"Facebook "+D:Ci(i,"UCWEB")||Ci(i,"UCBrowser")?"UC Browser":Ci(i,"CriOS")?X:Ci(i,"CrMo")||Ci(i,J)?J:Ci(i,O)&&Ci(i,V)?ui:Ci(i,"FxiOS")?ni:Ci(i.toLowerCase(),gi.toLowerCase())?gi:Pi(i,e)?Ci(i,D)?hi:V:Ci(i,ri)?ri:Ci(i,"MSIE")||Ci(i,"Trident/")?Q:Ci(i,"Gecko")?ri:""},Ti={[Y]:[new RegExp("rv:"+_i)],[ai]:[new RegExp(ti+"?\\/"+_i)],[J]:[new RegExp("("+J+"|CrMo)\\/"+_i)],[X]:[new RegExp("CriOS\\/"+_i)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+_i)],[V]:[Si],[hi]:[Si],[ii]:[new RegExp("(Opera|OPR)\\/"+_i)],[ri]:[new RegExp(ri+"\\/"+_i)],[ni]:[new RegExp("FxiOS\\/"+_i)],[gi]:[new RegExp("Konqueror[:/]?"+_i,"i")],[H]:[new RegExp(H+" "+_i),Si],[ui]:[new RegExp("android\\s"+_i,"i")],[z]:[new RegExp(W+"\\/"+_i)],[Q]:[new RegExp("(rv:|MSIE )"+_i)],Mozilla:[new RegExp("rv:"+_i)]},Ui=function(i,e){var t=Ri(i,e),a=Ti[t];if(void 0===a)return null;for(var r=0;r<a.length;r++){var n=a[r],s=i.match(n);if(s)return parseFloat(s[s.length-2])}return null},ki=[[new RegExp(ci+"; "+ci+" (.*?)[);]","i"),i=>[ci,i&&i[1]||""]],[new RegExp(si,"i"),[si,""]],[new RegExp(oi,"i"),[oi,""]],[Ei,[H,""]],[new RegExp(li,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[di,""];if(new RegExp(D).test(e)&&!/IEMobile\b/.test(e))return[li+" "+D,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var a=t[1],r=Mi[a]||"";return/arm/i.test(e)&&(r="RT"),[li,r]}return[li,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[N,e.join(".")]}return[N,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=void 0===i[2]?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+O+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+O+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[O,e.join(".")]}return[O,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Z,""]],[/Linux|debian/i,["Linux",""]]],Ii=function(i){return bi.test(i)?si:wi.test(i)?oi:yi.test(i)?ci:new RegExp(Ai,"i").test(i)?Ai:new RegExp("("+di+"|WPDesktop)","i").test(i)?di:/iPad/.test(i)?G:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?F:Ei.test(i)?H:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(fi,"i").test(i)?fi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(D).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?O:K:O:new RegExp("(pda|"+D+")","i").test(i)?mi:new RegExp(L,"i").test(i)&&!new RegExp(L+" pc","i").test(i)?pi:""},Bi="https?://(.*)",xi=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Di=y(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],xi),Ni="<masked>";function Oi(i){var e=function(i){return i?0===i.search(Bi+"google.([^/?]*)")?"google":0===i.search(Bi+"bing.com")?"bing":0===i.search(Bi+"yahoo.com")?"yahoo":0===i.search(Bi+"duckduckgo.com")?"duckduckgo":null:null}(i),t="yahoo"!==e?"q":"p",a={};if(null!==e){a.$search_engine=e;var r=M?I(M.referrer,t):"";r.length&&(a.ph_keyword=r)}return a}function Li(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Ki(){return(null==M?void 0:M.referrer)||"$direct"}function $i(){var i;return(null==M?void 0:M.referrer)&&(null===(i=k(M.referrer))||void 0===i?void 0:i.host)||"$direct"}function Gi(i){var e,{r:t,u:a}=i,r={$referrer:t,$referring_domain:null==t?void 0:"$direct"===t?"$direct":null===(e=k(t))||void 0===e?void 0:e.host};if(a){r.$current_url=a;var n=k(a);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var s=function(i){var e=Di.concat([]),t={};return g(e,function(e){var a=I(i,e);t[e]=a||null}),t}(a);S(r,s)}t&&S(r,Oi(t));return r}function ji(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}function Fi(){try{return(new Date).getTimezoneOffset()}catch(i){return}}function Vi(i,e){if(!T)return{};var t,a,r,[n,s]=function(i){for(var e=0;e<ki.length;e++){var[t,a]=ki[e],r=t.exec(i),n=r&&(x(a)?a(r,i):a);if(n)return n}return["",""]}(T);return S(function(i){var e={};for(var t in i)if(Object.prototype.hasOwnProperty.call(i,t)){var a=i[t];null!=a&&""!==a&&(e[t]=a)}return e}({$os:n,$os_version:s,$browser:Ri(T,navigator.vendor),$device:Ii(T),$device_type:(a=T,r=Ii(a),r===G||r===K||"Kobo"===r||"Kindle Fire"===r||r===pi?L:r===si||r===ci||r===oi||r===Ai?"Console":r===F?"Wearable":r?D:"Desktop"),$timezone:ji(),$timezone_offset:Fi()}),{$current_url:B(null==C?void 0:C.href,[],Ni),$host:null==C?void 0:C.host,$pathname:null==C?void 0:C.pathname,$raw_user_agent:T.length>1e3?T.substring(0,997)+"...":T,$browser_version:Ui(T,navigator.vendor),$browser_language:Li(),$browser_language_prefix:(t=Li(),"string"==typeof t?t.split("-")[0]:void 0),$screen_height:null==w?void 0:w.screen.height,$screen_width:null==w?void 0:w.screen.width,$viewport_height:null==w?void 0:w.innerHeight,$viewport_width:null==w?void 0:w.innerWidth,$lib:"web",$lib_version:"1.0.7",$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class Hi{constructor(i,e){void 0===i&&(i="localStorage"),this.I=null,this.storageMethod=i,this.domain=e,this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return t({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.saveUserIdentity()),this.userIdentity.anonymous_id}getUserProperties(){return t({},this.userIdentity.properties)}identify(i,e,a){if("number"==typeof i&&(i=i.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),i)if(this.isDistinctIdStringLike(i))console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==i){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=i,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=t({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}i!==r&&(this.userIdentity.distinct_id=i);var s="anonymous"===this.userIdentity.user_state;i!==r&&s?(this.userIdentity.user_state="identified",e&&(this.userIdentity.properties=t({},this.userIdentity.properties,e)),a&&Object.keys(a).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=a[i])}),this.saveUserIdentity()):e||a?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),e&&(this.userIdentity.properties=t({},this.userIdentity.properties,e)),a&&Object.keys(a).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=a[i])}),this.saveUserIdentity()):i!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(i,e){if(!i&&!e)return!1;var a=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(a,i,e);return this.I===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(i&&(this.userIdentity.properties=t({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=e[i])}),this.saveUserIdentity(),this.I=r,!0)}getPersonPropertiesHash(i,e,t){return JSON.stringify({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}reset(i){var e=this.generateAnonymousId(),a=this.userIdentity.device_id,r=i?this.generateDeviceId():a;this.userIdentity={distinct_id:null,anonymous_id:e,device_id:r,properties:{},user_state:"anonymous"},this.I=null,this.saveUserIdentity(),this.userIdentity.properties=t({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}setDistinctId(i){this.userIdentity.distinct_id=i,this.saveUserIdentity()}setUserState(i){this.userIdentity.user_state=i,this.saveUserIdentity()}updateUserProperties(i,e){i&&(this.userIdentity.properties=t({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=e[i])}),this.saveUserIdentity()}ensureDeviceId(i){this.userIdentity.device_id||(this.userIdentity.device_id=i,this.userIdentity.properties=t({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:i}),this.saveUserIdentity())}isDistinctIdStringLikePublic(i){return this.isDistinctIdStringLike(i)}createAlias(i,e){return this.isValidDistinctId(i)?(void 0===e&&(e=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(e)?i===e?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:i,original:e}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isValidDistinctId(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(e)&&0!==i.trim().length}isDistinctIdStringLike(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(e)}loadUserIdentity(){var i=this.getStoredValue(o)||this.generateAnonymousId(),e=this.getStoredValue(c)||null,t=this.getStoredValue(u)||this.generateDeviceId(),a=this.getStoredUserProperties(),r=this.getStoredValue(l)||"anonymous";return{distinct_id:e,anonymous_id:i||this.generateAnonymousId(),device_id:t,properties:a,user_state:r}}saveUserIdentity(){this.setStoredValue(o,this.userIdentity.anonymous_id),this.setStoredValue(u,this.userIdentity.device_id),this.setStoredValue(l,this.userIdentity.user_state),this.userIdentity.distinct_id?this.setStoredValue(c,this.userIdentity.distinct_id):this.removeStoredValue(c),this.setStoredUserProperties(this.userIdentity.properties)}generateAnonymousId(){return"anon_"+m()}generateDeviceId(){return"device_"+m()}getStoredValue(i){try{return this.storageMethod===f?localStorage.getItem(i):this.storageMethod===A?sessionStorage.getItem(i):this.getCookieValue(i)}catch(i){return console.warn("Failed to access storage:",i),null}}setStoredValue(i,e){try{this.storageMethod===f?localStorage.setItem(i,e):this.storageMethod===A?sessionStorage.setItem(i,e):this.setCookieValue(i,e)}catch(i){console.warn("Failed to save to storage:",i)}}removeStoredValue(i){this.storageMethod===f?localStorage.removeItem(i):this.storageMethod===A?sessionStorage.removeItem(i):this.removeCookieValue(i)}getStoredUserProperties(){var i=this.getStoredValue(h);if(!i)return{};try{return JSON.parse(i)}catch(i){return{}}}setStoredUserProperties(i){this.setStoredValue(h,JSON.stringify(i))}getCookieValue(i){var e=document.cookie.split(";");for(var t of e){var[a,r]=t.trim().split("=");if(a===i)return decodeURIComponent(r)}return null}setCookieValue(i,e){var t=i+"="+encodeURIComponent(e)+"; Max-Age=31536000; path=/; secure; SameSite=Lax";this.domain&&(t+="; domain="+this.domain),document.cookie=t}removeCookieValue(i){var e=i+"=; Max-Age=0; path=/";this.domain&&(e+="; domain="+this.domain),document.cookie=e}register_once(i,e){var t=this.getStoredUserProperties(),a=!1;for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(r in t||(t[r]=i[r],a=!0));if(e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(n in t||(t[n]=e[n],a=!0));a&&this.setStoredUserProperties(t)}set_initial_person_info(i,e){if(!this.getStoredUserProperties()[d]){var t=function(i,e){var t=i?y([],xi,e||[]):[],a=null==C?void 0:C.href.substring(0,1e3);return{r:Ki().substring(0,1e3),u:a?B(a,t,Ni):void 0}}(i,e);this.register_once({[d]:t},void 0)}}get_initial_props(){var i,e,t=this.getStoredUserProperties()[d];return t?(i=Gi(t),e={},g(i,function(i,t){var a;e["$initial_"+(a=String(t),a.startsWith("$")?a.substring(1):a)]=i}),e):{}}update_referrer_info(){var i={$referrer:Ki(),$referring_domain:$i()};this.register_once(i,void 0)}}class qi{constructor(i,e){if(this.instance=e,i.webVitals&&w)try{this.webVitals=require("web-vitals"),this.initializeWebVitals()}catch(i){console.warn("web-vitals library not found. Please install it to enable web vitals tracking.",i)}}initializeWebVitals(){if(this.webVitals){var i=i=>{try{if(!(w&&M&&E&&C))return;var{country:e,locale:t}=function(){var i,e;if(!E)return{country:i,locale:e};try{var t=Intl.DateTimeFormat().resolvedOptions().timeZone;i=v[t],e=E.languages&&E.languages.length?E.languages[0]:E.userLanguage||E.language||E.browserLanguage||"en"}catch(i){}return{country:i,locale:e}}();this.instance.capture("web_vital",{name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,pathname:C.pathname,href:C.href,"user-agent":E.userAgent,locale:t,location:e,referrer:M.referrer})}catch(i){console.error("Error sending web vital:",i)}};this.webVitals.onCLS&&this.webVitals.onCLS(i),this.webVitals.onFCP&&this.webVitals.onFCP(i),this.webVitals.onLCP&&this.webVitals.onLCP(i),this.webVitals.onTTFB&&this.webVitals.onTTFB(i),this.webVitals.onINP&&this.webVitals.onINP(i)}}}function Wi(i,e,t){try{if(!(e in i))return()=>{};var a=i[e],r=t(a);return x(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=a}}catch(i){return()=>{}}}class zi{constructor(i){var e;this._instance=i,this.B=(null===(e=null==w?void 0:w.location)||void 0===e?void 0:e.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.D&&this.D(),this.D=void 0}monitorHistoryChanges(){var i,e;if(w&&C&&(this.B=C.pathname||"",w.history)){var t=this;(null===(i=w.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||Wi(w.history,"pushState",i=>function(e,a,r){i.call(this,e,a,r),t.N("pushState")}),(null===(e=w.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||Wi(w.history,"replaceState",i=>function(e,a,r){i.call(this,e,a,r),t.N("replaceState")}),this.O()}}N(i){var e;try{var t=null===(e=null==w?void 0:w.location)||void 0===e?void 0:e.pathname;if(!t||!C||!M)return;if(t!==this.B&&this.isEnabled){var a={navigation_type:i};this._instance.capture("$pageview",a)}this.B=t}catch(e){console.error("Error capturing "+i+" pageview",e)}}O(){if(!this.D&&w){var i=()=>{this.N("popstate")};_(w,"popstate",i),this.D=()=>{w&&w.removeEventListener("popstate",i)}}}}var Ji=Uint8Array,Zi=Uint16Array,Xi=Int32Array,Qi=new Ji([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Yi=new Ji([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ie=new Ji([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ee=function(i,e){for(var t=new Zi(31),a=0;a<31;++a)t[a]=e+=1<<i[a-1];var r=new Xi(t[30]);for(a=1;a<30;++a)for(var n=t[a];n<t[a+1];++n)r[n]=n-t[a]<<5|a;return{b:t,r:r}},te=ee(Qi,2),ae=te.b,re=te.r;ae[28]=258,re[258]=28;for(var ne=ee(Yi,0).r,se=new Zi(32768),oe=0;oe<32768;++oe){var ce=(43690&oe)>>1|(21845&oe)<<1;ce=(61680&(ce=(52428&ce)>>2|(13107&ce)<<2))>>4|(3855&ce)<<4,se[oe]=((65280&ce)>>8|(255&ce)<<8)>>1}var ue=function(i,e,t){for(var a=i.length,r=0,n=new Zi(e);r<a;++r)i[r]&&++n[i[r]-1];var s,o=new Zi(e);for(r=1;r<e;++r)o[r]=o[r-1]+n[r-1]<<1;if(t){s=new Zi(1<<e);var c=15-e;for(r=0;r<a;++r)if(i[r])for(var u=r<<4|i[r],h=e-i[r],l=o[i[r]-1]++<<h,d=l|(1<<h)-1;l<=d;++l)s[se[l]>>c]=u}else for(s=new Zi(a),r=0;r<a;++r)i[r]&&(s[r]=se[o[i[r]-1]++]>>15-i[r]);return s},he=new Ji(288);for(oe=0;oe<144;++oe)he[oe]=8;for(oe=144;oe<256;++oe)he[oe]=9;for(oe=256;oe<280;++oe)he[oe]=7;for(oe=280;oe<288;++oe)he[oe]=8;var le=new Ji(32);for(oe=0;oe<32;++oe)le[oe]=5;var de=ue(he,9,0),fe=ue(le,5,0),Ae=function(i){return(i+7)/8|0},ve=function(i,e,t){return(null==t||t>i.length)&&(t=i.length),new Ji(i.subarray(e,t))},me=function(i,e,t){t<<=7&e;var a=e/8|0;i[a]|=t,i[a+1]|=t>>8},pe=function(i,e,t){t<<=7&e;var a=e/8|0;i[a]|=t,i[a+1]|=t>>8,i[a+2]|=t>>16},ge=function(i,e){for(var t=[],a=0;a<i.length;++a)i[a]&&t.push({s:a,f:i[a]});var r=t.length,n=t.slice();if(!r)return{t:Me,l:0};if(1==r){var s=new Ji(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(i,e){return i.f-e.f}),t.push({s:-1,f:25001});var o=t[0],c=t[1],u=0,h=1,l=2;for(t[0]={s:-1,f:o.f+c.f,l:o,r:c};h!=r-1;)o=t[t[u].f<t[l].f?u++:l++],c=t[u!=h&&t[u].f<t[l].f?u++:l++],t[h++]={s:-1,f:o.f+c.f,l:o,r:c};var d=n[0].s;for(a=1;a<r;++a)n[a].s>d&&(d=n[a].s);var f=new Zi(d+1),A=_e(t[h-1],f,0);if(A>e){a=0;var v=0,m=A-e,p=1<<m;for(n.sort(function(i,e){return f[e.s]-f[i.s]||i.f-e.f});a<r;++a){var g=n[a].s;if(!(f[g]>e))break;v+=p-(1<<A-f[g]),f[g]=e}for(v>>=m;v>0;){var _=n[a].s;f[_]<e?v-=1<<e-f[_]++-1:++a}for(;a>=0&&v;--a){var S=n[a].s;f[S]==e&&(--f[S],++v)}A=e}return{t:new Ji(f),l:A}},_e=function(i,e,t){return-1==i.s?Math.max(_e(i.l,e,t+1),_e(i.r,e,t+1)):e[i.s]=t},Se=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Zi(++e),a=0,r=i[0],n=1,s=function(i){t[a++]=i},o=1;o<=e;++o)if(i[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)s(32754);n>2&&(s(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(s(r),--n;n>6;n-=6)s(8304);n>2&&(s(n-3<<5|8208),n=0)}for(;n--;)s(r);n=1,r=i[o]}return{c:t.subarray(0,a),n:e}},ye=function(i,e){for(var t=0,a=0;a<e.length;++a)t+=i[a]*e[a];return t},we=function(i,e,t){var a=t.length,r=Ae(e+2);i[r]=255&a,i[r+1]=a>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;n<a;++n)i[r+n+4]=t[n];return 8*(r+4+a)},be=function(i,e,t,a,r,n,s,o,c,u,h){me(e,h++,t),++r[256];for(var l=ge(r,15),d=l.t,f=l.l,A=ge(n,15),v=A.t,m=A.l,p=Se(d),g=p.c,_=p.n,S=Se(v),y=S.c,w=S.n,b=new Zi(19),E=0;E<g.length;++E)++b[31&g[E]];for(E=0;E<y.length;++E)++b[31&y[E]];for(var M=ge(b,7),C=M.t,P=M.l,R=19;R>4&&!C[ie[R-1]];--R);var T,U,k,I,B=u+5<<3,x=ye(r,he)+ye(n,le)+s,D=ye(r,d)+ye(n,v)+s+14+3*R+ye(b,C)+2*b[16]+3*b[17]+7*b[18];if(c>=0&&B<=x&&B<=D)return we(e,h,i.subarray(c,c+u));if(me(e,h,1+(D<x)),h+=2,D<x){T=ue(d,f,0),U=d,k=ue(v,m,0),I=v;var N=ue(C,P,0);me(e,h,_-257),me(e,h+5,w-1),me(e,h+10,R-4),h+=14;for(E=0;E<R;++E)me(e,h+3*E,C[ie[E]]);h+=3*R;for(var O=[g,y],L=0;L<2;++L){var K=O[L];for(E=0;E<K.length;++E){var G=31&K[E];me(e,h,N[G]),h+=C[G],G>15&&(me(e,h,K[E]>>5&127),h+=K[E]>>12)}}}else T=de,U=he,k=fe,I=le;for(E=0;E<o;++E){var j=a[E];if(j>255){pe(e,h,T[(G=j>>18&31)+257]),h+=U[G+257],G>7&&(me(e,h,j>>23&31),h+=Qi[G]);var F=31&j;pe(e,h,k[F]),h+=I[F],F>3&&(pe(e,h,j>>5&8191),h+=Yi[F])}else pe(e,h,T[j]),h+=U[j]}return pe(e,h,T[256]),h+U[256]},Ee=new Xi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Me=new Ji(0),Ce=function(){for(var i=new Int32Array(256),e=0;e<256;++e){for(var t=e,a=9;--a;)t=(1&t&&-306674912)^t>>>1;i[e]=t}return i}(),Pe=function(i,e,t,a,r){if(!r&&(r={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),s=new Ji(n.length+i.length);s.set(n),s.set(i,n.length),i=s,r.w=n.length}return function(i,e,t,a,r,n){var s=n.z||i.length,o=new Ji(a+s+5*(1+Math.ceil(s/7e3))+r),c=o.subarray(a,o.length-r),u=n.l,h=7&(n.r||0);if(e){h&&(c[0]=n.r>>3);for(var l=Ee[e-1],d=l>>13,f=8191&l,A=(1<<t)-1,v=n.p||new Zi(32768),m=n.h||new Zi(A+1),p=Math.ceil(t/3),g=2*p,_=function(e){return(i[e]^i[e+1]<<p^i[e+2]<<g)&A},S=new Xi(25e3),y=new Zi(288),w=new Zi(32),b=0,E=0,M=n.i||0,C=0,P=n.w||0,R=0;M+2<s;++M){var T=_(M),U=32767&M,k=m[T];if(v[U]=k,m[T]=U,P<=M){var I=s-M;if((b>7e3||C>24576)&&(I>423||!u)){h=be(i,c,0,S,y,w,E,C,R,M-R,h),C=b=E=0,R=M;for(var B=0;B<286;++B)y[B]=0;for(B=0;B<30;++B)w[B]=0}var x=2,D=0,N=f,O=U-k&32767;if(I>2&&T==_(M-O))for(var L=Math.min(d,I)-1,K=Math.min(32767,M),G=Math.min(258,I);O<=K&&--N&&U!=k;){if(i[M+x]==i[M+x-O]){for(var j=0;j<G&&i[M+j]==i[M+j-O];++j);if(j>x){if(x=j,D=O,j>L)break;var F=Math.min(O,j-2),V=0;for(B=0;B<F;++B){var H=M-O+B&32767,q=H-v[H]&32767;q>V&&(V=q,k=H)}}}O+=(U=k)-(k=v[U])&32767}if(D){S[C++]=268435456|re[x]<<18|ne[D];var W=31&re[x],z=31&ne[D];E+=Qi[W]+Yi[z],++y[257+W],++w[z],P=M+x,++b}else S[C++]=i[M],++y[i[M]]}}for(M=Math.max(M,P);M<s;++M)S[C++]=i[M],++y[i[M]];h=be(i,c,u,S,y,w,E,C,R,M-R,h),u||(n.r=7&h|c[h/8|0]<<3,h-=7,n.h=m,n.p=v,n.i=M,n.w=P)}else{for(M=n.w||0;M<s+u;M+=65535){var J=M+65535;J>=s&&(c[h/8|0]=u,J=s),h=we(c,h+1,i.subarray(M,J))}n.i=s}return ve(o,0,a+Ae(h)+r)}(i,null==e.level?6:e.level,null==e.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):20:12+e.mem,t,a,r)},Re=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Te(i,e){e||(e={});var t=function(){var i=-1;return{p:function(e){for(var t=i,a=0;a<e.length;++a)t=Ce[255&t^e[a]]^t>>>8;i=t},d:function(){return~i}}}(),a=i.length;t.p(i);var r,n=Pe(i,e,10+((r=e).filename?r.filename.length+1:0),8),s=n.length;return function(i,e){var t=e.filename;if(i[0]=31,i[1]=139,i[2]=8,i[8]=e.level<2?4:9==e.level?2:0,i[9]=3,0!=e.mtime&&Re(i,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){i[3]=8;for(var a=0;a<=t.length;++a)i[a+10]=t.charCodeAt(a)}}(n,e),Re(n,s-8,t.d()),Re(n,s-4,a),n}var Ue="undefined"!=typeof TextEncoder&&new TextEncoder,ke="undefined"!=typeof TextDecoder&&new TextDecoder;try{ke.decode(Me,{stream:!0})}catch(i){}var Ie,Be="text/plain";!function(i){i.GZipJS="gzip-js",i.None="none"}(Ie||(Ie={}));var xe=i=>{var{data:e,compression:t}=i;if(e){var a=(i=>JSON.stringify(i,(i,e)=>"bigint"==typeof e?e.toString():e))(e),r=new Blob([a]).size;if(t===Ie.GZipJS&&r>=1024)try{var n=Te(function(i,e){if(Ue)return Ue.encode(i);for(var t=i.length,a=new Ji(i.length+(i.length>>1)),r=0,n=function(i){a[r++]=i},s=0;s<t;++s){if(r+5>a.length){var o=new Ji(r+8+(t-s<<1));o.set(a),a=o}var c=i.charCodeAt(s);c<128||e?n(c):c<2048?(n(192|c>>6),n(128|63&c)):c>55295&&c<57344?(n(240|(c=65536+(1047552&c)|1023&i.charCodeAt(++s))>>18),n(128|c>>12&63),n(128|c>>6&63),n(128|63&c)):(n(224|c>>12),n(128|c>>6&63),n(128|63&c))}return ve(a,0,r)}(a),{mtime:0}),s=new Blob([n],{type:Be});if(s.size<.95*r)return{contentType:Be,body:s,estimatedSize:s.size}}catch(i){}return{contentType:"application/json",body:a,estimatedSize:r}}},De=[{name:"fetch",available:"undefined"!=typeof fetch,method:i=>{var a=xe(i);if(a){var{contentType:r,body:n,estimatedSize:s}=a,o=t({"Content-Type":r},i.headers||{});r===Be&&i.compression===Ie.GZipJS&&(o["Content-Encoding"]="gzip");var c=new AbortController,u=i.timeout?setTimeout(()=>c.abort(),i.timeout):null;fetch(i.url,{method:i.method||"POST",headers:o,body:n,keepalive:s<52428.8,signal:c.signal}).then(function(){var t=e(function*(e){var t,a=yield e.text(),r={statusCode:e.status,text:a};if(200===e.status)try{r.json=JSON.parse(a)}catch(i){}null===(t=i.callback)||void 0===t||t.call(i,r)});return function(i){return t.apply(this,arguments)}}()).catch(()=>{var e;null===(e=i.callback)||void 0===e||e.call(i,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:i=>{var e=new XMLHttpRequest;e.open(i.method||"POST",i.url,!0);var t=xe(i);if(t){var{contentType:a,body:r}=t;i.headers&&Object.entries(i.headers).forEach(i=>{var[t,a]=i;e.setRequestHeader(t,a)}),e.setRequestHeader("Content-Type",a),a===Be&&i.compression===Ie.GZipJS&&e.setRequestHeader("Content-Encoding","gzip"),i.timeout&&(e.timeout=i.timeout),e.onreadystatechange=()=>{var t;if(4===e.readyState){var a={statusCode:e.status,text:e.responseText};if(200===e.status)try{a.json=JSON.parse(e.responseText)}catch(i){}null===(t=i.callback)||void 0===t||t.call(i,a)}},e.onerror=()=>{var e;null===(e=i.callback)||void 0===e||e.call(i,{statusCode:0})},e.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:i=>{var e=xe(i);if(e){var{contentType:t,body:a}=e;try{var r="string"==typeof a?new Blob([a],{type:t}):a,n=i.compression===Ie.GZipJS&&t===Be?i.url+(i.url.includes("?")?"&":"?")+"compression=gzip-js":i.url;navigator.sendBeacon(n,r)}catch(i){}}}}],Ne=i=>{var e,t=i.transport||"fetch",a=De.find(i=>i.name===t&&i.available)||De.find(i=>i.available);if(!a)return console.error("vTilt: No available transport method"),void(null===(e=i.callback)||void 0===e||e.call(i,{statusCode:0}));a.method(i)};class Oe{constructor(i,e){var t,a,r,n;this.L=!0,this.K=[],this.$=(t=(null==e?void 0:e.flush_interval_ms)||3e3,a=250,r=5e3,n=3e3,"number"!=typeof t||isNaN(t)?n:Math.min(Math.max(t,a),r)),this.G=i}get length(){return this.K.length}enqueue(i){this.K.push(i),this.j||this.F()}unload(){if(this.V(),0!==this.K.length){var i=this.H();for(var e in i){var a=i[e];this.G(t({},a,{transport:"sendBeacon"}))}}}enable(){this.L=!1,this.F()}pause(){this.L=!0,this.V()}flush(){this.V(),this.q(),this.F()}F(){this.L||(this.j=setTimeout(()=>{this.V(),this.q(),this.K.length>0&&this.F()},this.$))}V(){this.j&&(clearTimeout(this.j),this.j=void 0)}q(){if(0!==this.K.length){var i=this.H(),e=Date.now();for(var t in i){var a=i[t];a.events.forEach(i=>{var t=new Date(i.timestamp).getTime();i.$offset=Math.abs(t-e)}),this.G(a)}}}H(){var i={};return this.K.forEach(e=>{var t=e.batchKey||e.url;i[t]||(i[t]={url:e.url,events:[],batchKey:e.batchKey}),i[t].events.push(e.event)}),this.K=[],i}}class Le{constructor(i){this.W=!1,this.J=3e3,this.K=[],this.Z=!0,this.G=i.sendRequest,this.X=i.sendBeacon,w&&void 0!==E&&"onLine"in E&&(this.Z=E.onLine,_(w,"online",()=>{this.Z=!0,this.Y()}),_(w,"offline",()=>{this.Z=!1}))}get length(){return this.K.length}enqueue(i,e){if(void 0===e&&(e=0),e>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var t=function(i){var e=3e3*Math.pow(2,i),t=e/2,a=Math.min(18e5,e),r=(Math.random()-.5)*(a-t);return Math.ceil(a+r)}(e),a=Date.now()+t;this.K.push({retryAt:a,request:i,retriesPerformedSoFar:e+1});var r="VTilt: Enqueued failed request for retry in "+Math.round(t/1e3)+"s";this.Z||(r+=" (Browser is offline)"),console.warn(r),this.W||(this.W=!0,this.ii())}}retriableRequest(i){var t=this;return e(function*(){try{var e=yield t.G(i);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&t.enqueue(i,0)}catch(e){t.enqueue(i,0)}})()}ii(){this.ei&&clearTimeout(this.ei),this.ei=setTimeout(()=>{this.Z&&this.K.length>0&&this.Y(),this.K.length>0?this.ii():this.W=!1},this.J)}Y(){var i=this,t=Date.now(),a=[],r=[];this.K.forEach(i=>{i.retryAt<t?r.push(i):a.push(i)}),this.K=a,r.forEach(function(){var t=e(function*(e){var{request:t,retriesPerformedSoFar:a}=e;try{var r=yield i.G(t);200!==r.statusCode&&(r.statusCode<400||r.statusCode>=500)&&i.enqueue(t,a)}catch(e){i.enqueue(t,a)}});return function(i){return t.apply(this,arguments)}}())}unload(){this.ei&&(clearTimeout(this.ei),this.ei=void 0),this.K.forEach(i=>{var{request:e}=i;try{this.X(e)}catch(i){console.error("VTilt: Failed to send beacon on unload",i)}}),this.K=[]}}var Ke="vt_rate_limit";class $e{constructor(i){var e,t;void 0===i&&(i={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(e=i.eventsPerSecond)&&void 0!==e?e:10,this.eventsBurstLimit=Math.max(null!==(t=i.eventsBurstLimit)&&void 0!==t?t:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=i.persistence,this.captureWarning=i.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(i){var e,t,a,r;void 0===i&&(i=!1);var n=Date.now(),s=null!==(t=null===(e=this.persistence)||void 0===e?void 0:e.get(Ke))&&void 0!==t?t:{tokens:this.eventsBurstLimit,last:n},o=(n-s.last)/1e3;s.tokens+=o*this.eventsPerSecond,s.last=n,s.tokens>this.eventsBurstLimit&&(s.tokens=this.eventsBurstLimit);var c=s.tokens<1;return c||i||(s.tokens=Math.max(0,s.tokens-1)),!c||this.lastEventRateLimited||i||null===(a=this.captureWarning)||void 0===a||a.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=c,null===(r=this.persistence)||void 0===r||r.set(Ke,s),{isRateLimited:c,remainingTokens:s.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class Ge{constructor(i){void 0===i&&(i={}),this.__loaded=!1,this.ti=!1,this.ai=null,this.__request_queue=[],this.ri=!1,this.ni=!1,this.configManager=new a(i);var e=this.configManager.getConfig(),t=e.domain;!t&&C&&(t=this.getCurrentDomain()),this.sessionManager=new U(e.storage||"cookie",t),this.userManager=new Hi(e.persistence||"localStorage",t),this.webVitalsManager=new qi(e,this),this.rateLimiter=new $e({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:i=>{this.si("$$client_ingestion_warning",{$$client_ingestion_warning_message:i})}}),this.retryQueue=new Le({sendRequest:i=>this.oi(i),sendBeacon:i=>this.ci(i)}),this.requestQueue=new Oe(i=>this.ui(i),{flush_interval_ms:3e3})}init(i,e,t){var a;if(t&&t!==Fe){var r=null!==(a=je[t])&&void 0!==a?a:new Ge;return r._init(i,e,t),je[t]=r,je[Fe][t]=r,r}return this._init(i,e,t)}_init(i,e,a){if(void 0===e&&(e={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(t({},e,{projectId:i||e.projectId,name:a})),this.__loaded=!0;var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this.historyAutocapture=new zi(this),this.historyAutocapture.startIfEnabled(),this.hi(),this.li(),this}hi(){if(w){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};_(w,"beforeunload",i),_(w,"pagehide",i)}}toString(){var i,e=null!==(i=this.configManager.getConfig().name)&&void 0!==i?i:Fe;return e!==Fe&&(e=Fe+"."+e),e}getCurrentDomain(){if(!C)return"";var i=C.protocol,e=C.hostname,t=C.port;return i+"//"+e+(t?":"+t:"")}di(){var i=this.configManager.getConfig();return!(!i.projectId||!i.token)||(this.ri||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.ri=!0),!1)}buildUrl(){var i=this.configManager.getConfig(),{proxyUrl:e,proxy:t,host:a,token:r}=i;return e||(t?t+"/api/tracking?token="+r:a?a.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(i,e,t){if(this.di()){if(t&&void 0!==w)if(w.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});this.requestQueue.enqueue({url:i,event:e})}}ui(i){var{transport:e}=i;"sendBeacon"!==e?this.retryQueue.retriableRequest(i):this.ci(i)}oi(i){return new Promise(e=>{var{url:t,events:a}=i,r=1===a.length?a[0]:{events:a},n=this.configManager.getConfig().disable_compression?Ie.None:Ie.GZipJS;Ne({url:t,data:r,method:"POST",transport:"XHR",compression:n,callback:i=>{e({statusCode:i.statusCode})}})})}ci(i){var{url:e,events:t}=i,a=1===t.length?t[0]:{events:t},r=this.configManager.getConfig().disable_compression?Ie.None:Ie.GZipJS;Ne({url:e,data:a,method:"POST",transport:"sendBeacon",compression:r})}fi(i){this.sendRequest(i.url,i.event,!1)}capture(i,e,a){if(this.sessionManager.setSessionId(),E&&E.userAgent&&function(i){return!(i&&"string"==typeof i&&i.length>500)}(E.userAgent)&&((null==a?void 0:a.skip_client_rate_limiting)||this.rateLimiter.shouldAllowEvent())){var r=this.buildUrl(),n=Vi(),s=this.userManager.getUserProperties(),o=this.userManager.get_initial_props(),c=this.sessionManager.getSessionId(),u=this.sessionManager.getWindowId(),h=this.userManager.getAnonymousId(),l={};!this.ni&&Object.keys(o).length>0&&Object.assign(l,o),e.$set_once&&Object.assign(l,e.$set_once);var d=t({},n,s,{$session_id:c,$window_id:u},h?{$anon_distinct_id:h}:{},Object.keys(l).length>0?{$set_once:l}:{},e.$set?{$set:e.$set}:{},e);!this.ni&&Object.keys(o).length>0&&(this.ni=!0),"$pageview"===i&&M&&(d.title=M.title);var f,A,v=this.configManager.getConfig();if(!1!==v.stringifyPayload){if(f=Object.assign({},d,v.globalAttributes),!p(f=JSON.stringify(f)))return}else if(f=Object.assign({},d,v.globalAttributes),!p(JSON.stringify(f)))return;A="$identify"===i?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var m={timestamp:(new Date).toISOString(),event:i,project_id:v.projectId||"",domain:v.domain||this.getCurrentDomain(),payload:f,distinct_id:A,anonymous_id:h};this.sendRequest(r,m,!0)}}si(i,e){this.capture(i,e,{skip_client_rate_limiting:!0})}trackEvent(i,e){void 0===e&&(e={}),this.capture(i,e)}identify(i,e,t){if("number"==typeof i&&(i=String(i),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),i)if(this.userManager.isDistinctIdStringLikePublic(i))console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==i){var a=this.userManager.getDistinctId(),r=this.userManager.getAnonymousId(),n=this.userManager.getDeviceId(),s="anonymous"===this.userManager.getUserState();if(!n){var o=a||r;this.userManager.ensureDeviceId(o)}i!==a&&s?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(e,t),this.capture("$identify",{distinct_id:i,$anon_distinct_id:a||r,$set:e||{},$set_once:t||{}}),this.userManager.setDistinctId(i)):e||t?(s&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(e,t),this.capture("$set",{$set:e||{},$set_once:t||{}})):i!==a&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(i))}else console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(i,e){this.userManager.setUserProperties(i,e)&&this.capture("$set",{$set:i||{},$set_once:e||{}})}resetUser(i){this.sessionManager.resetSessionId(),this.userManager.reset(i)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(i,e){var t=this.userManager.createAlias(i,e);t?this.capture("$alias",{$original_id:t.original,$alias_id:t.distinct_id}):i===(e||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(i)}li(){M&&("visible"===M.visibilityState?this.ti||(this.ti=!0,setTimeout(()=>{if(M&&C){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.ai&&(M.removeEventListener("visibilitychange",this.ai),this.ai=null)):this.ai||(this.ai=()=>{this.li()},_(M,"visibilitychange",this.ai)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}updateConfig(i){this.configManager.updateConfig(i);var e=this.configManager.getConfig(),t=e.domain;!t&&C&&(t=this.getCurrentDomain()),this.sessionManager=new U(e.storage||"cookie",t),this.userManager=new Hi(e.persistence||"localStorage",t),this.webVitalsManager=new qi(e,this)}_execute_array(i){Array.isArray(i)&&i.forEach(i=>{if(i&&Array.isArray(i)&&i.length>0){var e=i[0],t=i.slice(1);if("function"==typeof this[e])try{this[e](...t)}catch(i){console.error("vTilt: Error executing queued call "+e+":",i)}}})}_dom_loaded(){this.requestQueue.enable(),this.__request_queue.forEach(i=>{this.fi(i)}),this.__request_queue=[]}}var je={},Fe="vt",Ve=!(void 0!==R||void 0!==P)&&-1===(null==T?void 0:T.indexOf("MSIE"))&&-1===(null==T?void 0:T.indexOf("Mozilla"));w&&(w.__VTILT_ENQUEUE_REQUESTS=Ve);var He,qe=(He=je[Fe]=new Ge,function(){function i(){i.done||(i.done=!0,Ve=!1,void 0!==w&&(w.__VTILT_ENQUEUE_REQUESTS=!1),g(je,function(i){i._dom_loaded()}))}M&&"function"==typeof M.addEventListener?"complete"===M.readyState?i():_(M,"DOMContentLoaded",i,{capture:!1}):w&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),He);export{Ge as VTilt,qe as default,qe as vt};
2
2
  //# sourceMappingURL=module.js.map