@v-tilt/browser 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.d.ts CHANGED
@@ -553,6 +553,29 @@ interface ChatConfig {
553
553
  offlineMessage?: string;
554
554
  /** Collect email when offline */
555
555
  collectEmailOffline?: boolean;
556
+ /** Called when widget is opened */
557
+ onWidgetOpen?: () => void;
558
+ /** Called when widget is closed */
559
+ onWidgetClose?: (data: {
560
+ timeOpenSeconds: number;
561
+ messagesSent: number;
562
+ }) => void;
563
+ /** Called when a new conversation is started */
564
+ onConversationStart?: (data: {
565
+ channelId: string;
566
+ aiMode: boolean;
567
+ }) => void;
568
+ /** Called when user sends a message */
569
+ onMessageSent?: (data: {
570
+ channelId: string;
571
+ messageId: string;
572
+ }) => void;
573
+ /** Called when a message is received (from AI or agent) */
574
+ onMessageReceived?: (data: {
575
+ channelId: string;
576
+ messageId: string;
577
+ senderType: "ai" | "agent";
578
+ }) => void;
556
579
  }
557
580
  /**
558
581
  * Chat theme customization
@@ -824,7 +847,7 @@ interface QueuedRequest {
824
847
  }
825
848
 
826
849
  declare class VTilt {
827
- readonly version = "1.8.0";
850
+ readonly version = "1.9.0";
828
851
  private configManager;
829
852
  private sessionManager;
830
853
  private userManager;
@@ -842,6 +865,8 @@ declare class VTilt {
842
865
  private _has_warned_about_config;
843
866
  private _set_once_properties_sent;
844
867
  private _remoteConfig;
868
+ /** Person UUID from vt= URL param (manual person tracking link); sent as $vt until backend links distinct_id */
869
+ private _vt_person_uuid;
845
870
  constructor(config?: Partial<VTiltConfig>);
846
871
  /**
847
872
  * Initializes a new instance of the VTilt tracking object.
@@ -890,6 +915,11 @@ declare class VTilt {
890
915
  * Uses both beforeunload and pagehide for maximum compatibility
891
916
  */
892
917
  private _setup_unload_handler;
918
+ /**
919
+ * Read vt=person_uuid from current URL (tracking link for manually created persons).
920
+ * Stores the value for inclusion in event payload as $vt; removes param from URL via replaceState.
921
+ */
922
+ private _read_vt_param_from_url;
893
923
  /**
894
924
  * Load remote config from cache and fetch fresh in background.
895
925
  * Uses sessionStorage for per-session caching.
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,l=null!=t?t:{},h="[ExternalScriptsLoader]";function u(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 d(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){u(s,r,n,o,a,"next",t)}function a(t){u(s,r,n,o,a,"throw",t)}o(void 0)})}}function v(){return v=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},v.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,"")+"/"+i+".js":e.api_host?e.api_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":(console.error(h+" Cannot load "+i+".js: api_host is required"),"")})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn(h+" "+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)};var c="1.8.0",f="__vt_session",g="__vt_window_id",p="__vt_primary_window",_="__vt_user_state",m="__vt_device_id",w="__vt_anonymous_id",y="__vt_remote_config",b="__vt_distinct_id",S="__vt_user_properties",T="localStorage",x="localStorage+cookie",C="sessionStorage",k="memory",E="$initial_person_info";class I{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return v({token:t.token||""},t);var i=document.currentScript,e=v({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=v({},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 v({},this.config)}updateConfig(t){this.config=v({},this.config,t)}}function M(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function R(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function O(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 P(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 L(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function A(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 D=[w,m,b,_],j=31536e3,U=["herokuapp.com","vercel.app","netlify.app"];function B(t){var i;if(!t||"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 N{constructor(t){var i,e,r;this.memoryStorage=new Map,this.o=null,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(".");return!U.includes(e)}(),this.sameSite=null!==(e=t.sameSite)&&void 0!==e?e:"Lax",this.secure=null!==(r=t.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this.o)return this.o;if(void 0===t||!t.localStorage)return this.o=!1,!1;try{var i="__vt_ls_test__";t.localStorage.setItem(i,"1");var e="1"===t.localStorage.getItem(i);return t.localStorage.removeItem(i),this.o=e,e||console.warn("[vTilt] localStorage unavailable, using cookies"),e}catch(t){return this.o=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(t){return D.includes(t)}get(t){var i;try{switch(this.method){case k:return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;case x:return this.getLocalStoragePlusCookie(t);case T:return this.getLocalStorage(t);case C:return this.readFromSessionStorage(t);default:return this.getCookie(t)}}catch(i){return console.warn('[vTilt] Storage get error for "'+t+'":',i),null}}set(t,i,e){try{switch(this.method){case k:this.memoryStorage.set(t,i);break;case x:this.setLocalStoragePlusCookie(t,i,e);break;case T:this.setLocalStorage(t,i);break;case C:this.writeToSessionStorage(t,i);break;default:this.setCookie(t,i,null!=e?e:j)}}catch(i){console.warn('[vTilt] Storage set error for "'+t+'":',i)}}remove(t){try{switch(this.method){case k:this.memoryStorage.delete(t);break;case x:this.removeLocalStoragePlusCookie(t);break;case T:this.removeLocalStorage(t);break;case C:this.removeFromSessionStorage(t);break;default:this.removeCookie(t)}}catch(i){console.warn('[vTilt] Storage remove error for "'+t+'":',i)}}getLocalStoragePlusCookie(i){if(this.isCriticalProperty(i)){var e=this.getCookie(i),r=this.getLocalStorage(i);if(null!==e){if(r!==e&&this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){}return e}return r}return this.getLocalStorage(i)}setLocalStoragePlusCookie(t,i,e){this.setLocalStorage(t,i),this.isCriticalProperty(t)&&this.setCookie(t,i,null!=e?e:j)}removeLocalStoragePlusCookie(t){this.removeLocalStorage(t),this.isCriticalProperty(t)&&this.removeCookie(t)}getLocalStorage(i){var e;if(!this.isLocalStorageSupported())return null;try{return null!==(e=null==t?void 0:t.localStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}setLocalStorage(i,e){if(this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){console.warn("[vTilt] localStorage write error:",t)}}removeLocalStorage(i){if(this.isLocalStorageSupported())try{null==t||t.localStorage.removeItem(i)}catch(t){}}readFromSessionStorage(i){var e;try{return null!==(e=null==t?void 0:t.sessionStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}writeToSessionStorage(i,e){try{null==t||t.sessionStorage.setItem(i,e)}catch(t){console.warn("[vTilt] sessionStorage write error:",t)}}removeFromSessionStorage(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){}}getCookie(t){if("undefined"==typeof document)return null;var i=t+"=";for(var e of document.cookie.split(";")){var r=e.trim();if(r.startsWith(i))try{return decodeURIComponent(r.slice(i.length))}catch(t){return r.slice(i.length)}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=B(this.cross_subdomain),n=t+"="+encodeURIComponent(i)+"; Max-Age="+e+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(t){if("undefined"!=typeof document){var i=B(this.cross_subdomain);document.cookie=t+"=; Max-Age=0; path=/"+(i?"; domain="+i:""),document.cookie=t+"=; Max-Age=0; path=/"}}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=v({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)}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_ss_test__";return t.sessionStorage.setItem(i,"1"),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 q{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.m=void 0,this.S()}getSessionId(){var t=this.T();return t||(t=M(),this.C(t)),t}setSessionId(){var t=this.T()||M();return this.C(t),t}resetSessionId(){this.k(),this.setSessionId(),this.I(M())}T(){return this.storage.get(f)}C(t){this.storage.set(f,t,1800)}k(){this.storage.remove(f)}getWindowId(){if(this.m)return this.m;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(g);if(i)return this.m=i,i}var e=M();return this.I(e),e}I(t){if(t!==this.m){this.m=t;var i=this.storage.getSessionStorage();i&&i.setItem(g,t)}}S(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p),e=t.getItem(g);e&&!i?this.m=e:(e&&t.removeItem(g),this.I(M())),t.setItem(p,"true"),this.$()}else this.m=M()}$(){var i=this.storage.getSessionStorage();t&&i&&P(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(p)},{capture:!1})}updateStorageMethod(t,i){this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"})}}function z(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function F(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 W(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 g=u.join("&");return l+(g?"?"+g:"")+(s?"#"+s:"")}function V(t){return"function"==typeof t}var J="Mobile",H="iOS",X="Android",K="Tablet",G=X+" "+K,Q="iPad",Z="Apple",Y=Z+" Watch",tt="Safari",it="BlackBerry",et="Samsung",rt=et+"Browser",nt=et+" Internet",st="Chrome",ot=st+" OS",at=st+" "+H,lt="Internet Explorer",ht=lt+" "+J,ut="Opera",dt=ut+" Mini",vt="Edge",ct="Microsoft "+vt,ft="Firefox",gt=ft+" "+H,pt="Nintendo",_t="PlayStation",mt="Xbox",wt=X+" "+J,yt=J+" "+tt,bt="Windows",St=bt+" Phone",Tt="Nokia",xt="Ouya",Ct="Generic",kt=Ct+" "+J.toLowerCase(),Et=Ct+" "+K.toLowerCase(),It="Konqueror",$t="(\\d+(\\.\\d+)?)",Mt=new RegExp("Version/"+$t),Rt=new RegExp(mt,"i"),Ot=new RegExp(_t+" \\w+","i"),Pt=new RegExp(pt+" \\w+","i"),Lt=new RegExp(it+"|PlayBook|BB10","i"),At={"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 Dt(t,i){return t.toLowerCase().includes(i.toLowerCase())}var jt=(t,i)=>i&&Dt(i,Z)||function(t){return Dt(t,tt)&&!Dt(t,st)&&!Dt(t,X)}(t),Ut=function(t,i){return i=i||"",Dt(t," OPR/")&&Dt(t,"Mini")?dt:Dt(t," OPR/")?ut:Lt.test(t)?it:Dt(t,"IE"+J)||Dt(t,"WPDesktop")?ht:Dt(t,rt)?nt:Dt(t,vt)||Dt(t,"Edg/")?ct:Dt(t,"FBIOS")?"Facebook "+J:Dt(t,"UCWEB")||Dt(t,"UCBrowser")?"UC Browser":Dt(t,"CriOS")?at:Dt(t,"CrMo")||Dt(t,st)?st:Dt(t,X)&&Dt(t,tt)?wt:Dt(t,"FxiOS")?gt:Dt(t.toLowerCase(),It.toLowerCase())?It:jt(t,i)?Dt(t,J)?yt:tt:Dt(t,ft)?ft:Dt(t,"MSIE")||Dt(t,"Trident/")?lt:Dt(t,"Gecko")?ft:""},Bt={[ht]:[new RegExp("rv:"+$t)],[ct]:[new RegExp(vt+"?\\/"+$t)],[st]:[new RegExp("("+st+"|CrMo)\\/"+$t)],[at]:[new RegExp("CriOS\\/"+$t)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$t)],[tt]:[Mt],[yt]:[Mt],[ut]:[new RegExp("(Opera|OPR)\\/"+$t)],[ft]:[new RegExp(ft+"\\/"+$t)],[gt]:[new RegExp("FxiOS\\/"+$t)],[It]:[new RegExp("Konqueror[:/]?"+$t,"i")],[it]:[new RegExp(it+" "+$t),Mt],[wt]:[new RegExp("android\\s"+$t,"i")],[nt]:[new RegExp(rt+"\\/"+$t)],[lt]:[new RegExp("(rv:|MSIE )"+$t)],Mozilla:[new RegExp("rv:"+$t)]},Nt=function(t,i){var e=Ut(t,i),r=Bt[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},qt=[[new RegExp(mt+"; "+mt+" (.*?)[);]","i"),t=>[mt,t&&t[1]||""]],[new RegExp(pt,"i"),[pt,""]],[new RegExp(_t,"i"),[_t,""]],[Lt,[it,""]],[new RegExp(bt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[St,""];if(new RegExp(J).test(i)&&!/IEMobile\b/.test(i))return[bt+" "+J,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=At[r]||"";return/arm/i.test(i)&&(n="RT"),[bt,n]}return[bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[H,i.join(".")]}return[H,""]}],[/(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("("+X+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+X+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[X,i.join(".")]}return[X,""]}],[/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/,[ot,""]],[/Linux|debian/i,["Linux",""]]],zt=function(t){return Pt.test(t)?pt:Ot.test(t)?_t:Rt.test(t)?mt:new RegExp(xt,"i").test(t)?xt:new RegExp("("+St+"|WPDesktop)","i").test(t)?St:/iPad/.test(t)?Q:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Y:Lt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Tt,"i").test(t)?Tt:/(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(J).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)?X:G:X:new RegExp("(pda|"+J+")","i").test(t)?kt:new RegExp(K,"i").test(t)&&!new RegExp(K+" pc","i").test(t)?Et:""},Ft="https?://(.*)",Wt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Vt=A(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Wt),Jt="<masked>";function Ht(t){var i=function(t){return t?0===t.search(Ft+"google.([^/?]*)")?"google":0===t.search(Ft+"bing.com")?"bing":0===t.search(Ft+"yahoo.com")?"yahoo":0===t.search(Ft+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?F(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function Xt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Kt(){return(null==r?void 0:r.referrer)||"$direct"}function Gt(){var t;return(null==r?void 0:r.referrer)&&(null===(t=z(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function Qt(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=z(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=z(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=Vt.concat([]),e={};return O(i,function(i){var r=F(t,i);e[i]=r||null}),e}(r);L(n,o)}e&&L(n,Ht(e));return n}function Zt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Yt(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function ti(i,e){if(!a)return{};var r,s,o,[l,h]=function(t){for(var i=0;i<qt.length;i++){var[e,r]=qt[i],n=e.exec(t),s=n&&(V(r)?r(n,t):r);if(s)return s}return["",""]}(a);return L(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:Ut(a,navigator.vendor),$device:zt(a),$device_type:(s=a,o=zt(s),o===Q||o===G||"Kobo"===o||"Kindle Fire"===o||o===Et?K:o===pt||o===mt||o===_t||o===xt?"Console":o===Y?"Wearable":o?J:"Desktop"),$timezone:Zt(),$timezone_offset:Yt()}),{$current_url:W(null==n?void 0:n.href,[],Jt),$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:Nt(a,navigator.vendor),$browser_language:Xt(),$browser_language_prefix:(r=Xt(),"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:c,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class ii{constructor(t,i){void 0===t&&(t="localStorage"),this.M=null,this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return v({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(w,this.userIdentity.anonymous_id,j)),this.userIdentity.anonymous_id}getUserProperties(){return v({},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=v({},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=v({},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=v({},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=v({},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=v({},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=v({},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=v({},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?A([],Wt,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:Kt().substring(0,1e3),u:r?W(r,e,Jt):void 0}}(t,i);this.register_once({[E]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[E];return e?(t=Qt(e),i={},O(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:Kt(),$referring_domain:Gt()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(w),i=this.storage.get(m),e=this.storage.get(b),r=this.storage.get(_),n=this.getStoredUserProperties(),s=t||this.generateAnonymousId(),o=i||this.generateDeviceId(),a=e||null,l=r||"anonymous",h=s||this.generateAnonymousId();return t||this.storage.set(w,h,j),i||this.storage.set(m,o,j),r||this.storage.set(_,l,j),{distinct_id:a,anonymous_id:h,device_id:o,properties:n,user_state:l}}saveUserIdentity(){this.storage.set(w,this.userIdentity.anonymous_id,j),this.storage.set(m,this.userIdentity.device_id,j),this.storage.set(_,this.userIdentity.user_state,j),this.userIdentity.distinct_id?this.storage.set(b,this.userIdentity.distinct_id,j):this.storage.remove(b),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(S)||{}}setStoredUserProperties(t){this.storage.setJSON(S,t,j)}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_"+M()}generateDeviceId(){return"device_"+M()}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 N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var ei=["LCP","CLS","FCP","INP","TTFB"],ri=["LCP","CLS","FCP","INP"],ni=9e5,si="[WebVitals]";class oi{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||ri}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?ni:0===t?0:t<6e4?ni: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(si+" Failed to load web-vitals:",t);else{var i=this.getWebVitalsCallbacks();i?this.startCapturing(i):console.error(si+" web-vitals loaded but callbacks not registered")}}):console.warn(si+" 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(si+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(si+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.getCurrentUrl(),s=this.getCurrentPathname();if(!e)return void console.warn(si+" 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=v({},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(si+" Error adding metric to buffer:",t)}}cleanAttribution(t){if(t){var i=v({},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(si+" Error flushing metrics:",t)}this.buffer=this.createEmptyBuffer()}}}function ai(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return V(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class li{constructor(i){var e;this._instance=i,this.R=(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.O&&this.O(),this.O=void 0}monitorHistoryChanges(){var i,e;if(t&&n&&(this.R=n.pathname||"",t.history)){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||ai(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.P("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||ai(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.P("replaceState")}),this.L()}}P(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.R&&this.isEnabled){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.R=s}catch(t){console.error("Error capturing "+i+" pageview",t)}}L(){if(!this.O&&t){var i=()=>{this.P("popstate")};P(t,"popstate",i),this.O=()=>{t&&t.removeEventListener("popstate",i)}}}}var hi="[SessionRecording]";class ui{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.A=i}get started(){var t;return!!(null===(t=this.D)||void 0===t?void 0:t.isStarted)}get status(){var t;return(null===(t=this.D)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.D)||void 0===t?void 0:t.sessionId)||""}startIfEnabledOrStop(t){var i;if(!this.j||!(null===(i=this.D)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.j&&e?(this.U(t),console.info(hi+" starting")):this.stopRecording()}}stopRecording(){var t;null===(t=this.D)||void 0===t||t.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.D)||void 0===e?void 0:e.log)?this.D.log(t,i):console.warn(hi+" log called before recorder was ready")}updateConfig(t){var i;this.A=v({},this.A,t),null===(i=this.D)||void 0===i||i.updateConfig(this.A)}get j(){var i,e=this._instance.getConfig(),r=null!==(i=this.A.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.j)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.N(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(hi+" could not load recorder:",i):this.N(t)}):console.error(hi+" loadExternalDependency not available. Session recording cannot start.")}}N(t){var i,e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.D||(this.D=e(this._instance,this.A)),this.D.start(t)):console.error(hi+" initSessionRecording not available after script load")}}var di=(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))(di||{}),vi=Uint8Array,ci=Uint16Array,fi=Int32Array,gi=new vi([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]),pi=new vi([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]),_i=new vi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mi=function(t,i){for(var e=new ci(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new fi(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}},wi=mi(gi,2),yi=wi.b,bi=wi.r;yi[28]=258,bi[258]=28;for(var Si=mi(pi,0).r,Ti=new ci(32768),xi=0;xi<32768;++xi){var Ci=(43690&xi)>>1|(21845&xi)<<1;Ci=(61680&(Ci=(52428&Ci)>>2|(13107&Ci)<<2))>>4|(3855&Ci)<<4,Ti[xi]=((65280&Ci)>>8|(255&Ci)<<8)>>1}var ki=function(t,i,e){for(var r=t.length,n=0,s=new ci(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new ci(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new ci(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[Ti[d]>>l]=h}else for(o=new ci(r),n=0;n<r;++n)t[n]&&(o[n]=Ti[a[t[n]-1]++]>>15-t[n]);return o},Ei=new vi(288);for(xi=0;xi<144;++xi)Ei[xi]=8;for(xi=144;xi<256;++xi)Ei[xi]=9;for(xi=256;xi<280;++xi)Ei[xi]=7;for(xi=280;xi<288;++xi)Ei[xi]=8;var Ii=new vi(32);for(xi=0;xi<32;++xi)Ii[xi]=5;var $i=ki(Ei,9,0),Mi=ki(Ii,5,0),Ri=function(t){return(t+7)/8|0},Oi=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new vi(t.subarray(i,e))},Pi=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},Li=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},Ai=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:zi,l:0};if(1==n){var o=new vi(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 ci(v+1),f=Di(e[u-1],c,0);if(f>i){r=0;var g=0,p=f-i,_=1<<p;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;g+=_-(1<<f-c[m]),c[m]=i}for(g>>=p;g>0;){var w=s[r].s;c[w]<i?g-=1<<i-c[w]++-1:++r}for(;r>=0&&g;--r){var y=s[r].s;c[y]==i&&(--c[y],++g)}f=i}return{t:new vi(c),l:f}},Di=function(t,i,e){return-1==t.s?Math.max(Di(t.l,i,e+1),Di(t.r,i,e+1)):i[t.s]=e},ji=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new ci(++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}},Ui=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Bi=function(t,i,e){var r=e.length,n=Ri(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)},Ni=function(t,i,e,r,n,s,o,a,l,h,u){Pi(i,u++,e),++n[256];for(var d=Ai(n,15),v=d.t,c=d.l,f=Ai(s,15),g=f.t,p=f.l,_=ji(v),m=_.c,w=_.n,y=ji(g),b=y.c,S=y.n,T=new ci(19),x=0;x<m.length;++x)++T[31&m[x]];for(x=0;x<b.length;++x)++T[31&b[x]];for(var C=Ai(T,7),k=C.t,E=C.l,I=19;I>4&&!k[_i[I-1]];--I);var M,R,O,P,L=h+5<<3,A=Ui(n,Ei)+Ui(s,Ii)+o,D=Ui(n,v)+Ui(s,g)+o+14+3*I+Ui(T,k)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&L<=A&&L<=D)return Bi(i,u,t.subarray(l,l+h));if(Pi(i,u,1+(D<A)),u+=2,D<A){M=ki(v,c,0),R=v,O=ki(g,p,0),P=g;var j=ki(k,E,0);Pi(i,u,w-257),Pi(i,u+5,S-1),Pi(i,u+10,I-4),u+=14;for(x=0;x<I;++x)Pi(i,u+3*x,k[_i[x]]);u+=3*I;for(var U=[m,b],B=0;B<2;++B){var N=U[B];for(x=0;x<N.length;++x){var q=31&N[x];Pi(i,u,j[q]),u+=k[q],q>15&&(Pi(i,u,N[x]>>5&127),u+=N[x]>>12)}}}else M=$i,R=Ei,O=Mi,P=Ii;for(x=0;x<a;++x){var z=r[x];if(z>255){Li(i,u,M[(q=z>>18&31)+257]),u+=R[q+257],q>7&&(Pi(i,u,z>>23&31),u+=gi[q]);var F=31&z;Li(i,u,O[F]),u+=P[F],F>3&&(Li(i,u,z>>5&8191),u+=pi[F])}else Li(i,u,M[z]),u+=R[z]}return Li(i,u,M[256]),u+R[256]},qi=new fi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zi=new vi(0),Fi=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}(),Wi=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new vi(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 vi(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=qi[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,g=s.p||new ci(32768),p=s.h||new ci(f+1),_=Math.ceil(e/3),m=2*_,w=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new fi(25e3),b=new ci(288),S=new ci(32),T=0,x=0,C=s.i||0,k=0,E=s.w||0,I=0;C+2<o;++C){var M=w(C),R=32767&C,O=p[M];if(g[R]=O,p[M]=R,E<=C){var P=o-C;if((T>7e3||k>24576)&&(P>423||!h)){u=Ni(t,l,0,y,b,S,x,k,I,C-I,u),k=T=x=0,I=C;for(var L=0;L<286;++L)b[L]=0;for(L=0;L<30;++L)S[L]=0}var A=2,D=0,j=c,U=R-O&32767;if(P>2&&M==w(C-U))for(var B=Math.min(v,P)-1,N=Math.min(32767,C),q=Math.min(258,P);U<=N&&--j&&R!=O;){if(t[C+A]==t[C+A-U]){for(var z=0;z<q&&t[C+z]==t[C+z-U];++z);if(z>A){if(A=z,D=U,z>B)break;var F=Math.min(U,z-2),W=0;for(L=0;L<F;++L){var V=C-U+L&32767,J=V-g[V]&32767;J>W&&(W=J,O=V)}}}U+=(R=O)-(O=g[R])&32767}if(D){y[k++]=268435456|bi[A]<<18|Si[D];var H=31&bi[A],X=31&Si[D];x+=gi[H]+pi[X],++b[257+H],++S[X],E=C+A,++T}else y[k++]=t[C],++b[t[C]]}}for(C=Math.max(C,E);C<o;++C)y[k++]=t[C],++b[t[C]];u=Ni(t,l,h,y,b,S,x,k,I,C-I,u),h||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=p,s.p=g,s.i=C,s.w=E)}else{for(C=s.w||0;C<o+h;C+=65535){var K=C+65535;K>=o&&(l[u/8|0]=h,K=o),u=Bi(l,u+1,t.subarray(C,K))}s.i=o}return Oi(a,0,r+Ri(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)},Vi=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ji(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=Fi[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=Wi(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&&Vi(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),Vi(s,o-8,e.d()),Vi(s,o-4,r),s}var Hi="undefined"!=typeof TextEncoder&&new TextEncoder,Xi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Xi.decode(zi,{stream:!0})}catch(t){}di.MouseMove,di.MouseInteraction,di.Scroll,di.ViewportResize,di.Input,di.TouchMove,di.MediaInteraction,di.Drag;var Ki="[Chat]";class Gi{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.q=null,this.F=!1,this.W=!1,this.V=null,this.J=[],this.H=[],this.X=[],this.K=[],this.G=[],this.A=i}get isOpen(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isOpen)&&void 0!==i&&i}get isConnected(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isConnected)&&void 0!==i&&i}get isLoading(){var t,i;return this.W||null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isLoading)&&void 0!==i&&i}get unreadCount(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.unreadCount)&&void 0!==i?i:0}get channel(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.channel)&&void 0!==i?i:null}get channels(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.channels)&&void 0!==i?i:[]}get currentView(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.currentView)&&void 0!==i?i:"list"}open(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.open()})}close(){var t;null===(t=this.Z)||void 0===t||t.close()}toggle(){this.Z?this.Z.toggle():this.open()}show(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.show()})}hide(){var t;null===(t=this.Z)||void 0===t||t.hide()}getChannels(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.getChannels()})}selectChannel(t){this.Y(()=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.selectChannel(t)})}createChannel(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.createChannel()})}goToChannelList(){var t;null===(t=this.Z)||void 0===t||t.goToChannelList()}sendMessage(t){this.Z?this.Z.sendMessage(t):(this.J.push(t),this.Y(()=>{this.J.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.sendMessage(t)}),this.J=[]}))}markAsRead(){var t;null===(t=this.Z)||void 0===t||t.markAsRead()}onMessage(t){return this.X.push(t),this.Z?this.Z.onMessage(t):()=>{var i=this.X.indexOf(t);i>-1&&this.X.splice(i,1)}}onTyping(t){return this.K.push(t),this.Z?this.Z.onTyping(t):()=>{var i=this.K.indexOf(t);i>-1&&this.K.splice(i,1)}}onConnectionChange(t){return this.G.push(t),this.Z?this.Z.onConnectionChange(t):()=>{var i=this.G.indexOf(t);i>-1&&this.G.splice(i,1)}}startIfEnabled(){var t=this;return d(function*(){var i,e,r,n;!1!==t.A.enabled?t._instance.getConfig().disable_chat?console.info(Ki+" disabled by disable_chat config"):(!1!==t.A.autoConfig&&(yield t.tt()),t.it?(null!==(r=null!==(i=t.A.preload)&&void 0!==i?i:null===(e=t.q)||void 0===e?void 0:e.enabled)&&void 0!==r&&r&&t.et(),(null===(n=t.q)||void 0===n?void 0:n.enabled)&&t.rt(),console.info(Ki+" ready (lazy-load on demand)")):console.info(Ki+" not enabled (check dashboard settings)")):console.info(Ki+" disabled by code config")})()}updateConfig(t){this.A=v({},this.A,t)}getMergedConfig(){var t,i,e,r,n,s,o,a,l,h,u,d,v,c,f,g,p,_,m=this.q,w=this.A;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!==(g=w.offlineMessage)&&void 0!==g?g:null==m?void 0:m.offline_message,collectEmailOffline:null===(_=null!==(p=w.collectEmailOffline)&&void 0!==p?p:null==m?void 0:m.collect_email_offline)||void 0===_||_}}destroy(){var t;null===(t=this.Z)||void 0===t||t.destroy(),this.Z=void 0,this.J=[],this.H=[],this.X=[],this.K=[],this.G=[]}get it(){var t;return!1!==this.A.enabled&&(!0===this.A.enabled||!0===(null===(t=this.q)||void 0===t?void 0:t.enabled))}tt(){var t=this;return d(function*(){if(!t.F){var i=t._instance.getConfig(),e=i.token,r=i.api_host;if(!e||!r)return console.warn(Ki+" Cannot fetch settings: missing token or api_host"),void(t.F=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(e),s=yield fetch(n);if(!s.ok)return console.warn(Ki+" Failed to fetch settings: "+s.status),void(t.F=!0);t.q=yield s.json(),t.F=!0,console.info(Ki+" Loaded settings from dashboard")}catch(i){console.warn(Ki+" Error fetching settings:",i),t.F=!0}}})()}rt(){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"}et(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this.nt(),{timeout:5e3}):setTimeout(()=>this.nt(),3e3)}Y(t){this.Z?t():(this.H.push(t),this.nt())}nt(){var t,i;if(!(this.W||this.Z||this.V))if(null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat)this.N();else{this.W=!0;var e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.loadExternalDependency;if(!e)return console.error(Ki+" loadExternalDependency not available. Chat cannot start."),this.W=!1,void(this.V="loadExternalDependency not available");e(this._instance,this.B,t=>{if(this.W=!1,t)return console.error(Ki+" Failed to load:",t),void(this.V=String(t));this.N()})}}N(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat;if(!i)return console.error(Ki+" initChat not available after script load"),void(this.V="initChat not available");if(!this.Z){var e=this.getMergedConfig();this.Z=i(this._instance,e),this.X.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.onMessage(t)}),this.K.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.onTyping(t)}),this.G.forEach(t=>{var i;return null===(i=this.Z)||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.H.forEach(t=>t()),this.H=[],console.info(Ki+" loaded and ready")}}var Qi,Zi="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Qi||(Qi={}));var Yi=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===Qi.GZipJS&&n>=1024)try{var s=Ji(function(t,i){if(Hi)return Hi.encode(t);for(var e=t.length,r=new vi(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 vi(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 Oi(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Zi});if(o.size<.95*n)return{contentType:Zi,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},te=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Yi(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Qi.GZipJS&&e===Zi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=v({"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=d(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=Yi(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Qi.GZipJS&&e===Zi?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=Yi(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Qi.GZipJS&&e===Zi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],ie=t=>{var i,e=t.transport||"fetch",r=te.find(t=>t.name===e&&t.available)||te.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 ee{constructor(t,i){var e,r,n,s;this.st=!0,this.ot=[],this.lt=(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.ht=t}get length(){return this.ot.length}enqueue(t){this.ot.push(t),this.ut||this.dt()}unload(){if(this.vt(),0!==this.ot.length){var t=this.ct();for(var i in t){var e=t[i];this.ht(v({},e,{transport:"sendBeacon"}))}}}enable(){this.st=!1,this.dt()}pause(){this.st=!0,this.vt()}flush(){this.vt(),this.ft(),this.dt()}dt(){this.st||(this.ut=setTimeout(()=>{this.vt(),this.ft(),this.ot.length>0&&this.dt()},this.lt))}vt(){this.ut&&(clearTimeout(this.ut),this.ut=void 0)}ft(){if(0!==this.ot.length){var t=this.ct(),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.ht(r)}}}ct(){var t={};return this.ot.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.ot=[],t}}class re{constructor(i){this.gt=!1,this._t=3e3,this.ot=[],this.wt=!0,this.ht=i.sendRequest,this.yt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this.wt=e.onLine,P(t,"online",()=>{this.wt=!0,this.bt()}),P(t,"offline",()=>{this.wt=!1}))}get length(){return this.ot.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.ot.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this.wt||(n+=" (Browser is offline)"),console.warn(n),this.gt||(this.gt=!0,this.St())}}retriableRequest(t){var i=this;return d(function*(){try{var e=yield i.ht(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}St(){this.Tt&&clearTimeout(this.Tt),this.Tt=setTimeout(()=>{this.wt&&this.ot.length>0&&this.bt(),this.ot.length>0?this.St():this.gt=!1},this._t)}bt(){var t=this,i=Date.now(),e=[],r=[];this.ot.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.ot=e,r.forEach(function(){var i=d(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.ht(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.Tt&&(clearTimeout(this.Tt),this.Tt=void 0),this.ot.forEach(t=>{var{request:i}=t;try{this.yt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.ot=[]}}var ne="vt_rate_limit";class se{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(ne))&&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(ne,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class oe{constructor(t){void 0===t&&(t={}),this.version=c,this.__loaded=!1,this.xt=!1,this.Ct=null,this.__request_queue=[],this.kt=!1,this.Et=!1,this.It=null,this.configManager=new I(t);var i=this.configManager.getConfig();this.sessionManager=new q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new ii(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.webVitalsManager=new oi(i,this),this.rateLimiter=new se({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.$t("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new re({sendRequest:t=>this.Mt(t),sendBeacon:t=>this.Rt(t)}),this.requestQueue=new ee(t=>this.Ot(t),{flush_interval_ms:3e3})}init(t,i,e){var r;if(e&&e!==le){var n=null!==(r=ae[e])&&void 0!==r?r:new oe;return n._init(t,i,e),ae[e]=n,ae[le][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(v({},i,{projectId:t||i.projectId,name:e})),this.__loaded=!0,this.Pt();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 li(this),this.historyAutocapture.startIfEnabled(),this.Lt(),this.At(),this.Dt(),this.jt(),!1!==r.capture_pageview&&this.Ut(),this}jt(){this.requestQueue.enable()}Dt(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};P(t,"beforeunload",i),P(t,"pagehide",i)}}Pt(){var i,e=this.configManager.getConfig();if(e.projectId){if(null===(i=e.bootstrap)||void 0===i?void 0:i.remoteConfig)return this.It=e.bootstrap.remoteConfig,this.Bt(this.It),void this.Nt();try{var r=t.__VTILT_BOOTSTRAP__;if(null==r?void 0:r.remoteConfig)return this.It=r.remoteConfig,this.Bt(this.It),void this.Nt()}catch(t){}try{var n=localStorage.getItem(y+"_"+e.projectId);n&&(this.It=JSON.parse(n),this.Bt(this.It))}catch(t){}this.Nt()}}Nt(){var t=this.configManager.getConfig();if(t.projectId&&t.api_host){var i=t.api_host+"/api/projects/"+t.projectId+"/decide",e=new AbortController,r=setTimeout(()=>e.abort(),3e3);(s||fetch)(i,{method:"GET",signal:e.signal,headers:{Accept:"application/json"}}).then(t=>t.json()).then(i=>{clearTimeout(r),this.It=i;try{localStorage.setItem(y+"_"+t.projectId,JSON.stringify(i))}catch(t){}this.Bt(i)}).catch(()=>{clearTimeout(r)})}}Bt(t){var i,e,r=this.configManager.getConfig(),n={},s=!1,o=!1;if(t.sessionRecording&&void 0===r.session_recording&&(n.session_recording={enabled:t.sessionRecording.enabled,sampleRate:t.sessionRecording.sampleRate,minimumDurationMs:t.sessionRecording.minimumDurationMs,maskAllInputs:t.sessionRecording.maskAllInputs,captureConsole:t.sessionRecording.captureConsole,captureCanvas:t.sessionRecording.captureCanvas},t.sessionRecording.enabled&&(s=!0)),(null===(i=t.chat)||void 0===i?void 0:i.enabled)&&void 0===r.chat&&(n.chat={enabled:t.chat.enabled,position:t.chat.widgetPosition,color:t.chat.widgetColor},o=!0),t.analytics&&(void 0!==t.analytics.capturePageview&&void 0===r.capture_pageview&&(n.capture_pageview=t.analytics.capturePageview),void 0!==t.analytics.capturePageleave&&void 0===r.capture_pageleave&&(n.capture_pageleave=!!t.analytics.capturePageleave),void 0!==t.analytics.capturePerformance&&void 0===r.capture_performance&&(n.capture_performance=t.analytics.capturePerformance),void 0!==t.analytics.autocapture&&void 0===r.autocapture&&(n.autocapture=t.analytics.autocapture)),void 0!==(null===(e=t.privacy)||void 0===e?void 0:e.respectDnt)&&void 0===r.respect_dnt&&(n.respect_dnt=t.privacy.respectDnt),Object.keys(n).length>0&&this.updateConfig(n),s&&this.__loaded&&this.startSessionRecording(),o&&this.__loaded)if(this.chat){var a=this.qt(this.configManager.getConfig());this.chat.updateConfig(a),this.chat.startIfEnabled()}else this.At()}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:le;return i!==le&&(i=le+"."+i),i}getCurrentDomain(){if(!n)return"";var t=n.protocol,i=n.hostname,e=n.port;return t+"//"+i+(e?":"+e:"")}zt(){var t=this.configManager.getConfig();return!(!t.projectId||!t.token)||(this.kt||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.kt=!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.zt()){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})}}Ot(t){var{transport:i}=t;"sendBeacon"!==i?this.retryQueue.retriableRequest(t):this.Rt(t)}Mt(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?Qi.None:Qi.GZipJS;ie({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>{i({statusCode:t.statusCode})}})})}Rt(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;ie({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}Ft(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=ti(),a=this.userManager.getUserProperties(),l=this.userManager.get_initial_props(),h=this.sessionManager.getSessionId(),u=this.sessionManager.getWindowId(),d=this.userManager.getAnonymousId(),c={};!this.Et&&Object.keys(l).length>0&&Object.assign(c,l),i.$set_once&&Object.assign(c,i.$set_once);var f=v({},o,a,{$session_id:h,$window_id:u},d?{$anon_distinct_id:d}:{},Object.keys(c).length>0?{$set_once:c}:{},i.$set?{$set:i.$set}:{},i);!this.Et&&Object.keys(l).length>0&&(this.Et=!0),"$pageview"===t&&r&&(f.title=r.title);var g,p,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(g=Object.assign({},f,_.globalAttributes),!R(g=JSON.stringify(g)))return}else if(g=Object.assign({},f,_.globalAttributes),!R(JSON.stringify(g)))return;p="$identify"===t?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var m={timestamp:(new Date).toISOString(),event:t,project_id:_.projectId||"",payload:g,distinct_id:p,anonymous_id:d};this.sendRequest(s,m,!0)}}$t(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)}Ut(){r&&("visible"===r.visibilityState?this.xt||(this.xt=!0,setTimeout(()=>{if(r&&n){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.Ct&&(r.removeEventListener("visibilitychange",this.Ct),this.Ct=null)):this.Ct||(this.Ct=()=>{this.Ut()},P(r,"visibilitychange",this.Ct)))}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 q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new ii(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.webVitalsManager=new oi(i,this),this.sessionRecording&&i.session_recording&&this.sessionRecording.updateConfig(this.Wt(i))}Lt(){if(!this.sessionRecording){var t=this.configManager.getConfig();if(!t.disable_session_recording){var i=this.Wt(t);this.sessionRecording=new ui(this,i),i.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}}Wt(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(){var t=this.configManager.getConfig(),i=this.Wt(t);i.enabled=!0,this.sessionRecording?this.sessionRecording.updateConfig(i):this.sessionRecording=new ui(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}At(){if(!this.chat){var t=this.configManager.getConfig();if(!t.disable_chat){var i=this.qt(t);this.chat=new Gi(this,i),this.chat.startIfEnabled()}}}qt(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.Ft(t)}),this.__request_queue=[],this.jt()}}var ae={},le="vt",he=!(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=he);var ue,de=(ue=ae[le]=new oe,function(){function i(){i.done||(i.done=!0,he=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),O(ae,function(t){t._dom_loaded()}))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():P(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),ue);export{ei as ALL_WEB_VITALS_METRICS,ri as DEFAULT_WEB_VITALS_METRICS,oe as VTilt,de as default,de 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:{},h="[ExternalScriptsLoader]";function u(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 d(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){u(s,r,n,o,a,"next",t)}function a(t){u(s,r,n,o,a,"throw",t)}o(void 0)})}}function v(){return v=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},v.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,"")+"/"+i+".js":e.api_host?e.api_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":(console.error(h+" Cannot load "+i+".js: api_host is required"),"")})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn(h+" "+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)};var c="1.9.0",f="__vt_session",g="__vt_window_id",p="__vt_primary_window",_="__vt_user_state",m="__vt_device_id",w="__vt_anonymous_id",y="__vt_remote_config",b="__vt_distinct_id",S="__vt_user_properties",T="localStorage",x="localStorage+cookie",C="sessionStorage",k="memory",E="$initial_person_info";class I{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return v({token:t.token||""},t);var i=document.currentScript,e=v({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=v({},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 v({},this.config)}updateConfig(t){this.config=v({},this.config,t)}}function M(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function R(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function O(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 P(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 L(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function A(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 D=[w,m,b,_],U=31536e3,j=["herokuapp.com","vercel.app","netlify.app"];function B(t){var i;if(!t||"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 N{constructor(t){var i,e,r;this.memoryStorage=new Map,this.o=null,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(".");return!j.includes(e)}(),this.sameSite=null!==(e=t.sameSite)&&void 0!==e?e:"Lax",this.secure=null!==(r=t.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this.o)return this.o;if(void 0===t||!t.localStorage)return this.o=!1,!1;try{var i="__vt_ls_test__";t.localStorage.setItem(i,"1");var e="1"===t.localStorage.getItem(i);return t.localStorage.removeItem(i),this.o=e,e||console.warn("[vTilt] localStorage unavailable, using cookies"),e}catch(t){return this.o=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(t){return D.includes(t)}get(t){var i;try{switch(this.method){case k:return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;case x:return this.getLocalStoragePlusCookie(t);case T:return this.getLocalStorage(t);case C:return this.readFromSessionStorage(t);default:return this.getCookie(t)}}catch(i){return console.warn('[vTilt] Storage get error for "'+t+'":',i),null}}set(t,i,e){try{switch(this.method){case k:this.memoryStorage.set(t,i);break;case x:this.setLocalStoragePlusCookie(t,i,e);break;case T:this.setLocalStorage(t,i);break;case C:this.writeToSessionStorage(t,i);break;default:this.setCookie(t,i,null!=e?e:U)}}catch(i){console.warn('[vTilt] Storage set error for "'+t+'":',i)}}remove(t){try{switch(this.method){case k:this.memoryStorage.delete(t);break;case x:this.removeLocalStoragePlusCookie(t);break;case T:this.removeLocalStorage(t);break;case C:this.removeFromSessionStorage(t);break;default:this.removeCookie(t)}}catch(i){console.warn('[vTilt] Storage remove error for "'+t+'":',i)}}getLocalStoragePlusCookie(i){if(this.isCriticalProperty(i)){var e=this.getCookie(i),r=this.getLocalStorage(i);if(null!==e){if(r!==e&&this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){}return e}return r}return this.getLocalStorage(i)}setLocalStoragePlusCookie(t,i,e){this.setLocalStorage(t,i),this.isCriticalProperty(t)&&this.setCookie(t,i,null!=e?e:U)}removeLocalStoragePlusCookie(t){this.removeLocalStorage(t),this.isCriticalProperty(t)&&this.removeCookie(t)}getLocalStorage(i){var e;if(!this.isLocalStorageSupported())return null;try{return null!==(e=null==t?void 0:t.localStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}setLocalStorage(i,e){if(this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){console.warn("[vTilt] localStorage write error:",t)}}removeLocalStorage(i){if(this.isLocalStorageSupported())try{null==t||t.localStorage.removeItem(i)}catch(t){}}readFromSessionStorage(i){var e;try{return null!==(e=null==t?void 0:t.sessionStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}writeToSessionStorage(i,e){try{null==t||t.sessionStorage.setItem(i,e)}catch(t){console.warn("[vTilt] sessionStorage write error:",t)}}removeFromSessionStorage(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){}}getCookie(t){if("undefined"==typeof document)return null;var i=t+"=";for(var e of document.cookie.split(";")){var r=e.trim();if(r.startsWith(i))try{return decodeURIComponent(r.slice(i.length))}catch(t){return r.slice(i.length)}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=B(this.cross_subdomain),n=t+"="+encodeURIComponent(i)+"; Max-Age="+e+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(t){if("undefined"!=typeof document){var i=B(this.cross_subdomain);document.cookie=t+"=; Max-Age=0; path=/"+(i?"; domain="+i:""),document.cookie=t+"=; Max-Age=0; path=/"}}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=v({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)}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_ss_test__";return t.sessionStorage.setItem(i,"1"),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 q{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.m=void 0,this.S()}getSessionId(){var t=this.T();return t||(t=M(),this.C(t)),t}setSessionId(){var t=this.T()||M();return this.C(t),t}resetSessionId(){this.k(),this.setSessionId(),this.I(M())}T(){return this.storage.get(f)}C(t){this.storage.set(f,t,1800)}k(){this.storage.remove(f)}getWindowId(){if(this.m)return this.m;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(g);if(i)return this.m=i,i}var e=M();return this.I(e),e}I(t){if(t!==this.m){this.m=t;var i=this.storage.getSessionStorage();i&&i.setItem(g,t)}}S(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p),e=t.getItem(g);e&&!i?this.m=e:(e&&t.removeItem(g),this.I(M())),t.setItem(p,"true"),this.$()}else this.m=M()}$(){var i=this.storage.getSessionStorage();t&&i&&P(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(p)},{capture:!1})}updateStorageMethod(t,i){this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"})}}function z(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function F(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 W(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 g=u.join("&");return l+(g?"?"+g:"")+(s?"#"+s:"")}function V(t){return"function"==typeof t}var J="Mobile",H="iOS",X="Android",K="Tablet",G=X+" "+K,Q="iPad",Z="Apple",Y=Z+" Watch",tt="Safari",it="BlackBerry",et="Samsung",rt=et+"Browser",nt=et+" Internet",st="Chrome",ot=st+" OS",at=st+" "+H,lt="Internet Explorer",ht=lt+" "+J,ut="Opera",dt=ut+" Mini",vt="Edge",ct="Microsoft "+vt,ft="Firefox",gt=ft+" "+H,pt="Nintendo",_t="PlayStation",mt="Xbox",wt=X+" "+J,yt=J+" "+tt,bt="Windows",St=bt+" Phone",Tt="Nokia",xt="Ouya",Ct="Generic",kt=Ct+" "+J.toLowerCase(),Et=Ct+" "+K.toLowerCase(),It="Konqueror",$t="(\\d+(\\.\\d+)?)",Mt=new RegExp("Version/"+$t),Rt=new RegExp(mt,"i"),Ot=new RegExp(_t+" \\w+","i"),Pt=new RegExp(pt+" \\w+","i"),Lt=new RegExp(it+"|PlayBook|BB10","i"),At={"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 Dt(t,i){return t.toLowerCase().includes(i.toLowerCase())}var Ut=(t,i)=>i&&Dt(i,Z)||function(t){return Dt(t,tt)&&!Dt(t,st)&&!Dt(t,X)}(t),jt=function(t,i){return i=i||"",Dt(t," OPR/")&&Dt(t,"Mini")?dt:Dt(t," OPR/")?ut:Lt.test(t)?it:Dt(t,"IE"+J)||Dt(t,"WPDesktop")?ht:Dt(t,rt)?nt:Dt(t,vt)||Dt(t,"Edg/")?ct:Dt(t,"FBIOS")?"Facebook "+J:Dt(t,"UCWEB")||Dt(t,"UCBrowser")?"UC Browser":Dt(t,"CriOS")?at:Dt(t,"CrMo")||Dt(t,st)?st:Dt(t,X)&&Dt(t,tt)?wt:Dt(t,"FxiOS")?gt:Dt(t.toLowerCase(),It.toLowerCase())?It:Ut(t,i)?Dt(t,J)?yt:tt:Dt(t,ft)?ft:Dt(t,"MSIE")||Dt(t,"Trident/")?lt:Dt(t,"Gecko")?ft:""},Bt={[ht]:[new RegExp("rv:"+$t)],[ct]:[new RegExp(vt+"?\\/"+$t)],[st]:[new RegExp("("+st+"|CrMo)\\/"+$t)],[at]:[new RegExp("CriOS\\/"+$t)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$t)],[tt]:[Mt],[yt]:[Mt],[ut]:[new RegExp("(Opera|OPR)\\/"+$t)],[ft]:[new RegExp(ft+"\\/"+$t)],[gt]:[new RegExp("FxiOS\\/"+$t)],[It]:[new RegExp("Konqueror[:/]?"+$t,"i")],[it]:[new RegExp(it+" "+$t),Mt],[wt]:[new RegExp("android\\s"+$t,"i")],[nt]:[new RegExp(rt+"\\/"+$t)],[lt]:[new RegExp("(rv:|MSIE )"+$t)],Mozilla:[new RegExp("rv:"+$t)]},Nt=function(t,i){var e=jt(t,i),r=Bt[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},qt=[[new RegExp(mt+"; "+mt+" (.*?)[);]","i"),t=>[mt,t&&t[1]||""]],[new RegExp(pt,"i"),[pt,""]],[new RegExp(_t,"i"),[_t,""]],[Lt,[it,""]],[new RegExp(bt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[St,""];if(new RegExp(J).test(i)&&!/IEMobile\b/.test(i))return[bt+" "+J,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=At[r]||"";return/arm/i.test(i)&&(n="RT"),[bt,n]}return[bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[H,i.join(".")]}return[H,""]}],[/(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("("+X+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+X+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[X,i.join(".")]}return[X,""]}],[/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/,[ot,""]],[/Linux|debian/i,["Linux",""]]],zt=function(t){return Pt.test(t)?pt:Ot.test(t)?_t:Rt.test(t)?mt:new RegExp(xt,"i").test(t)?xt:new RegExp("("+St+"|WPDesktop)","i").test(t)?St:/iPad/.test(t)?Q:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Y:Lt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Tt,"i").test(t)?Tt:/(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(J).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)?X:G:X:new RegExp("(pda|"+J+")","i").test(t)?kt:new RegExp(K,"i").test(t)&&!new RegExp(K+" pc","i").test(t)?Et:""},Ft="https?://(.*)",Wt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Vt=A(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Wt),Jt="<masked>";function Ht(t){var i=function(t){return t?0===t.search(Ft+"google.([^/?]*)")?"google":0===t.search(Ft+"bing.com")?"bing":0===t.search(Ft+"yahoo.com")?"yahoo":0===t.search(Ft+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?F(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function Xt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Kt(){return(null==r?void 0:r.referrer)||"$direct"}function Gt(){var t;return(null==r?void 0:r.referrer)&&(null===(t=z(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function Qt(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=z(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=z(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=Vt.concat([]),e={};return O(i,function(i){var r=F(t,i);e[i]=r||null}),e}(r);L(n,o)}e&&L(n,Ht(e));return n}function Zt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Yt(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function ti(i,e){if(!a)return{};var r,s,o,[l,h]=function(t){for(var i=0;i<qt.length;i++){var[e,r]=qt[i],n=e.exec(t),s=n&&(V(r)?r(n,t):r);if(s)return s}return["",""]}(a);return L(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:jt(a,navigator.vendor),$device:zt(a),$device_type:(s=a,o=zt(s),o===Q||o===G||"Kobo"===o||"Kindle Fire"===o||o===Et?K:o===pt||o===mt||o===_t||o===xt?"Console":o===Y?"Wearable":o?J:"Desktop"),$timezone:Zt(),$timezone_offset:Yt()}),{$current_url:W(null==n?void 0:n.href,[],Jt),$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:Nt(a,navigator.vendor),$browser_language:Xt(),$browser_language_prefix:(r=Xt(),"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:c,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class ii{constructor(t,i){void 0===t&&(t="localStorage"),this.M=null,this.storage=new N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return v({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(w,this.userIdentity.anonymous_id,U)),this.userIdentity.anonymous_id}getUserProperties(){return v({},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=v({},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=v({},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=v({},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=v({},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=v({},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=v({},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=v({},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?A([],Wt,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:Kt().substring(0,1e3),u:r?W(r,e,Jt):void 0}}(t,i);this.register_once({[E]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[E];return e?(t=Qt(e),i={},O(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:Kt(),$referring_domain:Gt()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(w),i=this.storage.get(m),e=this.storage.get(b),r=this.storage.get(_),n=this.getStoredUserProperties(),s=t||this.generateAnonymousId(),o=i||this.generateDeviceId(),a=e||null,l=r||"anonymous",h=s||this.generateAnonymousId();return t||this.storage.set(w,h,U),i||this.storage.set(m,o,U),r||this.storage.set(_,l,U),{distinct_id:a,anonymous_id:h,device_id:o,properties:n,user_state:l}}saveUserIdentity(){this.storage.set(w,this.userIdentity.anonymous_id,U),this.storage.set(m,this.userIdentity.device_id,U),this.storage.set(_,this.userIdentity.user_state,U),this.userIdentity.distinct_id?this.storage.set(b,this.userIdentity.distinct_id,U):this.storage.remove(b),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(S)||{}}setStoredUserProperties(t){this.storage.setJSON(S,t,U)}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_"+M()}generateDeviceId(){return"device_"+M()}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 N({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var ei=["LCP","CLS","FCP","INP","TTFB"],ri=["LCP","CLS","FCP","INP"],ni=9e5,si="[WebVitals]";class oi{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||ri}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?ni:0===t?0:t<6e4?ni: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(si+" Failed to load web-vitals:",t);else{var i=this.getWebVitalsCallbacks();i?this.startCapturing(i):console.error(si+" web-vitals loaded but callbacks not registered")}}):console.warn(si+" 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(si+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(si+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.getCurrentUrl(),s=this.getCurrentPathname();if(!e)return void console.warn(si+" 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=v({},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(si+" Error adding metric to buffer:",t)}}cleanAttribution(t){if(t){var i=v({},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(si+" Error flushing metrics:",t)}this.buffer=this.createEmptyBuffer()}}}function ai(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return V(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class li{constructor(i){var e;this._instance=i,this.R=(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.O&&this.O(),this.O=void 0}monitorHistoryChanges(){var i,e;if(t&&n&&(this.R=n.pathname||"",t.history)){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||ai(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.P("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||ai(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.P("replaceState")}),this.L()}}P(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.R&&this.isEnabled){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.R=s}catch(t){console.error("Error capturing "+i+" pageview",t)}}L(){if(!this.O&&t){var i=()=>{this.P("popstate")};P(t,"popstate",i),this.O=()=>{t&&t.removeEventListener("popstate",i)}}}}var hi="[SessionRecording]";class ui{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.A=i}get started(){var t;return!!(null===(t=this.D)||void 0===t?void 0:t.isStarted)}get status(){var t;return(null===(t=this.D)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.D)||void 0===t?void 0:t.sessionId)||""}startIfEnabledOrStop(t){var i;if(!this.U||!(null===(i=this.D)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.U&&e?(this.j(t),console.info(hi+" starting")):this.stopRecording()}}stopRecording(){var t;null===(t=this.D)||void 0===t||t.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.D)||void 0===e?void 0:e.log)?this.D.log(t,i):console.warn(hi+" log called before recorder was ready")}updateConfig(t){var i;this.A=v({},this.A,t),null===(i=this.D)||void 0===i||i.updateConfig(this.A)}get U(){var i,e=this._instance.getConfig(),r=null!==(i=this.A.enabled)&&void 0!==i&&i,n=!e.disable_session_recording;return!!t&&r&&n}get B(){return"recorder"}j(t){var i,e,r,n;if(this.U)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.N(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(hi+" could not load recorder:",i):this.N(t)}):console.error(hi+" loadExternalDependency not available. Session recording cannot start.")}}N(t){var i,e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.D||(this.D=e(this._instance,this.A)),this.D.start(t)):console.error(hi+" initSessionRecording not available after script load")}}var di=(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))(di||{}),vi=Uint8Array,ci=Uint16Array,fi=Int32Array,gi=new vi([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]),pi=new vi([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]),_i=new vi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mi=function(t,i){for(var e=new ci(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new fi(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}},wi=mi(gi,2),yi=wi.b,bi=wi.r;yi[28]=258,bi[258]=28;for(var Si=mi(pi,0).r,Ti=new ci(32768),xi=0;xi<32768;++xi){var Ci=(43690&xi)>>1|(21845&xi)<<1;Ci=(61680&(Ci=(52428&Ci)>>2|(13107&Ci)<<2))>>4|(3855&Ci)<<4,Ti[xi]=((65280&Ci)>>8|(255&Ci)<<8)>>1}var ki=function(t,i,e){for(var r=t.length,n=0,s=new ci(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new ci(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new ci(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[Ti[d]>>l]=h}else for(o=new ci(r),n=0;n<r;++n)t[n]&&(o[n]=Ti[a[t[n]-1]++]>>15-t[n]);return o},Ei=new vi(288);for(xi=0;xi<144;++xi)Ei[xi]=8;for(xi=144;xi<256;++xi)Ei[xi]=9;for(xi=256;xi<280;++xi)Ei[xi]=7;for(xi=280;xi<288;++xi)Ei[xi]=8;var Ii=new vi(32);for(xi=0;xi<32;++xi)Ii[xi]=5;var $i=ki(Ei,9,0),Mi=ki(Ii,5,0),Ri=function(t){return(t+7)/8|0},Oi=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new vi(t.subarray(i,e))},Pi=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},Li=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},Ai=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:zi,l:0};if(1==n){var o=new vi(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 ci(v+1),f=Di(e[u-1],c,0);if(f>i){r=0;var g=0,p=f-i,_=1<<p;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;g+=_-(1<<f-c[m]),c[m]=i}for(g>>=p;g>0;){var w=s[r].s;c[w]<i?g-=1<<i-c[w]++-1:++r}for(;r>=0&&g;--r){var y=s[r].s;c[y]==i&&(--c[y],++g)}f=i}return{t:new vi(c),l:f}},Di=function(t,i,e){return-1==t.s?Math.max(Di(t.l,i,e+1),Di(t.r,i,e+1)):i[t.s]=e},Ui=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new ci(++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}},ji=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Bi=function(t,i,e){var r=e.length,n=Ri(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)},Ni=function(t,i,e,r,n,s,o,a,l,h,u){Pi(i,u++,e),++n[256];for(var d=Ai(n,15),v=d.t,c=d.l,f=Ai(s,15),g=f.t,p=f.l,_=Ui(v),m=_.c,w=_.n,y=Ui(g),b=y.c,S=y.n,T=new ci(19),x=0;x<m.length;++x)++T[31&m[x]];for(x=0;x<b.length;++x)++T[31&b[x]];for(var C=Ai(T,7),k=C.t,E=C.l,I=19;I>4&&!k[_i[I-1]];--I);var M,R,O,P,L=h+5<<3,A=ji(n,Ei)+ji(s,Ii)+o,D=ji(n,v)+ji(s,g)+o+14+3*I+ji(T,k)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&L<=A&&L<=D)return Bi(i,u,t.subarray(l,l+h));if(Pi(i,u,1+(D<A)),u+=2,D<A){M=ki(v,c,0),R=v,O=ki(g,p,0),P=g;var U=ki(k,E,0);Pi(i,u,w-257),Pi(i,u+5,S-1),Pi(i,u+10,I-4),u+=14;for(x=0;x<I;++x)Pi(i,u+3*x,k[_i[x]]);u+=3*I;for(var j=[m,b],B=0;B<2;++B){var N=j[B];for(x=0;x<N.length;++x){var q=31&N[x];Pi(i,u,U[q]),u+=k[q],q>15&&(Pi(i,u,N[x]>>5&127),u+=N[x]>>12)}}}else M=$i,R=Ei,O=Mi,P=Ii;for(x=0;x<a;++x){var z=r[x];if(z>255){Li(i,u,M[(q=z>>18&31)+257]),u+=R[q+257],q>7&&(Pi(i,u,z>>23&31),u+=gi[q]);var F=31&z;Li(i,u,O[F]),u+=P[F],F>3&&(Li(i,u,z>>5&8191),u+=pi[F])}else Li(i,u,M[z]),u+=R[z]}return Li(i,u,M[256]),u+R[256]},qi=new fi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zi=new vi(0),Fi=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}(),Wi=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new vi(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 vi(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=qi[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,g=s.p||new ci(32768),p=s.h||new ci(f+1),_=Math.ceil(e/3),m=2*_,w=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new fi(25e3),b=new ci(288),S=new ci(32),T=0,x=0,C=s.i||0,k=0,E=s.w||0,I=0;C+2<o;++C){var M=w(C),R=32767&C,O=p[M];if(g[R]=O,p[M]=R,E<=C){var P=o-C;if((T>7e3||k>24576)&&(P>423||!h)){u=Ni(t,l,0,y,b,S,x,k,I,C-I,u),k=T=x=0,I=C;for(var L=0;L<286;++L)b[L]=0;for(L=0;L<30;++L)S[L]=0}var A=2,D=0,U=c,j=R-O&32767;if(P>2&&M==w(C-j))for(var B=Math.min(v,P)-1,N=Math.min(32767,C),q=Math.min(258,P);j<=N&&--U&&R!=O;){if(t[C+A]==t[C+A-j]){for(var z=0;z<q&&t[C+z]==t[C+z-j];++z);if(z>A){if(A=z,D=j,z>B)break;var F=Math.min(j,z-2),W=0;for(L=0;L<F;++L){var V=C-j+L&32767,J=V-g[V]&32767;J>W&&(W=J,O=V)}}}j+=(R=O)-(O=g[R])&32767}if(D){y[k++]=268435456|bi[A]<<18|Si[D];var H=31&bi[A],X=31&Si[D];x+=gi[H]+pi[X],++b[257+H],++S[X],E=C+A,++T}else y[k++]=t[C],++b[t[C]]}}for(C=Math.max(C,E);C<o;++C)y[k++]=t[C],++b[t[C]];u=Ni(t,l,h,y,b,S,x,k,I,C-I,u),h||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=p,s.p=g,s.i=C,s.w=E)}else{for(C=s.w||0;C<o+h;C+=65535){var K=C+65535;K>=o&&(l[u/8|0]=h,K=o),u=Bi(l,u+1,t.subarray(C,K))}s.i=o}return Oi(a,0,r+Ri(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)},Vi=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ji(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=Fi[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=Wi(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&&Vi(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),Vi(s,o-8,e.d()),Vi(s,o-4,r),s}var Hi="undefined"!=typeof TextEncoder&&new TextEncoder,Xi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Xi.decode(zi,{stream:!0})}catch(t){}di.MouseMove,di.MouseInteraction,di.Scroll,di.ViewportResize,di.Input,di.TouchMove,di.MediaInteraction,di.Drag;var Ki="[Chat]";class Gi{constructor(t,i){void 0===i&&(i={}),this._instance=t,this.q=null,this.F=!1,this.W=!1,this.V=null,this.J=[],this.H=[],this.X=[],this.K=[],this.G=[],this.A=i}get isOpen(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isOpen)&&void 0!==i&&i}get isConnected(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isConnected)&&void 0!==i&&i}get isLoading(){var t,i;return this.W||null!==(i=null===(t=this.Z)||void 0===t?void 0:t.isLoading)&&void 0!==i&&i}get unreadCount(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.unreadCount)&&void 0!==i?i:0}get channel(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.channel)&&void 0!==i?i:null}get channels(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.channels)&&void 0!==i?i:[]}get currentView(){var t,i;return null!==(i=null===(t=this.Z)||void 0===t?void 0:t.currentView)&&void 0!==i?i:"list"}open(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.open()})}close(){var t;null===(t=this.Z)||void 0===t||t.close()}toggle(){this.Z?this.Z.toggle():this.open()}show(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.show()})}hide(){var t;null===(t=this.Z)||void 0===t||t.hide()}getChannels(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.getChannels()})}selectChannel(t){this.Y(()=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.selectChannel(t)})}createChannel(){this.Y(()=>{var t;return null===(t=this.Z)||void 0===t?void 0:t.createChannel()})}goToChannelList(){var t;null===(t=this.Z)||void 0===t||t.goToChannelList()}sendMessage(t){this.Z?this.Z.sendMessage(t):(this.J.push(t),this.Y(()=>{this.J.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.sendMessage(t)}),this.J=[]}))}markAsRead(){var t;null===(t=this.Z)||void 0===t||t.markAsRead()}onMessage(t){return this.X.push(t),this.Z?this.Z.onMessage(t):()=>{var i=this.X.indexOf(t);i>-1&&this.X.splice(i,1)}}onTyping(t){return this.K.push(t),this.Z?this.Z.onTyping(t):()=>{var i=this.K.indexOf(t);i>-1&&this.K.splice(i,1)}}onConnectionChange(t){return this.G.push(t),this.Z?this.Z.onConnectionChange(t):()=>{var i=this.G.indexOf(t);i>-1&&this.G.splice(i,1)}}startIfEnabled(){var t=this;return d(function*(){var i,e,r,n;!1!==t.A.enabled?t._instance.getConfig().disable_chat?console.info(Ki+" disabled by disable_chat config"):(!1!==t.A.autoConfig&&(yield t.tt()),t.it?(null!==(r=null!==(i=t.A.preload)&&void 0!==i?i:null===(e=t.q)||void 0===e?void 0:e.enabled)&&void 0!==r&&r&&t.et(),(null===(n=t.q)||void 0===n?void 0:n.enabled)&&t.rt(),console.info(Ki+" ready (lazy-load on demand)")):console.info(Ki+" not enabled (check dashboard settings)")):console.info(Ki+" disabled by code config")})()}updateConfig(t){this.A=v({},this.A,t)}getMergedConfig(){var t,i,e,r,n,s,o,a,l,h,u,d,v,c,f,g,p,_,m=this.q,w=this.A;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!==(g=w.offlineMessage)&&void 0!==g?g:null==m?void 0:m.offline_message,collectEmailOffline:null===(_=null!==(p=w.collectEmailOffline)&&void 0!==p?p:null==m?void 0:m.collect_email_offline)||void 0===_||_}}destroy(){var t;null===(t=this.Z)||void 0===t||t.destroy(),this.Z=void 0,this.J=[],this.H=[],this.X=[],this.K=[],this.G=[]}get it(){var t;return!1!==this.A.enabled&&(!0===this.A.enabled||!0===(null===(t=this.q)||void 0===t?void 0:t.enabled))}tt(){var t=this;return d(function*(){if(!t.F){var i=t._instance.getConfig(),e=i.token,r=i.api_host;if(!e||!r)return console.warn(Ki+" Cannot fetch settings: missing token or api_host"),void(t.F=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(e),s=yield fetch(n);if(!s.ok)return console.warn(Ki+" Failed to fetch settings: "+s.status),void(t.F=!0);t.q=yield s.json(),t.F=!0,console.info(Ki+" Loaded settings from dashboard")}catch(i){console.warn(Ki+" Error fetching settings:",i),t.F=!0}}})()}rt(){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"}et(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this.nt(),{timeout:5e3}):setTimeout(()=>this.nt(),3e3)}Y(t){this.Z?t():(this.H.push(t),this.nt())}nt(){var t,i;if(!(this.W||this.Z||this.V))if(null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat)this.N();else{this.W=!0;var e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.loadExternalDependency;if(!e)return console.error(Ki+" loadExternalDependency not available. Chat cannot start."),this.W=!1,void(this.V="loadExternalDependency not available");e(this._instance,this.B,t=>{if(this.W=!1,t)return console.error(Ki+" Failed to load:",t),void(this.V=String(t));this.N()})}}N(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat;if(!i)return console.error(Ki+" initChat not available after script load"),void(this.V="initChat not available");if(!this.Z){var e=this.getMergedConfig();this.Z=i(this._instance,e),this.X.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.onMessage(t)}),this.K.forEach(t=>{var i;return null===(i=this.Z)||void 0===i?void 0:i.onTyping(t)}),this.G.forEach(t=>{var i;return null===(i=this.Z)||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.H.forEach(t=>t()),this.H=[],console.info(Ki+" loaded and ready")}}var Qi,Zi="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Qi||(Qi={}));var Yi=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===Qi.GZipJS&&n>=1024)try{var s=Ji(function(t,i){if(Hi)return Hi.encode(t);for(var e=t.length,r=new vi(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 vi(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 Oi(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Zi});if(o.size<.95*n)return{contentType:Zi,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},te=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Yi(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Qi.GZipJS&&e===Zi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=v({"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=d(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=Yi(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Qi.GZipJS&&e===Zi?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=Yi(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Qi.GZipJS&&e===Zi?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],ie=t=>{var i,e=t.transport||"fetch",r=te.find(t=>t.name===e&&t.available)||te.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 ee{constructor(t,i){var e,r,n,s;this.st=!0,this.ot=[],this.lt=(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.ht=t}get length(){return this.ot.length}enqueue(t){this.ot.push(t),this.ut||this.dt()}unload(){if(this.vt(),0!==this.ot.length){var t=this.ct();for(var i in t){var e=t[i];this.ht(v({},e,{transport:"sendBeacon"}))}}}enable(){this.st=!1,this.dt()}pause(){this.st=!0,this.vt()}flush(){this.vt(),this.ft(),this.dt()}dt(){this.st||(this.ut=setTimeout(()=>{this.vt(),this.ft(),this.ot.length>0&&this.dt()},this.lt))}vt(){this.ut&&(clearTimeout(this.ut),this.ut=void 0)}ft(){if(0!==this.ot.length){var t=this.ct(),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.ht(r)}}}ct(){var t={};return this.ot.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.ot=[],t}}class re{constructor(i){this.gt=!1,this._t=3e3,this.ot=[],this.wt=!0,this.ht=i.sendRequest,this.yt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this.wt=e.onLine,P(t,"online",()=>{this.wt=!0,this.bt()}),P(t,"offline",()=>{this.wt=!1}))}get length(){return this.ot.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.ot.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this.wt||(n+=" (Browser is offline)"),console.warn(n),this.gt||(this.gt=!0,this.St())}}retriableRequest(t){var i=this;return d(function*(){try{var e=yield i.ht(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}St(){this.Tt&&clearTimeout(this.Tt),this.Tt=setTimeout(()=>{this.wt&&this.ot.length>0&&this.bt(),this.ot.length>0?this.St():this.gt=!1},this._t)}bt(){var t=this,i=Date.now(),e=[],r=[];this.ot.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.ot=e,r.forEach(function(){var i=d(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.ht(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.Tt&&(clearTimeout(this.Tt),this.Tt=void 0),this.ot.forEach(t=>{var{request:i}=t;try{this.yt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.ot=[]}}var ne="vt_rate_limit";class se{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(ne))&&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(ne,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class oe{constructor(t){void 0===t&&(t={}),this.version=c,this.__loaded=!1,this.xt=!1,this.Ct=null,this.__request_queue=[],this.kt=!1,this.Et=!1,this.It=null,this.$t=null,this.configManager=new I(t);var i=this.configManager.getConfig();this.sessionManager=new q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new ii(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.webVitalsManager=new oi(i,this),this.rateLimiter=new se({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.Mt("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new re({sendRequest:t=>this.Rt(t),sendBeacon:t=>this.Ot(t)}),this.requestQueue=new ee(t=>this.Pt(t),{flush_interval_ms:3e3})}init(t,i,e){var r;if(e&&e!==le){var n=null!==(r=ae[e])&&void 0!==r?r:new oe;return n._init(t,i,e),ae[e]=n,ae[le][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(v({},i,{projectId:t||i.projectId,name:e})),this.__loaded=!0,this.Lt(),this.At();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 li(this),this.historyAutocapture.startIfEnabled(),this.Dt(),this.Ut(),this.jt(),this.Bt(),!1!==r.capture_pageview&&this.Nt(),this}Bt(){this.requestQueue.enable()}jt(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};P(t,"beforeunload",i),P(t,"pagehide",i)}}Lt(){var i;try{if(void 0===n||!n.search)return;var e=new URL(n.href),r=e.searchParams.get("vt");if(r&&r.trim()){this.$t=r.trim(),e.searchParams.delete("vt");var s=e.pathname+(e.search||"")+e.hash;void 0!==t&&(null===(i=t.history)||void 0===i?void 0:i.replaceState)&&t.history.replaceState({},"",s)}}catch(t){}}At(){var i,e=this.configManager.getConfig();if(e.projectId){if(null===(i=e.bootstrap)||void 0===i?void 0:i.remoteConfig)return this.It=e.bootstrap.remoteConfig,this.qt(this.It),void this.zt();try{var r=t.__VTILT_BOOTSTRAP__;if(null==r?void 0:r.remoteConfig)return this.It=r.remoteConfig,this.qt(this.It),void this.zt()}catch(t){}try{var n=localStorage.getItem(y+"_"+e.projectId);n&&(this.It=JSON.parse(n),this.qt(this.It))}catch(t){}this.zt()}}zt(){var t=this.configManager.getConfig();if(t.projectId&&t.api_host){var i=t.api_host+"/api/projects/"+t.projectId+"/decide",e=new AbortController,r=setTimeout(()=>e.abort(),3e3);(s||fetch)(i,{method:"GET",signal:e.signal,headers:{Accept:"application/json"}}).then(t=>t.json()).then(i=>{clearTimeout(r),this.It=i;try{localStorage.setItem(y+"_"+t.projectId,JSON.stringify(i))}catch(t){}this.qt(i)}).catch(()=>{clearTimeout(r)})}}qt(t){var i,e,r=this.configManager.getConfig(),n={},s=!1,o=!1;if(t.sessionRecording&&void 0===r.session_recording&&(n.session_recording={enabled:t.sessionRecording.enabled,sampleRate:t.sessionRecording.sampleRate,minimumDurationMs:t.sessionRecording.minimumDurationMs,maskAllInputs:t.sessionRecording.maskAllInputs,captureConsole:t.sessionRecording.captureConsole,captureCanvas:t.sessionRecording.captureCanvas},t.sessionRecording.enabled&&(s=!0)),(null===(i=t.chat)||void 0===i?void 0:i.enabled)&&void 0===r.chat&&(n.chat={enabled:t.chat.enabled,position:t.chat.widgetPosition,color:t.chat.widgetColor},o=!0),t.analytics&&(void 0!==t.analytics.capturePageview&&void 0===r.capture_pageview&&(n.capture_pageview=t.analytics.capturePageview),void 0!==t.analytics.capturePageleave&&void 0===r.capture_pageleave&&(n.capture_pageleave=!!t.analytics.capturePageleave),void 0!==t.analytics.capturePerformance&&void 0===r.capture_performance&&(n.capture_performance=t.analytics.capturePerformance),void 0!==t.analytics.autocapture&&void 0===r.autocapture&&(n.autocapture=t.analytics.autocapture)),void 0!==(null===(e=t.privacy)||void 0===e?void 0:e.respectDnt)&&void 0===r.respect_dnt&&(n.respect_dnt=t.privacy.respectDnt),Object.keys(n).length>0&&this.updateConfig(n),s&&this.__loaded&&this.startSessionRecording(),o&&this.__loaded)if(this.chat){var a=this.Ft(this.configManager.getConfig());this.chat.updateConfig(a),this.chat.startIfEnabled()}else this.Ut()}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:le;return i!==le&&(i=le+"."+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.kt||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.kt=!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})}}Pt(t){var{transport:i}=t;"sendBeacon"!==i?this.retryQueue.retriableRequest(t):this.Ot(t)}Rt(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?Qi.None:Qi.GZipJS;ie({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>{i({statusCode:t.statusCode})}})})}Ot(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;ie({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}Vt(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=ti(),a=this.userManager.getUserProperties(),l=this.userManager.get_initial_props(),h=this.sessionManager.getSessionId(),u=this.sessionManager.getWindowId(),d=this.userManager.getAnonymousId(),c={};!this.Et&&Object.keys(l).length>0&&Object.assign(c,l),i.$set_once&&Object.assign(c,i.$set_once);var f=v({},o,a,{$session_id:h,$window_id:u},d?{$anon_distinct_id:d}:{},this.$t?{$vt:this.$t}:{},Object.keys(c).length>0?{$set_once:c}:{},i.$set?{$set:i.$set}:{},i);!this.Et&&Object.keys(l).length>0&&(this.Et=!0),"$pageview"===t&&r&&(f.title=r.title);var g,p,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(g=Object.assign({},f,_.globalAttributes),!R(g=JSON.stringify(g)))return}else if(g=Object.assign({},f,_.globalAttributes),!R(JSON.stringify(g)))return;p="$identify"===t?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var m={timestamp:(new Date).toISOString(),event:t,project_id:_.projectId||"",payload:g,distinct_id:p,anonymous_id:d};this.sendRequest(s,m,!0)}}Mt(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)}Nt(){r&&("visible"===r.visibilityState?this.xt||(this.xt=!0,setTimeout(()=>{if(r&&n){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.Ct&&(r.removeEventListener("visibilitychange",this.Ct),this.Ct=null)):this.Ct||(this.Ct=()=>{this.Nt()},P(r,"visibilitychange",this.Ct)))}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 q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new ii(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.webVitalsManager=new oi(i,this),this.sessionRecording&&i.session_recording&&this.sessionRecording.updateConfig(this.Jt(i))}Dt(){if(!this.sessionRecording){var t=this.configManager.getConfig();if(!t.disable_session_recording){var i=this.Jt(t);this.sessionRecording=new ui(this,i),i.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}}Jt(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(){var t=this.configManager.getConfig(),i=this.Jt(t);i.enabled=!0,this.sessionRecording?this.sessionRecording.updateConfig(i):this.sessionRecording=new ui(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}Ut(){if(!this.chat){var t=this.configManager.getConfig();if(!t.disable_chat){var i=this.Ft(t);this.chat=new Gi(this,i),this.chat.startIfEnabled()}}}Ft(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.Vt(t)}),this.__request_queue=[],this.Bt()}}var ae={},le="vt",he=!(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=he);var ue,de=(ue=ae[le]=new oe,function(){function i(){i.done||(i.done=!0,he=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),O(ae,function(t){t._dom_loaded()}))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():P(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}(),ue);export{ei as ALL_WEB_VITALS_METRICS,ri as DEFAULT_WEB_VITALS_METRICS,oe as VTilt,de as default,de as vt};
2
2
  //# sourceMappingURL=module.js.map