@v-tilt/browser 1.10.1 → 1.10.2
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/autocapture-types.d.ts +18 -0
- package/dist/constants.d.ts +2 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +19 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +19 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/types.d.ts +18 -0
- package/dist/vtilt.d.ts +1 -1
- package/package.json +1 -1
package/dist/module.d.ts
CHANGED
|
@@ -287,6 +287,24 @@ interface AutocaptureOptions {
|
|
|
287
287
|
* Overrides VTiltConfig.mask_all_element_attributes for autocapture specifically.
|
|
288
288
|
*/
|
|
289
289
|
mask_all_element_attributes?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Capture form field values on change events (default: false)
|
|
292
|
+
*
|
|
293
|
+
* When enabled, captures $el_value and $selected_text properties:
|
|
294
|
+
* - $el_value: The programmatic value (input.value, option.value, checkbox checked state)
|
|
295
|
+
* - $selected_text: Human-readable selection (option text, checkbox label)
|
|
296
|
+
*
|
|
297
|
+
* Protected by multiple privacy layers:
|
|
298
|
+
* - Password and hidden inputs are never captured
|
|
299
|
+
* - Fields with sensitive names (cc, pass, ssn, etc.) are skipped
|
|
300
|
+
* - Credit card and SSN patterns in values are filtered out
|
|
301
|
+
* - Elements with vt-sensitive or vt-no-capture classes are excluded
|
|
302
|
+
*
|
|
303
|
+
* Use case: Tracking search keywords, filter selections, etc.
|
|
304
|
+
*
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
capture_element_values?: boolean;
|
|
290
308
|
}
|
|
291
309
|
/** Mask options for input elements in session recording */
|
|
292
310
|
interface SessionRecordingMaskInputOptions {
|
|
@@ -1583,7 +1601,7 @@ declare class SimpleEventEmitter {
|
|
|
1583
1601
|
*/
|
|
1584
1602
|
|
|
1585
1603
|
declare class VTilt {
|
|
1586
|
-
readonly version
|
|
1604
|
+
readonly version: string;
|
|
1587
1605
|
__loaded: boolean;
|
|
1588
1606
|
__request_queue: QueuedRequest[];
|
|
1589
1607
|
historyAutocapture?: HistoryAutocapture;
|
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,n=null==i?void 0:i.location,s=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0;null==i||i.AbortController;var a=null==e?void 0:e.userAgent,l=null!=t?t:{},u="[ExternalScriptsLoader]";function h(t,i,e,r,n,s,o){try{var a=t[s](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,n)}function d(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){h(s,r,n,o,a,"next",t)}function a(t){h(s,r,n,o,a,"throw",t)}o(void 0)})}}function v(){return v=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},v.apply(null,arguments)}l.__VTiltExtensions__=l.__VTiltExtensions__||{},l.__VTiltExtensions__.loadExternalDependency=(t,i,e)=>{var n=((t,i)=>{var e=t.getConfig();return e.script_host?e.script_host.replace(/\/+$/gm,"")+"/"+i+".js":e.api_host?e.api_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":(console.error(u+" Cannot load "+i+".js: api_host is required"),"")})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn(u+" "+i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var n=null==r?void 0:r.querySelectorAll("script");if(n)for(var s,o=function(){if(n[a].src===i){var t=n[a];return t.__vtilt_loading_callback_fired?{v:e()}:(t.addEventListener("load",i=>{t.__vtilt_loading_callback_fired=!0,e(void 0,i)}),t.onerror=t=>e(t),{v:void 0})}},a=0;a<n.length;a++)if(s=o())return s.v;var l=()=>{var t;if(!r)return e("document not found");var n=r.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=i,n.onload=t=>{n.__vtilt_loading_callback_fired=!0,e(void 0,t)},n.onerror=t=>e(t);var s=r.querySelectorAll("body > script");s.length>0?null===(t=s[0].parentNode)||void 0===t||t.insertBefore(n,s[0]):r.body.appendChild(n)};(null==r?void 0:r.body)?l():null==r||r.addEventListener("DOMContentLoaded",l)})(t,n,e)};var c="1.10.1",f="__vt_session",p="__vt_window_id",g="__vt_primary_window",_="__vt_user_state",m="__vt_device_id",b="__vt_anonymous_id",y="__vt_remote_config",w="__vt_distinct_id",S="__vt_user_properties",x="localStorage",C="localStorage+cookie",k="sessionStorage",E="memory",T="$initial_person_info";class I{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return v({token:t.token||""},t);var i=document.currentScript,e=v({token:""},t);e.api_host=i.getAttribute("data-api-host")||i.getAttribute("data-host")||t.api_host,e.script_host=i.getAttribute("data-script-host")||t.script_host,e.proxy=i.getAttribute("data-proxy")||t.proxy,e.proxyUrl=i.getAttribute("data-proxy-url")||t.proxyUrl,e.token=i.getAttribute("data-token")||t.token||"",e.projectId=i.getAttribute("data-project-id")||t.projectId||"",e.domain=i.getAttribute("data-domain")||t.domain,e.storage=i.getAttribute("data-storage")||t.storage,e.stringifyPayload="false"!==i.getAttribute("data-stringify-payload");var r="true"===i.getAttribute("data-capture-performance");if(e.capture_performance=!!r||t.capture_performance,e.proxy&&e.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var n of(e.globalAttributes=v({},t.globalAttributes),Array.from(i.attributes)))n.name.startsWith("data-vt-")&&(e.globalAttributes[n.name.slice(8).replace(/-/g,"_")]=n.value);return e}getConfig(){return v({},this.config)}updateConfig(t){this.config=v({},this.config,t)}}function M(t,i){try{return t()}catch(t){return i}}class R{constructor(){this.o=new Map,this.m=new Map}on(t,i){return this.o.has(t)||this.o.set(t,new Set),this.o.get(t).add(i),()=>{var e;null===(e=this.o.get(t))||void 0===e||e.delete(i)}}once(t,i){return this.m.has(t)||this.m.set(t,new Set),this.m.get(t).add(i),()=>{var e;null===(e=this.m.get(t))||void 0===e||e.delete(i)}}emit(t,i){var e,r;null===(e=this.o.get(t))||void 0===e||e.forEach(e=>{try{e(i)}catch(i){console.error('[vTilt] Error in event listener for "'+t+'":',i)}});var n=this.m.get(t);n&&(n.forEach(e=>{try{e(i)}catch(i){console.error('[vTilt] Error in once listener for "'+t+'":',i)}}),this.m.delete(t)),null===(r=this.o.get("*"))||void 0===r||r.forEach(e=>{try{e({event:t,payload:i})}catch(t){console.error("[vTilt] Error in wildcard listener:",t)}})}off(t){t?(this.o.delete(t),this.m.delete(t)):(this.o.clear(),this.m.clear())}listenerCount(t){var i,e,r,n;return(null!==(e=null===(i=this.o.get(t))||void 0===i?void 0:i.size)&&void 0!==e?e:0)+(null!==(n=null===(r=this.m.get(t))||void 0===r?void 0:r.size)&&void 0!==n?n:0)}hasListeners(t){return this.listenerCount(t)>0}}var A="sdk:initialized",O="sdk:config_updated",P="sdk:remote_config_loaded",L="feature:started",U="feature:stopped",D="event:captured",j="recording:started",B="recording:stopped";function N(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function z(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function q(t,i,e){if(t)if(Array.isArray(t))t.forEach((t,r)=>{i.call(e,t,r)});else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&i.call(e,t[r],r)}function F(t,i,e,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:n,passive:s})}function V(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function W(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];for(var n of e)for(var s of n)t.push(s);return t}var J=[b,m,w,_],H=31536e3,X=["herokuapp.com","vercel.app","netlify.app"];function K(t){var i;if(!t||"undefined"==typeof document)return"";var e=null===(i=document.location)||void 0===i?void 0:i.hostname;if(!e)return"";var r=e.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class G{constructor(t){var i,e,r;this.memoryStorage=new Map,this.S=null,this.method=t.method,this.cross_subdomain=null!==(i=t.cross_subdomain)&&void 0!==i?i:function(){var t;if("undefined"==typeof document)return!1;var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return!1;var e=i.split(".").slice(-2).join(".");return!X.includes(e)}(),this.sameSite=null!==(e=t.sameSite)&&void 0!==e?e:"Lax",this.secure=null!==(r=t.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this.S)return this.S;if(void 0===t||!t.localStorage)return this.S=!1,!1;try{var i="__vt_ls_test__";t.localStorage.setItem(i,"1");var e="1"===t.localStorage.getItem(i);return t.localStorage.removeItem(i),this.S=e,e||console.warn("[vTilt] localStorage unavailable, using cookies"),e}catch(t){return this.S=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(t){return J.includes(t)}get(t){var i;try{switch(this.method){case E:return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;case C:return this.getLocalStoragePlusCookie(t);case x:return this.getLocalStorage(t);case k:return this.readFromSessionStorage(t);default:return this.getCookie(t)}}catch(i){return console.warn('[vTilt] Storage get error for "'+t+'":',i),null}}set(t,i,e){try{switch(this.method){case E:this.memoryStorage.set(t,i);break;case C:this.setLocalStoragePlusCookie(t,i,e);break;case x:this.setLocalStorage(t,i);break;case k:this.writeToSessionStorage(t,i);break;default:this.setCookie(t,i,null!=e?e:H)}}catch(i){console.warn('[vTilt] Storage set error for "'+t+'":',i)}}remove(t){try{switch(this.method){case E:this.memoryStorage.delete(t);break;case C:this.removeLocalStoragePlusCookie(t);break;case x:this.removeLocalStorage(t);break;case k:this.removeFromSessionStorage(t);break;default:this.removeCookie(t)}}catch(i){console.warn('[vTilt] Storage remove error for "'+t+'":',i)}}getLocalStoragePlusCookie(i){if(this.isCriticalProperty(i)){var e=this.getCookie(i),r=this.getLocalStorage(i);if(null!==e){if(r!==e&&this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){}return e}return r}return this.getLocalStorage(i)}setLocalStoragePlusCookie(t,i,e){this.setLocalStorage(t,i),this.isCriticalProperty(t)&&this.setCookie(t,i,null!=e?e:H)}removeLocalStoragePlusCookie(t){this.removeLocalStorage(t),this.isCriticalProperty(t)&&this.removeCookie(t)}getLocalStorage(i){var e;if(!this.isLocalStorageSupported())return null;try{return null!==(e=null==t?void 0:t.localStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}setLocalStorage(i,e){if(this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){console.warn("[vTilt] localStorage write error:",t)}}removeLocalStorage(i){if(this.isLocalStorageSupported())try{null==t||t.localStorage.removeItem(i)}catch(t){}}readFromSessionStorage(i){var e;try{return null!==(e=null==t?void 0:t.sessionStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}writeToSessionStorage(i,e){try{null==t||t.sessionStorage.setItem(i,e)}catch(t){console.warn("[vTilt] sessionStorage write error:",t)}}removeFromSessionStorage(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){}}getCookie(t){if("undefined"==typeof document)return null;var i=t+"=";for(var e of document.cookie.split(";")){var r=e.trim();if(r.startsWith(i))try{return decodeURIComponent(r.slice(i.length))}catch(t){return r.slice(i.length)}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=K(this.cross_subdomain),n=t+"="+encodeURIComponent(i)+"; Max-Age="+e+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(t){if("undefined"!=typeof document){var i=K(this.cross_subdomain);document.cookie=t+"=; Max-Age=0; path=/"+(i?"; domain="+i:""),document.cookie=t+"=; Max-Age=0; path=/"}}getWithExpiry(t){var i=this.get(t);if(!i)return null;try{var e=JSON.parse(i);return e.expiry&&Date.now()>e.expiry?(this.remove(t),null):e.value}catch(t){return null}}setWithExpiry(t,i,e){var r=v({value:i},e?{expiry:Date.now()+e}:{});this.set(t,JSON.stringify(r))}getJSON(t){var i=this.get(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}}setJSON(t,i,e){this.set(t,JSON.stringify(i),e)}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_ss_test__";return t.sessionStorage.setItem(i,"1"),t.sessionStorage.removeItem(i),!0}catch(t){return!1}}getSessionStorage(){var i;return this.canUseSessionStorage()&&null!==(i=null==t?void 0:t.sessionStorage)&&void 0!==i?i:null}setMethod(t){this.method=t}getMethod(){return this.method}}class Q{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.C=void 0,this.k()}getSessionId(){var t=this.T();return t||(t=N(),this.I(t)),t}setSessionId(){var t=this.T()||N();return this.I(t),t}resetSessionId(){this.$(),this.setSessionId(),this.M(N())}T(){return this.storage.get(f)}I(t){this.storage.set(f,t,1800)}$(){this.storage.remove(f)}getWindowId(){if(this.C)return this.C;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p);if(i)return this.C=i,i}var e=N();return this.M(e),e}M(t){if(t!==this.C){this.C=t;var i=this.storage.getSessionStorage();i&&i.setItem(p,t)}}k(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(g),e=t.getItem(p);e&&!i?this.C=e:(e&&t.removeItem(p),this.M(N())),t.setItem(g,"true"),this.R()}else this.C=N()}R(){var i=this.storage.getSessionStorage();t&&i&&F(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(g)},{capture:!1})}updateStorageMethod(t,i){this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"})}}function Z(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function Y(t,i){for(var e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===i){if(n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(t){}return s.replace(/\+/g," ")}}return""}function tt(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("="),c=v[0],f=v.slice(1).join("=");-1!==i.indexOf(c)?h.push(c+"="+e):c&&h.push(c+(f?"="+f:""))}var p=h.join("&");return l+(p?"?"+p:"")+(s?"#"+s:"")}function it(t){return"function"==typeof t}var et="Mobile",rt="iOS",nt="Android",st="Tablet",ot=nt+" "+st,at="iPad",lt="Apple",ut=lt+" Watch",ht="Safari",dt="BlackBerry",vt="Samsung",ct=vt+"Browser",ft=vt+" Internet",pt="Chrome",gt=pt+" OS",_t=pt+" "+rt,mt="Internet Explorer",bt=mt+" "+et,yt="Opera",wt=yt+" Mini",St="Edge",xt="Microsoft "+St,Ct="Firefox",kt=Ct+" "+rt,Et="Nintendo",Tt="PlayStation",It="Xbox",$t=nt+" "+et,Mt=et+" "+ht,Rt="Windows",At=Rt+" Phone",Ot="Nokia",Pt="Ouya",Lt="Generic",Ut=Lt+" "+et.toLowerCase(),Dt=Lt+" "+st.toLowerCase(),jt="Konqueror",Bt="(\\d+(\\.\\d+)?)",Nt=new RegExp("Version/"+Bt),zt=new RegExp(It,"i"),qt=new RegExp(Tt+" \\w+","i"),Ft=new RegExp(Et+" \\w+","i"),Vt=new RegExp(dt+"|PlayBook|BB10","i"),Wt={"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 Jt(t,i){return t.toLowerCase().includes(i.toLowerCase())}var Ht=(t,i)=>i&&Jt(i,lt)||function(t){return Jt(t,ht)&&!Jt(t,pt)&&!Jt(t,nt)}(t),Xt=function(t,i){return i=i||"",Jt(t," OPR/")&&Jt(t,"Mini")?wt:Jt(t," OPR/")?yt:Vt.test(t)?dt:Jt(t,"IE"+et)||Jt(t,"WPDesktop")?bt:Jt(t,ct)?ft:Jt(t,St)||Jt(t,"Edg/")?xt:Jt(t,"FBIOS")?"Facebook "+et:Jt(t,"UCWEB")||Jt(t,"UCBrowser")?"UC Browser":Jt(t,"CriOS")?_t:Jt(t,"CrMo")||Jt(t,pt)?pt:Jt(t,nt)&&Jt(t,ht)?$t:Jt(t,"FxiOS")?kt:Jt(t.toLowerCase(),jt.toLowerCase())?jt:Ht(t,i)?Jt(t,et)?Mt:ht:Jt(t,Ct)?Ct:Jt(t,"MSIE")||Jt(t,"Trident/")?mt:Jt(t,"Gecko")?Ct:""},Kt={[bt]:[new RegExp("rv:"+Bt)],[xt]:[new RegExp(St+"?\\/"+Bt)],[pt]:[new RegExp("("+pt+"|CrMo)\\/"+Bt)],[_t]:[new RegExp("CriOS\\/"+Bt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Bt)],[ht]:[Nt],[Mt]:[Nt],[yt]:[new RegExp("(Opera|OPR)\\/"+Bt)],[Ct]:[new RegExp(Ct+"\\/"+Bt)],[kt]:[new RegExp("FxiOS\\/"+Bt)],[jt]:[new RegExp("Konqueror[:/]?"+Bt,"i")],[dt]:[new RegExp(dt+" "+Bt),Nt],[$t]:[new RegExp("android\\s"+Bt,"i")],[ft]:[new RegExp(ct+"\\/"+Bt)],[mt]:[new RegExp("(rv:|MSIE )"+Bt)],Mozilla:[new RegExp("rv:"+Bt)]},Gt=function(t,i){var e=Xt(t,i),r=Kt[e];if(void 0===r)return null;for(var n=0;n<r.length;n++){var s=r[n],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Qt=[[new RegExp(It+"; "+It+" (.*?)[);]","i"),t=>[It,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(Tt,"i"),[Tt,""]],[Vt,[dt,""]],[new RegExp(Rt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[At,""];if(new RegExp(et).test(i)&&!/IEMobile\b/.test(i))return[Rt+" "+et,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=Wt[r]||"";return/arm/i.test(i)&&(n="RT"),[Rt,n]}return[Rt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[rt,i.join(".")]}return[rt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=void 0===t[2]?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+nt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+nt+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[nt,i.join(".")]}return[nt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[gt,""]],[/Linux|debian/i,["Linux",""]]],Zt=function(t){return Ft.test(t)?Et:qt.test(t)?Tt:zt.test(t)?It:new RegExp(Pt,"i").test(t)?Pt:new RegExp("("+At+"|WPDesktop)","i").test(t)?At:/iPad/.test(t)?at:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ut:Vt.test(t)?dt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ot,"i").test(t)?Ot:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(et).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?nt:ot:nt:new RegExp("(pda|"+et+")","i").test(t)?Ut:new RegExp(st,"i").test(t)&&!new RegExp(st+" pc","i").test(t)?Dt:""},Yt="https?://(.*)",ti=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ii=W(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ti),ei="<masked>";function ri(t){var i=function(t){return t?0===t.search(Yt+"google.([^/?]*)")?"google":0===t.search(Yt+"bing.com")?"bing":0===t.search(Yt+"yahoo.com")?"yahoo":0===t.search(Yt+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?Y(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function ni(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function si(){return(null==r?void 0:r.referrer)||"$direct"}function oi(){var t;return(null==r?void 0:r.referrer)&&(null===(t=Z(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function ai(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=Z(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=Z(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=ii.concat([]),e={};return q(i,function(i){var r=Y(t,i);e[i]=r||null}),e}(r);V(n,o)}e&&V(n,ri(e));return n}function li(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ui(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function hi(i,e){if(!a)return{};var r,s,o,[l,u]=function(t){for(var i=0;i<Qt.length;i++){var[e,r]=Qt[i],n=e.exec(t),s=n&&(it(r)?r(n,t):r);if(s)return s}return["",""]}(a);return V(function(t){var i={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];null!=r&&""!==r&&(i[e]=r)}return i}({$os:l,$os_version:u,$browser:Xt(a,navigator.vendor),$device:Zt(a),$device_type:(s=a,o=Zt(s),o===at||o===ot||"Kobo"===o||"Kindle Fire"===o||o===Dt?st:o===Et||o===It||o===Tt||o===Pt?"Console":o===ut?"Wearable":o?et:"Desktop"),$timezone:li(),$timezone_offset:ui()}),{$current_url:tt(null==n?void 0:n.href,[],ei),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:Gt(a,navigator.vendor),$browser_language:ni(),$browser_language_prefix:(r=ni(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class di{constructor(t,i){void 0===t&&(t="localStorage"),this.A=null,this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return v({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(b,this.userIdentity.anonymous_id,H)),this.userIdentity.anonymous_id}getUserProperties(){return v({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(t,i,e){if("number"==typeof t&&(t=t.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),t)if(this.isDistinctIdStringLike(t))console.error('The string "'+t+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==t){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=t,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=v({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}t!==r&&(this.userIdentity.distinct_id=t);var s="anonymous"===this.userIdentity.user_state;t!==r&&s?(this.userIdentity.user_state="identified",i&&(this.userIdentity.properties=v({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):i||e?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),i&&(this.userIdentity.properties=v({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):t!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+t+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(t,i){if(!t&&!i)return!1;var e=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(e,t,i);return this.A===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(t&&(this.userIdentity.properties=v({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity(),this.A=r,!0)}reset(t){var i=this.generateAnonymousId(),e=this.userIdentity.device_id,r=t?this.generateDeviceId():e;this.userIdentity={distinct_id:null,anonymous_id:i,device_id:r,properties:{},user_state:"anonymous"},this.A=null,this.saveUserIdentity(),this.userIdentity.properties=v({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(t){this.userIdentity.distinct_id=t,this.saveUserIdentity()}setUserState(t){this.userIdentity.user_state=t,this.saveUserIdentity()}updateUserProperties(t,i){t&&(this.userIdentity.properties=v({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity()}ensureDeviceId(t){this.userIdentity.device_id||(this.userIdentity.device_id=t,this.userIdentity.properties=v({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:t}),this.saveUserIdentity())}createAlias(t,i){return this.isValidDistinctId(t)?(void 0===i&&(i=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(i)?t===i?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:t,original:i}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(t){return this.isDistinctIdStringLike(t)}set_initial_person_info(t,i){if(!this.getStoredUserProperties()[T]){var e=function(t,i){var e=t?W([],ti,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:si().substring(0,1e3),u:r?tt(r,e,ei):void 0}}(t,i);this.register_once({[T]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[T];return e?(t=ai(e),i={},q(t,function(t,e){var r;i["$initial_"+(r=String(e),r.startsWith("$")?r.substring(1):r)]=t}),i):{}}update_referrer_info(){var t={$referrer:si(),$referring_domain:oi()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(b),i=this.storage.get(m),e=this.storage.get(w),r=this.storage.get(_),n=this.getStoredUserProperties(),s=t||this.generateAnonymousId(),o=i||this.generateDeviceId(),a=e||null,l=r||"anonymous",u=s||this.generateAnonymousId();return t||this.storage.set(b,u,H),i||this.storage.set(m,o,H),r||this.storage.set(_,l,H),{distinct_id:a,anonymous_id:u,device_id:o,properties:n,user_state:l}}saveUserIdentity(){this.storage.set(b,this.userIdentity.anonymous_id,H),this.storage.set(m,this.userIdentity.device_id,H),this.storage.set(_,this.userIdentity.user_state,H),this.userIdentity.distinct_id?this.storage.set(w,this.userIdentity.distinct_id,H):this.storage.remove(w),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(S)||{}}setStoredUserProperties(t){this.storage.setJSON(S,t,H)}register_once(t,i){var e=this.getStoredUserProperties(),r=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(n in e||(e[n]=t[n],r=!0));if(i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(s in e||(e[s]=i[s],r=!0));r&&this.setStoredUserProperties(e)}generateAnonymousId(){return"anon_"+N()}generateDeviceId(){return"device_"+N()}getPersonPropertiesHash(t,i,e){return JSON.stringify({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}isValidDistinctId(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(i)&&0!==t.trim().length}isDistinctIdStringLike(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(i)}updateStorageMethod(t,i){this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var vi=["LCP","CLS","FCP","INP","TTFB"],ci=["LCP","CLS","FCP","INP"],fi=9e5,pi="[WebVitals]";class gi{static extractConfig(t){var i=t.capture_performance;return"boolean"==typeof i?{web_vitals:i}:"object"==typeof i&&null!==i?i:{web_vitals:!1}}constructor(t){this.name="WebVitals",this.O=!1,this._instance=t,this.P=this.L(),this.U=gi.extractConfig(t.getConfig())}get isEnabled(){var t=null==n?void 0:n.protocol;return("http:"===t||"https:"===t)&&!1!==this.U.web_vitals}get isStarted(){return this.O}startIfEnabled(){if(this.isEnabled&&!this.O&&t){var i=this.D();i?this.j(i):this.B()}}stop(){this.O&&(this.N(),this.q&&(clearTimeout(this.q),this.q=void 0),this.O=!1)}onConfigUpdate(t){var i=gi.extractConfig(t),e=this.isEnabled;this.U=i,e||!this.isEnabled||this.O?e&&!this.isEnabled&&this.O&&this.stop():this.startIfEnabled()}get allowedMetrics(){return this.U.web_vitals_allowed_metrics||ci}get flushTimeoutMs(){return this.U.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var t=this.U.__web_vitals_max_value;return void 0===t?fi:0===t?0:t<6e4?fi:t}L(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}D(){var t;return null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.webVitalsCallbacks}B(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;i?i(this._instance,"web-vitals",t=>{if(t)console.error(pi+" Failed to load web-vitals:",t);else{var i=this.D();i?this.j(i):console.error(pi+" web-vitals loaded but callbacks not registered")}}):console.warn(pi+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}j(t){if(!this.O){var i=this.allowedMetrics,e=this.F.bind(this);i.includes("LCP")&&t.onLCP&&t.onLCP(e),i.includes("CLS")&&t.onCLS&&t.onCLS(e,{reportAllChanges:!0}),i.includes("FCP")&&t.onFCP&&t.onFCP(e),i.includes("INP")&&t.onINP&&t.onINP(e),i.includes("TTFB")&&t.onTTFB&&t.onTTFB(e),this.O=!0}}V(){var i;return null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.href}W(){return null==n?void 0:n.pathname}F(i){try{if(!t||!r||!n)return;if(!(null==i?void 0:i.name)||void 0===(null==i?void 0:i.value))return void console.warn(pi+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(pi+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.V(),s=this.W();if(!e)return void console.warn(pi+" Could not determine current URL");this.P.url&&this.P.url!==e&&this.N(),this.P.url||(this.P.url=e,this.P.pathname=s),this.P.firstMetricTimestamp||(this.P.firstMetricTimestamp=Date.now());var o=this.J(i.attribution),a=this._instance.getSessionId(),l=this.H(),u=v({},i,{attribution:o,timestamp:Date.now(),$current_url:e,$session_id:a,$window_id:l}),h=this.P.metrics.findIndex(t=>t.name===i.name);h>=0?this.P.metrics[h]=u:this.P.metrics.push(u),this.X(),this.P.metrics.length>=this.allowedMetrics.length&&this.N()}catch(t){console.error(pi+" Error adding metric to buffer:",t)}}J(t){if(t){var i=v({},t);return"interactionTargetElement"in i&&delete i.interactionTargetElement,i}}H(){var t;try{return(null===(t=this._instance.sessionManager)||void 0===t?void 0:t.getWindowId())||null}catch(t){return null}}X(){this.q&&clearTimeout(this.q),this.q=setTimeout(()=>{this.N()},this.flushTimeoutMs)}N(){if(this.q&&(clearTimeout(this.q),this.q=void 0),0!==this.P.metrics.length){try{var t={$pathname:this.P.pathname,$current_url:this.P.url};for(var i of this.P.metrics)t["$web_vitals_"+i.name+"_value"]=i.value,t["$web_vitals_"+i.name+"_event"]={name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,attribution:i.attribution,$session_id:i.$session_id,$window_id:i.$window_id};this._instance.capture("$web_vitals",t)}catch(t){console.error(pi+" Error flushing metrics:",t)}this.P=this.L()}}}function _i(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return it(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class mi{constructor(i,e){var r;this.name="HistoryAutocapture",this.O=!1,this._instance=i,this.U=e||mi.extractConfig(i.getConfig()),this.K=(null===(r=null==t?void 0:t.location)||void 0===r?void 0:r.pathname)||""}static extractConfig(t){return{enabled:!1!==t.capture_pageview}}get isEnabled(){return!1!==this.U.enabled&&!1!==this._instance.getConfig().capture_pageview}get isStarted(){return this.O}startIfEnabled(){this.isEnabled&&!this.O&&this.G()}stop(){this.O&&(this.Z&&(this.Z(),this.Z=void 0),this.O=!1)}onConfigUpdate(t){this.U=mi.extractConfig(t),this.isEnabled&&!this.O?this.G():!this.isEnabled&&this.O&&this.stop()}G(){t&&n&&(this.K=n.pathname||"",this.Y(),this.tt(),this.O=!0)}Y(){var i,e;if(null==t?void 0:t.history){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||_i(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.it("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||_i(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.it("replaceState")})}}tt(){if(!this.Z&&t){var i=()=>{this.it("popstate")};F(t,"popstate",i),this.Z=()=>{null==t||t.removeEventListener("popstate",i)}}}it(i){this.isEnabled&&this.O&&M(()=>{var e,s=null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname;if(s&&n&&r){if(s!==this.K){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.K=s}})}}var bi=["a","button","form","input","select","textarea","label"],yi="$copy_autocapture";function wi(t){return null==t}function Si(t){return"string"==typeof t}function xi(t){return void 0===t}function Ci(t){return t.replace(/^\s+|\s+$/g,"")}function ki(t,i){return t.indexOf(i)>-1}function Ei(t){return 1===(null==t?void 0:t.nodeType)}function Ti(t){return 3===(null==t?void 0:t.nodeType)}function Ii(t,i){var e;return(null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase())===i}function $i(t){return 11===(null==t?void 0:t.nodeType)}function Mi(t){return t?Ci(t).split(/\s+/):[]}function Ri(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className&&"string"==typeof t.className.baseVal?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Mi(i)}function Ai(t){return wi(t)?null:Ci(t).split(/(\s+)/).filter(t=>Wi(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Oi(t){var i,e="";if(Hi(t)&&!Xi(t)&&t.childNodes&&t.childNodes.length)for(var r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];Ti(n)&&n.textContent&&(e+=null!==(i=Ai(n.textContent))&&void 0!==i?i:"")}return Ci(e)}function Pi(t){var i,e="";if(t&&t.childNodes&&t.childNodes.length)for(var r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];if(n&&"span"===(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase()))try{e=(e+" "+Oi(n)).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Pi(n)).trim())}catch(t){}}return e}function Li(t){var i=Oi(t);return Wi(i=(i+" "+Pi(t)).trim())?i:""}function Ui(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ei(i));return i}function Di(t){var i=t.parentNode;return!(!i||!Ei(i))&&i}function ji(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}var Bi="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ni=new RegExp("^(?:"+Bi+")$"),zi=new RegExp(Bi),qi="\\d{3}-?\\d{2}-?\\d{4}",Fi=new RegExp("^("+qi+")$"),Vi=new RegExp("("+qi+")");function Wi(t,i){if(void 0===i&&(i=!0),wi(t))return!1;if(Si(t)){if(t=Ci(t),(i?Ni:zi).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Fi:Vi).test(t))return!1}return!0}function Ji(t){return!!Si(t)&&("_ngcontent"===t.substring(0,10)||"_nghost"===t.substring(0,7))}function Hi(t){for(var i=t;i&&i.parentNode&&!Ii(i,"body");i=i.parentNode){var e=Ri(i);if(ki(e,"vt-sensitive")||ki(e,"vt-no-capture"))return!1}if(ki(Ri(t),"vt-include"))return!0;var r=t.type||"";if(Si(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=t.name||t.id||"";if(Si(n)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Xi(t){return!!(Ii(t,"input")&&!["button","checkbox","submit","reset","radio"].includes(t.type)||Ii(t,"textarea")||"true"===t.getAttribute("contenteditable"))}function Ki(t){if(!Hi(t))return null;if(Ii(t,"input")){var i=t,e=(i.type||"text").toLowerCase();if("password"===e||"hidden"===e)return null;if("checkbox"===e||"radio"===e){var r={$el_value:i.checked?"true":"false"},n=function(t){var i=t.closest("label");if(i){var e=Ci(i.textContent||"");if(e&&Wi(e))return Ai(e)||null}if(t.id)try{var r=null===document||void 0===document?void 0:document.querySelector('label[for="'+t.id+'"]');if(r){var n=Ci(r.textContent||"");if(n&&Wi(n))return Ai(n)||null}}catch(t){}return null}(i);return n?r.$selected_text=n:i.value&&Wi(i.value)&&(r.$selected_text=i.value),r}var s=i.value;if(s&&Wi(s)){var o=Ai(s);if(o)return{$el_value:o}}return null}if(Ii(t,"select")){var a=t,l=a.selectedIndex;if(l>=0&&a.options[l]){var u=a.options[l],h={};u.value&&Wi(u.value)&&(h.$el_value=u.value);var d=u.text;if(d&&Wi(d)){var v=Ai(d);v&&(h.$selected_text=v)}if(h.$el_value||h.$selected_text)return h}return null}return Ii(t,"textarea"),null}function Gi(i,e,r,n,s){if(void 0===r&&(r=void 0),!t||!i||Ii(i,"html")||!Ei(i))return!1;if((null==r?void 0:r.url_allowlist)&&!ji(r.url_allowlist))return!1;if((null==r?void 0:r.url_ignorelist)&&ji(r.url_ignorelist))return!1;if(null==r?void 0:r.dom_event_allowlist){var o=r.dom_event_allowlist;if(o&&!o.some(t=>e.type===t))return!1}for(var a=!1,l=[i],u=!0,h=i;h.parentNode&&!Ii(h,"body");)if($i(h.parentNode))l.push(h.parentNode.host),h=h.parentNode.host;else{if(!(u=Di(h)))break;if(n||bi.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=t.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),h=u}if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(xi(e))return!0;var r,n=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}(l,r))return!1;if(!function(t,i){var e=null==i?void 0:i.css_selector_allowlist;if(xi(e))return!0;var r,n=function(t){if(e.some(i=>t.matches(i)))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}(l,r))return!1;var v=t.getComputedStyle(i);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=i.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return a?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(bi.indexOf(c)>-1||"true"===i.getAttribute("contenteditable"))}}function Qi(t,i){return i.length>t?i.slice(0,t)+"...":i}function Zi(t,i,e,r){var n=t.tagName.toLowerCase(),s={tag_name:n};bi.indexOf(n)>-1&&!e&&(s.$el_text=Qi(1024,"a"===n||"button"===n?Li(t):Oi(t)));var o=Ri(t);o.length>0&&(s.classes=o.filter(t=>""!==t));for(var a=0;a<t.attributes.length;a++){var l=t.attributes[a];if((!Xi(t)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==r?void 0:r.includes(l.name))&&!i&&Wi(l.value)&&!Ji(l.name))){var u=l.value;"class"===l.name&&(u=Mi(u).join(" ")),s["attr__"+l.name]=Qi(1024,u)}}for(var h=1,d=1,v=t;v=Ui(v);)h++,v.tagName===t.tagName&&d++;return s.nth_child=h,s.nth_of_type=d,s}function Yi(t){if(!Hi(t))return{};for(var i={},e=0;e<t.attributes.length;e++){var r=t.attributes[e];if(r.name&&0===r.name.indexOf("data-vt-capture-attribute")){var n=r.name.replace("data-vt-capture-attribute-",""),s=r.value;n&&s&&Wi(s)&&(i[n]=s)}}return i}function te(t){return t.replace(/"|\\"/g,'\\"')}function ie(t){var i,e=t.attr__class;return e?(i=e,Array.isArray(i)?e:Mi(e)):void 0}function ee(t){return function(t){var i=t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var s=v({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Object.entries(s).sort((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)}).forEach(t=>{var[i,e]=t;return o[te(i.toString())]=te(String(e))}),(r+=":")+Object.entries(o).map(t=>{var[i,e]=t;return i+'="'+e+'"'}).join("")});return i.join(";")}(function(t){return t.map(t=>{var i,e,r={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:ie(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Object.entries(t).filter(t=>{var[i]=t;return 0===i.indexOf("attr__")}).forEach(t=>{var[i,e]=t;return r.attributes[i]=e}),r})}(t))}function re(t,i){return t.indexOf(i)>-1}class ne{constructor(){this.clicks=[],this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3}isRageClick(t,i,e){if(this.clicks=this.clicks.filter(t=>e-t.timestamp<this.RAGE_CLICK_TIMEOUT_MS),this.clicks.length>0){var r=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(t-r.x,2)+Math.pow(i-r.y,2))>this.RAGE_CLICK_THRESHOLD_PX&&(this.clicks=[])}return this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length>=this.RAGE_CLICK_CLICK_COUNT}}function se(i,e){for(var r,n,s,o,{e:a,maskAllElementAttributes:l,maskAllText:u,elementAttributeIgnoreList:h,elementsChainAsString:d}=e,v=[i],c=i;c.parentNode&&!Ii(c,"body");)$i(c.parentNode)?(v.push(c.parentNode.host),c=c.parentNode.host):(v.push(c.parentNode),c=c.parentNode);var f,p=[],g={},_=!1,m=!1;for(var b of v){var y=Hi(b);if("a"===b.tagName.toLowerCase()){var w=b.getAttribute("href");_=!!(y&&w&&Wi(w))&&w}re(Ri(b),"vt-no-capture")&&(m=!0),p.push(Zi(b,l,u,h));var S=Yi(b);Object.assign(g,S)}if(m)return{props:{},explicitNoCapture:m};if(u||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?p[0].$el_text=Li(i):p[0].$el_text=Oi(i)),"change"===a.type){var x=Ki(i);x&&(x.$el_value&&(p[0].$el_value=x.$el_value),x.$selected_text&&(p[0].$selected_text=x.$selected_text))}if(_){p[0].attr__href=_;var C=null===(r=Z(_))||void 0===r?void 0:r.host,k=null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.host;C&&k&&C!==k&&(f=_)}var E=function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return Object.assign({},...i)}({$event_type:a.type,$ce_version:1},d?{}:{$elements:p},{$elements_chain:ee(p)},(null===(s=p[0])||void 0===s?void 0:s.$el_text)?{$el_text:null===(o=p[0])||void 0===o?void 0:o.$el_text}:{},f&&"click"===a.type?{$external_click_url:f}:{},g);return{props:E}}class oe{constructor(t){this.name="Autocapture",this.et=!1,this.rt=null,this.nt=null,this.st=new ne,this.ot=!1,this._instance=t}get U(){var t,i=this._instance.getConfig(),e="object"!=typeof(t=i.autocapture)||null===t||Array.isArray(t)?{}:i.autocapture;return e.url_allowlist&&(e.url_allowlist=e.url_allowlist.map(t=>"string"==typeof t?new RegExp(t):t)),e.url_ignorelist&&(e.url_ignorelist=e.url_ignorelist.map(t=>"string"==typeof t?new RegExp(t):t)),e}get isEnabled(){var t,i=null!==(t=this.rt)&&void 0!==t&&t;return!!this._instance.getConfig().autocapture&&!i}get isStarted(){return this.et}startIfEnabled(){this.isEnabled&&!this.et&&(this.lt(),this.et=!0)}stop(){this.et=!1}onConfigUpdate(t){this.isEnabled&&!this.et&&this.startIfEnabled()}onRemoteConfig(t){t.elementsChainAsString&&(this.ot=t.elementsChainAsString),this.rt=!!t.autocapture_opt_out,this.startIfEnabled()}updateConfig(t){void 0!==t.enabled&&t.enabled&&(this.rt=!1)}setElementSelectors(t){this.nt=t}getElementSelectors(t){var i,e=[];return null===(i=this.nt)||void 0===i||i.forEach(i=>{var n=null==r?void 0:r.querySelectorAll(i);null==n||n.forEach(r=>{t===r&&e.push(i)})}),e}lt(){if(this.ut()&&t&&r){var i=i=>{i=i||(null==t?void 0:t.event);try{this.ht(i)}catch(t){}};if(F(r,"submit",i,{capture:!0}),F(r,"change",i,{capture:!0}),F(r,"click",i,{capture:!0}),this.U.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.ht(i,yi)};F(r,"copy",e,{capture:!0}),F(r,"cut",e,{capture:!0})}}}ht(i,e){var r,n,s,o;if(void 0===e&&(e="$autocapture"),this.isEnabled){var a=function(t){var i;return xi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}(i);if(Ti(a)&&(a=a.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this._instance.getConfig().rageclick&&(null===(r=this.st)||void 0===r?void 0:r.isRageClick(i.clientX,i.clientY,(new Date).getTime()))&&this.ht(i,"$rageclick");var l=e===yi;if(a&&Gi(a,i,this.U,l,l?["copy","cut"]:void 0)){var u=this._instance.getConfig(),{props:h,explicitNoCapture:d}=se(a,{e:i,maskAllElementAttributes:null!==(n=u.mask_all_element_attributes)&&void 0!==n&&n,maskAllText:null!==(s=u.mask_all_text)&&void 0!==s&&s,elementAttributeIgnoreList:this.U.element_attribute_ignorelist,elementsChainAsString:this.ot});if(d)return!1;var v=this.getElementSelectors(a);if(v&&v.length>0&&(h.$element_selectors=v),e===yi){var c=Ai(null===(o=null==t?void 0:t.getSelection())||void 0===o?void 0:o.toString()),f=i.type||"clipboard";if(!c)return!1;h.$selected_content=c,h.$copy_type=f}return this._instance.capture(e,h),!0}}}ut(){return"function"==typeof(null==r?void 0:r.querySelectorAll)}}var ae="[SessionRecording]";class le{constructor(t,i){this._instance=t,this.name="SessionRecording",this.O=!1,this.U=i||le.extractConfig(t.getConfig())}static extractConfig(t){var i,e,r,n=t.session_recording||{};return{enabled:null!==(i=n.enabled)&&void 0!==i&&i,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(e=n.captureConsole)&&void 0!==e&&e,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}get isEnabled(){var i,e=this._instance.getConfig(),r=null!==(i=this.U.enabled)&&void 0!==i&&i,n=!e.disable_session_recording;return!!t&&r&&n}get isStarted(){var t;return this.O&&!!(null===(t=this.dt)||void 0===t?void 0:t.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(t){var i;if(!this.isEnabled||!(null===(i=this.dt)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&e?(this.vt(t),this.O=!0,console.info(ae+" starting")):this.stop()}}stop(){M(()=>{var t;null===(t=this.dt)||void 0===t||t.stop(),this.O=!1})}onConfigUpdate(t){var i;this.U=le.extractConfig(t),null===(i=this.dt)||void 0===i||i.updateConfig(this.U),this.startIfEnabledOrStop("config_updated")}onRemoteConfig(t){var i,e,r,n,s,o,a;if(t.sessionRecording){var l=t.sessionRecording;this.U=v({},this.U,{enabled:null!==(i=this.U.enabled)&&void 0!==i?i:l.enabled,sampleRate:null!==(e=this.U.sampleRate)&&void 0!==e?e:l.sampleRate,minimumDurationMs:null!==(r=this.U.minimumDurationMs)&&void 0!==r?r:l.minimumDurationMs,fullSnapshotIntervalMs:null!==(n=this.U.fullSnapshotIntervalMs)&&void 0!==n?n:l.fullSnapshotIntervalMs,maskAllInputs:null!==(s=this.U.maskAllInputs)&&void 0!==s?s:l.maskAllInputs,captureConsole:null!==(o=this.U.captureConsole)&&void 0!==o?o:l.captureConsole,captureCanvas:null!==(a=this.U.captureCanvas)&&void 0!==a?a:l.captureCanvas}),this.startIfEnabledOrStop("remote_config")}}get started(){return this.isStarted}get status(){var t;return(null===(t=this.dt)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.dt)||void 0===t?void 0:t.sessionId)||""}stopRecording(){this.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.dt)||void 0===e?void 0:e.log)?this.dt.log(t,i):console.warn(ae+" log called before recorder was ready")}updateConfig(t){var i;this.U=v({},this.U,t),null===(i=this.dt)||void 0===i||i.updateConfig(this.U)}get ct(){return"recorder"}vt(t){var i,e,r,n;if(this.isEnabled)if((null===(e=null===(i=null==l?void 0:l.__VTiltExtensions__)||void 0===i?void 0:i.rrweb)||void 0===e?void 0:e.record)&&(null===(r=l.__VTiltExtensions__)||void 0===r?void 0:r.initSessionRecording))this.ft(t);else{var s=null===(n=l.__VTiltExtensions__)||void 0===n?void 0:n.loadExternalDependency;s?s(this._instance,this.ct,i=>{i?console.error(ae+" could not load recorder:",i):this.ft(t)}):console.error(ae+" loadExternalDependency not available. Session recording cannot start.")}}ft(t){var i,e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.dt||(this.dt=e(this._instance,this.U)),this.dt.start(t)):console.error(ae+" initSessionRecording not available after script load")}}var ue=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ue||{}),he=Uint8Array,de=Uint16Array,ve=Int32Array,ce=new he([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]),fe=new he([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]),pe=new he([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ge=function(t,i){for(var e=new de(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new ve(e[30]);for(r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)n[s]=s-e[r]<<5|r;return{b:e,r:n}},_e=ge(ce,2),me=_e.b,be=_e.r;me[28]=258,be[258]=28;for(var ye=ge(fe,0).r,we=new de(32768),Se=0;Se<32768;++Se){var xe=(43690&Se)>>1|(21845&Se)<<1;xe=(61680&(xe=(52428&xe)>>2|(13107&xe)<<2))>>4|(3855&xe)<<4,we[Se]=((65280&xe)>>8|(255&xe)<<8)>>1}var Ce=function(t,i,e){for(var r=t.length,n=0,s=new de(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new de(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new de(1<<i);var l=15-i;for(n=0;n<r;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],d=a[t[n]-1]++<<h,v=d|(1<<h)-1;d<=v;++d)o[we[d]>>l]=u}else for(o=new de(r),n=0;n<r;++n)t[n]&&(o[n]=we[a[t[n]-1]++]>>15-t[n]);return o},ke=new he(288);for(Se=0;Se<144;++Se)ke[Se]=8;for(Se=144;Se<256;++Se)ke[Se]=9;for(Se=256;Se<280;++Se)ke[Se]=7;for(Se=280;Se<288;++Se)ke[Se]=8;var Ee=new he(32);for(Se=0;Se<32;++Se)Ee[Se]=5;var Te=Ce(ke,9,0),Ie=Ce(Ee,5,0),$e=function(t){return(t+7)/8|0},Me=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new he(t.subarray(i,e))},Re=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},Ae=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8,t[r+2]|=e>>16},Oe=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var n=e.length,s=e.slice();if(!n)return{t:Ne,l:0};if(1==n){var o=new he(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=n-1;)a=e[e[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=s[0].s;for(r=1;r<n;++r)s[r].s>v&&(v=s[r].s);var c=new de(v+1),f=Pe(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(s.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});r<n;++r){var m=s[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>=g;p>0;){var b=s[r].s;c[b]<i?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=s[r].s;c[y]==i&&(--c[y],++p)}f=i}return{t:new he(c),l:f}},Pe=function(t,i,e){return-1==t.s?Math.max(Pe(t.l,i,e+1),Pe(t.r,i,e+1)):i[t.s]=e},Le=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new de(++i),r=0,n=t[0],s=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==n&&a!=i)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return{c:e.subarray(0,r),n:i}},Ue=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},De=function(t,i,e){var r=e.length,n=$e(i+2);t[n]=255&r,t[n+1]=r>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;s<r;++s)t[n+s+4]=e[s];return 8*(n+4+r)},je=function(t,i,e,r,n,s,o,a,l,u,h){Re(i,h++,e),++n[256];for(var d=Oe(n,15),v=d.t,c=d.l,f=Oe(s,15),p=f.t,g=f.l,_=Le(v),m=_.c,b=_.n,y=Le(p),w=y.c,S=y.n,x=new de(19),C=0;C<m.length;++C)++x[31&m[C]];for(C=0;C<w.length;++C)++x[31&w[C]];for(var k=Oe(x,7),E=k.t,T=k.l,I=19;I>4&&!E[pe[I-1]];--I);var M,R,A,O,P=u+5<<3,L=Ue(n,ke)+Ue(s,Ee)+o,U=Ue(n,v)+Ue(s,p)+o+14+3*I+Ue(x,E)+2*x[16]+3*x[17]+7*x[18];if(l>=0&&P<=L&&P<=U)return De(i,h,t.subarray(l,l+u));if(Re(i,h,1+(U<L)),h+=2,U<L){M=Ce(v,c,0),R=v,A=Ce(p,g,0),O=p;var D=Ce(E,T,0);Re(i,h,b-257),Re(i,h+5,S-1),Re(i,h+10,I-4),h+=14;for(C=0;C<I;++C)Re(i,h+3*C,E[pe[C]]);h+=3*I;for(var j=[m,w],B=0;B<2;++B){var N=j[B];for(C=0;C<N.length;++C){var z=31&N[C];Re(i,h,D[z]),h+=E[z],z>15&&(Re(i,h,N[C]>>5&127),h+=N[C]>>12)}}}else M=Te,R=ke,A=Ie,O=Ee;for(C=0;C<a;++C){var q=r[C];if(q>255){Ae(i,h,M[(z=q>>18&31)+257]),h+=R[z+257],z>7&&(Re(i,h,q>>23&31),h+=ce[z]);var F=31&q;Ae(i,h,A[F]),h+=O[F],F>3&&(Ae(i,h,q>>5&8191),h+=fe[F])}else Ae(i,h,M[q]),h+=R[q]}return Ae(i,h,M[256]),h+R[256]},Be=new ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ne=new he(0),ze=function(){for(var t=new Int32Array(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&-306674912)^e>>>1;t[i]=e}return t}(),qe=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new he(s.length+t.length);o.set(s),o.set(t,s.length),t=o,n.w=s.length}return function(t,i,e,r,n,s){var o=s.z||t.length,a=new he(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),u=s.l,h=7&(s.r||0);if(i){h&&(l[0]=s.r>>3);for(var d=Be[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,p=s.p||new de(32768),g=s.h||new de(f+1),_=Math.ceil(e/3),m=2*_,b=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new ve(25e3),w=new de(288),S=new de(32),x=0,C=0,k=s.i||0,E=0,T=s.w||0,I=0;k+2<o;++k){var M=b(k),R=32767&k,A=g[M];if(p[R]=A,g[M]=R,T<=k){var O=o-k;if((x>7e3||E>24576)&&(O>423||!u)){h=je(t,l,0,y,w,S,C,E,I,k-I,h),E=x=C=0,I=k;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var L=2,U=0,D=c,j=R-A&32767;if(O>2&&M==b(k-j))for(var B=Math.min(v,O)-1,N=Math.min(32767,k),z=Math.min(258,O);j<=N&&--D&&R!=A;){if(t[k+L]==t[k+L-j]){for(var q=0;q<z&&t[k+q]==t[k+q-j];++q);if(q>L){if(L=q,U=j,q>B)break;var F=Math.min(j,q-2),V=0;for(P=0;P<F;++P){var W=k-j+P&32767,J=W-p[W]&32767;J>V&&(V=J,A=W)}}}j+=(R=A)-(A=p[R])&32767}if(U){y[E++]=268435456|be[L]<<18|ye[U];var H=31&be[L],X=31&ye[U];C+=ce[H]+fe[X],++w[257+H],++S[X],T=k+L,++x}else y[E++]=t[k],++w[t[k]]}}for(k=Math.max(k,T);k<o;++k)y[E++]=t[k],++w[t[k]];h=je(t,l,u,y,w,S,C,E,I,k-I,h),u||(s.r=7&h|l[h/8|0]<<3,h-=7,s.h=g,s.p=p,s.i=k,s.w=T)}else{for(k=s.w||0;k<o+u;k+=65535){var K=k+65535;K>=o&&(l[h/8|0]=u,K=o),h=De(l,h+1,t.subarray(k,K))}s.i=o}return Me(a,0,r+$e(h)+n)}(t,null==i.level?6:i.level,null==i.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+i.mem,e,r,n)},Fe=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ve(t,i){i||(i={});var e=function(){var t=-1;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=ze[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=qe(t,i,10+((n=i).filename?n.filename.length+1:0),8),o=s.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Fe(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(s,i),Fe(s,o-8,e.d()),Fe(s,o-4,r),s}var We="undefined"!=typeof TextEncoder&&new TextEncoder,Je="undefined"!=typeof TextDecoder&&new TextDecoder;try{Je.decode(Ne,{stream:!0})}catch(t){}ue.MouseMove,ue.MouseInteraction,ue.Scroll,ue.ViewportResize,ue.Input,ue.TouchMove,ue.MediaInteraction,ue.Drag;var He="[Chat]";class Xe{constructor(t,i){this._instance=t,this.name="Chat",this.gt=null,this._t=!1,this.bt=!1,this.O=!1,this.yt=null,this.wt=[],this.St=[],this.xt=[],this.Ct=[],this.kt=[],this.U=i||Xe.extractConfig(t.getConfig())}static extractConfig(t){var i,e=t.chat||{};return{enabled:e.enabled,autoConfig:null===(i=e.autoConfig)||void 0===i||i,position:e.position,greeting:e.greeting,color:e.color,aiMode:e.aiMode,aiGreeting:e.aiGreeting,preload:e.preload,offlineMessage:e.offlineMessage,collectEmailOffline:e.collectEmailOffline}}get isEnabled(){var t;return!1!==this.U.enabled&&(!0===this.U.enabled||!this._instance.getConfig().disable_chat&&!0===(null===(t=this.gt)||void 0===t?void 0:t.enabled))}get isStarted(){return this.O}startIfEnabled(){this.Et().catch(t=>{console.error(He+" Error starting:",t)})}stop(){this.destroy(),this.O=!1}onConfigUpdate(t){var i,e;this.U=Xe.extractConfig(t),this.Tt&&(null===(e=(i=this.Tt).updateConfig)||void 0===e||e.call(i,this.getMergedConfig()))}onRemoteConfig(t){var i,e,r,n,s,o,a,l,u;t.chat&&(this.gt=v({},this.gt,{enabled:null!==(r=null!==(i=t.chat.enabled)&&void 0!==i?i:null===(e=this.gt)||void 0===e?void 0:e.enabled)&&void 0!==r&&r,position:null!==(o=null!==(n=t.chat.widgetPosition)&&void 0!==n?n:null===(s=this.gt)||void 0===s?void 0:s.position)&&void 0!==o?o:"bottom-right",color:null!==(u=null!==(a=t.chat.widgetColor)&&void 0!==a?a:null===(l=this.gt)||void 0===l?void 0:l.color)&&void 0!==u?u:"#6366f1"}),this.isEnabled&&!this.O&&this.startIfEnabled())}Et(){var t=this;return d(function*(){var i,e,r,n;!1!==t.U.enabled?t._instance.getConfig().disable_chat?console.info(He+" disabled by disable_chat config"):(!1!==t.U.autoConfig&&(yield t.It()),t.isEnabled?(t.O=!0,null!==(r=null!==(i=t.U.preload)&&void 0!==i?i:null===(e=t.gt)||void 0===e?void 0:e.enabled)&&void 0!==r&&r&&t.$t(),(null===(n=t.gt)||void 0===n?void 0:n.enabled)&&t.Mt(),console.info(He+" ready (lazy-load on demand)")):console.info(He+" not enabled (check dashboard settings)")):console.info(He+" disabled by code config")})()}get isOpen(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isOpen)&&void 0!==i&&i}get isConnected(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isConnected)&&void 0!==i&&i}get isLoading(){var t,i;return this.bt||null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isLoading)&&void 0!==i&&i}get unreadCount(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.unreadCount)&&void 0!==i?i:0}get channel(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.channel)&&void 0!==i?i:null}get channels(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.channels)&&void 0!==i?i:[]}get currentView(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.currentView)&&void 0!==i?i:"list"}open(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.open()})}close(){var t;null===(t=this.Tt)||void 0===t||t.close()}toggle(){this.Tt?this.Tt.toggle():this.open()}show(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.show()})}hide(){var t;null===(t=this.Tt)||void 0===t||t.hide()}getChannels(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.getChannels()})}selectChannel(t){this.Rt(()=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.selectChannel(t)})}createChannel(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.createChannel()})}goToChannelList(){var t;null===(t=this.Tt)||void 0===t||t.goToChannelList()}sendMessage(t){this.Tt?this.Tt.sendMessage(t):(this.wt.push(t),this.Rt(()=>{this.wt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.sendMessage(t)}),this.wt=[]}))}markAsRead(){var t;null===(t=this.Tt)||void 0===t||t.markAsRead()}onMessage(t){return this.xt.push(t),this.Tt?this.Tt.onMessage(t):()=>{var i=this.xt.indexOf(t);i>-1&&this.xt.splice(i,1)}}onTyping(t){return this.Ct.push(t),this.Tt?this.Tt.onTyping(t):()=>{var i=this.Ct.indexOf(t);i>-1&&this.Ct.splice(i,1)}}onConnectionChange(t){return this.kt.push(t),this.Tt?this.Tt.onConnectionChange(t):()=>{var i=this.kt.indexOf(t);i>-1&&this.kt.splice(i,1)}}updateConfig(t){this.U=v({},this.U,t)}getMergedConfig(){var t,i,e,r,n,s,o,a,l,u,h,d,v,c,f,p,g,_,m=this.gt,b=this.U;return{enabled:null!==(i=null!==(t=b.enabled)&&void 0!==t?t:null==m?void 0:m.enabled)&&void 0!==i&&i,autoConfig:null===(e=b.autoConfig)||void 0===e||e,position:null!==(n=null!==(r=b.position)&&void 0!==r?r:null==m?void 0:m.position)&&void 0!==n?n:"bottom-right",greeting:null!==(s=b.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(a=null!==(o=b.color)&&void 0!==o?o:null==m?void 0:m.color)&&void 0!==a?a:"#6366f1",aiMode:null===(u=null!==(l=b.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===u||u,aiGreeting:null!==(h=b.aiGreeting)&&void 0!==h?h:null==m?void 0:m.ai_greeting,preload:null!==(d=b.preload)&&void 0!==d&&d,theme:null!==(v=b.theme)&&void 0!==v?v:{primaryColor:null!==(f=null!==(c=b.color)&&void 0!==c?c:null==m?void 0:m.color)&&void 0!==f?f:"#6366f1"},offlineMessage:null!==(p=b.offlineMessage)&&void 0!==p?p:null==m?void 0:m.offline_message,collectEmailOffline:null===(_=null!==(g=b.collectEmailOffline)&&void 0!==g?g:null==m?void 0:m.collect_email_offline)||void 0===_||_}}destroy(){M(()=>{var i,e;null===(i=this.Tt)||void 0===i||i.destroy(),this.Tt=void 0,this.wt=[],this.St=[],this.xt=[],this.Ct=[],this.kt=[];var r=null===(e=null==t?void 0:t.document)||void 0===e?void 0:e.getElementById("vtilt-chat-bubble");r&&r.remove()})}It(){var t=this;return d(function*(){if(!t._t){var i=t._instance.getConfig(),e=i.token,r=i.api_host;if(!e||!r)return console.warn(He+" Cannot fetch settings: missing token or api_host"),void(t._t=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(e),s=yield fetch(n);if(!s.ok)return console.warn(He+" Failed to fetch settings: "+s.status),void(t._t=!0);t.gt=yield s.json(),t._t=!0,console.info(He+" Loaded settings from dashboard")}catch(i){console.warn(He+" Error fetching settings:",i),t._t=!0}}})()}Mt(){if((null==t?void 0:t.document)&&!document.getElementById("vtilt-chat-bubble")){var i=this.getMergedConfig(),e=i.position||"bottom-right",r=i.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===e?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+r+";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s, box-shadow 0.2s;\n z-index: 999999;\n ").trim()),n.innerHTML='\n <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>\n </svg>\n ',n.addEventListener("mouseenter",()=>{n.style.transform="scale(1.05)",n.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),n.addEventListener("mouseleave",()=>{n.style.transform="scale(1)",n.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),n.addEventListener("click",()=>{this.open()}),document.body.appendChild(n)}}get ct(){return"chat"}$t(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this.At(),{timeout:5e3}):setTimeout(()=>this.At(),3e3)}Rt(t){this.Tt?t():(this.St.push(t),this.At())}At(){var t,i;if(!(this.bt||this.Tt||this.yt))if(null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat)this.ft();else{this.bt=!0;var e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.loadExternalDependency;if(!e)return console.error(He+" loadExternalDependency not available. Chat cannot start."),this.bt=!1,void(this.yt="loadExternalDependency not available");e(this._instance,this.ct,t=>{if(this.bt=!1,t)return console.error(He+" Failed to load:",t),void(this.yt=String(t));this.ft()})}}ft(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat;if(!i)return console.error(He+" initChat not available after script load"),void(this.yt="initChat not available");if(!this.Tt){var e=this.getMergedConfig();this.Tt=i(this._instance,e),this.xt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onMessage(t)}),this.Ct.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onTyping(t)}),this.kt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onConnectionChange(t)});var r=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");r&&r.remove()}this.St.forEach(t=>t()),this.St=[],console.info(He+" loaded and ready")}}var Ke,Ge="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Ke||(Ke={}));var Qe=t=>{var{data:i,compression:e}=t;if(i){var r=(t=>JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i))(i),n=new Blob([r]).size;if(e===Ke.GZipJS&&n>=1024)try{var s=Ve(function(t,i){if(We)return We.encode(t);for(var e=t.length,r=new he(t.length+(t.length>>1)),n=0,s=function(t){r[n++]=t},o=0;o<e;++o){if(n+5>r.length){var a=new he(n+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return Me(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Ge});if(o.size<.95*n)return{contentType:Ge,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},Ze=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=v({"Content-Type":e},t.headers||{}),a=new AbortController,l=t.timeout?setTimeout(()=>a.abort(),t.timeout):null;fetch(s,{method:t.method||"POST",headers:o,body:r,keepalive:n<52428.8,signal:a.signal}).then(function(){var i=d(function*(i){var e,r=yield i.text(),n={statusCode:i.status,text:r};if(200===i.status)try{n.json=JSON.parse(r)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)});return function(t){return i.apply(this,arguments)}}()).catch(()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})}).finally(()=>{l&&clearTimeout(l)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,s=new XMLHttpRequest;s.open(t.method||"POST",n,!0),t.headers&&Object.entries(t.headers).forEach(t=>{var[i,e]=t;s.setRequestHeader(i,e)}),s.setRequestHeader("Content-Type",e),t.timeout&&(s.timeout=t.timeout),s.onreadystatechange=()=>{var i;if(4===s.readyState){var e={statusCode:s.status,text:s.responseText};if(200===s.status)try{e.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,e)}},s.onerror=()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],Ye=t=>{var i,e=t.transport||"fetch",r=Ze.find(t=>t.name===e&&t.available)||Ze.find(t=>t.available);if(!r)return console.error("vTilt: No available transport method"),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0}));r.method(t)};class tr{constructor(t,i){var e,r,n,s;this.Ot=!0,this.Pt=[],this.Lt=(e=(null==i?void 0:i.flush_interval_ms)||3e3,r=250,n=5e3,s=3e3,"number"!=typeof e||isNaN(e)?s:Math.min(Math.max(e,r),n)),this.Ut=t}get length(){return this.Pt.length}enqueue(t){this.Pt.push(t),this.Dt||this.jt()}unload(){if(this.Bt(),0!==this.Pt.length){var t=this.Nt();for(var i in t){var e=t[i];this.Ut(v({},e,{transport:"sendBeacon"}))}}}enable(){this.Ot=!1,this.jt()}pause(){this.Ot=!0,this.Bt()}flush(){this.Bt(),this.zt(),this.jt()}jt(){this.Ot||(this.Dt=setTimeout(()=>{this.Bt(),this.zt(),this.Pt.length>0&&this.jt()},this.Lt))}Bt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0)}zt(){if(0!==this.Pt.length){var t=this.Nt(),i=Date.now();for(var e in t){var r=t[e];r.events.forEach(t=>{var e=new Date(t.timestamp).getTime();t.$offset=Math.abs(e-i)}),this.Ut(r)}}}Nt(){var t={};return this.Pt.forEach(i=>{var e=i.batchKey||i.url;t[e]||(t[e]={url:i.url,events:[],batchKey:i.batchKey}),t[e].events.push(i.event)}),this.Pt=[],t}}class ir{constructor(i){this.qt=!1,this.Ft=3e3,this.Pt=[],this.Vt=!0,this.Ut=i.sendRequest,this.Wt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this.Vt=e.onLine,F(t,"online",()=>{this.Vt=!0,this.N()}),F(t,"offline",()=>{this.Vt=!1}))}get length(){return this.Pt.length}enqueue(t,i){if(void 0===i&&(i=0),i>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),n=(Math.random()-.5)*(r-e);return Math.ceil(r+n)}(i),r=Date.now()+e;this.Pt.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this.Vt||(n+=" (Browser is offline)"),console.warn(n),this.qt||(this.qt=!0,this.Jt())}}retriableRequest(t){var i=this;return d(function*(){try{var e=yield i.Ut(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}Jt(){this.Ht&&clearTimeout(this.Ht),this.Ht=setTimeout(()=>{this.Vt&&this.Pt.length>0&&this.N(),this.Pt.length>0?this.Jt():this.qt=!1},this.Ft)}N(){var t=this,i=Date.now(),e=[],r=[];this.Pt.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.Pt=e,r.forEach(function(){var i=d(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.Ut(e);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&t.enqueue(e,r)}catch(i){t.enqueue(e,r)}});return function(t){return i.apply(this,arguments)}}())}unload(){this.Ht&&(clearTimeout(this.Ht),this.Ht=void 0),this.Pt.forEach(t=>{var{request:i}=t;try{this.Wt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.Pt=[]}}var er="vt_rate_limit";class rr{constructor(t){var i,e;void 0===t&&(t={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(i=t.eventsPerSecond)&&void 0!==i?i:10,this.eventsBurstLimit=Math.max(null!==(e=t.eventsBurstLimit)&&void 0!==e?e:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=t.persistence,this.captureWarning=t.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(t){var i,e,r,n;void 0===t&&(t=!1);var s=Date.now(),o=null!==(e=null===(i=this.persistence)||void 0===i?void 0:i.get(er))&&void 0!==e?e:{tokens:this.eventsBurstLimit,last:s},a=(s-o.last)/1e3;o.tokens+=a*this.eventsPerSecond,o.last=s,o.tokens>this.eventsBurstLimit&&(o.tokens=this.eventsBurstLimit);var l=o.tokens<1;return l||t||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||t||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(n=this.persistence)||void 0===n||n.set(er,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class nr{constructor(t){this.Xt=null,this.Kt=t}get config(){return this.Xt}onApply(t){this.Gt=t}onLoad(t){this.Qt=t}load(){var i,e=this.Kt.getConfig();if(e.projectId){if(null===(i=e.bootstrap)||void 0===i?void 0:i.remoteConfig)return this.Xt=e.bootstrap.remoteConfig,this.Zt(this.Xt),void this.Yt();var r=M(()=>t.__VTILT_BOOTSTRAP__);if(null==r?void 0:r.remoteConfig)return this.Xt=r.remoteConfig,this.Zt(this.Xt),void this.Yt();M(()=>{var t=localStorage.getItem(y+"_"+e.projectId);t&&(this.Xt=JSON.parse(t),this.Zt(this.Xt))}),this.Yt()}}Yt(){var t=this.Kt.getConfig();if(t.projectId&&t.api_host){var i=t.api_host+"/api/projects/"+t.projectId+"/decide",e=new AbortController,r=setTimeout(()=>e.abort(),3e3);(s||fetch)(i,{method:"GET",signal:e.signal,headers:{Accept:"application/json"}}).then(t=>t.json()).then(i=>{var e;clearTimeout(r),this.Xt=i,M(()=>{localStorage.setItem(y+"_"+t.projectId,JSON.stringify(i))}),this.Zt(i),null===(e=this.Qt)||void 0===e||e.call(this,i)}).catch(()=>{clearTimeout(r)})}}Zt(t){var i,e,r,n,s,o,a,l,u,h=this.Kt.getConfig(),d={},v=!1,c=!1,f=!1;t.sessionRecording&&void 0===h.session_recording&&(d.session_recording={enabled:t.sessionRecording.enabled,sampleRate:t.sessionRecording.sampleRate,minimumDurationMs:t.sessionRecording.minimumDurationMs,fullSnapshotIntervalMs:t.sessionRecording.fullSnapshotIntervalMs,maskAllInputs:t.sessionRecording.maskAllInputs,captureConsole:t.sessionRecording.captureConsole,captureCanvas:t.sessionRecording.captureCanvas},t.sessionRecording.enabled&&(v=!0)),(null===(i=t.chat)||void 0===i?void 0:i.enabled)&&void 0===h.chat&&(d.chat={enabled:t.chat.enabled,position:t.chat.widgetPosition,color:t.chat.widgetColor},c=!0),t.analytics&&(void 0!==t.analytics.capturePageview&&void 0===h.capture_pageview&&(d.capture_pageview=t.analytics.capturePageview),void 0!==t.analytics.capturePageleave&&void 0===h.capture_pageleave&&(d.capture_pageleave=!!t.analytics.capturePageleave),void 0!==t.analytics.capturePerformance&&void 0===h.capture_performance&&(d.capture_performance=t.analytics.capturePerformance),void 0!==t.analytics.autocapture&&void 0===h.autocapture&&(d.autocapture=t.analytics.autocapture,t.analytics.autocapture&&(f=!0))),void 0!==(null===(e=t.privacy)||void 0===e?void 0:e.respectDnt)&&void 0===h.respect_dnt&&(d.respect_dnt=t.privacy.respectDnt),Object.keys(d).length>0&&this.Kt.updateConfig(d),null===(r=this.Gt)||void 0===r||r.call(this,t),this.Kt.__loaded&&(v&&(null===(s=(n=this.Kt).startSessionRecording)||void 0===s||s.call(n)),c&&(null===(a=(o=this.Kt).ti)||void 0===a||a.call(o)),f&&(null===(u=(l=this.Kt).startAutocapture)||void 0===u||u.call(l)))}}class sr{constructor(t){this.ii=!1,this.ei=!1,this.ri=null,this.ni=null,this.Kt=t}setVtPersonUuid(t){this.ni=t}capture(t,i,r){var n;if(this.Kt.sessionManager.setSessionId(),(null==e?void 0:e.userAgent)&&function(t){return!(t&&"string"==typeof t&&t.length>500)}(e.userAgent)&&((null==r?void 0:r.skip_client_rate_limiting)||this.Kt.rateLimiter.shouldAllowEvent())){var s,o=this.Kt.buildUrl(),a=this.Kt.getConfig(),l=this.si(t,i);if(!1!==a.stringifyPayload){if(!z(s=JSON.stringify(v({},l,a.globalAttributes))))return}else if(s=v({},l,a.globalAttributes),!z(JSON.stringify(s)))return;var u="$identify"===t?this.Kt.userManager.getAnonymousId():null!==(n=this.Kt.userManager.getDistinctId())&&void 0!==n?n:this.Kt.userManager.getAnonymousId(),h={timestamp:(new Date).toISOString(),event:t,project_id:a.projectId||"",payload:s,distinct_id:u,anonymous_id:this.Kt.userManager.getAnonymousId()};this.Kt.sendRequest(o,h,!0)}}captureInternal(t,i){this.capture(t,i,{skip_client_rate_limiting:!0})}trackEvent(t,i){void 0===i&&(i={}),this.capture(t,i)}captureInitialPageview(){r&&("visible"===r.visibilityState?this.ei||(this.ei=!0,setTimeout(()=>{r&&n&&this.capture("$pageview",{navigation_type:"initial_load"})},300),this.ri&&(r.removeEventListener("visibilitychange",this.ri),this.ri=null)):this.ri||(this.ri=()=>this.captureInitialPageview(),F(r,"visibilitychange",this.ri)))}si(t,i){var e=hi(),n=this.Kt.userManager.getUserProperties(),s=this.Kt.userManager.get_initial_props(),o=this.Kt.sessionManager.getSessionId(),a=this.Kt.sessionManager.getWindowId(),l=this.Kt.userManager.getAnonymousId(),u={};!this.ii&&Object.keys(s).length>0&&Object.assign(u,s),i.$set_once&&Object.assign(u,i.$set_once);var h=v({},e,n,{$session_id:o,$window_id:a},l?{$anon_distinct_id:l}:{},this.ni?{$vt:this.ni}:{},Object.keys(u).length>0?{$set_once:u}:{},i.$set?{$set:i.$set}:{},i);return!this.ii&&Object.keys(s).length>0&&(this.ii=!0),"$pageview"===t&&r&&(h.title=r.title),h}}class or{constructor(t){this.Kt=t}identify(t,i,e){var r;if("number"==typeof t&&(t=String(t),console.warn("identify: first argument should be a string, not a number")),t)if(this.Kt.userManager.isDistinctIdStringLikePublic(t))console.error('identify: "'+t+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==t){var n=this.Kt.userManager.getDistinctId(),s=this.Kt.userManager.getAnonymousId(),o=this.Kt.userManager.getDeviceId(),a="anonymous"===this.Kt.userManager.getUserState();o||this.Kt.userManager.ensureDeviceId(n||s),t!==n&&a?(this.Kt.userManager.setUserState("identified"),this.Kt.userManager.updateUserProperties(i,e),this.Kt.capture("$identify",{distinct_id:t,$anon_distinct_id:s,$set:i||{},$set_once:e||{}}),this.Kt.userManager.setDistinctId(t),null===(r=this.Kt.oi)||void 0===r||r.emit("user:identified",{distinctId:t})):i||e?(a&&this.Kt.userManager.setUserState("identified"),this.Kt.userManager.updateUserProperties(i,e),this.Kt.capture("$set",{$set:i||{},$set_once:e||{}})):t!==n&&(this.Kt.userManager.setUserState("identified"),this.Kt.userManager.setDistinctId(t))}else console.error("identify: cannot use sentinel value as distinct_id");else console.error("identify: unique user id is required")}setUserProperties(t,i){var e;this.Kt.userManager.setUserProperties(t,i)&&(this.Kt.capture("$set",{$set:t||{},$set_once:i||{}}),null===(e=this.Kt.oi)||void 0===e||e.emit("user:properties_set",{properties:t}))}resetUser(t){var i;this.Kt.sessionManager.resetSessionId(),this.Kt.userManager.reset(t),null===(i=this.Kt.oi)||void 0===i||i.emit("user:reset")}createAlias(t,i){var e=this.Kt.userManager.createAlias(t,i);e?this.Kt.capture("$alias",{$original_id:e.original,$alias_id:e.distinct_id}):t===(i||this.Kt.userManager.getDistinctId()||this.Kt.userManager.getAnonymousId())&&this.identify(t)}getUserIdentity(){return this.Kt.userManager.getUserIdentity()}getDeviceId(){return this.Kt.userManager.getDeviceId()}getUserState(){return this.Kt.userManager.getUserState()}getDistinctId(){var t;return null!==(t=this.Kt.userManager.getDistinctId())&&void 0!==t?t:this.Kt.userManager.getAnonymousId()}getAnonymousId(){return this.Kt.userManager.getAnonymousId()}}class ar{constructor(t){this.ai=new Map,this.Kt=t}onFeatureStarted(t){this.li=t}onFeatureStopped(t){this.ui=t}register(t){this.ai.set(t.name,t)}get(t){var i;return null===(i=this.ai.get(t))||void 0===i?void 0:i.instance}initAll(){this.ai.forEach(t=>{this.hi(t)})}init(t){var i=this.ai.get(t);if(i)return this.hi(i),i.instance}start(t){var i,e=this.ai.get(t);if(e&&(e.instance||this.hi(e),e.instance)){if(e.instance.onConfigUpdate){var r=this.Kt.getConfig();e.instance.onConfigUpdate(r)}e.instance.startIfEnabled(),null===(i=this.li)||void 0===i||i.call(this,t)}}stop(t){var i,e=this.ai.get(t);(null==e?void 0:e.instance)&&(e.instance.stop(),null===(i=this.ui)||void 0===i||i.call(this,t))}isActive(t){var i,e,r;return null!==(r=null===(e=null===(i=this.ai.get(t))||void 0===i?void 0:i.instance)||void 0===e?void 0:e.isStarted)&&void 0!==r&&r}notifyConfigUpdate(t){this.ai.forEach(i=>{var e;(null===(e=i.instance)||void 0===e?void 0:e.onConfigUpdate)&&M(()=>i.instance.onConfigUpdate(t))})}notifyRemoteConfig(t){this.ai.forEach(i=>{var e;(null===(e=i.instance)||void 0===e?void 0:e.onRemoteConfig)&&M(()=>i.instance.onRemoteConfig(t))})}getAll(){var t=[];return this.ai.forEach(i=>{i.instance&&t.push(i.instance)}),t}hi(t){if(!t.instance){var i=this.Kt.getConfig();t.disableKey&&i[t.disableKey]||t.enableKey&&!1===i[t.enableKey]||M(()=>{var i;t.instance=new t.FeatureClass(this.Kt),t.instance.startIfEnabled(),t.instance.isStarted&&(null===(i=this.li)||void 0===i||i.call(this,t.name))})}}}var lr="vt";class ur{constructor(t){void 0===t&&(t={}),this.version=c,this.__loaded=!1,this.__request_queue=[],this.di=!1,this.oi=new R,this.configManager=new I(t);var i=this.configManager.getConfig();this.sessionManager=new Q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new di(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.rateLimiter=new rr({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.ci.captureInternal("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new ir({sendRequest:t=>this.fi(t),sendBeacon:t=>this.pi(t)}),this.requestQueue=new tr(t=>this.gi(t),{flush_interval_ms:3e3}),this.ci=new sr(this),this.mi=new or(this),this.bi=new nr(this),this.yi=new ar(this),this.bi.onApply(t=>{this.yi.notifyRemoteConfig(t)}),this.bi.onLoad(t=>{this.oi.emit(P,{config:t})}),this.yi.onFeatureStarted(t=>{this.oi.emit(L,{feature:t})}),this.yi.onFeatureStopped(t=>{this.oi.emit(U,{feature:t})})}init(t,i,e){var r;if(e&&e!==lr){var n=null!==(r=hr[e])&&void 0!==r?r:new ur;return n._init(t,i,e),hr[e]=n,hr[lr][e]=n,n}return this._init(t,i,e)}_init(t,i,e){if(void 0===i&&(i={}),this.__loaded)return console.warn("vTilt: Already initialized! Re-initializing is a no-op"),this;this.updateConfig(v({},i,{projectId:t||i.projectId,name:e})),this.__loaded=!0,this.wi(),this.bi.load();var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this.Si(),this.xi(),this.Ci(),!1!==r.capture_pageview&&this.ci.captureInitialPageview(),this.oi.emit(A,{config:r}),this}Si(){this.ki(),this.Ei(),this.Ti(),this.Ii(),this.ti()}ki(){this.historyAutocapture||(this.historyAutocapture=new mi(this),this.historyAutocapture.startIfEnabled())}Ei(){this.autocapture||!1!==this.configManager.getConfig().autocapture&&(this.autocapture=new oe(this),this.autocapture.startIfEnabled())}Ti(){this.webVitals||(this.webVitals=new gi(this),this.webVitals.startIfEnabled())}Ii(){this.sessionRecording||(this.configManager.getConfig().disable_session_recording||(this.sessionRecording=new le(this),this.sessionRecording.isEnabled&&(this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this.oi.emit(j))))}ti(){this.chat||(this.configManager.getConfig().disable_chat||(this.chat=new Xe(this),this.chat.startIfEnabled()))}startAutocapture(){this.autocapture||(this.autocapture=new oe(this)),this.autocapture.updateConfig({enabled:!0}),this.autocapture.startIfEnabled()}stopAutocapture(){var t;null===(t=this.autocapture)||void 0===t||t.stop()}isAutocaptureActive(){var t,i;return null!==(i=null===(t=this.autocapture)||void 0===t?void 0:t.isStarted)&&void 0!==i&&i}startSessionRecording(){this.sessionRecording||(this.sessionRecording=new le(this)),this.sessionRecording.updateConfig({enabled:!0}),this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this.oi.emit(j)}stopSessionRecording(){var t;null===(t=this.sessionRecording)||void 0===t||t.stop(),this.oi.emit(B)}isRecordingActive(){var t;return"active"===(null===(t=this.sessionRecording)||void 0===t?void 0:t.status)}getSessionRecordingId(){var t;return(null===(t=this.sessionRecording)||void 0===t?void 0:t.sessionId)||null}capture(t,i,e){this.ci.capture(t,i,e),this.oi.emit(D,{event:t,payload:i})}trackEvent(t,i){void 0===i&&(i={}),this.ci.trackEvent(t,i)}identify(t,i,e){this.mi.identify(t,i,e)}setUserProperties(t,i){this.mi.setUserProperties(t,i)}resetUser(t){this.mi.resetUser(t)}createAlias(t,i){this.mi.createAlias(t,i)}getUserIdentity(){return this.mi.getUserIdentity()}getDeviceId(){return this.mi.getDeviceId()}getUserState(){return this.mi.getUserState()}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.mi.getDistinctId()}getAnonymousId(){return this.mi.getAnonymousId()}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:lr;return i!==lr&&(i="vt."+i),i}updateConfig(t){this.configManager.updateConfig(t);var i=this.configManager.getConfig();this.sessionManager=new Q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new di(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.$i(i),this.oi.emit(O,{config:i})}$i(t){[this.historyAutocapture,this.autocapture,this.webVitals,this.sessionRecording,this.chat].forEach(i=>{(null==i?void 0:i.onConfigUpdate)&&M(()=>i.onConfigUpdate(t))})}buildUrl(){var t=this.configManager.getConfig(),{proxyUrl:i,proxy:e,api_host:r,token:n}=t;return i||(e?e+"/api/tracking?token="+n:r?r.replace(/\/+$/gm,"")+"/api/tracking?token="+n:"/api/tracking?token="+n)}sendRequest(i,e,r){if(this.Mi()){if(r&&void 0!==t)if(t.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});this.requestQueue.enqueue({url:i,event:e})}}Mi(){var t=this.configManager.getConfig();return!(!t.projectId||!t.token)||(this.di||(console.warn("VTilt: projectId and token are required for tracking"),this.di=!0),!1)}gi(t){"sendBeacon"!==t.transport?this.retryQueue.retriableRequest(t):this.pi(t)}fi(t){return new Promise(i=>{var{url:e,events:r}=t,n=1===r.length?r[0]:{events:r},s=this.configManager.getConfig().disable_compression?Ke.None:Ke.GZipJS;Ye({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>i({statusCode:t.statusCode})})})}pi(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Ke.None:Ke.GZipJS;Ye({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}Ri(t){this.sendRequest(t.url,t.event,!1)}xi(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};F(t,"beforeunload",i),F(t,"pagehide",i)}}Ci(){this.requestQueue.enable()}wi(){M(()=>{var i,e;if(void 0!==n&&n.search){var r=new URL(n.href),s=r.searchParams.get("vt");if(null==s?void 0:s.trim()){this.ci.setVtPersonUuid(s.trim()),r.searchParams.delete("vt");var o=r.pathname+(r.search||"")+r.hash;null===(e=null===(i=null==t?void 0:t.history)||void 0===i?void 0:i.replaceState)||void 0===e||e.call(i,{},"",o)}}})}_execute_array(t){Array.isArray(t)&&t.forEach(t=>{if(t&&Array.isArray(t)&&t.length>0){var i=t[0],e=t.slice(1);"function"==typeof this[i]&&M(()=>this[i](...e))}})}_dom_loaded(){this.__request_queue.forEach(t=>this.Ri(t)),this.__request_queue=[],this.Ci()}}var hr={},dr=!(void 0!==o||void 0!==s)&&-1===(null==a?void 0:a.indexOf("MSIE"))&&-1===(null==a?void 0:a.indexOf("Mozilla"));null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=dr);var vr,cr=(vr=hr[lr]=new ur,function(){function i(){i.done||(i.done=!0,dr=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),q(hr,t=>t._dom_loaded()))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():F(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support document.addEventListener")}(),vr);export{vi as ALL_WEB_VITALS_METRICS,ci as DEFAULT_WEB_VITALS_METRICS,ur as VTilt,cr as default,cr as vt};
|
|
1
|
+
var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,n=null==i?void 0:i.location,s=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0;null==i||i.AbortController;var a=null==e?void 0:e.userAgent,l=null!=t?t:{},u="[ExternalScriptsLoader]";function h(t,i,e,r,n,s,o){try{var a=t[s](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,n)}function d(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var s=t.apply(i,e);function o(t){h(s,r,n,o,a,"next",t)}function a(t){h(s,r,n,o,a,"throw",t)}o(void 0)})}}function v(){return v=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},v.apply(null,arguments)}l.__VTiltExtensions__=l.__VTiltExtensions__||{},l.__VTiltExtensions__.loadExternalDependency=(t,i,e)=>{var n=((t,i)=>{var e=t.getConfig();return e.script_host?e.script_host.replace(/\/+$/gm,"")+"/"+i+".js":e.api_host?e.api_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":(console.error(u+" Cannot load "+i+".js: api_host is required"),"")})(t,i);((t,i,e)=>{if(t.getConfig().disable_external_dependency_loading)return console.warn(u+" "+i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var n=null==r?void 0:r.querySelectorAll("script");if(n)for(var s,o=function(){if(n[a].src===i){var t=n[a];return t.__vtilt_loading_callback_fired?{v:e()}:(t.addEventListener("load",i=>{t.__vtilt_loading_callback_fired=!0,e(void 0,i)}),t.onerror=t=>e(t),{v:void 0})}},a=0;a<n.length;a++)if(s=o())return s.v;var l=()=>{var t;if(!r)return e("document not found");var n=r.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=i,n.onload=t=>{n.__vtilt_loading_callback_fired=!0,e(void 0,t)},n.onerror=t=>e(t);var s=r.querySelectorAll("body > script");s.length>0?null===(t=s[0].parentNode)||void 0===t||t.insertBefore(n,s[0]):r.body.appendChild(n)};(null==r?void 0:r.body)?l():null==r||r.addEventListener("DOMContentLoaded",l)})(t,n,e)};var c="1.10.2",f="__vt_session",p="__vt_window_id",g="__vt_primary_window",_="__vt_user_state",m="__vt_device_id",b="__vt_anonymous_id",y="__vt_remote_config",w="__vt_distinct_id",S="__vt_user_properties",x="localStorage",C="localStorage+cookie",k="sessionStorage",E="memory",T="$initial_person_info";class I{constructor(t){void 0===t&&(t={}),this.config=this.parseConfigFromScript(t)}parseConfigFromScript(t){if(!document.currentScript)return v({token:t.token||""},t);var i=document.currentScript,e=v({token:""},t);e.api_host=i.getAttribute("data-api-host")||i.getAttribute("data-host")||t.api_host,e.script_host=i.getAttribute("data-script-host")||t.script_host,e.proxy=i.getAttribute("data-proxy")||t.proxy,e.proxyUrl=i.getAttribute("data-proxy-url")||t.proxyUrl,e.token=i.getAttribute("data-token")||t.token||"",e.projectId=i.getAttribute("data-project-id")||t.projectId||"",e.domain=i.getAttribute("data-domain")||t.domain,e.storage=i.getAttribute("data-storage")||t.storage,e.stringifyPayload="false"!==i.getAttribute("data-stringify-payload");var r="true"===i.getAttribute("data-capture-performance");if(e.capture_performance=!!r||t.capture_performance,e.proxy&&e.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var n of(e.globalAttributes=v({},t.globalAttributes),Array.from(i.attributes)))n.name.startsWith("data-vt-")&&(e.globalAttributes[n.name.slice(8).replace(/-/g,"_")]=n.value);return e}getConfig(){return v({},this.config)}updateConfig(t){this.config=v({},this.config,t)}}function M(t,i){try{return t()}catch(t){return i}}class R{constructor(){this.o=new Map,this.m=new Map}on(t,i){return this.o.has(t)||this.o.set(t,new Set),this.o.get(t).add(i),()=>{var e;null===(e=this.o.get(t))||void 0===e||e.delete(i)}}once(t,i){return this.m.has(t)||this.m.set(t,new Set),this.m.get(t).add(i),()=>{var e;null===(e=this.m.get(t))||void 0===e||e.delete(i)}}emit(t,i){var e,r;null===(e=this.o.get(t))||void 0===e||e.forEach(e=>{try{e(i)}catch(i){console.error('[vTilt] Error in event listener for "'+t+'":',i)}});var n=this.m.get(t);n&&(n.forEach(e=>{try{e(i)}catch(i){console.error('[vTilt] Error in once listener for "'+t+'":',i)}}),this.m.delete(t)),null===(r=this.o.get("*"))||void 0===r||r.forEach(e=>{try{e({event:t,payload:i})}catch(t){console.error("[vTilt] Error in wildcard listener:",t)}})}off(t){t?(this.o.delete(t),this.m.delete(t)):(this.o.clear(),this.m.clear())}listenerCount(t){var i,e,r,n;return(null!==(e=null===(i=this.o.get(t))||void 0===i?void 0:i.size)&&void 0!==e?e:0)+(null!==(n=null===(r=this.m.get(t))||void 0===r?void 0:r.size)&&void 0!==n?n:0)}hasListeners(t){return this.listenerCount(t)>0}}var A="sdk:initialized",O="sdk:config_updated",P="sdk:remote_config_loaded",L="feature:started",U="feature:stopped",D="event:captured",j="recording:started",B="recording:stopped";function N(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function z(t){return!(!t||"string"!=typeof t)&&!(t.length<2||t.length>10240)}function q(t,i,e){if(t)if(Array.isArray(t))t.forEach((t,r)=>{i.call(e,t,r)});else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&i.call(e,t[r],r)}function F(t,i,e,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:n,passive:s})}function V(t,i){if(!i)return t;for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}function W(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];for(var n of e)for(var s of n)t.push(s);return t}var J=[b,m,w,_],H=31536e3,X=["herokuapp.com","vercel.app","netlify.app"];function K(t){var i;if(!t||"undefined"==typeof document)return"";var e=null===(i=document.location)||void 0===i?void 0:i.hostname;if(!e)return"";var r=e.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class G{constructor(t){var i,e,r;this.memoryStorage=new Map,this.S=null,this.method=t.method,this.cross_subdomain=null!==(i=t.cross_subdomain)&&void 0!==i?i:function(){var t;if("undefined"==typeof document)return!1;var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return!1;var e=i.split(".").slice(-2).join(".");return!X.includes(e)}(),this.sameSite=null!==(e=t.sameSite)&&void 0!==e?e:"Lax",this.secure=null!==(r=t.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this.S)return this.S;if(void 0===t||!t.localStorage)return this.S=!1,!1;try{var i="__vt_ls_test__";t.localStorage.setItem(i,"1");var e="1"===t.localStorage.getItem(i);return t.localStorage.removeItem(i),this.S=e,e||console.warn("[vTilt] localStorage unavailable, using cookies"),e}catch(t){return this.S=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(t){return J.includes(t)}get(t){var i;try{switch(this.method){case E:return null!==(i=this.memoryStorage.get(t))&&void 0!==i?i:null;case C:return this.getLocalStoragePlusCookie(t);case x:return this.getLocalStorage(t);case k:return this.readFromSessionStorage(t);default:return this.getCookie(t)}}catch(i){return console.warn('[vTilt] Storage get error for "'+t+'":',i),null}}set(t,i,e){try{switch(this.method){case E:this.memoryStorage.set(t,i);break;case C:this.setLocalStoragePlusCookie(t,i,e);break;case x:this.setLocalStorage(t,i);break;case k:this.writeToSessionStorage(t,i);break;default:this.setCookie(t,i,null!=e?e:H)}}catch(i){console.warn('[vTilt] Storage set error for "'+t+'":',i)}}remove(t){try{switch(this.method){case E:this.memoryStorage.delete(t);break;case C:this.removeLocalStoragePlusCookie(t);break;case x:this.removeLocalStorage(t);break;case k:this.removeFromSessionStorage(t);break;default:this.removeCookie(t)}}catch(i){console.warn('[vTilt] Storage remove error for "'+t+'":',i)}}getLocalStoragePlusCookie(i){if(this.isCriticalProperty(i)){var e=this.getCookie(i),r=this.getLocalStorage(i);if(null!==e){if(r!==e&&this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){}return e}return r}return this.getLocalStorage(i)}setLocalStoragePlusCookie(t,i,e){this.setLocalStorage(t,i),this.isCriticalProperty(t)&&this.setCookie(t,i,null!=e?e:H)}removeLocalStoragePlusCookie(t){this.removeLocalStorage(t),this.isCriticalProperty(t)&&this.removeCookie(t)}getLocalStorage(i){var e;if(!this.isLocalStorageSupported())return null;try{return null!==(e=null==t?void 0:t.localStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}setLocalStorage(i,e){if(this.isLocalStorageSupported())try{null==t||t.localStorage.setItem(i,e)}catch(t){console.warn("[vTilt] localStorage write error:",t)}}removeLocalStorage(i){if(this.isLocalStorageSupported())try{null==t||t.localStorage.removeItem(i)}catch(t){}}readFromSessionStorage(i){var e;try{return null!==(e=null==t?void 0:t.sessionStorage.getItem(i))&&void 0!==e?e:null}catch(t){return null}}writeToSessionStorage(i,e){try{null==t||t.sessionStorage.setItem(i,e)}catch(t){console.warn("[vTilt] sessionStorage write error:",t)}}removeFromSessionStorage(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){}}getCookie(t){if("undefined"==typeof document)return null;var i=t+"=";for(var e of document.cookie.split(";")){var r=e.trim();if(r.startsWith(i))try{return decodeURIComponent(r.slice(i.length))}catch(t){return r.slice(i.length)}}return null}setCookie(t,i,e){if("undefined"!=typeof document){var r=K(this.cross_subdomain),n=t+"="+encodeURIComponent(i)+"; Max-Age="+e+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(t){if("undefined"!=typeof document){var i=K(this.cross_subdomain);document.cookie=t+"=; Max-Age=0; path=/"+(i?"; domain="+i:""),document.cookie=t+"=; Max-Age=0; path=/"}}getWithExpiry(t){var i=this.get(t);if(!i)return null;try{var e=JSON.parse(i);return e.expiry&&Date.now()>e.expiry?(this.remove(t),null):e.value}catch(t){return null}}setWithExpiry(t,i,e){var r=v({value:i},e?{expiry:Date.now()+e}:{});this.set(t,JSON.stringify(r))}getJSON(t){var i=this.get(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}}setJSON(t,i,e){this.set(t,JSON.stringify(i),e)}canUseSessionStorage(){if(void 0===t||!(null==t?void 0:t.sessionStorage))return!1;try{var i="__vt_ss_test__";return t.sessionStorage.setItem(i,"1"),t.sessionStorage.removeItem(i),!0}catch(t){return!1}}getSessionStorage(){var i;return this.canUseSessionStorage()&&null!==(i=null==t?void 0:t.sessionStorage)&&void 0!==i?i:null}setMethod(t){this.method=t}getMethod(){return this.method}}class Q{constructor(t,i){void 0===t&&(t="cookie"),this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.C=void 0,this.k()}getSessionId(){var t=this.T();return t||(t=N(),this.I(t)),t}setSessionId(){var t=this.T()||N();return this.I(t),t}resetSessionId(){this.$(),this.setSessionId(),this.M(N())}T(){return this.storage.get(f)}I(t){this.storage.set(f,t,1800)}$(){this.storage.remove(f)}getWindowId(){if(this.C)return this.C;var t=this.storage.getSessionStorage();if(t){var i=t.getItem(p);if(i)return this.C=i,i}var e=N();return this.M(e),e}M(t){if(t!==this.C){this.C=t;var i=this.storage.getSessionStorage();i&&i.setItem(p,t)}}k(){var t=this.storage.getSessionStorage();if(t){var i=t.getItem(g),e=t.getItem(p);e&&!i?this.C=e:(e&&t.removeItem(p),this.M(N())),t.setItem(g,"true"),this.R()}else this.C=N()}R(){var i=this.storage.getSessionStorage();t&&i&&F(t,"beforeunload",()=>{var t=this.storage.getSessionStorage();t&&t.removeItem(g)},{capture:!1})}updateStorageMethod(t,i){this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"})}}function Z(t){if(!r)return null;var i=r.createElement("a");return i.href=t,i}function Y(t,i){for(var e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===i){if(n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(t){}return s.replace(/\+/g," ")}}return""}function tt(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("="),c=v[0],f=v.slice(1).join("=");-1!==i.indexOf(c)?h.push(c+"="+e):c&&h.push(c+(f?"="+f:""))}var p=h.join("&");return l+(p?"?"+p:"")+(s?"#"+s:"")}function it(t){return"function"==typeof t}var et="Mobile",rt="iOS",nt="Android",st="Tablet",ot=nt+" "+st,at="iPad",lt="Apple",ut=lt+" Watch",ht="Safari",dt="BlackBerry",vt="Samsung",ct=vt+"Browser",ft=vt+" Internet",pt="Chrome",gt=pt+" OS",_t=pt+" "+rt,mt="Internet Explorer",bt=mt+" "+et,yt="Opera",wt=yt+" Mini",St="Edge",xt="Microsoft "+St,Ct="Firefox",kt=Ct+" "+rt,Et="Nintendo",Tt="PlayStation",It="Xbox",$t=nt+" "+et,Mt=et+" "+ht,Rt="Windows",At=Rt+" Phone",Ot="Nokia",Pt="Ouya",Lt="Generic",Ut=Lt+" "+et.toLowerCase(),Dt=Lt+" "+st.toLowerCase(),jt="Konqueror",Bt="(\\d+(\\.\\d+)?)",Nt=new RegExp("Version/"+Bt),zt=new RegExp(It,"i"),qt=new RegExp(Tt+" \\w+","i"),Ft=new RegExp(Et+" \\w+","i"),Vt=new RegExp(dt+"|PlayBook|BB10","i"),Wt={"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 Jt(t,i){return t.toLowerCase().includes(i.toLowerCase())}var Ht=(t,i)=>i&&Jt(i,lt)||function(t){return Jt(t,ht)&&!Jt(t,pt)&&!Jt(t,nt)}(t),Xt=function(t,i){return i=i||"",Jt(t," OPR/")&&Jt(t,"Mini")?wt:Jt(t," OPR/")?yt:Vt.test(t)?dt:Jt(t,"IE"+et)||Jt(t,"WPDesktop")?bt:Jt(t,ct)?ft:Jt(t,St)||Jt(t,"Edg/")?xt:Jt(t,"FBIOS")?"Facebook "+et:Jt(t,"UCWEB")||Jt(t,"UCBrowser")?"UC Browser":Jt(t,"CriOS")?_t:Jt(t,"CrMo")||Jt(t,pt)?pt:Jt(t,nt)&&Jt(t,ht)?$t:Jt(t,"FxiOS")?kt:Jt(t.toLowerCase(),jt.toLowerCase())?jt:Ht(t,i)?Jt(t,et)?Mt:ht:Jt(t,Ct)?Ct:Jt(t,"MSIE")||Jt(t,"Trident/")?mt:Jt(t,"Gecko")?Ct:""},Kt={[bt]:[new RegExp("rv:"+Bt)],[xt]:[new RegExp(St+"?\\/"+Bt)],[pt]:[new RegExp("("+pt+"|CrMo)\\/"+Bt)],[_t]:[new RegExp("CriOS\\/"+Bt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Bt)],[ht]:[Nt],[Mt]:[Nt],[yt]:[new RegExp("(Opera|OPR)\\/"+Bt)],[Ct]:[new RegExp(Ct+"\\/"+Bt)],[kt]:[new RegExp("FxiOS\\/"+Bt)],[jt]:[new RegExp("Konqueror[:/]?"+Bt,"i")],[dt]:[new RegExp(dt+" "+Bt),Nt],[$t]:[new RegExp("android\\s"+Bt,"i")],[ft]:[new RegExp(ct+"\\/"+Bt)],[mt]:[new RegExp("(rv:|MSIE )"+Bt)],Mozilla:[new RegExp("rv:"+Bt)]},Gt=function(t,i){var e=Xt(t,i),r=Kt[e];if(void 0===r)return null;for(var n=0;n<r.length;n++){var s=r[n],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Qt=[[new RegExp(It+"; "+It+" (.*?)[);]","i"),t=>[It,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(Tt,"i"),[Tt,""]],[Vt,[dt,""]],[new RegExp(Rt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[At,""];if(new RegExp(et).test(i)&&!/IEMobile\b/.test(i))return[Rt+" "+et,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],n=Wt[r]||"";return/arm/i.test(i)&&(n="RT"),[Rt,n]}return[Rt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[rt,i.join(".")]}return[rt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=void 0===t[2]?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+nt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+nt+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[nt,i.join(".")]}return[nt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[gt,""]],[/Linux|debian/i,["Linux",""]]],Zt=function(t){return Ft.test(t)?Et:qt.test(t)?Tt:zt.test(t)?It:new RegExp(Pt,"i").test(t)?Pt:new RegExp("("+At+"|WPDesktop)","i").test(t)?At:/iPad/.test(t)?at:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ut:Vt.test(t)?dt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ot,"i").test(t)?Ot:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(et).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?nt:ot:nt:new RegExp("(pda|"+et+")","i").test(t)?Ut:new RegExp(st,"i").test(t)&&!new RegExp(st+" pc","i").test(t)?Dt:""},Yt="https?://(.*)",ti=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ii=W(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ti),ei="<masked>";function ri(t){var i=function(t){return t?0===t.search(Yt+"google.([^/?]*)")?"google":0===t.search(Yt+"bing.com")?"bing":0===t.search(Yt+"yahoo.com")?"yahoo":0===t.search(Yt+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!==i?"q":"p",n={};if(null!==i){n.$search_engine=i;var s=r?Y(r.referrer,e):"";s.length&&(n.ph_keyword=s)}return n}function ni(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function si(){return(null==r?void 0:r.referrer)||"$direct"}function oi(){var t;return(null==r?void 0:r.referrer)&&(null===(t=Z(r.referrer))||void 0===t?void 0:t.host)||"$direct"}function ai(t){var i,{r:e,u:r}=t,n={$referrer:e,$referring_domain:null==e?void 0:"$direct"===e?"$direct":null===(i=Z(e))||void 0===i?void 0:i.host};if(r){n.$current_url=r;var s=Z(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=function(t){var i=ii.concat([]),e={};return q(i,function(i){var r=Y(t,i);e[i]=r||null}),e}(r);V(n,o)}e&&V(n,ri(e));return n}function li(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ui(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function hi(i,e){if(!a)return{};var r,s,o,[l,u]=function(t){for(var i=0;i<Qt.length;i++){var[e,r]=Qt[i],n=e.exec(t),s=n&&(it(r)?r(n,t):r);if(s)return s}return["",""]}(a);return V(function(t){var i={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];null!=r&&""!==r&&(i[e]=r)}return i}({$os:l,$os_version:u,$browser:Xt(a,navigator.vendor),$device:Zt(a),$device_type:(s=a,o=Zt(s),o===at||o===ot||"Kobo"===o||"Kindle Fire"===o||o===Dt?st:o===Et||o===It||o===Tt||o===Pt?"Console":o===ut?"Wearable":o?et:"Desktop"),$timezone:li(),$timezone_offset:ui()}),{$current_url:tt(null==n?void 0:n.href,[],ei),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:Gt(a,navigator.vendor),$browser_language:ni(),$browser_language_prefix:(r=ni(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class di{constructor(t,i){void 0===t&&(t="localStorage"),this.A=null,this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return v({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(b,this.userIdentity.anonymous_id,H)),this.userIdentity.anonymous_id}getUserProperties(){return v({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}identify(t,i,e){if("number"==typeof t&&(t=t.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),t)if(this.isDistinctIdStringLike(t))console.error('The string "'+t+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==t){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=t,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=v({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}t!==r&&(this.userIdentity.distinct_id=t);var s="anonymous"===this.userIdentity.user_state;t!==r&&s?(this.userIdentity.user_state="identified",i&&(this.userIdentity.properties=v({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):i||e?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),i&&(this.userIdentity.properties=v({},this.userIdentity.properties,i)),e&&Object.keys(e).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=e[t])}),this.saveUserIdentity()):t!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+t+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(t,i){if(!t&&!i)return!1;var e=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(e,t,i);return this.A===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(t&&(this.userIdentity.properties=v({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity(),this.A=r,!0)}reset(t){var i=this.generateAnonymousId(),e=this.userIdentity.device_id,r=t?this.generateDeviceId():e;this.userIdentity={distinct_id:null,anonymous_id:i,device_id:r,properties:{},user_state:"anonymous"},this.A=null,this.saveUserIdentity(),this.userIdentity.properties=v({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(t){this.userIdentity.distinct_id=t,this.saveUserIdentity()}setUserState(t){this.userIdentity.user_state=t,this.saveUserIdentity()}updateUserProperties(t,i){t&&(this.userIdentity.properties=v({},this.userIdentity.properties,t)),i&&Object.keys(i).forEach(t=>{t in this.userIdentity.properties||(this.userIdentity.properties[t]=i[t])}),this.saveUserIdentity()}ensureDeviceId(t){this.userIdentity.device_id||(this.userIdentity.device_id=t,this.userIdentity.properties=v({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:t}),this.saveUserIdentity())}createAlias(t,i){return this.isValidDistinctId(t)?(void 0===i&&(i=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(i)?t===i?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:t,original:i}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(t){return this.isDistinctIdStringLike(t)}set_initial_person_info(t,i){if(!this.getStoredUserProperties()[T]){var e=function(t,i){var e=t?W([],ti,i||[]):[],r=null==n?void 0:n.href.substring(0,1e3);return{r:si().substring(0,1e3),u:r?tt(r,e,ei):void 0}}(t,i);this.register_once({[T]:e},void 0)}}get_initial_props(){var t,i,e=this.getStoredUserProperties()[T];return e?(t=ai(e),i={},q(t,function(t,e){var r;i["$initial_"+(r=String(e),r.startsWith("$")?r.substring(1):r)]=t}),i):{}}update_referrer_info(){var t={$referrer:si(),$referring_domain:oi()};this.register_once(t,void 0)}loadUserIdentity(){var t=this.storage.get(b),i=this.storage.get(m),e=this.storage.get(w),r=this.storage.get(_),n=this.getStoredUserProperties(),s=t||this.generateAnonymousId(),o=i||this.generateDeviceId(),a=e||null,l=r||"anonymous",u=s||this.generateAnonymousId();return t||this.storage.set(b,u,H),i||this.storage.set(m,o,H),r||this.storage.set(_,l,H),{distinct_id:a,anonymous_id:u,device_id:o,properties:n,user_state:l}}saveUserIdentity(){this.storage.set(b,this.userIdentity.anonymous_id,H),this.storage.set(m,this.userIdentity.device_id,H),this.storage.set(_,this.userIdentity.user_state,H),this.userIdentity.distinct_id?this.storage.set(w,this.userIdentity.distinct_id,H):this.storage.remove(w),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(S)||{}}setStoredUserProperties(t){this.storage.setJSON(S,t,H)}register_once(t,i){var e=this.getStoredUserProperties(),r=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(n in e||(e[n]=t[n],r=!0));if(i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(s in e||(e[s]=i[s],r=!0));r&&this.setStoredUserProperties(e)}generateAnonymousId(){return"anon_"+N()}generateDeviceId(){return"device_"+N()}getPersonPropertiesHash(t,i,e){return JSON.stringify({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}isValidDistinctId(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(i)&&0!==t.trim().length}isDistinctIdStringLike(t){if(!t||"string"!=typeof t)return!1;var i=t.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(i)}updateStorageMethod(t,i){this.storage=new G({method:t,cross_subdomain:i,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var vi=["LCP","CLS","FCP","INP","TTFB"],ci=["LCP","CLS","FCP","INP"],fi=9e5,pi="[WebVitals]";class gi{static extractConfig(t){var i=t.capture_performance;return"boolean"==typeof i?{web_vitals:i}:"object"==typeof i&&null!==i?i:{web_vitals:!1}}constructor(t){this.name="WebVitals",this.O=!1,this._instance=t,this.P=this.L(),this.U=gi.extractConfig(t.getConfig())}get isEnabled(){var t=null==n?void 0:n.protocol;return("http:"===t||"https:"===t)&&!0===this.U.web_vitals}get isStarted(){return this.O}startIfEnabled(){if(this.isEnabled&&!this.O&&t){var i=this.D();i?this.j(i):this.B()}}stop(){this.O&&(this.N(),this.q&&(clearTimeout(this.q),this.q=void 0),this.O=!1)}onConfigUpdate(t){var i=gi.extractConfig(t),e=this.isEnabled;this.U=i,e||!this.isEnabled||this.O?e&&!this.isEnabled&&this.O&&this.stop():this.startIfEnabled()}get allowedMetrics(){return this.U.web_vitals_allowed_metrics||ci}get flushTimeoutMs(){return this.U.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var t=this.U.__web_vitals_max_value;return void 0===t?fi:0===t?0:t<6e4?fi:t}L(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}D(){var t;return null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.webVitalsCallbacks}B(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;i?i(this._instance,"web-vitals",t=>{if(t)console.error(pi+" Failed to load web-vitals:",t);else{var i=this.D();i?this.j(i):console.error(pi+" web-vitals loaded but callbacks not registered")}}):console.warn(pi+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}j(t){if(!this.O){var i=this.allowedMetrics,e=this.F.bind(this);i.includes("LCP")&&t.onLCP&&t.onLCP(e),i.includes("CLS")&&t.onCLS&&t.onCLS(e,{reportAllChanges:!0}),i.includes("FCP")&&t.onFCP&&t.onFCP(e),i.includes("INP")&&t.onINP&&t.onINP(e),i.includes("TTFB")&&t.onTTFB&&t.onTTFB(e),this.O=!0}}V(){var i;return null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.href}W(){return null==n?void 0:n.pathname}F(i){try{if(!t||!r||!n)return;if(!(null==i?void 0:i.name)||void 0===(null==i?void 0:i.value))return void console.warn(pi+" Invalid metric received",i);if(this.maxAllowedValue>0&&i.value>=this.maxAllowedValue&&"CLS"!==i.name)return void console.warn(pi+" Ignoring "+i.name+" with value >= "+this.maxAllowedValue+"ms");var e=this.V(),s=this.W();if(!e)return void console.warn(pi+" Could not determine current URL");this.P.url&&this.P.url!==e&&this.N(),this.P.url||(this.P.url=e,this.P.pathname=s),this.P.firstMetricTimestamp||(this.P.firstMetricTimestamp=Date.now());var o=this.J(i.attribution),a=this._instance.getSessionId(),l=this.H(),u=v({},i,{attribution:o,timestamp:Date.now(),$current_url:e,$session_id:a,$window_id:l}),h=this.P.metrics.findIndex(t=>t.name===i.name);h>=0?this.P.metrics[h]=u:this.P.metrics.push(u),this.X(),this.P.metrics.length>=this.allowedMetrics.length&&this.N()}catch(t){console.error(pi+" Error adding metric to buffer:",t)}}J(t){if(t){var i=v({},t);return"interactionTargetElement"in i&&delete i.interactionTargetElement,i}}H(){var t;try{return(null===(t=this._instance.sessionManager)||void 0===t?void 0:t.getWindowId())||null}catch(t){return null}}X(){this.q&&clearTimeout(this.q),this.q=setTimeout(()=>{this.N()},this.flushTimeoutMs)}N(){if(this.q&&(clearTimeout(this.q),this.q=void 0),0!==this.P.metrics.length){try{var t={$pathname:this.P.pathname,$current_url:this.P.url};for(var i of this.P.metrics)t["$web_vitals_"+i.name+"_value"]=i.value,t["$web_vitals_"+i.name+"_event"]={name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,attribution:i.attribution,$session_id:i.$session_id,$window_id:i.$window_id};this._instance.capture("$web_vitals",t)}catch(t){console.error(pi+" Error flushing metrics:",t)}this.P=this.L()}}}function _i(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],n=e(r);return it(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),t[i]=n,()=>{t[i]=r}}catch(t){return()=>{}}}class mi{constructor(i,e){var r;this.name="HistoryAutocapture",this.O=!1,this._instance=i,this.U=e||mi.extractConfig(i.getConfig()),this.K=(null===(r=null==t?void 0:t.location)||void 0===r?void 0:r.pathname)||""}static extractConfig(t){return{enabled:!1!==t.capture_pageview}}get isEnabled(){return!1!==this.U.enabled&&!1!==this._instance.getConfig().capture_pageview}get isStarted(){return this.O}startIfEnabled(){this.isEnabled&&!this.O&&this.G()}stop(){this.O&&(this.Z&&(this.Z(),this.Z=void 0),this.O=!1)}onConfigUpdate(t){this.U=mi.extractConfig(t),this.isEnabled&&!this.O?this.G():!this.isEnabled&&this.O&&this.stop()}G(){t&&n&&(this.K=n.pathname||"",this.Y(),this.tt(),this.O=!0)}Y(){var i,e;if(null==t?void 0:t.history){var r=this;(null===(i=t.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||_i(t.history,"pushState",t=>function(i,e,n){t.call(this,i,e,n),r.it("pushState")}),(null===(e=t.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||_i(t.history,"replaceState",t=>function(i,e,n){t.call(this,i,e,n),r.it("replaceState")})}}tt(){if(!this.Z&&t){var i=()=>{this.it("popstate")};F(t,"popstate",i),this.Z=()=>{null==t||t.removeEventListener("popstate",i)}}}it(i){this.isEnabled&&this.O&&M(()=>{var e,s=null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.pathname;if(s&&n&&r){if(s!==this.K){var o={navigation_type:i};this._instance.capture("$pageview",o)}this.K=s}})}}var bi=["a","button","form","input","select","textarea","label"],yi="$copy_autocapture";function wi(t){return null==t}function Si(t){return"string"==typeof t}function xi(t){return void 0===t}function Ci(t){return t.replace(/^\s+|\s+$/g,"")}function ki(t,i){return t.indexOf(i)>-1}function Ei(t){return 1===(null==t?void 0:t.nodeType)}function Ti(t){return 3===(null==t?void 0:t.nodeType)}function Ii(t,i){var e;return(null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase())===i}function $i(t){return 11===(null==t?void 0:t.nodeType)}function Mi(t){return t?Ci(t).split(/\s+/):[]}function Ri(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className&&"string"==typeof t.className.baseVal?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Mi(i)}function Ai(t){return wi(t)?null:Ci(t).split(/(\s+)/).filter(t=>Wi(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Oi(t){var i,e="";if(Hi(t)&&!Xi(t)&&t.childNodes&&t.childNodes.length)for(var r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];Ti(n)&&n.textContent&&(e+=null!==(i=Ai(n.textContent))&&void 0!==i?i:"")}return Ci(e)}function Pi(t){var i,e="";if(t&&t.childNodes&&t.childNodes.length)for(var r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];if(n&&"span"===(null===(i=n.tagName)||void 0===i?void 0:i.toLowerCase()))try{e=(e+" "+Oi(n)).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Pi(n)).trim())}catch(t){}}return e}function Li(t){var i=Oi(t);return Wi(i=(i+" "+Pi(t)).trim())?i:""}function Ui(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ei(i));return i}function Di(t){var i=t.parentNode;return!(!i||!Ei(i))&&i}function ji(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}var Bi="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ni=new RegExp("^(?:"+Bi+")$"),zi=new RegExp(Bi),qi="\\d{3}-?\\d{2}-?\\d{4}",Fi=new RegExp("^("+qi+")$"),Vi=new RegExp("("+qi+")");function Wi(t,i){if(void 0===i&&(i=!0),wi(t))return!1;if(Si(t)){if(t=Ci(t),(i?Ni:zi).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Fi:Vi).test(t))return!1}return!0}function Ji(t){return!!Si(t)&&("_ngcontent"===t.substring(0,10)||"_nghost"===t.substring(0,7))}function Hi(t){for(var i=t;i&&i.parentNode&&!Ii(i,"body");i=i.parentNode){var e=Ri(i);if(ki(e,"vt-sensitive")||ki(e,"vt-no-capture"))return!1}if(ki(Ri(t),"vt-include"))return!0;var r=t.type||"";if(Si(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=t.name||t.id||"";if(Si(n)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Xi(t){return!!(Ii(t,"input")&&!["button","checkbox","submit","reset","radio"].includes(t.type)||Ii(t,"textarea")||"true"===t.getAttribute("contenteditable"))}function Ki(t){if(!Hi(t))return null;if(Ii(t,"input")){var i=t,e=(i.type||"text").toLowerCase();if("password"===e||"hidden"===e)return null;if("checkbox"===e||"radio"===e){var r={$el_value:i.checked?"true":"false"},n=function(t){var i=t.closest("label");if(i){var e=Ci(i.textContent||"");if(e&&Wi(e))return Ai(e)||null}if(t.id)try{var r=null===document||void 0===document?void 0:document.querySelector('label[for="'+t.id+'"]');if(r){var n=Ci(r.textContent||"");if(n&&Wi(n))return Ai(n)||null}}catch(t){}return null}(i);return n?r.$selected_text=n:i.value&&Wi(i.value)&&(r.$selected_text=i.value),r}var s=i.value;if(s&&Wi(s)){var o=Ai(s);if(o)return{$el_value:o}}return null}if(Ii(t,"select")){var a=t,l=a.selectedIndex;if(l>=0&&a.options[l]){var u=a.options[l],h={};u.value&&Wi(u.value)&&(h.$el_value=u.value);var d=u.text;if(d&&Wi(d)){var v=Ai(d);v&&(h.$selected_text=v)}if(h.$el_value||h.$selected_text)return h}return null}return Ii(t,"textarea"),null}function Gi(i,e,r,n,s){if(void 0===r&&(r=void 0),!t||!i||Ii(i,"html")||!Ei(i))return!1;if((null==r?void 0:r.url_allowlist)&&!ji(r.url_allowlist))return!1;if((null==r?void 0:r.url_ignorelist)&&ji(r.url_ignorelist))return!1;if(null==r?void 0:r.dom_event_allowlist){var o=r.dom_event_allowlist;if(o&&!o.some(t=>e.type===t))return!1}for(var a=!1,l=[i],u=!0,h=i;h.parentNode&&!Ii(h,"body");)if($i(h.parentNode))l.push(h.parentNode.host),h=h.parentNode.host;else{if(!(u=Di(h)))break;if(n||bi.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=t.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),h=u}if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(xi(e))return!0;var r,n=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}(l,r))return!1;if(!function(t,i){var e=null==i?void 0:i.css_selector_allowlist;if(xi(e))return!0;var r,n=function(t){if(e.some(i=>t.matches(i)))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}(l,r))return!1;var v=t.getComputedStyle(i);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=i.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return a?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(bi.indexOf(c)>-1||"true"===i.getAttribute("contenteditable"))}}function Qi(t,i){return i.length>t?i.slice(0,t)+"...":i}function Zi(t,i,e,r){var n=t.tagName.toLowerCase(),s={tag_name:n};bi.indexOf(n)>-1&&!e&&(s.$el_text=Qi(1024,"a"===n||"button"===n?Li(t):Oi(t)));var o=Ri(t);o.length>0&&(s.classes=o.filter(t=>""!==t));for(var a=0;a<t.attributes.length;a++){var l=t.attributes[a];if((!Xi(t)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==r?void 0:r.includes(l.name))&&!i&&Wi(l.value)&&!Ji(l.name))){var u=l.value;"class"===l.name&&(u=Mi(u).join(" ")),s["attr__"+l.name]=Qi(1024,u)}}for(var h=1,d=1,v=t;v=Ui(v);)h++,v.tagName===t.tagName&&d++;return s.nth_child=h,s.nth_of_type=d,s}function Yi(t){if(!Hi(t))return{};for(var i={},e=0;e<t.attributes.length;e++){var r=t.attributes[e];if(r.name&&0===r.name.indexOf("data-vt-capture-attribute")){var n=r.name.replace("data-vt-capture-attribute-",""),s=r.value;n&&s&&Wi(s)&&(i[n]=s)}}return i}function te(t){return t.replace(/"|\\"/g,'\\"')}function ie(t){var i,e=t.attr__class;return e?(i=e,Array.isArray(i)?e:Mi(e)):void 0}function ee(t){return function(t){var i=t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var s=v({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Object.entries(s).sort((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)}).forEach(t=>{var[i,e]=t;return o[te(i.toString())]=te(String(e))}),(r+=":")+Object.entries(o).map(t=>{var[i,e]=t;return i+'="'+e+'"'}).join("")});return i.join(";")}(function(t){return t.map(t=>{var i,e,r={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:ie(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Object.entries(t).filter(t=>{var[i]=t;return 0===i.indexOf("attr__")}).forEach(t=>{var[i,e]=t;return r.attributes[i]=e}),r})}(t))}function re(t,i){return t.indexOf(i)>-1}class ne{constructor(){this.clicks=[],this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3}isRageClick(t,i,e){if(this.clicks=this.clicks.filter(t=>e-t.timestamp<this.RAGE_CLICK_TIMEOUT_MS),this.clicks.length>0){var r=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(t-r.x,2)+Math.pow(i-r.y,2))>this.RAGE_CLICK_THRESHOLD_PX&&(this.clicks=[])}return this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length>=this.RAGE_CLICK_CLICK_COUNT}}function se(i,e){for(var r,n,s,o,{e:a,maskAllElementAttributes:l,maskAllText:u,elementAttributeIgnoreList:h,elementsChainAsString:d,captureElementValues:v}=e,c=[i],f=i;f.parentNode&&!Ii(f,"body");)$i(f.parentNode)?(c.push(f.parentNode.host),f=f.parentNode.host):(c.push(f.parentNode),f=f.parentNode);var p,g=[],_={},m=!1,b=!1;for(var y of c){var w=Hi(y);if("a"===y.tagName.toLowerCase()){var S=y.getAttribute("href");m=!!(w&&S&&Wi(S))&&S}re(Ri(y),"vt-no-capture")&&(b=!0),g.push(Zi(y,l,u,h));var x=Yi(y);Object.assign(_,x)}if(b)return{props:{},explicitNoCapture:b};if(u||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?g[0].$el_text=Li(i):g[0].$el_text=Oi(i)),"change"===a.type&&v){var C=Ki(i);C&&(C.$el_value&&(g[0].$el_value=C.$el_value),C.$selected_text&&(g[0].$selected_text=C.$selected_text))}if(m){g[0].attr__href=m;var k=null===(r=Z(m))||void 0===r?void 0:r.host,E=null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.host;k&&E&&k!==E&&(p=m)}var T=function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return Object.assign({},...i)}({$event_type:a.type,$ce_version:1},d?{}:{$elements:g},{$elements_chain:ee(g)},(null===(s=g[0])||void 0===s?void 0:s.$el_text)?{$el_text:null===(o=g[0])||void 0===o?void 0:o.$el_text}:{},p&&"click"===a.type?{$external_click_url:p}:{},_);return{props:T}}class oe{constructor(t){this.name="Autocapture",this.et=!1,this.rt=null,this.nt=null,this.st=new ne,this.ot=!1,this._instance=t}get U(){var t,i=this._instance.getConfig(),e="object"!=typeof(t=i.autocapture)||null===t||Array.isArray(t)?{}:i.autocapture;return e.url_allowlist&&(e.url_allowlist=e.url_allowlist.map(t=>"string"==typeof t?new RegExp(t):t)),e.url_ignorelist&&(e.url_ignorelist=e.url_ignorelist.map(t=>"string"==typeof t?new RegExp(t):t)),e}get isEnabled(){var t,i=null!==(t=this.rt)&&void 0!==t&&t;return!!this._instance.getConfig().autocapture&&!i}get isStarted(){return this.et}startIfEnabled(){this.isEnabled&&!this.et&&(this.lt(),this.et=!0)}stop(){this.et=!1}onConfigUpdate(t){this.isEnabled&&!this.et&&this.startIfEnabled()}onRemoteConfig(t){t.elementsChainAsString&&(this.ot=t.elementsChainAsString),this.rt=!!t.autocapture_opt_out,this.startIfEnabled()}updateConfig(t){void 0!==t.enabled&&t.enabled&&(this.rt=!1)}setElementSelectors(t){this.nt=t}getElementSelectors(t){var i,e=[];return null===(i=this.nt)||void 0===i||i.forEach(i=>{var n=null==r?void 0:r.querySelectorAll(i);null==n||n.forEach(r=>{t===r&&e.push(i)})}),e}lt(){if(this.ut()&&t&&r){var i=i=>{i=i||(null==t?void 0:t.event);try{this.ht(i)}catch(t){}};if(F(r,"submit",i,{capture:!0}),F(r,"change",i,{capture:!0}),F(r,"click",i,{capture:!0}),this.U.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.ht(i,yi)};F(r,"copy",e,{capture:!0}),F(r,"cut",e,{capture:!0})}}}ht(i,e){var r,n,s,o,a;if(void 0===e&&(e="$autocapture"),this.isEnabled){var l=function(t){var i;return xi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}(i);if(Ti(l)&&(l=l.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this._instance.getConfig().rageclick&&(null===(r=this.st)||void 0===r?void 0:r.isRageClick(i.clientX,i.clientY,(new Date).getTime()))&&this.ht(i,"$rageclick");var u=e===yi;if(l&&Gi(l,i,this.U,u,u?["copy","cut"]:void 0)){var h=this._instance.getConfig(),{props:d,explicitNoCapture:v}=se(l,{e:i,maskAllElementAttributes:null!==(n=h.mask_all_element_attributes)&&void 0!==n&&n,maskAllText:null!==(s=h.mask_all_text)&&void 0!==s&&s,elementAttributeIgnoreList:this.U.element_attribute_ignorelist,elementsChainAsString:this.ot,captureElementValues:null!==(o=this.U.capture_element_values)&&void 0!==o&&o});if(v)return!1;var c=this.getElementSelectors(l);if(c&&c.length>0&&(d.$element_selectors=c),e===yi){var f=Ai(null===(a=null==t?void 0:t.getSelection())||void 0===a?void 0:a.toString()),p=i.type||"clipboard";if(!f)return!1;d.$selected_content=f,d.$copy_type=p}return this._instance.capture(e,d),!0}}}ut(){return"function"==typeof(null==r?void 0:r.querySelectorAll)}}var ae="[SessionRecording]";class le{constructor(t,i){this._instance=t,this.name="SessionRecording",this.O=!1,this.U=i||le.extractConfig(t.getConfig())}static extractConfig(t){var i,e,r,n=t.session_recording||{};return{enabled:null!==(i=n.enabled)&&void 0!==i&&i,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(e=n.captureConsole)&&void 0!==e&&e,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}get isEnabled(){var i,e=this._instance.getConfig(),r=null!==(i=this.U.enabled)&&void 0!==i&&i,n=!e.disable_session_recording;return!!t&&r&&n}get isStarted(){var t;return this.O&&!!(null===(t=this.dt)||void 0===t?void 0:t.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(t){var i;if(!this.isEnabled||!(null===(i=this.dt)||void 0===i?void 0:i.isStarted)){var e=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&e?(this.vt(t),this.O=!0,console.info(ae+" starting")):this.stop()}}stop(){M(()=>{var t;null===(t=this.dt)||void 0===t||t.stop(),this.O=!1})}onConfigUpdate(t){var i;this.U=le.extractConfig(t),null===(i=this.dt)||void 0===i||i.updateConfig(this.U),this.startIfEnabledOrStop("config_updated")}onRemoteConfig(t){var i,e,r,n,s,o,a;if(t.sessionRecording){var l=t.sessionRecording;this.U=v({},this.U,{enabled:null!==(i=this.U.enabled)&&void 0!==i?i:l.enabled,sampleRate:null!==(e=this.U.sampleRate)&&void 0!==e?e:l.sampleRate,minimumDurationMs:null!==(r=this.U.minimumDurationMs)&&void 0!==r?r:l.minimumDurationMs,fullSnapshotIntervalMs:null!==(n=this.U.fullSnapshotIntervalMs)&&void 0!==n?n:l.fullSnapshotIntervalMs,maskAllInputs:null!==(s=this.U.maskAllInputs)&&void 0!==s?s:l.maskAllInputs,captureConsole:null!==(o=this.U.captureConsole)&&void 0!==o?o:l.captureConsole,captureCanvas:null!==(a=this.U.captureCanvas)&&void 0!==a?a:l.captureCanvas}),this.startIfEnabledOrStop("remote_config")}}get started(){return this.isStarted}get status(){var t;return(null===(t=this.dt)||void 0===t?void 0:t.status)||"lazy_loading"}get sessionId(){var t;return(null===(t=this.dt)||void 0===t?void 0:t.sessionId)||""}stopRecording(){this.stop()}log(t,i){var e;void 0===i&&(i="log"),(null===(e=this.dt)||void 0===e?void 0:e.log)?this.dt.log(t,i):console.warn(ae+" log called before recorder was ready")}updateConfig(t){var i;this.U=v({},this.U,t),null===(i=this.dt)||void 0===i||i.updateConfig(this.U)}get ct(){return"recorder"}vt(t){var i,e,r,n;if(this.isEnabled)if((null===(e=null===(i=null==l?void 0:l.__VTiltExtensions__)||void 0===i?void 0:i.rrweb)||void 0===e?void 0:e.record)&&(null===(r=l.__VTiltExtensions__)||void 0===r?void 0:r.initSessionRecording))this.ft(t);else{var s=null===(n=l.__VTiltExtensions__)||void 0===n?void 0:n.loadExternalDependency;s?s(this._instance,this.ct,i=>{i?console.error(ae+" could not load recorder:",i):this.ft(t)}):console.error(ae+" loadExternalDependency not available. Session recording cannot start.")}}ft(t){var i,e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.initSessionRecording;e?(this.dt||(this.dt=e(this._instance,this.U)),this.dt.start(t)):console.error(ae+" initSessionRecording not available after script load")}}var ue=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ue||{}),he=Uint8Array,de=Uint16Array,ve=Int32Array,ce=new he([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]),fe=new he([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]),pe=new he([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ge=function(t,i){for(var e=new de(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var n=new ve(e[30]);for(r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)n[s]=s-e[r]<<5|r;return{b:e,r:n}},_e=ge(ce,2),me=_e.b,be=_e.r;me[28]=258,be[258]=28;for(var ye=ge(fe,0).r,we=new de(32768),Se=0;Se<32768;++Se){var xe=(43690&Se)>>1|(21845&Se)<<1;xe=(61680&(xe=(52428&xe)>>2|(13107&xe)<<2))>>4|(3855&xe)<<4,we[Se]=((65280&xe)>>8|(255&xe)<<8)>>1}var Ce=function(t,i,e){for(var r=t.length,n=0,s=new de(i);n<r;++n)t[n]&&++s[t[n]-1];var o,a=new de(i);for(n=1;n<i;++n)a[n]=a[n-1]+s[n-1]<<1;if(e){o=new de(1<<i);var l=15-i;for(n=0;n<r;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],d=a[t[n]-1]++<<h,v=d|(1<<h)-1;d<=v;++d)o[we[d]>>l]=u}else for(o=new de(r),n=0;n<r;++n)t[n]&&(o[n]=we[a[t[n]-1]++]>>15-t[n]);return o},ke=new he(288);for(Se=0;Se<144;++Se)ke[Se]=8;for(Se=144;Se<256;++Se)ke[Se]=9;for(Se=256;Se<280;++Se)ke[Se]=7;for(Se=280;Se<288;++Se)ke[Se]=8;var Ee=new he(32);for(Se=0;Se<32;++Se)Ee[Se]=5;var Te=Ce(ke,9,0),Ie=Ce(Ee,5,0),$e=function(t){return(t+7)/8|0},Me=function(t,i,e){return(null==e||e>t.length)&&(e=t.length),new he(t.subarray(i,e))},Re=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8},Ae=function(t,i,e){e<<=7&i;var r=i/8|0;t[r]|=e,t[r+1]|=e>>8,t[r+2]|=e>>16},Oe=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var n=e.length,s=e.slice();if(!n)return{t:Ne,l:0};if(1==n){var o=new he(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=n-1;)a=e[e[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=s[0].s;for(r=1;r<n;++r)s[r].s>v&&(v=s[r].s);var c=new de(v+1),f=Pe(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(s.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});r<n;++r){var m=s[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>=g;p>0;){var b=s[r].s;c[b]<i?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=s[r].s;c[y]==i&&(--c[y],++p)}f=i}return{t:new he(c),l:f}},Pe=function(t,i,e){return-1==t.s?Math.max(Pe(t.l,i,e+1),Pe(t.r,i,e+1)):i[t.s]=e},Le=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new de(++i),r=0,n=t[0],s=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==n&&a!=i)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return{c:e.subarray(0,r),n:i}},Ue=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},De=function(t,i,e){var r=e.length,n=$e(i+2);t[n]=255&r,t[n+1]=r>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;s<r;++s)t[n+s+4]=e[s];return 8*(n+4+r)},je=function(t,i,e,r,n,s,o,a,l,u,h){Re(i,h++,e),++n[256];for(var d=Oe(n,15),v=d.t,c=d.l,f=Oe(s,15),p=f.t,g=f.l,_=Le(v),m=_.c,b=_.n,y=Le(p),w=y.c,S=y.n,x=new de(19),C=0;C<m.length;++C)++x[31&m[C]];for(C=0;C<w.length;++C)++x[31&w[C]];for(var k=Oe(x,7),E=k.t,T=k.l,I=19;I>4&&!E[pe[I-1]];--I);var M,R,A,O,P=u+5<<3,L=Ue(n,ke)+Ue(s,Ee)+o,U=Ue(n,v)+Ue(s,p)+o+14+3*I+Ue(x,E)+2*x[16]+3*x[17]+7*x[18];if(l>=0&&P<=L&&P<=U)return De(i,h,t.subarray(l,l+u));if(Re(i,h,1+(U<L)),h+=2,U<L){M=Ce(v,c,0),R=v,A=Ce(p,g,0),O=p;var D=Ce(E,T,0);Re(i,h,b-257),Re(i,h+5,S-1),Re(i,h+10,I-4),h+=14;for(C=0;C<I;++C)Re(i,h+3*C,E[pe[C]]);h+=3*I;for(var j=[m,w],B=0;B<2;++B){var N=j[B];for(C=0;C<N.length;++C){var z=31&N[C];Re(i,h,D[z]),h+=E[z],z>15&&(Re(i,h,N[C]>>5&127),h+=N[C]>>12)}}}else M=Te,R=ke,A=Ie,O=Ee;for(C=0;C<a;++C){var q=r[C];if(q>255){Ae(i,h,M[(z=q>>18&31)+257]),h+=R[z+257],z>7&&(Re(i,h,q>>23&31),h+=ce[z]);var F=31&q;Ae(i,h,A[F]),h+=O[F],F>3&&(Ae(i,h,q>>5&8191),h+=fe[F])}else Ae(i,h,M[q]),h+=R[q]}return Ae(i,h,M[256]),h+R[256]},Be=new ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ne=new he(0),ze=function(){for(var t=new Int32Array(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&-306674912)^e>>>1;t[i]=e}return t}(),qe=function(t,i,e,r,n){if(!n&&(n={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),o=new he(s.length+t.length);o.set(s),o.set(t,s.length),t=o,n.w=s.length}return function(t,i,e,r,n,s){var o=s.z||t.length,a=new he(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),u=s.l,h=7&(s.r||0);if(i){h&&(l[0]=s.r>>3);for(var d=Be[i-1],v=d>>13,c=8191&d,f=(1<<e)-1,p=s.p||new de(32768),g=s.h||new de(f+1),_=Math.ceil(e/3),m=2*_,b=function(i){return(t[i]^t[i+1]<<_^t[i+2]<<m)&f},y=new ve(25e3),w=new de(288),S=new de(32),x=0,C=0,k=s.i||0,E=0,T=s.w||0,I=0;k+2<o;++k){var M=b(k),R=32767&k,A=g[M];if(p[R]=A,g[M]=R,T<=k){var O=o-k;if((x>7e3||E>24576)&&(O>423||!u)){h=je(t,l,0,y,w,S,C,E,I,k-I,h),E=x=C=0,I=k;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var L=2,U=0,D=c,j=R-A&32767;if(O>2&&M==b(k-j))for(var B=Math.min(v,O)-1,N=Math.min(32767,k),z=Math.min(258,O);j<=N&&--D&&R!=A;){if(t[k+L]==t[k+L-j]){for(var q=0;q<z&&t[k+q]==t[k+q-j];++q);if(q>L){if(L=q,U=j,q>B)break;var F=Math.min(j,q-2),V=0;for(P=0;P<F;++P){var W=k-j+P&32767,J=W-p[W]&32767;J>V&&(V=J,A=W)}}}j+=(R=A)-(A=p[R])&32767}if(U){y[E++]=268435456|be[L]<<18|ye[U];var H=31&be[L],X=31&ye[U];C+=ce[H]+fe[X],++w[257+H],++S[X],T=k+L,++x}else y[E++]=t[k],++w[t[k]]}}for(k=Math.max(k,T);k<o;++k)y[E++]=t[k],++w[t[k]];h=je(t,l,u,y,w,S,C,E,I,k-I,h),u||(s.r=7&h|l[h/8|0]<<3,h-=7,s.h=g,s.p=p,s.i=k,s.w=T)}else{for(k=s.w||0;k<o+u;k+=65535){var K=k+65535;K>=o&&(l[h/8|0]=u,K=o),h=De(l,h+1,t.subarray(k,K))}s.i=o}return Me(a,0,r+$e(h)+n)}(t,null==i.level?6:i.level,null==i.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+i.mem,e,r,n)},Fe=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ve(t,i){i||(i={});var e=function(){var t=-1;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=ze[255&e^i[r]]^e>>>8;t=e},d:function(){return~t}}}(),r=t.length;e.p(t);var n,s=qe(t,i,10+((n=i).filename?n.filename.length+1:0),8),o=s.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Fe(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(s,i),Fe(s,o-8,e.d()),Fe(s,o-4,r),s}var We="undefined"!=typeof TextEncoder&&new TextEncoder,Je="undefined"!=typeof TextDecoder&&new TextDecoder;try{Je.decode(Ne,{stream:!0})}catch(t){}ue.MouseMove,ue.MouseInteraction,ue.Scroll,ue.ViewportResize,ue.Input,ue.TouchMove,ue.MediaInteraction,ue.Drag;var He="[Chat]";class Xe{constructor(t,i){this._instance=t,this.name="Chat",this.gt=null,this._t=!1,this.bt=!1,this.O=!1,this.yt=null,this.wt=[],this.St=[],this.xt=[],this.Ct=[],this.kt=[],this.U=i||Xe.extractConfig(t.getConfig())}static extractConfig(t){var i,e=t.chat||{};return{enabled:e.enabled,autoConfig:null===(i=e.autoConfig)||void 0===i||i,position:e.position,greeting:e.greeting,color:e.color,aiMode:e.aiMode,aiGreeting:e.aiGreeting,preload:e.preload,offlineMessage:e.offlineMessage,collectEmailOffline:e.collectEmailOffline}}get isEnabled(){var t;return!1!==this.U.enabled&&(!0===this.U.enabled||!this._instance.getConfig().disable_chat&&!0===(null===(t=this.gt)||void 0===t?void 0:t.enabled))}get isStarted(){return this.O}startIfEnabled(){this.Et().catch(t=>{console.error(He+" Error starting:",t)})}stop(){this.destroy(),this.O=!1}onConfigUpdate(t){var i,e;this.U=Xe.extractConfig(t),this.Tt&&(null===(e=(i=this.Tt).updateConfig)||void 0===e||e.call(i,this.getMergedConfig()))}onRemoteConfig(t){var i,e,r,n,s,o,a,l,u;t.chat&&(this.gt=v({},this.gt,{enabled:null!==(r=null!==(i=t.chat.enabled)&&void 0!==i?i:null===(e=this.gt)||void 0===e?void 0:e.enabled)&&void 0!==r&&r,position:null!==(o=null!==(n=t.chat.widgetPosition)&&void 0!==n?n:null===(s=this.gt)||void 0===s?void 0:s.position)&&void 0!==o?o:"bottom-right",color:null!==(u=null!==(a=t.chat.widgetColor)&&void 0!==a?a:null===(l=this.gt)||void 0===l?void 0:l.color)&&void 0!==u?u:"#6366f1"}),this.isEnabled&&!this.O&&this.startIfEnabled())}Et(){var t=this;return d(function*(){var i,e,r,n;!1!==t.U.enabled?t._instance.getConfig().disable_chat?console.info(He+" disabled by disable_chat config"):(!1!==t.U.autoConfig&&(yield t.It()),t.isEnabled?(t.O=!0,null!==(r=null!==(i=t.U.preload)&&void 0!==i?i:null===(e=t.gt)||void 0===e?void 0:e.enabled)&&void 0!==r&&r&&t.$t(),(null===(n=t.gt)||void 0===n?void 0:n.enabled)&&t.Mt(),console.info(He+" ready (lazy-load on demand)")):console.info(He+" not enabled (check dashboard settings)")):console.info(He+" disabled by code config")})()}get isOpen(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isOpen)&&void 0!==i&&i}get isConnected(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isConnected)&&void 0!==i&&i}get isLoading(){var t,i;return this.bt||null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.isLoading)&&void 0!==i&&i}get unreadCount(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.unreadCount)&&void 0!==i?i:0}get channel(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.channel)&&void 0!==i?i:null}get channels(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.channels)&&void 0!==i?i:[]}get currentView(){var t,i;return null!==(i=null===(t=this.Tt)||void 0===t?void 0:t.currentView)&&void 0!==i?i:"list"}open(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.open()})}close(){var t;null===(t=this.Tt)||void 0===t||t.close()}toggle(){this.Tt?this.Tt.toggle():this.open()}show(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.show()})}hide(){var t;null===(t=this.Tt)||void 0===t||t.hide()}getChannels(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.getChannels()})}selectChannel(t){this.Rt(()=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.selectChannel(t)})}createChannel(){this.Rt(()=>{var t;return null===(t=this.Tt)||void 0===t?void 0:t.createChannel()})}goToChannelList(){var t;null===(t=this.Tt)||void 0===t||t.goToChannelList()}sendMessage(t){this.Tt?this.Tt.sendMessage(t):(this.wt.push(t),this.Rt(()=>{this.wt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.sendMessage(t)}),this.wt=[]}))}markAsRead(){var t;null===(t=this.Tt)||void 0===t||t.markAsRead()}onMessage(t){return this.xt.push(t),this.Tt?this.Tt.onMessage(t):()=>{var i=this.xt.indexOf(t);i>-1&&this.xt.splice(i,1)}}onTyping(t){return this.Ct.push(t),this.Tt?this.Tt.onTyping(t):()=>{var i=this.Ct.indexOf(t);i>-1&&this.Ct.splice(i,1)}}onConnectionChange(t){return this.kt.push(t),this.Tt?this.Tt.onConnectionChange(t):()=>{var i=this.kt.indexOf(t);i>-1&&this.kt.splice(i,1)}}updateConfig(t){this.U=v({},this.U,t)}getMergedConfig(){var t,i,e,r,n,s,o,a,l,u,h,d,v,c,f,p,g,_,m=this.gt,b=this.U;return{enabled:null!==(i=null!==(t=b.enabled)&&void 0!==t?t:null==m?void 0:m.enabled)&&void 0!==i&&i,autoConfig:null===(e=b.autoConfig)||void 0===e||e,position:null!==(n=null!==(r=b.position)&&void 0!==r?r:null==m?void 0:m.position)&&void 0!==n?n:"bottom-right",greeting:null!==(s=b.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(a=null!==(o=b.color)&&void 0!==o?o:null==m?void 0:m.color)&&void 0!==a?a:"#6366f1",aiMode:null===(u=null!==(l=b.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===u||u,aiGreeting:null!==(h=b.aiGreeting)&&void 0!==h?h:null==m?void 0:m.ai_greeting,preload:null!==(d=b.preload)&&void 0!==d&&d,theme:null!==(v=b.theme)&&void 0!==v?v:{primaryColor:null!==(f=null!==(c=b.color)&&void 0!==c?c:null==m?void 0:m.color)&&void 0!==f?f:"#6366f1"},offlineMessage:null!==(p=b.offlineMessage)&&void 0!==p?p:null==m?void 0:m.offline_message,collectEmailOffline:null===(_=null!==(g=b.collectEmailOffline)&&void 0!==g?g:null==m?void 0:m.collect_email_offline)||void 0===_||_}}destroy(){M(()=>{var i,e;null===(i=this.Tt)||void 0===i||i.destroy(),this.Tt=void 0,this.wt=[],this.St=[],this.xt=[],this.Ct=[],this.kt=[];var r=null===(e=null==t?void 0:t.document)||void 0===e?void 0:e.getElementById("vtilt-chat-bubble");r&&r.remove()})}It(){var t=this;return d(function*(){if(!t._t){var i=t._instance.getConfig(),e=i.token,r=i.api_host;if(!e||!r)return console.warn(He+" Cannot fetch settings: missing token or api_host"),void(t._t=!0);try{var n=r+"/api/chat/settings?token="+encodeURIComponent(e),s=yield fetch(n);if(!s.ok)return console.warn(He+" Failed to fetch settings: "+s.status),void(t._t=!0);t.gt=yield s.json(),t._t=!0,console.info(He+" Loaded settings from dashboard")}catch(i){console.warn(He+" Error fetching settings:",i),t._t=!0}}})()}Mt(){if((null==t?void 0:t.document)&&!document.getElementById("vtilt-chat-bubble")){var i=this.getMergedConfig(),e=i.position||"bottom-right",r=i.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===e?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+r+";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s, box-shadow 0.2s;\n z-index: 999999;\n ").trim()),n.innerHTML='\n <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>\n </svg>\n ',n.addEventListener("mouseenter",()=>{n.style.transform="scale(1.05)",n.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),n.addEventListener("mouseleave",()=>{n.style.transform="scale(1)",n.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),n.addEventListener("click",()=>{this.open()}),document.body.appendChild(n)}}get ct(){return"chat"}$t(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this.At(),{timeout:5e3}):setTimeout(()=>this.At(),3e3)}Rt(t){this.Tt?t():(this.St.push(t),this.At())}At(){var t,i;if(!(this.bt||this.Tt||this.yt))if(null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat)this.ft();else{this.bt=!0;var e=null===(i=l.__VTiltExtensions__)||void 0===i?void 0:i.loadExternalDependency;if(!e)return console.error(He+" loadExternalDependency not available. Chat cannot start."),this.bt=!1,void(this.yt="loadExternalDependency not available");e(this._instance,this.ct,t=>{if(this.bt=!1,t)return console.error(He+" Failed to load:",t),void(this.yt=String(t));this.ft()})}}ft(){var t,i=null===(t=l.__VTiltExtensions__)||void 0===t?void 0:t.initChat;if(!i)return console.error(He+" initChat not available after script load"),void(this.yt="initChat not available");if(!this.Tt){var e=this.getMergedConfig();this.Tt=i(this._instance,e),this.xt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onMessage(t)}),this.Ct.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onTyping(t)}),this.kt.forEach(t=>{var i;return null===(i=this.Tt)||void 0===i?void 0:i.onConnectionChange(t)});var r=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");r&&r.remove()}this.St.forEach(t=>t()),this.St=[],console.info(He+" loaded and ready")}}var Ke,Ge="text/plain";!function(t){t.GZipJS="gzip-js",t.None="none"}(Ke||(Ke={}));var Qe=t=>{var{data:i,compression:e}=t;if(i){var r=(t=>JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i))(i),n=new Blob([r]).size;if(e===Ke.GZipJS&&n>=1024)try{var s=Ve(function(t,i){if(We)return We.encode(t);for(var e=t.length,r=new he(t.length+(t.length>>1)),n=0,s=function(t){r[n++]=t},o=0;o<e;++o){if(n+5>r.length){var a=new he(n+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return Me(r,0,n)}(r),{mtime:0}),o=new Blob([s],{type:Ge});if(o.size<.95*n)return{contentType:Ge,body:o,estimatedSize:o.size}}catch(t){}return{contentType:"application/json",body:r,estimatedSize:n}}},Ze=[{name:"fetch",available:"undefined"!=typeof fetch,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r,estimatedSize:n}=i,s=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,o=v({"Content-Type":e},t.headers||{}),a=new AbortController,l=t.timeout?setTimeout(()=>a.abort(),t.timeout):null;fetch(s,{method:t.method||"POST",headers:o,body:r,keepalive:n<52428.8,signal:a.signal}).then(function(){var i=d(function*(i){var e,r=yield i.text(),n={statusCode:i.status,text:r};if(200===i.status)try{n.json=JSON.parse(r)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)});return function(t){return i.apply(this,arguments)}}()).catch(()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})}).finally(()=>{l&&clearTimeout(l)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r}=i,n=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url,s=new XMLHttpRequest;s.open(t.method||"POST",n,!0),t.headers&&Object.entries(t.headers).forEach(t=>{var[i,e]=t;s.setRequestHeader(i,e)}),s.setRequestHeader("Content-Type",e),t.timeout&&(s.timeout=t.timeout),s.onreadystatechange=()=>{var i;if(4===s.readyState){var e={statusCode:s.status,text:s.responseText};if(200===s.status)try{e.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,e)}},s.onerror=()=>{var i;null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:t=>{var i=Qe(t);if(i){var{contentType:e,body:r}=i;try{var n="string"==typeof r?new Blob([r],{type:e}):r,s=t.compression===Ke.GZipJS&&e===Ge?t.url+(t.url.includes("?")?"&":"?")+"compression=gzip-js":t.url;navigator.sendBeacon(s,n)}catch(t){}}}}],Ye=t=>{var i,e=t.transport||"fetch",r=Ze.find(t=>t.name===e&&t.available)||Ze.find(t=>t.available);if(!r)return console.error("vTilt: No available transport method"),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0}));r.method(t)};class tr{constructor(t,i){var e,r,n,s;this.Ot=!0,this.Pt=[],this.Lt=(e=(null==i?void 0:i.flush_interval_ms)||3e3,r=250,n=5e3,s=3e3,"number"!=typeof e||isNaN(e)?s:Math.min(Math.max(e,r),n)),this.Ut=t}get length(){return this.Pt.length}enqueue(t){this.Pt.push(t),this.Dt||this.jt()}unload(){if(this.Bt(),0!==this.Pt.length){var t=this.Nt();for(var i in t){var e=t[i];this.Ut(v({},e,{transport:"sendBeacon"}))}}}enable(){this.Ot=!1,this.jt()}pause(){this.Ot=!0,this.Bt()}flush(){this.Bt(),this.zt(),this.jt()}jt(){this.Ot||(this.Dt=setTimeout(()=>{this.Bt(),this.zt(),this.Pt.length>0&&this.jt()},this.Lt))}Bt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0)}zt(){if(0!==this.Pt.length){var t=this.Nt(),i=Date.now();for(var e in t){var r=t[e];r.events.forEach(t=>{var e=new Date(t.timestamp).getTime();t.$offset=Math.abs(e-i)}),this.Ut(r)}}}Nt(){var t={};return this.Pt.forEach(i=>{var e=i.batchKey||i.url;t[e]||(t[e]={url:i.url,events:[],batchKey:i.batchKey}),t[e].events.push(i.event)}),this.Pt=[],t}}class ir{constructor(i){this.qt=!1,this.Ft=3e3,this.Pt=[],this.Vt=!0,this.Ut=i.sendRequest,this.Wt=i.sendBeacon,t&&void 0!==e&&"onLine"in e&&(this.Vt=e.onLine,F(t,"online",()=>{this.Vt=!0,this.N()}),F(t,"offline",()=>{this.Vt=!1}))}get length(){return this.Pt.length}enqueue(t,i){if(void 0===i&&(i=0),i>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),n=(Math.random()-.5)*(r-e);return Math.ceil(r+n)}(i),r=Date.now()+e;this.Pt.push({retryAt:r,request:t,retriesPerformedSoFar:i+1});var n="VTilt: Enqueued failed request for retry in "+Math.round(e/1e3)+"s";this.Vt||(n+=" (Browser is offline)"),console.warn(n),this.qt||(this.qt=!0,this.Jt())}}retriableRequest(t){var i=this;return d(function*(){try{var e=yield i.Ut(t);200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&i.enqueue(t,0)}catch(e){i.enqueue(t,0)}})()}Jt(){this.Ht&&clearTimeout(this.Ht),this.Ht=setTimeout(()=>{this.Vt&&this.Pt.length>0&&this.N(),this.Pt.length>0?this.Jt():this.qt=!1},this.Ft)}N(){var t=this,i=Date.now(),e=[],r=[];this.Pt.forEach(t=>{t.retryAt<i?r.push(t):e.push(t)}),this.Pt=e,r.forEach(function(){var i=d(function*(i){var{request:e,retriesPerformedSoFar:r}=i;try{var n=yield t.Ut(e);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&t.enqueue(e,r)}catch(i){t.enqueue(e,r)}});return function(t){return i.apply(this,arguments)}}())}unload(){this.Ht&&(clearTimeout(this.Ht),this.Ht=void 0),this.Pt.forEach(t=>{var{request:i}=t;try{this.Wt(i)}catch(t){console.error("VTilt: Failed to send beacon on unload",t)}}),this.Pt=[]}}var er="vt_rate_limit";class rr{constructor(t){var i,e;void 0===t&&(t={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(i=t.eventsPerSecond)&&void 0!==i?i:10,this.eventsBurstLimit=Math.max(null!==(e=t.eventsBurstLimit)&&void 0!==e?e:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=t.persistence,this.captureWarning=t.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(t){var i,e,r,n;void 0===t&&(t=!1);var s=Date.now(),o=null!==(e=null===(i=this.persistence)||void 0===i?void 0:i.get(er))&&void 0!==e?e:{tokens:this.eventsBurstLimit,last:s},a=(s-o.last)/1e3;o.tokens+=a*this.eventsPerSecond,o.last=s,o.tokens>this.eventsBurstLimit&&(o.tokens=this.eventsBurstLimit);var l=o.tokens<1;return l||t||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||t||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(n=this.persistence)||void 0===n||n.set(er,o),{isRateLimited:l,remainingTokens:o.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class nr{constructor(t){this.Xt=null,this.Kt=t}get config(){return this.Xt}onApply(t){this.Gt=t}onLoad(t){this.Qt=t}load(){var i,e=this.Kt.getConfig();if(e.projectId){if(null===(i=e.bootstrap)||void 0===i?void 0:i.remoteConfig)return this.Xt=e.bootstrap.remoteConfig,this.Zt(this.Xt),void this.Yt();var r=M(()=>t.__VTILT_BOOTSTRAP__);if(null==r?void 0:r.remoteConfig)return this.Xt=r.remoteConfig,this.Zt(this.Xt),void this.Yt();M(()=>{var t=localStorage.getItem(y+"_"+e.projectId);t&&(this.Xt=JSON.parse(t),this.Zt(this.Xt))}),this.Yt()}}Yt(){var t=this.Kt.getConfig();if(t.projectId&&t.api_host){var i=t.api_host+"/api/projects/"+t.projectId+"/decide",e=new AbortController,r=setTimeout(()=>e.abort(),3e3);(s||fetch)(i,{method:"GET",signal:e.signal,headers:{Accept:"application/json"}}).then(t=>t.json()).then(i=>{var e;clearTimeout(r),this.Xt=i,M(()=>{localStorage.setItem(y+"_"+t.projectId,JSON.stringify(i))}),this.Zt(i),null===(e=this.Qt)||void 0===e||e.call(this,i)}).catch(()=>{clearTimeout(r)})}}Zt(t){var i,e,r,n,s,o,a,l,u,h=this.Kt.getConfig(),d={},v=!1,c=!1,f=!1;t.sessionRecording&&void 0===h.session_recording&&(d.session_recording={enabled:t.sessionRecording.enabled,sampleRate:t.sessionRecording.sampleRate,minimumDurationMs:t.sessionRecording.minimumDurationMs,fullSnapshotIntervalMs:t.sessionRecording.fullSnapshotIntervalMs,maskAllInputs:t.sessionRecording.maskAllInputs,captureConsole:t.sessionRecording.captureConsole,captureCanvas:t.sessionRecording.captureCanvas},t.sessionRecording.enabled&&(v=!0)),(null===(i=t.chat)||void 0===i?void 0:i.enabled)&&void 0===h.chat&&(d.chat={enabled:t.chat.enabled,position:t.chat.widgetPosition,color:t.chat.widgetColor},c=!0),t.analytics&&(void 0!==t.analytics.capturePageview&&void 0===h.capture_pageview&&(d.capture_pageview=t.analytics.capturePageview),void 0!==t.analytics.capturePageleave&&void 0===h.capture_pageleave&&(d.capture_pageleave=!!t.analytics.capturePageleave),void 0!==t.analytics.capturePerformance&&void 0===h.capture_performance&&(d.capture_performance=t.analytics.capturePerformance),void 0!==t.analytics.autocapture&&void 0===h.autocapture&&(d.autocapture=t.analytics.autocapture,t.analytics.autocapture&&(f=!0))),void 0!==(null===(e=t.privacy)||void 0===e?void 0:e.respectDnt)&&void 0===h.respect_dnt&&(d.respect_dnt=t.privacy.respectDnt),Object.keys(d).length>0&&this.Kt.updateConfig(d),null===(r=this.Gt)||void 0===r||r.call(this,t),this.Kt.__loaded&&(v&&(null===(s=(n=this.Kt).startSessionRecording)||void 0===s||s.call(n)),c&&(null===(a=(o=this.Kt).ti)||void 0===a||a.call(o)),f&&(null===(u=(l=this.Kt).startAutocapture)||void 0===u||u.call(l)))}}class sr{constructor(t){this.ii=!1,this.ei=!1,this.ri=null,this.ni=null,this.Kt=t}setVtPersonUuid(t){this.ni=t}capture(t,i,r){var n;if(this.Kt.sessionManager.setSessionId(),(null==e?void 0:e.userAgent)&&function(t){return!(t&&"string"==typeof t&&t.length>500)}(e.userAgent)&&((null==r?void 0:r.skip_client_rate_limiting)||this.Kt.rateLimiter.shouldAllowEvent())){var s,o=this.Kt.buildUrl(),a=this.Kt.getConfig(),l=this.si(t,i);if(!1!==a.stringifyPayload){if(!z(s=JSON.stringify(v({},l,a.globalAttributes))))return}else if(s=v({},l,a.globalAttributes),!z(JSON.stringify(s)))return;var u="$identify"===t?this.Kt.userManager.getAnonymousId():null!==(n=this.Kt.userManager.getDistinctId())&&void 0!==n?n:this.Kt.userManager.getAnonymousId(),h={timestamp:(new Date).toISOString(),event:t,project_id:a.projectId||"",payload:s,distinct_id:u,anonymous_id:this.Kt.userManager.getAnonymousId()};this.Kt.sendRequest(o,h,!0)}}captureInternal(t,i){this.capture(t,i,{skip_client_rate_limiting:!0})}trackEvent(t,i){void 0===i&&(i={}),this.capture(t,i)}captureInitialPageview(){r&&("visible"===r.visibilityState?this.ei||(this.ei=!0,setTimeout(()=>{r&&n&&this.capture("$pageview",{navigation_type:"initial_load"})},300),this.ri&&(r.removeEventListener("visibilitychange",this.ri),this.ri=null)):this.ri||(this.ri=()=>this.captureInitialPageview(),F(r,"visibilitychange",this.ri)))}si(t,i){var e=hi(),n=this.Kt.userManager.getUserProperties(),s=this.Kt.userManager.get_initial_props(),o=this.Kt.sessionManager.getSessionId(),a=this.Kt.sessionManager.getWindowId(),l=this.Kt.userManager.getAnonymousId(),u={};!this.ii&&Object.keys(s).length>0&&Object.assign(u,s),i.$set_once&&Object.assign(u,i.$set_once);var h=v({},e,n,{$session_id:o,$window_id:a},l?{$anon_distinct_id:l}:{},this.ni?{$vt:this.ni}:{},Object.keys(u).length>0?{$set_once:u}:{},i.$set?{$set:i.$set}:{},i);return!this.ii&&Object.keys(s).length>0&&(this.ii=!0),"$pageview"===t&&r&&(h.title=r.title),h}}class or{constructor(t){this.Kt=t}identify(t,i,e){var r;if("number"==typeof t&&(t=String(t),console.warn("identify: first argument should be a string, not a number")),t)if(this.Kt.userManager.isDistinctIdStringLikePublic(t))console.error('identify: "'+t+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==t){var n=this.Kt.userManager.getDistinctId(),s=this.Kt.userManager.getAnonymousId(),o=this.Kt.userManager.getDeviceId(),a="anonymous"===this.Kt.userManager.getUserState();o||this.Kt.userManager.ensureDeviceId(n||s),t!==n&&a?(this.Kt.userManager.setUserState("identified"),this.Kt.userManager.updateUserProperties(i,e),this.Kt.capture("$identify",{distinct_id:t,$anon_distinct_id:s,$set:i||{},$set_once:e||{}}),this.Kt.userManager.setDistinctId(t),null===(r=this.Kt.oi)||void 0===r||r.emit("user:identified",{distinctId:t})):i||e?(a&&this.Kt.userManager.setUserState("identified"),this.Kt.userManager.updateUserProperties(i,e),this.Kt.capture("$set",{$set:i||{},$set_once:e||{}})):t!==n&&(this.Kt.userManager.setUserState("identified"),this.Kt.userManager.setDistinctId(t))}else console.error("identify: cannot use sentinel value as distinct_id");else console.error("identify: unique user id is required")}setUserProperties(t,i){var e;this.Kt.userManager.setUserProperties(t,i)&&(this.Kt.capture("$set",{$set:t||{},$set_once:i||{}}),null===(e=this.Kt.oi)||void 0===e||e.emit("user:properties_set",{properties:t}))}resetUser(t){var i;this.Kt.sessionManager.resetSessionId(),this.Kt.userManager.reset(t),null===(i=this.Kt.oi)||void 0===i||i.emit("user:reset")}createAlias(t,i){var e=this.Kt.userManager.createAlias(t,i);e?this.Kt.capture("$alias",{$original_id:e.original,$alias_id:e.distinct_id}):t===(i||this.Kt.userManager.getDistinctId()||this.Kt.userManager.getAnonymousId())&&this.identify(t)}getUserIdentity(){return this.Kt.userManager.getUserIdentity()}getDeviceId(){return this.Kt.userManager.getDeviceId()}getUserState(){return this.Kt.userManager.getUserState()}getDistinctId(){var t;return null!==(t=this.Kt.userManager.getDistinctId())&&void 0!==t?t:this.Kt.userManager.getAnonymousId()}getAnonymousId(){return this.Kt.userManager.getAnonymousId()}}class ar{constructor(t){this.ai=new Map,this.Kt=t}onFeatureStarted(t){this.li=t}onFeatureStopped(t){this.ui=t}register(t){this.ai.set(t.name,t)}get(t){var i;return null===(i=this.ai.get(t))||void 0===i?void 0:i.instance}initAll(){this.ai.forEach(t=>{this.hi(t)})}init(t){var i=this.ai.get(t);if(i)return this.hi(i),i.instance}start(t){var i,e=this.ai.get(t);if(e&&(e.instance||this.hi(e),e.instance)){if(e.instance.onConfigUpdate){var r=this.Kt.getConfig();e.instance.onConfigUpdate(r)}e.instance.startIfEnabled(),null===(i=this.li)||void 0===i||i.call(this,t)}}stop(t){var i,e=this.ai.get(t);(null==e?void 0:e.instance)&&(e.instance.stop(),null===(i=this.ui)||void 0===i||i.call(this,t))}isActive(t){var i,e,r;return null!==(r=null===(e=null===(i=this.ai.get(t))||void 0===i?void 0:i.instance)||void 0===e?void 0:e.isStarted)&&void 0!==r&&r}notifyConfigUpdate(t){this.ai.forEach(i=>{var e;(null===(e=i.instance)||void 0===e?void 0:e.onConfigUpdate)&&M(()=>i.instance.onConfigUpdate(t))})}notifyRemoteConfig(t){this.ai.forEach(i=>{var e;(null===(e=i.instance)||void 0===e?void 0:e.onRemoteConfig)&&M(()=>i.instance.onRemoteConfig(t))})}getAll(){var t=[];return this.ai.forEach(i=>{i.instance&&t.push(i.instance)}),t}hi(t){if(!t.instance){var i=this.Kt.getConfig();t.disableKey&&i[t.disableKey]||t.enableKey&&!1===i[t.enableKey]||M(()=>{var i;t.instance=new t.FeatureClass(this.Kt),t.instance.startIfEnabled(),t.instance.isStarted&&(null===(i=this.li)||void 0===i||i.call(this,t.name))})}}}var lr="vt";class ur{constructor(t){void 0===t&&(t={}),this.version=c,this.__loaded=!1,this.__request_queue=[],this.di=!1,this.oi=new R,this.configManager=new I(t);var i=this.configManager.getConfig();this.sessionManager=new Q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new di(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.rateLimiter=new rr({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:t=>{this.ci.captureInternal("$$client_ingestion_warning",{$$client_ingestion_warning_message:t})}}),this.retryQueue=new ir({sendRequest:t=>this.fi(t),sendBeacon:t=>this.pi(t)}),this.requestQueue=new tr(t=>this.gi(t),{flush_interval_ms:3e3}),this.ci=new sr(this),this.mi=new or(this),this.bi=new nr(this),this.yi=new ar(this),this.bi.onApply(t=>{this.yi.notifyRemoteConfig(t)}),this.bi.onLoad(t=>{this.oi.emit(P,{config:t})}),this.yi.onFeatureStarted(t=>{this.oi.emit(L,{feature:t})}),this.yi.onFeatureStopped(t=>{this.oi.emit(U,{feature:t})})}init(t,i,e){var r;if(e&&e!==lr){var n=null!==(r=hr[e])&&void 0!==r?r:new ur;return n._init(t,i,e),hr[e]=n,hr[lr][e]=n,n}return this._init(t,i,e)}_init(t,i,e){if(void 0===i&&(i={}),this.__loaded)return console.warn("vTilt: Already initialized! Re-initializing is a no-op"),this;this.updateConfig(v({},i,{projectId:t||i.projectId,name:e})),this.__loaded=!0,this.wi(),this.bi.load();var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this.Si(),this.xi(),this.Ci(),!1!==r.capture_pageview&&this.ci.captureInitialPageview(),this.oi.emit(A,{config:r}),this}Si(){this.ki(),this.Ei(),this.Ti(),this.Ii(),this.ti()}ki(){this.historyAutocapture||(this.historyAutocapture=new mi(this),this.historyAutocapture.startIfEnabled())}Ei(){this.autocapture||!1!==this.configManager.getConfig().autocapture&&(this.autocapture=new oe(this),this.autocapture.startIfEnabled())}Ti(){this.webVitals||(this.webVitals=new gi(this),this.webVitals.startIfEnabled())}Ii(){this.sessionRecording||(this.configManager.getConfig().disable_session_recording||(this.sessionRecording=new le(this),this.sessionRecording.isEnabled&&(this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this.oi.emit(j))))}ti(){this.chat||(this.configManager.getConfig().disable_chat||(this.chat=new Xe(this),this.chat.startIfEnabled()))}startAutocapture(){this.autocapture||(this.autocapture=new oe(this)),this.autocapture.updateConfig({enabled:!0}),this.autocapture.startIfEnabled()}stopAutocapture(){var t;null===(t=this.autocapture)||void 0===t||t.stop()}isAutocaptureActive(){var t,i;return null!==(i=null===(t=this.autocapture)||void 0===t?void 0:t.isStarted)&&void 0!==i&&i}startSessionRecording(){this.sessionRecording||(this.sessionRecording=new le(this)),this.sessionRecording.updateConfig({enabled:!0}),this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this.oi.emit(j)}stopSessionRecording(){var t;null===(t=this.sessionRecording)||void 0===t||t.stop(),this.oi.emit(B)}isRecordingActive(){var t;return"active"===(null===(t=this.sessionRecording)||void 0===t?void 0:t.status)}getSessionRecordingId(){var t;return(null===(t=this.sessionRecording)||void 0===t?void 0:t.sessionId)||null}capture(t,i,e){this.ci.capture(t,i,e),this.oi.emit(D,{event:t,payload:i})}trackEvent(t,i){void 0===i&&(i={}),this.ci.trackEvent(t,i)}identify(t,i,e){this.mi.identify(t,i,e)}setUserProperties(t,i){this.mi.setUserProperties(t,i)}resetUser(t){this.mi.resetUser(t)}createAlias(t,i){this.mi.createAlias(t,i)}getUserIdentity(){return this.mi.getUserIdentity()}getDeviceId(){return this.mi.getDeviceId()}getUserState(){return this.mi.getUserState()}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this.mi.getDistinctId()}getAnonymousId(){return this.mi.getAnonymousId()}toString(){var t,i=null!==(t=this.configManager.getConfig().name)&&void 0!==t?t:lr;return i!==lr&&(i="vt."+i),i}updateConfig(t){this.configManager.updateConfig(t);var i=this.configManager.getConfig();this.sessionManager=new Q(i.storage||"cookie",i.cross_subdomain_cookie),this.userManager=new di(i.persistence||"localStorage+cookie",i.cross_subdomain_cookie),this.$i(i),this.oi.emit(O,{config:i})}$i(t){[this.historyAutocapture,this.autocapture,this.webVitals,this.sessionRecording,this.chat].forEach(i=>{(null==i?void 0:i.onConfigUpdate)&&M(()=>i.onConfigUpdate(t))})}buildUrl(){var t=this.configManager.getConfig(),{proxyUrl:i,proxy:e,api_host:r,token:n}=t;return i||(e?e+"/api/tracking?token="+n:r?r.replace(/\/+$/gm,"")+"/api/tracking?token="+n:"/api/tracking?token="+n)}sendRequest(i,e,r){if(this.Mi()){if(r&&void 0!==t)if(t.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});this.requestQueue.enqueue({url:i,event:e})}}Mi(){var t=this.configManager.getConfig();return!(!t.projectId||!t.token)||(this.di||(console.warn("VTilt: projectId and token are required for tracking"),this.di=!0),!1)}gi(t){"sendBeacon"!==t.transport?this.retryQueue.retriableRequest(t):this.pi(t)}fi(t){return new Promise(i=>{var{url:e,events:r}=t,n=1===r.length?r[0]:{events:r},s=this.configManager.getConfig().disable_compression?Ke.None:Ke.GZipJS;Ye({url:e,data:n,method:"POST",transport:"XHR",compression:s,callback:t=>i({statusCode:t.statusCode})})})}pi(t){var{url:i,events:e}=t,r=1===e.length?e[0]:{events:e},n=this.configManager.getConfig().disable_compression?Ke.None:Ke.GZipJS;Ye({url:i,data:r,method:"POST",transport:"sendBeacon",compression:n})}Ri(t){this.sendRequest(t.url,t.event,!1)}xi(){if(t){var i=()=>{this.requestQueue.unload(),this.retryQueue.unload()};F(t,"beforeunload",i),F(t,"pagehide",i)}}Ci(){this.requestQueue.enable()}wi(){M(()=>{var i,e;if(void 0!==n&&n.search){var r=new URL(n.href),s=r.searchParams.get("vt");if(null==s?void 0:s.trim()){this.ci.setVtPersonUuid(s.trim()),r.searchParams.delete("vt");var o=r.pathname+(r.search||"")+r.hash;null===(e=null===(i=null==t?void 0:t.history)||void 0===i?void 0:i.replaceState)||void 0===e||e.call(i,{},"",o)}}})}_execute_array(t){Array.isArray(t)&&t.forEach(t=>{if(t&&Array.isArray(t)&&t.length>0){var i=t[0],e=t.slice(1);"function"==typeof this[i]&&M(()=>this[i](...e))}})}_dom_loaded(){this.__request_queue.forEach(t=>this.Ri(t)),this.__request_queue=[],this.Ci()}}var hr={},dr=!(void 0!==o||void 0!==s)&&-1===(null==a?void 0:a.indexOf("MSIE"))&&-1===(null==a?void 0:a.indexOf("Mozilla"));null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=dr);var vr,cr=(vr=hr[lr]=new ur,function(){function i(){i.done||(i.done=!0,dr=!1,null!=t&&(t.__VTILT_ENQUEUE_REQUESTS=!1),q(hr,t=>t._dom_loaded()))}r&&"function"==typeof r.addEventListener?"complete"===r.readyState?i():F(r,"DOMContentLoaded",i,{capture:!1}):t&&console.error("Browser doesn't support document.addEventListener")}(),vr);export{vi as ALL_WEB_VITALS_METRICS,ci as DEFAULT_WEB_VITALS_METRICS,ur as VTilt,cr as default,cr as vt};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|