"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1319],{71319: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;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);return n=t?Reflect.construct(r,arguments,d(this).constructor):r.apply(this,arguments),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(e,t)||_(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=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 nj}});var y,b={DEBUG:!1,LIB_VERSION:"1.83.0"},w=Array.prototype,k=Object.prototype,S=k.toString,E=k.hasOwnProperty,x="undefined"!=typeof window?window:{},P=x.navigator||{userAgent:""},F=x.document||{},I=P.userAgent,O=["localhost","127.0.0.1"],$=w.forEach,R=w.indexOf,T={},A={log:function(){if(b.DEBUG&&!U(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;r<t;r++)n[r]=arguments[r];try{e.apply(window.console,n)}catch(t){M(n,function(t){e(t)})}}},error:function(){if(b.DEBUG&&!U(window.console)&&window.console){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){M(r,function(e){i(e)})}}},critical:function(){if(!U(window.console)&&window.console){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){M(r,function(e){i(e)})}}},unintializedWarning:function(e){b.DEBUG&&!U(window.console)&&window.console&&A.error("[PostHog] You must initialize PostHog before calling ".concat(e))}},C=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function M(e,t,n){if(Array.isArray(e)){if($&&e.forEach===$)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===T)return}}}function D(e,t,n){if(null!=e){if(Array.isArray(e))return M(e,t,n);for(var r in e)if(E.call(e,r)&&t.call(n,e[r],r)===T)return}}var N=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return M(n,function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])}),e},j=Array.isArray||function(e){return"[object Array]"===S.call(e)},H=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(e){return!1}};function L(e,t){return -1!==e.indexOf(t)}var B=function(e){return e===Object(e)&&!j(e)},q=function(e){if(B(e)){for(var t in e)if(E.call(e,t))return!1;return!0}return!1},U=function(e){return void 0===e},V=function(e){return"[object String]"==S.call(e)},G=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},z=function(e){return function(){try{for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){A.critical("Implementation error. Please turn on debug and contact support@posthog.com."),A.critical(e)}}},W=function(e){var t={};return D(e,function(e,n){V(e)&&e.length>0&&(t[n]=e)}),t},Y=["$performance_raw"];function Q(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,u=0,c="",l=[];if(!e)return e;e=J(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[u++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i);while(a<e.length);switch(c=l.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}var J=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<r;i++){var s=e.charCodeAt(i),a=null;s<128?n++:a=s>127&&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},X=["ahrefsbot","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","hubspot","linkedinbot","mj12bot","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","twitterbot","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"],Z=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){A.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")},K=function(e,t){var n=e.match(RegExp(t+"=([^&]*)"));return n?n[1]:null},ee=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;H(a)&&(i=a(n));var s=r.call(t,n);return!1!==i&&!1!==s||(o=!1),o}}}}else A.error("No valid element provided to register_event")}}();function et(e,t){var n=function(){var n=F.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=F.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):F.body.appendChild(n)};F.body?n():F.addEventListener("DOMContentLoaded",n)}var en={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","msclkid"].concat(e||[]),n={};return D(t,function(e){var t=Z(F.URL,e);t.length&&(n[e]=t)}),n},searchEngine:function(){var e=F.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=en.searchEngine(),t={};if(null!==e){t.$search_engine=e;var n=Z(F.referrer,"yahoo"!=e?"q":"p");n.length&&(t.ph_keyword=n)}return t},browser:function(e,t,n){return t=t||"",n||L(e," OPR/")?L(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":L(e,"IEMobile")||L(e,"WPDesktop")?"Internet Explorer Mobile":L(e,"SamsungBrowser/")?"Samsung Internet":L(e,"Edge")||L(e,"Edg/")?"Microsoft Edge":L(e,"FBIOS")?"Facebook Mobile":L(e,"Chrome")?"Chrome":L(e,"CriOS")?"Chrome iOS":L(e,"UCWEB")||L(e,"UCBrowser")?"UC Browser":L(e,"FxiOS")?"Firefox iOS":L(t,"Apple")?L(e,"Mobile")?"Mobile Safari":"Safari":L(e,"Android")?"Android Mobile":L(e,"Konqueror")?"Konqueror":L(e,"Firefox")?"Firefox":L(e,"MSIE")||L(e,"Trident/")?"Internet Explorer":L(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+)?)/}[en.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 P.language||P.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 F.referrer||"$direct"},referringDomain:function(){if(!F.referrer)return"$direct";var e=F.createElement("a");return e.href=F.referrer,e.host},properties:function(){var e=en.os(I);return N(W({$os:e.os_name,$os_version:e.os_version,$browser:en.browser(I,P.vendor,x.opera),$device:en.device(I),$device_type:en.deviceType(I)}),{$current_url:null==x?void 0:x.location.href,$host:null==x?void 0:x.location.host,$pathname:null==x?void 0:x.location.pathname,$browser_version:en.browserVersion(I,P.vendor,x.opera),$browser_language:en.browserLanguage(),$screen_height:null==x?void 0:x.screen.height,$screen_width:null==x?void 0:x.screen.width,$viewport_height:null==x?void 0:x.innerHeight,$viewport_width:null==x?void 0:x.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:G()/1e3})},people_properties:function(){var e=en.os(I);return N(W({$os:e.os_name,$os_version:e.os_version,$browser:en.browser(I,P.vendor,x.opera)}),{$browser_version:en.browserVersion(I,P.vendor,x.opera)})}};function er(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 ei(e){var t="";return el(e)&&!ed(e)&&e.childNodes&&e.childNodes.length&&D(e.childNodes,function(e){ea(e)&&e.textContent&&(t+=C(e.textContent).split(/(\s+)/).filter(ef).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),C(t)}function eo(e){return!!e&&1===e.nodeType}function es(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ea(e){return!!e&&3===e.nodeType}function eu(e){return!!e&&11===e.nodeType}var ec=["a","button","form","input","select","textarea","label"];function el(e){for(var t=e;t.parentNode&&!es(t,"body");t=t.parentNode){var n=er(t).split(" ");if(L(n,"ph-sensitive")||L(n,"ph-no-capture"))return!1}if(L(er(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 ed(e){return!!(es(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||es(e,"select")||es(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function ef(e){return!(null===e||U(e)||"string"==typeof e&&(e=C(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 eh(e){var t=ei(e);return ef(t="".concat(t," ").concat(function e(t){var n="";return t&&t.childNodes&&t.childNodes.length&&D(t.childNodes,function(t){var r;if(t&&"span"===(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase()))try{var i=ei(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 ep=function(){function e(t){s(this,e),this.clicks=[],this.enabled=t}return u(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}(),eg="$people_distinct_id",e_="__alias",ev="__timers",em="$autocapture_disabled_server_side",ey="$session_recording_enabled_server_side",eb="$console_log_recording_enabled_server_side",ew="$session_recording_recorder_version_server_side",ek="$sesid",eS="$enabled_feature_flags",eE="$early_access_features",ex="$stored_person_properties",eP="$stored_group_properties",eF="$surveys",eI="$flag_call_reported",eO="$user_state",e$="$posthog_quota_limited",eR=[eg,e_,"__cmpns",ev,ey,ek,eS,eO,e$,eE,eP,ex,eF,eI];function eT(e,t){return t.length>e?t.slice(0,e)+"...":t}var eA={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t,n=null===this._isDisabledServerSide?!(null===(t=e.persistence)||void 0===t||!t.props[em]):this._isDisabledServerSide,r=!!e.config.autocapture;this._isAutocaptureEnabled=r&&!n},_previousElementSibling:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!eo(t));return t},_getAugmentPropertiesFromElement:function(e){if(!el(e))return{};var t={};return D(e.attributes,function(e){if(0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&ef(r)&&(t[n]=r)}}),t},_getPropertiesFromElement:function(e,t,n){var r,i=e.tagName.toLowerCase(),o={tag_name:i};ec.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=eT(1024,eh(e)):o.$el_text=eT(1024,ei(e)));var s=er(e);s.length>0&&(o.classes=s.split(" ").filter(function(e){return""!==e}));var a=null===(r=this.config)||void 0===r?void 0:r.element_attribute_ignorelist;D(e.attributes,function(n){var r;ed(e)&&-1===["name","id","class"].indexOf(n.name)||null!=a&&a.includes(n.name)||!t&&ef(n.value)&&("string"!=typeof(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))&&(o["attr__"+n.name]=eT(1024,n.value))});for(var u=1,c=1,l=e;l=this._previousElementSibling(l);)u++,l.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return D(document.querySelectorAll(e.css_selector),function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),ef(n)&&t.push(n)}),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return D(this._customProperties,function(r){D(r.event_selectors,function(i){D(document.querySelectorAll(i),function(i){L(e,i)&&el(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(ea(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||es(e,"html")||!eo(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 u=!1,c=[e],l=!0,d=e;d.parentNode&&!es(d,"body");)if(eu(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=d.parentNode||!1))break;if(ec.indexOf(l.tagName.toLowerCase())>-1)u=!0;else{var f=window.getComputedStyle(l);f&&"pointer"===f.getPropertyValue("cursor")&&(u=!0)}c.push(l),d=l}var h=window.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){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 u?"click"===t.type:"click"===t.type&&(ec.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var s,a,u=[o],c=o;c.parentNode&&!es(c,"body");)eu(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var l,d=[],f={},h=!1;if(D(u,function(e){var n=el(e);"a"===e.tagName.toLowerCase()&&(l=e.getAttribute("href"),l=n&&ef(l)&&l),L(er(e).split(" "),"ph-no-capture")&&(h=!0),d.push(r._getPropertiesFromElement(e,t.config.mask_all_element_attributes,t.config.mask_all_text)),N(f,r._getAugmentPropertiesFromElement(e))}),t.config.mask_all_text||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?d[0].$el_text=eh(o):d[0].$el_text=ei(o)),l&&(d[0].attr__href=l),h)return!1;var p=N(this._getDefaultProperties(e.type),{$elements:d},null!==(s=d[0])&&void 0!==s&&s.$el_text?{$el_text:null===(a=d[0])||void 0===a?void 0:a.$el_text}:{},this._getCustomProperties(u),f);return t.capture(i,p),!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)};ee(document,"submit",n,!1,!0),ee(document,"change",n,!1,!0),ee(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 ep(e.config.rageclick)},afterDecideResponse:function(e,t){var n=t.config.token;this._initializedTokens.indexOf(n)>-1?A.log('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(c({},em,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this._setIsAutocaptureEnabled(t),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=U(t)?10:t,n=U(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return H(document.querySelectorAll)}};!function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=e[t].bind(e))}(eA),function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=z(e[t]))}(eA);var eC,eM,eD="$active_feature_flags",eN="$override_feature_flags",ej="$feature_flag_payloads",eH=function(e){var t,n={},r=m(function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}(e||{}));try{for(r.s();!(t=r.n()).done;){var i=p(t.value,2),o=i[0],s=i[1];s&&(n[o]=s)}}catch(e){r.e(e)}finally{r.f()}return n},eL=function(){function e(t){s(this,e),this.instance=t,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return u(e,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(eS),t=this.instance.get_property(eN);if(!t)return e||{};for(var n=N({},e),r=Object.keys(t),i=0;i<r.length;i++)!1===t[r[i]]?delete n[r[i]]:n[r[i]]=t[r[i]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(ej)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;this.setReloadingPaused(!0);var t=this.instance.config.token,n=this.instance.get_property(ex),r=this.instance.get_property(eP),i=Q(JSON.stringify({token:t,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:n,group_properties:r,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0}));this.instance._send_request(this.instance.config.api_host+"/decide/?v=3",{data:i},{method:"POST"},this.instance._prepare_callback(function(t){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(t),e.setReloadingPaused(!1),e._startReloadTimer()}))}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var n,r=this.getFlagVariants()[e],i="".concat(r),o=this.instance.get_property(eI)||{};return!t.send_event&&"send_event"in t||e in o&&o[e].includes(i)||(Array.isArray(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register(c({},eI,o)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r})),r}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.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)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){if(this.instance.persistence){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,u={};if(o)for(var l=0;l<o.length;l++)u[o[l]]=!0;t&&t.register((c(a={},eD,o),c(a,eS,u),a))}else{var d,f=o,h=s;e.errorsWhileComputingFlags&&(f=i(i({},n),f),h=i(i({},r),h)),t&&t.register((c(d={},eD,Object.keys(eH(f))),c(d,eS,f||{}),c(d,ej,h||{}),d))}}})(e,this.instance.persistence,t,n),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return A.unintializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,!1===e)this.instance.persistence.unregister(eN);else if(Array.isArray(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(c({},eN,t))}else this.instance.persistence.register(c({},eN,e))}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks();e(n.flags,n.flagVariants)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){var n,r,o=c({},"$feature_enrollment/".concat(e),t);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:o}),this.setPersonPropertiesForFlags(o,!1);var s=i(i({},this.getFlagVariants()),{},c({},e,t));null===(n=this.instance.persistence)||void 0===n||n.register((c(r={},eD,Object.keys(eH(s))),c(r,eS,s),r)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(eE);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.config.api_host,"/api/early_access_features/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var r,i=n.earlyAccessFeatures;return null===(r=t.instance.persistence)||void 0===r||r.register(c({},eE,i)),e(i)})}},{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(ex)||{};this.instance.register(c({},ex,i(i({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(ex)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(eP)||{};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(c({},eP,i(i({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(eP)||{};this.instance.register(c({},eP,i(i({},t),{},c({},e,{}))))}else this.instance.unregister(eP)}}]),e}(),eB=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,eq={is_supported:function(){return!0},error:function(e){A.error("cookieStore error: "+e)},get:function(e){try{for(var t=e+"=",n=document.cookie.split(";").filter(function(e){return e.length}),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch(e){}return null},parse:function(e){var t;try{t=JSON.parse(eq.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){try{var o="",s="",a="";if(r){var u=document.location.hostname.match(eB),c=u?u[0]:"";o=c?"; domain=."+c:""}if(n){var l=new Date;l.setTime(l.getTime()+24*n*36e5),s="; expires="+l.toUTCString()}i&&(a="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+o+a;return document.cookie=d,d}catch(e){return}},remove:function(e,t){try{eq.set(e,"",-1,t)}catch(e){return}}},eU=null,eV={is_supported:function(){if(null!==eU)return eU;var e=!0;if("undefined"!=typeof window)try{var t="__mplssupport__";eV.set(t,"xyz"),'"xyz"'!==eV.get(t)&&(e=!1),eV.remove(t)}catch(t){e=!1}else e=!1;return e||A.error("localStorage unsupported; falling back to cookie store"),eU=e,e},error:function(e){A.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(e){eV.error(e)}return null},parse:function(e){try{return JSON.parse(eV.get(e))||{}}catch(e){}return null},set:function(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){eV.error(e)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(e){eV.error(e)}}},eG=["distinct_id",ek],ez=i(i({},eV),{},{parse:function(e){try{var t={};try{t=eq.parse(e)||{}}catch(e){}var n=N(t,JSON.parse(eV.get(e)||"{}"));return eV.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{eV.set(e,t);var o={};eG.forEach(function(e){t[e]&&(o[e]=t[e])}),Object.keys(o).length&&eq.set(e,o,n,r,i)}catch(e){eV.error(e)}},remove:function(e,t){try{window.localStorage.removeItem(e),eq.remove(e,t)}catch(e){eV.error(e)}}}),eW={},eY={is_supported:function(){return!0},error:function(e){A.error("memoryStorage error: "+e)},get:function(e){return eW[e]||null},parse:function(e){return eW[e]||null},set:function(e,t){eW[e]=t},remove:function(e){delete eW[e]}},eQ=null,eJ={is_supported:function(){if(null!==eQ)return eQ;if(eQ=!0,"undefined"!=typeof window)try{var e="__support__";eJ.set(e,"xyz"),'"xyz"'!==eJ.get(e)&&(eQ=!1),eJ.remove(e)}catch(e){eQ=!1}else eQ=!1;return eQ},error:function(e){b.DEBUG&&A.error("sessionStorage error: ",e)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(e){eJ.error(e)}return null},parse:function(e){try{return JSON.parse(eJ.get(e))||null}catch(e){}return null},set:function(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){eJ.error(e)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(e){eJ.error(e)}}},eX=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],eZ=function(){function e(t){s(this,e);var n="";t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=t.custom_campaign_params||[],t.persistence_name?this.name="ph_"+t.persistence_name:this.name="ph_"+n+"_posthog",-1===eX.indexOf(t.persistence.toLowerCase())&&(A.critical("Unknown persistence type "+t.persistence+"; falling back to cookie"),t.persistence="cookie");var r=t.persistence.toLowerCase();"localstorage"===r&&eV.is_supported()?this.storage=eV:"localstorage+cookie"===r&&ez.is_supported()?this.storage=ez:"sessionstorage"===r&&eJ.is_supported()?this.storage=eJ:this.storage="memory"===r?eY:eq,this.user_state="anonymous",this.load(),this.update_config(t),this.save()}return u(e,[{key:"properties",value:function(){var e={};return D(this.props,function(t,n){if(n===eS&&"object"===o(t))for(var r,i=Object.keys(t),s=0;s<i.length;s++)e["$feature/".concat(i[s])]=t[i[s]];else r=!1,(null===eR?r:R&&eR.indexOf===R?-1!=eR.indexOf(n):(D(eR,function(e){if(r||(r=e===n))return T}),r))||(e[n]=t)}),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=N({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var r=this;if(B(e)){void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n;var i=!1;if(D(e,function(e,n){r.props.hasOwnProperty(n)&&r.props[n]!==t||(r.props[n]=e,i=!0)}),i)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(B(e)){this.expire_days=void 0===t?this.default_expiry:t;var r=!1;if(D(e,function(t,i){e.hasOwnProperty(i)&&n.props[i]!==t&&(n.props[i]=t,r=!0)}),r)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(en.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(en.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||en.referrer(),$referring_domain:this.props.$referring_domain||en.referringDomain()})}},{key:"get_referrer_info",value:function(){return W({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return D(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[ev]||{};n[e]=t,this.props[ev]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[ev]||{})[e];return U(t)||(delete this.props[ev][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[eO]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[eO]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[e$]||{}}},{key:"set_quota_limits",value:function(e){this.props[e$]=e,this.save()}}]),e}(),eK=u(function e(t){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),c(this,"bucketSize",100),c(this,"refillRate",10),c(this,"mutationBuckets",{}),c(this,"loggedTracker",{}),c(this,"refillBuckets",function(){Object.keys(i.mutationBuckets).forEach(function(e){i.mutationBuckets[e]=i.mutationBuckets[e]+i.refillRate,i.mutationBuckets[e]>=i.bucketSize&&delete i.mutationBuckets[e]})}),c(this,"getNodeOrRelevantParent",function(e){var t=i.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var n=t.closest("svg");if(n)return[i.rrweb.mirror.getId(n),n]}return[e,t]}),c(this,"numberOfChanges",function(e){var t,n,r,i,o,s,a,u;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(r=null===(i=e.attributes)||void 0===i?void 0:i.length)&&void 0!==r?r:0)+(null!==(o=null===(s=e.texts)||void 0===s?void 0:s.length)&&void 0!==o?o:0)+(null!==(a=null===(u=e.adds)||void 0===u?void 0:u.length)&&void 0!==a?a:0)}),c(this,"throttleMutations",function(e){if(3!==e.type||0!==e.data.source)return e;var t=e.data,n=i.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter(function(e){var t,n,r,o=p(i.getNodeOrRelevantParent(e.id),2),s=o[0],a=o[1];return 0!==i.mutationBuckets[s]&&(i.mutationBuckets[s]=null!==(t=i.mutationBuckets[s])&&void 0!==t?t:i.bucketSize,i.mutationBuckets[s]=Math.max(i.mutationBuckets[s]-1,0),0===i.mutationBuckets[s]&&(i.loggedTracker[s]||(i.loggedTracker[s]=!0,null===(n=(r=i.options).onBlockedNode)||void 0===n||n.call(r,s,a))),e)}));var r=i.numberOfChanges(t);return 0!==r||n===r?e:void 0}),this.rrweb=t,this.options=o,this.refillRate=null!==(n=this.options.refillRate)&&void 0!==n?n:this.refillRate,this.bucketSize=null!==(r=this.options.bucketSize)&&void 0!==r?r:this.bucketSize,setInterval(function(){i.refillBuckets()},1e3)}),e0=((eC=e0||{})[eC.DomContentLoaded=0]="DomContentLoaded",eC[eC.Load=1]="Load",eC[eC.FullSnapshot=2]="FullSnapshot",eC[eC.IncrementalSnapshot=3]="IncrementalSnapshot",eC[eC.Meta=4]="Meta",eC[eC.Custom=5]="Custom",eC[eC.Plugin=6]="Plugin",eC);(t$=eM||(eM={}))[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";var e1=[eM.MouseMove,eM.MouseInteraction,eM.Scroll,eM.ViewportResize,eM.Input,eM.TouchMove,eM.MediaInteraction,eM.Drag],e2=function(){function e(t){var n=this;s(this,e),c(this,"lastActivityTimestamp",Date.now()),c(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 u(e,[{key:"getSessionManager",value:function(){if(this.instance.sessionManager)return this.instance.sessionManager;A.error("Session recording started without valid sessionManager")}},{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(ey),t=!this.instance.config.disable_session_recording;return e&&t}},{key:"isConsoleLogCaptureEnabled",value:function(){var e=!!this.instance.get_property(eb),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"getRecordingVersion",value:function(){var e,t=this.instance.get_property(ew);return(null===(e=this.instance.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((c(o={},ey,!!e.sessionRecording),c(o,eb,null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled),c(o,ew,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:"log",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:G()})}},{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,t=this.getSessionManager();if(t&&void 0!==Object.assign&&!this.captureStarted&&!this.instance.config.disable_session_recording){this.captureStarted=!0,t.checkAndGetSessionAndWindowId();var n="v2"===this.getRecordingVersion()?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.getRecordingVersion()?et(this.instance.config.api_host+"/static/".concat(n,"?v=").concat(b.LIB_VERSION),function(t){if(t)return A.error("Could not load ".concat(n),t);e._onScriptLoaded()}):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==e1.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.getSessionManager();if(t){var n=this._isInteractiveEvent(e);if(n||this.isIdle||e.timestamp-this.lastActivityTimestamp>3e5&&(this.isIdle=!0),n&&(this.lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryTakeFullSnapshot())),!this.isIdle){var r=t.checkAndGetSessionAndWindowId(!n,e.timestamp),i=r.windowId,o=r.sessionId;-1!==[2,4].indexOf(e.type)||this.windowId===i&&this.sessionId===o||this._tryTakeFullSnapshot(),this.windowId=i,this.sessionId=o}}}},{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 A.error("Error taking full snapshot.",e),!1}}},{key:"_onScriptLoaded",value:function(){var e,t=this,n={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 r=this.instance.config.session_recording,o=0,s=Object.entries(r||{});o<s.length;o++){var a=p(s[o],2),u=a[0],c=a[1];u in n&&(n[u]=c)}this.rrwebRecord?(this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new eK(this.rrwebRecord,{onBlockedNode:function(e,n){var r="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");A.log(r,{node:n}),t.log("[PostHog Recorder] "+r,"warn")}}),this.stopRrweb=this.rrwebRecord(i({emit:function(e){t.onRRwebEmit(e)},plugins:window.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled()?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},n)),this.instance._addCaptureHook(function(e){try{if("$pageview"===e){var n,r=t._maskUrl(window.location.href);if(!r)return;null===(n=t.rrwebRecord)||void 0===n||n.addCustomEvent("$pageview",{href:r})}}catch(e){A.error("Could not add $pageview to rrweb session",e)}}),this.lastActivityTimestamp=Date.now(),this.isIdle=!1):A.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"onRRwebEmit",value:function(e){if(e&&"object"===o(e)){if(e.type===e0.Meta){var t=this._maskUrl(e.data.href);if(!t)return;e.data.href=t}var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var r=function(e){var t=JSON.stringify(e);if(t.length>5e6){var n,r=m(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;n<e.data.payload.payload.length;n++)e.data.payload.payload[n]&&e.data.payload.payload[n].length>2e3?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}(n)),i=r.event,s=r.size;if(this._updateWindowAndSessionIds(i),!this.isIdle){var a={$snapshot_bytes:s,$snapshot_data:i,$session_id:this.sessionId,$window_id:this.windowId};this.emit?this._captureSnapshotBuffered(a):this.snapshots.push(a)}}}}},{key:"_maskUrl",value:function(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var n,r={url:e};return null===(n=r=t.maskNetworkRequestFn(r))||void 0===n?void 0:n.url}return e}},{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:"recordings",_metrics:{rrweb_full_snapshot:2===e.$snapshot_data.type}})}}]),e}(),e3={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},e5=["first-input","navigation","paint","resource"],e6=["/s/","/e/"],e8=function(){function e(t){s(this,e),c(this,"_forceAllowLocalhost",!1),this.instance=t}return u(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(!O.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 e5.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 A.log("PostHog Peformance observer not started because we are on localhost.")}else A.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.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.config.api_host)){var t=e.name.replace(this.instance.config.api_host,"");if(e6.find(function(e){return 0===t.indexOf(e)}))return}var n={url:e.name},r=this.instance.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[e3.timeOrigin]=s,o[e3.timestamp]=Math.floor(s+e.startTime),e3)void 0!==i[a]&&(o[e3[a]]=i[a]);if(this.capturePerformanceEvent(o),e4(e)){var u,l=m(e.serverTiming||[]);try{for(l.s();!(u=l.n()).done;){var d,f=u.value;this.capturePerformanceEvent((c(d={},e3.timeOrigin,s),c(d,e3.timestamp,Math.floor(s+e.startTime)),c(d,e3.name,f.name),c(d,e3.duration,f.duration),c(d,e3.entryType,"serverTiming"),d))}}catch(e){l.e(e)}finally{l.f()}}}}},{key:"capturePerformanceEvent",value:function(e){var t,n=e[e3.timestamp];null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"posthog/network@1",payload:e},timestamp:n})}}]),e}(),e4=function(e){return"navigation"===e.entryType||"resource"===e.entryType},e7=function(){function e(t){s(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return u(e,[{key:"call",value:function(){var e=this,t=Q(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(ex),group_properties:this.instance.get_property(eP),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0}));this.instance._send_request("".concat(this.instance.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,o=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),0!==(null==e?void 0:e.status)){if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){o.parseDecideResponse(e)},500);if(this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),eA.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.config.advanced_disable_feature_flags_on_first_load||this.instance.featureFlags.receivedFeatureFlags(e),this.instance.compression={},e.supportedCompression&&!this.instance.config.disable_compression){var s,a={},u=m(e.supportedCompression);try{for(u.s();!(s=u.n()).done;)a[s.value]=!0}catch(e){u.e(e)}finally{u.f()}this.instance.compression=a}var c=null===(i=window)||void 0===i?void 0:i.extendPostHogWithSurveys;if(e.surveys&&!c&&et(this.instance.config.api_host+"/static/surveys.js",function(e){if(e)return console.error("Could not load surveys script",e);window.extendPostHogWithSurveys(o.instance)}),e.siteApps){if(this.instance.config.opt_in_site_apps){var l,d=this.instance.config.api_host,f=m(e.siteApps);try{for(f.s();!(l=f.n()).done;)(function(){var e=l.value,t=e.id,n=e.url,r=[d,"/"===d[d.length-1]&&"/"===n[0]?n.substring(1):n].join("");window["__$$ph_site_app_".concat(t)]=o.instance,et(r,function(e){e&&console.error("Error while initializing PostHog app with config id ".concat(t),e)})})()}catch(e){f.e(e)}finally{f.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}(),e9=["https://app.posthog.com","https://eu.posthog.com"],te=["source"],tt=function(){function e(t){s(this,e),this.instance=t}return u(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=K(e.hash,"__posthog")||K(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.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.config.api_host,r=3e5*Math.floor(Date.now()/3e5),o="".concat(n).concat(n.endsWith("/")?"":"/","static/toolbar.js?t=").concat(r),s=!e9.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,a=i(i({token:this.instance.config.token},e),{},{apiURL:n},s?{instrument:!1}:{});a.source;var u=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<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,te);return window.localStorage.setItem("_postHogToolbarParams",JSON.stringify(u)),et(o,function(e){e?A.error("Failed to load toolbar",e):(window.ph_load_toolbar||window.ph_load_editor)(a,t.instance)}),ee(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 tn(e,t){tl(!0,e,t)}function tr(e,t){tl(!1,e,t)}function ti(e,t){return"1"===tc(e,t)}function to(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||x,n=t.navigator||{},r=!1;return D([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(e){L([!0,1,"1","yes"],e)&&(r=!0)}),r}return!1}(t)||"0"===tc(e,t)}function ts(e,t){ta(t=t||{}).remove(tu(e,t),!!t.crossSubdomainCookie)}function ta(e){return"localStorage"===(e=e||{}).persistenceType?eV:"localStorage+cookie"===e.persistenceType?ez:eq}function tu(e,t){return((t=t||{}).persistencePrefix||"__ph_opt_in_out_")+e}function tc(e,t){return ta(t).get(tu(e,t))}function tl(e,t,n){var r;V(t)&&t.length?(ta(n=n||{}).set(tu(t,n),e?1:0,(r=n.cookieExpiration,"[object Number]"==S.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 td=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 u(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}(),tf=function(e){l(n,td);var t=h(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;return s(this,n),(r=t.call(this,i)).handlePollRequest=e,r}return u(n,[{key:"enqueue",value:function(e,t,n){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;D(o,function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp}),e.handlePollRequest(i,o,s)})(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:"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(g(n.filter(function(e){return 0===e.url.indexOf("/e")})),g(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 D(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}(),th=Uint8Array,tp=Uint16Array,tg=Uint32Array,t_=new th([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]),tv=new th([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]),tm=new th([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ty=function(e,t){for(var n=new tp(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new tg(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},tb=ty(t_,2),tw=tb[0],tk=tb[1];tw[28]=258,tk[258]=28;for(var tS=ty(tv,0)[1],tE=new tp(32768),tx=0;tx<32768;++tx){var tP=(43690&tx)>>>1|(21845&tx)<<1;tP=(61680&(tP=(52428&tP)>>>2|(13107&tP)<<2))>>>4|(3855&tP)<<4,tE[tx]=((65280&tP)>>>8|(255&tP)<<8)>>>1}var tF=function(e,t,n){for(var r=e.length,i=0,o=new tp(t);i<r;++i)++o[e[i]-1];var s,a=new tp(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new tp(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,f=d|(1<<l)-1;d<=f;++d)s[tE[d]>>>u]=c}else for(s=new tp(r),i=0;i<r;++i)s[i]=tE[a[e[i]-1]++]>>>15-e[i];return s},tI=new th(288);for(tx=0;tx<144;++tx)tI[tx]=8;for(tx=144;tx<256;++tx)tI[tx]=9;for(tx=256;tx<280;++tx)tI[tx]=7;for(tx=280;tx<288;++tx)tI[tx]=8;var tO=new th(32);for(tx=0;tx<32;++tx)tO[tx]=5;var t$,tR,tT=tF(tI,9,0),tA=tF(tO,5,0),tC=function(e){return(e/8>>0)+(7&e&&1)},tM=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof tp?tp:e instanceof tg?tg:th)(n-t);return r.set(e.subarray(t,n)),r},tD=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},tN=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},tj=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new th(0),0];if(1==i){var s=new th(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],c=0,l=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};l!=i-1;)a=n[n[c].f<n[d].f?c++:d++],u=n[c!=l&&n[c].f<n[d].f?c++:d++],n[l++]={s:-1,f:a.f+u.f,l:a,r:u};var f=o[0].s;for(r=1;r<i;++r)o[r].s>f&&(f=o[r].s);var h=new tp(f+1),p=tH(n[l-1],h,0);if(p>t){r=0;var g=0,_=p-t,v=1<<_;for(o.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r<i;++r){var m=o[r].s;if(!(h[m]>t))break;g+=v-(1<<p-h[m]),h[m]=t}for(g>>>=_;g>0;){var y=o[r].s;h[y]<t?g-=1<<t-h[y]++-1:++r}for(;r>=0&&g;--r){var b=o[r].s;h[b]==t&&(--h[b],++g)}p=t}return[new th(h),p]},tH=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},tL=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tp(++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]},tB=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},tq=function(e,t,n){var r=n.length,i=tC(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},tU=function(e,t,n,r,i,o,s,a,u,c,l){tD(t,l++,n),++i[256];for(var d=tj(i,15),f=d[0],h=d[1],p=tj(o,15),g=p[0],_=p[1],v=tL(f),m=v[0],y=v[1],b=tL(g),w=b[0],k=b[1],S=new tp(19),E=0;E<m.length;++E)S[31&m[E]]++;for(E=0;E<w.length;++E)S[31&w[E]]++;for(var x=tj(S,7),P=x[0],F=x[1],I=19;I>4&&!P[tm[I-1]];--I);var O,$,R,T,A=c+5<<3,C=tB(i,tI)+tB(o,tO)+s,M=tB(i,f)+tB(o,g)+s+14+3*I+tB(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A<=C&&A<=M)return tq(t,l,e.subarray(u,u+c));if(tD(t,l,1+(M<C)),l+=2,M<C){O=tF(f,h,0),$=f,R=tF(g,_,0),T=g;var D=tF(P,F,0);for(tD(t,l,y-257),tD(t,l+5,k-1),tD(t,l+10,I-4),l+=14,E=0;E<I;++E)tD(t,l+3*E,P[tm[E]]);l+=3*I;for(var N=[m,w],j=0;j<2;++j){var H=N[j];for(E=0;E<H.length;++E){var L=31&H[E];tD(t,l,D[L]),l+=P[L],L>15&&(tD(t,l,H[E]>>>5&127),l+=H[E]>>>12)}}}else O=tT,$=tI,R=tA,T=tO;for(E=0;E<a;++E)if(r[E]>255){tN(t,l,O[(L=r[E]>>>18&31)+257]),l+=$[L+257],L>7&&(tD(t,l,r[E]>>>23&31),l+=t_[L]);var B=31&r[E];tN(t,l,R[B]),l+=T[B],B>3&&(tN(t,l,r[E]>>>5&8191),l+=tv[B])}else tN(t,l,O[r[E]]),l+=$[r[E]];return tN(t,l,O[256]),l+$[256]},tV=new tg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tG=new th(0),tz=function(){for(var e=new tg(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<t.length;++r)n=tz[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},tY=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&&tY(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)}};(t5=tR||(tR={})).GZipJS="gzip-js",t5.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=m(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 u=e.indexOf("?")>-1?"&":"?";return e+u+function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return D(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;return new Blob([e(t,{method:"POST"})],{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.callback,s=e.retriesPerformedSoFar,a=e.retryQueue,u=e.onXHRError,c=e.timeout,l=e.onResponse,d=new XMLHttpRequest;d.open(i.method||"GET",t,!0);var f=tX(n,i);D(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===c?6e4:c,d.withCredentials=!0,d.onreadystatechange=function(){if(4===d.readyState){if(null==l||l(d),200===d.status){if(o){var e;try{e=JSON.parse(d.responseText)}catch(e){return void A.error(e)}o(e)}}else"function"==typeof u&&u(d),(d.status<400||d.status>500)&&a.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(s||0)+1,callback:o}),null==o||o({status:0})}},d.send(f)},tK=function(e){l(n,td);var t=h(n);function n(e,r){var i;return s(this,n),(i=t.call(this)).isPolling=!1,i.queue=[],i.areWeOnline=!0,i.onXHRError=e,i.rateLimiter=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 u(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.retryAt<e});if(t.length>0){this.queue=this.queue.filter(function(t){return t.retryAt>=e});var n,r=m(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=m(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestData,r=n.url,o=n.data,s=n.options;if(this.rateLimiter.isRateLimited(s._batchKey))b.DEBUG&&console.warn("[PostHog RetryQueue] is quota limited. Dropping request.");else 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,s=e.retriesPerformedSoFar;this.rateLimiter.isRateLimited(r._batchKey)||tZ({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:s||0,callback:o,retryQueue:this,onXHRError:this.onXHRError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),n}();/**
 * 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 t0="0123456789abcdef",t1=function(){function e(t){if(s(this,e),this.bytes=t,16!==t.length)throw TypeError("not 128-bit length")}return u(e,[{key:"toString",value:function(){for(var e="",t=0;t<this.bytes.length;t++)e=e+t0.charAt(this.bytes[t]>>>4)+t0.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");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}(),t2=function(){function e(){s(this,e),c(this,"timestamp",0),c(this,"counter",0),c(this,"random",new t8)}return u(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 t1.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}(),t3=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<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};"undefined"!=typeof crypto&&crypto.getRandomValues&&(t3=function(e){return crypto.getRandomValues(e)});var t5,t6,t8=function(){function e(){s(this,e),c(this,"buffer",new Uint32Array(8)),c(this,"cursor",1/0)}return u(e,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(t3(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),t4=function(){return t7().toString()},t7=function(){return(t6||(t6=new t2)).generate()},t9=function(){function e(t,n){s(this,e),c(this,"_sessionIdChangedHandlers",[]),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null;var r=t.persistence_name||t.token,i=t.session_idle_timeout_seconds||1800;if("number"!=typeof i?(console.warn("[PostHog] session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),i=1800):i>1800?console.warn("[PostHog] session_idle_timeout_seconds cannot be  greater than 30 minutes. Using 30 minutes instead."):i<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(i,60),1800),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var o=eJ.parse(this._window_id_storage_key),a=eJ.parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:eJ.remove(this._window_id_storage_key),eJ.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return u(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&&eJ.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&eJ.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?eJ.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(c({},ek,[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[ek];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()&&eJ.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=p(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],s=this._getWindowId(),a=o&&o>0&&Math.abs(t-o)>864e5,u=!1;!i||!e&&Math.abs(t-r)>this._sessionTimeoutMs||a?(i=t4(),s=t4(),o=t,u=!0):s||(s=t4(),u=!0);var c=0===o?(new Date).getTime():o;return this._setWindowId(s),this._setSessionId(i,0===r||!e||a?t:r,c),u&&this._sessionIdChangedHandlers.forEach(function(e){return e(i,s)}),{sessionId:i,windowId:s,sessionStartTimestamp:c}}}]),e}(),ne=u(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,u,c,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===(u=d[0])||void 0===u?void 0:u.value,$sentry_exception_type:null===(c=d[0])||void 0===c?void 0:c.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})}}),nt=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")}}},nn=function(){function e(){var t=this;s(this,e),c(this,"_hasSeenPageView",!1),c(this,"_updateScrollData",function(){t._pageViewData||(t._pageViewData=t._createPageViewData());var e,n,r,i,o=t._pageViewData,s=t._scrollY(),a=t._scrollHeight(),u=t._contentY(),c=t._contentHeight();o.lastScrollY=s,o.maxScrollY=Math.max(s,null!==(e=o.maxScrollY)&&void 0!==e?e:0),o.maxScrollHeight=Math.max(a,null!==(n=o.maxScrollHeight)&&void 0!==n?n:0),o.lastContentY=u,o.maxContentY=Math.max(u,null!==(r=o.maxContentY)&&void 0!==r?r:0),o.maxContentHeight=Math.max(c,null!==(i=o.maxContentHeight)&&void 0!==i?i:0)})}return u(e,[{key:"_createPageViewData",value:function(){return{pathname:x.location.pathname}}},{key:"doPageView",value:function(){var e,t;return this._hasSeenPageView?(t=this._pageViewData,this._pageViewData=this._createPageViewData()):(this._hasSeenPageView=!0,t=void 0,this._pageViewData||(this._pageViewData=this._createPageViewData())),setTimeout(this._updateScrollData,0),i({$prev_pageview_pathname:null===(e=t)||void 0===e?void 0:e.pathname},this._calculatePrevPageScrollProperties(t))}},{key:"doPageLeave",value:function(){var e=this._pageViewData;return i({$prev_pageview_pathname:null==e?void 0:e.pathname},this._calculatePrevPageScrollProperties(e))}},{key:"_calculatePrevPageScrollProperties",value:function(e){if(!e||null==e.maxScrollHeight||null==e.lastScrollY||null==e.maxScrollY||null==e.maxContentHeight||null==e.lastContentY||null==e.maxContentY)return{};var t=e.maxScrollHeight,n=e.lastScrollY,r=e.maxScrollY,i=e.maxContentHeight,o=e.lastContentY,s=e.maxContentY;return t=Math.ceil(t),n=Math.ceil(n),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),s=Math.ceil(s),{$prev_pageview_last_scroll:n,$prev_pageview_last_scroll_percentage:t<=1?1:nr(n/t,0,1),$prev_pageview_max_scroll:r,$prev_pageview_max_scroll_percentage:t<=1?1:nr(r/t,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:i<=1?1:nr(o/i,0,1),$prev_pageview_max_content:s,$prev_pageview_max_content_percentage:i<=1?1:nr(s/i,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){x.addEventListener("scroll",this._updateScrollData),x.addEventListener("scrollend",this._updateScrollData),x.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){x.removeEventListener("scroll",this._updateScrollData),x.removeEventListener("scrollend",this._updateScrollData),x.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollHeight",value:function(){return Math.max(0,x.document.documentElement.scrollHeight-x.document.documentElement.clientHeight)}},{key:"_scrollY",value:function(){return x.scrollY||x.pageYOffset||x.document.documentElement.scrollTop||0}},{key:"_contentHeight",value:function(){return x.document.documentElement.scrollHeight||0}},{key:"_contentY",value:function(){var e=x.document.documentElement.clientHeight||0;return this._scrollY()+e}}]),e}();function nr(e,t,n){return Math.max(t,Math.min(e,n))}function ni(e){return"undefined"!=typeof Event&&no(e,Event)}function no(e,t){try{return e instanceof t}catch(e){return!1}}function ns(e){return null===e||"object"!==o(e)&&"function"!=typeof e}function na(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function nu(e){return na(e,"DOMError")}var nc=/\(error: (.*)\)/;function nl(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 nd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nf=/\((\S*)(?::(\d+))(?::(\d+))\)/,nh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,np=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ng=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,n_=(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],o=e.split("\n"),s=t;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var u=nc.test(a)?a.replace(nc,"$1"):a;if(!u.match(/\S*Error: /)){var c,l=m(r);try{for(l.s();!(c=l.n()).done;){var d=(0,c.value)(u);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=nd.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){var n=nf.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}var r=p(nv(t[1]||"?",t[2]),2),i=r[0];return nl(r[1],i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,function(e){var t=nh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=np.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=p(nv(i,r),2);return i=o[0],nl(r=o[1],i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,function(e){var t=ng.exec(e);return t?nl(t[2],t[1]||"?",+t[3],t[4]?+t[4]:void 0):void 0}]]),nv=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]},nm=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ny=/Minified React error #\d+;/i;function nb(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(ny.test(e.message))return 1}return 0}(e);try{return n_(t,n)}catch(e){}return[]}(e);return{$exception_type:e.name,$exception_message:e.message,$exception_stack_trace_raw:JSON.stringify(t)}}function nw(e){var t=p(e,5),n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],u={};if(void 0===a&&"string"==typeof n){var c="Error",l=n,d=n.match(nm);d&&(c=d[1],l=d[2]),u={$exception_type:c,$exception_message:l}}var f=a||n;if(nu(f)||na(f,"DOMException")){if("stack"in f)u=nb(f);else{var h=f.name||(nu(f)?"DOMError":"DOMException"),g=f.message?"".concat(h,": ").concat(f.message):h;(u={$exception_type:"Error",$exception_message:g}).$exception_type=nu(f)?"DOMError":"DOMException",u.$exception_message=u.$exception_message||g}"code"in f&&(u.$exception_DOMException_code="".concat(f.code))}else na(f,"ErrorEvent")&&f.error?u=nb(f.error):function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return no(e,Error)}}(f)?u=nb(f):na(f,"Object")||ni(f)?(u={$exception_type:ni(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:(u.$exception_type=u.$exception_type||"Error",u.$exception_message=u.$exception_message||f,u.$exception_is_synthetic=!0);return i(i(i(i({},u),{},{$exception_type:u.$exception_type||"UnknownErrorType",$exception_message:u.$exception_message||""},r?{$exception_source:r}:{}),o?{$exception_lineno:o}:{}),s?{$exception_colno:s}:{})}var nk,nS,nE,nx=function(){function e(t){s(this,e),c(this,"originalOnErrorHandler",void 0),c(this,"originalOnUnhandledRejectionHandler",void 0),c(this,"errorsToIgnore",[]),this.instance=t}return u(e,[{key:"debugLog",value:function(){if(this.instance.config.debug){for(var e,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["PostHog.js [PostHog.ExceptionObserver]"].concat(n))}}},{key:"startCapturing",value:function(){var e;if(this.isEnabled()&&(null===(e=x.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__))try{this.originalOnErrorHandler=x.onerror,x.onerror=(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.captureException(t),!!this.originalOnErrorHandler&&this.originalOnErrorHandler.apply(this,t)}).bind(this),x.onerror.__POSTHOG_INSTRUMENTED__=!0,this.originalOnUnhandledRejectionHandler=x.onunhandledrejection,x.onunhandledrejection=(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=function(e){var t=p(e,1)[0],n=t;try{"reason"in t?n=t.reason:"detail"in t&&"reason"in t.detail&&(n=t.detail.reason)}catch(e){}var r={};return(r=ns(n)?{$exception_message:"Non-Error promise rejection captured with value: ".concat(String(n))}:nw([n])).$exception_handled=!1,i(i({},r),{},{$exception_type:r.$exception_type="UnhandledRejection",$exception_message:r.$exception_message=r.$exception_message||t.reason||String(n)})}(t);return this.sendExceptionEvent(r),!this.originalOnUnhandledRejectionHandler||this.originalOnUnhandledRejectionHandler.apply(x,t)}).bind(this),x.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0}catch(e){console.error("PostHog failed to start exception autocapture",e),this.stopCapturing()}}},{key:"stopCapturing",value:function(){var e,t;void 0!==this.originalOnErrorHandler&&(x.onerror=this.originalOnErrorHandler,this.originalOnErrorHandler=null),null===(e=x.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,void 0!==this.originalOnUnhandledRejectionHandler&&(x.onunhandledrejection=this.originalOnUnhandledRejectionHandler,this.originalOnUnhandledRejectionHandler=null),null===(t=x.onunhandledrejection)||void 0===t||delete t.__POSTHOG_INSTRUMENTED__}},{key:"isCapturing",value:function(){var e;return!(null===(e=x.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}},{key:"isEnabled",value:function(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){var t=e.autocaptureExceptions;if(this.remoteEnabled=!!t,!ns(t)&&"errors_to_ignore"in t&&Array.isArray(t.errors_to_ignore)){var n=t.errors_to_ignore;this.errorsToIgnore=n.map(function(e){return new RegExp(e)})}this.isEnabled()?(this.startCapturing(),this.debugLog("Remote config for exception autocapture is enabled, starting",t)):this.debugLog("Remote config for exception autocapture is disabled, not starting",t)}},{key:"captureException",value:function(e,t){var n=nw(e);if(this.errorsToIgnore.some(function(e){return e.test(n.$exception_message||"")}))this.debugLog("Ignoring exception based on remote config",n);else{var r=i(i({},t),n),o=this.instance.config.ui_host||this.instance.config.api_host;n.$exception_personURL=o+"/person/"+this.instance.get_distinct_id(),this.sendExceptionEvent(r)}}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{transport:"XHR",method:"POST",endpoint:"/e/",_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),e}(),nP={icontains:function(e){return window.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},regex:function(e){var t;return t=window.location.href,!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(e)&&new RegExp(e).test(t)},exact:function(e){return window.location.href===e}},nF=function(){function e(t){s(this,e),this.instance=t}return u(e,[{key:"getSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(eF);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.config.api_host,"/api/surveys/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var r,i=n.surveys||[];return null===(r=t.instance.persistence)||void 0===r||r.register(c({},eF,i)),e(i)})}},{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,i,o=null===(t=e.conditions)||void 0===t||!t.url||nP[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),s=null===(i=e.conditions)||void 0===i||!i.selector||document.querySelector(e.conditions.selector);return o&&s}).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}(),nI=function(){function e(){var t=this;s(this,e),c(this,"limits",{}),c(this,"checkForLimiting",function(e){try{(JSON.parse(e.responseText).quota_limited||[]).forEach(function(e){A.log("[PostHog RateLimiter] ".concat(e||"events"," is quota limited.")),t.limits[e]=(new Date).getTime()+6e4})}catch(e){return void A.error(e)}})}return u(e,[{key:"isRateLimited",value:function(e){var t=this.limits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}();(y=nk||(nk={}))[y.INIT_MODULE=0]="INIT_MODULE",y[y.INIT_SNIPPET=1]="INIT_SNIPPET";var nO=function(){},n$={},nR="posthog",nT=x.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,nA=!nT&&-1===I.indexOf("MSIE")&&-1===I.indexOf("Mozilla"),nC=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==F||null===(e=F.location)||void 0===e||null===(t=e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:nO,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:!0,debug:!1,verbose:!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==x||null===(n=x.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_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!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:nO,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},nM=function(e,t,n,r){var i,o=n!==nR&&nE?n?nE[n]:void 0:nE,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&&nS===nk.INIT_MODULE)i=o;else{if(o&&!j(o))return void console.error("You have already initialized "+n);i=new nD}return i._init(e,t,n,a("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new e2(i),i.sessionRecording.startRecordingIfEnabled(),i.webPerformance=new e8(i),i.webPerformance.startObservingIfEnabled(),i.config.__preview_measure_pageview_stats&&i.pageViewManager.startMeasuringScrollPosition(),i.exceptionAutocapture=new nx(i),i.__autocapture=i.config.autocapture,eA._setIsAutocaptureEnabled(i),eA._isAutocaptureEnabled&&(i.__autocapture=i.config.autocapture,eA.enabledForProject(i.config.token,100,100)?eA.isBrowserSupported()?eA.init(i):(i.__autocapture=!1,A.log("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,A.log("Not in active bucket: disabling Automatic Event Collection."))),b.DEBUG=b.DEBUG||i.config.debug,void 0!==o&&j(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),a("syncCode")(i),i},nD=function(){function e(){var t=this;s(this,e),this.config=nC(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=ne,this.segmentIntegration=function(){return nt(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 eL(this),this.toolbar=new tt(this),this.pageViewManager=new nn,this.surveys=new nF(this),this.rateLimiter=new nI,this.people={set:function(e,n,r){var i="string"==typeof e?c({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i="string"==typeof e?c({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}}}return u(e,[{key:"init",value:function(e,t,n){if(U(n))console.error("You must name your new library: init(token, config, name)");else{if(n!==nR){var r=nM(e,t,n,function(e){nE[n]=e,e._loaded()});return nE[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 u,c={segmentRegister:!1,syncCode:!1},l=function(e){return function(){c[e]||(c[e]=!0,c.segmentRegister&&c.syncCode&&(null==a||a(r)))}};if(this.set_config(N({},nC(),o,{name:s,token:e,callback_fn:(s===nR?s:nR+"."+s)+"._jsc"})),this._jsc=function(){},(null!=x&&null!==(t=x.rrweb)&&void 0!==t&&t.record||null!=x&&x.rrwebRecord)&&(this.__loaded_recorder_version=null==x||null===(u=x.rrweb)||void 0===u?void 0:u.version),this.persistence=new eZ(this.config),this._requestQueue=new tf(this._handle_queued_event.bind(this)),this._retryQueue=new tK(this.config.on_xhr_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new t9(this.config,this.persistence),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new eZ(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,h=this.config.get_device_id(t4()),p=null!==(d=o.bootstrap)&&void 0!==d&&d.isIdentifiedID?h: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:p})}if(this._hasBootstrappedFeatureFlags()){var g,_,v=Object.keys((null===(g=o.bootstrap)||void 0===g?void 0:g.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},{}),m=Object.keys((null===(_=o.bootstrap)||void 0===_?void 0:_.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:m})}if(!this.get_distinct_id()){var y=this.config.get_device_id(t4());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_user_state("anonymous")}x.addEventListener&&x.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&this.capture("$pageview",{title:F.title},{send_instantly:!0}),e||(new e7(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.poll())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||M(this.__request_queue,function(t){e._send_request.apply(e,g(t))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(U(e))return null;if(nT)return function(n){e(n,t)};var n=this._jsc,r=""+Math.floor(1e8*Math.random()),i=this.config.callback_fn+"["+r+"]";return n[r]=function(i){delete n[r],e(i,t)},i}},{key:"_handle_unload",value:function(){var e,t;this.config.request_batching?(this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this.config.capture_pageview&&this.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||n$,nO)}},{key:"__compress_and_send_json_request",value:function(e,t,n,r){var o,s,a,u,c,l,d,f=p((this.compression[tR.GZipJS]?tR.GZipJS:tR.Base64)===tR.GZipJS?[(o=function(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new th(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;s<n;++s){if(i+5>r.length){var a=new th(i+8+(n-s<<1));a.set(r),r=a}var u=e.charCodeAt(s);u<128?o(u):(u<2048?o(192|u>>>6):(u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++s))>>>18),o(128|u>>>12&63)):o(224|u>>>12),o(128|u>>>6&63)),o(128|63&u))}return tM(r,0,i)}(t),s={mtime:0},a=tW(),u=o.length,a.p(o),d=(c=10+(s.filename&&s.filename.length+1||0),l=function(e,t,n,r,i,o){var s=e.length,a=new th(r+s+5*(1+Math.floor(s/7e3))+8),u=a.subarray(r,a.length-8),c=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d<s?c=tq(u,c,e.subarray(l,d)):(u[l]=o,c=tq(u,c,e.subarray(l,s)))}else{for(var f=tV[t-1],h=f>>>13,p=8191&f,g=(1<<n)-1,_=new tp(32768),v=new tp(g+1),m=Math.ceil(n/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new tg(25e3),k=new tp(288),S=new tp(32),E=0,x=0,P=(l=0,0),F=0,I=0;l<s;++l){var O=b(l),$=32767&l,R=v[O];if(_[$]=R,v[O]=$,F<=l){var T=s-l;if((E>7e3||P>24576)&&T>423){c=tU(e,u,0,w,k,S,x,P,I,l-I,c),P=E=x=0,I=l;for(var A=0;A<286;++A)k[A]=0;for(A=0;A<30;++A)S[A]=0}var C=2,M=0,D=p,N=$-R&32767;if(T>2&&O==b(l-N))for(var j=Math.min(h,T)-1,H=Math.min(32767,l),L=Math.min(258,T);N<=H&&--D&&$!=R;){if(e[l+C]==e[l+C-N]){for(var B=0;B<L&&e[l+B]==e[l+B-N];++B);if(B>C){if(C=B,M=N,B>j)break;var q=Math.min(N,B-2),U=0;for(A=0;A<q;++A){var V=l-N+A+32768&32767,G=V-_[V]+32768&32767;G>U&&(U=G,R=V)}}}N+=($=R)-(R=_[$])+32768&32767}if(M){w[P++]=268435456|tk[C]<<18|tS[M];var z=31&tk[C],W=31&tS[M];x+=t_[z]+tv[W],++k[257+z],++S[W],F=l+C,++E}else w[P++]=e[l],++k[e[l]]}}c=tU(e,u,o,w,k,S,x,P,I,l-I,c),o||(c=tq(u,c,tG))}return tM(a,0,r+tC(c)+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,c,8,!0)).length,tQ(l,s),tY(l,d-8,a.d()),tY(l,d-4,u),l),i(i({},n),{},{blob:!0,urlQueryArgs:{compression:tR.GZipJS}})]:[{data:Q(t)},n],2),h=f[0],g=f[1];this._send_request(e,h,g,r)}},{key:"_send_request",value:function(e,t,n,r){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(n._batchKey)){if(nA)this.__request_queue.push([e,t,n,r]);else{n=N({method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose},n||{}),nT||(n.method="GET");var o="sendBeacon"in x.navigator&&"sendBeacon"===n.transport;if(e=tJ(e,n.urlQueryArgs||{},{ip:this.config.ip}),o)try{x.navigator.sendBeacon(e,tX(t,i(i({},n),{},{sendBeacon:!0})))}catch(e){}else if(nT)try{tZ({url:e,data:t,headers:this.config.xhr_headers,options:n,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.config.on_xhr_error,onResponse:this.rateLimiter.checkForLimiting})}catch(e){console.error(e)}else{var s,a=F.createElement("script");a.type="text/javascript",a.async=!0,a.defer=!0,a.src=e;var u=F.getElementsByTagName("script")[0];null===(s=u.parentNode)||void 0===s||s.insertBefore(a,u)}}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];M(e,function(e){e&&(j(t=e[0])?o.push(e):"function"==typeof e?e.call(n):j(e)&&"alias"===t?r.push(e):j(e)&&-1!==t.indexOf("capture")&&"function"==typeof n[t]?o.push(e):i.push(e))});var s=function(e,t){M(e,function(e){if(j(e[0])){var n=t;D(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]:n$;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return A.unintializedWarning("posthog.capture");if(!function(e,t){var n=!1;try{var r=e.config.token,i=e.config.respect_dnt,o=e.config.opt_out_capturing_persistence_type,s=e.config.opt_out_capturing_cookie_prefix||void 0,a=e.config.window;r&&(n=to(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)){var r=(n=n||n$).transport;if(r&&(n.transport=r),U(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(o=this.config.custom_blocked_useragents,!X.concat(o).some(function(e){return I.includes?I.includes(e):-1!==I.indexOf(e)})){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var o,s,a,u,c,l={uuid:t4(),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(l.$set=n.$set,l.$set_once=n.$set_once),(s=l,a=n._noTruncate?null:this.config.properties_string_max_length,u=function(e,t){return t&&Y.indexOf(t)>-1?e:"string"==typeof e&&null!==a?e.slice(0,a):e},c=new Set,l=function e(t,n){var r;return t!==Object(t)?u?u(t,n):t:c.has(t)?void 0:(c.add(t),j(t)?(r=[],M(t,function(t){r.push(e(t))})):(r={},D(t,function(t,n){c.has(t)||(r[n]=e(t,n))})),r)}(s)).timestamp=n.timestamp||new Date;var d=i(i({},l.properties.$set),l.$set);q(d)||this.setPersonPropertiesForFlags(d),this.config.debug&&A.log("PostHog.js send",l);var f=JSON.stringify(l),h=this.config.api_host+(n.endpoint||"/e/"),p=n!==n$;return!this.config.request_batching||p&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(h,f,n):this._requestQueue.enqueue(h,l,n),this._invokeCaptureHooks(e,l),l}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),D(this.__captureHooks,function(t){return t(e)})}},{key:"_calculate_event_properties",value:function(e,t){if(!this.persistence||!this.sessionPersistence)return t;var n=this.persistence.remove_event_timer(e),r=i({},t);if(r.token=this.config.token,"$snapshot"===e){var o=i(i({},this.persistence.properties()),this.sessionPersistence.properties());return r.distinct_id=o.distinct_id,r}var s=en.properties();if(this.sessionManager){var a=this.sessionManager.checkAndGetSessionAndWindowId(),u=a.sessionId,c=a.windowId;r.$session_id=u,r.$window_id=c}if(this.config.__preview_measure_pageview_stats){var l={};"$pageview"===e?l=this.pageViewManager.doPageView():"$pageleave"===e&&(l=this.pageViewManager.doPageLeave()),r=N(r,l)}if("$pageview"===e&&(r.title=F.title),"$performance_event"===e){var d=this.persistence.properties();return r.distinct_id=d.distinct_id,r.$current_url=s.$current_url,r}if(void 0!==n){var f=(new Date).getTime()-n;r.$duration=parseFloat((f/1e3).toFixed(3))}r=N({},en.properties(),this.persistence.properties(),this.sessionPersistence.properties(),r);var h=this.config.property_blacklist;j(h)?D(h,function(e){delete r[e]}):console.error("Invalid value for property_blacklist config: "+h);var p=this.config.sanitize_properties;return p&&(r=p(r,e)),r}},{key:"register",value:function(e,t){var n;null===(n=this.persistence)||void 0===n||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var r;null===(r=this.persistence)||void 0===r||r.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}},{key:"unregister",value:function(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}},{key:"_register_single",value:function(e,t){this.register(c({},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){var t,n;return null!==(t=null===(n=this.sessionManager)||void 0===n?void 0:n.onSessionId(e))&&void 0!==t?t:function(){}}},{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(!this.__loaded||!this.persistence)return A.unintializedWarning("posthog.identify");if(e){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(e_)&&(this.unregister(e_),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||{},!1),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(eI))}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){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i(i({},r),{},c({},e,t))}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags(c({},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){if(!this.__loaded)return A.unintializedWarning("posthog.reset");var t,n,r,i,o=this.get_property("$device_id");null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),null===(r=this.persistence)||void 0===r||r.set_user_state("anonymous"),null===(i=this.sessionManager)||void 0===i||i.resetSessionId();var s=this.config.get_device_id(t4());this.register_once({distinct_id:s,$device_id:e?s:o},"")}},{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(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";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 u=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-a,0);o+="?t=".concat(u)}return o}},{key:"alias",value:function(e,t){return e===this.get_property(eg)?(A.critical("Attempting to create alias for existing People user - aborting."),-2):(U(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(e_,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,n,r=i({},this.config);B(e)&&(N(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),null===(t=this.persistence)||void 0===t||t.update_config(this.config),null===(n=this.sessionPersistence)||void 0===n||n.update_config(this.config),eV.is_supported()&&"true"===eV.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(b.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&r.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_property",value:function(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:nR;return t!==nR&&(t=nR+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.config.opt_out_capturing_persistence_type&&eV.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.config.opt_out_capturing_by_default||eq.get("ph_optout"))&&(eq.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.config.opt_out_persistence_by_default}))}},{key:"_gdpr_update_persistence",value:function(e){var t,n,r,i,o;if(e&&e.clear_persistence)r=!0;else{if(!e||!e.enable_persistence)return;r=!1}this.config.disable_persistence||(null===(t=this.persistence)||void 0===t?void 0:t.disabled)===r||null===(i=this.persistence)||void 0===i||i.set_disabled(r),this.config.disable_persistence||(null===(n=this.sessionPersistence)||void 0===n?void 0:n.disabled)===r||null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(r)}},{key:"_gdpr_call_func",value:function(e,t){return t=N({capture:this.capture.bind(this),persistence_type:this.config.opt_out_capturing_persistence_type,cookie_prefix:this.config.opt_out_capturing_cookie_prefix,cookie_expiration:this.config.cookie_expiration,cross_subdomain_cookie:this.config.cross_subdomain_cookie,secure_cookie:this.config.secure_cookie},t||{}),eV.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.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=N({enable_persistence:!0},e||{}),this._gdpr_call_func(tn,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=N({clear_persistence:!0},e||{});this._gdpr_call_func(tr,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(ti,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(to,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=N({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(ts,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(x.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(x.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<t.length;n++)e.prototype[t[n]]=z(e.prototype[t[n]])}(nD,["identify"]);var nN={},nj=(nS=nk.INIT_MODULE,(nE=new nD).init=function(e,t,n){if(n)return nE[n]||(nE[n]=nN[n]=nM(e||"",t||{},n,function(e){nE[n]=nN[n]=e,e._loaded()})),nE[n];var r=nE;return nN[nR]?r=nN[nR]:e&&(r=nM(e,t||{},nR,function(e){nN[nR]=e,e._loaded()}),nN[nR]=r),nE=r,nS===nk.INIT_SNIPPET&&(x[nR]=nE),D(nN,function(e,t){t!==nR&&(nE[t]=e)}),r},nE.init(),function(){function e(){e.done||(e.done=!0,nA=!1,D(nN,function(e){e._dom_loaded()}))}F.addEventListener&&("complete"===F.readyState?e():F.addEventListener("DOMContentLoaded",e,!1)),ee(x,"load",e,!0)}(),nE)}}]);