@v-tilt/browser 1.3.0 → 1.4.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.
Files changed (43) hide show
  1. package/dist/all-external-dependencies.js.map +1 -1
  2. package/dist/array.full.js +1 -1
  3. package/dist/array.full.js.map +1 -1
  4. package/dist/array.js +1 -1
  5. package/dist/array.js.map +1 -1
  6. package/dist/array.no-external.js +1 -1
  7. package/dist/array.no-external.js.map +1 -1
  8. package/dist/chat.js +2 -0
  9. package/dist/chat.js.map +1 -0
  10. package/dist/entrypoints/chat.d.ts +22 -0
  11. package/dist/extensions/chat/chat-wrapper.d.ts +172 -0
  12. package/dist/extensions/chat/chat.d.ts +87 -0
  13. package/dist/extensions/chat/index.d.ts +10 -0
  14. package/dist/extensions/chat/types.d.ts +156 -0
  15. package/dist/external-scripts-loader.js.map +1 -1
  16. package/dist/main.js +1 -1
  17. package/dist/main.js.map +1 -1
  18. package/dist/module.d.ts +279 -2
  19. package/dist/module.js +1 -1
  20. package/dist/module.js.map +1 -1
  21. package/dist/module.no-external.d.ts +279 -2
  22. package/dist/module.no-external.js +1 -1
  23. package/dist/module.no-external.js.map +1 -1
  24. package/dist/recorder.js.map +1 -1
  25. package/dist/types.d.ts +27 -0
  26. package/dist/utils/globals.d.ts +111 -1
  27. package/dist/vtilt.d.ts +11 -1
  28. package/dist/web-vitals.js.map +1 -1
  29. package/lib/entrypoints/chat.d.ts +22 -0
  30. package/lib/entrypoints/chat.js +32 -0
  31. package/lib/extensions/chat/chat-wrapper.d.ts +172 -0
  32. package/lib/extensions/chat/chat-wrapper.js +497 -0
  33. package/lib/extensions/chat/chat.d.ts +87 -0
  34. package/lib/extensions/chat/chat.js +998 -0
  35. package/lib/extensions/chat/index.d.ts +10 -0
  36. package/lib/extensions/chat/index.js +27 -0
  37. package/lib/extensions/chat/types.d.ts +156 -0
  38. package/lib/extensions/chat/types.js +22 -0
  39. package/lib/types.d.ts +27 -0
  40. package/lib/utils/globals.d.ts +111 -1
  41. package/lib/vtilt.d.ts +11 -1
  42. package/lib/vtilt.js +42 -1
  43. package/package.json +66 -65
package/dist/module.d.ts CHANGED
@@ -86,6 +86,10 @@ interface VTiltConfig {
86
86
  session_recording?: SessionRecordingOptions;
87
87
  /** Disable session recording (convenience flag) */
88
88
  disable_session_recording?: boolean;
89
+ /** Chat widget configuration */
90
+ chat?: ChatWidgetConfig;
91
+ /** Disable chat (convenience flag) */
92
+ disable_chat?: boolean;
89
93
  /** Global attributes added to all events */
90
94
  globalAttributes?: Record<string, string>;
91
95
  /** Bootstrap data for initialization */
@@ -297,6 +301,29 @@ interface SessionRecordingOptions {
297
301
  /** Internal: Mutation throttler bucket size */
298
302
  __mutationThrottlerBucketSize?: number;
299
303
  }
304
+ /** Chat widget configuration */
305
+ interface ChatWidgetConfig {
306
+ /** Enable/disable chat widget (default: auto from dashboard) */
307
+ enabled?: boolean;
308
+ /** Auto-fetch settings from dashboard (default: true) */
309
+ autoConfig?: boolean;
310
+ /** Widget position (default: 'bottom-right') */
311
+ position?: "bottom-right" | "bottom-left";
312
+ /** Widget header/greeting message */
313
+ greeting?: string;
314
+ /** Widget primary color */
315
+ color?: string;
316
+ /** Start in AI mode (default: true) */
317
+ aiMode?: boolean;
318
+ /** AI greeting message (first message from AI) */
319
+ aiGreeting?: string;
320
+ /** Preload widget script on idle vs on-demand */
321
+ preload?: boolean;
322
+ /** Offline message shown when business is unavailable */
323
+ offlineMessage?: string;
324
+ /** Collect email when offline */
325
+ collectEmailOffline?: boolean;
326
+ }
300
327
  interface RemoteConfig {
301
328
  /** Default to identified_only mode */
302
329
  defaultIdentifiedOnly?: boolean;
@@ -407,6 +434,94 @@ interface SessionRecordingConfig {
407
434
  /** Recording start reason */
408
435
  type SessionStartReason = "recording_initialized" | "session_id_changed" | "linked_flag_matched" | "linked_flag_overridden" | "sampling_overridden" | "url_trigger_matched" | "event_trigger_matched" | "sampled";
409
436
 
437
+ /**
438
+ * Chat message structure (matches PostgreSQL chat_messages table)
439
+ * Note: Read status is determined by cursor comparison, not per-message
440
+ */
441
+ interface ChatMessage {
442
+ id: string;
443
+ channel_id: string;
444
+ sender_type: "user" | "agent" | "ai" | "system";
445
+ sender_id: string | null;
446
+ sender_name: string | null;
447
+ sender_avatar_url: string | null;
448
+ content: string;
449
+ content_type: "text" | "html" | "attachment";
450
+ metadata: Record<string, unknown>;
451
+ created_at: string;
452
+ }
453
+ /**
454
+ * Chat channel structure (maps 1:1 to Ably channel)
455
+ */
456
+ interface ChatChannel {
457
+ id: string;
458
+ project_id: string;
459
+ person_id: string;
460
+ distinct_id: string;
461
+ status: "open" | "closed" | "snoozed";
462
+ ai_mode: boolean;
463
+ unread_count: number;
464
+ last_message_at: string | null;
465
+ last_message_preview: string | null;
466
+ last_message_sender: "user" | "agent" | "ai" | "system" | null;
467
+ user_last_read_at: string | null;
468
+ agent_last_read_at: string | null;
469
+ created_at: string;
470
+ }
471
+ /**
472
+ * Chat widget configuration
473
+ *
474
+ * Settings can come from two sources:
475
+ * 1. Dashboard (fetched from /api/chat/settings) - "snippet-only" mode
476
+ * 2. Code config (passed to vt.init) - overrides dashboard settings
477
+ *
478
+ * This enables Intercom-like flexibility: just add snippet OR customize with code.
479
+ */
480
+ interface ChatConfig {
481
+ /**
482
+ * Enable/disable chat widget.
483
+ * - undefined: Use dashboard setting (auto-fetch)
484
+ * - true: Enable (override dashboard)
485
+ * - false: Disable entirely
486
+ */
487
+ enabled?: boolean;
488
+ /**
489
+ * Auto-fetch settings from dashboard (default: true)
490
+ * When true, SDK fetches /api/chat/settings and uses those as base config.
491
+ * Code config always overrides fetched settings.
492
+ */
493
+ autoConfig?: boolean;
494
+ /** Widget position (default: 'bottom-right') */
495
+ position?: "bottom-right" | "bottom-left";
496
+ /** Widget header/greeting message */
497
+ greeting?: string;
498
+ /** Widget primary color */
499
+ color?: string;
500
+ /** Start in AI mode (default: true) */
501
+ aiMode?: boolean;
502
+ /** AI greeting message (first message from AI) */
503
+ aiGreeting?: string;
504
+ /** Preload widget script on idle vs on-demand */
505
+ preload?: boolean;
506
+ /** Custom theme */
507
+ theme?: ChatTheme;
508
+ /** Offline message shown when business is unavailable */
509
+ offlineMessage?: string;
510
+ /** Collect email when offline */
511
+ collectEmailOffline?: boolean;
512
+ }
513
+ /**
514
+ * Chat theme customization
515
+ */
516
+ interface ChatTheme {
517
+ primaryColor?: string;
518
+ fontFamily?: string;
519
+ borderRadius?: string;
520
+ headerBgColor?: string;
521
+ userBubbleColor?: string;
522
+ agentBubbleColor?: string;
523
+ }
524
+
410
525
  /**
411
526
  * Session Recording Wrapper
412
527
  *
@@ -467,6 +582,159 @@ declare class SessionRecordingWrapper {
467
582
  private _onScriptLoaded;
468
583
  }
469
584
 
585
+ /**
586
+ * Message callback type
587
+ */
588
+ type MessageCallback = (message: ChatMessage) => void;
589
+ /**
590
+ * Typing callback type
591
+ */
592
+ type TypingCallback = (isTyping: boolean, senderType: string) => void;
593
+ /**
594
+ * Connection callback type
595
+ */
596
+ type ConnectionCallback = (connected: boolean) => void;
597
+ /**
598
+ * Unsubscribe function type
599
+ */
600
+ type Unsubscribe = () => void;
601
+
602
+ /**
603
+ * Chat Wrapper
604
+ *
605
+ * This is the lightweight class that lives in the main bundle.
606
+ * It handles:
607
+ * - Auto-fetching settings from dashboard (Intercom-like)
608
+ * - Merging server settings with code config
609
+ * - Deciding if chat should be enabled
610
+ * - Lazy loading the actual chat widget code
611
+ * - Delegating to LazyLoadedChat
612
+ * - Queuing messages/callbacks before widget loads
613
+ */
614
+ declare class ChatWrapper {
615
+ private readonly _instance;
616
+ private _lazyLoadedChat;
617
+ private _config;
618
+ private _serverConfig;
619
+ private _configFetched;
620
+ private _isLoading;
621
+ private _loadError;
622
+ private _pendingMessages;
623
+ private _pendingCallbacks;
624
+ private _messageCallbacks;
625
+ private _typingCallbacks;
626
+ private _connectionCallbacks;
627
+ constructor(_instance: VTilt, config?: ChatConfig);
628
+ /**
629
+ * Whether the chat widget is open
630
+ */
631
+ get isOpen(): boolean;
632
+ /**
633
+ * Whether connected to realtime service
634
+ */
635
+ get isConnected(): boolean;
636
+ /**
637
+ * Whether the widget is loading
638
+ */
639
+ get isLoading(): boolean;
640
+ /**
641
+ * Number of unread messages
642
+ */
643
+ get unreadCount(): number;
644
+ /**
645
+ * Current channel (if any)
646
+ */
647
+ get channel(): ChatChannel | null;
648
+ /**
649
+ * Open the chat widget
650
+ */
651
+ open(): void;
652
+ /**
653
+ * Close the chat widget
654
+ */
655
+ close(): void;
656
+ /**
657
+ * Toggle the chat widget open/closed
658
+ */
659
+ toggle(): void;
660
+ /**
661
+ * Show the chat widget (make visible but not necessarily open)
662
+ */
663
+ show(): void;
664
+ /**
665
+ * Hide the chat widget
666
+ */
667
+ hide(): void;
668
+ /**
669
+ * Send a message
670
+ */
671
+ sendMessage(content: string): void;
672
+ /**
673
+ * Mark messages as read
674
+ */
675
+ markAsRead(): void;
676
+ /**
677
+ * Subscribe to new messages
678
+ */
679
+ onMessage(callback: MessageCallback): Unsubscribe;
680
+ /**
681
+ * Subscribe to typing indicators
682
+ */
683
+ onTyping(callback: TypingCallback): Unsubscribe;
684
+ /**
685
+ * Subscribe to connection changes
686
+ */
687
+ onConnectionChange(callback: ConnectionCallback): Unsubscribe;
688
+ /**
689
+ * Start chat if enabled, called by VTilt after init
690
+ *
691
+ * This method supports two modes (Intercom-like):
692
+ * 1. Auto-config: Fetch settings from /api/chat/settings (default)
693
+ * 2. Code-only: Use only code config (autoConfig: false)
694
+ */
695
+ startIfEnabled(): Promise<void>;
696
+ /**
697
+ * Update configuration
698
+ */
699
+ updateConfig(config: Partial<ChatConfig>): void;
700
+ /**
701
+ * Get the merged configuration (server + code, code takes precedence)
702
+ */
703
+ getMergedConfig(): ChatConfig;
704
+ /**
705
+ * Destroy the chat widget
706
+ */
707
+ destroy(): void;
708
+ private get _isChatEnabled();
709
+ /**
710
+ * Fetch chat settings from the server
711
+ * This enables "snippet-only" installation where widget configures from dashboard
712
+ */
713
+ private _fetchServerSettings;
714
+ /**
715
+ * Show the chat bubble (launcher button) without fully loading the widget
716
+ * This creates a lightweight bubble that loads the full widget on click
717
+ */
718
+ private _showBubble;
719
+ private get _scriptName();
720
+ /**
721
+ * Schedule preload on idle
722
+ */
723
+ private _schedulePreload;
724
+ /**
725
+ * Lazy load and then execute callback
726
+ */
727
+ private _lazyLoadAndThen;
728
+ /**
729
+ * Lazy load the chat script
730
+ */
731
+ private _lazyLoad;
732
+ /**
733
+ * Called after the chat script is loaded
734
+ */
735
+ private _onScriptLoaded;
736
+ }
737
+
470
738
  /**
471
739
  * Request Queue - Event Batching (PostHog-style)
472
740
  *
@@ -498,6 +766,7 @@ declare class VTilt {
498
766
  private rateLimiter;
499
767
  historyAutocapture?: HistoryAutocapture;
500
768
  sessionRecording?: SessionRecordingWrapper;
769
+ chat?: ChatWrapper;
501
770
  __loaded: boolean;
502
771
  private _initial_pageview_captured;
503
772
  private _visibility_state_listener;
@@ -756,11 +1025,19 @@ declare class VTilt {
756
1025
  /**
757
1026
  * Check if session recording is active
758
1027
  */
759
- isSessionRecordingActive(): boolean;
1028
+ isRecordingActive(): boolean;
760
1029
  /**
761
1030
  * Get session recording ID
762
1031
  */
763
1032
  getSessionRecordingId(): string | null;
1033
+ /**
1034
+ * Initialize chat widget
1035
+ */
1036
+ private _initChat;
1037
+ /**
1038
+ * Build chat config from VTiltConfig
1039
+ */
1040
+ private _buildChatConfig;
764
1041
  /**
765
1042
  * _execute_array() deals with processing any vTilt function
766
1043
  * calls that were called before the vTilt library was loaded
@@ -783,4 +1060,4 @@ declare class VTilt {
783
1060
  declare const vt: VTilt;
784
1061
 
785
1062
  export { ALL_WEB_VITALS_METRICS, DEFAULT_WEB_VITALS_METRICS, VTilt, vt as default, vt };
786
- export type { AliasEvent, CaptureOptions, CapturePerformanceConfig, CaptureResult, EventPayload, FeatureFlagsConfig, GeolocationData, GroupsConfig, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, SessionRecordingMaskInputOptions, SessionRecordingOptions, SupportedWebVitalsMetric, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, WebVitalMetric };
1063
+ export type { AliasEvent, CaptureOptions, CapturePerformanceConfig, CaptureResult, ChatWidgetConfig, EventPayload, FeatureFlagsConfig, GeolocationData, GroupsConfig, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, SessionRecordingMaskInputOptions, SessionRecordingOptions, SupportedWebVitalsMetric, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, WebVitalMetric };
package/dist/module.js CHANGED
@@ -1,2 +1,2 @@
1
- var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,n=null==i?void 0:i.location,s=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0;null==i||i.AbortController;var a=null==e?void 0:e.userAgent,u=null!=t?t:{};function h(t,i,e,r,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void e(t)}a.done?i(u):Promise.resolve(u).then(r,n)}function l(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){h(s,r,n,o,a,"next",t)}function a(t){h(s,r,n,o,a,"throw",t)}o(void 0)})}}function d(){return d=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},d.apply(null,arguments)}u.__VTiltExtensions__=u.__VTiltExtensions__||{},u.__VTiltExtensions__.loadExternalDependency=(t,i,e)=>{var n=((t,i)=>{var e=t.getConfig();return e.script_host?e.script_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":"https://unpkg.com/@v-tilt/browser@1.3.0/dist/"+i+".js"})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn("[ExternalScriptsLoader] "+i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var n=null==r?void 0:r.querySelectorAll("script");if(n)for(var s,o=function(){if(n[a].src===i){var t=n[a];return t.__vtilt_loading_callback_fired?{v:e()}:(t.addEventListener("load",i=>{t.__vtilt_loading_callback_fired=!0,e(void 0,i)}),t.onerror=t=>e(t),{v:void 0})}},a=0;a<n.length;a++)if(s=o())return s.v;var u=()=>{var t;if(!r)return e("document not found");var n=r.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=i,n.onload=t=>{n.__vtilt_loading_callback_fired=!0,e(void 0,t)},n.onerror=t=>e(t);var s=r.querySelectorAll("body > script");s.length>0?null===(t=s[0].parentNode)||void 0===t||t.insertBefore(n,s[0]):r.body.appendChild(n)};(null==r?void 0:r.body)?u():null==r||r.addEventListener("DOMContentLoaded",u)})(t,n,e)};class v{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return d({token:t.token||""},t);var i=document.currentScript,e=d({token:""},t);e.api_host=i.getAttribute("data-api-host")||i.getAttribute("data-host")||t.api_host,e.script_host=i.getAttribute("data-script-host")||t.script_host,e.proxy=i.getAttribute("data-proxy")||t.proxy,e.proxyUrl=i.getAttribute("data-proxy-url")||t.proxyUrl,e.token=i.getAttribute("data-token")||t.token||"",e.projectId=i.getAttribute("data-project-id")||t.projectId||"",e.domain=i.getAttribute("data-domain")||t.domain,e.storage=i.getAttribute("data-storage")||t.storage,e.stringifyPayload="false"!==i.getAttribute("data-stringify-payload");var r="true"===i.getAttribute("data-capture-performance");if(e.capture_performance=!!r||t.capture_performance,e.proxy&&e.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 n of(e.globalAttributes=d({},t.globalAttributes),Array.from(i.attributes)))n.name.startsWith("data-vt-")&&(e.globalAttributes[n.name.slice(8).replace(/-/g,"_")]=n.value);return e}getConfig(){return d({},this.config)}updateConfig(t){this.config=d({},this.config,t)}}var c="__vt_session",f="__vt_window_id",p="__vt_primary_window",g="__vt_user_state",_="__vt_device_id",m="__vt_anonymous_id",w="__vt_distinct_id",y="__vt_user_properties",b="localStorage",S="localStorage+cookie",T="sessionStorage",x="memory",E="$initial_person_info";function I(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function M(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function k(t,i,e){if(t)if(Array.isArray(t))t.forEach((t,r)=>{i.call(e,t,r)});else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&i.call(e,t[r],r)}function C(t,i,e,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:n,passive:s})}function R(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function O(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];for(var n of e)for(var s of n)t.push(s);return t}var P=31536e3,D=["herokuapp.com","vercel.app","netlify.app"];function A(t){var i;if(!t)return"";if("undefined"==typeof document)return"";var e=null===(i=document.location)||void 0===i?void 0:i.hostname;if(!e)return"";var r=e.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class L{constructor(t){var i,e;this.memoryStorage=new Map,this.method=t.method,this.cross_subdomain=null!==(i=t.cross_subdomain)&&void 0!==i?i:function(){var t;if("undefined"==typeof document)return!1;var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return!1;var e=i.split(".").slice(-2).join(".");for(var r of D)if(e===r)return!1;return!0}(),this.sameSite=t.sameSite||"Lax",this.secure=null!==(e=t.secure)&&void 0!==e?e:"undefined"!=typeof location&&"https:"===location.protocol}get(t){var i;try{if(this.method===x)return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;if(this.usesLocalStorage()){var e=localStorage.getItem(t);return null!==e?e:this.method===S?this.getCookie(t):null}return this.usesSessionStorage()?sessionStorage.getItem(t):this.getCookie(t)}catch(i){return console.warn('[StorageManager] Failed to get "'+t+'":',i),null}}set(t,i,e){try{if(this.method===x)return void this.memoryStorage.set(t,i);if(this.usesLocalStorage())return localStorage.setItem(t,i),void(this.method===S&&this.setCookie(t,i,e||P));if(this.usesSessionStorage())return void sessionStorage.setItem(t,i);this.setCookie(t,i,e||P)}catch(i){console.warn('[StorageManager] Failed to set "'+t+'":',i)}}remove(t){try{if(this.method===x)return void this.memoryStorage.delete(t);if(this.usesLocalStorage())return localStorage.removeItem(t),void(this.method===S&&this.removeCookie(t));if(this.usesSessionStorage())return void sessionStorage.removeItem(t);this.removeCookie(t)}catch(i){console.warn('[StorageManager] Failed to remove "'+t+'":',i)}}getWithExpiry(t){var i=this.get(t);if(!i)return null;try{var e=JSON.parse(i);return e.expiry&&Date.now()>e.expiry?(this.remove(t),null):e.value}catch(t){return null}}setWithExpiry(t,i,e){var r=d({value:i},e?{expiry:Date.now()+e}:{});this.set(t,JSON.stringify(r))}getJSON(t){var i=this.get(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}}setJSON(t,i,e){this.set(t,JSON.stringify(i),e)}getCookie(t){if("undefined"==typeof document)return null;var i=document.cookie.split(";");for(var e of i){var[r,...n]=e.trim().split("=");if(r===t){var s=n.join("=");try{return decodeURIComponent(s)}catch(t){return s}}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=t+"="+encodeURIComponent(i);r+="; Max-Age="+e,r+="; path=/",r+="; SameSite="+this.sameSite,this.secure&&(r+="; Secure");var n=A(this.cross_subdomain);n&&(r+="; domain="+n),document.cookie=r}}removeCookie(t){if("undefined"!=typeof document){var i=A(this.cross_subdomain),e=t+"=; Max-Age=0; path=/";i&&(e+="; domain="+i),document.cookie=e,document.cookie=t+"=; Max-Age=0; path=/"}}usesLocalStorage(){return this.method===b||this.method===S}usesSessionStorage(){return this.method===T}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_storage_test__";return t.sessionStorage.setItem(i,"test"),t.sessionStorage.removeItem(i),!0}catch(t){return!1}}getSessionStorage(){var i;return this.canUseSessionStorage()&&null!==(i=null==t?void 0:t.sessionStorage)&&void 0!==i?i:null}setMethod(t){this.method=t}getMethod(){return this.method}}class U{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new L({method:t,cross_subdomain:i,sameSite:"Lax"}),this.o=void 0,this.m()}getSessionId(){var t=this.S();return t||(t=I(),this.T(t)),t}setSessionId(){var t=this.S()||I();return this.T(t),t}resetSessionId(){this.I(),this.setSessionId(),this.$(I())}S(){return this.storage.get(c)}T(t){this.storage.set(c,t,1800)}I(){this.storage.remove(c)}getWindowId(){if(this.o)return this.o;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(f);if(i)return this.o=i,i}var e=I();return this.$(e),e}$(t){if(t!==this.o){this.o=t;var i=this.storage.getSessionStorage();i&&i.setItem(f,t)}}m(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p),e=t.getItem(f);e&&!i?this.o=e:(e&&t.removeItem(f),this.$(I())),t.setItem(p,"true"),this.M()}else this.o=I()}M(){var i=this.storage.getSessionStorage();t&&i&&C(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(p)},{capture:!1})}updateStorageMethod(t,i){this.storage=new L({method:t,cross_subdomain:i,sameSite:"Lax"})}}function B(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function j(t,i){for(var e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===i){if(n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(t){}return s.replace(/\+/g," ")}}return""}function N(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],u=o[0],h=(a||"").split("&"),l=[],d=0;d<h.length;d++){var v=h[d].split("="),c=v[0],f=v.slice(1).join("=");-1!==i.indexOf(c)?l.push(c+"="+e):c&&l.push(c+(f?"="+f:""))}var p=l.join("&");return u+(p?"?"+p:"")+(s?"#"+s:"")}function q(t){return"function"==typeof t}var z="Mobile",F="iOS",W="Android",V="Tablet",J=W+" "+V,X="iPad",H="Apple",K=H+" Watch",G="Safari",Q="BlackBerry",Z="Samsung",Y=Z+"Browser",tt=Z+" Internet",it="Chrome",et=it+" OS",rt=it+" "+F,nt="Internet Explorer",st=nt+" "+z,ot="Opera",at=ot+" Mini",ut="Edge",ht="Microsoft "+ut,lt="Firefox",dt=lt+" "+F,vt="Nintendo",ct="PlayStation",ft="Xbox",pt=W+" "+z,gt=z+" "+G,_t="Windows",mt=_t+" Phone",wt="Nokia",yt="Ouya",bt="Generic",St=bt+" "+z.toLowerCase(),Tt=bt+" "+V.toLowerCase(),xt="Konqueror",Et="(\\d+(\\.\\d+)?)",It=new RegExp("Version/"+Et),$t=new RegExp(ft,"i"),Mt=new RegExp(ct+" \\w+","i"),kt=new RegExp(vt+" \\w+","i"),Ct=new RegExp(Q+"|PlayBook|BB10","i"),Rt={"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 Ot(t,i){return t.toLowerCase().includes(i.toLowerCase())}var Pt=(t,i)=>i&&Ot(i,H)||function(t){return Ot(t,G)&&!Ot(t,it)&&!Ot(t,W)}(t),Dt=function(t,i){return i=i||"",Ot(t," OPR/")&&Ot(t,"Mini")?at:Ot(t," OPR/")?ot:Ct.test(t)?Q:Ot(t,"IE"+z)||Ot(t,"WPDesktop")?st:Ot(t,Y)?tt:Ot(t,ut)||Ot(t,"Edg/")?ht:Ot(t,"FBIOS")?"Facebook "+z:Ot(t,"UCWEB")||Ot(t,"UCBrowser")?"UC Browser":Ot(t,"CriOS")?rt:Ot(t,"CrMo")||Ot(t,it)?it:Ot(t,W)&&Ot(t,G)?pt:Ot(t,"FxiOS")?dt:Ot(t.toLowerCase(),xt.toLowerCase())?xt:Pt(t,i)?Ot(t,z)?gt:G:Ot(t,lt)?lt:Ot(t,"MSIE")||Ot(t,"Trident/")?nt:Ot(t,"Gecko")?lt:""},At={[st]:[new RegExp("rv:"+Et)],[ht]:[new RegExp(ut+"?\\/"+Et)],[it]:[new RegExp("("+it+"|CrMo)\\/"+Et)],[rt]:[new RegExp("CriOS\\/"+Et)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Et)],[G]:[It],[gt]:[It],[ot]:[new RegExp("(Opera|OPR)\\/"+Et)],[lt]:[new RegExp(lt+"\\/"+Et)],[dt]:[new RegExp("FxiOS\\/"+Et)],[xt]:[new RegExp("Konqueror[:/]?"+Et,"i")],[Q]:[new RegExp(Q+" "+Et),It],[pt]:[new RegExp("android\\s"+Et,"i")],[tt]:[new RegExp(Y+"\\/"+Et)],[nt]:[new RegExp("(rv:|MSIE )"+Et)],Mozilla:[new RegExp("rv:"+Et)]},Lt=function(t,i){var e=Dt(t,i),r=At[e];if(void 0===r)return null;for(var n=0;n<r.length;n++){var s=r[n],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Ut=[[new RegExp(ft+"; "+ft+" (.*?)[);]","i"),t=>[ft,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[Ct,[Q,""]],[new RegExp(_t,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[mt,""];if(new RegExp(z).test(i)&&!/IEMobile\b/.test(i))return[_t+" "+z,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=Rt[r]||"";return/arm/i.test(i)&&(n="RT"),[_t,n]}return[_t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[F,i.join(".")]}return[F,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=void 0===t[2]?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+W+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+W+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[W,i.join(".")]}return[W,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[et,""]],[/Linux|debian/i,["Linux",""]]],Bt=function(t){return kt.test(t)?vt:Mt.test(t)?ct:$t.test(t)?ft:new RegExp(yt,"i").test(t)?yt:new RegExp("("+mt+"|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?X:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?K:Ct.test(t)?Q:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wt,"i").test(t)?wt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(z).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?W:J:W:new RegExp("(pda|"+z+")","i").test(t)?St:new RegExp(V,"i").test(t)&&!new RegExp(V+" pc","i").test(t)?Tt:""},jt="https?://(.*)",Nt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],qt=O(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Nt),zt="<masked>";function Ft(t){var i=function(t){return t?0===t.search(jt+"google.([^/?]*)")?"google":0===t.search(jt+"bing.com")?"bing":0===t.search(jt+"yahoo.com")?"yahoo":0===t.search(jt+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?j(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function Wt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Vt(){return(null==r?void 0:r.referrer)||"$direct"}function Jt(){var t;return(null==r?void 0:r.referrer)&&(null===(t=B(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function Xt(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=B(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=B(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=qt.concat([]),e={};return k(i,function(i){var r=j(t,i);e[i]=r||null}),e}(r);R(n,o)}e&&R(n,Ft(e));return n}function Ht(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Kt(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function Gt(i,e){if(!a)return{};var r,s,o,[u,h]=function(t){for(var i=0;i<Ut.length;i++){var[e,r]=Ut[i],n=e.exec(t),s=n&&(q(r)?r(n,t):r);if(s)return s}return["",""]}(a);return R(function(t){var i={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];null!=r&&""!==r&&(i[e]=r)}return i}({$os:u,$os_version:h,$browser:Dt(a,navigator.vendor),$device:Bt(a),$device_type:(s=a,o=Bt(s),o===X||o===J||"Kobo"===o||"Kindle Fire"===o||o===Tt?V:o===vt||o===ft||o===ct||o===yt?"Console":o===K?"Wearable":o?z:"Desktop"),$timezone:Ht(),$timezone_offset:Kt()}),{$current_url:N(null==n?void 0:n.href,[],zt),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:Lt(a,navigator.vendor),$browser_language:Wt(),$browser_language_prefix:(r=Wt(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.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 Qt{constructor(t,i){void 0===t&&(t="localStorage"),this.k=null,this.storage=new L({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return d({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(m,this.userIdentity.anonymous_id,P)),this.userIdentity.anonymous_id}getUserProperties(){return d({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(t,i,e){if("number"==typeof t&&(t=t.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.")),t)if(this.isDistinctIdStringLike(t))console.error('The string "'+t+'" 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"!==t){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=t,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=d({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}t!==r&&(this.userIdentity.distinct_id=t);var s="anonymous"===this.userIdentity.user_state;t!==r&&s?(this.userIdentity.user_state="identified",i&&(this.userIdentity.properties=d({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):i||e?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),i&&(this.userIdentity.properties=d({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):t!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+t+'" 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(t,i){if(!t&&!i)return!1;var e=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(e,t,i);return this.k===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(t&&(this.userIdentity.properties=d({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity(),this.k=r,!0)}reset(t){var i=this.generateAnonymousId(),e=this.userIdentity.device_id,r=t?this.generateDeviceId():e;this.userIdentity={distinct_id:null,anonymous_id:i,device_id:r,properties:{},user_state:"anonymous"},this.k=null,this.saveUserIdentity(),this.userIdentity.properties=d({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(t){this.userIdentity.distinct_id=t,this.saveUserIdentity()}setUserState(t){this.userIdentity.user_state=t,this.saveUserIdentity()}updateUserProperties(t,i){t&&(this.userIdentity.properties=d({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity()}ensureDeviceId(t){this.userIdentity.device_id||(this.userIdentity.device_id=t,this.userIdentity.properties=d({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:t}),this.saveUserIdentity())}createAlias(t,i){return this.isValidDistinctId(t)?(void 0===i&&(i=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(i)?t===i?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:t,original:i}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(t){return this.isDistinctIdStringLike(t)}set_initial_person_info(t,i){if(!this.getStoredUserProperties()[E]){var e=function(t,i){var e=t?O([],Nt,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:Vt().substring(0,1e3),u:r?N(r,e,zt):void 0}}(t,i);this.register_once({[E]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[E];return e?(t=Xt(e),i={},k(t,function(t,e){var r;i["$initial_"+(r=String(e),r.startsWith("$")?r.substring(1):r)]=t}),i):{}}update_referrer_info(){var t={$referrer:Vt(),$referring_domain:Jt()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(m)||this.generateAnonymousId(),i=this.storage.get(w)||null,e=this.storage.get(_)||this.generateDeviceId(),r=this.getStoredUserProperties(),n=this.storage.get(g)||"anonymous";return{distinct_id:i,anonymous_id:t||this.generateAnonymousId(),device_id:e,properties:r,user_state:n}}saveUserIdentity(){this.storage.set(m,this.userIdentity.anonymous_id,P),this.storage.set(_,this.userIdentity.device_id,P),this.storage.set(g,this.userIdentity.user_state,P),this.userIdentity.distinct_id?this.storage.set(w,this.userIdentity.distinct_id,P):this.storage.remove(w),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(y)||{}}setStoredUserProperties(t){this.storage.setJSON(y,t,P)}register_once(t,i){var e=this.getStoredUserProperties(),r=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(n in e||(e[n]=t[n],r=!0));if(i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(s in e||(e[s]=i[s],r=!0));r&&this.setStoredUserProperties(e)}generateAnonymousId(){return"anon_"+I()}generateDeviceId(){return"device_"+I()}getPersonPropertiesHash(t,i,e){return JSON.stringify({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}isValidDistinctId(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(i)&&0!==t.trim().length}isDistinctIdStringLike(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(i)}updateStorageMethod(t,i){this.storage=new L({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var Zt=["LCP","CLS","FCP","INP","TTFB"],Yt=["LCP","CLS","FCP","INP"],ti=9e5,ii="[WebVitals]";class ei{constructor(i,e){this.initialized=!1,this.instance=e,this.buffer=this.createEmptyBuffer(),this.config=this.parseConfig(i.capture_performance),this.isEnabled&&t&&this.startIfEnabled()}parseConfig(t){return"boolean"==typeof t?{web_vitals:t}:"object"==typeof t&&null!==t?t:{web_vitals:!1}}get isEnabled(){var t=null==n?void 0:n.protocol;return("http:"===t||"https:"===t)&&!1!==this.config.web_vitals}get allowedMetrics(){return this.config.web_vitals_allowed_metrics||Yt}get flushTimeoutMs(){return this.config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var t=this.config.__web_vitals_max_value;return void 0===t?ti:0===t?0:t<6e4?ti:t}createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}getWebVitalsCallbacks(){var t;return null===(t=u.__VTiltExtensions__)||void 0===t?void 0:t.webVitalsCallbacks}startIfEnabled(){if(this.isEnabled&&!this.initialized){var t=this.getWebVitalsCallbacks();t?this.startCapturing(t):this.loadWebVitals()}}loadWebVitals(){var t,i=null===(t=u.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;i?i(this.instance,"web-vitals",t=>{if(t)console.error(ii+" Failed to load web-vitals:",t);else{var i=this.getWebVitalsCallbacks();i?this.startCapturing(i):console.error(ii+" web-vitals loaded but callbacks not registered")}}):console.warn(ii+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}startCapturing(t){if(!this.initialized){var i=this.allowedMetrics,e=this.addToBuffer.bind(this);i.includes("LCP")&&t.onLCP&&t.onLCP(e),i.includes("CLS")&&t.onCLS&&t.onCLS(e,{reportAllChanges:!0}),i.includes("FCP")&&t.onFCP&&t.onFCP(e),i.includes("INP")&&t.onINP&&t.onINP(e),i.includes("TTFB")&&t.onTTFB&&t.onTTFB(e),this.initialized=!0}}getCurrentUrl(){var i;return null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.href}getCurrentPathname(){return null==n?void 0:n.pathname}addToBuffer(i){try{if(!t||!r||!n)return;if(!(null==i?void 0:i.name)||void 0===(null==i?void 0:i.value))return void console.warn(ii+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(ii+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.getCurrentUrl(),s=this.getCurrentPathname();if(!e)return void console.warn(ii+" Could not determine current URL");this.buffer.url&&this.buffer.url!==e&&this.flush(),this.buffer.url||(this.buffer.url=e,this.buffer.pathname=s),this.buffer.firstMetricTimestamp||(this.buffer.firstMetricTimestamp=Date.now());var o=this.cleanAttribution(i.attribution),a=this.instance.getSessionId(),u=this.getWindowId(),h=d({},i,{attribution:o,timestamp:Date.now(),$current_url:e,$session_id:a,$window_id:u}),l=this.buffer.metrics.findIndex(t=>t.name===i.name);l>=0?this.buffer.metrics[l]=h:this.buffer.metrics.push(h),this.scheduleFlush(),this.buffer.metrics.length>=this.allowedMetrics.length&&this.flush()}catch(t){console.error(ii+" Error adding metric to buffer:",t)}}cleanAttribution(t){if(t){var i=d({},t);return"interactionTargetElement"in i&&delete i.interactionTargetElement,i}}getWindowId(){var t;try{return(null===(t=this.instance.sessionManager)||void 0===t?void 0:t.getWindowId())||null}catch(t){return null}}scheduleFlush(){this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>{this.flush()},this.flushTimeoutMs)}flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0),0!==this.buffer.metrics.length){try{var t={$pathname:this.buffer.pathname,$current_url:this.buffer.url};for(var i of this.buffer.metrics)t["$web_vitals_"+i.name+"_value"]=i.value,t["$web_vitals_"+i.name+"_event"]={name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,attribution:i.attribution,$session_id:i.$session_id,$window_id:i.$window_id};this.instance.capture("$web_vitals",t)}catch(t){console.error(ii+" Error flushing metrics:",t)}this.buffer=this.createEmptyBuffer()}}}function ri(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return q(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class ni{constructor(i){var e;this._instance=i,this.C=(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.R&&this.R(),this.R=void 0}monitorHistoryChanges(){var i,e;if(t&&n&&(this.C=n.pathname||"",t.history)){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||ri(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.O("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||ri(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.O("replaceState")}),this.P()}}O(i){var e;try{var s=null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname;if(!s||!n||!r)return;if(s!==this.C&&this.isEnabled){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.C=s}catch(t){console.error("Error capturing "+i+" pageview",t)}}P(){if(!this.R&&t){var i=()=>{this.O("popstate")};C(t,"popstate",i),this.R=()=>{t&&t.removeEventListener("popstate",i)}}}}var si="[SessionRecording]";class oi{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.D=i}get started(){var t;return!!(null===(t=this.A)||void 0===t?void 0:t.isStarted)}get status(){var t;return(null===(t=this.A)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.A)||void 0===t?void 0:t.sessionId)||""}startIfEnabledOrStop(t){var i;if(!this.L||!(null===(i=this.A)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.L&&e?(this.U(t),console.info(si+" starting")):this.stopRecording()}}stopRecording(){var t;null===(t=this.A)||void 0===t||t.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.A)||void 0===e?void 0:e.log)?this.A.log(t,i):console.warn(si+" log called before recorder was ready")}updateConfig(t){var i;this.D=d({},this.D,t),null===(i=this.A)||void 0===i||i.updateConfig(this.D)}get L(){var i,e=this._instance.getConfig(),r=null!==(i=this.D.enabled)&&void 0!==i&&i,n=!e.disable_session_recording;return!!t&&r&&n}get B(){return"recorder"}U(t){var i,e,r,n;if(this.L)if((null===(e=null===(i=null==u?void 0:u.__VTiltExtensions__)||void 0===i?void 0:i.rrweb)||void 0===e?void 0:e.record)&&(null===(r=u.__VTiltExtensions__)||void 0===r?void 0:r.initSessionRecording))this.j(t);else{var s=null===(n=u.__VTiltExtensions__)||void 0===n?void 0:n.loadExternalDependency;s?s(this._instance,this.B,i=>{i?console.error(si+" could not load recorder:",i):this.j(t)}):console.error(si+" loadExternalDependency not available. Session recording cannot start.")}}j(t){var i,e=null===(i=u.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.A||(this.A=e(this._instance,this.D)),this.A.start(t)):console.error(si+" initSessionRecording not available after script load")}}var ai=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ai||{}),ui=Uint8Array,hi=Uint16Array,li=Int32Array,di=new ui([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]),vi=new ui([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]),ci=new ui([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fi=function(t,i){for(var e=new hi(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new li(e[30]);for(r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)n[s]=s-e[r]<<5|r;return{b:e,r:n}},pi=fi(di,2),gi=pi.b,_i=pi.r;gi[28]=258,_i[258]=28;for(var mi=fi(vi,0).r,wi=new hi(32768),yi=0;yi<32768;++yi){var bi=(43690&yi)>>1|(21845&yi)<<1;bi=(61680&(bi=(52428&bi)>>2|(13107&bi)<<2))>>4|(3855&bi)<<4,wi[yi]=((65280&bi)>>8|(255&bi)<<8)>>1}var Si=function(t,i,e){for(var r=t.length,n=0,s=new hi(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new hi(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new hi(1<<i);var u=15-i;for(n=0;n<r;++n)if(t[n])for(var h=n<<4|t[n],l=i-t[n],d=a[t[n]-1]++<<l,v=d|(1<<l)-1;d<=v;++d)o[wi[d]>>u]=h}else for(o=new hi(r),n=0;n<r;++n)t[n]&&(o[n]=wi[a[t[n]-1]++]>>15-t[n]);return o},Ti=new ui(288);for(yi=0;yi<144;++yi)Ti[yi]=8;for(yi=144;yi<256;++yi)Ti[yi]=9;for(yi=256;yi<280;++yi)Ti[yi]=7;for(yi=280;yi<288;++yi)Ti[yi]=8;var xi=new ui(32);for(yi=0;yi<32;++yi)xi[yi]=5;var Ei=Si(Ti,9,0),Ii=Si(xi,5,0),$i=function(t){return(t+7)/8|0},Mi=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new ui(t.subarray(i,e))},ki=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},Ci=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8,t[r+2]|=e>>16},Ri=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var n=e.length,s=e.slice();if(!n)return{t:Bi,l:0};if(1==n){var o=new ui(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],u=e[1],h=0,l=1,d=2;for(e[0]={s:-1,f:a.f+u.f,l:a,r:u};l!=n-1;)a=e[e[h].f<e[d].f?h++:d++],u=e[h!=l&&e[h].f<e[d].f?h++:d++],e[l++]={s:-1,f:a.f+u.f,l:a,r:u};var v=s[0].s;for(r=1;r<n;++r)s[r].s>v&&(v=s[r].s);var c=new hi(v+1),f=Oi(e[l-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(s.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});r<n;++r){var m=s[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>=g;p>0;){var w=s[r].s;c[w]<i?p-=1<<i-c[w]++-1:++r}for(;r>=0&&p;--r){var y=s[r].s;c[y]==i&&(--c[y],++p)}f=i}return{t:new ui(c),l:f}},Oi=function(t,i,e){return-1==t.s?Math.max(Oi(t.l,i,e+1),Oi(t.r,i,e+1)):i[t.s]=e},Pi=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new hi(++i),r=0,n=t[0],s=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==n&&a!=i)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return{c:e.subarray(0,r),n:i}},Di=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Ai=function(t,i,e){var r=e.length,n=$i(i+2);t[n]=255&r,t[n+1]=r>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;s<r;++s)t[n+s+4]=e[s];return 8*(n+4+r)},Li=function(t,i,e,r,n,s,o,a,u,h,l){ki(i,l++,e),++n[256];for(var d=Ri(n,15),v=d.t,c=d.l,f=Ri(s,15),p=f.t,g=f.l,_=Pi(v),m=_.c,w=_.n,y=Pi(p),b=y.c,S=y.n,T=new hi(19),x=0;x<m.length;++x)++T[31&m[x]];for(x=0;x<b.length;++x)++T[31&b[x]];for(var E=Ri(T,7),I=E.t,M=E.l,k=19;k>4&&!I[ci[k-1]];--k);var C,R,O,P,D=h+5<<3,A=Di(n,Ti)+Di(s,xi)+o,L=Di(n,v)+Di(s,p)+o+14+3*k+Di(T,I)+2*T[16]+3*T[17]+7*T[18];if(u>=0&&D<=A&&D<=L)return Ai(i,l,t.subarray(u,u+h));if(ki(i,l,1+(L<A)),l+=2,L<A){C=Si(v,c,0),R=v,O=Si(p,g,0),P=p;var U=Si(I,M,0);ki(i,l,w-257),ki(i,l+5,S-1),ki(i,l+10,k-4),l+=14;for(x=0;x<k;++x)ki(i,l+3*x,I[ci[x]]);l+=3*k;for(var B=[m,b],j=0;j<2;++j){var N=B[j];for(x=0;x<N.length;++x){var q=31&N[x];ki(i,l,U[q]),l+=I[q],q>15&&(ki(i,l,N[x]>>5&127),l+=N[x]>>12)}}}else C=Ei,R=Ti,O=Ii,P=xi;for(x=0;x<a;++x){var z=r[x];if(z>255){Ci(i,l,C[(q=z>>18&31)+257]),l+=R[q+257],q>7&&(ki(i,l,z>>23&31),l+=di[q]);var F=31&z;Ci(i,l,O[F]),l+=P[F],F>3&&(Ci(i,l,z>>5&8191),l+=vi[F])}else Ci(i,l,C[z]),l+=R[z]}return Ci(i,l,C[256]),l+R[256]},Ui=new li([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bi=new ui(0),ji=function(){for(var t=new Int32Array(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&-306674912)^e>>>1;t[i]=e}return t}(),Ni=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new ui(s.length+t.length);o.set(s),o.set(t,s.length),t=o,n.w=s.length}return function(t,i,e,r,n,s){var o=s.z||t.length,a=new ui(r+o+5*(1+Math.ceil(o/7e3))+n),u=a.subarray(r,a.length-n),h=s.l,l=7&(s.r||0);if(i){l&&(u[0]=s.r>>3);for(var d=Ui[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,p=s.p||new hi(32768),g=s.h||new hi(f+1),_=Math.ceil(e/3),m=2*_,w=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new li(25e3),b=new hi(288),S=new hi(32),T=0,x=0,E=s.i||0,I=0,M=s.w||0,k=0;E+2<o;++E){var C=w(E),R=32767&E,O=g[C];if(p[R]=O,g[C]=R,M<=E){var P=o-E;if((T>7e3||I>24576)&&(P>423||!h)){l=Li(t,u,0,y,b,S,x,I,k,E-k,l),I=T=x=0,k=E;for(var D=0;D<286;++D)b[D]=0;for(D=0;D<30;++D)S[D]=0}var A=2,L=0,U=c,B=R-O&32767;if(P>2&&C==w(E-B))for(var j=Math.min(v,P)-1,N=Math.min(32767,E),q=Math.min(258,P);B<=N&&--U&&R!=O;){if(t[E+A]==t[E+A-B]){for(var z=0;z<q&&t[E+z]==t[E+z-B];++z);if(z>A){if(A=z,L=B,z>j)break;var F=Math.min(B,z-2),W=0;for(D=0;D<F;++D){var V=E-B+D&32767,J=V-p[V]&32767;J>W&&(W=J,O=V)}}}B+=(R=O)-(O=p[R])&32767}if(L){y[I++]=268435456|_i[A]<<18|mi[L];var X=31&_i[A],H=31&mi[L];x+=di[X]+vi[H],++b[257+X],++S[H],M=E+A,++T}else y[I++]=t[E],++b[t[E]]}}for(E=Math.max(E,M);E<o;++E)y[I++]=t[E],++b[t[E]];l=Li(t,u,h,y,b,S,x,I,k,E-k,l),h||(s.r=7&l|u[l/8|0]<<3,l-=7,s.h=g,s.p=p,s.i=E,s.w=M)}else{for(E=s.w||0;E<o+h;E+=65535){var K=E+65535;K>=o&&(u[l/8|0]=h,K=o),l=Ai(u,l+1,t.subarray(E,K))}s.i=o}return Mi(a,0,r+$i(l)+n)}(t,null==i.level?6:i.level,null==i.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+i.mem,e,r,n)},qi=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function zi(t,i){i||(i={});var e=function(){var t=-1;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=ji[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=Ni(t,i,10+((n=i).filename?n.filename.length+1:0),8),o=s.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&qi(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(s,i),qi(s,o-8,e.d()),qi(s,o-4,r),s}var Fi="undefined"!=typeof TextEncoder&&new TextEncoder,Wi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Wi.decode(Bi,{stream:!0})}catch(t){}ai.MouseMove,ai.MouseInteraction,ai.Scroll,ai.ViewportResize,ai.Input,ai.TouchMove,ai.MediaInteraction,ai.Drag;var Vi,Ji="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Vi||(Vi={}));var Xi=t=>{var{data:i,compression:e}=t;if(i){var r=(t=>JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i))(i),n=new Blob([r]).size;if(e===Vi.GZipJS&&n>=1024)try{var s=zi(function(t,i){if(Fi)return Fi.encode(t);for(var e=t.length,r=new ui(t.length+(t.length>>1)),n=0,s=function(t){r[n++]=t},o=0;o<e;++o){if(n+5>r.length){var a=new ui(n+8+(e-o<<1));a.set(r),r=a}var u=t.charCodeAt(o);u<128||i?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++o))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return Mi(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Ji});if(o.size<.95*n)return{contentType:Ji,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},Hi=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Xi(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Vi.GZipJS&&e===Ji?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=d({"Content-Type":e},t.headers||{}),a=new AbortController,u=t.timeout?setTimeout(()=>a.abort(),t.timeout):null;fetch(s,{method:t.method||"POST",headers:o,body:r,keepalive:n<52428.8,signal:a.signal}).then(function(){var i=l(function*(i){var e,r=yield i.text(),n={statusCode:i.status,text:r};if(200===i.status)try{n.json=JSON.parse(r)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)});return function(t){return i.apply(this,arguments)}}()).catch(()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:t=>{var i=Xi(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Vi.GZipJS&&e===Ji?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,s=new XMLHttpRequest;s.open(t.method||"POST",n,!0),t.headers&&Object.entries(t.headers).forEach(t=>{var[i,e]=t;s.setRequestHeader(i,e)}),s.setRequestHeader("Content-Type",e),t.timeout&&(s.timeout=t.timeout),s.onreadystatechange=()=>{var i;if(4===s.readyState){var e={statusCode:s.status,text:s.responseText};if(200===s.status)try{e.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,e)}},s.onerror=()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:t=>{var i=Xi(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Vi.GZipJS&&e===Ji?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],Ki=t=>{var i,e=t.transport||"fetch",r=Hi.find(t=>t.name===e&&t.available)||Hi.find(t=>t.available);if(!r)return console.error("vTilt: No available transport method"),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0}));r.method(t)};class Gi{constructor(t,i){var e,r,n,s;this.N=!0,this.q=[],this.F=(e=(null==i?void 0:i.flush_interval_ms)||3e3,r=250,n=5e3,s=3e3,"number"!=typeof e||isNaN(e)?s:Math.min(Math.max(e,r),n)),this.W=t}get length(){return this.q.length}enqueue(t){this.q.push(t),this.V||this.J()}unload(){if(this.X(),0!==this.q.length){var t=this.H();for(var i in t){var e=t[i];this.W(d({},e,{transport:"sendBeacon"}))}}}enable(){this.N=!1,this.J()}pause(){this.N=!0,this.X()}flush(){this.X(),this.K(),this.J()}J(){this.N||(this.V=setTimeout(()=>{this.X(),this.K(),this.q.length>0&&this.J()},this.F))}X(){this.V&&(clearTimeout(this.V),this.V=void 0)}K(){if(0!==this.q.length){var t=this.H(),i=Date.now();for(var e in t){var r=t[e];r.events.forEach(t=>{var e=new Date(t.timestamp).getTime();t.$offset=Math.abs(e-i)}),this.W(r)}}}H(){var t={};return this.q.forEach(i=>{var e=i.batchKey||i.url;t[e]||(t[e]={url:i.url,events:[],batchKey:i.batchKey}),t[e].events.push(i.event)}),this.q=[],t}}class Qi{constructor(i){this.G=!1,this.Z=3e3,this.q=[],this.Y=!0,this.W=i.sendRequest,this.tt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this.Y=e.onLine,C(t,"online",()=>{this.Y=!0,this.it()}),C(t,"offline",()=>{this.Y=!1}))}get length(){return this.q.length}enqueue(t,i){if(void 0===i&&(i=0),i>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),n=(Math.random()-.5)*(r-e);return Math.ceil(r+n)}(i),r=Date.now()+e;this.q.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this.Y||(n+=" (Browser is offline)"),console.warn(n),this.G||(this.G=!0,this.et())}}retriableRequest(t){var i=this;return l(function*(){try{var e=yield i.W(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}et(){this.rt&&clearTimeout(this.rt),this.rt=setTimeout(()=>{this.Y&&this.q.length>0&&this.it(),this.q.length>0?this.et():this.G=!1},this.Z)}it(){var t=this,i=Date.now(),e=[],r=[];this.q.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.q=e,r.forEach(function(){var i=l(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.W(e);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&t.enqueue(e,r)}catch(i){t.enqueue(e,r)}});return function(t){return i.apply(this,arguments)}}())}unload(){this.rt&&(clearTimeout(this.rt),this.rt=void 0),this.q.forEach(t=>{var{request:i}=t;try{this.tt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.q=[]}}var Zi="vt_rate_limit";class Yi{constructor(t){var i,e;void 0===t&&(t={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(i=t.eventsPerSecond)&&void 0!==i?i:10,this.eventsBurstLimit=Math.max(null!==(e=t.eventsBurstLimit)&&void 0!==e?e:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=t.persistence,this.captureWarning=t.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(t){var i,e,r,n;void 0===t&&(t=!1);var s=Date.now(),o=null!==(e=null===(i=this.persistence)||void 0===i?void 0:i.get(Zi))&&void 0!==e?e:{tokens:this.eventsBurstLimit,last:s},a=(s-o.last)/1e3;o.tokens+=a*this.eventsPerSecond,o.last=s,o.tokens>this.eventsBurstLimit&&(o.tokens=this.eventsBurstLimit);var u=o.tokens<1;return u||t||(o.tokens=Math.max(0,o.tokens-1)),!u||this.lastEventRateLimited||t||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=u,null===(n=this.persistence)||void 0===n||n.set(Zi,o),{isRateLimited:u,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class te{constructor(t){void 0===t&&(t={}),this.version="1.1.5",this.__loaded=!1,this.nt=!1,this.st=null,this.__request_queue=[],this.ot=!1,this.ut=!1,this.configManager=new v(t);var i=this.configManager.getConfig();this.sessionManager=new U(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new Qt(i.persistence||"localStorage",i.cross_subdomain_cookie),this.webVitalsManager=new ei(i,this),this.rateLimiter=new Yi({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.ht("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new Qi({sendRequest:t=>this.lt(t),sendBeacon:t=>this.dt(t)}),this.requestQueue=new Gi(t=>this.vt(t),{flush_interval_ms:3e3})}init(t,i,e){var r;if(e&&e!==ee){var n=null!==(r=ie[e])&&void 0!==r?r:new te;return n._init(t,i,e),ie[e]=n,ie[ee][e]=n,n}return this._init(t,i,e)}_init(t,i,e){if(void 0===i&&(i={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(d({},i,{projectId:t||i.projectId,name:e})),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 ni(this),this.historyAutocapture.startIfEnabled(),this.ct(),this.ft(),this.gt(),!1!==r.capture_pageview&&this._t(),this}gt(){this.requestQueue.enable()}ft(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};C(t,"beforeunload",i),C(t,"pagehide",i)}}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:ee;return i!==ee&&(i=ee+"."+i),i}getCurrentDomain(){if(!n)return"";var t=n.protocol,i=n.hostname,e=n.port;return t+"//"+i+(e?":"+e:"")}wt(){var t=this.configManager.getConfig();return!(!t.projectId||!t.token)||(this.ot||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.ot=!0),!1)}buildUrl(){var t=this.configManager.getConfig(),{proxyUrl:i,proxy:e,api_host:r,token:n}=t;return i||(e?e+"/api/tracking?token="+n:r?r.replace(/\/+$/gm,"")+"/api/tracking?token="+n:"/api/tracking?token="+n)}sendRequest(i,e,r){if(this.wt()){if(r&&void 0!==t)if(t.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});this.requestQueue.enqueue({url:i,event:e})}}vt(t){var{transport:i}=t;"sendBeacon"!==i?this.retryQueue.retriableRequest(t):this.dt(t)}lt(t){return new Promise(i=>{var{url:e,events:r}=t,n=1===r.length?r[0]:{events:r},s=this.configManager.getConfig().disable_compression?Vi.None:Vi.GZipJS;Ki({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>{i({statusCode:t.statusCode})}})})}dt(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Vi.None:Vi.GZipJS;Ki({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}yt(t){this.sendRequest(t.url,t.event,!1)}capture(t,i,n){if(this.sessionManager.setSessionId(),e&&e.userAgent&&function(t){return!(t&&"string"==typeof t&&t.length>500)}(e.userAgent)&&((null==n?void 0:n.skip_client_rate_limiting)||this.rateLimiter.shouldAllowEvent())){var s=this.buildUrl(),o=Gt(),a=this.userManager.getUserProperties(),u=this.userManager.get_initial_props(),h=this.sessionManager.getSessionId(),l=this.sessionManager.getWindowId(),v=this.userManager.getAnonymousId(),c={};!this.ut&&Object.keys(u).length>0&&Object.assign(c,u),i.$set_once&&Object.assign(c,i.$set_once);var f=d({},o,a,{$session_id:h,$window_id:l},v?{$anon_distinct_id:v}:{},Object.keys(c).length>0?{$set_once:c}:{},i.$set?{$set:i.$set}:{},i);!this.ut&&Object.keys(u).length>0&&(this.ut=!0),"$pageview"===t&&r&&(f.title=r.title);var p,g,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(p=Object.assign({},f,_.globalAttributes),!M(p=JSON.stringify(p)))return}else if(p=Object.assign({},f,_.globalAttributes),!M(JSON.stringify(p)))return;g="$identify"===t?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var m={timestamp:(new Date).toISOString(),event:t,project_id:_.projectId||"",payload:p,distinct_id:g,anonymous_id:v};this.sendRequest(s,m,!0)}}ht(t,i){this.capture(t,i,{skip_client_rate_limiting:!0})}trackEvent(t,i){void 0===i&&(i={}),this.capture(t,i)}identify(t,i,e){if("number"==typeof t&&(t=String(t),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),t)if(this.userManager.isDistinctIdStringLikePublic(t))console.error('The string "'+t+'" 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"!==t){var r=this.userManager.getDistinctId(),n=this.userManager.getAnonymousId(),s=this.userManager.getDeviceId(),o="anonymous"===this.userManager.getUserState();if(!s){var a=r||n;this.userManager.ensureDeviceId(a)}t!==r&&o?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(i,e),this.capture("$identify",{distinct_id:t,$anon_distinct_id:n,$set:i||{},$set_once:e||{}}),this.userManager.setDistinctId(t)):i||e?(o&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(i,e),this.capture("$set",{$set:i||{},$set_once:e||{}})):t!==r&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(t))}else console.error('The string "'+t+'" 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(t,i){this.userManager.setUserProperties(t,i)&&this.capture("$set",{$set:t||{},$set_once:i||{}})}resetUser(t){this.sessionManager.resetSessionId(),this.userManager.reset(t)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(t,i){var e=this.userManager.createAlias(t,i);e?this.capture("$alias",{$original_id:e.original,$alias_id:e.distinct_id}):t===(i||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(t)}_t(){r&&("visible"===r.visibilityState?this.nt||(this.nt=!0,setTimeout(()=>{if(r&&n){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.st&&(r.removeEventListener("visibilitychange",this.st),this.st=null)):this.st||(this.st=()=>{this._t()},C(r,"visibilitychange",this.st)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.userManager.getDistinctId()||this.userManager.getAnonymousId()}getAnonymousId(){return this.userManager.getAnonymousId()}updateConfig(t){this.configManager.updateConfig(t);var i=this.configManager.getConfig();this.sessionManager=new U(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new Qt(i.persistence||"localStorage",i.cross_subdomain_cookie),this.webVitalsManager=new ei(i,this),this.sessionRecording&&i.session_recording&&this.sessionRecording.updateConfig(this.bt(i))}ct(){var t=this.configManager.getConfig();if(!t.disable_session_recording){var i=this.bt(t);this.sessionRecording=new oi(this,i),i.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}bt(t){var i,e,r,n=t.session_recording||{};return{enabled:null!==(i=n.enabled)&&void 0!==i&&i,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(e=n.captureConsole)&&void 0!==e&&e,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}startSessionRecording(){if(!this.sessionRecording){var t=this.configManager.getConfig(),i=this.bt(t);i.enabled=!0,this.sessionRecording=new oi(this,i)}this.sessionRecording.startIfEnabledOrStop("recording_initialized")}stopSessionRecording(){var t;null===(t=this.sessionRecording)||void 0===t||t.stopRecording()}isSessionRecordingActive(){var t;return"active"===(null===(t=this.sessionRecording)||void 0===t?void 0:t.status)}getSessionRecordingId(){var t;return(null===(t=this.sessionRecording)||void 0===t?void 0:t.sessionId)||null}_execute_array(t){Array.isArray(t)&&t.forEach(t=>{if(t&&Array.isArray(t)&&t.length>0){var i=t[0],e=t.slice(1);if("function"==typeof this[i])try{this[i](...e)}catch(t){console.error("vTilt: Error executing queued call "+i+":",t)}}})}_dom_loaded(){this.__request_queue.forEach(t=>{this.yt(t)}),this.__request_queue=[],this.gt()}}var ie={},ee="vt",re=!(void 0!==o||void 0!==s)&&-1===(null==a?void 0:a.indexOf("MSIE"))&&-1===(null==a?void 0:a.indexOf("Mozilla"));null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=re);var ne,se=(ne=ie[ee]=new te,function(){function i(){i.done||(i.done=!0,re=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),k(ie,function(t){t._dom_loaded()}))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():C(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),ne);export{Zt as ALL_WEB_VITALS_METRICS,Yt as DEFAULT_WEB_VITALS_METRICS,te as VTilt,se as default,se as vt};
1
+ var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,n=null==i?void 0:i.location,s=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0;null==i||i.AbortController;var a=null==e?void 0:e.userAgent,l=null!=t?t:{};function h(t,i,e,r,n,s,o){try{var a=t[s](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,n)}function u(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){h(s,r,n,o,a,"next",t)}function a(t){h(s,r,n,o,a,"throw",t)}o(void 0)})}}function d(){return d=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},d.apply(null,arguments)}l.__VTiltExtensions__=l.__VTiltExtensions__||{},l.__VTiltExtensions__.loadExternalDependency=(t,i,e)=>{var n=((t,i)=>{var e=t.getConfig();return e.script_host?e.script_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":"https://unpkg.com/@v-tilt/browser@1.3.0/dist/"+i+".js"})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn("[ExternalScriptsLoader] "+i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var n=null==r?void 0:r.querySelectorAll("script");if(n)for(var s,o=function(){if(n[a].src===i){var t=n[a];return t.__vtilt_loading_callback_fired?{v:e()}:(t.addEventListener("load",i=>{t.__vtilt_loading_callback_fired=!0,e(void 0,i)}),t.onerror=t=>e(t),{v:void 0})}},a=0;a<n.length;a++)if(s=o())return s.v;var l=()=>{var t;if(!r)return e("document not found");var n=r.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=i,n.onload=t=>{n.__vtilt_loading_callback_fired=!0,e(void 0,t)},n.onerror=t=>e(t);var s=r.querySelectorAll("body > script");s.length>0?null===(t=s[0].parentNode)||void 0===t||t.insertBefore(n,s[0]):r.body.appendChild(n)};(null==r?void 0:r.body)?l():null==r||r.addEventListener("DOMContentLoaded",l)})(t,n,e)};class v{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return d({token:t.token||""},t);var i=document.currentScript,e=d({token:""},t);e.api_host=i.getAttribute("data-api-host")||i.getAttribute("data-host")||t.api_host,e.script_host=i.getAttribute("data-script-host")||t.script_host,e.proxy=i.getAttribute("data-proxy")||t.proxy,e.proxyUrl=i.getAttribute("data-proxy-url")||t.proxyUrl,e.token=i.getAttribute("data-token")||t.token||"",e.projectId=i.getAttribute("data-project-id")||t.projectId||"",e.domain=i.getAttribute("data-domain")||t.domain,e.storage=i.getAttribute("data-storage")||t.storage,e.stringifyPayload="false"!==i.getAttribute("data-stringify-payload");var r="true"===i.getAttribute("data-capture-performance");if(e.capture_performance=!!r||t.capture_performance,e.proxy&&e.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 n of(e.globalAttributes=d({},t.globalAttributes),Array.from(i.attributes)))n.name.startsWith("data-vt-")&&(e.globalAttributes[n.name.slice(8).replace(/-/g,"_")]=n.value);return e}getConfig(){return d({},this.config)}updateConfig(t){this.config=d({},this.config,t)}}var c="__vt_session",f="__vt_window_id",p="__vt_primary_window",g="__vt_user_state",_="__vt_device_id",m="__vt_anonymous_id",w="__vt_distinct_id",y="__vt_user_properties",b="localStorage",S="localStorage+cookie",x="sessionStorage",T="memory",E="$initial_person_info";function C(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function I(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function k(t,i,e){if(t)if(Array.isArray(t))t.forEach((t,r)=>{i.call(e,t,r)});else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&i.call(e,t[r],r)}function M(t,i,e,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:n,passive:s})}function R(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function O(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];for(var n of e)for(var s of n)t.push(s);return t}var P=31536e3,D=["herokuapp.com","vercel.app","netlify.app"];function L(t){var i;if(!t)return"";if("undefined"==typeof document)return"";var e=null===(i=document.location)||void 0===i?void 0:i.hostname;if(!e)return"";var r=e.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class A{constructor(t){var i,e;this.memoryStorage=new Map,this.method=t.method,this.cross_subdomain=null!==(i=t.cross_subdomain)&&void 0!==i?i:function(){var t;if("undefined"==typeof document)return!1;var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return!1;var e=i.split(".").slice(-2).join(".");for(var r of D)if(e===r)return!1;return!0}(),this.sameSite=t.sameSite||"Lax",this.secure=null!==(e=t.secure)&&void 0!==e?e:"undefined"!=typeof location&&"https:"===location.protocol}get(t){var i;try{if(this.method===T)return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;if(this.usesLocalStorage()){var e=localStorage.getItem(t);return null!==e?e:this.method===S?this.getCookie(t):null}return this.usesSessionStorage()?sessionStorage.getItem(t):this.getCookie(t)}catch(i){return console.warn('[StorageManager] Failed to get "'+t+'":',i),null}}set(t,i,e){try{if(this.method===T)return void this.memoryStorage.set(t,i);if(this.usesLocalStorage())return localStorage.setItem(t,i),void(this.method===S&&this.setCookie(t,i,e||P));if(this.usesSessionStorage())return void sessionStorage.setItem(t,i);this.setCookie(t,i,e||P)}catch(i){console.warn('[StorageManager] Failed to set "'+t+'":',i)}}remove(t){try{if(this.method===T)return void this.memoryStorage.delete(t);if(this.usesLocalStorage())return localStorage.removeItem(t),void(this.method===S&&this.removeCookie(t));if(this.usesSessionStorage())return void sessionStorage.removeItem(t);this.removeCookie(t)}catch(i){console.warn('[StorageManager] Failed to remove "'+t+'":',i)}}getWithExpiry(t){var i=this.get(t);if(!i)return null;try{var e=JSON.parse(i);return e.expiry&&Date.now()>e.expiry?(this.remove(t),null):e.value}catch(t){return null}}setWithExpiry(t,i,e){var r=d({value:i},e?{expiry:Date.now()+e}:{});this.set(t,JSON.stringify(r))}getJSON(t){var i=this.get(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}}setJSON(t,i,e){this.set(t,JSON.stringify(i),e)}getCookie(t){if("undefined"==typeof document)return null;var i=document.cookie.split(";");for(var e of i){var[r,...n]=e.trim().split("=");if(r===t){var s=n.join("=");try{return decodeURIComponent(s)}catch(t){return s}}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=t+"="+encodeURIComponent(i);r+="; Max-Age="+e,r+="; path=/",r+="; SameSite="+this.sameSite,this.secure&&(r+="; Secure");var n=L(this.cross_subdomain);n&&(r+="; domain="+n),document.cookie=r}}removeCookie(t){if("undefined"!=typeof document){var i=L(this.cross_subdomain),e=t+"=; Max-Age=0; path=/";i&&(e+="; domain="+i),document.cookie=e,document.cookie=t+"=; Max-Age=0; path=/"}}usesLocalStorage(){return this.method===b||this.method===S}usesSessionStorage(){return this.method===x}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_storage_test__";return t.sessionStorage.setItem(i,"test"),t.sessionStorage.removeItem(i),!0}catch(t){return!1}}getSessionStorage(){var i;return this.canUseSessionStorage()&&null!==(i=null==t?void 0:t.sessionStorage)&&void 0!==i?i:null}setMethod(t){this.method=t}getMethod(){return this.method}}class U{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new A({method:t,cross_subdomain:i,sameSite:"Lax"}),this.o=void 0,this.m()}getSessionId(){var t=this.S();return t||(t=C(),this.T(t)),t}setSessionId(){var t=this.S()||C();return this.T(t),t}resetSessionId(){this.C(),this.setSessionId(),this.I(C())}S(){return this.storage.get(c)}T(t){this.storage.set(c,t,1800)}C(){this.storage.remove(c)}getWindowId(){if(this.o)return this.o;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(f);if(i)return this.o=i,i}var e=C();return this.I(e),e}I(t){if(t!==this.o){this.o=t;var i=this.storage.getSessionStorage();i&&i.setItem(f,t)}}m(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p),e=t.getItem(f);e&&!i?this.o=e:(e&&t.removeItem(f),this.I(C())),t.setItem(p,"true"),this.k()}else this.o=C()}k(){var i=this.storage.getSessionStorage();t&&i&&M(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(p)},{capture:!1})}updateStorageMethod(t,i){this.storage=new A({method:t,cross_subdomain:i,sameSite:"Lax"})}}function B(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function j(t,i){for(var e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===i){if(n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(t){}return s.replace(/\+/g," ")}}return""}function N(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],l=o[0],h=(a||"").split("&"),u=[],d=0;d<h.length;d++){var v=h[d].split("="),c=v[0],f=v.slice(1).join("=");-1!==i.indexOf(c)?u.push(c+"="+e):c&&u.push(c+(f?"="+f:""))}var p=u.join("&");return l+(p?"?"+p:"")+(s?"#"+s:"")}function z(t){return"function"==typeof t}var q="Mobile",F="iOS",W="Android",V="Tablet",J=W+" "+V,H="iPad",X="Apple",K=X+" Watch",G="Safari",Q="BlackBerry",Z="Samsung",Y=Z+"Browser",tt=Z+" Internet",it="Chrome",et=it+" OS",rt=it+" "+F,nt="Internet Explorer",st=nt+" "+q,ot="Opera",at=ot+" Mini",lt="Edge",ht="Microsoft "+lt,ut="Firefox",dt=ut+" "+F,vt="Nintendo",ct="PlayStation",ft="Xbox",pt=W+" "+q,gt=q+" "+G,_t="Windows",mt=_t+" Phone",wt="Nokia",yt="Ouya",bt="Generic",St=bt+" "+q.toLowerCase(),xt=bt+" "+V.toLowerCase(),Tt="Konqueror",Et="(\\d+(\\.\\d+)?)",Ct=new RegExp("Version/"+Et),It=new RegExp(ft,"i"),kt=new RegExp(ct+" \\w+","i"),Mt=new RegExp(vt+" \\w+","i"),$t=new RegExp(Q+"|PlayBook|BB10","i"),Rt={"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 Ot(t,i){return t.toLowerCase().includes(i.toLowerCase())}var Pt=(t,i)=>i&&Ot(i,X)||function(t){return Ot(t,G)&&!Ot(t,it)&&!Ot(t,W)}(t),Dt=function(t,i){return i=i||"",Ot(t," OPR/")&&Ot(t,"Mini")?at:Ot(t," OPR/")?ot:$t.test(t)?Q:Ot(t,"IE"+q)||Ot(t,"WPDesktop")?st:Ot(t,Y)?tt:Ot(t,lt)||Ot(t,"Edg/")?ht:Ot(t,"FBIOS")?"Facebook "+q:Ot(t,"UCWEB")||Ot(t,"UCBrowser")?"UC Browser":Ot(t,"CriOS")?rt:Ot(t,"CrMo")||Ot(t,it)?it:Ot(t,W)&&Ot(t,G)?pt:Ot(t,"FxiOS")?dt:Ot(t.toLowerCase(),Tt.toLowerCase())?Tt:Pt(t,i)?Ot(t,q)?gt:G:Ot(t,ut)?ut:Ot(t,"MSIE")||Ot(t,"Trident/")?nt:Ot(t,"Gecko")?ut:""},Lt={[st]:[new RegExp("rv:"+Et)],[ht]:[new RegExp(lt+"?\\/"+Et)],[it]:[new RegExp("("+it+"|CrMo)\\/"+Et)],[rt]:[new RegExp("CriOS\\/"+Et)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Et)],[G]:[Ct],[gt]:[Ct],[ot]:[new RegExp("(Opera|OPR)\\/"+Et)],[ut]:[new RegExp(ut+"\\/"+Et)],[dt]:[new RegExp("FxiOS\\/"+Et)],[Tt]:[new RegExp("Konqueror[:/]?"+Et,"i")],[Q]:[new RegExp(Q+" "+Et),Ct],[pt]:[new RegExp("android\\s"+Et,"i")],[tt]:[new RegExp(Y+"\\/"+Et)],[nt]:[new RegExp("(rv:|MSIE )"+Et)],Mozilla:[new RegExp("rv:"+Et)]},At=function(t,i){var e=Dt(t,i),r=Lt[e];if(void 0===r)return null;for(var n=0;n<r.length;n++){var s=r[n],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Ut=[[new RegExp(ft+"; "+ft+" (.*?)[);]","i"),t=>[ft,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[$t,[Q,""]],[new RegExp(_t,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[mt,""];if(new RegExp(q).test(i)&&!/IEMobile\b/.test(i))return[_t+" "+q,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=Rt[r]||"";return/arm/i.test(i)&&(n="RT"),[_t,n]}return[_t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[F,i.join(".")]}return[F,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=void 0===t[2]?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+W+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+W+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[W,i.join(".")]}return[W,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[et,""]],[/Linux|debian/i,["Linux",""]]],Bt=function(t){return Mt.test(t)?vt:kt.test(t)?ct:It.test(t)?ft:new RegExp(yt,"i").test(t)?yt:new RegExp("("+mt+"|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?H:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?K:$t.test(t)?Q:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wt,"i").test(t)?wt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(q).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?W:J:W:new RegExp("(pda|"+q+")","i").test(t)?St:new RegExp(V,"i").test(t)&&!new RegExp(V+" pc","i").test(t)?xt:""},jt="https?://(.*)",Nt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],zt=O(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Nt),qt="<masked>";function Ft(t){var i=function(t){return t?0===t.search(jt+"google.([^/?]*)")?"google":0===t.search(jt+"bing.com")?"bing":0===t.search(jt+"yahoo.com")?"yahoo":0===t.search(jt+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?j(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function Wt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Vt(){return(null==r?void 0:r.referrer)||"$direct"}function Jt(){var t;return(null==r?void 0:r.referrer)&&(null===(t=B(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function Ht(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=B(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=B(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=zt.concat([]),e={};return k(i,function(i){var r=j(t,i);e[i]=r||null}),e}(r);R(n,o)}e&&R(n,Ft(e));return n}function Xt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Kt(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function Gt(i,e){if(!a)return{};var r,s,o,[l,h]=function(t){for(var i=0;i<Ut.length;i++){var[e,r]=Ut[i],n=e.exec(t),s=n&&(z(r)?r(n,t):r);if(s)return s}return["",""]}(a);return R(function(t){var i={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];null!=r&&""!==r&&(i[e]=r)}return i}({$os:l,$os_version:h,$browser:Dt(a,navigator.vendor),$device:Bt(a),$device_type:(s=a,o=Bt(s),o===H||o===J||"Kobo"===o||"Kindle Fire"===o||o===xt?V:o===vt||o===ft||o===ct||o===yt?"Console":o===K?"Wearable":o?q:"Desktop"),$timezone:Xt(),$timezone_offset:Kt()}),{$current_url:N(null==n?void 0:n.href,[],qt),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:At(a,navigator.vendor),$browser_language:Wt(),$browser_language_prefix:(r=Wt(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.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 Qt{constructor(t,i){void 0===t&&(t="localStorage"),this.M=null,this.storage=new A({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return d({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(m,this.userIdentity.anonymous_id,P)),this.userIdentity.anonymous_id}getUserProperties(){return d({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(t,i,e){if("number"==typeof t&&(t=t.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.")),t)if(this.isDistinctIdStringLike(t))console.error('The string "'+t+'" 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"!==t){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=t,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=d({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}t!==r&&(this.userIdentity.distinct_id=t);var s="anonymous"===this.userIdentity.user_state;t!==r&&s?(this.userIdentity.user_state="identified",i&&(this.userIdentity.properties=d({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):i||e?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),i&&(this.userIdentity.properties=d({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):t!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+t+'" 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(t,i){if(!t&&!i)return!1;var e=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(e,t,i);return this.M===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(t&&(this.userIdentity.properties=d({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity(),this.M=r,!0)}reset(t){var i=this.generateAnonymousId(),e=this.userIdentity.device_id,r=t?this.generateDeviceId():e;this.userIdentity={distinct_id:null,anonymous_id:i,device_id:r,properties:{},user_state:"anonymous"},this.M=null,this.saveUserIdentity(),this.userIdentity.properties=d({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(t){this.userIdentity.distinct_id=t,this.saveUserIdentity()}setUserState(t){this.userIdentity.user_state=t,this.saveUserIdentity()}updateUserProperties(t,i){t&&(this.userIdentity.properties=d({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity()}ensureDeviceId(t){this.userIdentity.device_id||(this.userIdentity.device_id=t,this.userIdentity.properties=d({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:t}),this.saveUserIdentity())}createAlias(t,i){return this.isValidDistinctId(t)?(void 0===i&&(i=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(i)?t===i?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:t,original:i}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(t){return this.isDistinctIdStringLike(t)}set_initial_person_info(t,i){if(!this.getStoredUserProperties()[E]){var e=function(t,i){var e=t?O([],Nt,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:Vt().substring(0,1e3),u:r?N(r,e,qt):void 0}}(t,i);this.register_once({[E]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[E];return e?(t=Ht(e),i={},k(t,function(t,e){var r;i["$initial_"+(r=String(e),r.startsWith("$")?r.substring(1):r)]=t}),i):{}}update_referrer_info(){var t={$referrer:Vt(),$referring_domain:Jt()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(m)||this.generateAnonymousId(),i=this.storage.get(w)||null,e=this.storage.get(_)||this.generateDeviceId(),r=this.getStoredUserProperties(),n=this.storage.get(g)||"anonymous";return{distinct_id:i,anonymous_id:t||this.generateAnonymousId(),device_id:e,properties:r,user_state:n}}saveUserIdentity(){this.storage.set(m,this.userIdentity.anonymous_id,P),this.storage.set(_,this.userIdentity.device_id,P),this.storage.set(g,this.userIdentity.user_state,P),this.userIdentity.distinct_id?this.storage.set(w,this.userIdentity.distinct_id,P):this.storage.remove(w),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(y)||{}}setStoredUserProperties(t){this.storage.setJSON(y,t,P)}register_once(t,i){var e=this.getStoredUserProperties(),r=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(n in e||(e[n]=t[n],r=!0));if(i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(s in e||(e[s]=i[s],r=!0));r&&this.setStoredUserProperties(e)}generateAnonymousId(){return"anon_"+C()}generateDeviceId(){return"device_"+C()}getPersonPropertiesHash(t,i,e){return JSON.stringify({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}isValidDistinctId(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(i)&&0!==t.trim().length}isDistinctIdStringLike(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(i)}updateStorageMethod(t,i){this.storage=new A({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var Zt=["LCP","CLS","FCP","INP","TTFB"],Yt=["LCP","CLS","FCP","INP"],ti=9e5,ii="[WebVitals]";class ei{constructor(i,e){this.initialized=!1,this.instance=e,this.buffer=this.createEmptyBuffer(),this.config=this.parseConfig(i.capture_performance),this.isEnabled&&t&&this.startIfEnabled()}parseConfig(t){return"boolean"==typeof t?{web_vitals:t}:"object"==typeof t&&null!==t?t:{web_vitals:!1}}get isEnabled(){var t=null==n?void 0:n.protocol;return("http:"===t||"https:"===t)&&!1!==this.config.web_vitals}get allowedMetrics(){return this.config.web_vitals_allowed_metrics||Yt}get flushTimeoutMs(){return this.config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var t=this.config.__web_vitals_max_value;return void 0===t?ti:0===t?0:t<6e4?ti:t}createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}getWebVitalsCallbacks(){var t;return null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.webVitalsCallbacks}startIfEnabled(){if(this.isEnabled&&!this.initialized){var t=this.getWebVitalsCallbacks();t?this.startCapturing(t):this.loadWebVitals()}}loadWebVitals(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;i?i(this.instance,"web-vitals",t=>{if(t)console.error(ii+" Failed to load web-vitals:",t);else{var i=this.getWebVitalsCallbacks();i?this.startCapturing(i):console.error(ii+" web-vitals loaded but callbacks not registered")}}):console.warn(ii+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}startCapturing(t){if(!this.initialized){var i=this.allowedMetrics,e=this.addToBuffer.bind(this);i.includes("LCP")&&t.onLCP&&t.onLCP(e),i.includes("CLS")&&t.onCLS&&t.onCLS(e,{reportAllChanges:!0}),i.includes("FCP")&&t.onFCP&&t.onFCP(e),i.includes("INP")&&t.onINP&&t.onINP(e),i.includes("TTFB")&&t.onTTFB&&t.onTTFB(e),this.initialized=!0}}getCurrentUrl(){var i;return null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.href}getCurrentPathname(){return null==n?void 0:n.pathname}addToBuffer(i){try{if(!t||!r||!n)return;if(!(null==i?void 0:i.name)||void 0===(null==i?void 0:i.value))return void console.warn(ii+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(ii+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.getCurrentUrl(),s=this.getCurrentPathname();if(!e)return void console.warn(ii+" Could not determine current URL");this.buffer.url&&this.buffer.url!==e&&this.flush(),this.buffer.url||(this.buffer.url=e,this.buffer.pathname=s),this.buffer.firstMetricTimestamp||(this.buffer.firstMetricTimestamp=Date.now());var o=this.cleanAttribution(i.attribution),a=this.instance.getSessionId(),l=this.getWindowId(),h=d({},i,{attribution:o,timestamp:Date.now(),$current_url:e,$session_id:a,$window_id:l}),u=this.buffer.metrics.findIndex(t=>t.name===i.name);u>=0?this.buffer.metrics[u]=h:this.buffer.metrics.push(h),this.scheduleFlush(),this.buffer.metrics.length>=this.allowedMetrics.length&&this.flush()}catch(t){console.error(ii+" Error adding metric to buffer:",t)}}cleanAttribution(t){if(t){var i=d({},t);return"interactionTargetElement"in i&&delete i.interactionTargetElement,i}}getWindowId(){var t;try{return(null===(t=this.instance.sessionManager)||void 0===t?void 0:t.getWindowId())||null}catch(t){return null}}scheduleFlush(){this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>{this.flush()},this.flushTimeoutMs)}flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0),0!==this.buffer.metrics.length){try{var t={$pathname:this.buffer.pathname,$current_url:this.buffer.url};for(var i of this.buffer.metrics)t["$web_vitals_"+i.name+"_value"]=i.value,t["$web_vitals_"+i.name+"_event"]={name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,attribution:i.attribution,$session_id:i.$session_id,$window_id:i.$window_id};this.instance.capture("$web_vitals",t)}catch(t){console.error(ii+" Error flushing metrics:",t)}this.buffer=this.createEmptyBuffer()}}}function ri(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return z(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class ni{constructor(i){var e;this._instance=i,this.$=(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.R&&this.R(),this.R=void 0}monitorHistoryChanges(){var i,e;if(t&&n&&(this.$=n.pathname||"",t.history)){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||ri(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.O("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||ri(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.O("replaceState")}),this.P()}}O(i){var e;try{var s=null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname;if(!s||!n||!r)return;if(s!==this.$&&this.isEnabled){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.$=s}catch(t){console.error("Error capturing "+i+" pageview",t)}}P(){if(!this.R&&t){var i=()=>{this.O("popstate")};M(t,"popstate",i),this.R=()=>{t&&t.removeEventListener("popstate",i)}}}}var si="[SessionRecording]";class oi{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.D=i}get started(){var t;return!!(null===(t=this.L)||void 0===t?void 0:t.isStarted)}get status(){var t;return(null===(t=this.L)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.L)||void 0===t?void 0:t.sessionId)||""}startIfEnabledOrStop(t){var i;if(!this.A||!(null===(i=this.L)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.A&&e?(this.U(t),console.info(si+" starting")):this.stopRecording()}}stopRecording(){var t;null===(t=this.L)||void 0===t||t.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.L)||void 0===e?void 0:e.log)?this.L.log(t,i):console.warn(si+" log called before recorder was ready")}updateConfig(t){var i;this.D=d({},this.D,t),null===(i=this.L)||void 0===i||i.updateConfig(this.D)}get A(){var i,e=this._instance.getConfig(),r=null!==(i=this.D.enabled)&&void 0!==i&&i,n=!e.disable_session_recording;return!!t&&r&&n}get B(){return"recorder"}U(t){var i,e,r,n;if(this.A)if((null===(e=null===(i=null==l?void 0:l.__VTiltExtensions__)||void 0===i?void 0:i.rrweb)||void 0===e?void 0:e.record)&&(null===(r=l.__VTiltExtensions__)||void 0===r?void 0:r.initSessionRecording))this.j(t);else{var s=null===(n=l.__VTiltExtensions__)||void 0===n?void 0:n.loadExternalDependency;s?s(this._instance,this.B,i=>{i?console.error(si+" could not load recorder:",i):this.j(t)}):console.error(si+" loadExternalDependency not available. Session recording cannot start.")}}j(t){var i,e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.L||(this.L=e(this._instance,this.D)),this.L.start(t)):console.error(si+" initSessionRecording not available after script load")}}var ai=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ai||{}),li=Uint8Array,hi=Uint16Array,ui=Int32Array,di=new li([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]),vi=new li([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]),ci=new li([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fi=function(t,i){for(var e=new hi(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new ui(e[30]);for(r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)n[s]=s-e[r]<<5|r;return{b:e,r:n}},pi=fi(di,2),gi=pi.b,_i=pi.r;gi[28]=258,_i[258]=28;for(var mi=fi(vi,0).r,wi=new hi(32768),yi=0;yi<32768;++yi){var bi=(43690&yi)>>1|(21845&yi)<<1;bi=(61680&(bi=(52428&bi)>>2|(13107&bi)<<2))>>4|(3855&bi)<<4,wi[yi]=((65280&bi)>>8|(255&bi)<<8)>>1}var Si=function(t,i,e){for(var r=t.length,n=0,s=new hi(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new hi(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new hi(1<<i);var l=15-i;for(n=0;n<r;++n)if(t[n])for(var h=n<<4|t[n],u=i-t[n],d=a[t[n]-1]++<<u,v=d|(1<<u)-1;d<=v;++d)o[wi[d]>>l]=h}else for(o=new hi(r),n=0;n<r;++n)t[n]&&(o[n]=wi[a[t[n]-1]++]>>15-t[n]);return o},xi=new li(288);for(yi=0;yi<144;++yi)xi[yi]=8;for(yi=144;yi<256;++yi)xi[yi]=9;for(yi=256;yi<280;++yi)xi[yi]=7;for(yi=280;yi<288;++yi)xi[yi]=8;var Ti=new li(32);for(yi=0;yi<32;++yi)Ti[yi]=5;var Ei=Si(xi,9,0),Ci=Si(Ti,5,0),Ii=function(t){return(t+7)/8|0},ki=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new li(t.subarray(i,e))},Mi=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},$i=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8,t[r+2]|=e>>16},Ri=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var n=e.length,s=e.slice();if(!n)return{t:Bi,l:0};if(1==n){var o=new li(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=e[e[h].f<e[d].f?h++:d++],l=e[h!=u&&e[h].f<e[d].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=s[0].s;for(r=1;r<n;++r)s[r].s>v&&(v=s[r].s);var c=new hi(v+1),f=Oi(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(s.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});r<n;++r){var m=s[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>=g;p>0;){var w=s[r].s;c[w]<i?p-=1<<i-c[w]++-1:++r}for(;r>=0&&p;--r){var y=s[r].s;c[y]==i&&(--c[y],++p)}f=i}return{t:new li(c),l:f}},Oi=function(t,i,e){return-1==t.s?Math.max(Oi(t.l,i,e+1),Oi(t.r,i,e+1)):i[t.s]=e},Pi=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new hi(++i),r=0,n=t[0],s=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==n&&a!=i)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return{c:e.subarray(0,r),n:i}},Di=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Li=function(t,i,e){var r=e.length,n=Ii(i+2);t[n]=255&r,t[n+1]=r>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;s<r;++s)t[n+s+4]=e[s];return 8*(n+4+r)},Ai=function(t,i,e,r,n,s,o,a,l,h,u){Mi(i,u++,e),++n[256];for(var d=Ri(n,15),v=d.t,c=d.l,f=Ri(s,15),p=f.t,g=f.l,_=Pi(v),m=_.c,w=_.n,y=Pi(p),b=y.c,S=y.n,x=new hi(19),T=0;T<m.length;++T)++x[31&m[T]];for(T=0;T<b.length;++T)++x[31&b[T]];for(var E=Ri(x,7),C=E.t,I=E.l,k=19;k>4&&!C[ci[k-1]];--k);var M,R,O,P,D=h+5<<3,L=Di(n,xi)+Di(s,Ti)+o,A=Di(n,v)+Di(s,p)+o+14+3*k+Di(x,C)+2*x[16]+3*x[17]+7*x[18];if(l>=0&&D<=L&&D<=A)return Li(i,u,t.subarray(l,l+h));if(Mi(i,u,1+(A<L)),u+=2,A<L){M=Si(v,c,0),R=v,O=Si(p,g,0),P=p;var U=Si(C,I,0);Mi(i,u,w-257),Mi(i,u+5,S-1),Mi(i,u+10,k-4),u+=14;for(T=0;T<k;++T)Mi(i,u+3*T,C[ci[T]]);u+=3*k;for(var B=[m,b],j=0;j<2;++j){var N=B[j];for(T=0;T<N.length;++T){var z=31&N[T];Mi(i,u,U[z]),u+=C[z],z>15&&(Mi(i,u,N[T]>>5&127),u+=N[T]>>12)}}}else M=Ei,R=xi,O=Ci,P=Ti;for(T=0;T<a;++T){var q=r[T];if(q>255){$i(i,u,M[(z=q>>18&31)+257]),u+=R[z+257],z>7&&(Mi(i,u,q>>23&31),u+=di[z]);var F=31&q;$i(i,u,O[F]),u+=P[F],F>3&&($i(i,u,q>>5&8191),u+=vi[F])}else $i(i,u,M[q]),u+=R[q]}return $i(i,u,M[256]),u+R[256]},Ui=new ui([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bi=new li(0),ji=function(){for(var t=new Int32Array(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&-306674912)^e>>>1;t[i]=e}return t}(),Ni=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new li(s.length+t.length);o.set(s),o.set(t,s.length),t=o,n.w=s.length}return function(t,i,e,r,n,s){var o=s.z||t.length,a=new li(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),h=s.l,u=7&(s.r||0);if(i){u&&(l[0]=s.r>>3);for(var d=Ui[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,p=s.p||new hi(32768),g=s.h||new hi(f+1),_=Math.ceil(e/3),m=2*_,w=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new ui(25e3),b=new hi(288),S=new hi(32),x=0,T=0,E=s.i||0,C=0,I=s.w||0,k=0;E+2<o;++E){var M=w(E),R=32767&E,O=g[M];if(p[R]=O,g[M]=R,I<=E){var P=o-E;if((x>7e3||C>24576)&&(P>423||!h)){u=Ai(t,l,0,y,b,S,T,C,k,E-k,u),C=x=T=0,k=E;for(var D=0;D<286;++D)b[D]=0;for(D=0;D<30;++D)S[D]=0}var L=2,A=0,U=c,B=R-O&32767;if(P>2&&M==w(E-B))for(var j=Math.min(v,P)-1,N=Math.min(32767,E),z=Math.min(258,P);B<=N&&--U&&R!=O;){if(t[E+L]==t[E+L-B]){for(var q=0;q<z&&t[E+q]==t[E+q-B];++q);if(q>L){if(L=q,A=B,q>j)break;var F=Math.min(B,q-2),W=0;for(D=0;D<F;++D){var V=E-B+D&32767,J=V-p[V]&32767;J>W&&(W=J,O=V)}}}B+=(R=O)-(O=p[R])&32767}if(A){y[C++]=268435456|_i[L]<<18|mi[A];var H=31&_i[L],X=31&mi[A];T+=di[H]+vi[X],++b[257+H],++S[X],I=E+L,++x}else y[C++]=t[E],++b[t[E]]}}for(E=Math.max(E,I);E<o;++E)y[C++]=t[E],++b[t[E]];u=Ai(t,l,h,y,b,S,T,C,k,E-k,u),h||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=g,s.p=p,s.i=E,s.w=I)}else{for(E=s.w||0;E<o+h;E+=65535){var K=E+65535;K>=o&&(l[u/8|0]=h,K=o),u=Li(l,u+1,t.subarray(E,K))}s.i=o}return ki(a,0,r+Ii(u)+n)}(t,null==i.level?6:i.level,null==i.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+i.mem,e,r,n)},zi=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function qi(t,i){i||(i={});var e=function(){var t=-1;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=ji[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=Ni(t,i,10+((n=i).filename?n.filename.length+1:0),8),o=s.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&zi(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(s,i),zi(s,o-8,e.d()),zi(s,o-4,r),s}var Fi="undefined"!=typeof TextEncoder&&new TextEncoder,Wi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Wi.decode(Bi,{stream:!0})}catch(t){}ai.MouseMove,ai.MouseInteraction,ai.Scroll,ai.ViewportResize,ai.Input,ai.TouchMove,ai.MediaInteraction,ai.Drag;var Vi="[Chat]";class Ji{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.N=null,this.q=!1,this.F=!1,this.W=null,this.V=[],this.J=[],this.H=[],this.X=[],this.K=[],this.D=i}get isOpen(){var t,i;return null!==(i=null===(t=this.G)||void 0===t?void 0:t.isOpen)&&void 0!==i&&i}get isConnected(){var t,i;return null!==(i=null===(t=this.G)||void 0===t?void 0:t.isConnected)&&void 0!==i&&i}get isLoading(){var t,i;return this.F||null!==(i=null===(t=this.G)||void 0===t?void 0:t.isLoading)&&void 0!==i&&i}get unreadCount(){var t,i;return null!==(i=null===(t=this.G)||void 0===t?void 0:t.unreadCount)&&void 0!==i?i:0}get channel(){var t,i;return null!==(i=null===(t=this.G)||void 0===t?void 0:t.channel)&&void 0!==i?i:null}open(){this.Z(()=>{var t;return null===(t=this.G)||void 0===t?void 0:t.open()})}close(){var t;null===(t=this.G)||void 0===t||t.close()}toggle(){this.G?this.G.toggle():this.open()}show(){this.Z(()=>{var t;return null===(t=this.G)||void 0===t?void 0:t.show()})}hide(){var t;null===(t=this.G)||void 0===t||t.hide()}sendMessage(t){this.G?this.G.sendMessage(t):(this.V.push(t),this.Z(()=>{this.V.forEach(t=>{var i;return null===(i=this.G)||void 0===i?void 0:i.sendMessage(t)}),this.V=[]}))}markAsRead(){var t;null===(t=this.G)||void 0===t||t.markAsRead()}onMessage(t){return this.H.push(t),this.G?this.G.onMessage(t):()=>{var i=this.H.indexOf(t);i>-1&&this.H.splice(i,1)}}onTyping(t){return this.X.push(t),this.G?this.G.onTyping(t):()=>{var i=this.X.indexOf(t);i>-1&&this.X.splice(i,1)}}onConnectionChange(t){return this.K.push(t),this.G?this.G.onConnectionChange(t):()=>{var i=this.K.indexOf(t);i>-1&&this.K.splice(i,1)}}startIfEnabled(){var t=this;return u(function*(){var i,e,r,n;!1!==t.D.enabled?t._instance.getConfig().disable_chat?console.info(Vi+" disabled by disable_chat config"):(!1!==t.D.autoConfig&&(yield t.Y()),t.tt?(null!==(r=null!==(i=t.D.preload)&&void 0!==i?i:null===(e=t.N)||void 0===e?void 0:e.enabled)&&void 0!==r&&r&&t.it(),(null===(n=t.N)||void 0===n?void 0:n.enabled)&&t.et(),console.info(Vi+" ready (lazy-load on demand)")):console.info(Vi+" not enabled (check dashboard settings)")):console.info(Vi+" disabled by code config")})()}updateConfig(t){this.D=d({},this.D,t)}getMergedConfig(){var t,i,e,r,n,s,o,a,l,h,u,d,v,c,f,p,g,_,m=this.N,w=this.D;return{enabled:null!==(i=null!==(t=w.enabled)&&void 0!==t?t:null==m?void 0:m.enabled)&&void 0!==i&&i,autoConfig:null===(e=w.autoConfig)||void 0===e||e,position:null!==(n=null!==(r=w.position)&&void 0!==r?r:null==m?void 0:m.position)&&void 0!==n?n:"bottom-right",greeting:null!==(s=w.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(a=null!==(o=w.color)&&void 0!==o?o:null==m?void 0:m.color)&&void 0!==a?a:"#6366f1",aiMode:null===(h=null!==(l=w.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===h||h,aiGreeting:null!==(u=w.aiGreeting)&&void 0!==u?u:null==m?void 0:m.ai_greeting,preload:null!==(d=w.preload)&&void 0!==d&&d,theme:null!==(v=w.theme)&&void 0!==v?v:{primaryColor:null!==(f=null!==(c=w.color)&&void 0!==c?c:null==m?void 0:m.color)&&void 0!==f?f:"#6366f1"},offlineMessage:null!==(p=w.offlineMessage)&&void 0!==p?p:null==m?void 0:m.offline_message,collectEmailOffline:null===(_=null!==(g=w.collectEmailOffline)&&void 0!==g?g:null==m?void 0:m.collect_email_offline)||void 0===_||_}}destroy(){var t;null===(t=this.G)||void 0===t||t.destroy(),this.G=void 0,this.V=[],this.J=[],this.H=[],this.X=[],this.K=[]}get tt(){var t;return!1!==this.D.enabled&&(!0===this.D.enabled||!0===(null===(t=this.N)||void 0===t?void 0:t.enabled))}Y(){var t=this;return u(function*(){if(!t.q){var i=t._instance.getConfig(),e=i.token,r=i.api_host;if(!e||!r)return console.warn(Vi+" Cannot fetch settings: missing token or api_host"),void(t.q=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(e),s=yield fetch(n);if(!s.ok)return console.warn(Vi+" Failed to fetch settings: "+s.status),void(t.q=!0);t.N=yield s.json(),t.q=!0,console.info(Vi+" Loaded settings from dashboard")}catch(i){console.warn(Vi+" Error fetching settings:",i),t.q=!0}}})()}et(){if((null==t?void 0:t.document)&&!document.getElementById("vtilt-chat-bubble")){var i=this.getMergedConfig(),e=i.position||"bottom-right",r=i.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===e?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+r+";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s, box-shadow 0.2s;\n z-index: 999999;\n ").trim()),n.innerHTML='\n <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>\n </svg>\n ',n.addEventListener("mouseenter",()=>{n.style.transform="scale(1.05)",n.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),n.addEventListener("mouseleave",()=>{n.style.transform="scale(1)",n.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),n.addEventListener("click",()=>{this.open()}),document.body.appendChild(n)}}get B(){return"chat"}it(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this.rt(),{timeout:5e3}):setTimeout(()=>this.rt(),3e3)}Z(t){this.G?t():(this.J.push(t),this.rt())}rt(){var t,i;if(!(this.F||this.G||this.W))if(null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat)this.j();else{this.F=!0;var e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.loadExternalDependency;if(!e)return console.error(Vi+" loadExternalDependency not available. Chat cannot start."),this.F=!1,void(this.W="loadExternalDependency not available");e(this._instance,this.B,t=>{if(this.F=!1,t)return console.error(Vi+" Failed to load:",t),void(this.W=String(t));this.j()})}}j(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat;if(!i)return console.error(Vi+" initChat not available after script load"),void(this.W="initChat not available");if(!this.G){var e=this.getMergedConfig();this.G=i(this._instance,e),this.H.forEach(t=>{var i;return null===(i=this.G)||void 0===i?void 0:i.onMessage(t)}),this.X.forEach(t=>{var i;return null===(i=this.G)||void 0===i?void 0:i.onTyping(t)}),this.K.forEach(t=>{var i;return null===(i=this.G)||void 0===i?void 0:i.onConnectionChange(t)});var r=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");r&&r.remove()}this.J.forEach(t=>t()),this.J=[],console.info(Vi+" loaded and ready")}}var Hi,Xi="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Hi||(Hi={}));var Ki=t=>{var{data:i,compression:e}=t;if(i){var r=(t=>JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i))(i),n=new Blob([r]).size;if(e===Hi.GZipJS&&n>=1024)try{var s=qi(function(t,i){if(Fi)return Fi.encode(t);for(var e=t.length,r=new li(t.length+(t.length>>1)),n=0,s=function(t){r[n++]=t},o=0;o<e;++o){if(n+5>r.length){var a=new li(n+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return ki(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Xi});if(o.size<.95*n)return{contentType:Xi,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},Gi=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Ki(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Hi.GZipJS&&e===Xi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=d({"Content-Type":e},t.headers||{}),a=new AbortController,l=t.timeout?setTimeout(()=>a.abort(),t.timeout):null;fetch(s,{method:t.method||"POST",headers:o,body:r,keepalive:n<52428.8,signal:a.signal}).then(function(){var i=u(function*(i){var e,r=yield i.text(),n={statusCode:i.status,text:r};if(200===i.status)try{n.json=JSON.parse(r)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)});return function(t){return i.apply(this,arguments)}}()).catch(()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})}).finally(()=>{l&&clearTimeout(l)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:t=>{var i=Ki(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Hi.GZipJS&&e===Xi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,s=new XMLHttpRequest;s.open(t.method||"POST",n,!0),t.headers&&Object.entries(t.headers).forEach(t=>{var[i,e]=t;s.setRequestHeader(i,e)}),s.setRequestHeader("Content-Type",e),t.timeout&&(s.timeout=t.timeout),s.onreadystatechange=()=>{var i;if(4===s.readyState){var e={statusCode:s.status,text:s.responseText};if(200===s.status)try{e.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,e)}},s.onerror=()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:t=>{var i=Ki(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Hi.GZipJS&&e===Xi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],Qi=t=>{var i,e=t.transport||"fetch",r=Gi.find(t=>t.name===e&&t.available)||Gi.find(t=>t.available);if(!r)return console.error("vTilt: No available transport method"),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0}));r.method(t)};class Zi{constructor(t,i){var e,r,n,s;this.nt=!0,this.st=[],this.ot=(e=(null==i?void 0:i.flush_interval_ms)||3e3,r=250,n=5e3,s=3e3,"number"!=typeof e||isNaN(e)?s:Math.min(Math.max(e,r),n)),this.lt=t}get length(){return this.st.length}enqueue(t){this.st.push(t),this.ht||this.ut()}unload(){if(this.dt(),0!==this.st.length){var t=this.vt();for(var i in t){var e=t[i];this.lt(d({},e,{transport:"sendBeacon"}))}}}enable(){this.nt=!1,this.ut()}pause(){this.nt=!0,this.dt()}flush(){this.dt(),this.ct(),this.ut()}ut(){this.nt||(this.ht=setTimeout(()=>{this.dt(),this.ct(),this.st.length>0&&this.ut()},this.ot))}dt(){this.ht&&(clearTimeout(this.ht),this.ht=void 0)}ct(){if(0!==this.st.length){var t=this.vt(),i=Date.now();for(var e in t){var r=t[e];r.events.forEach(t=>{var e=new Date(t.timestamp).getTime();t.$offset=Math.abs(e-i)}),this.lt(r)}}}vt(){var t={};return this.st.forEach(i=>{var e=i.batchKey||i.url;t[e]||(t[e]={url:i.url,events:[],batchKey:i.batchKey}),t[e].events.push(i.event)}),this.st=[],t}}class Yi{constructor(i){this.ft=!1,this.gt=3e3,this.st=[],this._t=!0,this.lt=i.sendRequest,this.wt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this._t=e.onLine,M(t,"online",()=>{this._t=!0,this.yt()}),M(t,"offline",()=>{this._t=!1}))}get length(){return this.st.length}enqueue(t,i){if(void 0===i&&(i=0),i>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),n=(Math.random()-.5)*(r-e);return Math.ceil(r+n)}(i),r=Date.now()+e;this.st.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this._t||(n+=" (Browser is offline)"),console.warn(n),this.ft||(this.ft=!0,this.bt())}}retriableRequest(t){var i=this;return u(function*(){try{var e=yield i.lt(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}bt(){this.St&&clearTimeout(this.St),this.St=setTimeout(()=>{this._t&&this.st.length>0&&this.yt(),this.st.length>0?this.bt():this.ft=!1},this.gt)}yt(){var t=this,i=Date.now(),e=[],r=[];this.st.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.st=e,r.forEach(function(){var i=u(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.lt(e);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&t.enqueue(e,r)}catch(i){t.enqueue(e,r)}});return function(t){return i.apply(this,arguments)}}())}unload(){this.St&&(clearTimeout(this.St),this.St=void 0),this.st.forEach(t=>{var{request:i}=t;try{this.wt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.st=[]}}var te="vt_rate_limit";class ie{constructor(t){var i,e;void 0===t&&(t={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(i=t.eventsPerSecond)&&void 0!==i?i:10,this.eventsBurstLimit=Math.max(null!==(e=t.eventsBurstLimit)&&void 0!==e?e:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=t.persistence,this.captureWarning=t.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(t){var i,e,r,n;void 0===t&&(t=!1);var s=Date.now(),o=null!==(e=null===(i=this.persistence)||void 0===i?void 0:i.get(te))&&void 0!==e?e:{tokens:this.eventsBurstLimit,last:s},a=(s-o.last)/1e3;o.tokens+=a*this.eventsPerSecond,o.last=s,o.tokens>this.eventsBurstLimit&&(o.tokens=this.eventsBurstLimit);var l=o.tokens<1;return l||t||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||t||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(n=this.persistence)||void 0===n||n.set(te,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class ee{constructor(t){void 0===t&&(t={}),this.version="1.1.5",this.__loaded=!1,this.xt=!1,this.Tt=null,this.__request_queue=[],this.Et=!1,this.Ct=!1,this.configManager=new v(t);var i=this.configManager.getConfig();this.sessionManager=new U(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new Qt(i.persistence||"localStorage",i.cross_subdomain_cookie),this.webVitalsManager=new ei(i,this),this.rateLimiter=new ie({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.It("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new Yi({sendRequest:t=>this.kt(t),sendBeacon:t=>this.Mt(t)}),this.requestQueue=new Zi(t=>this.$t(t),{flush_interval_ms:3e3})}init(t,i,e){var r;if(e&&e!==ne){var n=null!==(r=re[e])&&void 0!==r?r:new ee;return n._init(t,i,e),re[e]=n,re[ne][e]=n,n}return this._init(t,i,e)}_init(t,i,e){if(void 0===i&&(i={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(d({},i,{projectId:t||i.projectId,name:e})),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 ni(this),this.historyAutocapture.startIfEnabled(),this.Rt(),this.Ot(),this.Pt(),this.Dt(),!1!==r.capture_pageview&&this.Lt(),this}Dt(){this.requestQueue.enable()}Pt(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};M(t,"beforeunload",i),M(t,"pagehide",i)}}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:ne;return i!==ne&&(i=ne+"."+i),i}getCurrentDomain(){if(!n)return"";var t=n.protocol,i=n.hostname,e=n.port;return t+"//"+i+(e?":"+e:"")}At(){var t=this.configManager.getConfig();return!(!t.projectId||!t.token)||(this.Et||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.Et=!0),!1)}buildUrl(){var t=this.configManager.getConfig(),{proxyUrl:i,proxy:e,api_host:r,token:n}=t;return i||(e?e+"/api/tracking?token="+n:r?r.replace(/\/+$/gm,"")+"/api/tracking?token="+n:"/api/tracking?token="+n)}sendRequest(i,e,r){if(this.At()){if(r&&void 0!==t)if(t.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});this.requestQueue.enqueue({url:i,event:e})}}$t(t){var{transport:i}=t;"sendBeacon"!==i?this.retryQueue.retriableRequest(t):this.Mt(t)}kt(t){return new Promise(i=>{var{url:e,events:r}=t,n=1===r.length?r[0]:{events:r},s=this.configManager.getConfig().disable_compression?Hi.None:Hi.GZipJS;Qi({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>{i({statusCode:t.statusCode})}})})}Mt(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Hi.None:Hi.GZipJS;Qi({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}Ut(t){this.sendRequest(t.url,t.event,!1)}capture(t,i,n){if(this.sessionManager.setSessionId(),e&&e.userAgent&&function(t){return!(t&&"string"==typeof t&&t.length>500)}(e.userAgent)&&((null==n?void 0:n.skip_client_rate_limiting)||this.rateLimiter.shouldAllowEvent())){var s=this.buildUrl(),o=Gt(),a=this.userManager.getUserProperties(),l=this.userManager.get_initial_props(),h=this.sessionManager.getSessionId(),u=this.sessionManager.getWindowId(),v=this.userManager.getAnonymousId(),c={};!this.Ct&&Object.keys(l).length>0&&Object.assign(c,l),i.$set_once&&Object.assign(c,i.$set_once);var f=d({},o,a,{$session_id:h,$window_id:u},v?{$anon_distinct_id:v}:{},Object.keys(c).length>0?{$set_once:c}:{},i.$set?{$set:i.$set}:{},i);!this.Ct&&Object.keys(l).length>0&&(this.Ct=!0),"$pageview"===t&&r&&(f.title=r.title);var p,g,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(p=Object.assign({},f,_.globalAttributes),!I(p=JSON.stringify(p)))return}else if(p=Object.assign({},f,_.globalAttributes),!I(JSON.stringify(p)))return;g="$identify"===t?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var m={timestamp:(new Date).toISOString(),event:t,project_id:_.projectId||"",payload:p,distinct_id:g,anonymous_id:v};this.sendRequest(s,m,!0)}}It(t,i){this.capture(t,i,{skip_client_rate_limiting:!0})}trackEvent(t,i){void 0===i&&(i={}),this.capture(t,i)}identify(t,i,e){if("number"==typeof t&&(t=String(t),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),t)if(this.userManager.isDistinctIdStringLikePublic(t))console.error('The string "'+t+'" 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"!==t){var r=this.userManager.getDistinctId(),n=this.userManager.getAnonymousId(),s=this.userManager.getDeviceId(),o="anonymous"===this.userManager.getUserState();if(!s){var a=r||n;this.userManager.ensureDeviceId(a)}t!==r&&o?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(i,e),this.capture("$identify",{distinct_id:t,$anon_distinct_id:n,$set:i||{},$set_once:e||{}}),this.userManager.setDistinctId(t)):i||e?(o&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(i,e),this.capture("$set",{$set:i||{},$set_once:e||{}})):t!==r&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(t))}else console.error('The string "'+t+'" 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(t,i){this.userManager.setUserProperties(t,i)&&this.capture("$set",{$set:t||{},$set_once:i||{}})}resetUser(t){this.sessionManager.resetSessionId(),this.userManager.reset(t)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(t,i){var e=this.userManager.createAlias(t,i);e?this.capture("$alias",{$original_id:e.original,$alias_id:e.distinct_id}):t===(i||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(t)}Lt(){r&&("visible"===r.visibilityState?this.xt||(this.xt=!0,setTimeout(()=>{if(r&&n){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.Tt&&(r.removeEventListener("visibilitychange",this.Tt),this.Tt=null)):this.Tt||(this.Tt=()=>{this.Lt()},M(r,"visibilitychange",this.Tt)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.userManager.getDistinctId()||this.userManager.getAnonymousId()}getAnonymousId(){return this.userManager.getAnonymousId()}updateConfig(t){this.configManager.updateConfig(t);var i=this.configManager.getConfig();this.sessionManager=new U(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new Qt(i.persistence||"localStorage",i.cross_subdomain_cookie),this.webVitalsManager=new ei(i,this),this.sessionRecording&&i.session_recording&&this.sessionRecording.updateConfig(this.Bt(i))}Rt(){var t=this.configManager.getConfig();if(!t.disable_session_recording){var i=this.Bt(t);this.sessionRecording=new oi(this,i),i.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}Bt(t){var i,e,r,n=t.session_recording||{};return{enabled:null!==(i=n.enabled)&&void 0!==i&&i,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(e=n.captureConsole)&&void 0!==e&&e,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}startSessionRecording(){if(!this.sessionRecording){var t=this.configManager.getConfig(),i=this.Bt(t);i.enabled=!0,this.sessionRecording=new oi(this,i)}this.sessionRecording.startIfEnabledOrStop("recording_initialized")}stopSessionRecording(){var t;null===(t=this.sessionRecording)||void 0===t||t.stopRecording()}isRecordingActive(){var t;return"active"===(null===(t=this.sessionRecording)||void 0===t?void 0:t.status)}getSessionRecordingId(){var t;return(null===(t=this.sessionRecording)||void 0===t?void 0:t.sessionId)||null}Ot(){var t=this.configManager.getConfig();if(!t.disable_chat){var i=this.jt(t);this.chat=new Ji(this,i),this.chat.startIfEnabled()}}jt(t){var i,e=t.chat||{};return{enabled:e.enabled,autoConfig:null===(i=e.autoConfig)||void 0===i||i,position:e.position,greeting:e.greeting,color:e.color,aiMode:e.aiMode,aiGreeting:e.aiGreeting,preload:e.preload,offlineMessage:e.offlineMessage,collectEmailOffline:e.collectEmailOffline}}_execute_array(t){Array.isArray(t)&&t.forEach(t=>{if(t&&Array.isArray(t)&&t.length>0){var i=t[0],e=t.slice(1);if("function"==typeof this[i])try{this[i](...e)}catch(t){console.error("vTilt: Error executing queued call "+i+":",t)}}})}_dom_loaded(){this.__request_queue.forEach(t=>{this.Ut(t)}),this.__request_queue=[],this.Dt()}}var re={},ne="vt",se=!(void 0!==o||void 0!==s)&&-1===(null==a?void 0:a.indexOf("MSIE"))&&-1===(null==a?void 0:a.indexOf("Mozilla"));null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=se);var oe,ae=(oe=re[ne]=new ee,function(){function i(){i.done||(i.done=!0,se=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),k(re,function(t){t._dom_loaded()}))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():M(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),oe);export{Zt as ALL_WEB_VITALS_METRICS,Yt as DEFAULT_WEB_VITALS_METRICS,ee as VTilt,ae as default,ae as vt};
2
2
  //# sourceMappingURL=module.js.map