"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[157],{8157:function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}n.d(t,{ZP:function(){return n$}});var m,b={DEBUG:!1,LIB_VERSION:"1.71.0"};/** * uuidv7: An experimental implementation of the proposed UUID Version 7 * * @license Apache-2.0 * @copyright 2021-2023 LiosK * @packageDocumentation * * from https://github.com/LiosK/uuidv7/blob/e501462ea3d23241de13192ceae726956f9b3b7d/src/index.ts */Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e});var w="0123456789abcdef",k=function(){function e(t){if(s(this,e),this.bytes=t,16!==t.length)throw TypeError("not 128-bit length")}return c(e,[{key:"toString",value:function(){for(var e="",t=0;t>>4)+w.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");return e}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/1099511627776,o[1]=t/4294967296,o[2]=t/16777216,o[3]=t/65536,o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}}]),e}(),S=function(){function e(){s(this,e),u(this,"timestamp",0),u(this,"counter",0),u(this,"random",new P)}return c(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(void 0!==e)return e;this.timestamp=0;var t=this.generateOrAbort();if(void 0===t)throw Error("Could not generate UUID after timestamp reset");return t}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return k.fromFieldsV7(this.timestamp,Math.trunc(this.counter/1073741824),1073741823&this.counter,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),F=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;t=this.buffer.length&&(F(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),I=Array.prototype,x=Object.prototype,O=x.toString,$=x.hasOwnProperty,T="undefined"!=typeof window?window:{},M=T.navigator||{userAgent:""},A=T.document||{},R=M.userAgent,C=["localhost","127.0.0.1"],j=I.forEach,D=I.indexOf,N={},q={log:function(){if(b.DEBUG&&!Q(window.console)&&window.console){for(var e=("__rrweb_original__"in window.console.log)?window.console.log.__rrweb_original__:window.console.log,t=arguments.length,n=Array(t),r=0;r1?t-1:0),r=1;r0&&(t[n]=e)}),t},Y=["$performance_raw"];function K(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,c=0,u="",l=[];if(!e)return e;e=ee(e);do t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,l[c++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i);while(a127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(n>t&&(o+=e.substring(t,n)),o+=a,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},et=function(e){var t=function(){var e=(new Date).valueOf(),t=0;if(T.performance&&T.performance.now)t=1e4*T.performance.now();else for(;e==(new Date).valueOf();)t++;return e.toString(16)+Math.floor(t).toString(16)};return function(n){if("v7"===n||"v7"===e)return(E||(E=new S)).generate().toString();var r="undefined"!=typeof window?(window.screen.height*window.screen.width).toString(16):"0";return t()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=0,r=[];function i(e,t){var n,i=0;for(n=0;n=4&&(n=i(n,r),r=[]);return r.length>0&&(n=i(n,r)),n.toString(16)}()+"-"+r+"-"+t()}},en=function(e,t){var n=RegExp("[\\?&]"+t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]")+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var r=n[1];try{r=decodeURIComponent(r)}catch(e){q.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")},er=function(e,t){var n=e.match(RegExp(t+"=([^&]*)"));return n?n[1]:null},ei=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,o){if(t){if(t.addEventListener&&!i)t.addEventListener(n,r,!!o);else{var s="on"+n,a=t[s];t[s]=function(n){if(n=n||e(window.event)){var i,o=!0;G(a)&&(i=a(n));var s=r.call(t,n);return!1!==i&&!1!==s||(o=!1),o}}}}else q.error("No valid element provided to register_event")}}();function eo(e,t){var n=function(){var n=A.createElement("script");n.type="text/javascript",n.src=e,n.onload=function(e){return t(void 0,e)},n.onerror=function(e){return t(e)};var r,i=A.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):A.body.appendChild(n)};A.body?n():A.addEventListener("DOMContentLoaded",n)}var es={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","msclkid"].concat(e||[]),n={};return L(t,function(e){var t=en(A.URL,e);t.length&&(n[e]=t)}),n},searchEngine:function(){var e=A.referrer;return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=es.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(null!==e){n.$search_engine=e;var r=en(A.referrer,t);r.length&&(n.ph_keyword=r)}return n},browser:function(e,t,n){return t=t||"",n||W(e," OPR/")?W(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":W(e,"IEMobile")||W(e,"WPDesktop")?"Internet Explorer Mobile":W(e,"SamsungBrowser/")?"Samsung Internet":W(e,"Edge")||W(e,"Edg/")?"Microsoft Edge":W(e,"FBIOS")?"Facebook Mobile":W(e,"Chrome")?"Chrome":W(e,"CriOS")?"Chrome iOS":W(e,"UCWEB")||W(e,"UCBrowser")?"UC Browser":W(e,"FxiOS")?"Firefox iOS":W(t,"Apple")?W(e,"Mobile")?"Mobile Safari":"Safari":W(e,"Android")?"Android Mobile":W(e,"Konqueror")?"Konqueror":W(e,"Firefox")?"Firefox":W(e,"MSIE")||W(e,"Trident/")?"Internet Explorer":W(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[es.browser(e,t,n)];if(void 0===r)return null;var i=e.match(r);return i?parseFloat(i[i.length-2]):null},browserLanguage:function(){return M.language||M.userLanguage},os:function(e){if(/Windows/i.test(e)){if(/Phone/.test(e)||/WPDesktop/.test(e))return{os_name:"Windows Phone",os_version:""};var t=/Windows NT ([0-9.]+)/i.exec(e);return t&&t[1]?{os_name:"Windows",os_version:t[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(e)){var n=/OS (\d+)_(\d+)_?(\d+)?/i.exec(e);return n&&n[1]?{os_name:"iOS",os_version:[n[1],n[2],n[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(e)){var r=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(e);return r&&r[1]?{os_name:"Android",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(e))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(e)){var i=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(e);return i&&i[1]?{os_name:"Mac OS X",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(e)?{os_name:"Linux",os_version:""}:/CrOS/.test(e)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)&&!/Mobile/.test(e)?"Android Tablet":/Android/.test(e)?"Android":""},deviceType:function(e){var t=this.device(e);return"iPad"===t||"Android Tablet"===t?"Tablet":t?"Mobile":"Desktop"},referrer:function(){return A.referrer||"$direct"},referringDomain:function(){if(!A.referrer)return"$direct";var e=A.createElement("a");return e.href=A.referrer,e.host},properties:function(){var e=es.os(R);return U(Z({$os:e.os_name,$os_version:e.os_version,$browser:es.browser(R,M.vendor,T.opera),$device:es.device(R),$device_type:es.deviceType(R)}),{$current_url:null==T?void 0:T.location.href,$host:null==T?void 0:T.location.host,$pathname:null==T?void 0:T.location.pathname,$browser_version:es.browserVersion(R,M.vendor,T.opera),$browser_language:es.browserLanguage(),$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:b.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:(Date.now=Date.now||function(){return+new Date},Date.now()/1e3)})},people_properties:function(){var e=es.os(R);return U(Z({$os:e.os_name,$os_version:e.os_version,$browser:es.browser(R,M.vendor,T.opera)}),{$browser_version:es.browserVersion(R,M.vendor,T.opera)})}};function ea(e){switch(o(e.className)){case"string":return e.className;case"object":return("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";default:return""}}function ec(e){var t="";return eh(e)&&!e_(e)&&e.childNodes&&e.childNodes.length&&L(e.childNodes,function(e){ed(e)&&e.textContent&&(t+=H(e.textContent).split(/(\s+)/).filter(eg).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),H(t)}function eu(e){return!!e&&1===e.nodeType}function el(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ed(e){return!!e&&3===e.nodeType}function ef(e){return!!e&&11===e.nodeType}var ep=["a","button","form","input","select","textarea","label"];function eh(e){for(var t=e;t.parentNode&&!el(t,"body");t=t.parentNode){var n=ea(t).split(" ");if(W(n,"ph-sensitive")||W(n,"ph-no-capture"))return!1}if(W(ea(e).split(" "),"ph-include"))return!0;var r=e.type||"";if("string"==typeof r)switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!("string"==typeof i&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function e_(e){return!!(el(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||el(e,"select")||el(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function eg(e){return!(null===e||Q(e)||"string"==typeof e&&(e=H(e),/^(?:(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}))$/.test((e||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(e)))}function ev(e){var t=ec(e);return eg(t="".concat(t," ").concat(function e(t){var n="";return t&&t.childNodes&&t.childNodes.length&&L(t.childNodes,function(t){var r;if(t&&"span"===(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase()))try{var i=ec(t);n="".concat(n," ").concat(i).trim(),t.childNodes&&t.childNodes.length&&(n="".concat(n," ").concat(e(t)).trim())}catch(e){console.error(e)}}),n}(e)).trim())?t:""}var ey=function(){function e(t){s(this,e),this.clicks=[],this.enabled=t}return c(e,[{key:"isRageClick",value:function(e,t,n){if(!this.enabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),em=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,eb={is_supported:function(){return!0},error:function(e){q.error("cookieStore error: "+e)},get:function(e){try{for(var t=e+"=",n=document.cookie.split(";"),r=0;r-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?i.$el_text=ev(e):i.$el_text=ec(e));var o=ea(e);o.length>0&&(i.classes=o.split(" ").filter(function(e){return""!==e})),L(e.attributes,function(n){var r;e_(e)&&-1===["name","id","class"].indexOf(n.name)||!t&&eg(n.value)&&("string"!=typeof(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))&&(i["attr__"+n.name]=n.value)});for(var s=1,a=1,c=e;c=this._previousElementSibling(c);)s++,c.tagName===e.tagName&&a++;return i.nth_child=s,i.nth_of_type=a,i},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return L(document.querySelectorAll(e.css_selector),function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),eg(n)&&t.push(n)}),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return L(this._customProperties,function(r){L(r.event_selectors,function(i){L(document.querySelectorAll(i),function(i){W(e,i)&&eh(i)&&(n[r.name]=t._extractCustomPropertyValue(r))})})}),n},_getEventTarget:function(e){var t;return void 0===e.target?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null},_captureEvent:function(e,t){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$autocapture",o=this._getEventTarget(e);if(ed(o)&&(o=o.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,t,"$rageclick"),o&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||el(e,"html")||!eu(e))return!1;if(null!=n&&n.url_allowlist){var r=window.location.href,i=n.url_allowlist;if(i&&!i.some(function(e){return r.match(e)}))return!1}if(null!=n&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some(function(e){return t.type===e}))return!1}if(null!=n&&n.element_allowlist){var s=n.element_allowlist;if(s&&!s.some(function(t){return e.tagName.toLowerCase()===t}))return!1}if(null!=n&&n.css_selector_allowlist){var a=n.css_selector_allowlist;if(a&&!a.some(function(t){return e.matches(t)}))return!1}for(var c=!1,u=[e],l=!0,d=e;d.parentNode&&!el(d,"body");)if(ef(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=d.parentNode||!1))break;if(ep.indexOf(l.tagName.toLowerCase())>-1)c=!0;else{var f=window.getComputedStyle(l);f&&"pointer"===f.getPropertyValue("cursor")&&(c=!0)}u.push(l),d=l}var p=window.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return"submit"===t.type;case"input":case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return c?"click"===t.type:"click"===t.type&&(ep.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var s=[o],a=o;a.parentNode&&!el(a,"body");)ef(a.parentNode)?(s.push(a.parentNode.host),a=a.parentNode.host):(s.push(a.parentNode),a=a.parentNode);var c,u=[],l={},d=!1;if(L(s,function(e){var n=eh(e);"a"===e.tagName.toLowerCase()&&(c=e.getAttribute("href"),c=n&&eg(c)&&c),W(ea(e).split(" "),"ph-no-capture")&&(d=!0),u.push(r._getPropertiesFromElement(e,t.get_config("mask_all_element_attributes"),t.get_config("mask_all_text"))),U(l,r._getAugmentPropertiesFromElement(e))}),t.get_config("mask_all_text")||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?u[0].$el_text=ev(o):u[0].$el_text=ec(o)),c&&(u[0].attr__href=c),d)return!1;var f=U(this._getDefaultProperties(e.type),{$elements:u},this._getCustomProperties(s),l);return t.capture(i,f),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(e){var t=this,n=function(n){n=n||window.event,t._captureEvent(n,e)};ei(document,"submit",n,!1,!0),ei(document,"change",n,!1,!0),ei(document,"click",n,!1,!0)},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;"boolean"!=typeof e.__autocapture&&(this.config=e.__autocapture),null!==(t=this.config)&&void 0!==t&&t.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map(function(e){return new RegExp(e)})),this.rageclicks=new ey(e.get_config("rageclick"))},afterDecideResponse:function(e,t){this._setIsAutocaptureEnabled(t);var n=t.get_config("token");this._initializedTokens.indexOf(n)>-1?q.log('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(u({},eT,!!e.autocapture_opt_out)),this._initializedTokens.push(n),e&&e.config&&e.config.enable_collect_everything&&this._isAutocaptureEnabled?(e.custom_properties&&(this._customProperties=e.custom_properties),this._addDomEventHandlers(t)):t.__autocapture=!1)},enabledForProject:function(e,t,n){if(!e)return!0;t=Q(t)?10:t,n=Q(n)?10:n;for(var r=0,i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(this.getFlags()&&0!==this.getFlags().length){var n=this.getFlagVariants()[e],r="".concat(n),i=this.instance.get_property(eB)||{};return!t.send_event&&"send_event"in t||e in i&&i[e].includes(r)||(Array.isArray(i[e])?i[e].push(r):i[e]=[r],this.instance.persistence.register(u({},eB,i)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})),n}console.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.getFlags()&&0!==this.getFlags().length)return!!this.getFeatureFlag(e,t);console.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(t){return t!==e})}},{key:"receivedFeatureFlags",value:function(e){this.instance.decideEndpointWasHit=!0;var t=this.getFlagVariants(),n=this.getFlagPayloads();(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.featureFlags,s=e.featureFlagPayloads;if(o){if(Array.isArray(o)){var a,c={};if(o)for(var l=0;l1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(eD);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/api/early_access_features/?token=").concat(this.instance.get_config("token")),{},{method:"GET"},function(n){var r=n.earlyAccessFeatures;return t.instance.persistence.register(u({},eD,r)),e(r)})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(function(e){return t[e]}),flagVariants:Object.keys(t).filter(function(e){return t[e]}).reduce(function(e,n){return e[n]=t[n],e},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),t=e.flags,n=e.flagVariants;this.featureFlagEventHandlers.forEach(function(e){return e(t,n)})}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(eN)||{};this.instance.register(u({},eN,i(i({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(eN)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(eq)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(function(t){n[t]=i(i({},n[t]),e[t]),delete e[t]}),this.instance.register(u({},eq,i(i({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(eq)||{};this.instance.register(u({},eq,i(i({},t),{},u({},e,{}))))}else this.instance.unregister(eq)}}]),e}();(tO=tx||(tx={}))[tO.Mutation=0]="Mutation",tO[tO.MouseMove=1]="MouseMove",tO[tO.MouseInteraction=2]="MouseInteraction",tO[tO.Scroll=3]="Scroll",tO[tO.ViewportResize=4]="ViewportResize",tO[tO.Input=5]="Input",tO[tO.TouchMove=6]="TouchMove",tO[tO.MediaInteraction=7]="MediaInteraction",tO[tO.StyleSheetRule=8]="StyleSheetRule",tO[tO.CanvasMutation=9]="CanvasMutation",tO[tO.Font=10]="Font",tO[tO.Log=11]="Log",tO[tO.Drag=12]="Drag",tO[tO.StyleDeclaration=13]="StyleDeclaration",tO[tO.Selection=14]="Selection",tO[tO.AdoptedStyleSheet=15]="AdoptedStyleSheet";var eY=[tx.MouseMove,tx.MouseInteraction,tx.Scroll,tx.ViewportResize,tx.Input,tx.TouchMove,tx.MediaInteraction,tx.Drag],eK=function(){function e(t){var n=this;s(this,e),u(this,"lastActivityTimestamp",Date.now()),u(this,"isIdle",!1),this.instance=t,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint="/s/",this.stopRrweb=void 0,this.windowId=null,this.sessionId=null,this.receivedDecide=!1,window.addEventListener("beforeunload",function(){n._flushBuffer()})}return c(e,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(eM),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"isConsoleLogCaptureEnabled",value:function(){var e=!!this.instance.get_property(eA),t=this.instance.get_config("enable_recording_console_log");return null!=t?t:e}},{key:"getRecordingVersion",value:function(){var e,t=this.instance.get_property(eR);return(null===(e=this.instance.get_config("session_recording"))||void 0===e?void 0:e.recorderVersion)||t||"v1"}},{key:"afterDecideResponse",value:function(e){var t,n,r,i,o,s;this.receivedDecide=!0,this.instance.persistence&&this.instance.persistence.register((u(o={},eM,!!e.sessionRecording),u(o,eA,null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled),u(o,eR,null===(i=e.sessionRecording)||void 0===i?void 0:i.recorderVersion),o)),null!==(t=e.sessionRecording)&&void 0!==t&&t.endpoint&&(this.endpoint=null===(s=e.sessionRecording)||void 0===s?void 0:s.endpoint),null!==(n=e.sessionRecording)&&void 0!==n&&n.recorderVersion&&(this.recorderVersion=e.sessionRecording.recorderVersion),this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach(function(t){return e._captureSnapshotBuffered(t)})),this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(void 0!==Object.assign&&!this.captureStarted&&!this.instance.get_config("disable_session_recording")){this.captureStarted=!0,this.instance.sessionManager.checkAndGetSessionAndWindowId();var t="v2"===this.getRecordingVersion()?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.getRecordingVersion()?eo(this.instance.get_config("api_host")+"/static/".concat(t,"?v=").concat(b.LIB_VERSION),function(n){if(n)return q.error("Could not load ".concat(t),n);e._onScriptLoaded()}):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==eY.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this._isInteractiveEvent(e);if(t||this.isIdle||e.timestamp-this.lastActivityTimestamp>3e5&&(this.isIdle=!0),t&&(this.lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryTakeFullSnapshot())),!this.isIdle){var n=this.instance.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=n.windowId,i=n.sessionId;-1!==[2,4].indexOf(e.type)||this.windowId===r&&this.sessionId===i||this._tryTakeFullSnapshot(),this.windowId=r,this.sessionId=i}}},{key:"_tryTakeFullSnapshot",value:function(){if(!this.captureStarted)return!1;try{var e;return null===(e=this.rrwebRecord)||void 0===e||e.takeFullSnapshot(),!0}catch(e){return q.error("Error taking full snapshot.",e),!1}}},{key:"_onScriptLoaded",value:function(){var e=this,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var n=this.instance.get_config("session_recording"),r=0,o=Object.entries(n||{});r5e6){var n,r=y(t.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(r.s();!(n=r.n()).done;){var i=n.value;t="image/"===i[1].toLocaleLowerCase().slice(0,6)?t.replace(i[0],"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg=="):t.replace(i[0],"")}}catch(e){r.e(e)}finally{r.f()}}return{event:JSON.parse(t),size:t.length}}(function(e){if(e&&"object"===o(e)&&6===e.type&&"object"===o(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var t=[],n=0;n2e3?t.push(e.data.payload.payload[n].slice(0,2e3)+"...[truncated]"):t.push(e.data.payload.payload[n]);return e.data.payload.payload=t,e}return e}(e)),n=t.event,r=t.size;if(this._updateWindowAndSessionIds(n),!this.isIdle){var i={$snapshot_bytes:r,$snapshot_data:n,$session_id:this.sessionId,$window_id:this.windowId};this.instance._captureMetrics.incr("rrweb-record"),this.instance._captureMetrics.incr("rrweb-record-".concat(n.type)),this.emit?this._captureSnapshotBuffered(i):this.snapshots.push(i)}}}},{key:"_flushBuffer",value:function(){return this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0),this.buffer&&0!==this.buffer.data.length&&this._captureSnapshot({$snapshot_bytes:this.buffer.size,$snapshot_data:this.buffer.data,$session_id:this.buffer.sessionId,$window_id:this.buffer.windowId}),this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_captureSnapshotBuffered",value:function(e){var t,n=this,r=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);(!this.buffer||this.buffer.size+e.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){n._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:2===e.$snapshot_data.type}})}}]),e}(),e0={entryType:0,timeOrigin:1,name:2,startTime:3,redirectStart:4,redirectEnd:5,workerStart:6,fetchStart:7,domainLookupStart:8,domainLookupEnd:9,connectStart:10,secureConnectionStart:11,connectEnd:12,requestStart:13,responseStart:14,responseEnd:15,decodedBodySize:16,encodedBodySize:17,initiatorType:18,nextHopProtocol:19,renderBlockingStatus:20,responseStatus:21,transferSize:22,element:23,renderTime:24,loadTime:25,size:26,id:27,url:28,domComplete:29,domContentLoadedEvent:30,domInteractive:31,loadEventEnd:32,loadEventStart:33,redirectCount:34,navigationType:35,unloadEventEnd:36,unloadEventStart:37,duration:39,timestamp:40},e1=["first-input","navigation","paint","resource"],e2=["/s/","/e/"],e3=function(){function e(t){s(this,e),u(this,"_forceAllowLocalhost",!1),this.instance=t}return c(e,[{key:"startObservingIfEnabled",value:function(){this.isEnabled()?this.startObserving():this.stopObserving()}},{key:"startObserving",value:function(){var e,t,n=this;if(!this.observer){if(void 0!==(null===(e=window)||void 0===e||null===(t=e.PerformanceObserver)||void 0===t?void 0:t.supportedEntryTypes)){if(!C.includes(location.hostname)||this._forceAllowLocalhost)try{this.observer=new PerformanceObserver(function(e){e.getEntries().forEach(function(e){n._capturePerformanceEvent(e)})}),PerformanceObserver.supportedEntryTypes.filter(function(e){return e1.includes(e)}).forEach(function(e){var t;null===(t=n.observer)||void 0===t||t.observe({type:e,buffered:!0})})}catch(e){console.error("PostHog failed to start performance observer",e),this.stopObserving()}else q.log("PostHog Peformance observer not started because we are on localhost.")}else q.log("PostHog Performance observer not started because PerformanceObserver is not supported by this browser.")}}},{key:"stopObserving",value:function(){this.observer&&(this.observer.disconnect(),this.observer=void 0)}},{key:"isObserving",value:function(){return!!this.observer}},{key:"isEnabled",value:function(){var e,t;return null!==(e=null!==(t=this.instance.get_config("capture_performance"))&&void 0!==t?t:this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.capturePerformance||!1,this.isEnabled()&&this.startObserving()}},{key:"_capturePerformanceEvent",value:function(e){if(0===e.name.indexOf(this.instance.get_config("api_host"))){var t=e.name.replace(this.instance.get_config("api_host"),"");if(e2.find(function(e){return 0===t.indexOf(e)}))return}var n={url:e.name},r=this.instance.get_config("session_recording");if(r.maskNetworkRequestFn&&(n=r.maskNetworkRequestFn(n)),n){var i=e.toJSON();i.name=n.url;var o={},s=Math.floor(Date.now()-performance.now());for(var a in o[e0.timeOrigin]=s,o[e0.timestamp]=Math.floor(s+e.startTime),e0)void 0!==i[a]&&(o[e0[a]]=i[a]);if(this.capturePerformanceEvent(o),e5(e)){var c,l=y(e.serverTiming||[]);try{for(l.s();!(c=l.n()).done;){var d,f=c.value;this.capturePerformanceEvent((u(d={},e0.timeOrigin,s),u(d,e0.timestamp,Math.floor(s+e.startTime)),u(d,e0.name,f.name),u(d,e0.duration,f.duration),u(d,e0.entryType,"serverTiming"),d))}}catch(e){l.e(e)}finally{l.f()}}}}},{key:"capturePerformanceEvent",value:function(e){var t,n=e[e0.timestamp];null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"posthog/network@1",payload:e},timestamp:n})}}]),e}(),e5=function(e){return"navigation"===e.entryType||"resource"===e.entryType},e6=function(){function e(t){s(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return c(e,[{key:"call",value:function(){var e=this,t=K(JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(eN),group_properties:this.instance.get_property(eq)}));this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=3"),{data:t,verbose:!0},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(e){var t,n,r,i=this;if(0!==(null==e?void 0:e.status)){if(this.instance.decideEndpointWasHit=!0,!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){i.parseDecideResponse(e)},500);if(this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),eW.afterDecideResponse(e,this.instance),null===(n=this.instance.webPerformance)||void 0===n||n.afterDecideResponse(e),null===(r=this.instance.exceptionAutocapture)||void 0===r||r.afterDecideResponse(e),this.instance.featureFlags.receivedFeatureFlags(e),this.instance.compression={},e.supportedCompression&&!this.instance.get_config("disable_compression")){var o,s={},a=y(e.supportedCompression);try{for(a.s();!(o=a.n()).done;)s[o.value]=!0}catch(e){a.e(e)}finally{a.f()}this.instance.compression=s}if(e.siteApps){if(this.instance.get_config("opt_in_site_apps")){var c,u=this.instance.get_config("api_host"),l=y(e.siteApps);try{for(l.s();!(c=l.n()).done;)(function(){var e=c.value,t=e.id,n=e.url,r=[u,"/"===u[u.length-1]&&"/"===n[0]?n.substring(1):n].join("");window["__$$ph_site_app_".concat(t)]=i.instance,eo(r,function(e){e&&console.error("Error while initializing PostHog app with config id ".concat(t),e)})})()}catch(e){l.e(e)}finally{l.f()}}else e.siteApps.length>0&&console.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}else console.error("Failed to fetch feature flags from PostHog.")}}]),e}(),e8=["https://app.posthog.com","https://eu.posthog.com"],e4=["source"],e7=function(){function e(t){s(this,e),this.instance=t}return c(e,[{key:"afterDecideResponse",value:function(e){var t=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&this.loadToolbar(i({},t))}},{key:"maybeLoadToolbar",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!t){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(e){return!1}t=window.localStorage}var r,i=er(e.hash,"__posthog")||er(e.hash,"state"),o=i?JSON.parse(decodeURIComponent(i)):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState("",document.title,e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.get_config("token")!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}},{key:"loadToolbar",value:function(e){var t=this;if(window._postHogToolbarLoaded)return!1;window._postHogToolbarLoaded=!0;var n=this.instance.get_config("api_host"),r=3e4*Math.floor(Date.now()/3e4),o="".concat(n).concat(n.endsWith("/")?"":"/","static/toolbar.js?_ts=").concat(r),s=!e8.includes(this.instance.get_config("api_host"))&&this.instance.get_config("advanced_disable_toolbar_metrics"),a=i(i({token:this.instance.get_config("token")},e),{},{apiURL:n},s?{instrument:!1}:{});a.source;var c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,e4);return window.localStorage.setItem("_postHogToolbarParams",JSON.stringify(c)),eo(o,function(e){e?q.error("Failed to load toolbar",e):(window.ph_load_toolbar||window.ph_load_editor)(a,t.instance)}),ei(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,t.loadToolbar(a)}),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;return this.maybeLoadToolbar(e,t,n)}}]),e}();function e9(e,t){ta(!0,e,t)}function te(e,t){ta(!1,e,t)}function tt(e,t){return"1"===ts(e,t)}function tn(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||T,n=t.navigator||{},r=!1;return L([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(e){W([!0,1,"1","yes"],e)&&(r=!0)}),r}return!1}(t)||"0"===ts(e,t)}function tr(e,t){ti(t=t||{}).remove(to(e,t),!!t.crossSubdomainCookie)}function ti(e){return"localStorage"===(e=e||{}).persistenceType?ek:"localStorage+cookie"===e.persistenceType?eS:eb}function to(e,t){return((t=t||{}).persistencePrefix||"__ph_opt_in_out_")+e}function ts(e,t){return ti(t).get(to(e,t))}function ta(e,t,n){var r;J(t)&&t.length?(ti(n=n||{}).set(to(t,n),e?1:0,(r=n.cookieExpiration,"[object Number]"==O.call(r))?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}var tc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;s(this,e),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=t}return c(e,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),e}(),tu=function(e){l(n,tc);var t=p(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;return s(this,n),(i=t.call(this,o)).handlePollRequest=r,i.captureMetrics=e,i}return c(n,[{key:"enqueue",value:function(e,t,n){this.captureMetrics.incr("batch-enqueue"),this._event_queue.push({url:e,data:t,options:n}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;clearTimeout(this._poller),this._poller=setTimeout(function(){if(e._event_queue.length>0){var t=e.formatQueue();for(var n in t)(function(n){var r=t[n],i=r.url,o=r.data,s=r.options;L(o,function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp}),e.handlePollRequest(i,o,s),e.captureMetrics.incr("batch-requests"),e.captureMetrics.incr("batch-requests-".concat(i.slice(i.length-2))),e.captureMetrics.incr("batch-handle",o.length),e.captureMetrics.incr("batch-handle-".concat(i.slice(i.length-2)),o.length)})(n);e._event_queue.length=0,e._empty_queue_count=0}else e._empty_queue_count++;e._empty_queue_count>4&&(e.isPolling=!1,e._empty_queue_count=0),e.isPolling&&e.poll()},this._pollInterval)}},{key:"updateUnloadMetrics",value:function(){var e=this.formatQueue();for(var t in e){var n=e[t],r=n.url,i=n.data;this.captureMetrics.incr("batch-unload-requests"),this.captureMetrics.incr("batch-unload-requests-".concat(r.slice(r.length-2))),this.captureMetrics.incr("batch-unload",i.length),this.captureMetrics.incr("batch-unload-".concat(r.slice(r.length-2)),i.length)}}},{key:"unload",value:function(){var e=this;clearTimeout(this._poller);var t=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var n=Object.values(t);[].concat(_(n.filter(function(e){return 0===e.url.indexOf("/e")})),_(n.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(t){var n=t.url,r=t.data,o=t.options;e.handlePollRequest(n,r,i(i({},o),{},{transport:"sendBeacon"}))})}},{key:"formatQueue",value:function(){var e={};return L(this._event_queue,function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;void 0===e[o]&&(e[o]={data:[],url:n,options:i}),i&&e[o].options&&e[o].options._metrics&&!e[o].options._metrics.rrweb_full_snapshot&&(e[o].options._metrics.rrweb_full_snapshot=i._metrics.rrweb_full_snapshot),e[o].data.push(r)}),e}}]),n}(),tl=function(){function e(t){s(this,e),this.enabled=t,this.metrics={}}return c(e,[{key:"incr",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)+t)}},{key:"decr",value:function(e){this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)-1)}}]),e}(),td=Uint8Array,tf=Uint16Array,tp=Uint32Array,th=new td([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]),t_=new td([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]),tg=new td([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tv=function(e,t){for(var n=new tf(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&tS)<<1;tF=(61680&(tF=(52428&tF)>>>2|(13107&tF)<<2))>>>4|(3855&tF)<<4,tk[tS]=((65280&tF)>>>8|(255&tF)<<8)>>>1}var tE=function(e,t,n){for(var r=e.length,i=0,o=new tf(t);i>>c]=u}else for(s=new tf(r),i=0;i>>15-e[i];return s},tP=new td(288);for(tS=0;tS<144;++tS)tP[tS]=8;for(tS=144;tS<256;++tS)tP[tS]=9;for(tS=256;tS<280;++tS)tP[tS]=7;for(tS=280;tS<288;++tS)tP[tS]=8;var tI=new td(32);for(tS=0;tS<32;++tS)tI[tS]=5;var tx,tO,t$,tT=tE(tP,9,0),tM=tE(tI,5,0),tA=function(e){return(e/8>>0)+(7&e&&1)},tR=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof tf?tf:e instanceof tp?tp:td)(n-t);return r.set(e.subarray(t,n)),r},tC=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},tj=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},tD=function(e,t){for(var n=[],r=0;rf&&(f=o[r].s);var p=new tf(f+1),h=tN(n[l-1],p,0);if(h>t){r=0;var _=0,g=h-t,v=1<t))break;_+=v-(1<>>=g;_>0;){var m=o[r].s;p[m]=0&&_;--r){var b=o[r].s;p[b]==t&&(--p[b],++_)}h=t}return[new td(p),h]},tN=function e(t,n,r){return -1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},tq=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tf(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},tH=function(e,t){for(var n=0,r=0;r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o4&&!P[tg[x-1]];--x);var O,$,T,M,A=u+5<<3,R=tH(i,tP)+tH(o,tI)+s,C=tH(i,f)+tH(o,_)+s+14+3*x+tH(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A<=R&&A<=C)return tB(t,l,e.subarray(c,c+u));if(tC(t,l,1+(C15&&(tC(t,l,q[F]>>>5&127),l+=q[F]>>>12)}}}else O=tT,$=tP,T=tM,M=tI;for(F=0;F255){tj(t,l,O[(H=r[F]>>>18&31)+257]),l+=$[H+257],H>7&&(tC(t,l,r[F]>>>23&31),l+=th[H]);var B=31&r[F];tj(t,l,T[B]),l+=M[B],B>3&&(tj(t,l,r[F]>>>5&8191),l+=t_[B])}else tj(t,l,O[r[F]]),l+=$[r[F]];return tj(t,l,O[256]),l+$[256]},tU=new tp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tV=new td(0),tG=function(){for(var e=new tp(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),tW=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r>>8;e=n},d:function(){return 4294967295^e}}},tz=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},tQ=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&tz(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}};(nd=t$||(t$={})).GZipJS="gzip-js",nd.Base64="base64";var tJ=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=b.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,s=y(i[1].split("&"));try{for(s.s();!(o=s.n()).done;){var a=o.value.split("=")[0];r[a]&&delete r[a]}}catch(e){s.e(e)}finally{s.f()}}var c=e.indexOf("?")>-1?"&":"?";return e+c+function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return L(e,function(e,r){t=encodeURIComponent(e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t}),i.join(r)}(r)},tX=function e(t,n){if(n.blob&&t.buffer)return new Blob([t.buffer],{type:"text/plain"});if(n.sendBeacon||n.blob){var r,i=e(t,{method:"POST"});return new Blob([i],{type:"application/x-www-form-urlencoded"})}return"POST"!==n.method?null:(r=Array.isArray(t)||"[object Uint8Array]"===Object.prototype.toString.call(t)?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(r+="&compression="+t.compression),r)},tZ=function(e){var t=e.url,n=e.data,r=e.headers,i=e.options,o=e.captureMetrics,s=e.callback,a=e.retriesPerformedSoFar,c=e.retryQueue,u=e.onXHRError,l=e.timeout,d=new XMLHttpRequest;d.open(i.method||"GET",t,!0);var f=tX(n,i);o.incr("_send_request"),o.incr("_send_request_inflight"),L(r,function(e,t){d.setRequestHeader(t,e)}),"POST"!==i.method||i.blob||d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.timeout=void 0===l?1e4:l,d.withCredentials=!0,d.onreadystatechange=function(){if(4===d.readyState){if(o.incr("xhr-response"),o.incr("xhr-response-".concat(d.status)),o.decr("_send_request_inflight"),200===d.status){if(s){var e;try{e=JSON.parse(d.responseText)}catch(e){return void q.error(e)}s(e)}}else"function"==typeof u&&u(d),0>[401,403,404,500].indexOf(d.status)&&c.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(a||0)+1,callback:s}),s&&s({status:0})}},d.send(f)},tY=function(e){l(n,tc);var t=p(n);function n(e,r){var i;return s(this,n),(i=t.call(this)).captureMetrics=e,i.isPolling=!1,i.queue=[],i.areWeOnline=!0,i.onXHRError=r,"undefined"!=typeof window&&"onLine"in window.navigator&&(i.areWeOnline=window.navigator.onLine,window.addEventListener("online",function(){i._handleWeAreNowOnline()}),window.addEventListener("offline",function(){i.areWeOnline=!1})),i}return c(n,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var n,r,i,o=(i=(Math.random()-.5)*((r=Math.min(18e5,n=3e3*Math.pow(2,t)))-n/2),Math.ceil(r+i)),s=new Date(Date.now()+o);this.queue.push({retryAt:s,requestData:e}),console.warn("Enqueued failed request for retry in ".concat(o)),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout(function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()},this._pollInterval)}},{key:"flush",value:function(){var e=new Date(Date.now()),t=this.queue.filter(function(t){return t.retryAt0){this.queue=this.queue.filter(function(t){return t.retryAt>=e});var n,r=y(t);try{for(r.s();!(n=r.n()).done;){var i=n.value.requestData;this._executeXhrRequest(i)}}catch(e){r.e(e)}finally{r.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var e,t=y(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestData,r=n.url,o=n.data,s=n.options;try{window.navigator.sendBeacon(r,tX(o,i(i({},s),{},{sendBeacon:!0})))}catch(e){b.DEBUG&&console.error(e)}}}catch(e){t.e(e)}finally{t.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var t=e.url,n=e.data,r=e.options,i=e.headers,o=e.callback;tZ({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:e.retriesPerformedSoFar||0,callback:o,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),n}(),tK=function(){function e(t,n,r){s(this,e),u(this,"_sessionIdChangedHandlers",[]),this.uuidFn=r,this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null;var i=t.persistence_name||t.token,o=t.session_idle_timeout_seconds||1800;if("number"!=typeof o?(console.warn("[PostHog] session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),o=1800):o>1800?console.warn("[PostHog] session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):o<60&&console.warn("[PostHog] session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."),this._sessionTimeoutMs=1e3*Math.min(Math.max(o,60),1800),this._window_id_storage_key="ph_"+i+"_window_id",this._primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var a=eI.parse(this._window_id_storage_key),c=eI.parse(this._primary_window_exists_storage_key);a&&!c?this._windowId=a:eI.remove(this._window_id_storage_key),eI.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return c(e,[{key:"onSessionId",value:function(e){var t=this;return void 0===this._sessionIdChangedHandlers&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){t._sessionIdChangedHandlers=t._sessionIdChangedHandlers.filter(function(t){return t!==e})}}},{key:"_canUseSessionStorage",value:function(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&eI.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&eI.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?eI.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register(u({},eC,[t,e,n])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[eC];return Array.isArray(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;window.addEventListener("beforeunload",function(){e._canUseSessionStorage()&&eI.remove(e._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),n=h(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],s=this._getWindowId(),a=o&&o>0&&Math.abs(t-o)>864e5,c=!1;!i||!e&&Math.abs(t-r)>this._sessionTimeoutMs||a?(i=this.uuidFn(),s=this.uuidFn(),o=t,c=!0):s||(s=this.uuidFn(),c=!0);var u=0===r||!e||a?t:r,l=0===o?(new Date).getTime():o;return this._setWindowId(s),this._setSessionId(i,u,l),c&&this._sessionIdChangedHandlers.forEach(function(e){return e(i,s)}),{sessionId:i,windowId:s,sessionStartTimestamp:l}}}]),e}(),t0=c(function e(t,n,r,i){s(this,e),this.name="posthog-js",this.setupOnce=function(e){e(function(e){if("error"!==e.level||!t.__loaded)return e;e.tags||(e.tags={});var o,s,a,c,u,l=t.config.ui_host||t.config.api_host;e.tags["PostHog Person URL"]=l+"/person/"+t.get_distinct_id(),t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var d=(null===(o=e.exception)||void 0===o?void 0:o.values)||[],f={$exception_message:null===(s=d[0])||void 0===s?void 0:s.value,$exception_type:null===(a=d[0])||void 0===a?void 0:a.type,$exception_personURL:l+"/person/"+t.get_distinct_id(),$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:null===(c=d[0])||void 0===c?void 0:c.value,$sentry_exception_type:null===(u=d[0])||void 0===u?void 0:u.type,$sentry_tags:e.tags};return n&&r&&(f.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+e.event_id),t.capture("$exception",f),e})}}),t1=function(e){Promise&&Promise.resolve||console.warn("This browser does not have Promise support, and can not use the segment integration");var t=function(t,n){t.event.userId||t.event.anonymousId===e.get_distinct_id()||e.reset(),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(e.register({distinct_id:t.event.userId}),e.reloadFeatureFlags());var r=e._calculate_event_properties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,"$pageview")},identify:function(e){return t(e,"$identify")},screen:function(e){return t(e,"$screen")}}},t2=function(){function e(t){s(this,e),u(this,"_seenFirstPageView",!1),this.uuidFn=t}return c(e,[{key:"onPageview",value:function(){this._seenFirstPageView&&(this._pageViewId=this.uuidFn()),this._seenFirstPageView=!0}},{key:"getPageViewId",value:function(){return this._pageViewId||(this._pageViewId=this.uuidFn()),this._pageViewId}}]),e}();function t3(e){return"undefined"!=typeof Event&&t5(e,Event)}function t5(e,t){try{return e instanceof t}catch(e){return!1}}function t6(e){return null===e||"object"!==o(e)&&"function"!=typeof e}function t8(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function t4(e){return t8(e,"DOMError")}var t7=/\(error: (.*)\)/;function t9(e,t,n,r){var i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}var ne=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nt=/\((\S*)(?::(\d+))(?::(\d+))\)/,nn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ni=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,no=(function(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:0,n=[],o=e.split("\n"),s=t;s1024)){var c=t7.test(a)?a.replace(t7,"$1"):a;if(!c.match(/\S*Error: /)){var u,l=y(r);try{for(l.s();!(u=l.n()).done;){var d=(0,u.value)(c);if(d){n.push(d);break}}}catch(e){l.e(e)}finally{l.f()}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=e.slice(0,50);return t.reverse(),t.map(function(e){return i(i({},e),{},{filename:e.filename||t[t.length-1].filename,function:e.function||"?"})})}(n)}}).apply(void 0,[[30,function(e){var t=ne.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){var n=nt.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}var r=h(ns(t[1]||"?",t[2]),2),i=r[0];return t9(r[1],i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,function(e){var t=nn.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=nr.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||"?",o=h(ns(i,r),2);return i=o[0],t9(r=o[1],i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,function(e){var t=ni.exec(e);return t?t9(t[2],t[1]||"?",+t[3],t[4]?+t[4]:void 0):void 0}]]),ns=function(e,t){var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:"?",n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},na=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,nc=/Minified React error #\d+;/i;function nu(e){var t=function(e){var t=e.stacktrace||e.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(nc.test(e.message))return 1}return 0}(e);try{return no(t,n)}catch(e){}return[]}(e);return{$exception_type:e.name,$exception_message:e.message,$exception_stack_trace_raw:JSON.stringify(t)}}function nl(e){var t=h(e,5),n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],c={};if(void 0===a&&"string"==typeof n){var u="Error",l=n,d=n.match(na);d&&(u=d[1],l=d[2]),c={$exception_type:u,$exception_message:l}}var f=a||n;if(t4(f)||t8(f,"DOMException")){if("stack"in f)c=nu(f);else{var p=f.name||(t4(f)?"DOMError":"DOMException"),_=f.message?"".concat(p,": ").concat(f.message):p;(c={$exception_type:"Error",$exception_message:_}).$exception_type=t4(f)?"DOMError":"DOMException",c.$exception_message=c.$exception_message||_}"code"in f&&(c.$exception_DOMException_code="".concat(f.code))}else t8(f,"ErrorEvent")&&f.error?c=nu(f.error):function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t5(e,Error)}}(f)?c=nu(f):t8(f,"Object")||t3(f)?(c={$exception_type:t3(f)?f.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:"".concat(i.slice(0,t),"...")}return""}(f))}).$exception_is_synthetic=!0:(c.$exception_type=c.$exception_type||"Error",c.$exception_message=c.$exception_message||f,c.$exception_is_synthetic=!0);return i(i(i(i({},c),{},{$exception_type:c.$exception_type||"UnknownErrorType",$exception_message:c.$exception_message||""},r?{$exception_source:r}:{}),o?{$exception_lineno:o}:{}),s?{$exception_colno:s}:{})}var nd,nf,np,nh=function(){function e(t){s(this,e),u(this,"originalOnErrorHandler",void 0),u(this,"originalOnUnhandledRejectionHandler",void 0),u(this,"errorsToIgnore",[]),this.instance=t}return c(e,[{key:"debugLog",value:function(){if(this.instance.get_config("debug")){for(var e,t=arguments.length,n=Array(t),r=0;r1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(eH);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/api/surveys/?token=").concat(this.instance.get_config("token")),{},{method:"GET"},function(n){var r=n.surveys;return t.instance.persistence.register(u({},eH,r)),e(r)})}},{key:"getActiveMatchingSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys(function(n){return e(n.filter(function(e){return!(!e.start_date||e.end_date)}).filter(function(e){if(!e.conditions)return!0;var t,n,r=null===(t=e.conditions)||void 0===t||!t.url||window.location.href.indexOf(e.conditions.url)>-1,i=null===(n=e.conditions)||void 0===n||!n.selector||document.querySelector(e.conditions.selector);return r&&i}).filter(function(e){if(!e.linked_flag_key&&!e.targeting_flag_key)return!0;var n=!e.linked_flag_key||t.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),r=!e.targeting_flag_key||t.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key);return n&&r}))},n)}}]),e}();(m=nv||(nv={}))[m.INIT_MODULE=0]="INIT_MODULE",m[m.INIT_SNIPPET=1]="INIT_SNIPPET";var nw=function(){},nk={},nS="posthog",nF=T.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,nE=!nF&&-1===R.indexOf("MSIE")&&-1===R.indexOf("Mozilla"),nP=function(){var e,t,n;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:-1===(null==A||null===(e=A.location)||void 0===e||null===(t=e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:nw,store_google:!0,custom_campaign_params:[],save_referrer:!0,test:!1,verbose:!1,capture_pageview:!0,capture_pageleave:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==T||null===(n=T.location)||void 0===n?void 0:n.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(e){console.error("Bad HTTP status: "+e.status+" "+e.statusText)},get_device_id:function(e){return e},_onCapture:nw,_capture_metrics:!1,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,uuid_version:"og"}},nI=function(e,t,n,r){var i,o=n!==nS&&nm?n?nm[n]:void 0:nm,s={initComplete:!1,syncCode:!1},a=function(e){return function(t){s[e]||(s[e]=!0,s.initComplete&&s.syncCode&&(null==r||r(t)))}};if(o&&ny===nv.INIT_MODULE)i=o;else{if(o&&!V(o))return void console.error("You have already initialized "+n);i=new nx}return i._init(e,t,n,a("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new eK(i),i.sessionRecording.startRecordingIfEnabled(),i.webPerformance=new e3(i),i.webPerformance.startObservingIfEnabled(),i.exceptionAutocapture=new nh(i),i.__autocapture=i.get_config("autocapture"),eW._setIsAutocaptureEnabled(i),eW._isAutocaptureEnabled&&(i.__autocapture=i.get_config("autocapture"),eW.enabledForProject(i.get_config("token"),100,100)?eW.isBrowserSupported()?eW.init(i):(i.__autocapture=!1,q.log("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,q.log("Not in active bucket: disabling Automatic Event Collection."))),b.DEBUG=b.DEBUG||i.get_config("debug"),void 0!==o&&V(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),a("syncCode")(i),i},nx=function(){function e(){var t=this;s(this,e),u(this,"uuidFn",et("og")),this.config=nP(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=t0,this.segmentIntegration=function(){return t1(t)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.featureFlags=new eZ(this),this.toolbar=new e7(this),this.pageViewIdManager=new t2(this.uuidFn),this.surveys=new nb(this),this._captureMetrics=void 0,this._requestQueue=void 0,this._retryQueue=void 0,this.persistence=void 0,this.sessionPersistence=void 0,this.sessionManager=void 0,this.people={set:function(e,n,r){var i="string"==typeof e?u({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i="string"==typeof e?u({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}}}return c(e,[{key:"init",value:function(e,t,n){if(Q(n))console.error("You must name your new library: init(token, config, name)");else{if(n!==nS){var r=nI(e,t,n,function(e){nm[n]=e,e._loaded()});return nm[n]=r,r}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var t,n,r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var c,u={segmentRegister:!1,syncCode:!1},l=function(e){return function(){u[e]||(u[e]=!0,u.segmentRegister&&u.syncCode&&(null==a||a(r)))}};if(this.set_config(U({},nP(),o,{name:s,token:e,callback_fn:(s===nS?s:nS+"."+s)+"._jsc"})),this.uuidFn=et(this.config.uuid_version||"og"),this._jsc=function(){},(null!=T&&null!==(t=T.rrweb)&&void 0!==t&&t.record||null!=T&&T.rrwebRecord)&&(this.__loaded_recorder_version=null==T||null===(c=T.rrweb)||void 0===c?void 0:c.version),this._captureMetrics=new tl(this.get_config("_capture_metrics")),this._requestQueue=new tu(this._captureMetrics,this._handle_queued_event.bind(this)),this._retryQueue=new tY(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new eG(this.config),this.sessionManager=new tK(this.config,this.persistence,this.uuidFn),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new eG(i(i({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),o.segment?(this.config.get_device_id=function(){return o.segment.user().anonymousId()},o.segment.user().id()&&(this.register({distinct_id:o.segment.user().id()}),this.persistence.set_user_state("identified")),o.segment.register(this.segmentIntegration()).then(l("segmentRegister"))):l("segmentRegister")(),void 0!==(null===(n=o.bootstrap)||void 0===n?void 0:n.distinctID)){var d,f,p=this.get_config("get_device_id")(this.uuidFn()),h=null!==(d=o.bootstrap)&&void 0!==d&&d.isIdentifiedID?p:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(f=o.bootstrap)&&void 0!==f&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var _,g,v=Object.keys((null===(_=o.bootstrap)||void 0===_?void 0:_.featureFlags)||{}).filter(function(e){var t,n;return!(null===(t=o.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])}).reduce(function(e,t){var n,r;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e},{}),y=Object.keys((null===(g=o.bootstrap)||void 0===g?void 0:g.featureFlagPayloads)||{}).filter(function(e){return v[e]}).reduce(function(e,t){var n,r,i,s;return null!==(n=o.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(i=o.bootstrap)||void 0===i||null===(s=i.featureFlagPayloads)||void 0===s?void 0:s[t]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:y})}if(!this.get_distinct_id()){var m=this.get_config("get_device_id")(this.uuidFn());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_user_state("anonymous")}T.addEventListener&&T.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_loaded",value:function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{title:A.title},{send_instantly:!0}),this.get_config("advanced_disable_decide")||new e6(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)}},{key:"_start_queue_if_opted_in",value:function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||B(this.__request_queue,function(t){e._send_request.apply(e,_(t))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(Q(e))return null;if(nF)return function(n){e(n,t)};var n=this._jsc,r=""+Math.floor(1e8*Math.random()),i=this.get_config("callback_fn")+"["+r+"]";return n[r]=function(i){delete n[r],e(i,t)},i}},{key:"_handle_unload",value:function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics)),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,t,n){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,n||nk,nw)}},{key:"__compress_and_send_json_request",value:function(e,t,n,r){var o,s,a,c,u,l,d,f=h((this.compression[t$.GZipJS]?t$.GZipJS:t$.Base64)===t$.GZipJS?[(o=function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new td(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;sr.length){var a=new td(i+8+(n-s<<1));a.set(r),r=a}var c=e.charCodeAt(s);c<128||t?o(c):(c<2048?o(192|c>>>6):(c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63)):o(224|c>>>12),o(128|c>>>6&63)),o(128|63&c))}return tR(r,0,i)}(t),s={mtime:0},a=tW(),c=o.length,a.p(o),u=10+(s.filename&&s.filename.length+1||0),d=(l=function(e,t,n,r,i,o){var s=e.length,a=new td(r+s+5*(1+Math.floor(s/7e3))+i),c=a.subarray(r,a.length-i),u=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d>>13,h=8191&f,_=(1<7e3||P>24576)&&M>423){u=tL(e,c,0,w,k,S,E,P,x,l-x,u),P=F=E=0,x=l;for(var A=0;A<286;++A)k[A]=0;for(A=0;A<30;++A)S[A]=0}var R=2,C=0,j=h,D=$-T&32767;if(M>2&&O==b(l-D))for(var N=Math.min(p,M)-1,q=Math.min(32767,l),H=Math.min(258,M);D<=q&&--j&&$!=T;){if(e[l+R]==e[l+R-D]){for(var B=0;BR){if(R=B,C=D,B>N)break;var L=Math.min(D,B-2),U=0;for(A=0;AU&&(U=G,T=V)}}}D+=($=T)-(T=g[$])+32768&32767}if(C){w[P++]=268435456|tb[R]<<18|tw[C];var W=31&tb[R],z=31&tw[C];E+=th[W]+t_[z],++k[257+W],++S[z],I=l+R,++F}else w[P++]=e[l],++k[e[l]]}}u=tL(e,c,o,w,k,S,E,P,x,l-x,u),o||(u=tB(c,u,tV))}return tR(a,0,r+tA(u)+i)}(o,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+s.mem,u,8,!0)).length,tQ(l,s),tz(l,d-8,a.d()),tz(l,d-4,c),l),i(i({},n),{},{blob:!0,urlQueryArgs:{compression:t$.GZipJS}})]:[{data:K(t)},n],2),p=f[0],_=f[1];this._send_request(e,p,_,r)}},{key:"_send_request",value:function(e,t,n,r){if(nE)this.__request_queue.push([e,t,n,r]);else{n=U({method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},n||{}),nF||(n.method="GET");var o="sendBeacon"in T.navigator&&"sendBeacon"===n.transport;if(e=tJ(e,n.urlQueryArgs||{},{ip:this.get_config("ip")}),o)try{T.navigator.sendBeacon(e,tX(t,i(i({},n),{},{sendBeacon:!0})))}catch(e){this.get_config("debug")&&console.error(e)}else if(nF)try{tZ({url:e,data:t,headers:this.get_config("xhr_headers"),options:n,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(e){console.error(e)}else{var s,a=A.createElement("script");a.type="text/javascript",a.async=!0,a.defer=!0,a.src=e;var c=A.getElementsByTagName("script")[0];null===(s=c.parentNode)||void 0===s||s.insertBefore(a,c)}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];B(e,function(e){e&&(V(t=e[0])?o.push(e):"function"==typeof e?e.call(n):V(e)&&"alias"===t?r.push(e):V(e)&&-1!==t.indexOf("capture")&&"function"==typeof n[t]?o.push(e):i.push(e))});var s=function(e,t){B(e,function(e){if(V(e[0])){var n=t;L(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(r,this),s(i,this),s(o,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"captureException",value:function(e,t){var n;null===(n=this.exceptionAutocapture)||void 0===n||n.captureException([e.name,void 0,void 0,void 0,e],t)}},{key:"capture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nk;if(this.__loaded&&!function(e,t){var n=!1;try{var r=e.get_config("token"),i=e.get_config("respect_dnt"),o=e.get_config("opt_out_capturing_persistence_type"),s=e.get_config("opt_out_capturing_cookie_prefix")||void 0,a=e.get_config("window");r&&(n=tn(r,{respectDnt:i,persistenceType:o,persistencePrefix:s,window:a}))}catch(e){t||console.error("Unexpected error when checking capturing opt-out status: "+e)}return n}(this,!1)){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(n=n||nk).transport;if(r&&(n.transport=r),Q(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp|ahrefsbot|facebookexternalhit|facebookcatalog|applebot|semrushbot|duckduckbot|twitterbot|rogerbot|linkedinbot|mj12bot|sitebulb|bot.htm|bot.php|hubspot|crawler|prerender)/i.test(R)){this.sessionPersistence.update_search_keyword(),this.get_config("store_google")&&this.sessionPersistence.update_campaign_params(),this.get_config("save_referrer")&&this.sessionPersistence.update_referrer_info();var i,o,s,a,c={uuid:this.uuidFn("v7"),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(c.$set=n.$set,c.$set_once=n.$set_once),(i=c,o=n._noTruncate?null:this.get_config("properties_string_max_length"),s=function(e,t){return t&&Y.indexOf(t)>-1?e:"string"==typeof e&&null!==o?e.slice(0,o):e},a=new Set,c=function e(t,n){var r;return t!==Object(t)?s?s(t,n):t:a.has(t)?void 0:(a.add(t),V(t)?(r=[],B(t,function(t){r.push(e(t))})):(r={},L(t,function(t,n){a.has(t)||(r[n]=e(t,n))})),r)}(i)).timestamp=n.timestamp||new Date,this.get_config("debug")&&q.log("PostHog.js send",c);var u=JSON.stringify(c),l=this.get_config("api_host")+(n.endpoint||"/e/"),d=n!==nk;return!this.get_config("request_batching")||d&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(l,u,n):this._requestQueue.enqueue(l,c,n),this._invokeCaptureHooks(e,c),c}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),L(this.__captureHooks,function(t){return t(e)})}},{key:"_calculate_event_properties",value:function(e,t){var n,r=this.persistence.remove_event_timer(e),o=i({},t);if(o.token=this.get_config("token"),"$snapshot"===e){var s=i(i({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,o}var a=es.properties();if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(),u=c.sessionId,l=c.windowId;o.$session_id=u,o.$window_id=l}if(null!==(n=this.webPerformance)&&void 0!==n&&n.isEnabled&&("$pageview"===e&&this.pageViewIdManager.onPageview(),o=U(o,{$pageview_id:this.pageViewIdManager.getPageViewId()})),"$pageview"===e&&(o.title=A.title),"$performance_event"===e){var d=this.persistence.properties();return o.distinct_id=d.distinct_id,o.$current_url=a.$current_url,o}if(void 0!==r){var f=(new Date).getTime()-r;o.$duration=parseFloat((f/1e3).toFixed(3))}o=U({},es.properties(),this.persistence.properties(),this.sessionPersistence.properties(),o);var p=this.get_config("property_blacklist");V(p)?L(p,function(e){delete o[e]}):console.error("Invalid value for property_blacklist config: "+p);var h=this.get_config("sanitize_properties");return h&&(o=h(o,e)),o}},{key:"register",value:function(e,t){this.persistence.register(e,t)}},{key:"register_once",value:function(e,t,n){this.persistence.register_once(e,t,n)}},{key:"register_for_session",value:function(e){this.sessionPersistence.register(e)}},{key:"unregister",value:function(e){this.persistence.unregister(e)}},{key:"unregister_for_session",value:function(e){this.sessionPersistence.unregister(e)}},{key:"_register_single",value:function(e,t){this.register(u({},e,t))}},{key:"getFeatureFlag",value:function(e,t){return this.featureFlags.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}},{key:"isFeatureEnabled",value:function(e,t){return this.featureFlags.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}},{key:"getEarlyAccessFeatures",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){return this.sessionManager.onSessionId(e)}},{key:"getSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}},{key:"getActiveMatchingSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}},{key:"identify",value:function(e,t,n){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(eO)&&(this.unregister(eO),this.register({distinct_id:e}));var i="anonymous"===this.persistence.get_user_state();e!==r&&i?(this.persistence.set_user_state("identified"),this.setPersonPropertiesForFlags(t||{}),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(eB))}else console.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,t){(e||t)&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}},{key:"group",value:function(e,t,n){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i(i({},r),{},u({},e,t))}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags(u({},e,n))),r[e]===t||n||this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t=this.get_property("$device_id");this.persistence.clear(),this.sessionPersistence.clear(),this.persistence.set_user_state("anonymous"),this.sessionManager.resetSessionId();var n=this.get_config("get_device_id")(this.uuidFn());this.register_once({distinct_id:n,$device_id:e?n:t},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){return this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId}},{key:"get_session_replay_url",value:function(e){var t=this.config.ui_host||this.config.api_host,n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionId,i=n.sessionStartTimestamp,o=t+"/replay/"+r;if(null!=e&&e.withTimestamp&&i){var s,a=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return o;var c=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-a,0);o+="?t=".concat(c)}return o}},{key:"alias",value:function(e,t){return e===this.get_property(ex)?(q.critical("Attempting to create alias for existing People user - aborting."),-2):(Q(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(eO,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var t=i({},this.config);z(e)&&(U(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),this.sessionPersistence&&this.sessionPersistence.update_config(this.config),ek.is_supported()&&"true"===ek.get("ph_debug")&&(this.config.debug=!0),this.get_config("debug")&&(b.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started())}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_config",value:function(e){var t;return null===(t=this.config)||void 0===t?void 0:t[e]}},{key:"get_property",value:function(e){return this.persistence.props[e]}},{key:"getSessionProperty",value:function(e){return this.sessionPersistence.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.get_config("name"))&&void 0!==e?e:nS;return t!==nS&&(t=nS+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&ek.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_capturing()&&(this.get_config("opt_out_capturing_by_default")||eb.get("ph_optout"))&&(eb.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))}},{key:"_gdpr_update_persistence",value:function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),this.get_config("disable_persistence")||this.sessionPersistence.disabled===t||this.sessionPersistence.set_disabled(t)}},{key:"_gdpr_call_func",value:function(e,t){return t=U({capture:this.capture.bind(this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t||{}),ek.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=U({enable_persistence:!0},e||{}),this._gdpr_call_func(e9,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=U({clear_persistence:!0},e||{});this._gdpr_call_func(te,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(tt,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(tn,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=U({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(tr,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(T.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),e}();!function(e,t){for(var n=0;n