@v-tilt/browser 1.4.2 → 1.4.4
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/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/extensions/chat/chat-wrapper.d.ts +1 -1
- package/dist/extensions/chat/chat.d.ts +3 -33
- package/dist/external-scripts-loader.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/storage.d.ts +68 -51
- package/dist/user-manager.d.ts +15 -1
- package/lib/entrypoints/external-scripts-loader.js +1 -1
- package/lib/extensions/chat/chat-wrapper.d.ts +1 -1
- package/lib/extensions/chat/chat-wrapper.js +12 -6
- package/lib/extensions/chat/chat.d.ts +3 -33
- package/lib/extensions/chat/chat.js +102 -229
- package/lib/storage.d.ts +68 -51
- package/lib/storage.js +306 -219
- package/lib/user-manager.d.ts +15 -1
- package/lib/user-manager.js +38 -6
- package/lib/vtilt.js +6 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}function t(t){return function(){var i=this,n=arguments;return new Promise(function(r,s){var o=t.apply(i,n);function a(t){e(o,r,s,a,l,"next",t)}function l(t){e(o,r,s,a,l,"throw",t)}a(void 0)})}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},i.apply(null,arguments)}class n{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!document.currentScript)return i({token:e.token||""},e);var t=document.currentScript,n=i({token:""},e);n.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,n.script_host=t.getAttribute("data-script-host")||e.script_host,n.proxy=t.getAttribute("data-proxy")||e.proxy,n.proxyUrl=t.getAttribute("data-proxy-url")||e.proxyUrl,n.token=t.getAttribute("data-token")||e.token||"",n.projectId=t.getAttribute("data-project-id")||e.projectId||"",n.domain=t.getAttribute("data-domain")||e.domain,n.storage=t.getAttribute("data-storage")||e.storage,n.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var r="true"===t.getAttribute("data-capture-performance");if(n.capture_performance=!!r||e.capture_performance,n.proxy&&n.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 s of(n.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))s.name.startsWith("data-vt-")&&(n.globalAttributes[s.name.slice(8).replace(/-/g,"_")]=s.value);return n}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}var r="__vt_session",s="__vt_window_id",o="__vt_primary_window",a="__vt_user_state",l="__vt_device_id",d="__vt_anonymous_id",u="__vt_distinct_id",h="__vt_user_properties",c="localStorage",g="localStorage+cookie",v="sessionStorage",_="memory",f="$initial_person_info";function p(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16))}function m(e){return!(!e||"string"!=typeof e)&&!(e.length<2||e.length>10240)}function y(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,n)=>{t.call(i,e,n)});else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(i,e[n],n)}function b(e,t,i,n){var{capture:r=!1,passive:s=!0}=null!=n?n:{};null==e||e.addEventListener(t,i,{capture:r,passive:s})}function w(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function S(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r of i)for(var s of r)e.push(s);return e}var I="undefined"!=typeof window?window:void 0,C="undefined"!=typeof globalThis?globalThis:I,M=null==C?void 0:C.navigator,E=null==C?void 0:C.document,T=null==C?void 0:C.location,L=null==C?void 0:C.fetch,k=(null==C?void 0:C.XMLHttpRequest)&&"withCredentials"in new C.XMLHttpRequest?C.XMLHttpRequest:void 0;null==C||C.AbortController;var x=null==M?void 0:M.userAgent,R=null!=I?I:{},P=31536e3,A=["herokuapp.com","vercel.app","netlify.app"];function z(e){var t;if(!e)return"";if("undefined"==typeof document)return"";var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return"";var n=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return n?"."+n[0]:""}class O{constructor(e){var t,i;this.memoryStorage=new Map,this.method=e.method,this.cross_subdomain=null!==(t=e.cross_subdomain)&&void 0!==t?t:function(){var e;if("undefined"==typeof document)return!1;var t=null===(e=document.location)||void 0===e?void 0:e.hostname;if(!t)return!1;var i=t.split(".").slice(-2).join(".");for(var n of A)if(i===n)return!1;return!0}(),this.sameSite=e.sameSite||"Lax",this.secure=null!==(i=e.secure)&&void 0!==i?i:"undefined"!=typeof location&&"https:"===location.protocol}get(e){var t;try{if(this.method===_)return null!==(t=this.memoryStorage.get(e))&&void 0!==t?t:null;if(this.usesLocalStorage()){var i=localStorage.getItem(e);return null!==i?i:this.method===g?this.getCookie(e):null}return this.usesSessionStorage()?sessionStorage.getItem(e):this.getCookie(e)}catch(t){return console.warn('[StorageManager] Failed to get "'+e+'":',t),null}}set(e,t,i){try{if(this.method===_)return void this.memoryStorage.set(e,t);if(this.usesLocalStorage())return localStorage.setItem(e,t),void(this.method===g&&this.setCookie(e,t,i||P));if(this.usesSessionStorage())return void sessionStorage.setItem(e,t);this.setCookie(e,t,i||P)}catch(t){console.warn('[StorageManager] Failed to set "'+e+'":',t)}}remove(e){try{if(this.method===_)return void this.memoryStorage.delete(e);if(this.usesLocalStorage())return localStorage.removeItem(e),void(this.method===g&&this.removeCookie(e));if(this.usesSessionStorage())return void sessionStorage.removeItem(e);this.removeCookie(e)}catch(t){console.warn('[StorageManager] Failed to remove "'+e+'":',t)}}getWithExpiry(e){var t=this.get(e);if(!t)return null;try{var i=JSON.parse(t);return i.expiry&&Date.now()>i.expiry?(this.remove(e),null):i.value}catch(e){return null}}setWithExpiry(e,t,n){var r=i({value:t},n?{expiry:Date.now()+n}:{});this.set(e,JSON.stringify(r))}getJSON(e){var t=this.get(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return null}}setJSON(e,t,i){this.set(e,JSON.stringify(t),i)}getCookie(e){if("undefined"==typeof document)return null;var t=document.cookie.split(";");for(var i of t){var[n,...r]=i.trim().split("=");if(n===e){var s=r.join("=");try{return decodeURIComponent(s)}catch(e){return s}}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var n=e+"="+encodeURIComponent(t);n+="; Max-Age="+i,n+="; path=/",n+="; SameSite="+this.sameSite,this.secure&&(n+="; Secure");var r=z(this.cross_subdomain);r&&(n+="; domain="+r),document.cookie=n}}removeCookie(e){if("undefined"!=typeof document){var t=z(this.cross_subdomain),i=e+"=; Max-Age=0; path=/";t&&(i+="; domain="+t),document.cookie=i,document.cookie=e+"=; Max-Age=0; path=/"}}usesLocalStorage(){return this.method===c||this.method===g}usesSessionStorage(){return this.method===v}canUseSessionStorage(){if(void 0===I||!(null==I?void 0:I.sessionStorage))return!1;try{var e="__vt_storage_test__";return I.sessionStorage.setItem(e,"test"),I.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==I?void 0:I.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class ${constructor(e,t){void 0===e&&(e="cookie"),this.storage=new O({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=p(),this._storeSessionId(e)),e}setSessionId(){var e=this._getSessionIdRaw()||p();return this._storeSessionId(e),e}resetSessionId(){this._clearSessionId(),this.setSessionId(),this._setWindowId(p())}_getSessionIdRaw(){return this.storage.get(r)}_storeSessionId(e){this.storage.set(r,e,1800)}_clearSessionId(){this.storage.remove(r)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s);if(t)return this._windowId=t,t}var i=p();return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(s,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(o),i=e.getItem(s);i&&!t?this._windowId=i:(i&&e.removeItem(s),this._setWindowId(p())),e.setItem(o,"true"),this._listenToUnload()}else this._windowId=p()}_listenToUnload(){var e=this.storage.getSessionStorage();I&&e&&b(I,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(o)},{capture:!1})}updateStorageMethod(e,t){this.storage=new O({method:e,cross_subdomain:t,sameSite:"Lax"})}}function q(e){if(!E)return null;var t=E.createElement("a");return t.href=e,t}function U(e,t){for(var i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;n<i.length;n++){var r=i[n].split("=");if(r[0]===t){if(r.length<2)return"";var s=r[1];try{s=decodeURIComponent(s)}catch(e){}return s.replace(/\+/g," ")}}return""}function D(e,t,i){if(!e||!t||!t.length)return e;for(var n=e.split("#"),r=n[0]||"",s=n[1],o=r.split("?"),a=o[1],l=o[0],d=(a||"").split("&"),u=[],h=0;h<d.length;h++){var c=d[h].split("="),g=c[0],v=c.slice(1).join("=");-1!==t.indexOf(g)?u.push(g+"="+i):g&&u.push(g+(v?"="+v:""))}var _=u.join("&");return l+(_?"?"+_:"")+(s?"#"+s:"")}function B(e){return"function"==typeof e}var j="Mobile",N="iOS",F="Android",V="Tablet",W=F+" "+V,J="iPad",H="Apple",Q=H+" Watch",G="Safari",X="BlackBerry",K="Samsung",Z=K+"Browser",Y=K+" Internet",ee="Chrome",te=ee+" OS",ie=ee+" "+N,ne="Internet Explorer",re=ne+" "+j,se="Opera",oe=se+" Mini",ae="Edge",le="Microsoft "+ae,de="Firefox",ue=de+" "+N,he="Nintendo",ce="PlayStation",ge="Xbox",ve=F+" "+j,_e=j+" "+G,fe="Windows",pe=fe+" Phone",me="Nokia",ye="Ouya",be="Generic",we=be+" "+j.toLowerCase(),Se=be+" "+V.toLowerCase(),Ie="Konqueror",Ce="(\\d+(\\.\\d+)?)",Me=new RegExp("Version/"+Ce),Ee=new RegExp(ge,"i"),Te=new RegExp(ce+" \\w+","i"),Le=new RegExp(he+" \\w+","i"),ke=new RegExp(X+"|PlayBook|BB10","i"),xe={"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 Re(e,t){return e.toLowerCase().includes(t.toLowerCase())}var Pe=(e,t)=>t&&Re(t,H)||function(e){return Re(e,G)&&!Re(e,ee)&&!Re(e,F)}(e),Ae=function(e,t){return t=t||"",Re(e," OPR/")&&Re(e,"Mini")?oe:Re(e," OPR/")?se:ke.test(e)?X:Re(e,"IE"+j)||Re(e,"WPDesktop")?re:Re(e,Z)?Y:Re(e,ae)||Re(e,"Edg/")?le:Re(e,"FBIOS")?"Facebook "+j:Re(e,"UCWEB")||Re(e,"UCBrowser")?"UC Browser":Re(e,"CriOS")?ie:Re(e,"CrMo")||Re(e,ee)?ee:Re(e,F)&&Re(e,G)?ve:Re(e,"FxiOS")?ue:Re(e.toLowerCase(),Ie.toLowerCase())?Ie:Pe(e,t)?Re(e,j)?_e:G:Re(e,de)?de:Re(e,"MSIE")||Re(e,"Trident/")?ne:Re(e,"Gecko")?de:""},ze={[re]:[new RegExp("rv:"+Ce)],[le]:[new RegExp(ae+"?\\/"+Ce)],[ee]:[new RegExp("("+ee+"|CrMo)\\/"+Ce)],[ie]:[new RegExp("CriOS\\/"+Ce)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ce)],[G]:[Me],[_e]:[Me],[se]:[new RegExp("(Opera|OPR)\\/"+Ce)],[de]:[new RegExp(de+"\\/"+Ce)],[ue]:[new RegExp("FxiOS\\/"+Ce)],[Ie]:[new RegExp("Konqueror[:/]?"+Ce,"i")],[X]:[new RegExp(X+" "+Ce),Me],[ve]:[new RegExp("android\\s"+Ce,"i")],[Y]:[new RegExp(Z+"\\/"+Ce)],[ne]:[new RegExp("(rv:|MSIE )"+Ce)],Mozilla:[new RegExp("rv:"+Ce)]},Oe=function(e,t){var i=Ae(e,t),n=ze[i];if(void 0===n)return null;for(var r=0;r<n.length;r++){var s=n[r],o=e.match(s);if(o)return parseFloat(o[o.length-2])}return null},$e=[[new RegExp(ge+"; "+ge+" (.*?)[);]","i"),e=>[ge,e&&e[1]||""]],[new RegExp(he,"i"),[he,""]],[new RegExp(ce,"i"),[ce,""]],[ke,[X,""]],[new RegExp(fe,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[pe,""];if(new RegExp(j).test(t)&&!/IEMobile\b/.test(t))return[fe+" "+j,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var n=i[1],r=xe[n]||"";return/arm/i.test(t)&&(r="RT"),[fe,r]}return[fe,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[N,t.join(".")]}return[N,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=void 0===e[2]?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+F+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+F+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[F,t.join(".")]}return[F,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[te,""]],[/Linux|debian/i,["Linux",""]]],qe=function(e){return Le.test(e)?he:Te.test(e)?ce:Ee.test(e)?ge:new RegExp(ye,"i").test(e)?ye:new RegExp("("+pe+"|WPDesktop)","i").test(e)?pe:/iPad/.test(e)?J:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Q:ke.test(e)?X:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(me,"i").test(e)?me:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(j).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?F:W:F:new RegExp("(pda|"+j+")","i").test(e)?we:new RegExp(V,"i").test(e)&&!new RegExp(V+" pc","i").test(e)?Se:""},Ue="https?://(.*)",De=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Be=S(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],De),je="<masked>";function Ne(e){var t=function(e){return e?0===e.search(Ue+"google.([^/?]*)")?"google":0===e.search(Ue+"bing.com")?"bing":0===e.search(Ue+"yahoo.com")?"yahoo":0===e.search(Ue+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",n={};if(null!==t){n.$search_engine=t;var r=E?U(E.referrer,i):"";r.length&&(n.ph_keyword=r)}return n}function Fe(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function Ve(){return(null==E?void 0:E.referrer)||"$direct"}function We(){var e;return(null==E?void 0:E.referrer)&&(null===(e=q(E.referrer))||void 0===e?void 0:e.host)||"$direct"}function Je(e){var t,{r:i,u:n}=e,r={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=q(i))||void 0===t?void 0:t.host};if(n){r.$current_url=n;var s=q(n);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var o=function(e){var t=Be.concat([]),i={};return y(t,function(t){var n=U(e,t);i[t]=n||null}),i}(n);w(r,o)}i&&w(r,Ne(i));return r}function He(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Qe(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function Ge(e,t){if(!x)return{};var i,n,r,[s,o]=function(e){for(var t=0;t<$e.length;t++){var[i,n]=$e[t],r=i.exec(e),s=r&&(B(n)?n(r,e):n);if(s)return s}return["",""]}(x);return w(function(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];null!=n&&""!==n&&(t[i]=n)}return t}({$os:s,$os_version:o,$browser:Ae(x,navigator.vendor),$device:qe(x),$device_type:(n=x,r=qe(n),r===J||r===W||"Kobo"===r||"Kindle Fire"===r||r===Se?V:r===he||r===ge||r===ce||r===ye?"Console":r===Q?"Wearable":r?j:"Desktop"),$timezone:He(),$timezone_offset:Qe()}),{$current_url:D(null==T?void 0:T.href,[],je),$host:null==T?void 0:T.host,$pathname:null==T?void 0:T.pathname,$raw_user_agent:x.length>1e3?x.substring(0,997)+"...":x,$browser_version:Oe(x,navigator.vendor),$browser_language:Fe(),$browser_language_prefix:(i=Fe(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==I?void 0:I.screen.height,$screen_width:null==I?void 0:I.screen.width,$viewport_height:null==I?void 0:I.innerHeight,$viewport_width:null==I?void 0:I.innerWidth,$lib:"web",$lib_version:"1.0.7",$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class Xe{constructor(e,t){void 0===e&&(e="localStorage"),this._cachedPersonProperties=null,this.storage=new O({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,P)),this.userIdentity.anonymous_id}getUserProperties(){return i({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(e,t,n){if("number"==typeof e&&(e=e.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.isDistinctIdStringLike(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=e,!this.userIdentity.device_id){var s=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=s,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:s})}e!==r&&(this.userIdentity.distinct_id=e);var o="anonymous"===this.userIdentity.user_state;e!==r&&o?(this.userIdentity.user_state="identified",t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):t||n?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):e!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){if(!e&&!t)return!1;var n=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(n,e,t);return this._cachedPersonProperties===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity(),this._cachedPersonProperties=r,!0)}reset(e){var t=this.generateAnonymousId(),n=this.userIdentity.device_id,r=e?this.generateDeviceId():n;this.userIdentity={distinct_id:null,anonymous_id:t,device_id:r,properties:{},user_state:"anonymous"},this._cachedPersonProperties=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(e){this.userIdentity.distinct_id=e,this.saveUserIdentity()}setUserState(e){this.userIdentity.user_state=e,this.saveUserIdentity()}updateUserProperties(e,t){e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity()}ensureDeviceId(e){this.userIdentity.device_id||(this.userIdentity.device_id=e,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:e}),this.saveUserIdentity())}createAlias(e,t){return this.isValidDistinctId(e)?(void 0===t&&(t=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(t)?e===t?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:e,original:t}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(e){return this.isDistinctIdStringLike(e)}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?S([],De,t||[]):[],n=null==T?void 0:T.href.substring(0,1e3);return{r:Ve().substring(0,1e3),u:n?D(n,i,je):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e,t,i=this.getStoredUserProperties()[f];return i?(e=Je(i),t={},y(e,function(e,i){var n;t["$initial_"+(n=String(i),n.startsWith("$")?n.substring(1):n)]=e}),t):{}}update_referrer_info(){var e={$referrer:Ve(),$referring_domain:We()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d)||this.generateAnonymousId(),t=this.storage.get(u)||null,i=this.storage.get(l)||this.generateDeviceId(),n=this.getStoredUserProperties(),r=this.storage.get(a)||"anonymous";return{distinct_id:t,anonymous_id:e||this.generateAnonymousId(),device_id:i,properties:n,user_state:r}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,P),this.storage.set(l,this.userIdentity.device_id,P),this.storage.set(a,this.userIdentity.user_state,P),this.userIdentity.distinct_id?this.storage.set(u,this.userIdentity.distinct_id,P):this.storage.remove(u),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(h)||{}}setStoredUserProperties(e){this.storage.setJSON(h,e,P)}register_once(e,t){var i=this.getStoredUserProperties(),n=!1;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r in i||(i[r]=e[r],n=!0));if(t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(s in i||(i[s]=t[s],n=!0));n&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+p()}generateDeviceId(){return"device_"+p()}getPersonPropertiesHash(e,t,i){return JSON.stringify({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}isValidDistinctId(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(t)&&0!==e.trim().length}isDistinctIdStringLike(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(t)}updateStorageMethod(e,t){this.storage=new O({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var Ke=["LCP","CLS","FCP","INP"],Ze=9e5,Ye="[WebVitals]";class et{constructor(e,t){this.initialized=!1,this.instance=t,this.buffer=this.createEmptyBuffer(),this.config=this.parseConfig(e.capture_performance),this.isEnabled&&I&&this.startIfEnabled()}parseConfig(e){return"boolean"==typeof e?{web_vitals:e}:"object"==typeof e&&null!==e?e:{web_vitals:!1}}get isEnabled(){var e=null==T?void 0:T.protocol;return("http:"===e||"https:"===e)&&!1!==this.config.web_vitals}get allowedMetrics(){return this.config.web_vitals_allowed_metrics||Ke}get flushTimeoutMs(){return this.config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var e=this.config.__web_vitals_max_value;return void 0===e?Ze:0===e?0:e<6e4?Ze:e}createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}getWebVitalsCallbacks(){var e;return null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.webVitalsCallbacks}startIfEnabled(){if(this.isEnabled&&!this.initialized){var e=this.getWebVitalsCallbacks();e?this.startCapturing(e):this.loadWebVitals()}}loadWebVitals(){var e,t=null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.loadExternalDependency;t?t(this.instance,"web-vitals",e=>{if(e)console.error(Ye+" Failed to load web-vitals:",e);else{var t=this.getWebVitalsCallbacks();t?this.startCapturing(t):console.error(Ye+" web-vitals loaded but callbacks not registered")}}):console.warn(Ye+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}startCapturing(e){if(!this.initialized){var t=this.allowedMetrics,i=this.addToBuffer.bind(this);t.includes("LCP")&&e.onLCP&&e.onLCP(i),t.includes("CLS")&&e.onCLS&&e.onCLS(i,{reportAllChanges:!0}),t.includes("FCP")&&e.onFCP&&e.onFCP(i),t.includes("INP")&&e.onINP&&e.onINP(i),t.includes("TTFB")&&e.onTTFB&&e.onTTFB(i),this.initialized=!0}}getCurrentUrl(){var e;return null===(e=null==I?void 0:I.location)||void 0===e?void 0:e.href}getCurrentPathname(){return null==T?void 0:T.pathname}addToBuffer(e){try{if(!I||!E||!T)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void console.warn(Ye+" Invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void console.warn(Ye+" Ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var t=this.getCurrentUrl(),n=this.getCurrentPathname();if(!t)return void console.warn(Ye+" Could not determine current URL");this.buffer.url&&this.buffer.url!==t&&this.flush(),this.buffer.url||(this.buffer.url=t,this.buffer.pathname=n),this.buffer.firstMetricTimestamp||(this.buffer.firstMetricTimestamp=Date.now());var r=this.cleanAttribution(e.attribution),s=this.instance.getSessionId(),o=this.getWindowId(),a=i({},e,{attribution:r,timestamp:Date.now(),$current_url:t,$session_id:s,$window_id:o}),l=this.buffer.metrics.findIndex(t=>t.name===e.name);l>=0?this.buffer.metrics[l]=a:this.buffer.metrics.push(a),this.scheduleFlush(),this.buffer.metrics.length>=this.allowedMetrics.length&&this.flush()}catch(e){console.error(Ye+" Error adding metric to buffer:",e)}}cleanAttribution(e){if(e){var t=i({},e);return"interactionTargetElement"in t&&delete t.interactionTargetElement,t}}getWindowId(){var e;try{return(null===(e=this.instance.sessionManager)||void 0===e?void 0:e.getWindowId())||null}catch(e){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 e={$pathname:this.buffer.pathname,$current_url:this.buffer.url};for(var t of this.buffer.metrics)e["$web_vitals_"+t.name+"_value"]=t.value,e["$web_vitals_"+t.name+"_event"]={name:t.name,value:t.value,delta:t.delta,rating:t.rating,id:t.id,navigationType:t.navigationType,attribution:t.attribution,$session_id:t.$session_id,$window_id:t.$window_id};this.instance.capture("$web_vitals",e)}catch(e){console.error(Ye+" Error flushing metrics:",e)}this.buffer=this.createEmptyBuffer()}}}function tt(e,t,i){try{if(!(t in e))return()=>{};var n=e[t],r=i(n);return B(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=n}}catch(e){return()=>{}}}class it{constructor(e){var t;this._instance=e,this._lastPathname=(null===(t=null==I?void 0:I.location)||void 0===t?void 0:t.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0}monitorHistoryChanges(){var e,t;if(I&&T&&(this._lastPathname=T.pathname||"",I.history)){var i=this;(null===(e=I.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||tt(I.history,"pushState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("pushState")}),(null===(t=I.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||tt(I.history,"replaceState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("replaceState")}),this._setupPopstateListener()}}_capturePageview(e){var t;try{var i=null===(t=null==I?void 0:I.location)||void 0===t?void 0:t.pathname;if(!i||!T||!E)return;if(i!==this._lastPathname&&this.isEnabled){var n={navigation_type:e};this._instance.capture("$pageview",n)}this._lastPathname=i}catch(t){console.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener&&I){var e=()=>{this._capturePageview("popstate")};b(I,"popstate",e),this._popstateListener=()=>{I&&I.removeEventListener("popstate",e)}}}}var nt="[SessionRecording]";class rt{constructor(e,t){void 0===t&&(t={}),this._instance=e,this._config=t}get started(){var e;return!!(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.isStarted)}get status(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.sessionId)||""}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||!(null===(t=this._lazyLoadedRecording)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),console.info(nt+" starting")):this.stopRecording()}}stopRecording(){var e;null===(e=this._lazyLoadedRecording)||void 0===e||e.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._lazyLoadedRecording)||void 0===i?void 0:i.log)?this._lazyLoadedRecording.log(e,t):console.warn(nt+" log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config)}get _isRecordingEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,n=!t.disable_session_recording;return!!I&&i&&n}get _scriptName(){return"recorder"}_lazyLoadAndStart(e){var t,i,n,r;if(this._isRecordingEnabled)if((null===(i=null===(t=null==R?void 0:R.__VTiltExtensions__)||void 0===t?void 0:t.rrweb)||void 0===i?void 0:i.record)&&(null===(n=R.__VTiltExtensions__)||void 0===n?void 0:n.initSessionRecording))this._onScriptLoaded(e);else{var s=null===(r=R.__VTiltExtensions__)||void 0===r?void 0:r.loadExternalDependency;s?s(this._instance,this._scriptName,t=>{t?console.error(nt+" could not load recorder:",t):this._onScriptLoaded(e)}):console.error(nt+" loadExternalDependency not available. Session recording cannot start.")}}_onScriptLoaded(e){var t,i=null===(t=R.__VTiltExtensions__)||void 0===t?void 0:t.initSessionRecording;i?(this._lazyLoadedRecording||(this._lazyLoadedRecording=i(this._instance,this._config)),this._lazyLoadedRecording.start(e)):console.error(nt+" initSessionRecording not available after script load")}}var st=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(st||{}),ot=Uint8Array,at=Uint16Array,lt=Int32Array,dt=new ot([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]),ut=new ot([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]),ht=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ct=function(e,t){for(var i=new at(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var r=new lt(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return{b:i,r:r}},gt=ct(dt,2),vt=gt.b,_t=gt.r;vt[28]=258,_t[258]=28;for(var ft=ct(ut,0).r,pt=new at(32768),mt=0;mt<32768;++mt){var yt=(43690&mt)>>1|(21845&mt)<<1;yt=(61680&(yt=(52428&yt)>>2|(13107&yt)<<2))>>4|(3855&yt)<<4,pt[mt]=((65280&yt)>>8|(255&yt)<<8)>>1}var bt=function(e,t,i){for(var n=e.length,r=0,s=new at(t);r<n;++r)e[r]&&++s[e[r]-1];var o,a=new at(t);for(r=1;r<t;++r)a[r]=a[r-1]+s[r-1]<<1;if(i){o=new at(1<<t);var l=15-t;for(r=0;r<n;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],h=a[e[r]-1]++<<u,c=h|(1<<u)-1;h<=c;++h)o[pt[h]>>l]=d}else for(o=new at(n),r=0;r<n;++r)e[r]&&(o[r]=pt[a[e[r]-1]++]>>15-e[r]);return o},wt=new ot(288);for(mt=0;mt<144;++mt)wt[mt]=8;for(mt=144;mt<256;++mt)wt[mt]=9;for(mt=256;mt<280;++mt)wt[mt]=7;for(mt=280;mt<288;++mt)wt[mt]=8;var St=new ot(32);for(mt=0;mt<32;++mt)St[mt]=5;var It=bt(wt,9,0),Ct=bt(St,5,0),Mt=function(e){return(e+7)/8|0},Et=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new ot(e.subarray(t,i))},Tt=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8},Lt=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8,e[n+2]|=i>>16},kt=function(e,t){for(var i=[],n=0;n<e.length;++n)e[n]&&i.push({s:n,f:e[n]});var r=i.length,s=i.slice();if(!r)return{t:$t,l:0};if(1==r){var o=new ot(i[0].s+1);return o[i[0].s]=1,{t:o,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],d=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[d].f<i[h].f?d++:h++],l=i[d!=u&&i[d].f<i[h].f?d++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=s[0].s;for(n=1;n<r;++n)s[n].s>c&&(c=s[n].s);var g=new at(c+1),v=xt(i[u-1],g,0);if(v>t){n=0;var _=0,f=v-t,p=1<<f;for(s.sort(function(e,t){return g[t.s]-g[e.s]||e.f-t.f});n<r;++n){var m=s[n].s;if(!(g[m]>t))break;_+=p-(1<<v-g[m]),g[m]=t}for(_>>=f;_>0;){var y=s[n].s;g[y]<t?_-=1<<t-g[y]++-1:++n}for(;n>=0&&_;--n){var b=s[n].s;g[b]==t&&(--g[b],++_)}v=t}return{t:new ot(g),l:v}},xt=function(e,t,i){return-1==e.s?Math.max(xt(e.l,t,i+1),xt(e.r,t,i+1)):t[e.s]=i},Rt=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new at(++t),n=0,r=e[0],s=1,o=function(e){i[n++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&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(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=e[a]}return{c:i.subarray(0,n),n:t}},Pt=function(e,t){for(var i=0,n=0;n<t.length;++n)i+=e[n]*t[n];return i},At=function(e,t,i){var n=i.length,r=Mt(t+2);e[r]=255&n,e[r+1]=n>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;s<n;++s)e[r+s+4]=i[s];return 8*(r+4+n)},zt=function(e,t,i,n,r,s,o,a,l,d,u){Tt(t,u++,i),++r[256];for(var h=kt(r,15),c=h.t,g=h.l,v=kt(s,15),_=v.t,f=v.l,p=Rt(c),m=p.c,y=p.n,b=Rt(_),w=b.c,S=b.n,I=new at(19),C=0;C<m.length;++C)++I[31&m[C]];for(C=0;C<w.length;++C)++I[31&w[C]];for(var M=kt(I,7),E=M.t,T=M.l,L=19;L>4&&!E[ht[L-1]];--L);var k,x,R,P,A=d+5<<3,z=Pt(r,wt)+Pt(s,St)+o,O=Pt(r,c)+Pt(s,_)+o+14+3*L+Pt(I,E)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&A<=z&&A<=O)return At(t,u,e.subarray(l,l+d));if(Tt(t,u,1+(O<z)),u+=2,O<z){k=bt(c,g,0),x=c,R=bt(_,f,0),P=_;var $=bt(E,T,0);Tt(t,u,y-257),Tt(t,u+5,S-1),Tt(t,u+10,L-4),u+=14;for(C=0;C<L;++C)Tt(t,u+3*C,E[ht[C]]);u+=3*L;for(var q=[m,w],U=0;U<2;++U){var D=q[U];for(C=0;C<D.length;++C){var B=31&D[C];Tt(t,u,$[B]),u+=E[B],B>15&&(Tt(t,u,D[C]>>5&127),u+=D[C]>>12)}}}else k=It,x=wt,R=Ct,P=St;for(C=0;C<a;++C){var j=n[C];if(j>255){Lt(t,u,k[(B=j>>18&31)+257]),u+=x[B+257],B>7&&(Tt(t,u,j>>23&31),u+=dt[B]);var N=31&j;Lt(t,u,R[N]),u+=P[N],N>3&&(Lt(t,u,j>>5&8191),u+=ut[N])}else Lt(t,u,k[j]),u+=x[j]}return Lt(t,u,k[256]),u+x[256]},Ot=new lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$t=new ot(0),qt=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,n=9;--n;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Ut=function(e,t,i,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new ot(s.length+e.length);o.set(s),o.set(e,s.length),e=o,r.w=s.length}return function(e,t,i,n,r,s){var o=s.z||e.length,a=new ot(n+o+5*(1+Math.ceil(o/7e3))+r),l=a.subarray(n,a.length-r),d=s.l,u=7&(s.r||0);if(t){u&&(l[0]=s.r>>3);for(var h=Ot[t-1],c=h>>13,g=8191&h,v=(1<<i)-1,_=s.p||new at(32768),f=s.h||new at(v+1),p=Math.ceil(i/3),m=2*p,y=function(t){return(e[t]^e[t+1]<<p^e[t+2]<<m)&v},b=new lt(25e3),w=new at(288),S=new at(32),I=0,C=0,M=s.i||0,E=0,T=s.w||0,L=0;M+2<o;++M){var k=y(M),x=32767&M,R=f[k];if(_[x]=R,f[k]=x,T<=M){var P=o-M;if((I>7e3||E>24576)&&(P>423||!d)){u=zt(e,l,0,b,w,S,C,E,L,M-L,u),E=I=C=0,L=M;for(var A=0;A<286;++A)w[A]=0;for(A=0;A<30;++A)S[A]=0}var z=2,O=0,$=g,q=x-R&32767;if(P>2&&k==y(M-q))for(var U=Math.min(c,P)-1,D=Math.min(32767,M),B=Math.min(258,P);q<=D&&--$&&x!=R;){if(e[M+z]==e[M+z-q]){for(var j=0;j<B&&e[M+j]==e[M+j-q];++j);if(j>z){if(z=j,O=q,j>U)break;var N=Math.min(q,j-2),F=0;for(A=0;A<N;++A){var V=M-q+A&32767,W=V-_[V]&32767;W>F&&(F=W,R=V)}}}q+=(x=R)-(R=_[x])&32767}if(O){b[E++]=268435456|_t[z]<<18|ft[O];var J=31&_t[z],H=31&ft[O];C+=dt[J]+ut[H],++w[257+J],++S[H],T=M+z,++I}else b[E++]=e[M],++w[e[M]]}}for(M=Math.max(M,T);M<o;++M)b[E++]=e[M],++w[e[M]];u=zt(e,l,d,b,w,S,C,E,L,M-L,u),d||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=f,s.p=_,s.i=M,s.w=T)}else{for(M=s.w||0;M<o+d;M+=65535){var Q=M+65535;Q>=o&&(l[u/8|0]=d,Q=o),u=At(l,u+1,e.subarray(M,Q))}s.i=o}return Et(a,0,n+Mt(u)+r)}(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,n,r)},Dt=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Bt(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,n=0;n<t.length;++n)i=qt[255&i^t[n]]^i>>>8;e=i},d:function(){return~e}}}(),n=e.length;i.p(e);var r,s=Ut(e,t,10+((r=t).filename?r.filename.length+1:0),8),o=s.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Dt(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;n<=i.length;++n)e[n+10]=i.charCodeAt(n)}}(s,t),Dt(s,o-8,i.d()),Dt(s,o-4,n),s}var jt="undefined"!=typeof TextEncoder&&new TextEncoder,Nt="undefined"!=typeof TextDecoder&&new TextDecoder;try{Nt.decode($t,{stream:!0})}catch(e){}st.MouseMove,st.MouseInteraction,st.Scroll,st.ViewportResize,st.Input,st.TouchMove,st.MediaInteraction,st.Drag;var Ft="[Chat]";class Vt{constructor(e,t){void 0===t&&(t={}),this._instance=e,this._serverConfig=null,this._configFetched=!1,this._isLoading=!1,this._loadError=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._config=t}get isOpen(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.open()})}close(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.close()}toggle(){this._lazyLoadedChat?this._lazyLoadedChat.toggle():this.open()}show(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.show()})}hide(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.hide()}getChannels(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.getChannels()})}selectChannel(e){this._lazyLoadAndThen(()=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.selectChannel(e)})}createChannel(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.createChannel()})}goToChannelList(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.goToChannelList()}sendMessage(e){this._lazyLoadedChat?this._lazyLoadedChat.sendMessage(e):(this._pendingMessages.push(e),this._lazyLoadAndThen(()=>{this._pendingMessages.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.sendMessage(e)}),this._pendingMessages=[]}))}markAsRead(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.markAsRead()}onMessage(e){return this._messageCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}startIfEnabled(){var e=this;return t(function*(){var t,i,n,r;!1!==e._config.enabled?e._instance.getConfig().disable_chat?console.info(Ft+" disabled by disable_chat config"):(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),e._isChatEnabled?(null!==(n=null!==(t=e._config.preload)&&void 0!==t?t:null===(i=e._serverConfig)||void 0===i?void 0:i.enabled)&&void 0!==n&&n&&e._schedulePreload(),(null===(r=e._serverConfig)||void 0===r?void 0:r.enabled)&&e._showBubble(),console.info(Ft+" ready (lazy-load on demand)")):console.info(Ft+" not enabled (check dashboard settings)")):console.info(Ft+" disabled by code config")})()}updateConfig(e){this._config=i({},this._config,e)}getMergedConfig(){var e,t,i,n,r,s,o,a,l,d,u,h,c,g,v,_,f,p,m=this._serverConfig,y=this._config;return{enabled:null!==(t=null!==(e=y.enabled)&&void 0!==e?e:null==m?void 0:m.enabled)&&void 0!==t&&t,autoConfig:null===(i=y.autoConfig)||void 0===i||i,position:null!==(r=null!==(n=y.position)&&void 0!==n?n:null==m?void 0:m.position)&&void 0!==r?r:"bottom-right",greeting:null!==(s=y.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(a=null!==(o=y.color)&&void 0!==o?o:null==m?void 0:m.color)&&void 0!==a?a:"#6366f1",aiMode:null===(d=null!==(l=y.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=y.aiGreeting)&&void 0!==u?u:null==m?void 0:m.ai_greeting,preload:null!==(h=y.preload)&&void 0!==h&&h,theme:null!==(c=y.theme)&&void 0!==c?c:{primaryColor:null!==(v=null!==(g=y.color)&&void 0!==g?g:null==m?void 0:m.color)&&void 0!==v?v:"#6366f1"},offlineMessage:null!==(_=y.offlineMessage)&&void 0!==_?_:null==m?void 0:m.offline_message,collectEmailOffline:null===(p=null!==(f=y.collectEmailOffline)&&void 0!==f?f:null==m?void 0:m.collect_email_offline)||void 0===p||p}}destroy(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.destroy(),this._lazyLoadedChat=void 0,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[]}get _isChatEnabled(){var e;return!1!==this._config.enabled&&(!0===this._config.enabled||!0===(null===(e=this._serverConfig)||void 0===e?void 0:e.enabled))}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig(),i=t.token,n=t.api_host;if(!i||!n)return console.warn(Ft+" Cannot fetch settings: missing token or api_host"),void(e._configFetched=!0);try{var r=n+"/api/chat/settings?token="+encodeURIComponent(i),s=yield fetch(r);if(!s.ok)return console.warn(Ft+" Failed to fetch settings: "+s.status),void(e._configFetched=!0);e._serverConfig=yield s.json(),e._configFetched=!0,console.info(Ft+" Loaded settings from dashboard")}catch(t){console.warn(Ft+" Error fetching settings:",t),e._configFetched=!0}}})()}_showBubble(){if((null==I?void 0:I.document)&&!document.getElementById("vtilt-chat-bubble")){var e=this.getMergedConfig(),t=e.position||"bottom-right",i=e.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===t?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+i+";\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 _scriptName(){return"chat"}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._lazyLoad(),{timeout:5e3}):setTimeout(()=>this._lazyLoad(),3e3)}_lazyLoadAndThen(e){this._lazyLoadedChat?e():(this._pendingCallbacks.push(e),this._lazyLoad())}_lazyLoad(){var e,t;if(!(this._isLoading||this._lazyLoadedChat||this._loadError))if(null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.initChat)this._onScriptLoaded();else{this._isLoading=!0;var i=null===(t=R.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return console.error(Ft+" loadExternalDependency not available. Chat cannot start."),this._isLoading=!1,void(this._loadError="loadExternalDependency not available");i(this._instance,this._scriptName,e=>{if(this._isLoading=!1,e)return console.error(Ft+" Failed to load:",e),void(this._loadError=String(e));this._onScriptLoaded()})}}_onScriptLoaded(){var e,t=null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!t)return console.error(Ft+" initChat not available after script load"),void(this._loadError="initChat not available");if(!this._lazyLoadedChat){var i=this.getMergedConfig();this._lazyLoadedChat=t(this._instance,i),this._messageCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onMessage(e)}),this._typingCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onTyping(e)}),this._connectionCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onConnectionChange(e)});var n=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");n&&n.remove()}this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],console.info(Ft+" loaded and ready")}}var Wt,Jt="text/plain";!function(e){e.GZipJS="gzip-js",e.None="none"}(Wt||(Wt={}));var Ht=e=>{var{data:t,compression:i}=e;if(t){var n=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(t),r=new Blob([n]).size;if(i===Wt.GZipJS&&r>=1024)try{var s=Bt(function(e,t){if(jt)return jt.encode(e);for(var i=e.length,n=new ot(e.length+(e.length>>1)),r=0,s=function(e){n[r++]=e},o=0;o<i;++o){if(r+5>n.length){var a=new ot(r+8+(i-o<<1));a.set(n),n=a}var l=e.charCodeAt(o);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.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 Et(n,0,r)}(n),{mtime:0}),o=new Blob([s],{type:Jt});if(o.size<.95*r)return{contentType:Jt,body:o,estimatedSize:o.size}}catch(e){}return{contentType:"application/json",body:n,estimatedSize:r}}},Qt=[{name:"fetch",available:"undefined"!=typeof fetch,method:e=>{var n=Ht(e);if(n){var{contentType:r,body:s,estimatedSize:o}=n,a=e.compression===Wt.GZipJS&&r===Jt?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,l=i({"Content-Type":r},e.headers||{}),d=new AbortController,u=e.timeout?setTimeout(()=>d.abort(),e.timeout):null;fetch(a,{method:e.method||"POST",headers:l,body:s,keepalive:o<52428.8,signal:d.signal}).then(function(){var i=t(function*(t){var i,n=yield t.text(),r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){}null===(i=e.callback)||void 0===i||i.call(e,r)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:e=>{var t=Ht(e);if(t){var{contentType:i,body:n}=t,r=e.compression===Wt.GZipJS&&i===Jt?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,s=new XMLHttpRequest;s.open(e.method||"POST",r,!0),e.headers&&Object.entries(e.headers).forEach(e=>{var[t,i]=e;s.setRequestHeader(t,i)}),s.setRequestHeader("Content-Type",i),e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{var t;if(4===s.readyState){var i={statusCode:s.status,text:s.responseText};if(200===s.status)try{i.json=JSON.parse(s.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(n)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=Ht(e);if(t){var{contentType:i,body:n}=t;try{var r="string"==typeof n?new Blob([n],{type:i}):n,s=e.compression===Wt.GZipJS&&i===Jt?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url;navigator.sendBeacon(s,r)}catch(e){}}}}],Gt=e=>{var t,i=e.transport||"fetch",n=Qt.find(e=>e.name===i&&e.available)||Qt.find(e=>e.available);if(!n)return console.error("vTilt: No available transport method"),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0}));n.method(e)};class Xt{constructor(e,t){var i,n,r,s;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,n=250,r=5e3,s=3e3,"number"!=typeof i||isNaN(i)?s:Math.min(Math.max(i,n),r)),this._sendRequest=e}get length(){return this._queue.length}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){if(this._clearFlushTimeout(),0!==this._queue.length){var e=this._formatQueue();for(var t in e){var n=e[t];this._sendRequest(i({},n,{transport:"sendBeacon"}))}}}enable(){this._isPaused=!1,this._setFlushTimeout()}pause(){this._isPaused=!0,this._clearFlushTimeout()}flush(){this._clearFlushTimeout(),this._flushNow(),this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flushNow(),this._queue.length>0&&this._setFlushTimeout()},this._flushTimeoutMs))}_clearFlushTimeout(){this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0)}_flushNow(){if(0!==this._queue.length){var e=this._formatQueue(),t=Date.now();for(var i in e){var n=e[i];n.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(n)}}}_formatQueue(){var e={};return this._queue.forEach(t=>{var i=t.batchKey||t.url;e[i]||(e[i]={url:t.url,events:[],batchKey:t.batchKey}),e[i].events.push(t.event)}),this._queue=[],e}}class Kt{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,I&&void 0!==M&&"onLine"in M&&(this._areWeOnline=M.onLine,b(I,"online",()=>{this._areWeOnline=!0,this._flush()}),b(I,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,n=Math.min(18e5,t),r=(Math.random()-.5)*(n-i);return Math.ceil(n+r)}(t),n=Date.now()+i;this._queue.push({retryAt:n,request:e,retriesPerformedSoFar:t+1});var r="VTilt: Enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(r+=" (Browser is offline)"),console.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}}retriableRequest(e){var i=this;return t(function*(){try{var t=yield i._sendRequest(e);200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&i.enqueue(e,0)}catch(t){i.enqueue(e,0)}})()}_poll(){this._poller&&clearTimeout(this._poller),this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._queue.length>0?this._poll():this._isPolling=!1},this._pollIntervalMs)}_flush(){var e=this,i=Date.now(),n=[],r=[];this._queue.forEach(e=>{e.retryAt<i?r.push(e):n.push(e)}),this._queue=n,r.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:n}=t;try{var r=yield e._sendRequest(i);200!==r.statusCode&&(r.statusCode<400||r.statusCode>=500)&&e.enqueue(i,n)}catch(t){e.enqueue(i,n)}});return function(e){return i.apply(this,arguments)}}())}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._queue.forEach(e=>{var{request:t}=e;try{this._sendBeacon(t)}catch(e){console.error("VTilt: Failed to send beacon on unload",e)}}),this._queue=[]}}var Zt="vt_rate_limit";class Yt{constructor(e){var t,i;void 0===e&&(e={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(t=e.eventsPerSecond)&&void 0!==t?t:10,this.eventsBurstLimit=Math.max(null!==(i=e.eventsBurstLimit)&&void 0!==i?i:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=e.persistence,this.captureWarning=e.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(e){var t,i,n,r;void 0===e&&(e=!1);var s=Date.now(),o=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(Zt))&&void 0!==i?i:{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||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||null===(n=this.captureWarning)||void 0===n||n.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(r=this.persistence)||void 0===r||r.set(Zt,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}var ei=Array.isArray;class ti{constructor(e){void 0===e&&(e={}),this.version="1.1.5",this.__loaded=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this.__request_queue=[],this._has_warned_about_config=!1,this._set_once_properties_sent=!1,this.configManager=new n(e);var t=this.configManager.getConfig();this.sessionManager=new $(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new Xe(t.persistence||"localStorage",t.cross_subdomain_cookie),this.webVitalsManager=new et(t,this),this.rateLimiter=new Yt({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._capture_internal("$$client_ingestion_warning",{$$client_ingestion_warning_message:e})}}),this.retryQueue=new Kt({sendRequest:e=>this._send_http_request(e),sendBeacon:e=>this._send_beacon_request(e)}),this.requestQueue=new Xt(e=>this._send_batched_request(e),{flush_interval_ms:3e3})}init(e,t,i){var n;if(i&&i!==ni){var r=null!==(n=ii[i])&&void 0!==n?n:new ti;return r._init(e,t,i),ii[i]=r,ii[ni][i]=r,r}return this._init(e,t,i)}_init(e,t,n){if(void 0===t&&(t={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(i({},t,{projectId:e||t.projectId,name:n})),this.__loaded=!0;var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this.historyAutocapture=new it(this),this.historyAutocapture.startIfEnabled(),this._initSessionRecording(),this._initChat(),this._setup_unload_handler(),this._start_queue_if_opted_in(),!1!==r.capture_pageview&&this._capture_initial_pageview(),this}_start_queue_if_opted_in(){this.requestQueue.enable()}_setup_unload_handler(){if(I){var e=()=>{this.requestQueue.unload(),this.retryQueue.unload()};b(I,"beforeunload",e),b(I,"pagehide",e)}}toString(){var e,t=null!==(e=this.configManager.getConfig().name)&&void 0!==e?e:ni;return t!==ni&&(t=ni+"."+t),t}getCurrentDomain(){if(!T)return"";var e=T.protocol,t=T.hostname,i=T.port;return e+"//"+t+(i?":"+i:"")}_is_configured(){var e=this.configManager.getConfig();return!(!e.projectId||!e.token)||(this._has_warned_about_config||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this._has_warned_about_config=!0),!1)}buildUrl(){var e=this.configManager.getConfig(),{proxyUrl:t,proxy:i,api_host:n,token:r}=e;return t||(i?i+"/api/tracking?token="+r:n?n.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(e,t,i){if(this._is_configured()){if(i&&void 0!==I)if(I.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:e,event:t});this.requestQueue.enqueue({url:e,event:t})}}_send_batched_request(e){var{transport:t}=e;"sendBeacon"!==t?this.retryQueue.retriableRequest(e):this._send_beacon_request(e)}_send_http_request(e){return new Promise(t=>{var{url:i,events:n}=e,r=1===n.length?n[0]:{events:n},s=this.configManager.getConfig().disable_compression?Wt.None:Wt.GZipJS;Gt({url:i,data:r,method:"POST",transport:"XHR",compression:s,callback:e=>{t({statusCode:e.statusCode})}})})}_send_beacon_request(e){var{url:t,events:i}=e,n=1===i.length?i[0]:{events:i},r=this.configManager.getConfig().disable_compression?Wt.None:Wt.GZipJS;Gt({url:t,data:n,method:"POST",transport:"sendBeacon",compression:r})}_send_retriable_request(e){this.sendRequest(e.url,e.event,!1)}capture(e,t,n){if(this.sessionManager.setSessionId(),M&&M.userAgent&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(M.userAgent)&&((null==n?void 0:n.skip_client_rate_limiting)||this.rateLimiter.shouldAllowEvent())){var r=this.buildUrl(),s=Ge(),o=this.userManager.getUserProperties(),a=this.userManager.get_initial_props(),l=this.sessionManager.getSessionId(),d=this.sessionManager.getWindowId(),u=this.userManager.getAnonymousId(),h={};!this._set_once_properties_sent&&Object.keys(a).length>0&&Object.assign(h,a),t.$set_once&&Object.assign(h,t.$set_once);var c=i({},s,o,{$session_id:l,$window_id:d},u?{$anon_distinct_id:u}:{},Object.keys(h).length>0?{$set_once:h}:{},t.$set?{$set:t.$set}:{},t);!this._set_once_properties_sent&&Object.keys(a).length>0&&(this._set_once_properties_sent=!0),"$pageview"===e&&E&&(c.title=E.title);var g,v,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(g=Object.assign({},c,_.globalAttributes),!m(g=JSON.stringify(g)))return}else if(g=Object.assign({},c,_.globalAttributes),!m(JSON.stringify(g)))return;v="$identify"===e?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var f={timestamp:(new Date).toISOString(),event:e,project_id:_.projectId||"",payload:g,distinct_id:v,anonymous_id:u};this.sendRequest(r,f,!0)}}_capture_internal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}trackEvent(e,t){void 0===t&&(t={}),this.capture(e,t)}identify(e,t,i){if("number"==typeof e&&(e=String(e),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.userManager.isDistinctIdStringLikePublic(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var n=this.userManager.getDistinctId(),r=this.userManager.getAnonymousId(),s=this.userManager.getDeviceId(),o="anonymous"===this.userManager.getUserState();if(!s){var a=n||r;this.userManager.ensureDeviceId(a)}e!==n&&o?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(t,i),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r,$set:t||{},$set_once:i||{}}),this.userManager.setDistinctId(e)):t||i?(o&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(t,i),this.capture("$set",{$set:t||{},$set_once:i||{}})):e!==n&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(e))}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){this.userManager.setUserProperties(e,t)&&this.capture("$set",{$set:e||{},$set_once:t||{}})}resetUser(e){this.sessionManager.resetSessionId(),this.userManager.reset(e)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(e,t){var i=this.userManager.createAlias(e,t);i?this.capture("$alias",{$original_id:i.original,$alias_id:i.distinct_id}):e===(t||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(e)}_capture_initial_pageview(){E&&("visible"===E.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{if(E&&T){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this._visibility_state_listener&&(E.removeEventListener("visibilitychange",this._visibility_state_listener),this._visibility_state_listener=null)):this._visibility_state_listener||(this._visibility_state_listener=()=>{this._capture_initial_pageview()},b(E,"visibilitychange",this._visibility_state_listener)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.userManager.getDistinctId()||this.userManager.getAnonymousId()}getAnonymousId(){return this.userManager.getAnonymousId()}updateConfig(e){this.configManager.updateConfig(e);var t=this.configManager.getConfig();this.sessionManager=new $(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new Xe(t.persistence||"localStorage",t.cross_subdomain_cookie),this.webVitalsManager=new et(t,this),this.sessionRecording&&t.session_recording&&this.sessionRecording.updateConfig(this._buildSessionRecordingConfig(t))}_initSessionRecording(){var e=this.configManager.getConfig();if(!e.disable_session_recording){var t=this._buildSessionRecordingConfig(e);this.sessionRecording=new rt(this,t),t.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}_buildSessionRecordingConfig(e){var t,i,n,r=e.session_recording||{};return{enabled:null!==(t=r.enabled)&&void 0!==t&&t,sampleRate:r.sampleRate,minimumDurationMs:r.minimumDurationMs,sessionIdleThresholdMs:r.sessionIdleThresholdMs,fullSnapshotIntervalMs:r.fullSnapshotIntervalMs,captureConsole:null!==(i=r.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(n=r.captureNetwork)&&void 0!==n&&n,captureCanvas:r.captureCanvas,blockClass:r.blockClass,blockSelector:r.blockSelector,ignoreClass:r.ignoreClass,maskTextClass:r.maskTextClass,maskTextSelector:r.maskTextSelector,maskAllInputs:r.maskAllInputs,maskInputOptions:r.maskInputOptions,masking:r.masking,recordHeaders:r.recordHeaders,recordBody:r.recordBody,compressEvents:r.compressEvents,__mutationThrottlerRefillRate:r.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:r.__mutationThrottlerBucketSize}}startSessionRecording(){if(!this.sessionRecording){var e=this.configManager.getConfig(),t=this._buildSessionRecordingConfig(e);t.enabled=!0,this.sessionRecording=new rt(this,t)}this.sessionRecording.startIfEnabledOrStop("recording_initialized")}stopSessionRecording(){var e;null===(e=this.sessionRecording)||void 0===e||e.stopRecording()}isRecordingActive(){var e;return"active"===(null===(e=this.sessionRecording)||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this.sessionRecording)||void 0===e?void 0:e.sessionId)||null}_initChat(){var e=this.configManager.getConfig();if(!e.disable_chat){var t=this._buildChatConfig(e);this.chat=new Vt(this,t),this.chat.startIfEnabled()}}_buildChatConfig(e){var t,i=e.chat||{};return{enabled:i.enabled,autoConfig:null===(t=i.autoConfig)||void 0===t||t,position:i.position,greeting:i.greeting,color:i.color,aiMode:i.aiMode,aiGreeting:i.aiGreeting,preload:i.preload,offlineMessage:i.offlineMessage,collectEmailOffline:i.collectEmailOffline}}_execute_array(e){Array.isArray(e)&&e.forEach(e=>{if(e&&Array.isArray(e)&&e.length>0){var t=e[0],i=e.slice(1);if("function"==typeof this[t])try{this[t](...i)}catch(e){console.error("vTilt: Error executing queued call "+t+":",e)}}})}_dom_loaded(){this.__request_queue.forEach(e=>{this._send_retriable_request(e)}),this.__request_queue=[],this._start_queue_if_opted_in()}}var ii={},ni="vt",ri=!(void 0!==k||void 0!==L)&&-1===(null==x?void 0:x.indexOf("MSIE"))&&-1===(null==x?void 0:x.indexOf("Mozilla"));null!=I&&(I.__VTILT_ENQUEUE_REQUESTS=ri);var si,oi;si=ii[ni]=new ti,(oi=R.vt)&&y(oi._i,function(e){if(e&&ei(e)){var t=si.init(e[0],e[1],e[2]),i=oi[e[2]||"vt"]||oi;t&&t._execute_array(i)}}),R.vt=si,function(){function e(){e.done||(e.done=!0,ri=!1,null!=I&&(I.__VTILT_ENQUEUE_REQUESTS=!1),y(ii,function(e){e._dom_loaded()}))}E&&"function"==typeof E.addEventListener?"complete"===E.readyState?e():b(E,"DOMContentLoaded",e,{capture:!1}):I&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}()}();
|
|
1
|
+
!function(){"use strict";function e(e,t,i,r,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,n)}function t(t){return function(){var i=this,r=arguments;return new Promise(function(n,s){var o=t.apply(i,r);function a(t){e(o,n,s,a,l,"next",t)}function l(t){e(o,n,s,a,l,"throw",t)}a(void 0)})}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}class r{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!document.currentScript)return i({token:e.token||""},e);var t=document.currentScript,r=i({token:""},e);r.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,r.script_host=t.getAttribute("data-script-host")||e.script_host,r.proxy=t.getAttribute("data-proxy")||e.proxy,r.proxyUrl=t.getAttribute("data-proxy-url")||e.proxyUrl,r.token=t.getAttribute("data-token")||e.token||"",r.projectId=t.getAttribute("data-project-id")||e.projectId||"",r.domain=t.getAttribute("data-domain")||e.domain,r.storage=t.getAttribute("data-storage")||e.storage,r.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var n="true"===t.getAttribute("data-capture-performance");if(r.capture_performance=!!n||e.capture_performance,r.proxy&&r.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 s of(r.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))s.name.startsWith("data-vt-")&&(r.globalAttributes[s.name.slice(8).replace(/-/g,"_")]=s.value);return r}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}var n="__vt_session",s="__vt_window_id",o="__vt_primary_window",a="__vt_user_state",l="__vt_device_id",d="__vt_anonymous_id",u="__vt_distinct_id",h="__vt_user_properties",c="localStorage",g="localStorage+cookie",v="sessionStorage",_="memory",f="$initial_person_info";function p(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16))}function m(e){return!(!e||"string"!=typeof e)&&!(e.length<2||e.length>10240)}function y(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,r)=>{t.call(i,e,r)});else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(i,e[r],r)}function b(e,t,i,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:n,passive:s})}function w(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function S(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n of i)for(var s of n)e.push(s);return e}var I="undefined"!=typeof window?window:void 0,C="undefined"!=typeof globalThis?globalThis:I,L=null==C?void 0:C.navigator,k=null==C?void 0:C.document,T=null==C?void 0:C.location,E=null==C?void 0:C.fetch,M=(null==C?void 0:C.XMLHttpRequest)&&"withCredentials"in new C.XMLHttpRequest?C.XMLHttpRequest:void 0;null==C||C.AbortController;var x=null==L?void 0:L.userAgent,R=null!=I?I:{},P=[d,l,u,a],A=31536e3,z=["herokuapp.com","vercel.app","netlify.app"];function O(e){var t;if(!e||"undefined"==typeof document)return"";var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return"";var r=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class ${constructor(e){var t,i,r;this.memoryStorage=new Map,this._localStorageSupported=null,this.method=e.method,this.cross_subdomain=null!==(t=e.cross_subdomain)&&void 0!==t?t:function(){var e;if("undefined"==typeof document)return!1;var t=null===(e=document.location)||void 0===e?void 0:e.hostname;if(!t)return!1;var i=t.split(".").slice(-2).join(".");return!z.includes(i)}(),this.sameSite=null!==(i=e.sameSite)&&void 0!==i?i:"Lax",this.secure=null!==(r=e.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this._localStorageSupported)return this._localStorageSupported;if(void 0===I||!I.localStorage)return this._localStorageSupported=!1,!1;try{var e="__vt_ls_test__";I.localStorage.setItem(e,"1");var t="1"===I.localStorage.getItem(e);return I.localStorage.removeItem(e),this._localStorageSupported=t,t||console.warn("[vTilt] localStorage unavailable, using cookies"),t}catch(e){return this._localStorageSupported=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(e){return P.includes(e)}get(e){var t;try{switch(this.method){case _:return null!==(t=this.memoryStorage.get(e))&&void 0!==t?t:null;case g:return this.getLocalStoragePlusCookie(e);case c:return this.getLocalStorage(e);case v:return this.readFromSessionStorage(e);default:return this.getCookie(e)}}catch(t){return console.warn('[vTilt] Storage get error for "'+e+'":',t),null}}set(e,t,i){try{switch(this.method){case _:this.memoryStorage.set(e,t);break;case g:this.setLocalStoragePlusCookie(e,t,i);break;case c:this.setLocalStorage(e,t);break;case v:this.writeToSessionStorage(e,t);break;default:this.setCookie(e,t,null!=i?i:A)}}catch(t){console.warn('[vTilt] Storage set error for "'+e+'":',t)}}remove(e){try{switch(this.method){case _:this.memoryStorage.delete(e);break;case g:this.removeLocalStoragePlusCookie(e);break;case c:this.removeLocalStorage(e);break;case v:this.removeFromSessionStorage(e);break;default:this.removeCookie(e)}}catch(t){console.warn('[vTilt] Storage remove error for "'+e+'":',t)}}getLocalStoragePlusCookie(e){if(this.isCriticalProperty(e)){var t=this.getCookie(e),i=this.getLocalStorage(e);if(null!==t){if(i!==t&&this.isLocalStorageSupported())try{null==I||I.localStorage.setItem(e,t)}catch(e){}return t}return i}return this.getLocalStorage(e)}setLocalStoragePlusCookie(e,t,i){this.setLocalStorage(e,t),this.isCriticalProperty(e)&&this.setCookie(e,t,null!=i?i:A)}removeLocalStoragePlusCookie(e){this.removeLocalStorage(e),this.isCriticalProperty(e)&&this.removeCookie(e)}getLocalStorage(e){var t;if(!this.isLocalStorageSupported())return null;try{return null!==(t=null==I?void 0:I.localStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}setLocalStorage(e,t){if(this.isLocalStorageSupported())try{null==I||I.localStorage.setItem(e,t)}catch(e){console.warn("[vTilt] localStorage write error:",e)}}removeLocalStorage(e){if(this.isLocalStorageSupported())try{null==I||I.localStorage.removeItem(e)}catch(e){}}readFromSessionStorage(e){var t;try{return null!==(t=null==I?void 0:I.sessionStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}writeToSessionStorage(e,t){try{null==I||I.sessionStorage.setItem(e,t)}catch(e){console.warn("[vTilt] sessionStorage write error:",e)}}removeFromSessionStorage(e){try{null==I||I.sessionStorage.removeItem(e)}catch(e){}}getCookie(e){if("undefined"==typeof document)return null;var t=e+"=";for(var i of document.cookie.split(";")){var r=i.trim();if(r.startsWith(t))try{return decodeURIComponent(r.slice(t.length))}catch(e){return r.slice(t.length)}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var r=O(this.cross_subdomain),n=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(e){if("undefined"!=typeof document){var t=O(this.cross_subdomain);document.cookie=e+"=; Max-Age=0; path=/"+(t?"; domain="+t:""),document.cookie=e+"=; Max-Age=0; path=/"}}getWithExpiry(e){var t=this.get(e);if(!t)return null;try{var i=JSON.parse(t);return i.expiry&&Date.now()>i.expiry?(this.remove(e),null):i.value}catch(e){return null}}setWithExpiry(e,t,r){var n=i({value:t},r?{expiry:Date.now()+r}:{});this.set(e,JSON.stringify(n))}getJSON(e){var t=this.get(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return null}}setJSON(e,t,i){this.set(e,JSON.stringify(t),i)}canUseSessionStorage(){if(void 0===I||!(null==I?void 0:I.sessionStorage))return!1;try{var e="__vt_ss_test__";return I.sessionStorage.setItem(e,"1"),I.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==I?void 0:I.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class q{constructor(e,t){void 0===e&&(e="cookie"),this.storage=new $({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=p(),this._storeSessionId(e)),e}setSessionId(){var e=this._getSessionIdRaw()||p();return this._storeSessionId(e),e}resetSessionId(){this._clearSessionId(),this.setSessionId(),this._setWindowId(p())}_getSessionIdRaw(){return this.storage.get(n)}_storeSessionId(e){this.storage.set(n,e,1800)}_clearSessionId(){this.storage.remove(n)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s);if(t)return this._windowId=t,t}var i=p();return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(s,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(o),i=e.getItem(s);i&&!t?this._windowId=i:(i&&e.removeItem(s),this._setWindowId(p())),e.setItem(o,"true"),this._listenToUnload()}else this._windowId=p()}_listenToUnload(){var e=this.storage.getSessionStorage();I&&e&&b(I,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(o)},{capture:!1})}updateStorageMethod(e,t){this.storage=new $({method:e,cross_subdomain:t,sameSite:"Lax"})}}function U(e){if(!k)return null;var t=k.createElement("a");return t.href=e,t}function D(e,t){for(var i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<i.length;r++){var n=i[r].split("=");if(n[0]===t){if(n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(e){}return s.replace(/\+/g," ")}}return""}function B(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],l=o[0],d=(a||"").split("&"),u=[],h=0;h<d.length;h++){var c=d[h].split("="),g=c[0],v=c.slice(1).join("=");-1!==t.indexOf(g)?u.push(g+"="+i):g&&u.push(g+(v?"="+v:""))}var _=u.join("&");return l+(_?"?"+_:"")+(s?"#"+s:"")}function F(e){return"function"==typeof e}var N="Mobile",j="iOS",V="Android",W="Tablet",J=V+" "+W,H="iPad",Q="Apple",G=Q+" Watch",X="Safari",K="BlackBerry",Z="Samsung",Y=Z+"Browser",ee=Z+" Internet",te="Chrome",ie=te+" OS",re=te+" "+j,ne="Internet Explorer",se=ne+" "+N,oe="Opera",ae=oe+" Mini",le="Edge",de="Microsoft "+le,ue="Firefox",he=ue+" "+j,ce="Nintendo",ge="PlayStation",ve="Xbox",_e=V+" "+N,fe=N+" "+X,pe="Windows",me=pe+" Phone",ye="Nokia",be="Ouya",we="Generic",Se=we+" "+N.toLowerCase(),Ie=we+" "+W.toLowerCase(),Ce="Konqueror",Le="(\\d+(\\.\\d+)?)",ke=new RegExp("Version/"+Le),Te=new RegExp(ve,"i"),Ee=new RegExp(ge+" \\w+","i"),Me=new RegExp(ce+" \\w+","i"),xe=new RegExp(K+"|PlayBook|BB10","i"),Re={"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 Pe(e,t){return e.toLowerCase().includes(t.toLowerCase())}var Ae=(e,t)=>t&&Pe(t,Q)||function(e){return Pe(e,X)&&!Pe(e,te)&&!Pe(e,V)}(e),ze=function(e,t){return t=t||"",Pe(e," OPR/")&&Pe(e,"Mini")?ae:Pe(e," OPR/")?oe:xe.test(e)?K:Pe(e,"IE"+N)||Pe(e,"WPDesktop")?se:Pe(e,Y)?ee:Pe(e,le)||Pe(e,"Edg/")?de:Pe(e,"FBIOS")?"Facebook "+N:Pe(e,"UCWEB")||Pe(e,"UCBrowser")?"UC Browser":Pe(e,"CriOS")?re:Pe(e,"CrMo")||Pe(e,te)?te:Pe(e,V)&&Pe(e,X)?_e:Pe(e,"FxiOS")?he:Pe(e.toLowerCase(),Ce.toLowerCase())?Ce:Ae(e,t)?Pe(e,N)?fe:X:Pe(e,ue)?ue:Pe(e,"MSIE")||Pe(e,"Trident/")?ne:Pe(e,"Gecko")?ue:""},Oe={[se]:[new RegExp("rv:"+Le)],[de]:[new RegExp(le+"?\\/"+Le)],[te]:[new RegExp("("+te+"|CrMo)\\/"+Le)],[re]:[new RegExp("CriOS\\/"+Le)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Le)],[X]:[ke],[fe]:[ke],[oe]:[new RegExp("(Opera|OPR)\\/"+Le)],[ue]:[new RegExp(ue+"\\/"+Le)],[he]:[new RegExp("FxiOS\\/"+Le)],[Ce]:[new RegExp("Konqueror[:/]?"+Le,"i")],[K]:[new RegExp(K+" "+Le),ke],[_e]:[new RegExp("android\\s"+Le,"i")],[ee]:[new RegExp(Y+"\\/"+Le)],[ne]:[new RegExp("(rv:|MSIE )"+Le)],Mozilla:[new RegExp("rv:"+Le)]},$e=function(e,t){var i=ze(e,t),r=Oe[i];if(void 0===r)return null;for(var n=0;n<r.length;n++){var s=r[n],o=e.match(s);if(o)return parseFloat(o[o.length-2])}return null},qe=[[new RegExp(ve+"; "+ve+" (.*?)[);]","i"),e=>[ve,e&&e[1]||""]],[new RegExp(ce,"i"),[ce,""]],[new RegExp(ge,"i"),[ge,""]],[xe,[K,""]],[new RegExp(pe,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[me,""];if(new RegExp(N).test(t)&&!/IEMobile\b/.test(t))return[pe+" "+N,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],n=Re[r]||"";return/arm/i.test(t)&&(n="RT"),[pe,n]}return[pe,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[j,t.join(".")]}return[j,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=void 0===e[2]?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+V+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+V+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[V,t.join(".")]}return[V,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ie,""]],[/Linux|debian/i,["Linux",""]]],Ue=function(e){return Me.test(e)?ce:Ee.test(e)?ge:Te.test(e)?ve:new RegExp(be,"i").test(e)?be:new RegExp("("+me+"|WPDesktop)","i").test(e)?me:/iPad/.test(e)?H:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?G:xe.test(e)?K:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ye,"i").test(e)?ye:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(N).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?V:J:V:new RegExp("(pda|"+N+")","i").test(e)?Se:new RegExp(W,"i").test(e)&&!new RegExp(W+" pc","i").test(e)?Ie:""},De="https?://(.*)",Be=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Fe=S(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Be),Ne="<masked>";function je(e){var t=function(e){return e?0===e.search(De+"google.([^/?]*)")?"google":0===e.search(De+"bing.com")?"bing":0===e.search(De+"yahoo.com")?"yahoo":0===e.search(De+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",r={};if(null!==t){r.$search_engine=t;var n=k?D(k.referrer,i):"";n.length&&(r.ph_keyword=n)}return r}function Ve(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function We(){return(null==k?void 0:k.referrer)||"$direct"}function Je(){var e;return(null==k?void 0:k.referrer)&&(null===(e=U(k.referrer))||void 0===e?void 0:e.host)||"$direct"}function He(e){var t,{r:i,u:r}=e,n={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=U(i))||void 0===t?void 0:t.host};if(r){n.$current_url=r;var s=U(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(e){var t=Fe.concat([]),i={};return y(t,function(t){var r=D(e,t);i[t]=r||null}),i}(r);w(n,o)}i&&w(n,je(i));return n}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ge(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function Xe(e,t){if(!x)return{};var i,r,n,[s,o]=function(e){for(var t=0;t<qe.length;t++){var[i,r]=qe[t],n=i.exec(e),s=n&&(F(r)?r(n,e):r);if(s)return s}return["",""]}(x);return w(function(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];null!=r&&""!==r&&(t[i]=r)}return t}({$os:s,$os_version:o,$browser:ze(x,navigator.vendor),$device:Ue(x),$device_type:(r=x,n=Ue(r),n===H||n===J||"Kobo"===n||"Kindle Fire"===n||n===Ie?W:n===ce||n===ve||n===ge||n===be?"Console":n===G?"Wearable":n?N:"Desktop"),$timezone:Qe(),$timezone_offset:Ge()}),{$current_url:B(null==T?void 0:T.href,[],Ne),$host:null==T?void 0:T.host,$pathname:null==T?void 0:T.pathname,$raw_user_agent:x.length>1e3?x.substring(0,997)+"...":x,$browser_version:$e(x,navigator.vendor),$browser_language:Ve(),$browser_language_prefix:(i=Ve(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==I?void 0:I.screen.height,$screen_width:null==I?void 0:I.screen.width,$viewport_height:null==I?void 0:I.innerHeight,$viewport_width:null==I?void 0:I.innerWidth,$lib:"web",$lib_version:"1.0.7",$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class Ke{constructor(e,t){void 0===e&&(e="localStorage"),this._cachedPersonProperties=null,this.storage=new $({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,A)),this.userIdentity.anonymous_id}getUserProperties(){return i({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(e,t,r){if("number"==typeof e&&(e=e.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.isDistinctIdStringLike(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var n=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=e,!this.userIdentity.device_id){var s=n||this.userIdentity.anonymous_id;this.userIdentity.device_id=s,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:s})}e!==n&&(this.userIdentity.distinct_id=e);var o="anonymous"===this.userIdentity.user_state;e!==n&&o?(this.userIdentity.user_state="identified",t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),r&&Object.keys(r).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=r[e])}),this.saveUserIdentity()):t||r?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),r&&Object.keys(r).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=r[e])}),this.saveUserIdentity()):e!==n&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){if(!e&&!t)return!1;var r=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,n=this.getPersonPropertiesHash(r,e,t);return this._cachedPersonProperties===n?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity(),this._cachedPersonProperties=n,!0)}reset(e){var t=this.generateAnonymousId(),r=this.userIdentity.device_id,n=e?this.generateDeviceId():r;this.userIdentity={distinct_id:null,anonymous_id:t,device_id:n,properties:{},user_state:"anonymous"},this._cachedPersonProperties=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(e){this.userIdentity.distinct_id=e,this.saveUserIdentity()}setUserState(e){this.userIdentity.user_state=e,this.saveUserIdentity()}updateUserProperties(e,t){e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity()}ensureDeviceId(e){this.userIdentity.device_id||(this.userIdentity.device_id=e,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:e}),this.saveUserIdentity())}createAlias(e,t){return this.isValidDistinctId(e)?(void 0===t&&(t=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(t)?e===t?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:e,original:t}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(e){return this.isDistinctIdStringLike(e)}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?S([],Be,t||[]):[],r=null==T?void 0:T.href.substring(0,1e3);return{r:We().substring(0,1e3),u:r?B(r,i,Ne):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e,t,i=this.getStoredUserProperties()[f];return i?(e=He(i),t={},y(e,function(e,i){var r;t["$initial_"+(r=String(i),r.startsWith("$")?r.substring(1):r)]=e}),t):{}}update_referrer_info(){var e={$referrer:We(),$referring_domain:Je()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d),t=this.storage.get(l),i=this.storage.get(u),r=this.storage.get(a),n=this.getStoredUserProperties(),s=e||this.generateAnonymousId(),o=t||this.generateDeviceId(),h=i||null,c=r||"anonymous",g=s||this.generateAnonymousId();return e||this.storage.set(d,g,A),t||this.storage.set(l,o,A),r||this.storage.set(a,c,A),{distinct_id:h,anonymous_id:g,device_id:o,properties:n,user_state:c}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,A),this.storage.set(l,this.userIdentity.device_id,A),this.storage.set(a,this.userIdentity.user_state,A),this.userIdentity.distinct_id?this.storage.set(u,this.userIdentity.distinct_id,A):this.storage.remove(u),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(h)||{}}setStoredUserProperties(e){this.storage.setJSON(h,e,A)}register_once(e,t){var i=this.getStoredUserProperties(),r=!1;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(n in i||(i[n]=e[n],r=!0));if(t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(s in i||(i[s]=t[s],r=!0));r&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+p()}generateDeviceId(){return"device_"+p()}getPersonPropertiesHash(e,t,i){return JSON.stringify({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}isValidDistinctId(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(t)&&0!==e.trim().length}isDistinctIdStringLike(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(t)}updateStorageMethod(e,t){this.storage=new $({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var Ze=["LCP","CLS","FCP","INP"],Ye=9e5,et="[WebVitals]";class tt{constructor(e,t){this.initialized=!1,this.instance=t,this.buffer=this.createEmptyBuffer(),this.config=this.parseConfig(e.capture_performance),this.isEnabled&&I&&this.startIfEnabled()}parseConfig(e){return"boolean"==typeof e?{web_vitals:e}:"object"==typeof e&&null!==e?e:{web_vitals:!1}}get isEnabled(){var e=null==T?void 0:T.protocol;return("http:"===e||"https:"===e)&&!1!==this.config.web_vitals}get allowedMetrics(){return this.config.web_vitals_allowed_metrics||Ze}get flushTimeoutMs(){return this.config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var e=this.config.__web_vitals_max_value;return void 0===e?Ye:0===e?0:e<6e4?Ye:e}createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}getWebVitalsCallbacks(){var e;return null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.webVitalsCallbacks}startIfEnabled(){if(this.isEnabled&&!this.initialized){var e=this.getWebVitalsCallbacks();e?this.startCapturing(e):this.loadWebVitals()}}loadWebVitals(){var e,t=null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.loadExternalDependency;t?t(this.instance,"web-vitals",e=>{if(e)console.error(et+" Failed to load web-vitals:",e);else{var t=this.getWebVitalsCallbacks();t?this.startCapturing(t):console.error(et+" web-vitals loaded but callbacks not registered")}}):console.warn(et+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}startCapturing(e){if(!this.initialized){var t=this.allowedMetrics,i=this.addToBuffer.bind(this);t.includes("LCP")&&e.onLCP&&e.onLCP(i),t.includes("CLS")&&e.onCLS&&e.onCLS(i,{reportAllChanges:!0}),t.includes("FCP")&&e.onFCP&&e.onFCP(i),t.includes("INP")&&e.onINP&&e.onINP(i),t.includes("TTFB")&&e.onTTFB&&e.onTTFB(i),this.initialized=!0}}getCurrentUrl(){var e;return null===(e=null==I?void 0:I.location)||void 0===e?void 0:e.href}getCurrentPathname(){return null==T?void 0:T.pathname}addToBuffer(e){try{if(!I||!k||!T)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void console.warn(et+" Invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void console.warn(et+" Ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var t=this.getCurrentUrl(),r=this.getCurrentPathname();if(!t)return void console.warn(et+" Could not determine current URL");this.buffer.url&&this.buffer.url!==t&&this.flush(),this.buffer.url||(this.buffer.url=t,this.buffer.pathname=r),this.buffer.firstMetricTimestamp||(this.buffer.firstMetricTimestamp=Date.now());var n=this.cleanAttribution(e.attribution),s=this.instance.getSessionId(),o=this.getWindowId(),a=i({},e,{attribution:n,timestamp:Date.now(),$current_url:t,$session_id:s,$window_id:o}),l=this.buffer.metrics.findIndex(t=>t.name===e.name);l>=0?this.buffer.metrics[l]=a:this.buffer.metrics.push(a),this.scheduleFlush(),this.buffer.metrics.length>=this.allowedMetrics.length&&this.flush()}catch(e){console.error(et+" Error adding metric to buffer:",e)}}cleanAttribution(e){if(e){var t=i({},e);return"interactionTargetElement"in t&&delete t.interactionTargetElement,t}}getWindowId(){var e;try{return(null===(e=this.instance.sessionManager)||void 0===e?void 0:e.getWindowId())||null}catch(e){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 e={$pathname:this.buffer.pathname,$current_url:this.buffer.url};for(var t of this.buffer.metrics)e["$web_vitals_"+t.name+"_value"]=t.value,e["$web_vitals_"+t.name+"_event"]={name:t.name,value:t.value,delta:t.delta,rating:t.rating,id:t.id,navigationType:t.navigationType,attribution:t.attribution,$session_id:t.$session_id,$window_id:t.$window_id};this.instance.capture("$web_vitals",e)}catch(e){console.error(et+" Error flushing metrics:",e)}this.buffer=this.createEmptyBuffer()}}}function it(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],n=i(r);return F(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]=r}}catch(e){return()=>{}}}class rt{constructor(e){var t;this._instance=e,this._lastPathname=(null===(t=null==I?void 0:I.location)||void 0===t?void 0:t.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0}monitorHistoryChanges(){var e,t;if(I&&T&&(this._lastPathname=T.pathname||"",I.history)){var i=this;(null===(e=I.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||it(I.history,"pushState",e=>function(t,r,n){e.call(this,t,r,n),i._capturePageview("pushState")}),(null===(t=I.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||it(I.history,"replaceState",e=>function(t,r,n){e.call(this,t,r,n),i._capturePageview("replaceState")}),this._setupPopstateListener()}}_capturePageview(e){var t;try{var i=null===(t=null==I?void 0:I.location)||void 0===t?void 0:t.pathname;if(!i||!T||!k)return;if(i!==this._lastPathname&&this.isEnabled){var r={navigation_type:e};this._instance.capture("$pageview",r)}this._lastPathname=i}catch(t){console.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener&&I){var e=()=>{this._capturePageview("popstate")};b(I,"popstate",e),this._popstateListener=()=>{I&&I.removeEventListener("popstate",e)}}}}var nt="[SessionRecording]";class st{constructor(e,t){void 0===t&&(t={}),this._instance=e,this._config=t}get started(){var e;return!!(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.isStarted)}get status(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.sessionId)||""}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||!(null===(t=this._lazyLoadedRecording)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),console.info(nt+" starting")):this.stopRecording()}}stopRecording(){var e;null===(e=this._lazyLoadedRecording)||void 0===e||e.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._lazyLoadedRecording)||void 0===i?void 0:i.log)?this._lazyLoadedRecording.log(e,t):console.warn(nt+" log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config)}get _isRecordingEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,r=!t.disable_session_recording;return!!I&&i&&r}get _scriptName(){return"recorder"}_lazyLoadAndStart(e){var t,i,r,n;if(this._isRecordingEnabled)if((null===(i=null===(t=null==R?void 0:R.__VTiltExtensions__)||void 0===t?void 0:t.rrweb)||void 0===i?void 0:i.record)&&(null===(r=R.__VTiltExtensions__)||void 0===r?void 0:r.initSessionRecording))this._onScriptLoaded(e);else{var s=null===(n=R.__VTiltExtensions__)||void 0===n?void 0:n.loadExternalDependency;s?s(this._instance,this._scriptName,t=>{t?console.error(nt+" could not load recorder:",t):this._onScriptLoaded(e)}):console.error(nt+" loadExternalDependency not available. Session recording cannot start.")}}_onScriptLoaded(e){var t,i=null===(t=R.__VTiltExtensions__)||void 0===t?void 0:t.initSessionRecording;i?(this._lazyLoadedRecording||(this._lazyLoadedRecording=i(this._instance,this._config)),this._lazyLoadedRecording.start(e)):console.error(nt+" initSessionRecording not available after script load")}}var ot=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ot||{}),at=Uint8Array,lt=Uint16Array,dt=Int32Array,ut=new at([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]),ht=new at([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]),ct=new at([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gt=function(e,t){for(var i=new lt(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new dt(i[30]);for(r=1;r<30;++r)for(var s=i[r];s<i[r+1];++s)n[s]=s-i[r]<<5|r;return{b:i,r:n}},vt=gt(ut,2),_t=vt.b,ft=vt.r;_t[28]=258,ft[258]=28;for(var pt=gt(ht,0).r,mt=new lt(32768),yt=0;yt<32768;++yt){var bt=(43690&yt)>>1|(21845&yt)<<1;bt=(61680&(bt=(52428&bt)>>2|(13107&bt)<<2))>>4|(3855&bt)<<4,mt[yt]=((65280&bt)>>8|(255&bt)<<8)>>1}var wt=function(e,t,i){for(var r=e.length,n=0,s=new lt(t);n<r;++n)e[n]&&++s[e[n]-1];var o,a=new lt(t);for(n=1;n<t;++n)a[n]=a[n-1]+s[n-1]<<1;if(i){o=new lt(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var d=n<<4|e[n],u=t-e[n],h=a[e[n]-1]++<<u,c=h|(1<<u)-1;h<=c;++h)o[mt[h]>>l]=d}else for(o=new lt(r),n=0;n<r;++n)e[n]&&(o[n]=mt[a[e[n]-1]++]>>15-e[n]);return o},St=new at(288);for(yt=0;yt<144;++yt)St[yt]=8;for(yt=144;yt<256;++yt)St[yt]=9;for(yt=256;yt<280;++yt)St[yt]=7;for(yt=280;yt<288;++yt)St[yt]=8;var It=new at(32);for(yt=0;yt<32;++yt)It[yt]=5;var Ct=wt(St,9,0),Lt=wt(It,5,0),kt=function(e){return(e+7)/8|0},Tt=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new at(e.subarray(t,i))},Et=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8},Mt=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8,e[r+2]|=i>>16},xt=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,s=i.slice();if(!n)return{t:qt,l:0};if(1==n){var o=new at(i[0].s+1);return o[i[0].s]=1,{t:o,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],d=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f<i[h].f?d++:h++],l=i[d!=u&&i[d].f<i[h].f?d++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=s[0].s;for(r=1;r<n;++r)s[r].s>c&&(c=s[r].s);var g=new lt(c+1),v=Rt(i[u-1],g,0);if(v>t){r=0;var _=0,f=v-t,p=1<<f;for(s.sort(function(e,t){return g[t.s]-g[e.s]||e.f-t.f});r<n;++r){var m=s[r].s;if(!(g[m]>t))break;_+=p-(1<<v-g[m]),g[m]=t}for(_>>=f;_>0;){var y=s[r].s;g[y]<t?_-=1<<t-g[y]++-1:++r}for(;r>=0&&_;--r){var b=s[r].s;g[b]==t&&(--g[b],++_)}v=t}return{t:new at(g),l:v}},Rt=function(e,t,i){return-1==e.s?Math.max(Rt(e.l,t,i+1),Rt(e.r,t,i+1)):t[e.s]=i},Pt=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new lt(++t),r=0,n=e[0],s=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==n&&a!=t)++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=e[a]}return{c:i.subarray(0,r),n:t}},At=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},zt=function(e,t,i){var r=i.length,n=kt(t+2);e[n]=255&r,e[n+1]=r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;s<r;++s)e[n+s+4]=i[s];return 8*(n+4+r)},Ot=function(e,t,i,r,n,s,o,a,l,d,u){Et(t,u++,i),++n[256];for(var h=xt(n,15),c=h.t,g=h.l,v=xt(s,15),_=v.t,f=v.l,p=Pt(c),m=p.c,y=p.n,b=Pt(_),w=b.c,S=b.n,I=new lt(19),C=0;C<m.length;++C)++I[31&m[C]];for(C=0;C<w.length;++C)++I[31&w[C]];for(var L=xt(I,7),k=L.t,T=L.l,E=19;E>4&&!k[ct[E-1]];--E);var M,x,R,P,A=d+5<<3,z=At(n,St)+At(s,It)+o,O=At(n,c)+At(s,_)+o+14+3*E+At(I,k)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&A<=z&&A<=O)return zt(t,u,e.subarray(l,l+d));if(Et(t,u,1+(O<z)),u+=2,O<z){M=wt(c,g,0),x=c,R=wt(_,f,0),P=_;var $=wt(k,T,0);Et(t,u,y-257),Et(t,u+5,S-1),Et(t,u+10,E-4),u+=14;for(C=0;C<E;++C)Et(t,u+3*C,k[ct[C]]);u+=3*E;for(var q=[m,w],U=0;U<2;++U){var D=q[U];for(C=0;C<D.length;++C){var B=31&D[C];Et(t,u,$[B]),u+=k[B],B>15&&(Et(t,u,D[C]>>5&127),u+=D[C]>>12)}}}else M=Ct,x=St,R=Lt,P=It;for(C=0;C<a;++C){var F=r[C];if(F>255){Mt(t,u,M[(B=F>>18&31)+257]),u+=x[B+257],B>7&&(Et(t,u,F>>23&31),u+=ut[B]);var N=31&F;Mt(t,u,R[N]),u+=P[N],N>3&&(Mt(t,u,F>>5&8191),u+=ht[N])}else Mt(t,u,M[F]),u+=x[F]}return Mt(t,u,M[256]),u+x[256]},$t=new dt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qt=new at(0),Ut=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Dt=function(e,t,i,r,n){if(!n&&(n={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new at(s.length+e.length);o.set(s),o.set(e,s.length),e=o,n.w=s.length}return function(e,t,i,r,n,s){var o=s.z||e.length,a=new at(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),d=s.l,u=7&(s.r||0);if(t){u&&(l[0]=s.r>>3);for(var h=$t[t-1],c=h>>13,g=8191&h,v=(1<<i)-1,_=s.p||new lt(32768),f=s.h||new lt(v+1),p=Math.ceil(i/3),m=2*p,y=function(t){return(e[t]^e[t+1]<<p^e[t+2]<<m)&v},b=new dt(25e3),w=new lt(288),S=new lt(32),I=0,C=0,L=s.i||0,k=0,T=s.w||0,E=0;L+2<o;++L){var M=y(L),x=32767&L,R=f[M];if(_[x]=R,f[M]=x,T<=L){var P=o-L;if((I>7e3||k>24576)&&(P>423||!d)){u=Ot(e,l,0,b,w,S,C,k,E,L-E,u),k=I=C=0,E=L;for(var A=0;A<286;++A)w[A]=0;for(A=0;A<30;++A)S[A]=0}var z=2,O=0,$=g,q=x-R&32767;if(P>2&&M==y(L-q))for(var U=Math.min(c,P)-1,D=Math.min(32767,L),B=Math.min(258,P);q<=D&&--$&&x!=R;){if(e[L+z]==e[L+z-q]){for(var F=0;F<B&&e[L+F]==e[L+F-q];++F);if(F>z){if(z=F,O=q,F>U)break;var N=Math.min(q,F-2),j=0;for(A=0;A<N;++A){var V=L-q+A&32767,W=V-_[V]&32767;W>j&&(j=W,R=V)}}}q+=(x=R)-(R=_[x])&32767}if(O){b[k++]=268435456|ft[z]<<18|pt[O];var J=31&ft[z],H=31&pt[O];C+=ut[J]+ht[H],++w[257+J],++S[H],T=L+z,++I}else b[k++]=e[L],++w[e[L]]}}for(L=Math.max(L,T);L<o;++L)b[k++]=e[L],++w[e[L]];u=Ot(e,l,d,b,w,S,C,k,E,L-E,u),d||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=f,s.p=_,s.i=L,s.w=T)}else{for(L=s.w||0;L<o+d;L+=65535){var Q=L+65535;Q>=o&&(l[u/8|0]=d,Q=o),u=zt(l,u+1,e.subarray(L,Q))}s.i=o}return Tt(a,0,r+kt(u)+n)}(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,r,n)},Bt=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Ft(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Ut[255&i^t[r]]^i>>>8;e=i},d:function(){return~e}}}(),r=e.length;i.p(e);var n,s=Dt(e,t,10+((n=t).filename?n.filename.length+1:0),8),o=s.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Bt(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(s,t),Bt(s,o-8,i.d()),Bt(s,o-4,r),s}var Nt="undefined"!=typeof TextEncoder&&new TextEncoder,jt="undefined"!=typeof TextDecoder&&new TextDecoder;try{jt.decode(qt,{stream:!0})}catch(e){}ot.MouseMove,ot.MouseInteraction,ot.Scroll,ot.ViewportResize,ot.Input,ot.TouchMove,ot.MediaInteraction,ot.Drag;var Vt="[Chat]";class Wt{constructor(e,t){void 0===t&&(t={}),this._instance=e,this._serverConfig=null,this._configFetched=!1,this._isLoading=!1,this._loadError=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._config=t}get isOpen(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.open()})}close(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.close()}toggle(){this._lazyLoadedChat?this._lazyLoadedChat.toggle():this.open()}show(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.show()})}hide(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.hide()}getChannels(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.getChannels()})}selectChannel(e){this._lazyLoadAndThen(()=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.selectChannel(e)})}createChannel(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.createChannel()})}goToChannelList(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.goToChannelList()}sendMessage(e){this._lazyLoadedChat?this._lazyLoadedChat.sendMessage(e):(this._pendingMessages.push(e),this._lazyLoadAndThen(()=>{this._pendingMessages.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.sendMessage(e)}),this._pendingMessages=[]}))}markAsRead(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.markAsRead()}onMessage(e){return this._messageCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}startIfEnabled(){var e=this;return t(function*(){var t,i,r,n;!1!==e._config.enabled?e._instance.getConfig().disable_chat?console.info(Vt+" disabled by disable_chat config"):(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),e._isChatEnabled?(null!==(r=null!==(t=e._config.preload)&&void 0!==t?t:null===(i=e._serverConfig)||void 0===i?void 0:i.enabled)&&void 0!==r&&r&&e._schedulePreload(),(null===(n=e._serverConfig)||void 0===n?void 0:n.enabled)&&e._showBubble(),console.info(Vt+" ready (lazy-load on demand)")):console.info(Vt+" not enabled (check dashboard settings)")):console.info(Vt+" disabled by code config")})()}updateConfig(e){this._config=i({},this._config,e)}getMergedConfig(){var e,t,i,r,n,s,o,a,l,d,u,h,c,g,v,_,f,p,m=this._serverConfig,y=this._config;return{enabled:null!==(t=null!==(e=y.enabled)&&void 0!==e?e:null==m?void 0:m.enabled)&&void 0!==t&&t,autoConfig:null===(i=y.autoConfig)||void 0===i||i,position:null!==(n=null!==(r=y.position)&&void 0!==r?r:null==m?void 0:m.position)&&void 0!==n?n:"bottom-right",greeting:null!==(s=y.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(a=null!==(o=y.color)&&void 0!==o?o:null==m?void 0:m.color)&&void 0!==a?a:"#6366f1",aiMode:null===(d=null!==(l=y.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=y.aiGreeting)&&void 0!==u?u:null==m?void 0:m.ai_greeting,preload:null!==(h=y.preload)&&void 0!==h&&h,theme:null!==(c=y.theme)&&void 0!==c?c:{primaryColor:null!==(v=null!==(g=y.color)&&void 0!==g?g:null==m?void 0:m.color)&&void 0!==v?v:"#6366f1"},offlineMessage:null!==(_=y.offlineMessage)&&void 0!==_?_:null==m?void 0:m.offline_message,collectEmailOffline:null===(p=null!==(f=y.collectEmailOffline)&&void 0!==f?f:null==m?void 0:m.collect_email_offline)||void 0===p||p}}destroy(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.destroy(),this._lazyLoadedChat=void 0,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[]}get _isChatEnabled(){var e;return!1!==this._config.enabled&&(!0===this._config.enabled||!0===(null===(e=this._serverConfig)||void 0===e?void 0:e.enabled))}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig(),i=t.token,r=t.api_host;if(!i||!r)return console.warn(Vt+" Cannot fetch settings: missing token or api_host"),void(e._configFetched=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(i),s=yield fetch(n);if(!s.ok)return console.warn(Vt+" Failed to fetch settings: "+s.status),void(e._configFetched=!0);e._serverConfig=yield s.json(),e._configFetched=!0,console.info(Vt+" Loaded settings from dashboard")}catch(t){console.warn(Vt+" Error fetching settings:",t),e._configFetched=!0}}})()}_showBubble(){if((null==I?void 0:I.document)&&!document.getElementById("vtilt-chat-bubble")){var e=this.getMergedConfig(),t=e.position||"bottom-right",i=e.color||"#6366f1",r=document.createElement("div");r.id="vtilt-chat-bubble",r.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===t?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+i+";\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()),r.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 ',r.addEventListener("mouseenter",()=>{r.style.transform="scale(1.05)",r.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),r.addEventListener("mouseleave",()=>{r.style.transform="scale(1)",r.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),r.addEventListener("click",()=>{this.open()}),document.body.appendChild(r)}}get _scriptName(){return"chat"}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._lazyLoad(),{timeout:5e3}):setTimeout(()=>this._lazyLoad(),3e3)}_lazyLoadAndThen(e){this._lazyLoadedChat?e():(this._pendingCallbacks.push(e),this._lazyLoad())}_lazyLoad(){var e,t;if(!(this._isLoading||this._lazyLoadedChat||this._loadError))if(null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.initChat)this._onScriptLoaded();else{this._isLoading=!0;var i=null===(t=R.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return console.error(Vt+" loadExternalDependency not available. Chat cannot start."),this._isLoading=!1,void(this._loadError="loadExternalDependency not available");i(this._instance,this._scriptName,e=>{if(this._isLoading=!1,e)return console.error(Vt+" Failed to load:",e),void(this._loadError=String(e));this._onScriptLoaded()})}}_onScriptLoaded(){var e,t=null===(e=R.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!t)return console.error(Vt+" initChat not available after script load"),void(this._loadError="initChat not available");if(!this._lazyLoadedChat){var i=this.getMergedConfig();this._lazyLoadedChat=t(this._instance,i),this._messageCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onMessage(e)}),this._typingCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onTyping(e)}),this._connectionCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onConnectionChange(e)});var r=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");r&&r.remove()}this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],console.info(Vt+" loaded and ready")}}var Jt,Ht="text/plain";!function(e){e.GZipJS="gzip-js",e.None="none"}(Jt||(Jt={}));var Qt=e=>{var{data:t,compression:i}=e;if(t){var r=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(t),n=new Blob([r]).size;if(i===Jt.GZipJS&&n>=1024)try{var s=Ft(function(e,t){if(Nt)return Nt.encode(e);for(var i=e.length,r=new at(e.length+(e.length>>1)),n=0,s=function(e){r[n++]=e},o=0;o<i;++o){if(n+5>r.length){var a=new at(n+8+(i-o<<1));a.set(r),r=a}var l=e.charCodeAt(o);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.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 Tt(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Ht});if(o.size<.95*n)return{contentType:Ht,body:o,estimatedSize:o.size}}catch(e){}return{contentType:"application/json",body:r,estimatedSize:n}}},Gt=[{name:"fetch",available:"undefined"!=typeof fetch,method:e=>{var r=Qt(e);if(r){var{contentType:n,body:s,estimatedSize:o}=r,a=e.compression===Jt.GZipJS&&n===Ht?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,l=i({"Content-Type":n},e.headers||{}),d=new AbortController,u=e.timeout?setTimeout(()=>d.abort(),e.timeout):null;fetch(a,{method:e.method||"POST",headers:l,body:s,keepalive:o<52428.8,signal:d.signal}).then(function(){var i=t(function*(t){var i,r=yield t.text(),n={statusCode:t.status,text:r};if(200===t.status)try{n.json=JSON.parse(r)}catch(e){}null===(i=e.callback)||void 0===i||i.call(e,n)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:e=>{var t=Qt(e);if(t){var{contentType:i,body:r}=t,n=e.compression===Jt.GZipJS&&i===Ht?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,s=new XMLHttpRequest;s.open(e.method||"POST",n,!0),e.headers&&Object.entries(e.headers).forEach(e=>{var[t,i]=e;s.setRequestHeader(t,i)}),s.setRequestHeader("Content-Type",i),e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{var t;if(4===s.readyState){var i={statusCode:s.status,text:s.responseText};if(200===s.status)try{i.json=JSON.parse(s.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=Qt(e);if(t){var{contentType:i,body:r}=t;try{var n="string"==typeof r?new Blob([r],{type:i}):r,s=e.compression===Jt.GZipJS&&i===Ht?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url;navigator.sendBeacon(s,n)}catch(e){}}}}],Xt=e=>{var t,i=e.transport||"fetch",r=Gt.find(e=>e.name===i&&e.available)||Gt.find(e=>e.available);if(!r)return console.error("vTilt: No available transport method"),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0}));r.method(e)};class Kt{constructor(e,t){var i,r,n,s;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,r=250,n=5e3,s=3e3,"number"!=typeof i||isNaN(i)?s:Math.min(Math.max(i,r),n)),this._sendRequest=e}get length(){return this._queue.length}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){if(this._clearFlushTimeout(),0!==this._queue.length){var e=this._formatQueue();for(var t in e){var r=e[t];this._sendRequest(i({},r,{transport:"sendBeacon"}))}}}enable(){this._isPaused=!1,this._setFlushTimeout()}pause(){this._isPaused=!0,this._clearFlushTimeout()}flush(){this._clearFlushTimeout(),this._flushNow(),this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flushNow(),this._queue.length>0&&this._setFlushTimeout()},this._flushTimeoutMs))}_clearFlushTimeout(){this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0)}_flushNow(){if(0!==this._queue.length){var e=this._formatQueue(),t=Date.now();for(var i in e){var r=e[i];r.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(r)}}}_formatQueue(){var e={};return this._queue.forEach(t=>{var i=t.batchKey||t.url;e[i]||(e[i]={url:t.url,events:[],batchKey:t.batchKey}),e[i].events.push(t.event)}),this._queue=[],e}}class Zt{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,I&&void 0!==L&&"onLine"in L&&(this._areWeOnline=L.onLine,b(I,"online",()=>{this._areWeOnline=!0,this._flush()}),b(I,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),n=(Math.random()-.5)*(r-i);return Math.ceil(r+n)}(t),r=Date.now()+i;this._queue.push({retryAt:r,request:e,retriesPerformedSoFar:t+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(n+=" (Browser is offline)"),console.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}}retriableRequest(e){var i=this;return t(function*(){try{var t=yield i._sendRequest(e);200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&i.enqueue(e,0)}catch(t){i.enqueue(e,0)}})()}_poll(){this._poller&&clearTimeout(this._poller),this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._queue.length>0?this._poll():this._isPolling=!1},this._pollIntervalMs)}_flush(){var e=this,i=Date.now(),r=[],n=[];this._queue.forEach(e=>{e.retryAt<i?n.push(e):r.push(e)}),this._queue=r,n.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:r}=t;try{var n=yield e._sendRequest(i);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&e.enqueue(i,r)}catch(t){e.enqueue(i,r)}});return function(e){return i.apply(this,arguments)}}())}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._queue.forEach(e=>{var{request:t}=e;try{this._sendBeacon(t)}catch(e){console.error("VTilt: Failed to send beacon on unload",e)}}),this._queue=[]}}var Yt="vt_rate_limit";class ei{constructor(e){var t,i;void 0===e&&(e={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(t=e.eventsPerSecond)&&void 0!==t?t:10,this.eventsBurstLimit=Math.max(null!==(i=e.eventsBurstLimit)&&void 0!==i?i:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=e.persistence,this.captureWarning=e.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(e){var t,i,r,n;void 0===e&&(e=!1);var s=Date.now(),o=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(Yt))&&void 0!==i?i:{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||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||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(Yt,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}var ti=Array.isArray;class ii{constructor(e){void 0===e&&(e={}),this.version="1.1.5",this.__loaded=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this.__request_queue=[],this._has_warned_about_config=!1,this._set_once_properties_sent=!1,this.configManager=new r(e);var t=this.configManager.getConfig();this.sessionManager=new q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new Ke(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.webVitalsManager=new tt(t,this),this.rateLimiter=new ei({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._capture_internal("$$client_ingestion_warning",{$$client_ingestion_warning_message:e})}}),this.retryQueue=new Zt({sendRequest:e=>this._send_http_request(e),sendBeacon:e=>this._send_beacon_request(e)}),this.requestQueue=new Kt(e=>this._send_batched_request(e),{flush_interval_ms:3e3})}init(e,t,i){var r;if(i&&i!==ni){var n=null!==(r=ri[i])&&void 0!==r?r:new ii;return n._init(e,t,i),ri[i]=n,ri[ni][i]=n,n}return this._init(e,t,i)}_init(e,t,r){if(void 0===t&&(t={}),this.__loaded)return console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this;this.updateConfig(i({},t,{projectId:e||t.projectId,name:r})),this.__loaded=!0;var n=this.configManager.getConfig();return this.userManager.set_initial_person_info(n.mask_personal_data_properties,n.custom_personal_data_properties),this.historyAutocapture=new rt(this),this.historyAutocapture.startIfEnabled(),this._initSessionRecording(),this._initChat(),this._setup_unload_handler(),this._start_queue_if_opted_in(),!1!==n.capture_pageview&&this._capture_initial_pageview(),this}_start_queue_if_opted_in(){this.requestQueue.enable()}_setup_unload_handler(){if(I){var e=()=>{this.requestQueue.unload(),this.retryQueue.unload()};b(I,"beforeunload",e),b(I,"pagehide",e)}}toString(){var e,t=null!==(e=this.configManager.getConfig().name)&&void 0!==e?e:ni;return t!==ni&&(t=ni+"."+t),t}getCurrentDomain(){if(!T)return"";var e=T.protocol,t=T.hostname,i=T.port;return e+"//"+t+(i?":"+i:"")}_is_configured(){var e=this.configManager.getConfig();return!(!e.projectId||!e.token)||(this._has_warned_about_config||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this._has_warned_about_config=!0),!1)}buildUrl(){var e=this.configManager.getConfig(),{proxyUrl:t,proxy:i,api_host:r,token:n}=e;return t||(i?i+"/api/tracking?token="+n:r?r.replace(/\/+$/gm,"")+"/api/tracking?token="+n:"/api/tracking?token="+n)}sendRequest(e,t,i){if(this._is_configured()){if(i&&void 0!==I)if(I.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:e,event:t});this.requestQueue.enqueue({url:e,event:t})}}_send_batched_request(e){var{transport:t}=e;"sendBeacon"!==t?this.retryQueue.retriableRequest(e):this._send_beacon_request(e)}_send_http_request(e){return new Promise(t=>{var{url:i,events:r}=e,n=1===r.length?r[0]:{events:r},s=this.configManager.getConfig().disable_compression?Jt.None:Jt.GZipJS;Xt({url:i,data:n,method:"POST",transport:"XHR",compression:s,callback:e=>{t({statusCode:e.statusCode})}})})}_send_beacon_request(e){var{url:t,events:i}=e,r=1===i.length?i[0]:{events:i},n=this.configManager.getConfig().disable_compression?Jt.None:Jt.GZipJS;Xt({url:t,data:r,method:"POST",transport:"sendBeacon",compression:n})}_send_retriable_request(e){this.sendRequest(e.url,e.event,!1)}capture(e,t,r){if(this.sessionManager.setSessionId(),L&&L.userAgent&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(L.userAgent)&&((null==r?void 0:r.skip_client_rate_limiting)||this.rateLimiter.shouldAllowEvent())){var n=this.buildUrl(),s=Xe(),o=this.userManager.getUserProperties(),a=this.userManager.get_initial_props(),l=this.sessionManager.getSessionId(),d=this.sessionManager.getWindowId(),u=this.userManager.getAnonymousId(),h={};!this._set_once_properties_sent&&Object.keys(a).length>0&&Object.assign(h,a),t.$set_once&&Object.assign(h,t.$set_once);var c=i({},s,o,{$session_id:l,$window_id:d},u?{$anon_distinct_id:u}:{},Object.keys(h).length>0?{$set_once:h}:{},t.$set?{$set:t.$set}:{},t);!this._set_once_properties_sent&&Object.keys(a).length>0&&(this._set_once_properties_sent=!0),"$pageview"===e&&k&&(c.title=k.title);var g,v,_=this.configManager.getConfig();if(!1!==_.stringifyPayload){if(g=Object.assign({},c,_.globalAttributes),!m(g=JSON.stringify(g)))return}else if(g=Object.assign({},c,_.globalAttributes),!m(JSON.stringify(g)))return;v="$identify"===e?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var f={timestamp:(new Date).toISOString(),event:e,project_id:_.projectId||"",payload:g,distinct_id:v,anonymous_id:u};this.sendRequest(n,f,!0)}}_capture_internal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}trackEvent(e,t){void 0===t&&(t={}),this.capture(e,t)}identify(e,t,i){if("number"==typeof e&&(e=String(e),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.userManager.isDistinctIdStringLikePublic(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var r=this.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)}e!==r&&o?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(t,i),this.capture("$identify",{distinct_id:e,$anon_distinct_id:n,$set:t||{},$set_once:i||{}}),this.userManager.setDistinctId(e)):t||i?(o&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(t,i),this.capture("$set",{$set:t||{},$set_once:i||{}})):e!==r&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(e))}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){this.userManager.setUserProperties(e,t)&&this.capture("$set",{$set:e||{},$set_once:t||{}})}resetUser(e){this.sessionManager.resetSessionId(),this.userManager.reset(e)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(e,t){var i=this.userManager.createAlias(e,t);i?this.capture("$alias",{$original_id:i.original,$alias_id:i.distinct_id}):e===(t||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(e)}_capture_initial_pageview(){k&&("visible"===k.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{if(k&&T){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this._visibility_state_listener&&(k.removeEventListener("visibilitychange",this._visibility_state_listener),this._visibility_state_listener=null)):this._visibility_state_listener||(this._visibility_state_listener=()=>{this._capture_initial_pageview()},b(k,"visibilitychange",this._visibility_state_listener)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.userManager.getDistinctId()||this.userManager.getAnonymousId()}getAnonymousId(){return this.userManager.getAnonymousId()}updateConfig(e){this.configManager.updateConfig(e);var t=this.configManager.getConfig();this.sessionManager=new q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new Ke(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.webVitalsManager=new tt(t,this),this.sessionRecording&&t.session_recording&&this.sessionRecording.updateConfig(this._buildSessionRecordingConfig(t))}_initSessionRecording(){var e=this.configManager.getConfig();if(!e.disable_session_recording){var t=this._buildSessionRecordingConfig(e);this.sessionRecording=new st(this,t),t.enabled&&this.sessionRecording.startIfEnabledOrStop("recording_initialized")}}_buildSessionRecordingConfig(e){var t,i,r,n=e.session_recording||{};return{enabled:null!==(t=n.enabled)&&void 0!==t&&t,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(i=n.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}startSessionRecording(){if(!this.sessionRecording){var e=this.configManager.getConfig(),t=this._buildSessionRecordingConfig(e);t.enabled=!0,this.sessionRecording=new st(this,t)}this.sessionRecording.startIfEnabledOrStop("recording_initialized")}stopSessionRecording(){var e;null===(e=this.sessionRecording)||void 0===e||e.stopRecording()}isRecordingActive(){var e;return"active"===(null===(e=this.sessionRecording)||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this.sessionRecording)||void 0===e?void 0:e.sessionId)||null}_initChat(){var e=this.configManager.getConfig();if(!e.disable_chat){var t=this._buildChatConfig(e);this.chat=new Wt(this,t),this.chat.startIfEnabled()}}_buildChatConfig(e){var t,i=e.chat||{};return{enabled:i.enabled,autoConfig:null===(t=i.autoConfig)||void 0===t||t,position:i.position,greeting:i.greeting,color:i.color,aiMode:i.aiMode,aiGreeting:i.aiGreeting,preload:i.preload,offlineMessage:i.offlineMessage,collectEmailOffline:i.collectEmailOffline}}_execute_array(e){Array.isArray(e)&&e.forEach(e=>{if(e&&Array.isArray(e)&&e.length>0){var t=e[0],i=e.slice(1);if("function"==typeof this[t])try{this[t](...i)}catch(e){console.error("vTilt: Error executing queued call "+t+":",e)}}})}_dom_loaded(){this.__request_queue.forEach(e=>{this._send_retriable_request(e)}),this.__request_queue=[],this._start_queue_if_opted_in()}}var ri={},ni="vt",si=!(void 0!==M||void 0!==E)&&-1===(null==x?void 0:x.indexOf("MSIE"))&&-1===(null==x?void 0:x.indexOf("Mozilla"));null!=I&&(I.__VTILT_ENQUEUE_REQUESTS=si);var oi,ai;oi=ri[ni]=new ii,(ai=R.vt)&&y(ai._i,function(e){if(e&&ti(e)){var t=oi.init(e[0],e[1],e[2]),i=ai[e[2]||"vt"]||ai;t&&t._execute_array(i)}}),R.vt=oi,function(){function e(){e.done||(e.done=!0,si=!1,null!=I&&(I.__VTILT_ENQUEUE_REQUESTS=!1),y(ri,function(e){e._dom_loaded()}))}k&&"function"==typeof k.addEventListener?"complete"===k.readyState?e():b(k,"DOMContentLoaded",e,{capture:!1}):I&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")}()}();
|
|
2
2
|
//# sourceMappingURL=array.no-external.js.map
|