posthog-js 1.103.0 → 1.103.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/lib/src/autocapture-utils.d.ts +17 -0
- package/dist/lib/src/autocapture.d.ts +27 -0
- package/dist/lib/src/base-request-queue.d.ts +12 -0
- package/dist/lib/src/compression.d.ts +3 -0
- package/dist/lib/src/config.d.ts +5 -0
- package/dist/lib/src/constants.d.ts +22 -0
- package/dist/lib/src/decide.d.ts +8 -0
- package/dist/lib/src/extensions/cloud.d.ts +1 -0
- package/dist/lib/src/extensions/exception-autocapture/error-conversion.d.ts +26 -0
- package/dist/lib/src/extensions/exception-autocapture/index.d.ts +24 -0
- package/dist/lib/src/extensions/exception-autocapture/stack-trace.d.ts +31 -0
- package/dist/lib/src/extensions/exception-autocapture/type-checking.d.ts +10 -0
- package/dist/lib/src/extensions/rageclick.d.ts +10 -0
- package/dist/lib/src/extensions/replay/config.d.ts +9 -0
- package/dist/lib/src/extensions/replay/sessionrecording-utils.d.ts +67 -0
- package/dist/lib/src/extensions/replay/sessionrecording.d.ts +68 -0
- package/dist/lib/src/extensions/segment-integration.d.ts +44 -0
- package/dist/lib/src/extensions/sentry-integration.d.ts +30 -0
- package/dist/lib/src/extensions/surveys/surveys-utils.d.ts +24 -0
- package/dist/lib/src/extensions/surveys-widget.d.ts +14 -0
- package/dist/lib/src/extensions/surveys.d.ts +10 -0
- package/dist/lib/src/extensions/toolbar.d.ts +18 -0
- package/dist/lib/src/gdpr-utils.d.ts +70 -0
- package/dist/lib/src/loader-exception-autocapture.d.ts +2 -0
- package/dist/lib/src/loader-globals-full.d.ts +1 -0
- package/dist/lib/src/loader-globals.d.ts +1 -0
- package/dist/lib/src/loader-module.d.ts +5 -0
- package/dist/lib/src/loader-recorder-v2.d.ts +14 -0
- package/dist/lib/src/loader-recorder.d.ts +2 -0
- package/dist/lib/src/loader-surveys.d.ts +2 -0
- package/dist/lib/src/page-view.d.ts +42 -0
- package/dist/lib/src/posthog-core.d.ts +709 -0
- package/dist/lib/src/posthog-featureflags.d.ts +70 -0
- package/dist/lib/src/posthog-persistence.d.ts +56 -0
- package/dist/lib/src/posthog-surveys-types.d.ts +91 -0
- package/dist/lib/src/posthog-surveys.d.ts +9 -0
- package/dist/lib/src/rate-limiter.d.ts +5 -0
- package/dist/lib/src/request-queue.d.ts +10 -0
- package/dist/lib/src/retry-queue.d.ts +28 -0
- package/dist/lib/src/send-request.d.ts +6 -0
- package/dist/lib/src/session-props.d.ts +41 -0
- package/dist/lib/src/sessionid.d.ts +30 -0
- package/dist/lib/src/storage.d.ts +23 -0
- package/dist/lib/src/types.d.ts +354 -0
- package/dist/lib/src/utils/blocked-uas.d.ts +5 -0
- package/dist/lib/src/utils/event-utils.d.ts +32 -0
- package/dist/lib/src/utils/globals.d.ts +8 -0
- package/dist/lib/src/utils/index.d.ts +36 -0
- package/dist/lib/src/utils/logger.d.ts +8 -0
- package/dist/lib/src/utils/request-utils.d.ts +12 -0
- package/dist/lib/src/utils/type-utils.d.ts +12 -0
- package/dist/lib/src/uuidv7.d.ts +42 -0
- package/dist/module.d.ts +6 -2
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/recorder-v2.js +2 -2
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +9 -9
- package/lib/src/extensions/replay/sessionrecording.d.ts +5 -1
- package/lib/src/extensions/replay/sessionrecording.js +83 -9
- package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
- package/lib/src/loader-recorder-v2.js +51 -22
- package/lib/src/loader-recorder-v2.js.map +1 -1
- package/package.json +9 -9
package/dist/array.full.js
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function i(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function o(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return s="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},s(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 c(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new 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&&h(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function v(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}function g(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(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=p(e);if(t){var i=p(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return g(this,n)}}function _(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)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return k(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)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function S(e){var t,n=null===(t=e)||void 0===t?void 0:t.host;return Boolean(n&&n.shadowRoot&&n.shadowRoot===e)}function C(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,i=e.value,o=e.maskInputFn,a=i||"";return(t[n.toLowerCase()]||t[r])&&(a=o?o(a):"*".repeat(a.length)),a}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var I="__rrweb_original__";var x,F,E=1,O=new RegExp("[^a-z0-9-_:]"),R=-2;function M(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(T).join(""):null}catch(e){return null}}function T(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=M(e.styleSheet)||t}catch(e){}return t}var P=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,N=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,L=/^(data:)([^,]*),(.*)/i;function D(e,t){return(e||"").replace(P,(function(e,n,r,i,o,a){var s,u=r||o||a,l=n||i||"";if(!u)return e;if(!N.test(u))return"url("+l+u+l+")";if(L.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+u)+l+")";var c=t.split("/"),d=u.split("/");c.pop();for(var f=0,p=d;f<p.length;f++){var h=p[f];"."!==h&&(".."===h?c.pop():c.push(h))}return"url("+l+c.join("/")+l+")"}))}var A,$,q,B,j,H,W=/^[^ \t\n\r\u000c]+/,U=/^[, \t\n\r\u000c]+/;function V(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function z(){var e=document.createElement("a");return e.href="",e.href}function G(e,t,n,r){return"src"===n||"href"===n&&r||"xlink:href"===n&&r&&"#"!==r[0]?V(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}for(var i=[];r(U),!(n>=t.length);){var o=r(W);if(","===o.slice(-1))o=V(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=V(e,o);for(var s=!1;;){var u=t.charAt(n);if(""===u){i.push((o+a).trim());break}if(s)")"===u&&(s=!1);else{if(","===u){n+=1,i.push((o+a).trim());break}"("===u&&(s=!0)}a+=u,n+=1}}}return i.join(", ")}(e,r):"style"===n&&r?D(r,z()):"object"===t&&"data"===n&&r?V(e,r):r:V(e,r)}function Y(e,t,n){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=0;r<e.classList.length;r++){var i=e.classList[r];if(t.test(i))return!0}return!(!n||!e.matches(n))||Y(e.parentNode,t,n)}return e.nodeType,e.TEXT_NODE,Y(e.parentNode,t,n)}function Q(t,n){var r,i,o,a,s=n.doc,u=n.blockClass,l=n.blockSelector,c=n.maskTextClass,d=n.maskTextSelector,f=n.inlineStylesheet,p=n.maskInputOptions,h=void 0===p?{}:p,v=n.maskTextFn,g=n.maskInputFn,m=n.dataURLOptions,_=void 0===m?{}:m,y=n.inlineImages,b=n.recordCanvas,k=n.keepIframeSrcFn;if(s.__sn){var w=s.__sn.id;i=1===w?void 0:w}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:i}:{type:e.Document,childNodes:[],rootId:i};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:i};case t.ELEMENT_NODE:for(var S=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=0;r<e.classList.length;r++){var i=e.classList[r];if(t.test(i))return!0}return!!n&&e.matches(n)}(t,u,l),E=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return O.test(t)?"div":t}(t),R={},T=0,P=Array.from(t.attributes);T<P.length;T++){var N=P[T],L=N.name,A=N.value;R[L]=G(s,E,L,A)}if("link"===E&&f){var $=Array.from(s.styleSheets).find((function(e){return e.href===t.href})),q=null;$&&(q=M($)),q&&(delete R.rel,delete R.href,R._cssText=D(q,$.href))}if("style"===E&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(q=M(t.sheet))&&(R._cssText=D(q,z()));if("input"===E||"textarea"===E||"select"===E){A=t.value;"radio"!==R.type&&"checkbox"!==R.type&&"submit"!==R.type&&"button"!==R.type&&A?R.value=C({type:R.type,tagName:E,value:A,maskInputOptions:h,maskInputFn:g}):t.checked&&(R.checked=t.checked)}if("option"===E&&(t.selected&&!h.select?R.selected=!0:delete R.selected),"canvas"===E&&b)if("2d"===t.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var i=t.getImageData,o=I in i?i[I]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(t)||(R.rr_dataURL=t.toDataURL(_.type,_.quality));else if(!("__context"in t)){var B=t.toDataURL(_.type,_.quality),j=document.createElement("canvas");j.width=t.width,j.height=t.height,B!==j.toDataURL(_.type,_.quality)&&(R.rr_dataURL=B)}if("img"===E&&y){x||(x=s.createElement("canvas"),F=x.getContext("2d"));var H=t,W=H.crossOrigin;H.crossOrigin="anonymous";var U=function(){try{x.width=H.naturalWidth,x.height=H.naturalHeight,F.drawImage(H,0,0),R.rr_dataURL=x.toDataURL(_.type,_.quality)}catch(e){console.warn("Cannot inline img src="+H.currentSrc+"! Error: "+e)}W?R.crossOrigin=W:delete R.crossOrigin};H.complete&&0!==H.naturalWidth?U():H.onload=U}if("audio"!==E&&"video"!==E||(R.rr_mediaState=t.paused?"paused":"played",R.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(R.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(R.rr_scrollTop=t.scrollTop),S){var V=t.getBoundingClientRect(),Q=V.width,J=V.height;R={class:R.class,rr_width:Q+"px",rr_height:J+"px"}}return"iframe"!==E||k(R.src)||(t.contentDocument||(R.rr_src=R.src),delete R.src),{type:e.Element,tagName:E,attributes:R,childNodes:[],isSVG:(a=t,Boolean("svg"===a.tagName||a.ownerSVGElement)||void 0),needBlock:S,rootId:i};case t.TEXT_NODE:var X=t.parentNode&&t.parentNode.tagName,K=t.textContent,Z="STYLE"===X||void 0,ee="SCRIPT"===X||void 0;if(Z&&K){try{t.nextSibling||t.previousSibling||(null===(r=t.parentNode.sheet)||void 0===r?void 0:r.cssRules)&&(K=(o=t.parentNode.sheet).cssRules?Array.from(o.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}K=D(K,z())}return ee&&(K="SCRIPT_PLACEHOLDER"),!Z&&!ee&&Y(t,c,d)&&K&&(K=v?v(K):K.replace(/[\S]/g,"*")),{type:e.Text,textContent:K||"",isStyle:Z,rootId:i};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:i};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:i};default:return!1}}function J(e){return void 0===e?"":e.toLowerCase()}function X(t,n){var r,i=n.doc,o=n.map,a=n.blockClass,s=n.blockSelector,u=n.maskTextClass,l=n.maskTextSelector,c=n.skipChild,d=void 0!==c&&c,f=n.inlineStylesheet,p=void 0===f||f,h=n.maskInputOptions,v=void 0===h?{}:h,g=n.maskTextFn,m=n.maskInputFn,_=n.slimDOMOptions,y=n.dataURLOptions,b=void 0===y?{}:y,k=n.inlineImages,w=void 0!==k&&k,C=n.recordCanvas,I=void 0!==C&&C,x=n.onSerialize,F=n.onIframeLoad,O=n.iframeLoadTimeout,M=void 0===O?5e3:O,T=n.keepIframeSrcFn,P=void 0===T?function(){return!1}:T,N=n.preserveWhiteSpace,L=void 0===N||N,D=Q(t,{doc:i,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,dataURLOptions:b,inlineImages:w,recordCanvas:I,keepIframeSrcFn:P});if(!D)return console.warn(t,"not serialized"),null;r="__sn"in t?t.__sn.id:!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(J(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===J(t.attributes.name)||"icon"===J(t.attributes.rel)||"apple-touch-icon"===J(t.attributes.rel)||"shortcut icon"===J(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&J(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(J(t.attributes.property).match(/^(og|twitter|fb):/)||J(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===J(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===J(t.attributes.name)||"googlebot"===J(t.attributes.name)||"bingbot"===J(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===J(t.attributes.name)||"generator"===J(t.attributes.name)||"framework"===J(t.attributes.name)||"publisher"===J(t.attributes.name)||"progid"===J(t.attributes.name)||J(t.attributes.property).match(/^article:/)||J(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===J(t.attributes.name)||"yandex-verification"===J(t.attributes.name)||"csrf-token"===J(t.attributes.name)||"p:domain_verify"===J(t.attributes.name)||"verify-v1"===J(t.attributes.name)||"verification"===J(t.attributes.name)||"shopify-checkout-api-token"===J(t.attributes.name)))return!0}}return!1}(D,_)&&(L||D.type!==e.Text||D.isStyle||D.textContent.replace(/^\s+|\s+$/gm,"").length)?E++:R;var A=Object.assign(D,{id:r});if(t.__sn=A,r===R)return null;o[r]=t,x&&x(t);var $=!d;if(A.type===e.Element&&($=$&&!A.needBlock,delete A.needBlock,t.shadowRoot&&(A.isShadowHost=!0)),(A.type===e.Document||A.type===e.Element)&&$){_.headWhitespace&&D.type===e.Element&&"head"===D.tagName&&(L=!1);for(var q={doc:i,map:o,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,skipChild:d,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,slimDOMOptions:_,dataURLOptions:b,inlineImages:w,recordCanvas:I,preserveWhiteSpace:L,onSerialize:x,onIframeLoad:F,iframeLoadTimeout:M,keepIframeSrcFn:P},B=0,j=Array.from(t.childNodes);B<j.length;B++){(U=X(j[B],q))&&A.childNodes.push(U)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var H=0,W=Array.from(t.shadowRoot.childNodes);H<W.length;H++){var U;(U=X(W[H],q))&&(U.isShadow=!0,A.childNodes.push(U))}}return t.parentNode&&S(t.parentNode)&&(A.isShadow=!0),A.type===e.Element&&"iframe"===A.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"===i){var a="about:blank";r.location.href===a&&e.src!==a&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}}(t,(function(){var e=t.contentDocument;if(e&&F){var n=X(e,{doc:e,map:o,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,slimDOMOptions:_,dataURLOptions:b,inlineImages:w,recordCanvas:I,preserveWhiteSpace:L,onSerialize:x,onIframeLoad:F,iframeLoadTimeout:M,keepIframeSrcFn:P});n&&F(t,n)}}),M),A}function K(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}!function(e){e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin"}(A||(A={})),function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration"}($||($={})),function(e){e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel"}(q||(q={})),function(e){e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2"}(B||(B={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange"}(j||(j={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back"}(H||(H={}));var Z="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",ee={map:{},getId:function(){return console.error(Z),-1},getNode:function(){return console.error(Z),null},removeNodeFromMap:function(){console.error(Z)},has:function(){return console.error(Z),!1},reset:function(){console.error(Z)}};function te(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(o){var a=Date.now();i||!1!==n.leading||(i=a);var s=t-(a-i),u=this,l=arguments;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(u,l)):r||!1===n.trailing||(r=setTimeout((function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(u,l)}),s))}}function ne(e,t,n,r,i){void 0===i&&(i=window);var o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set:function(e){var t=this;setTimeout((function(){n.set.call(t,e)}),0),o&&o.set&&o.set.call(this,e)}}),function(){return ne(e,t,o||{},!0)}}function re(e,t,n){try{if(!(t in e))return function(){};var r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,function(){e[t]=r}}catch(e){return function(){}}}function ie(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;if("string"==typeof t){if(void 0!==e.closest)return null!==e.closest("."+t);n=e.classList.contains(t)}else e.classList.forEach((function(e){t.test(e)&&(n=!0)}));return n||ae(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,ae(e.parentNode,t)}function se(e){return"__sn"in e&&e.__sn.id===R}function ue(e,t){if(S(e))return!1;var n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||ue(e.parentNode,t))}function le(e){return Boolean(e.changedTouches)}function ce(t){return"__sn"in t&&(t.__sn.type===e.Element&&"iframe"===t.__sn.tagName)}function de(e){return Boolean(null==e?void 0:e.shadowRoot)}function fe(e){return"__ln"in e}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ee=new Proxy(ee,{get:function(e,t,n){return"map"===t&&console.error(Z),Reflect.get(e,t,n)}}));var pe=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fe(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&fe(e.nextSibling)&&e.nextSibling.__ln.previous){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)},e}(),he=function(e,t){return"".concat(e,"@").concat(t)};function ve(e){return"__sn"in e}var ge=function(){function e(){var e=this;this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(t){t.forEach(e.processMutation),e.emit()},this.emit=function(){var t,r,i,o;if(!e.frozen&&!e.locked){for(var a=[],s=new pe,u=function(t){for(var n=t,r=R;r===R;)r=(n=n&&n.nextSibling)&&e.mirror.getId(n);return r},l=function(t){for(var n,r,i,o,l,c=t.getRootNode?null===(n=t.getRootNode())||void 0===n?void 0:n.host:null,d=c;null===(i=null===(r=null==d?void 0:d.getRootNode)||void 0===r?void 0:r.call(d))||void 0===i?void 0:i.host;)d=(null===(l=null===(o=null==d?void 0:d.getRootNode)||void 0===o?void 0:o.call(d))||void 0===l?void 0:l.host)||null;var f=!(e.doc.contains(t)||null!==d&&e.doc.contains(d));if(t.parentNode&&!f){var p=S(t.parentNode)?e.mirror.getId(c):e.mirror.getId(t.parentNode),h=u(t);if(-1===p||-1===h)return s.addNode(t);var v=X(t,{doc:e.doc,map:e.mirror.map,blockClass:e.blockClass,blockSelector:e.blockSelector,maskTextClass:e.maskTextClass,maskTextSelector:e.maskTextSelector,skipChild:!0,inlineStylesheet:e.inlineStylesheet,maskInputOptions:e.maskInputOptions,maskTextFn:e.maskTextFn,maskInputFn:e.maskInputFn,slimDOMOptions:e.slimDOMOptions,recordCanvas:e.recordCanvas,inlineImages:e.inlineImages,onSerialize:function(n){ce(n)&&e.iframeManager.addIframe(n),de(t)&&e.shadowDomManager.addShadowRoot(t.shadowRoot,document)},onIframeLoad:function(t,n){e.iframeManager.attachIframe(t,n),e.shadowDomManager.observeAttachShadow(t)}});v&&a.push({parentId:p,nextId:h,node:v})}};e.mapRemoves.length;)e.mirror.removeNodeFromMap(e.mapRemoves.shift());try{for(var c=n(e.movedSet),d=c.next();!d.done;d=c.next()){var f=d.value;_e(e.removes,f,e.mirror)&&!e.movedSet.has(f.parentNode)||l(f)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}try{for(var p=n(e.addedSet),h=p.next();!h.done;h=p.next()){f=h.value;ye(e.droppedSet,f)||_e(e.removes,f,e.mirror)?ye(e.movedSet,f)?l(f):e.droppedSet.add(f):l(f)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}for(var v=null;s.length;){var g=null;if(v){var m=e.mirror.getId(v.value.parentNode),_=u(v.value);-1!==m&&-1!==_&&(g=v)}if(!g)for(var y=s.length-1;y>=0;y--){var b=s.get(y);if(b){m=e.mirror.getId(b.value.parentNode),_=u(b.value);if(-1!==m&&-1!==_){g=b;break}}}if(!g){for(;s.head;)s.removeNode(s.head.value);break}v=g.previous,s.removeNode(g.value),l(g.value)}var k={texts:e.texts.map((function(t){return{id:e.mirror.getId(t.node),value:t.value}})).filter((function(t){return e.mirror.has(t.id)})),attributes:e.attributes.map((function(t){return{id:e.mirror.getId(t.node),attributes:t.attributes}})).filter((function(t){return e.mirror.has(t.id)})),removes:e.removes,adds:a};(k.texts.length||k.attributes.length||k.removes.length||k.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.mutationCb(k))}},this.processMutation=function(t){var r,i,o,a;if(!se(t.target))switch(t.type){case"characterData":var s=t.target.textContent;ae(t.target,e.blockClass)||s===t.oldValue||e.texts.push({value:Y(t.target,e.maskTextClass,e.maskTextSelector)&&s?e.maskTextFn?e.maskTextFn(s):s.replace(/[\S]/g,"*"):s,node:t.target});break;case"attributes":var u=t.target;s=t.target.getAttribute(t.attributeName);if("value"===t.attributeName&&(s=C({maskInputOptions:e.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:s,maskInputFn:e.maskInputFn})),ae(t.target,e.blockClass)||s===t.oldValue)return;var l=e.attributes.find((function(e){return e.node===t.target}));if(l||(l={node:t.target,attributes:{}},e.attributes.push(l)),"style"===t.attributeName){var c=e.doc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue),void 0!==l.attributes.style&&null!==l.attributes.style||(l.attributes.style={});var d=l.attributes.style;try{for(var f=n(Array.from(u.style)),p=f.next();!p.done;p=f.next()){var h=p.value,v=u.style.getPropertyValue(h),g=u.style.getPropertyPriority(h);v===c.style.getPropertyValue(h)&&g===c.style.getPropertyPriority(h)||(d[h]=""===g?v:[v,g])}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}try{for(var m=n(Array.from(c.style)),_=m.next();!_.done;_=m.next()){h=_.value;""===u.style.getPropertyValue(h)&&(d[h]=!1)}}catch(e){o={error:e}}finally{try{_&&!_.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}}else l.attributes[t.attributeName]=G(e.doc,t.target.tagName,t.attributeName,s);break;case"childList":t.addedNodes.forEach((function(n){return e.genAdds(n,t.target)})),t.removedNodes.forEach((function(n){var r=e.mirror.getId(n),i=S(t.target)?e.mirror.getId(t.target.host):e.mirror.getId(t.target);ae(t.target,e.blockClass)||se(n)||(e.addedSet.has(n)?(me(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===r||ue(t.target,e.mirror)||(e.movedSet.has(n)&&e.movedMap[he(r,i)]?me(e.movedSet,n):e.removes.push({parentId:i,id:r,isShadow:!!S(t.target)||void 0})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!n||!ae(n,e.blockClass)){if(ve(t)){if(se(t))return;e.movedSet.add(t);var r=null;n&&ve(n)&&(r=n.__sn.id),r&&(e.movedMap[he(t.__sn.id,r)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);ae(t,e.blockClass)||t.childNodes.forEach((function(t){return e.genAdds(t)}))}}}return e.prototype.init=function(e){var t=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","recordCanvas","inlineImages","slimDOMOptions","doc","mirror","iframeManager","shadowDomManager","canvasManager"].forEach((function(n){t[n]=e[n]}))},e.prototype.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},e.prototype.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},e.prototype.isFrozen=function(){return this.frozen},e.prototype.lock=function(){this.locked=!0,this.canvasManager.lock()},e.prototype.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},e.prototype.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},e}();function me(e,t){e.delete(t),t.childNodes.forEach((function(t){return me(e,t)}))}function _e(e,t,n){var r=t.parentNode;if(!r)return!1;var i=n.getId(r);return!!e.some((function(e){return e.id===i}))||_e(e,r,n)}function ye(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||ye(e,n))}var be=[],ke="undefined"!=typeof CSSGroupingRule,we="undefined"!=typeof CSSMediaRule,Se="undefined"!=typeof CSSSupportsRule,Ce="undefined"!=typeof CSSConditionRule;function Ie(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function xe(e,t){var n,r,i=new ge;be.push(i),i.init(e);var o=window.MutationObserver||window.__rrMutationObserver,a=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);var s=new o(i.processMutations.bind(i));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Fe(e){var t=e.mouseInteractionCb,n=e.doc,r=e.mirror,i=e.blockClass,o=e.sampling;if(!1===o.mouseInteraction)return function(){};var a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,s=[];return Object.keys(q).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e]})).forEach((function(e){var o=e.toLowerCase(),a=function(e){return function(n){var o=Ie(n);if(!ae(o,i)){var a=le(n)?n.changedTouches[0]:n;if(a){var s=r.getId(o),u=a.clientX,l=a.clientY;t({type:q[e],id:s,x:u,y:l})}}}}(e);s.push(K(o,a,n))})),function(){s.forEach((function(e){return e()}))}}function Ee(e){var t=e.scrollCb,n=e.doc,r=e.mirror,i=e.blockClass;return K("scroll",te((function(e){var o=Ie(e);if(o&&!ae(o,i)){var a=r.getId(o);if(o===n){var s=n.scrollingElement||n.documentElement;t({id:a,x:s.scrollLeft,y:s.scrollTop})}else t({id:a,x:o.scrollLeft,y:o.scrollTop})}}),e.sampling.scroll||100),n)}function Oe(e,n){var r=t({},e);return n||delete r.userTriggered,r}var Re=["INPUT","TEXTAREA","SELECT"],Me=new WeakMap;function Te(e){return function(e,t){if(ke&&e.parentRule instanceof CSSGroupingRule||we&&e.parentRule instanceof CSSMediaRule||Se&&e.parentRule instanceof CSSSupportsRule||Ce&&e.parentRule instanceof CSSConditionRule){var n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else{n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Pe(e,o){var a,s;void 0===o&&(o={});var u=e.doc.defaultView;if(!u)return function(){};!function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,s=e.scrollCb,u=e.viewportResizeCb,l=e.inputCb,c=e.mediaInteractionCb,d=e.styleSheetRuleCb,f=e.styleDeclarationCb,p=e.canvasMutationCb,h=e.fontCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,i([],r(e),!1)),n.apply(void 0,i([],r(e),!1))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,i([],r(e),!1)),o.apply(void 0,i([],r(e),!1))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,i([],r(e),!1)),a.apply(void 0,i([],r(e),!1))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,i([],r(e),!1)),s.apply(void 0,i([],r(e),!1))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,i([],r(e),!1)),u.apply(void 0,i([],r(e),!1))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,i([],r(e),!1)),l.apply(void 0,i([],r(e),!1))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,i([],r(e),!1)),c.apply(void 0,i([],r(e),!1))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,i([],r(e),!1)),d.apply(void 0,i([],r(e),!1))},e.styleDeclarationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleDeclaration&&t.styleDeclaration.apply(t,i([],r(e),!1)),f.apply(void 0,i([],r(e),!1))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,i([],r(e),!1)),p.apply(void 0,i([],r(e),!1))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,i([],r(e),!1)),h.apply(void 0,i([],r(e),!1))}}(e,o);var l=xe(e,e.doc),c=function(e){var t=e.mousemoveCb,n=e.sampling,r=e.doc,i=e.mirror;if(!1===n.mousemove)return function(){};var o,a="number"==typeof n.mousemove?n.mousemove:50,s="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500,u=[],l=te((function(e){var n=Date.now()-o;t(u.map((function(e){return e.timeOffset-=n,e})),e),u=[],o=null}),s),c=te((function(e){var t=Ie(e),n=le(e)?e.changedTouches[0]:e,r=n.clientX,a=n.clientY;o||(o=Date.now()),u.push({x:r,y:a,id:i.getId(t),timeOffset:Date.now()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?$.Drag:e instanceof MouseEvent?$.MouseMove:$.TouchMove)}),a,{trailing:!1}),d=[K("mousemove",c,r),K("touchmove",c,r),K("drag",c,r)];return function(){d.forEach((function(e){return e()}))}}(e),d=Fe(e),f=Ee(e),p=function(e){var t=e.viewportResizeCb,n=-1,r=-1;return K("resize",te((function(){var e=ie(),i=oe();n===e&&r===i||(t({width:Number(i),height:Number(e)}),n=e,r=i)}),200),window)}(e),h=function(e){var n=e.inputCb,o=e.doc,a=e.mirror,s=e.blockClass,u=e.ignoreClass,l=e.maskInputOptions,c=e.maskInputFn,d=e.sampling,f=e.userTriggeredOnInput;function p(e){var t=Ie(e),n=e.isTrusted;if(t&&"OPTION"===t.tagName&&(t=t.parentElement),t&&t.tagName&&!(Re.indexOf(t.tagName)<0)&&!ae(t,s)){var r=t.type;if(!t.classList.contains(u)){var i=t.value,a=!1;"radio"===r||"checkbox"===r?a=t.checked:(l[t.tagName.toLowerCase()]||l[r])&&(i=C({maskInputOptions:l,tagName:t.tagName,type:r,value:i,maskInputFn:c})),h(t,Oe({text:i,isChecked:a,userTriggered:n},f));var d=t.name;"radio"===r&&d&&a&&o.querySelectorAll('input[type="radio"][name="'.concat(d,'"]')).forEach((function(e){e!==t&&h(e,Oe({text:e.value,isChecked:!a,userTriggered:!1},f))}))}}}function h(e,r){var i=Me.get(e);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Me.set(e,r);var o=a.getId(e);n(t(t({},r),{id:o}))}}var v=("last"===d.input?["change"]:["input","change"]).map((function(e){return K(e,p,o)})),g=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),m=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"],[HTMLOptionElement.prototype,"selected"]];return g&&g.set&&v.push.apply(v,i([],r(m.map((function(e){return ne(e[0],e[1],{set:function(){p({target:this})}})}))),!1)),function(){v.forEach((function(e){return e()}))}}(e),v=function(e){var t=e.mediaInteractionCb,n=e.blockClass,r=e.mirror,i=e.sampling,o=function(e){return te((function(i){var o=Ie(i);if(o&&!ae(o,n)){var a=o,s=a.currentTime,u=a.volume,l=a.muted;t({type:e,id:r.getId(o),currentTime:s,volume:u,muted:l})}}),i.media||500)},a=[K("play",o(0)),K("pause",o(1)),K("seeked",o(2)),K("volumechange",o(3))];return function(){a.forEach((function(e){return e()}))}}(e),g=function(e,t){var n=e.styleSheetRuleCb,o=e.mirror,a=t.win,s=a.CSSStyleSheet.prototype.insertRule;a.CSSStyleSheet.prototype.insertRule=function(e,t){var r=o.getId(this.ownerNode);return-1!==r&&n({id:r,adds:[{rule:e,index:t}]}),s.apply(this,arguments)};var u=a.CSSStyleSheet.prototype.deleteRule;a.CSSStyleSheet.prototype.deleteRule=function(e){var t=o.getId(this.ownerNode);return-1!==t&&n({id:t,removes:[{index:e}]}),u.apply(this,arguments)};var l={};ke?l.CSSGroupingRule=a.CSSGroupingRule:(we&&(l.CSSMediaRule=a.CSSMediaRule),Ce&&(l.CSSConditionRule=a.CSSConditionRule),Se&&(l.CSSSupportsRule=a.CSSSupportsRule));var c={};return Object.entries(l).forEach((function(e){var t=r(e,2),a=t[0],s=t[1];c[a]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(e,t){var s=o.getId(this.parentStyleSheet.ownerNode);return-1!==s&&n({id:s,adds:[{rule:e,index:i(i([],r(Te(this)),!1),[t||0],!1)}]}),c[a].insertRule.apply(this,arguments)},s.prototype.deleteRule=function(e){var t=o.getId(this.parentStyleSheet.ownerNode);return-1!==t&&n({id:t,removes:[{index:i(i([],r(Te(this)),!1),[e],!1)}]}),c[a].deleteRule.apply(this,arguments)}})),function(){a.CSSStyleSheet.prototype.insertRule=s,a.CSSStyleSheet.prototype.deleteRule=u,Object.entries(l).forEach((function(e){var t=r(e,2),n=t[0],i=t[1];i.prototype.insertRule=c[n].insertRule,i.prototype.deleteRule=c[n].deleteRule}))}}(e,{win:u}),m=function(e,t){var n=e.styleDeclarationCb,r=e.mirror,i=t.win,o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(e,t,i){var a,s,u=r.getId(null===(s=null===(a=this.parentRule)||void 0===a?void 0:a.parentStyleSheet)||void 0===s?void 0:s.ownerNode);return-1!==u&&n({id:u,set:{property:e,value:t,priority:i},index:Te(this.parentRule)}),o.apply(this,arguments)};var a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(e){var t,i,o=r.getId(null===(i=null===(t=this.parentRule)||void 0===t?void 0:t.parentStyleSheet)||void 0===i?void 0:i.ownerNode);return-1!==o&&n({id:o,remove:{property:e},index:Te(this.parentRule)}),a.apply(this,arguments)},function(){i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}}(e,{win:u}),_=e.collectFonts?function(e){var t=e.fontCb,n=e.doc,r=n.defaultView;if(!r)return function(){};var i=[],o=new WeakMap,a=r.FontFace;r.FontFace=function(e,t,n){var r=new a(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};var s=re(n.fonts,"add",(function(e){return function(n){return setTimeout((function(){var e=o.get(n);e&&(t(e),o.delete(n))}),0),e.apply(this,[n])}}));return i.push((function(){r.FontFace=a})),i.push(s),function(){i.forEach((function(e){return e()}))}}(e):function(){},y=[];try{for(var b=n(e.plugins),k=b.next();!k.done;k=b.next()){var w=k.value;y.push(w.observer(w.callback,u,w.options))}}catch(e){a={error:e}}finally{try{k&&!k.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}return function(){be.forEach((function(e){return e.reset()})),l.disconnect(),c(),d(),f(),p(),h(),v(),g(),m(),_(),y.forEach((function(e){return e()}))}}var Ne=function(){function e(e){this.iframes=new WeakMap,this.mutationCb=e.mutationCb}return e.prototype.addIframe=function(e){this.iframes.set(e,!0)},e.prototype.addLoadListener=function(e){this.loadListener=e},e.prototype.attachIframe=function(e,t){var n;this.mutationCb({adds:[{parentId:e.__sn.id,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e)},e}(),Le=function(){function e(e){this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;var t=this;this.restorePatches.push(re(HTMLElement.prototype,"attachShadow",(function(e){return function(){var n=e.apply(this,arguments);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),n}})))}return e.prototype.addShadowRoot=function(e,n){xe(t(t({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Ee(t(t({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))},e.prototype.observeAttachShadow=function(e){if(e.contentWindow){var t=this;this.restorePatches.push(re(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(){var r=n.apply(this,arguments);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),r}})))}},e.prototype.reset=function(){this.restorePatches.forEach((function(e){return e()}))},e}();for(var De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ae="undefined"==typeof Uint8Array?[]:new Uint8Array(256),$e=0;$e<De.length;$e++)Ae[De.charCodeAt($e)]=$e;var qe=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=De[n[t]>>2],i+=De[(3&n[t])<<4|n[t+1]>>4],i+=De[(15&n[t+1])<<2|n[t+2]>>6],i+=De[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},Be=new Map;var je=function(e,t,n){if(e&&(Ue(e,t)||"object"===s(e))){var r=function(e,t){var n=Be.get(e);return n||(n=new Map,Be.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name),i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i}};function He(e,t,n){return e instanceof Array?e.map((function(e){return He(e,t,n)})):null===e?e:e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray?{rr_type:e.constructor.name,args:[Object.values(e)]}:e instanceof ArrayBuffer?{rr_type:e.constructor.name,base64:qe(e)}:e instanceof DataView?{rr_type:e.constructor.name,args:[He(e.buffer,t,n),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof ImageData?{rr_type:e.constructor.name,args:[He(e.data,t,n),e.width,e.height]}:Ue(e,t)||"object"===s(e)?{rr_type:e.constructor.name,index:je(e,t,n)}:e}var We=function(e,t,n){return i([],r(e),!1).map((function(e){return He(e,t,n)}))},Ue=function(e,t){var n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((function(e){return"function"==typeof t[e]}));return Boolean(n.find((function(n){return e instanceof t[n]})))};function Ve(e,t,o,a,s,u){var l,c,d=[],f=Object.getOwnPropertyNames(e),p=function(n){try{if("function"!=typeof e[n])return"continue";var l=re(e,n,(function(l){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];var f=l.apply(this,c);if(je(f,u,e),!ae(this.canvas,a)){s.getId(this.canvas);var p=We(i([],r(c),!1),u,e),h={type:t,property:n,args:p};o(this.canvas,h)}return f}}));d.push(l)}catch(r){var c=ne(e,n,{set:function(e){o(this.canvas,{type:t,property:n,args:[e],setter:!0})}});d.push(c)}};try{for(var h=n(f),v=h.next();!v.done;v=h.next()){p(v.value)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(c=h.return)&&c.call(h)}finally{if(l)throw l.error}}return d}var ze,Ge,Ye=function(){function e(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=function(e,t){!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)},this.mutationCb=e.mutationCb,this.mirror=e.mirror,!0===e.recordCanvas&&this.initCanvasMutationObserver(e.win,e.blockClass)}return e.prototype.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},e.prototype.freeze=function(){this.frozen=!0},e.prototype.unfreeze=function(){this.frozen=!1},e.prototype.lock=function(){this.locked=!0},e.prototype.unlock=function(){this.locked=!1},e.prototype.initCanvasMutationObserver=function(e,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var o=function(e,t){var n=[];try{var o=re(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return ae(this,t)||"__context"in this||(this.__context=n),e.apply(this,i([n],r(o),!1))}}));n.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){n.forEach((function(e){return e()}))}}(e,t),a=function(e,t,o,a){var s,u,l=[],c=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),d=function(n){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[n])return"continue";var a=re(t.CanvasRenderingContext2D.prototype,n,(function(t){return function(){for(var a=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return ae(this.canvas,o)||setTimeout((function(){var t=i([],r(s),!1);if("drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement){var o=t[0],u=o.getContext("2d"),l=null==u?void 0:u.getImageData(0,0,o.width,o.height),c=null==l?void 0:l.data;t[0]=JSON.stringify(c)}e(a.canvas,{type:B["2D"],property:n,args:t})}),0),t.apply(this,s)}}));l.push(a)}catch(r){var s=ne(t.CanvasRenderingContext2D.prototype,n,{set:function(t){e(this.canvas,{type:B["2D"],property:n,args:[t],setter:!0})}});l.push(s)}};try{for(var f=n(c),p=f.next();!p.done;p=f.next())d(p.value)}catch(e){s={error:e}}finally{try{p&&!p.done&&(u=f.return)&&u.call(f)}finally{if(s)throw s.error}}return function(){l.forEach((function(e){return e()}))}}(this.processMutation.bind(this),e,t,this.mirror),s=function(e,t,n,o){var a=[];return a.push.apply(a,i([],r(Ve(t.WebGLRenderingContext.prototype,B.WebGL,e,n,o,t)),!1)),void 0!==t.WebGL2RenderingContext&&a.push.apply(a,i([],r(Ve(t.WebGL2RenderingContext.prototype,B.WebGL2,e,n,o,t)),!1)),function(){a.forEach((function(e){return e()}))}}(this.processMutation.bind(this),e,t,this.mirror);this.resetObservers=function(){o(),a(),s()}},e.prototype.startPendingCanvasMutationFlusher=function(){var e=this;requestAnimationFrame((function(){return e.flushPendingCanvasMutations()}))},e.prototype.startRAFTimestamping=function(){var e=this;requestAnimationFrame((function t(n){e.rafStamps.latestId=n,requestAnimationFrame(t)}))},e.prototype.flushPendingCanvasMutations=function(){var e=this;this.pendingCanvasMutations.forEach((function(t,n){var r=e.mirror.getId(n);e.flushPendingCanvasMutationFor(n,r)})),requestAnimationFrame((function(){return e.flushPendingCanvasMutations()}))},e.prototype.flushPendingCanvasMutationFor=function(e,t){if(!this.frozen&&!this.locked){var n=this.pendingCanvasMutations.get(e);if(n&&-1!==t){var r=n.map((function(e){e.type;var t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]);return t})),i=n[0].type;this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}},e}();function Qe(e){return t(t({},e),{timestamp:Date.now()})}var Je={map:{},getId:function(e){return e&&e.__sn?e.__sn.id:-1},getNode:function(e){return this.map[e]||null},removeNodeFromMap:function(e){var t=this,n=e.__sn&&e.__sn.id;delete this.map[n],e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},has:function(e){return this.map.hasOwnProperty(e)},reset:function(){this.map={}}};function Xe(e){void 0===e&&(e={});var i=e.emit,o=e.checkoutEveryNms,a=e.checkoutEveryNth,s=e.blockClass,u=void 0===s?"rr-block":s,l=e.blockSelector,c=void 0===l?null:l,d=e.ignoreClass,f=void 0===d?"rr-ignore":d,p=e.maskTextClass,h=void 0===p?"rr-mask":p,v=e.maskTextSelector,g=void 0===v?null:v,m=e.inlineStylesheet,_=void 0===m||m,y=e.maskAllInputs,b=e.maskInputOptions,k=e.slimDOMOptions,w=e.maskInputFn,S=e.maskTextFn,C=e.hooks,I=e.packFn,x=e.sampling,F=void 0===x?{}:x,E=e.mousemoveWait,O=e.recordCanvas,R=void 0!==O&&O,M=e.userTriggeredOnInput,T=void 0!==M&&M,P=e.collectFonts,N=void 0!==P&&P,L=e.inlineImages,D=void 0!==L&&L,q=e.plugins,B=e.keepIframeSrcFn,j=void 0===B?function(){return!1}:B;if(!i)throw new Error("emit function is required");void 0!==E&&void 0===F.mousemove&&(F.mousemove=E);var H,W=!0===y?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==b?b:{password:!0},U=!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===k,headMetaDescKeywords:"all"===k}:k||{};!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1})}();var V=0;ze=function(e,t){var r;if(!(null===(r=be[0])||void 0===r?void 0:r.isFrozen())||e.type===A.FullSnapshot||e.type===A.IncrementalSnapshot&&e.data.source===$.Mutation||be.forEach((function(e){return e.unfreeze()})),i(function(e){var t,r;try{for(var i=n(q||[]),o=i.next();!o.done;o=i.next()){var a=o.value;a.eventProcessor&&(e=a.eventProcessor(e))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return I&&(e=I(e)),e}(e),t),e.type===A.FullSnapshot)H=e,V=0;else if(e.type===A.IncrementalSnapshot){if(e.data.source===$.Mutation&&e.data.isAttachIframe)return;V++;var s=a&&V>=a,u=o&&e.timestamp-H.timestamp>o;(s||u)&&Ge(!0)}};var z=function(e){ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.Mutation},e)}))},G=function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.Scroll},e)}))},Y=function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.CanvasMutation},e)}))},Q=new Ne({mutationCb:z}),J=new Ye({recordCanvas:R,mutationCb:Y,win:window,blockClass:u,mirror:Je}),Z=new Le({mutationCb:z,scrollCb:G,bypassOptions:{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskInputOptions:W,maskTextFn:S,maskInputFn:w,recordCanvas:R,inlineImages:D,sampling:F,slimDOMOptions:U,iframeManager:Q,canvasManager:J},mirror:Je});Ge=function(e){var t,n,i,o;void 0===e&&(e=!1),ze(Qe({type:A.Meta,data:{href:window.location.href,width:oe(),height:ie()}}),e),be.forEach((function(e){return e.lock()}));var a=r(function(e,t){var n=t||{},r=n.blockClass,i=void 0===r?"rr-block":r,o=n.blockSelector,a=void 0===o?null:o,s=n.maskTextClass,u=void 0===s?"rr-mask":s,l=n.maskTextSelector,c=void 0===l?null:l,d=n.inlineStylesheet,f=void 0===d||d,p=n.inlineImages,h=void 0!==p&&p,v=n.recordCanvas,g=void 0!==v&&v,m=n.maskAllInputs,_=void 0!==m&&m,y=n.maskTextFn,b=n.maskInputFn,k=n.slimDOM,w=void 0!==k&&k,S=n.dataURLOptions,C=n.preserveWhiteSpace,I=n.onSerialize,x=n.onIframeLoad,F=n.iframeLoadTimeout,E=n.keepIframeSrcFn,O={};return[X(e,{doc:e,map:O,blockClass:i,blockSelector:a,maskTextClass:u,maskTextSelector:c,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===_?{password:!0}:_,maskTextFn:y,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:S,inlineImages:h,recordCanvas:g,preserveWhiteSpace:C,onSerialize:I,onIframeLoad:x,iframeLoadTimeout:F,keepIframeSrcFn:void 0===E?function(){return!1}:E}),O]}(document,{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskAllInputs:W,maskTextFn:S,slimDOM:U,recordCanvas:R,inlineImages:D,onSerialize:function(e){ce(e)&&Q.addIframe(e),de(e)&&Z.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){Q.attachIframe(e,t),Z.observeAttachShadow(e)},keepIframeSrcFn:j}),2),s=a[0],l=a[1];if(!s)return console.warn("Failed to snapshot the document");Je.map=l,ze(Qe({type:A.FullSnapshot,data:{node:s,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(o=null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}})),be.forEach((function(e){return e.unlock()}))};try{var ee=[];ee.push(K("DOMContentLoaded",(function(){ze(Qe({type:A.DomContentLoaded,data:{}}))})));var te=function(e){var n;return Pe({mutationCb:z,mousemoveCb:function(e,t){return ze(Qe({type:A.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.MouseInteraction},e)}))},scrollCb:G,viewportResizeCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.ViewportResize},e)}))},inputCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.Input},e)}))},mediaInteractionCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.StyleDeclaration},e)}))},canvasMutationCb:Y,fontCb:function(e){return ze(Qe({type:A.IncrementalSnapshot,data:t({source:$.Font},e)}))},blockClass:u,ignoreClass:f,maskTextClass:h,maskTextSelector:g,maskInputOptions:W,inlineStylesheet:_,sampling:F,recordCanvas:R,inlineImages:D,userTriggeredOnInput:T,collectFonts:N,doc:e,maskInputFn:w,maskTextFn:S,blockSelector:c,slimDOMOptions:U,mirror:Je,iframeManager:Q,shadowDomManager:Z,canvasManager:J,plugins:(null===(n=null==q?void 0:q.filter((function(e){return e.observer})))||void 0===n?void 0:n.map((function(e){return{observer:e.observer,options:e.options,callback:function(t){return ze(Qe({type:A.Plugin,data:{plugin:e.name,payload:t}}))}}})))||[]},C)};Q.addLoadListener((function(e){ee.push(te(e.contentDocument))}));var ne=function(){Ge(),ee.push(te(document))};return"interactive"===document.readyState||"complete"===document.readyState?ne():ee.push(K("load",(function(){ze(Qe({type:A.Load,data:{}})),ne()}),window)),function(){ee.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}Xe.addCustomEvent=function(e,t){if(!ze)throw new Error("please add custom event after start recording");ze(Qe({type:A.Custom,data:{tag:e,payload:t}}))},Xe.freezePage=function(){be.forEach((function(e){return e.freeze()}))},Xe.takeFullSnapshot=function(e){if(!Ge)throw new Error("please take full snapshot after start recording");Ge(e)},Xe.mirror=Je;var Ke=function(){function e(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}return e.prototype.toString=function(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t},e}(),Ze=/(^|@)\S+:\d+/,et=/^\s*at .*(\S+:\d+|\(native\))/m,tt=/^(eval@)?(\[native code])?$/,nt={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(et))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: ".concat(e));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(et)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),r=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Ke({functionName:o,fileName:a,lineNumber:i[1],columnNumber:i[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(tt)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Ke({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Ke({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=t.exec(n[i]);a&&r.push(new Ke({fileName:a[2],lineNumber:parseFloat(a[1])}))}return r},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=t.exec(n[i]);a&&r.push(new Ke({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Ze)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ke({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function rt(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var r=e.parentElement,i=[];if(r.children&&r.children.length>0)for(var o=0;o<r.children.length;o++){var a=r.children[o];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===n&&i.push(a)}i.length>1&&(n+=":eq("+i.indexOf(e)+")"),t=n+(t?">"+t:""),e=r}return t}function it(e){return"[object Object]"===Object.prototype.toString.call(e)}function ot(e,t){var r,i;if(0===t)return!0;var o=Object.keys(e);try{for(var a=n(o),s=a.next();!s.done;s=a.next()){var u=s.value;if(it(e[u])&&ot(e[u],t-1))return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return!1}function at(e,t){var n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);var r=[],i=[];return JSON.stringify(e,(function(e,t){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?i.splice(o,1/0,e):i.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null==t)return t;if(function(e){if(it(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(it(e)&&ot(e,n.depthOfLimit))return!0;return!1}(t))return function(e){var t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t="".concat(t.slice(0,n.stringLengthLimit),"..."));return t}(t);if(t instanceof Event){var a={};for(var s in t){var u=t[s];Array.isArray(u)?a[s]=rt(u.length?u[0]:null):a[s]=u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var st={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function ut(e,t,o){var a,s,u,l=o.logger;if(!l)return function(){};u="string"==typeof l?t[l]:l;var c=0,d=[];if(o.level.includes("error")&&window){var f=function(t){var n=t.message,r=t.error,i=nt.parse(r).map((function(e){return e.toString()})),a=[at(n,o.stringifyOptions)];e({level:"error",trace:i,payload:a})};window.addEventListener("error",f),d.push((function(){window&&window.removeEventListener("error",f)}))}try{for(var p=n(o.level),h=p.next();!h.done;h=p.next()){var v=h.value;d.push(g(u,v))}}catch(e){a={error:e}}finally{try{h&&!h.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}return function(){d.forEach((function(e){return e()}))};function g(t,n){var a=this;return t[n]?re(t,n,(function(t){return function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];t.apply(a,s);try{var l=nt.parse(new Error).map((function(e){return e.toString()})).splice(1),d=s.map((function(e){return at(e,o.stringifyOptions)}));++c<o.lengthThreshold?e({level:n,trace:l,payload:d}):c===o.lengthThreshold&&e({level:"warn",trace:[],payload:[at("The number of log records reached the threshold.")]})}catch(e){t.apply(void 0,i(["rrweb logger error:",e],r(s),!1))}}})):function(){}}}var lt=Array.prototype,ct=lt.forEach,dt=lt.indexOf,ft="undefined"!=typeof window?window:void 0,pt=null==ft?void 0:ft.navigator,ht=null==ft?void 0:ft.document,vt=null==pt?void 0:pt.userAgent,gt=null!=ft?ft:{};ft&&(ft.rrweb={record:Xe,version:"v1",rrwebVersion:"1.1.3"},ft.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:ut,options:e?Object.assign({},st,e):st}}});var mt={DEBUG:!1,LIB_VERSION:"1.103.0"},_t=Array.isArray,yt=Object.prototype,bt=yt.hasOwnProperty,kt=yt.toString,wt=_t||function(e){return"[object Array]"===kt.call(e)},St=function(e){return"[object Uint8Array]"===kt.call(e)},Ct=function(e){return"function"==typeof e},It=function(e){return e===Object(e)&&!wt(e)},xt=function(e){if(It(e)){for(var t in e)if(bt.call(e,t))return!1;return!0}return!1},Ft=function(e){return void 0===e},Et=function(e){return"[object String]"==kt.call(e)},Ot=function(e){return null===e},Rt=function(e){return"[object Number]"==kt.call(e)},Mt=function(e){return"[object Boolean]"===kt.call(e)},Tt="[PostHog.js]",Pt={_log:function(e){if(ft&&(mt.DEBUG||gt.POSTHOG_DEBUG)&&!Ft(ft.console)&&ft.console){for(var t=("__rrweb_original__"in ft.console[e]?ft.console[e].__rrweb_original__:ft.console[e]),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.apply(void 0,[Tt].concat(r))}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Pt._log.apply(Pt,["log"].concat(t))},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Pt._log.apply(Pt,["warn"].concat(t))},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Pt._log.apply(Pt,["error"].concat(t))},critical:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[Tt].concat(n))},uninitializedWarning:function(e){Pt.error("You must initialize PostHog before calling ".concat(e))}},Nt={},Lt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Dt(e,t,n){if(wt(e))if(ct&&e.forEach===ct)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)===Nt)return}function At(e,t,n){if(!Ot(e)&&!Ft(e)){if(wt(e))return Dt(e,t,n);for(var r in e)if(bt.call(e,r)&&t.call(n,e[r],r)===Nt)return}}var $t=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Dt(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function qt(e,t){return-1!==e.indexOf(t)}function Bt(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var jt=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Ht=function(e){try{return e()}catch(e){return}},Wt=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){Pt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pt.critical(e)}}},Ut=function(e){var t={};return At(e,(function(e,n){Et(e)&&e.length>0&&(t[n]=e)})),t};var Vt=["$performance_raw"];function zt(e,t){return n=e,r=function(e,n){return n&&Vt.indexOf(n)>-1?e:Et(e)&&!Ot(t)?e.slice(0,t):e},i=new Set,function e(t,n){return t!==Object(t)?r?r(t,n):t:i.has(t)?void 0:(i.add(t),wt(t)?(o=[],Dt(t,(function(t){o.push(e(t))}))):(o={},At(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}function Gt(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,u=0,l="",c=[];if(!e)return e;e=Yt(e);do{t=(o=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[u++]=a.charAt(t)+a.charAt(n)+a.charAt(r)+a.charAt(i)}while(s<e.length);switch(l=c.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l}var Yt=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 a=e.charCodeAt(i),s=null;a<128?n++:s=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Ot(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},Qt=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 a="on"+n,s=t[a];t[a]=function(t,n,r){return function(i){if(i=i||e(null==ft?void 0:ft.event)){var o,a=!0;Ct(r)&&(o=r(i));var s=n.call(t,i);return!1!==o&&!1!==s||(a=!1),a}}}(t,r,s)}else Pt.error("No valid element provided to register_event")}}();function Jt(e,t){var n=function(){if(!ht)return t("document not found");var n=ht.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=ht.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):ht.body.appendChild(n)};null!=ht&&ht.body?n():null==ht||ht.addEventListener("DOMContentLoaded",n)}function Xt(e){return e?Lt(e).split(/\s+/):[]}function Kt(e){var t="";switch(s(e.className)){case"string":t=e.className;break;case"object":t=("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Xt(t)}function Zt(e){var t="";return an(e)&&!sn(e)&&e.childNodes&&e.childNodes.length&&At(e.childNodes,(function(e){nn(e)&&e.textContent&&(t+=Lt(e.textContent).split(/(\s+)/).filter(un).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))})),Lt(t)}function en(e){return!!e&&1===e.nodeType}function tn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function nn(e){return!!e&&3===e.nodeType}function rn(e){return!!e&&11===e.nodeType}var on=["a","button","form","input","select","textarea","label"];function an(e){for(var t=e;t.parentNode&&!tn(t,"body");t=t.parentNode){var n=Kt(t);if(qt(n,"ph-sensitive")||qt(n,"ph-no-capture"))return!1}if(qt(Kt(e),"ph-include"))return!0;var r=e.type||"";if(Et(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if(Et(i)){if(/^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,"")))return!1}return!0}function sn(e){return!!(tn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||tn(e,"select")||tn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function un(e){if(Ot(e)||Ft(e))return!1;if(Et(e)){e=Lt(e);if(/^(?:(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,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0}function ln(e){var t=Zt(e);return un(t="".concat(t," ").concat(cn(e)).trim())?t:""}function cn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&At(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=Zt(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(cn(e)).trim())}catch(e){Pt.error(e)}})),t}function dn(e){return function(e){var t=e.map((function(e){var t,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class){e.attr_class.sort();var i,o=w(e.attr_class);try{for(o.s();!(i=o.n()).done;){var s=i.value;r+=".".concat(s.replace(/"/g,""))}}catch(e){o.e(e)}finally{o.f()}}var u=a(a(a(a({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),l={};return Bt(u).sort((function(e,t){var n=_(e,1)[0],r=_(t,1)[0];return n.localeCompare(r)})).forEach((function(e){var t=_(e,2),n=t[0],r=t[1];return l[fn(n.toString())]=fn(r.toString())})),r+=":",r+=Bt(u).map((function(e){var t=_(e,2),n=t[0],r=t[1];return"".concat(n,'="').concat(r,'"')})).join("")}));return t.join(";")}(function(e){return e.map((function(e){var t,n,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(n=e.attr__href)||void 0===n?void 0:n.slice(0,2048),attr_class:pn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Bt(e).filter((function(e){return 0===_(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=_(e,2),n=t[0],i=t[1];return r.attributes[n]=i})),r}))}(e))}function fn(e){return e.replace(/"|\\"/g,'\\"')}function pn(e){var t=e.attr__class;return t?wt(t)?t:Xt(t):void 0}var hn=function(){function e(t){u(this,e),this.clicks=[],this.enabled=t}return c(e,[{key:"isRageClick",value:function(e,t,n){if(!this.enabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),vn="$people_distinct_id",gn="__alias",mn="__timers",_n="$autocapture_disabled_server_side",yn="$session_recording_enabled_server_side",bn="$console_log_recording_enabled_server_side",kn="$session_recording_recorder_version_server_side",wn="$session_recording_network_payload_capture",Sn="$sesid",Cn="$session_is_sampled",In="$enabled_feature_flags",xn="$early_access_features",Fn="$stored_person_properties",En="$stored_group_properties",On="$surveys",Rn="$flag_call_reported",Mn="$user_state",Tn="$posthog_quota_limited",Pn="$client_session_props",Nn=[vn,gn,"__cmpns",mn,yn,Sn,In,Mn,Tn,xn,En,Fn,On,Rn,Pn];function Ln(e,t){return t.length>e?t.slice(0,e)+"...":t}var Dn={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t,n=Ot(this._isDisabledServerSide)?!(null===(t=e.persistence)||void 0===t||!t.props[_n]):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&&!en(t));return t},_getAugmentPropertiesFromElement:function(e){if(!an(e))return{};var t={};return At(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&&un(r)&&(t[n]=r)}})),t},_getPropertiesFromElement:function(e,t,n){var r,i=e.tagName.toLowerCase(),o={tag_name:i};on.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=Ln(1024,ln(e)):o.$el_text=Ln(1024,Zt(e)));var a=Kt(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e})));var s=null===(r=this.config)||void 0===r?void 0:r.element_attribute_ignorelist;At(e.attributes,(function(n){var r;if((!sn(e)||-1!==["name","id","class"].indexOf(n.name))&&((null==s||!s.includes(n.name))&&!t&&un(n.value)&&(r=n.name,!Et(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var i=n.value;"class"===n.name&&(i=Xt(i).join(" ")),o["attr__"+n.name]=Ln(1024,i)}}));for(var u=1,l=1,c=e;c=this._previousElementSibling(c);)u++,c.tagName===e.tagName&&l++;return o.nth_child=u,o.nth_of_type=l,o},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return At(null==ht?void 0:ht.querySelectorAll(e.css_selector),(function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),un(n)&&t.push(n)})),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return At(this._customProperties,(function(r){At(r.event_selectors,(function(i){At(null==ht?void 0:ht.querySelectorAll(i),(function(i){qt(e,i)&&an(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return Ft(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},_captureEvent:function(e,t){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$autocapture",o=this._getEventTarget(e);(nn(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"));if(o&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!ft||!e||tn(e,"html")||!en(e))return!1;if(null!=n&&n.url_allowlist){var r=ft.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 a=n.element_allowlist;if(a&&!a.some((function(t){return e.tagName.toLowerCase()===t})))return!1}if(null!=n&&n.css_selector_allowlist){var s=n.css_selector_allowlist;if(s&&!s.some((function(t){return e.matches(t)})))return!1}for(var u=!1,l=[e],c=!0,d=e;d.parentNode&&!tn(d,"body");)if(rn(d.parentNode))l.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=d.parentNode||!1))break;if(on.indexOf(c.tagName.toLowerCase())>-1)u=!0;else{var f=ft.getComputedStyle(c);f&&"pointer"===f.getPropertyValue("cursor")&&(u=!0)}l.push(c),d=c}var p=ft.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return"submit"===t.type;case"input":case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return u?"click"===t.type:"click"===t.type&&(on.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var a,s,u=[o],l=o;l.parentNode&&!tn(l,"body");)rn(l.parentNode)?(u.push(l.parentNode.host),l=l.parentNode.host):(u.push(l.parentNode),l=l.parentNode);var c,d=[],f={},p=!1;if(At(u,(function(e){var n=an(e);"a"===e.tagName.toLowerCase()&&(c=e.getAttribute("href"),c=n&&un(c)&&c),qt(Kt(e),"ph-no-capture")&&(p=!0),d.push(r._getPropertiesFromElement(e,t.config.mask_all_element_attributes,t.config.mask_all_text));var i=r._getAugmentPropertiesFromElement(e);$t(f,i)})),t.config.mask_all_text||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?d[0].$el_text=ln(o):d[0].$el_text=Zt(o)),c&&(d[0].attr__href=c),p)return!1;var h=$t(this._getDefaultProperties(e.type),t.elementsChainAsString?{$elements_chain:dn(d)}:{$elements:d},null!==(a=d[0])&&void 0!==a&&a.$el_text?{$el_text:null===(s=d[0])||void 0===s?void 0:s.$el_text}:{},this._getCustomProperties(u),f);return t.capture(i,h),!0}},_navigate:function(e){ft&&(ft.location.href=e)},_addDomEventHandlers:function(e){var t=this;if(ft&&ht){var n=function(n){n=n||(null==ft?void 0:ft.event),t._captureEvent(n,e)};Qt(ht,"submit",n,!1,!0),Qt(ht,"change",n,!1,!0),Qt(ht,"click",n,!1,!0)}},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;Mt(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 hn(e.config.rageclick)},afterDecideResponse:function(e,t){var n=t.config.token;this._initializedTokens.indexOf(n)>-1?Pt.info('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(d({},_n,!!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=Ft(t)?10:t,n=Ft(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return Ct(null==ht?void 0:ht.querySelectorAll)}};!function(e){for(var t in e)Ct(e[t])&&(e[t]=e[t].bind(e))}(Dn),function(e){for(var t in e)Ct(e[t])&&(e[t]=Wt(e[t]))}(Dn);var An="$active_feature_flags",$n="$override_feature_flags",qn="$feature_flag_payloads",Bn=function(e){var t,n={},r=w(Bt(e||{}));try{for(r.s();!(t=r.n()).done;){var i=_(t.value,2),o=i[0],a=i[1];a&&(n[o]=a)}}catch(e){r.e(e)}finally{r.f()}return n},jn=function(){function e(t){u(this,e),this.instance=t,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return c(e,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(In),t=this.instance.get_property($n);if(!t)return e||{};for(var n=$t({},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||(Pt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(qn)||{}}},{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;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var t=this.instance.config.token,n=this.instance.get_property(Fn),r=this.instance.get_property(En),i=Gt(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(Rn)||{};if(t.send_event||!("send_event"in t))if(!(e in o)||!o[e].includes(i))wt(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register(d({},Rn,o)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r});return r}Pt.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);Pt.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]:{},i=e.featureFlags,o=e.featureFlagPayloads;if(i)if(wt(i)){var s,u={};if(i)for(var l=0;l<i.length;l++)u[i[l]]=!0;t&&t.register((d(s={},An,i),d(s,In,u),s))}else{var c,f=i,p=o;e.errorsWhileComputingFlags&&(f=a(a({},n),f),p=a(a({},r),p)),t&&t.register((d(c={},An,Object.keys(Bn(f))),d(c,In,f||{}),d(c,qn,p||{}),c))}}(e,this.instance.persistence,t,n),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return Pt.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,!1===e)this.instance.persistence.unregister($n);else if(wt(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(d({},$n,t))}else this.instance.persistence.register(d({},$n,e))}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks(),r=n.flags,i=n.flagVariants;e(r,i)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){var n,r,i=d({},"$feature_enrollment/".concat(e),t);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:i}),this.setPersonPropertiesForFlags(i,!1);var o=a(a({},this.getFlagVariants()),{},d({},e,t));null===(n=this.instance.persistence)||void 0===n||n.register((d(r={},An,Object.keys(Bn(o))),d(r,In,o),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(xn);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(d({},xn,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(Fn)||{};this.instance.register(d({},Fn,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Fn)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(En)||{};0!==Object.keys(n).length&&Object.keys(n).forEach((function(t){n[t]=a(a({},n[t]),e[t]),delete e[t]})),this.instance.register(d({},En,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(En)||{};this.instance.register(d({},En,a(a({},t),{},d({},e,{}))))}else this.instance.unregister(En)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Rt(e)&&isFinite(e)&&Math.floor(e)===e});var Hn="0123456789abcdef",Wn=function(){function e(t){if(u(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return c(e,[{key:"toString",value:function(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Hn.charAt(this.bytes[t]>>>4)+Hn.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new 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 new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),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}(),Un=function(){function e(){u(this,e),d(this,"timestamp",0),d(this,"counter",0),d(this,"random",new Gn)}return c(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Ft(e)){this.timestamp=0;var t=this.generateOrAbort();if(Ft(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}},{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 Wn.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),Vn=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};ft&&!Ft(ft.crypto)&&crypto.getRandomValues&&(Vn=function(e){return crypto.getRandomValues(e)});var zn,Gn=function(){function e(){u(this,e),d(this,"buffer",new Uint32Array(8)),d(this,"cursor",1/0)}return c(e,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Vn(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),Yn=function(){return Qn().toString()},Qn=function(){return(zn||(zn=new Un)).generate()},Jn="Thu, 01 Jan 1970 00:00:00 GMT",Xn="";var Kn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Zn=function(e){var t=e.match(Kn);return t?t[0]:""};function er(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ht;if(Xn)return Xn;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),r=Math.min(n.length,8),i="dmn_chk_"+Yn(),o=new RegExp("(^|;)\\s*"+i+"=1");!Xn&&r--;){var a=n.slice(r).join("."),s=i+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+Jn,Xn=a)}return Xn}(e);if(!n){var r=Zn(e);r!==n&&Pt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var tr={is_supported:function(){return!!ht},error:function(e){Pt.error("cookieStore error: "+e)},get:function(e){if(ht){try{for(var t=e+"=",n=ht.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(tr.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){if(ht)try{var o="",a="",s=er(ht.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+24*n*60*60*1e3),o="; expires="+u.toUTCString()}i&&(a="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+s+a;return l.length>3686.4&&Pt.warn("cookieStore warning: large cookie, len="+l.length),ht.cookie=l,l}catch(e){return}},remove:function(e,t){try{tr.set(e,"",-1,t)}catch(e){return}}},nr=null,rr={is_supported:function(){if(!Ot(nr))return nr;var e=!0;if(Ft(ft))e=!1;else try{var t="__mplssupport__";rr.set(t,"xyz"),'"xyz"'!==rr.get(t)&&(e=!1),rr.remove(t)}catch(t){e=!1}return e||Pt.error("localStorage unsupported; falling back to cookie store"),nr=e,e},error:function(e){Pt.error("localStorage error: "+e)},get:function(e){try{return null==ft?void 0:ft.localStorage.getItem(e)}catch(e){rr.error(e)}return null},parse:function(e){try{return JSON.parse(rr.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==ft||ft.localStorage.setItem(e,JSON.stringify(t))}catch(e){rr.error(e)}},remove:function(e){try{null==ft||ft.localStorage.removeItem(e)}catch(e){rr.error(e)}}},ir=["distinct_id",Sn,Cn],or=a(a({},rr),{},{parse:function(e){try{var t={};try{t=tr.parse(e)||{}}catch(e){}var n=$t(t,JSON.parse(rr.get(e)||"{}"));return rr.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{rr.set(e,t);var o={};ir.forEach((function(e){t[e]&&(o[e]=t[e])})),Object.keys(o).length&&tr.set(e,o,n,r,i)}catch(e){rr.error(e)}},remove:function(e,t){try{null==ft||ft.localStorage.removeItem(e),tr.remove(e,t)}catch(e){rr.error(e)}}}),ar={},sr={is_supported:function(){return!0},error:function(e){Pt.error("memoryStorage error: "+e)},get:function(e){return ar[e]||null},parse:function(e){return ar[e]||null},set:function(e,t){ar[e]=t},remove:function(e){delete ar[e]}},ur=null,lr={is_supported:function(){if(!Ot(ur))return ur;if(ur=!0,Ft(ft))ur=!1;else try{var e="__support__";lr.set(e,"xyz"),'"xyz"'!==lr.get(e)&&(ur=!1),lr.remove(e)}catch(e){ur=!1}return ur},error:function(e){Pt.error("sessionStorage error: ",e)},get:function(e){try{return null==ft?void 0:ft.sessionStorage.getItem(e)}catch(e){lr.error(e)}return null},parse:function(e){try{return JSON.parse(lr.get(e))||null}catch(e){}return null},set:function(e,t){try{null==ft||ft.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){lr.error(e)}},remove:function(e){try{null==ft||ft.sessionStorage.removeItem(e)}catch(e){lr.error(e)}}},cr=["localhost","127.0.0.1"],dr=function(e){var t=null==ht?void 0:ht.createElement("a");return Ft(t)?null:(t.href=e,t)},fr=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},pr=function(e,t){for(var n,r=((e.split("#")[0]||"").split("?")[1]||"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!wt(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){Pt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},hr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null};var vr={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gbraid","wbraid","fbclid","msclkid"].concat(e||[]),n={};return At(t,(function(e){var t=ht?pr(ht.URL,e):"";t.length&&(n[e]=t)})),n},searchEngine:function(){var e=null==ht?void 0:ht.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=vr.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(!Ot(e)){n.$search_engine=e;var r=ht?pr(ht.referrer,t):"";r.length&&(n.ph_keyword=r)}return n},browser:function(e,t,n){return t=t||"",n||qt(e," OPR/")?qt(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":qt(e,"IEMobile")||qt(e,"WPDesktop")?"Internet Explorer Mobile":qt(e,"SamsungBrowser/")?"Samsung Internet":qt(e,"Edge")||qt(e,"Edg/")?"Microsoft Edge":qt(e,"FBIOS")?"Facebook Mobile":qt(e,"Chrome")?"Chrome":qt(e,"CriOS")?"Chrome iOS":qt(e,"UCWEB")||qt(e,"UCBrowser")?"UC Browser":qt(e,"FxiOS")?"Firefox iOS":qt(t,"Apple")||function(e){return qt(e,"Safari")&&!qt(e,"Chrome")&&!qt(e,"Android")}(e)?qt(e,"Mobile")?"Mobile Safari":"Safari":qt(e,"Android")?"Android Mobile":qt(e,"Konqueror")||qt(e,"konqueror")?"Konqueror":qt(e,"Firefox")?"Firefox":qt(e,"MSIE")||qt(e,"Trident/")?"Internet Explorer":qt(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+)?)/i],BlackBerry:[/BlackBerry (\d+(\.\d+)?)/,/Version\/(\d+(\.\d+)?)/],"Android Mobile":[/android\s(\d+(\.\d+)?)/],"Samsung Internet":[/SamsungBrowser\/(\d+(\.\d+)?)/],"Internet Explorer":[/(rv:|MSIE )(\d+(\.\d+)?)/],Mozilla:[/rv:(\d+(\.\d+)?)/]}[vr.browser(e,t,n)];if(Ft(r))return null;for(var i=0;i<r.length;i++){var o=r[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.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(null==ht?void 0:ht.referrer)||"$direct"},referringDomain:function(){var e;return null!=ht&&ht.referrer&&(null===(e=dr(ht.referrer))||void 0===e?void 0:e.host)||"$direct"},properties:function(){if(!vt)return{};var e=vr.os(vt),t=e.os_name,n=e.os_version;return $t(Ut({$os:t,$os_version:n,$browser:vr.browser(vt,navigator.vendor,gt.opera),$device:vr.device(vt),$device_type:vr.deviceType(vt)}),{$current_url:null==ft?void 0:ft.location.href,$host:null==ft?void 0:ft.location.host,$pathname:null==ft?void 0:ft.location.pathname,$raw_user_agent:vt.length>1e3?vt.substring(0,997)+"...":vt,$browser_version:vr.browserVersion(vt,navigator.vendor,gt.opera),$browser_language:vr.browserLanguage(),$screen_height:null==ft?void 0:ft.screen.height,$screen_width:null==ft?void 0:ft.screen.width,$viewport_height:null==ft?void 0:ft.innerHeight,$viewport_width:null==ft?void 0:ft.innerWidth,$lib:"web",$lib_version:mt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:jt()/1e3})},people_properties:function(){if(!vt)return{};var e=vr.os(vt),t=e.os_name,n=e.os_version;return $t(Ut({$os:t,$os_version:n,$browser:vr.browser(vt,navigator.vendor,gt.opera)}),{$browser_version:vr.browserVersion(vt,navigator.vendor,gt.opera)})}},gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mr=function(){function e(t){u(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===gr.indexOf(t.persistence.toLowerCase())&&(Pt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r=t.persistence.toLowerCase();"localstorage"===r&&rr.is_supported()?this.storage=rr:"localstorage+cookie"===r&&or.is_supported()?this.storage=or:"sessionstorage"===r&&lr.is_supported()?this.storage=lr:"memory"===r?this.storage=sr:"cookie"===r?this.storage=tr:or.is_supported()?this.storage=or:this.storage=tr,this.load(),this.update_config(t),this.save()}return c(e,[{key:"properties",value:function(){var e={};return At(this.props,(function(t,n){if(n===In&&It(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e["$feature/".concat(r[i])]=t[r[i]];else a=n,s=!1,(Ot(o=Nn)?s:dt&&o.indexOf===dt?-1!=o.indexOf(a):(At(o,(function(e){if(s||(s=e===a))return Nt})),s))||(e[n]=t);var o,a,s})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=$t({},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(It(e)){Ft(t)&&(t="None"),this.expire_days=Ft(n)?this.default_expiry:n;var i=!1;if(At(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(It(e)){this.expire_days=Ft(t)?this.default_expiry:t;var r=!1;if(At(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(vr.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(vr.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||vr.referrer(),$referring_domain:this.props.$referring_domain||vr.referringDomain()})}},{key:"get_referrer_info",value:function(){return Ut({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return At(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[mn]||{};n[e]=t,this.props[mn]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[mn]||{})[e];return Ft(t)||(delete this.props[mn][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[Mn]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[Mn]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[Tn]||{}}},{key:"set_quota_limits",value:function(e){this.props[Tn]=e,this.save()}}]),e}(),_r=2,yr=4,br=3,kr=6,wr=0,Sr="rrweb/console@1";var Cr=c((function e(t){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,e),d(this,"bucketSize",100),d(this,"refillRate",10),d(this,"mutationBuckets",{}),d(this,"loggedTracker",{}),d(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]}))})),d(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]})),d(this,"numberOfChanges",(function(e){var t,n,r,i,o,a,s,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===(a=e.texts)||void 0===a?void 0:a.length)&&void 0!==o?o:0)+(null!==(s=null===(u=e.adds)||void 0===u?void 0:u.length)&&void 0!==s?s:0)})),d(this,"throttleMutations",(function(e){if(e.type!==br||e.data.source!==wr)return e;var t=e.data,n=i.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((function(e){var t,n,r,o=_(i.getNodeOrRelevantParent(e.id),2),a=o[0],s=o[1];if(0===i.mutationBuckets[a])return!1;(i.mutationBuckets[a]=null!==(t=i.mutationBuckets[a])&&void 0!==t?t:i.bucketSize,i.mutationBuckets[a]=Math.max(i.mutationBuckets[a]-1,0),0===i.mutationBuckets[a])&&(i.loggedTracker[a]||(i.loggedTracker[a]=!0,null===(n=(r=i.options).onBlockedNode)||void 0===n||n.call(r,a,s)));return 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)})),Ir=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}(Ir||{}),xr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(e){return e},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6},Fr=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Er=["/s/","/e/","/i/vo/e/"];function Or(e,t,n,r){var i=null==t?void 0:t["content-length"];return i&&parseInt(i)>n?"".concat(r," body too large to record"):e}var Rr=function(e,t){var n,r,i,o=e.session_recording,s=!1!==o.recordHeaders&&t.recordHeaders,u=!1!==o.recordBody&&t.recordBody,l=!1!==o.recordPerformance&&t.recordPerformance,c=(n=o,i=Math.min(1e6,null!==(r=n.payloadSizeLimitBytes)&&void 0!==r?r:1e6),function(e){return null!=e&&e.requestBody&&(e.requestBody=Or(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=Or(e.responseBody,e.responseHeaders,i,"Response")),e}),d=function(e){return c(function(e){var t=dr(e.name);if(!(t&&t.pathname&&Er.includes(t.pathname)))return e}((t=e,Object.keys(null!==(n=t.requestHeaders)&&void 0!==n?n:{}).forEach((function(e){var n;Fr.includes(e.toLowerCase())&&(null===(n=t.requestHeaders)||void 0===n||delete n[e])})),t)));var t,n},f=Ct(e.session_recording.maskNetworkRequestFn);return f&&Ct(e.session_recording.maskCapturedNetworkRequestFn)&&Pt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(e.session_recording.maskCapturedNetworkRequestFn=function(t){var n=e.session_recording.maskNetworkRequestFn({url:t.name});return a(a({},t),{},{name:null==n?void 0:n.url})}),o.maskRequestFn=Ct(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,r,i,o=d(t);return o&&null!==(n=null===(r=(i=e.session_recording).maskCapturedNetworkRequestFn)||void 0===r?void 0:r.call(i,o))&&void 0!==n?n:void 0}:void 0,o.maskRequestFn||(o.maskRequestFn=d),a(a(a({},xr),o),{},{recordHeaders:s,recordBody:u,recordPerformance:l,recordInitialRequests:l})},Mr="__ph_opt_in_out_";function Tr(e,t){Br(!0,e,t)}function Pr(e,t){Br(!1,e,t)}function Nr(e,t){return"1"===qr(e,t)}function Lr(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||ft,n=null==t?void 0:t.navigator,r=!1;return At([null==n?void 0:n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){qt([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===qr(e,t)}function Dr(e,t){Ar(t=t||{}).remove($r(e,t),!!t.crossSubdomainCookie)}function Ar(e){return"localStorage"===(e=e||{}).persistenceType?rr:"localStorage+cookie"===e.persistenceType?or:tr}function $r(e,t){return((t=t||{}).persistencePrefix||Mr)+e}function qr(e,t){return Ar(t).get($r(e,t))}function Br(e,t,n){Et(t)&&t.length?(Ar(n=n||{}).set($r(t,n),e?1:0,Rt(n.cookieExpiration)?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):Pt.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function jr(e){var t=!1;try{var n=e.config.token,r=e.config.respect_dnt,i=e.config.opt_out_capturing_persistence_type,o=e.config.opt_out_capturing_cookie_prefix||void 0,a=e.config.window;n&&(t=Lr(n,{respectDnt:r,persistenceType:i,persistencePrefix:o,window:a}))}catch(e){Pt.error("Unexpected error when checking capturing opt-out status: "+e)}return t}var Hr,Wr="/s/",Ur=3e5;!function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet"}(Hr||(Hr={}));var Vr=[Hr.MouseMove,Hr.MouseInteraction,Hr.Scroll,Hr.ViewportResize,Hr.Input,Hr.TouchMove,Hr.MediaInteraction,Hr.Drag],zr=function(){function e(t){var n=this;if(u(this,e),d(this,"isIdle",!1),d(this,"_linkedFlagSeen",!1),d(this,"_lastActivityTimestamp",Date.now()),d(this,"windowId",null),d(this,"sessionId",null),d(this,"_linkedFlag",null),d(this,"_sampleRate",null),d(this,"_minimumDuration",null),d(this,"_recordCanvas",!1),d(this,"_canvasFps",null),d(this,"_canvasQuality",null),d(this,"_forceAllowLocalhostNetworkCapture",!1),this.instance=t,this._captureStarted=!1,this._endpoint=Wr,this.stopRrweb=void 0,this.receivedDecide=!1,null==ft||ft.addEventListener("beforeunload",(function(){n._flushBuffer()})),null==ft||ft.addEventListener("offline",(function(){n._tryAddCustomEvent("browser offline",{})})),null==ft||ft.addEventListener("online",(function(){n._tryAddCustomEvent("browser online",{})})),!this.instance.sessionManager)throw Pt.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");this.buffer=this.clearBuffer()}return c(e,[{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw Pt.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return Rt(this._sampleRate)?this.instance.get_property(Cn):null}},{key:"sessionDuration",get:function(){var e,t,n=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],r=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return n?n.timestamp-r:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(yn),t=!this.instance.config.disable_session_recording;return ft&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(bn),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"recordingVersion",get:function(){var e,t=this.instance.get_property(kn);return(null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recorderVersion)||t||"v1"}},{key:"networkPayloadCapture",get:function(){var e,t,n=this.instance.get_property(wn),r={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},i=(null==r?void 0:r.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==r?void 0:r.recordBody)||(null==n?void 0:n.recordBody),a=this.instance.config.capture_performance||(null==n?void 0:n.capturePerformance);return i||o||a?{recordHeaders:i,recordBody:o,recordPerformance:a}:void 0}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?Et(this._linkedFlag)&&!this._linkedFlagSeen?"buffering":Mt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this.startCaptureAndTrySendingQueuedSnapshots(),Pt.info("[SessionRecording] started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Pt.info("[SessionRecording] stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n=this.sessionId!==e;if(Rt(this._sampleRate)){var r,i=this.isSampled;if(n||!Mt(i))r=Math.random()<this._sampleRate;else r=i;r||Pt.warn("[SessionSampling] Sample rate (".concat(this._sampleRate,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),null===(t=this.instance.persistence)||void 0===t||t.register(d({},Cn,r))}else{var o;null===(o=this.instance.persistence)||void 0===o||o.register(d({},Cn,null))}}},{key:"afterDecideResponse",value:function(e){var t,n,r,i,o,s,u,l,c,f,p,h=this;this.instance.persistence&&this.instance.persistence.register((d(p={},yn,!!e.sessionRecording),d(p,bn,null===(l=e.sessionRecording)||void 0===l?void 0:l.consoleLogRecordingEnabled),d(p,kn,null===(c=e.sessionRecording)||void 0===c?void 0:c.recorderVersion),d(p,wn,a({capturePerformance:e.capturePerformance},null===(f=e.sessionRecording)||void 0===f?void 0:f.networkPayloadCapture)),p));var v=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate;this._sampleRate=Ft(v)||Ot(v)?null:parseFloat(v);var g=null===(n=e.sessionRecording)||void 0===n?void 0:n.minimumDurationMilliseconds;this._minimumDuration=Ft(g)?null:g;var m=null===(r=e.sessionRecording)||void 0===r?void 0:r.recordCanvas;this._recordCanvas=!Ft(m)&&!Ot(m)&&m;var _=null===(i=e.sessionRecording)||void 0===i?void 0:i.canvasFps;this._canvasFps=Ft(_)?null:_;var y,b=null===(o=e.sessionRecording)||void 0===o?void 0:o.canvasQuality;(this._canvasQuality=Ft(b)||Ot(b)?null:parseFloat(b),this._linkedFlag=(null===(s=e.sessionRecording)||void 0===s?void 0:s.linkedFlag)||null,null!==(u=e.sessionRecording)&&void 0!==u&&u.endpoint)&&(this._endpoint=null===(y=e.sessionRecording)||void 0===y?void 0:y.endpoint);if(Rt(this._sampleRate)&&this.sessionManager.onSessionId((function(e){h.makeSamplingDecision(e)})),Et(this._linkedFlag)){var k=this._linkedFlag;this.instance.onFeatureFlags((function(e){h._linkedFlagSeen=e.includes(k)}))}this.receivedDecide=!0,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:jt()})}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(!Ft(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||jr(this.instance))){this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId();var t="v2"===this.recordingVersion?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.recordingVersion?Jt(this.instance.config.api_host+"/static/".concat(t,"?v=").concat(mt.LIB_VERSION),(function(n){if(n)return Pt.error("Could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return e.type===br&&-1!==Vr.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this._isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>Ur&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Ur}));var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)),!this.isIdle){var r=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,o=r.sessionId,a=this.sessionId!==o,s=this.windowId!==i;this.windowId=i,this.sessionId=o,(n||-1===[_r,yr].indexOf(e.type)&&(s||a))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRwebMethod",value:function(e){if(!this._captureStarted)return!1;try{return e(),!0}catch(e){return Pt.error("[Session-Recording] using rrweb when not started.",e),!1}}},{key:"_tryAddCustomEvent",value:function(e,t){var n=this;return this._tryRRwebMethod((function(){var r;return null===(r=n.rrwebRecord)||void 0===r?void 0:r.addCustomEvent(e,t)}))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRwebMethod((function(){var t;return null===(t=e.rrwebRecord)||void 0===t?void 0:t.takeFullSnapshot()}))}},{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=ft.rrweb?ft.rrweb.record:ft.rrwebRecord;for(var r=this.instance.config.session_recording,i=0,o=Object.entries(r||{});i<o.length;i++){var s=_(o[i],2),u=s[0],l=s[1];u in n&&(n[u]=l)}if(!this._recordCanvas||Ot(this._canvasFps)||Ot(this._canvasQuality)||(n.recordCanvas=!0,n.sampling={canvas:this._canvasFps},n.dataURLOptions={type:"image/webp",quality:this._canvasQuality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new Cr(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");Pt.info(r,{node:n}),t.log("[PostHog Recorder] "+r,"warn")}});var c=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(a({emit:function(e){t.onRRwebEmit(e)},plugins:c},n)),this.instance._addCaptureHook((function(e){try{if("$pageview"===e){var n=ft?t._maskUrl(ft.location.href):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n})}}catch(e){Pt.error("Could not add $pageview to rrweb session",e)}})),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:n,activePlugins:c.map((function(e){return null==e?void 0:e.name}))})}else Pt.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_gatherRRWebPlugins",value:function(){var e=[];(gt.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(gt.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&Ct(gt.getRecordNetworkPlugin))&&(!cr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(gt.getRecordNetworkPlugin(Rr(this.instance.config,this.networkPayloadCapture))):Pt.info("[SessionReplay-NetworkCapture] not started because we are on localhost."));return e}},{key:"onRRwebEmit",value:function(e){if(e&&It(e)){if(e.type===Ir.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=e;if(t&&It(t)&&t.type===kr&&It(t.data)&&t.data.plugin===Sr){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var n=[],r=0;r<t.data.payload.payload.length;r++)t.data.payload.payload[r]&&t.data.payload.payload[r].length>2e3?n.push(t.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):n.push(t.data.payload.payload[r]);return t.data.payload.payload=n,e}return e}(n),i=JSON.stringify(r).length;if(this._updateWindowAndSessionIds(r),!this.isIdle){var o={$snapshot_bytes:i,$snapshot_data:r,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(o):this.clearBuffer()}}}}},{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:"clearBuffer",value:function(){return this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_flushBuffer",value:function(){var e=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this._minimumDuration,n=this.sessionDuration,r=Rt(n)&&n>=0,i=Rt(t)&&r&&n<t;return"buffering"===this.status||i?(this.flushBufferTimer=setTimeout((function(){e._flushBuffer()}),2e3),this.buffer||this.clearBuffer()):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.clearBuffer()):this.buffer||this.clearBuffer()}},{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.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),Ot(this.buffer.sessionId)&&!Ot(this.sessionId)&&(this.buffer.sessionId=this.sessionId,this.buffer.windowId=this.windowId),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:e.$snapshot_data.type===_r}})}}]),e}(),Gr=function(){function e(t){u(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return c(e,[{key:"call",value:function(){var e=this,t=Gt(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Fn),group_properties:this.instance.get_property(En),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=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),0!==(null==e?void 0:e.status)){if(!ht||!ht.body)return Pt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){n.parseDecideResponse(e)}),500);this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),Dn.afterDecideResponse(e,this.instance),this.instance._afterDecideResponse(e),this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e);var r=null==ft?void 0:ft.extendPostHogWithSurveys;e.surveys&&!r&&Jt(this.instance.config.api_host+"/static/surveys.js",(function(e){if(e)return Pt.error("Could not load surveys script",e);ft.extendPostHogWithSurveys(n.instance)}));var i=null==ft?void 0:ft.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&Ft(i)&&Jt(this.instance.config.api_host+"/static/exception-autocapture.js",(function(t){if(t)return Pt.error("Could not load exception autocapture script",t);ft.extendPostHogWithExceptionAutocapture(n.instance,e)})),e.siteApps)if(this.instance.config.opt_in_site_apps){var o,a=this.instance.config.api_host,s=w(e.siteApps);try{var u=function(){var e=o.value,t=e.id,r=e.url,i=[a,"/"===a[a.length-1]&&"/"===r[0]?r.substring(1):r].join("");gt["__$$ph_site_app_".concat(t)]=n.instance,Jt(i,(function(e){e&&Pt.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(s.s();!(o=s.n()).done;)u()}catch(e){s.e(e)}finally{s.f()}}else e.siteApps.length>0&&Pt.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else Pt.error("Failed to fetch feature flags from PostHog.")}}]),e}(),Yr=["https://app.posthog.com","https://eu.posthog.com"],Qr=["source"],Jr=null!=ft&&ft.location?hr(ft.location.hash,"__posthog")||hr(location.hash,"state"):null,Xr=function(){function e(t){u(this,e),this.instance=t}return c(e,[{key:"afterDecideResponse",value:function(e){var t=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&this.loadToolbar(a({},t))}},{key:"maybeLoadToolbar",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!ft||!ht)return!1;n=null!==(e=n)&&void 0!==e?e:ft.location,i=null!==(t=i)&&void 0!==t?t:ft.history;try{if(!r){try{ft.localStorage.setItem("test","test"),ft.localStorage.removeItem("test")}catch(e){return!1}r=null==ft?void 0:ft.localStorage}var o,a=Jr||hr(n.hash,"__posthog")||hr(n.hash,"state"),s=a?Ht((function(){return JSON.parse(atob(decodeURIComponent(a)))}))||Ht((function(){return JSON.parse(decodeURIComponent(a))})):null;return s&&"ph_authorize"===s.action?((o=s).source="url",o&&Object.keys(o).length>0&&(s.desiredHash?n.hash=s.desiredHash:i?i.replaceState("",ht.title,n.pathname+n.search):n.hash="")):((o=JSON.parse(r.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch(e){return!1}}},{key:"loadToolbar",value:function(e){var t=this;if(!ft||gt._postHogToolbarLoaded)return!1;gt._postHogToolbarLoaded=!0;var n=this.instance.config.api_host,r=3e5,i=Math.floor(Date.now()/r)*r,o="".concat(n).concat(n.endsWith("/")?"":"/","static/toolbar.js?t=").concat(i),s=!Yr.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,u=a(a({token:this.instance.config.token},e),{},{apiURL:n},s?{instrument:!1}:{});u.source;var l=v(u,Qr);return ft.localStorage.setItem("_postHogToolbarParams",JSON.stringify(l)),Jt(o,(function(e){e?Pt.error("Failed to load toolbar",e):(gt.ph_load_toolbar||gt.ph_load_editor)(u,t.instance)})),Qt(ft,"turbolinks:load",(function(){gt._postHogToolbarLoaded=!1,t.loadToolbar(u)})),!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]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,n)}}]),e}(),Kr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;u(this,e),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=t}return c(e,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),e}(),Zr=function(e){f(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;return u(this,n),(r=t.call(this,i)).handlePollRequest=e,r}return c(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(),n=function(n){var r=t[n],i=r.url,o=r.data,a=r.options;At(o,(function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp})),e.handlePollRequest(i,o,a)};for(var r in t)n(r);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(y(n.filter((function(e){return 0===e.url.indexOf("/e")}))),y(n.filter((function(e){return 0!==e.url.indexOf("/e")})))).map((function(t){var n=t.url,r=t.data,i=t.options;e.handlePollRequest(n,r,a(a({},i),{},{transport:"sendBeacon"}))}))}},{key:"formatQueue",value:function(){var e={};return At(this._event_queue,(function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;Ft(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}(Kr),ei=Uint8Array,ti=Uint16Array,ni=Uint32Array,ri=new ei([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]),ii=new ei([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]),oi=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ai=function(e,t){for(var n=new ti(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new ni(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]},si=ai(ri,2),ui=si[0],li=si[1];ui[28]=258,li[258]=28;for(var ci=ai(ii,0)[1],di=new ti(32768),fi=0;fi<32768;++fi){var pi=(43690&fi)>>>1|(21845&fi)<<1;pi=(61680&(pi=(52428&pi)>>>2|(13107&pi)<<2))>>>4|(3855&pi)<<4,di[fi]=((65280&pi)>>>8|(255&pi)<<8)>>>1}var hi=function(e,t,n){for(var r=e.length,i=0,o=new ti(t);i<r;++i)++o[e[i]-1];var a,s=new ti(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new ti(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)a[di[d]>>>u]=l}else for(a=new ti(r),i=0;i<r;++i)a[i]=di[s[e[i]-1]++]>>>15-e[i];return a},vi=new ei(288);for(fi=0;fi<144;++fi)vi[fi]=8;for(fi=144;fi<256;++fi)vi[fi]=9;for(fi=256;fi<280;++fi)vi[fi]=7;for(fi=280;fi<288;++fi)vi[fi]=8;var gi=new ei(32);for(fi=0;fi<32;++fi)gi[fi]=5;var mi,_i=hi(vi,9,0),yi=hi(gi,5,0),bi=function(e){return(e/8>>0)+(7&e&&1)},ki=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof ti?ti:e instanceof ni?ni:ei)(n-t);return r.set(e.subarray(t,n)),r},wi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Si=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},Ci=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 ei(0),0];if(1==i){var a=new ei(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:s.f+u.f,l:s,r:u};c!=i-1;)s=n[n[l].f<n[d].f?l++:d++],u=n[l!=c&&n[l].f<n[d].f?l++:d++],n[c++]={s:-1,f:s.f+u.f,l:s,r:u};var f=o[0].s;for(r=1;r<i;++r)o[r].s>f&&(f=o[r].s);var p=new ti(f+1),h=Ii(n[c-1],p,0);if(h>t){r=0;var v=0,g=h-t,m=1<<g;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var _=o[r].s;if(!(p[_]>t))break;v+=m-(1<<h-p[_]),p[_]=t}for(v>>>=g;v>0;){var y=o[r].s;p[y]<t?v-=1<<t-p[y]++-1:++r}for(;r>=0&&v;--r){var b=o[r].s;p[b]==t&&(--p[b],++v)}h=t}return[new ei(p),h]},Ii=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},xi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ti(++t),r=0,i=e[0],o=1,a=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[n.subarray(0,r),t]},Fi=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ei=function(e,t,n){var r=n.length,i=bi(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)},Oi=function(e,t,n,r,i,o,a,s,u,l,c){wi(t,c++,n),++i[256];for(var d=Ci(i,15),f=d[0],p=d[1],h=Ci(o,15),v=h[0],g=h[1],m=xi(f),_=m[0],y=m[1],b=xi(v),k=b[0],w=b[1],S=new ti(19),C=0;C<_.length;++C)S[31&_[C]]++;for(C=0;C<k.length;++C)S[31&k[C]]++;for(var I=Ci(S,7),x=I[0],F=I[1],E=19;E>4&&!x[oi[E-1]];--E);var O,R,M,T,P=l+5<<3,N=Fi(i,vi)+Fi(o,gi)+a,L=Fi(i,f)+Fi(o,v)+a+14+3*E+Fi(S,x)+(2*S[16]+3*S[17]+7*S[18]);if(P<=N&&P<=L)return Ei(t,c,e.subarray(u,u+l));if(wi(t,c,1+(L<N)),c+=2,L<N){O=hi(f,p,0),R=f,M=hi(v,g,0),T=v;var D=hi(x,F,0);wi(t,c,y-257),wi(t,c+5,w-1),wi(t,c+10,E-4),c+=14;for(C=0;C<E;++C)wi(t,c+3*C,x[oi[C]]);c+=3*E;for(var A=[_,k],$=0;$<2;++$){var q=A[$];for(C=0;C<q.length;++C){var B=31&q[C];wi(t,c,D[B]),c+=x[B],B>15&&(wi(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}}else O=_i,R=vi,M=yi,T=gi;for(C=0;C<s;++C)if(r[C]>255){B=r[C]>>>18&31;Si(t,c,O[B+257]),c+=R[B+257],B>7&&(wi(t,c,r[C]>>>23&31),c+=ri[B]);var j=31&r[C];Si(t,c,M[j]),c+=T[j],j>3&&(Si(t,c,r[C]>>>5&8191),c+=ii[j])}else Si(t,c,O[r[C]]),c+=R[r[C]];return Si(t,c,O[256]),c+R[256]},Ri=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mi=new ei(0),Ti=function(){for(var e=new ni(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Pi=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Ti[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},Ni=function(e,t,n,r,i){return function(e,t,n,r,i,o){var a=e.length,s=new ei(r+a+5*(1+Math.floor(a/7e3))+i),u=s.subarray(r,s.length-i),l=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var d=c+65535;d<a?l=Ei(u,l,e.subarray(c,d)):(u[c]=o,l=Ei(u,l,e.subarray(c,a)))}else{for(var f=Ri[t-1],p=f>>>13,h=8191&f,v=(1<<n)-1,g=new ti(32768),m=new ti(v+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&v},k=new ni(25e3),w=new ti(288),S=new ti(32),C=0,I=0,x=(c=0,0),F=0,E=0;c<a;++c){var O=b(c),R=32767&c,M=m[O];if(g[R]=M,m[O]=R,F<=c){var T=a-c;if((C>7e3||x>24576)&&T>423){l=Oi(e,u,0,k,w,S,I,x,E,c-E,l),x=C=I=0,E=c;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var N=2,L=0,D=h,A=R-M&32767;if(T>2&&O==b(c-A))for(var $=Math.min(p,T)-1,q=Math.min(32767,c),B=Math.min(258,T);A<=q&&--D&&R!=M;){if(e[c+N]==e[c+N-A]){for(var j=0;j<B&&e[c+j]==e[c+j-A];++j);if(j>N){if(N=j,L=A,j>$)break;var H=Math.min(A,j-2),W=0;for(P=0;P<H;++P){var U=c-A+P+32768&32767,V=U-g[U]+32768&32767;V>W&&(W=V,M=U)}}}A+=(R=M)-(M=g[R])+32768&32767}if(L){k[x++]=268435456|li[N]<<18|ci[L];var z=31&li[N],G=31&ci[L];I+=ri[z]+ii[G],++w[257+z],++S[G],F=c+N,++C}else k[x++]=e[c],++w[e[c]]}}l=Oi(e,u,o,k,w,S,I,x,E,c-E,l),o||(l=Ei(u,l,Mi))}return ki(s,0,r+bi(l)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},Li=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Di=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&&Li(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)}},Ai=function(e){return 10+(e.filename&&e.filename.length+1||0)};function $i(e,t){void 0===t&&(t={});var n=Pi(),r=e.length;n.p(e);var i=Ni(e,t,Ai(t),8),o=i.length;return Di(i,t),Li(i,o-8,n.d()),Li(i,o-4,r),i}function qi(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new ei(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},a=0;a<n;++a){if(i+5>r.length){var s=new ei(i+8+(n-a<<1));s.set(r),r=s}var u=e.charCodeAt(a);u<128||t?o(u):u<2048?(o(192|u>>>6),o(128|63&u)):u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++a))>>>18),o(128|u>>>12&63),o(128|u>>>6&63),o(128|63&u)):(o(224|u>>>12),o(128|u>>>6&63),o(128|63&u))}return ki(r,0,i)}!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(mi||(mi={}));var Bi=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=mt.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,a=w(i[1].split("&"));try{for(a.s();!(o=a.n()).done;){var s=o.value.split("=")[0];Ft(r[s])||delete r[s]}}catch(e){a.e(e)}finally{a.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 At(e,(function(e,r){Ft(e)||Ft(r)||"undefined"===r||(t=encodeURIComponent(e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)})),i.join(r)}(r)},ji=function e(t,n){if(n.blob&&t.buffer)return new Blob([St(t)?t:t.buffer],{type:"text/plain"});if(n.sendBeacon||n.blob){var r=e(t,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}return"POST"!==n.method?null:(i=wt(t)||St(t)?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(i+="&compression="+t.compression),i);var i},Hi=function(e){var t=e.url,n=e.data,r=e.headers,i=e.options,o=e.callback,a=e.retriesPerformedSoFar,s=e.retryQueue,u=e.onXHRError,l=e.timeout,c=void 0===l?6e4:l,d=e.onResponse;Rt(a)&&a>0&&(t=Bi(t,{retry_count:a},{}));var f=new XMLHttpRequest;f.open(i.method||"GET",t,!0);var p=ji(n,i);At(r,(function(e,t){f.setRequestHeader(t,e)})),"POST"!==i.method||i.blob||f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.timeout=c,f.withCredentials=!0,f.onreadystatechange=function(){if(4===f.readyState)if(null==d||d(f),200===f.status){if(o){var e;try{e=JSON.parse(f.responseText)}catch(e){return void Pt.error(e)}o(e)}}else Ct(u)&&u(f),(f.status<400||f.status>500)&&s.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(a||0)+1,callback:o}),null==o||o({status:0})},f.send(p)},Wi=18e5;var Ui=function(e){f(n,e);var t=m(n);function n(e,r){var i;return u(this,n),(i=t.call(this)).isPolling=!1,i.queue=[],i.areWeOnline=!0,i.onXHRError=e,i.rateLimiter=r,!Ft(ft)&&"onLine"in ft.navigator&&(i.areWeOnline=ft.navigator.onLine,ft.addEventListener("online",(function(){i._handleWeAreNowOnline()})),ft.addEventListener("offline",(function(){i.areWeOnline=!1}))),i}return c(n,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var n=function(e){var t=3e3*Math.pow(2,e),n=t/2,r=Math.min(Wi,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=new Date(Date.now()+n);this.queue.push({retryAt:r,requestData:e});var i="Enqueued failed request for retry in ".concat(n);navigator.onLine||(i+=" (Browser is offline)"),Pt.warn(i),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=w(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=w(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestData,r=n.url,i=n.data,o=n.options;if(this.rateLimiter.isRateLimited(o._batchKey))Pt.warn("[RetryQueue] is quota limited. Dropping request.");else try{null==ft||ft.navigator.sendBeacon(r,ji(i,a(a({},o),{},{sendBeacon:!0})))}catch(e){Pt.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,a=e.retriesPerformedSoFar;this.rateLimiter.isRateLimited(r._batchKey)||Hi({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:a||0,callback:o,retryQueue:this,onXHRError:this.onXHRError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),n}(Kr),Vi=1800,zi=60,Gi=864e5,Yi=function(){function e(t,n,r,i){u(this,e),d(this,"_sessionIdChangedHandlers",[]),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=r||Yn,this._windowIdGenerator=i||Yn;var o=t.persistence_name||t.token,a=t.session_idle_timeout_seconds||Vi;if(Rt(a)?a>Vi?Pt.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):a<zi&&Pt.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(Pt.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),a=Vi),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,zi),Vi),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var s=lr.parse(this._window_id_storage_key),l=lr.parse(this._primary_window_exists_storage_key);s&&!l?this._windowId=s:lr.remove(this._window_id_storage_key),lr.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return c(e,[{key:"onSessionId",value:function(e){var t=this;return Ft(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&&lr.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&lr.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?lr.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(d({},Sn,[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[Sn];return wt(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;null==ft||ft.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&lr.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=_(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],a=this._getWindowId(),s=o&&o>0&&Math.abs(t-o)>Gi,u=!1,l=!i,c=!e&&Math.abs(t-r)>this._sessionTimeoutMs;l||c||s?(i=this._sessionIdGenerator(),a=this._windowIdGenerator(),Pt.info("[SessionId] new session ID generated",{sessionId:i,windowId:a,changeReason:{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}}),o=t,u=!0):a||(a=this._windowIdGenerator(),u=!0);var d=0===r||!e||s?t:r,f=0===o?(new Date).getTime():o;return this._setWindowId(a),this._setSessionId(i,d,f),u&&this._sessionIdChangedHandlers.forEach((function(e){return e(i,a)})),{sessionId:i,windowId:a,sessionStartTimestamp:f}}}]),e}(),Qi=c((function e(t,n,r,i){u(this,e),this.name="posthog-js",this.setupOnce=function(e){e((function(e){var o,a,s,u,l;if("error"!==e.level||!t.__loaded)return e;e.tags||(e.tags={});var c=t.config.ui_host||t.config.api_host;e.tags["PostHog Person URL"]=c+"/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===(a=d[0])||void 0===a?void 0:a.value,$exception_type:null===(s=d[0])||void 0===s?void 0:s.type,$exception_personURL:c+"/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===(l=d[0])||void 0===l?void 0:l.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}))}})),Ji=function(e){Promise&&Promise.resolve||Pt.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")}}},Xi=function(){function e(t){var n=this;u(this,e),d(this,"_hasSeenPageView",!1),d(this,"_updateScrollData",(function(){var e,t,r,i;n._pageViewData||(n._pageViewData=n._createPageViewData());var o=n._pageViewData,a=n._scrollY(),s=n._scrollHeight(),u=n._contentY(),l=n._contentHeight();o.lastScrollY=a,o.maxScrollY=Math.max(a,null!==(e=o.maxScrollY)&&void 0!==e?e:0),o.maxScrollHeight=Math.max(s,null!==(t=o.maxScrollHeight)&&void 0!==t?t:0),o.lastContentY=u,o.maxContentY=Math.max(u,null!==(r=o.maxContentY)&&void 0!==r?r:0),o.maxContentHeight=Math.max(l,null!==(i=o.maxContentHeight)&&void 0!==i?i:0)})),this._instance=t}return c(e,[{key:"_createPageViewData",value:function(){var e;return{pathname:null!==(e=null==ft?void 0:ft.location.pathname)&&void 0!==e?e:""}}},{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),a({$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 a({$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,a=e.maxContentY;return t=Math.ceil(t),n=Math.ceil(n),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),a=Math.ceil(a),{$prev_pageview_last_scroll:n,$prev_pageview_last_scroll_percentage:t<=1?1:Ki(n/t,0,1),$prev_pageview_max_scroll:r,$prev_pageview_max_scroll_percentage:t<=1?1:Ki(r/t,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:i<=1?1:Ki(o/i,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:i<=1?1:Ki(a/i,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){null==ft||ft.addEventListener("scroll",this._updateScrollData,!0),null==ft||ft.addEventListener("scrollend",this._updateScrollData,!0),null==ft||ft.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){null==ft||ft.removeEventListener("scroll",this._updateScrollData),null==ft||ft.removeEventListener("scrollend",this._updateScrollData),null==ft||ft.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return null==ft?void 0:ft.document.documentElement;var e,t=w(wt(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]);try{for(t.s();!(e=t.n()).done;){var n=e.value,r=null==ft?void 0:ft.document.querySelector(n);if(r)return r}}catch(e){t.e(e)}finally{t.f()}}},{key:"_scrollHeight",value:function(){var e=this._scrollElement();return e?Math.max(0,e.scrollHeight-e.clientHeight):0}},{key:"_scrollY",value:function(){if(this._instance.config.scroll_root_selector){var e=this._scrollElement();return e&&e.scrollTop||0}return ft&&(ft.scrollY||ft.pageYOffset||ft.document.documentElement.scrollTop)||0}},{key:"_contentHeight",value:function(){var e=this._scrollElement();return(null==e?void 0:e.scrollHeight)||0}},{key:"_contentY",value:function(){var e=this._scrollElement(),t=(null==e?void 0:e.clientHeight)||0;return this._scrollY()+t}}]),e}();function Ki(e,t,n){return Math.max(t,Math.min(e,n))}var Zi,eo,to,no={icontains:function(e){return!!ft&&ft.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},regex:function(e){return!!ft&&fr(ft.location.href,e)},exact:function(e){return(null==ft?void 0:ft.location.href)===e}},ro=function(){function e(t){u(this,e),this.instance=t}return c(e,[{key:"getSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(On);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(d({},On,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){var r=n.filter((function(e){return!(!e.start_date||e.end_date)})).filter((function(e){var t,n,r,i;if(!e.conditions)return!0;var o=null===(t=e.conditions)||void 0===t||!t.url||no[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),a=null===(i=e.conditions)||void 0===i||!i.selector||(null==ht?void 0:ht.querySelector(e.conditions.selector));return o&&a})).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}));return e(r)}),n)}}]),e}(),io=6e4,oo=function(){function e(){var t=this;u(this,e),d(this,"limits",{}),d(this,"checkForLimiting",(function(e){try{var n=e.responseText;if(!n||!n.length)return;(JSON.parse(n).quota_limited||[]).forEach((function(e){Pt.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),t.limits[e]=(new Date).getTime()+io}))}catch(e){return void Pt.error(e)}}))}return c(e,[{key:"isRateLimited",value:function(e){var t=this.limits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),ao=function(){return a({initialPathName:(null==ft?void 0:ft.location.pathname)||"",referringDomain:vr.referringDomain()},vr.campaignParams())},so=function(){function e(t,n,r){var i=this;u(this,e),d(this,"_onSessionIdCallback",(function(e){var t=i._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:i._sessionSourceParamGenerator()};i._persistence.register(d({},Pn,n))}})),this._sessionIdManager=t,this._persistence=n,this._sessionSourceParamGenerator=r||ao,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return c(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[Pn]}},{key:"getSessionProps",value:function(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}]),e}(),uo=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","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"],lo=function(e,t){if(!e)return!1;var n=e.toLowerCase();return uo.concat(t||[]).some((function(e){var t=e.toLowerCase();return n.includes?n.includes(t):-1!==n.indexOf(t)}))};!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(Zi||(Zi={}));var co=function(){},fo={},po="posthog",ho=(null==ft?void 0:ft.XMLHttpRequest)&&"withCredentials"in new XMLHttpRequest,vo=!ho&&-1===(null==vt?void 0:vt.indexOf("MSIE"))&&-1===(null==vt?void 0:vt.indexOf("Mozilla")),go=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:(t=null==ht?void 0:ht.location,n=null==t?void 0:t.hostname,!!Et(n)&&"herokuapp.com"!==n.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",cookie_name:"",loaded:co,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==ft||null===(e=ft.location)||void 0===e?void 0:e.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!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){var t="Bad HTTP status: "+e.status+" "+e.statusText;Pt.error(t)},get_device_id:function(e){return e},_onCapture:co,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},mo=function(e,t,n,r){var i,o=n!==po&&to?n?to[n]:void 0:to,a={initComplete:!1,syncCode:!1},s=function(e){return function(t){a[e]||(a[e]=!0,a.initComplete&&a.syncCode&&(null==r||r(t)))}};if(o&&eo===Zi.INIT_MODULE)i=o;else{if(o&&!wt(o))return void Pt.error("You have already initialized "+n);i=new yo}if(i._init(e,t,n,s("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new zr(i),i.sessionRecording.startRecordingIfEnabled(),i.config.disable_scroll_properties||i.pageViewManager.startMeasuringScrollPosition(),i.__autocapture=i.config.autocapture,Dn._setIsAutocaptureEnabled(i),Dn._isAutocaptureEnabled){i.__autocapture=i.config.autocapture;Dn.enabledForProject(i.config.token,100,100)?Dn.isBrowserSupported()?Dn.init(i):(i.__autocapture=!1,Pt.info("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,Pt.info("Not in active bucket: disabling Automatic Event Collection."))}return mt.DEBUG=mt.DEBUG||i.config.debug,!Ft(o)&&wt(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),s("syncCode")(i),i},_o=function(){function e(){u(this,e),d(this,"__forceAllowLocalhost",!1)}return c(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){Pt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),yo=function(){function e(){var t=this;u(this,e),d(this,"webPerformance",new _o),this.config=go(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=Qi,this.segmentIntegration=function(){return Ji(t)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new jn(this),this.toolbar=new Xr(this),this.pageViewManager=new Xi(this),this.surveys=new ro(this),this.rateLimiter=new oo,this.people={set:function(e,n,r){var i=Et(e)?d({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i=Et(e)?d({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}}}return c(e,[{key:"init",value:function(e,t,n){if(Ft(n))Pt.critical("You must name your new library: init(token, config, name)");else{if(n!==po){var r=mo(e,t,n,(function(e){to[n]=e,e._loaded()}));return to[n]=r,r}Pt.critical("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var t,n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var l,c={segmentRegister:!1,syncCode:!1},d=function(e){return function(){c[e]||(c[e]=!0,c.segmentRegister&&c.syncCode&&(null==u||u(i)))}};(this.set_config($t({},go(),o,{name:s,token:e,callback_fn:(s===po?s:po+"."+s)+"._jsc"})),this._jsc=function(){},null!=ft&&null!==(t=ft.rrweb)&&void 0!==t&&t.record||null!=ft&&ft.rrwebRecord)&&(this.__loaded_recorder_version=null==ft||null===(l=ft.rrweb)||void 0===l?void 0:l.version);if(this.persistence=new mr(this.config),this._requestQueue=new Zr(this._handle_queued_event.bind(this)),this._retryQueue=new Ui(this.config.on_xhr_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new Yi(this.config,this.persistence),this.sessionPropsManager=new so(this.sessionManager,this.persistence),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new mr(a(a({},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(d("segmentRegister"))):d("segmentRegister")(),void 0!==(null===(n=o.bootstrap)||void 0===n?void 0:n.distinctID)){var f,p,h=this.config.get_device_id(Yn()),v=null!==(f=o.bootstrap)&&void 0!==f&&f.isIdentifiedID?h:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(p=o.bootstrap)&&void 0!==p&&p.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:v})}if(this._hasBootstrappedFeatureFlags()){var g,m,_=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}),{}),y=Object.keys((null===(m=o.bootstrap)||void 0===m?void 0:m.featureFlagPayloads)||{}).filter((function(e){return _[e]})).reduce((function(e,t){var n,r,i,a;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===(a=i.featureFlagPayloads)||void 0===a?void 0:a[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:y})}if(!this.get_distinct_id()){var b=this.config.get_device_id(Yn());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_user_state("anonymous")}null==ft||null===(r=ft.addEventListener)||void 0===r||r.call(ft,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),d("syncCode")()}},{key:"_afterDecideResponse",value:function(e){var t;if(this.compression={},e.supportedCompression&&!this.config.disable_compression){var n,r={},i=w(e.supportedCompression);try{for(i.s();!(n=i.n()).done;){r[n.value]=!0}}catch(e){i.e(e)}finally{i.f()}this.compression=r}null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),e.elementsChainAsString&&(this.elementsChainAsString=e.elementsChainAsString)}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){Pt.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&ht&&this.capture("$pageview",{title:ht.title},{send_instantly:!0}),e||(new Gr(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()||Dt(this.__request_queue,(function(t){e._send_request.apply(e,y(t))})),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(Ft(e))return null;if(ho)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||fo,co)}},{key:"__compress_and_send_json_request",value:function(e,t,n,r){var i=function(e,t,n){return e===mi.GZipJS?[$i(qi(t),{mtime:0}),a(a({},n),{},{blob:!0,urlQueryArgs:{compression:mi.GZipJS}})]:[{data:Gt(t)},n]}(this.compression[mi.GZipJS]?mi.GZipJS:mi.Base64,t,n),o=_(i,2),s=o[0],u=o[1];this._send_request(e,s,u,r)}},{key:"_send_request",value:function(e,t,n,r){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(n._batchKey))if(vo)this.__request_queue.push([e,t,n,r]);else{var i={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};n=$t(i,n||{}),ho||(n.method="GET");var o=ft&&"sendBeacon"in ft.navigator&&"sendBeacon"===n.transport;if(e=Bi(e,n.urlQueryArgs||{},{ip:this.config.ip}),o)try{null==ft||ft.navigator.sendBeacon(e,ji(t,a(a({},n),{},{sendBeacon:!0})))}catch(e){}else if(ho||!ht)try{Hi({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){Pt.error(e)}else{var s,u=ht.createElement("script");u.type="text/javascript",u.async=!0,u.defer=!0,u.src=e;var l=ht.getElementsByTagName("script")[0];null===(s=l.parentNode)||void 0===s||s.insertBefore(u,l)}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];Dt(e,(function(e){e&&(t=e[0],wt(t)?o.push(e):Ct(e)?e.call(n):wt(e)&&"alias"===t?r.push(e):wt(e)&&-1!==t.indexOf("capture")&&Ct(n[t])?o.push(e):i.push(e))}));var a=function(e,t){Dt(e,(function(e){if(wt(e[0])){var n=t;At(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(r,this),a(i,this),a(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:"capture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fo;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return Pt.uninitializedWarning("posthog.capture");if(!jr(this)){var r=(n=n||fo).transport;if(r&&(n.transport=r),!Ft(e)&&Et(e)){if(!vt||this.config.opt_out_useragent_filter||!lo(vt,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var i={uuid:Yn(),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(i.$set=n.$set,i.$set_once=n.$set_once),(i=zt(i,n._noTruncate?null:this.config.properties_string_max_length)).timestamp=n.timestamp||new Date;var o=a(a({},i.properties.$set),i.$set);xt(o)||this.setPersonPropertiesForFlags(o),Pt.info("send",i);var s=JSON.stringify(i),u=this.config.api_host+(n.endpoint||this.analyticsDefaultEndpoint),l=n!==fo;return!this.config.request_batching||l&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(u,s,n):this._requestQueue.enqueue(u,i,n),this._invokeCaptureHooks(e,i),i}}else Pt.error("No event name provided to posthog.capture")}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),At(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=a({},t);if(r.token=this.config.token,"$snapshot"===e){var i=a(a({},this.persistence.properties()),this.sessionPersistence.properties());return r.distinct_id=i.distinct_id,r}var o=vr.properties();if(this.sessionManager){var s=this.sessionManager.checkAndGetSessionAndWindowId(),u=s.sessionId,l=s.windowId;r.$session_id=u,r.$window_id=l}if(this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var c=this.sessionPropsManager.getSessionProps();r=$t(r,c)}if(!this.config.disable_scroll_properties){var d={};"$pageview"===e?d=this.pageViewManager.doPageView():"$pageleave"===e&&(d=this.pageViewManager.doPageLeave()),r=$t(r,d)}if("$pageview"===e&&ht&&(r.title=ht.title),"$performance_event"===e){var f=this.persistence.properties();return r.distinct_id=f.distinct_id,r.$current_url=o.$current_url,r}if(!Ft(n)){var p=(new Date).getTime()-n;r.$duration=parseFloat((p/1e3).toFixed(3))}vt&&this.config.opt_out_useragent_filter&&(r.$browser_type=lo(vt,this.config.custom_blocked_useragents)?"bot":"browser"),r=$t({},vr.properties(),this.persistence.properties(),this.sessionPersistence.properties(),r);var h=this.config.property_blacklist;wt(h)?At(h,(function(e){delete r[e]})):Pt.error("Invalid value for property_blacklist config: "+h);var v=this.config.sanitize_properties;return v&&(r=v(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(d({},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 Pt.uninitializedWarning("posthog.identify");if(e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Pt.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else{var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(gn)&&(this.unregister(gn),this.register({distinct_id:e}));var o="anonymous"===this.persistence.get_user_state();e!==r&&o?(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(Rn))}else Pt.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:a(a({},r),{},d({},e,t))}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags(d({},e,n))),r[e]===t||n||this.reloadFeatureFlags()}else Pt.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,r,i;if(!this.__loaded)return Pt.uninitializedWarning("posthog.reset");var 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 a=this.config.get_device_id(Yn());this.register_once({distinct_id:a,$device_id:e?a: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 a,s=null!==(a=e.timestampLookBack)&&void 0!==a?a:10;if(!i)return o;var u=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0);o+="?t=".concat(u)}return o}},{key:"alias",value:function(e,t){return e===this.get_property(vn)?(Pt.critical("Attempting to create alias for existing People user - aborting."),-2):(Ft(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(gn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Pt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var t,n,r=a({},this.config);if(It(e)&&($t(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),this.config.api_host=this.config.api_host.replace(/\/$/,""),"https://us.posthog.com"===this.config.api_host&&(this.config.api_host="https://app.posthog.com"),null===(t=this.persistence)||void 0===t||t.update_config(this.config),null===(n=this.sessionPersistence)||void 0===n||n.update_config(this.config),rr.is_supported()&&"true"===rr.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(mt.DEBUG=!0),this.sessionRecording&&!Ft(e.disable_session_recording))){var i=r.disable_session_recording!==e.disable_session_recording,o=!jr(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(i||o)&&(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:po;return t!==po&&(t=po+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.config.opt_out_capturing_persistence_type&&rr.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&&!tr.get("ph_optout")||(tr.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=$t({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||{}),rr.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=$t({enable_persistence:!0},e||{}),this._gdpr_call_func(Tr,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=$t({clear_persistence:!0},e||{});this._gdpr_call_func(Pr,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Nr,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Lr,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=$t({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(Dr,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(null==ft||ft.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==ft||ft.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]]=Wt(e.prototype[t[n]])}(yo,["identify"]);var bo={},ko=function(){to.init=function(e,t,n){if(n)return to[n]||(to[n]=bo[n]=mo(e||"",t||{},n,(function(e){to[n]=bo[n]=e,e._loaded()}))),to[n];var r=to;return bo[po]?r=bo[po]:e&&(r=mo(e,t||{},po,(function(e){bo[po]=e,e._loaded()})),bo[po]=r),to=r,eo===Zi.INIT_SNIPPET&&(gt[po]=to),At(bo,(function(e,t){t!==po&&(to[t]=e)})),r}},wo=function(){function e(){e.done||(e.done=!0,vo=!1,At(bo,(function(e){e._dom_loaded()})))}null!=ht&&ht.addEventListener&&("complete"===ht.readyState?e():ht.addEventListener("DOMContentLoaded",e,!1)),ft&&Qt(ft,"load",e,!0)};eo=Zi.INIT_SNIPPET,Ft(gt.posthog)&&(gt.posthog=[]),(to=gt.posthog).__loaded||to.config&&to.persistence?Pt.critical("PostHog library has already been downloaded at least once."):(At(to._i,(function(e){e&&wt(e)&&(bo[e[2]]=mo.apply(void 0,y(e)))})),ko(),to.init(),At(bo,(function(e){e._loaded()})),wo())}();
|
|
15
|
+
***************************************************************************** */function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function i(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function o(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return s="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},s(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 c(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new 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&&h(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function v(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}function g(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(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=p(e);if(t){var i=p(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return g(this,n)}}function _(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)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return k(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)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function S(e){var t,n=null===(t=e)||void 0===t?void 0:t.host;return Boolean(n&&n.shadowRoot&&n.shadowRoot===e)}function C(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,i=e.value,o=e.maskInputFn,a=i||"";return(t[n.toLowerCase()]||t[r])&&(a=o?o(a):"*".repeat(a.length)),a}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var I="__rrweb_original__";var x,F,E=1,R=new RegExp("[^a-z0-9-_:]"),O=-2;function M(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(T).join(""):null}catch(e){return null}}function T(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=M(e.styleSheet)||t}catch(e){}return t}var P=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,N=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,L=/^(data:)([^,]*),(.*)/i;function D(e,t){return(e||"").replace(P,(function(e,n,r,i,o,a){var s,u=r||o||a,l=n||i||"";if(!u)return e;if(!N.test(u))return"url("+l+u+l+")";if(L.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+u)+l+")";var c=t.split("/"),d=u.split("/");c.pop();for(var f=0,p=d;f<p.length;f++){var h=p[f];"."!==h&&(".."===h?c.pop():c.push(h))}return"url("+l+c.join("/")+l+")"}))}var A,$,q,B,j,H,W=/^[^ \t\n\r\u000c]+/,U=/^[, \t\n\r\u000c]+/;function V(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function z(){var e=document.createElement("a");return e.href="",e.href}function G(e,t,n,r){return"src"===n||"href"===n&&r||"xlink:href"===n&&r&&"#"!==r[0]?V(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}for(var i=[];r(U),!(n>=t.length);){var o=r(W);if(","===o.slice(-1))o=V(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=V(e,o);for(var s=!1;;){var u=t.charAt(n);if(""===u){i.push((o+a).trim());break}if(s)")"===u&&(s=!1);else{if(","===u){n+=1,i.push((o+a).trim());break}"("===u&&(s=!0)}a+=u,n+=1}}}return i.join(", ")}(e,r):"style"===n&&r?D(r,z()):"object"===t&&"data"===n&&r?V(e,r):r:V(e,r)}function Q(e,t,n){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=0;r<e.classList.length;r++){var i=e.classList[r];if(t.test(i))return!0}return!(!n||!e.matches(n))||Q(e.parentNode,t,n)}return e.nodeType,e.TEXT_NODE,Q(e.parentNode,t,n)}function Y(t,n){var r,i,o,a,s=n.doc,u=n.blockClass,l=n.blockSelector,c=n.maskTextClass,d=n.maskTextSelector,f=n.inlineStylesheet,p=n.maskInputOptions,h=void 0===p?{}:p,v=n.maskTextFn,g=n.maskInputFn,m=n.dataURLOptions,_=void 0===m?{}:m,y=n.inlineImages,b=n.recordCanvas,k=n.keepIframeSrcFn;if(s.__sn){var w=s.__sn.id;i=1===w?void 0:w}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:i}:{type:e.Document,childNodes:[],rootId:i};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:i};case t.ELEMENT_NODE:for(var S=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=0;r<e.classList.length;r++){var i=e.classList[r];if(t.test(i))return!0}return!!n&&e.matches(n)}(t,u,l),E=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return R.test(t)?"div":t}(t),O={},T=0,P=Array.from(t.attributes);T<P.length;T++){var N=P[T],L=N.name,A=N.value;O[L]=G(s,E,L,A)}if("link"===E&&f){var $=Array.from(s.styleSheets).find((function(e){return e.href===t.href})),q=null;$&&(q=M($)),q&&(delete O.rel,delete O.href,O._cssText=D(q,$.href))}if("style"===E&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(q=M(t.sheet))&&(O._cssText=D(q,z()));if("input"===E||"textarea"===E||"select"===E){A=t.value;"radio"!==O.type&&"checkbox"!==O.type&&"submit"!==O.type&&"button"!==O.type&&A?O.value=C({type:O.type,tagName:E,value:A,maskInputOptions:h,maskInputFn:g}):t.checked&&(O.checked=t.checked)}if("option"===E&&(t.selected&&!h.select?O.selected=!0:delete O.selected),"canvas"===E&&b)if("2d"===t.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var i=t.getImageData,o=I in i?i[I]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(t)||(O.rr_dataURL=t.toDataURL(_.type,_.quality));else if(!("__context"in t)){var B=t.toDataURL(_.type,_.quality),j=document.createElement("canvas");j.width=t.width,j.height=t.height,B!==j.toDataURL(_.type,_.quality)&&(O.rr_dataURL=B)}if("img"===E&&y){x||(x=s.createElement("canvas"),F=x.getContext("2d"));var H=t,W=H.crossOrigin;H.crossOrigin="anonymous";var U=function(){try{x.width=H.naturalWidth,x.height=H.naturalHeight,F.drawImage(H,0,0),O.rr_dataURL=x.toDataURL(_.type,_.quality)}catch(e){console.warn("Cannot inline img src="+H.currentSrc+"! Error: "+e)}W?O.crossOrigin=W:delete O.crossOrigin};H.complete&&0!==H.naturalWidth?U():H.onload=U}if("audio"!==E&&"video"!==E||(O.rr_mediaState=t.paused?"paused":"played",O.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(O.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(O.rr_scrollTop=t.scrollTop),S){var V=t.getBoundingClientRect(),Y=V.width,J=V.height;O={class:O.class,rr_width:Y+"px",rr_height:J+"px"}}return"iframe"!==E||k(O.src)||(t.contentDocument||(O.rr_src=O.src),delete O.src),{type:e.Element,tagName:E,attributes:O,childNodes:[],isSVG:(a=t,Boolean("svg"===a.tagName||a.ownerSVGElement)||void 0),needBlock:S,rootId:i};case t.TEXT_NODE:var X=t.parentNode&&t.parentNode.tagName,K=t.textContent,Z="STYLE"===X||void 0,ee="SCRIPT"===X||void 0;if(Z&&K){try{t.nextSibling||t.previousSibling||(null===(r=t.parentNode.sheet)||void 0===r?void 0:r.cssRules)&&(K=(o=t.parentNode.sheet).cssRules?Array.from(o.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}K=D(K,z())}return ee&&(K="SCRIPT_PLACEHOLDER"),!Z&&!ee&&Q(t,c,d)&&K&&(K=v?v(K):K.replace(/[\S]/g,"*")),{type:e.Text,textContent:K||"",isStyle:Z,rootId:i};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:i};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:i};default:return!1}}function J(e){return void 0===e?"":e.toLowerCase()}function X(t,n){var r,i=n.doc,o=n.map,a=n.blockClass,s=n.blockSelector,u=n.maskTextClass,l=n.maskTextSelector,c=n.skipChild,d=void 0!==c&&c,f=n.inlineStylesheet,p=void 0===f||f,h=n.maskInputOptions,v=void 0===h?{}:h,g=n.maskTextFn,m=n.maskInputFn,_=n.slimDOMOptions,y=n.dataURLOptions,b=void 0===y?{}:y,k=n.inlineImages,w=void 0!==k&&k,C=n.recordCanvas,I=void 0!==C&&C,x=n.onSerialize,F=n.onIframeLoad,R=n.iframeLoadTimeout,M=void 0===R?5e3:R,T=n.keepIframeSrcFn,P=void 0===T?function(){return!1}:T,N=n.preserveWhiteSpace,L=void 0===N||N,D=Y(t,{doc:i,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,dataURLOptions:b,inlineImages:w,recordCanvas:I,keepIframeSrcFn:P});if(!D)return console.warn(t,"not serialized"),null;r="__sn"in t?t.__sn.id:!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(J(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===J(t.attributes.name)||"icon"===J(t.attributes.rel)||"apple-touch-icon"===J(t.attributes.rel)||"shortcut icon"===J(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&J(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(J(t.attributes.property).match(/^(og|twitter|fb):/)||J(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===J(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===J(t.attributes.name)||"googlebot"===J(t.attributes.name)||"bingbot"===J(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===J(t.attributes.name)||"generator"===J(t.attributes.name)||"framework"===J(t.attributes.name)||"publisher"===J(t.attributes.name)||"progid"===J(t.attributes.name)||J(t.attributes.property).match(/^article:/)||J(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===J(t.attributes.name)||"yandex-verification"===J(t.attributes.name)||"csrf-token"===J(t.attributes.name)||"p:domain_verify"===J(t.attributes.name)||"verify-v1"===J(t.attributes.name)||"verification"===J(t.attributes.name)||"shopify-checkout-api-token"===J(t.attributes.name)))return!0}}return!1}(D,_)&&(L||D.type!==e.Text||D.isStyle||D.textContent.replace(/^\s+|\s+$/gm,"").length)?E++:O;var A=Object.assign(D,{id:r});if(t.__sn=A,r===O)return null;o[r]=t,x&&x(t);var $=!d;if(A.type===e.Element&&($=$&&!A.needBlock,delete A.needBlock,t.shadowRoot&&(A.isShadowHost=!0)),(A.type===e.Document||A.type===e.Element)&&$){_.headWhitespace&&D.type===e.Element&&"head"===D.tagName&&(L=!1);for(var q={doc:i,map:o,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,skipChild:d,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,slimDOMOptions:_,dataURLOptions:b,inlineImages:w,recordCanvas:I,preserveWhiteSpace:L,onSerialize:x,onIframeLoad:F,iframeLoadTimeout:M,keepIframeSrcFn:P},B=0,j=Array.from(t.childNodes);B<j.length;B++){(U=X(j[B],q))&&A.childNodes.push(U)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var H=0,W=Array.from(t.shadowRoot.childNodes);H<W.length;H++){var U;(U=X(W[H],q))&&(U.isShadow=!0,A.childNodes.push(U))}}return t.parentNode&&S(t.parentNode)&&(A.isShadow=!0),A.type===e.Element&&"iframe"===A.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"===i){var a="about:blank";r.location.href===a&&e.src!==a&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}}(t,(function(){var e=t.contentDocument;if(e&&F){var n=X(e,{doc:e,map:o,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,slimDOMOptions:_,dataURLOptions:b,inlineImages:w,recordCanvas:I,preserveWhiteSpace:L,onSerialize:x,onIframeLoad:F,iframeLoadTimeout:M,keepIframeSrcFn:P});n&&F(t,n)}}),M),A}function K(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}!function(e){e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin"}(A||(A={})),function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration"}($||($={})),function(e){e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel"}(q||(q={})),function(e){e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2"}(B||(B={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange"}(j||(j={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back"}(H||(H={}));var Z="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",ee={map:{},getId:function(){return console.error(Z),-1},getNode:function(){return console.error(Z),null},removeNodeFromMap:function(){console.error(Z)},has:function(){return console.error(Z),!1},reset:function(){console.error(Z)}};function te(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(o){var a=Date.now();i||!1!==n.leading||(i=a);var s=t-(a-i),u=this,l=arguments;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(u,l)):r||!1===n.trailing||(r=setTimeout((function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(u,l)}),s))}}function ne(e,t,n,r,i){void 0===i&&(i=window);var o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set:function(e){var t=this;setTimeout((function(){n.set.call(t,e)}),0),o&&o.set&&o.set.call(this,e)}}),function(){return ne(e,t,o||{},!0)}}function re(e,t,n){try{if(!(t in e))return function(){};var r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,function(){e[t]=r}}catch(e){return function(){}}}function ie(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;if("string"==typeof t){if(void 0!==e.closest)return null!==e.closest("."+t);n=e.classList.contains(t)}else e.classList.forEach((function(e){t.test(e)&&(n=!0)}));return n||ae(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,ae(e.parentNode,t)}function se(e){return"__sn"in e&&e.__sn.id===O}function ue(e,t){if(S(e))return!1;var n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||ue(e.parentNode,t))}function le(e){return Boolean(e.changedTouches)}function ce(t){return"__sn"in t&&(t.__sn.type===e.Element&&"iframe"===t.__sn.tagName)}function de(e){return Boolean(null==e?void 0:e.shadowRoot)}function fe(e){return"__ln"in e}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ee=new Proxy(ee,{get:function(e,t,n){return"map"===t&&console.error(Z),Reflect.get(e,t,n)}}));var pe=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fe(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&fe(e.nextSibling)&&e.nextSibling.__ln.previous){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)},e}(),he=function(e,t){return"".concat(e,"@").concat(t)};function ve(e){return"__sn"in e}var ge=function(){function e(){var e=this;this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(t){t.forEach(e.processMutation),e.emit()},this.emit=function(){var t,r,i,o;if(!e.frozen&&!e.locked){for(var a=[],s=new pe,u=function(t){for(var n=t,r=O;r===O;)r=(n=n&&n.nextSibling)&&e.mirror.getId(n);return r},l=function(t){for(var n,r,i,o,l,c=t.getRootNode?null===(n=t.getRootNode())||void 0===n?void 0:n.host:null,d=c;null===(i=null===(r=null==d?void 0:d.getRootNode)||void 0===r?void 0:r.call(d))||void 0===i?void 0:i.host;)d=(null===(l=null===(o=null==d?void 0:d.getRootNode)||void 0===o?void 0:o.call(d))||void 0===l?void 0:l.host)||null;var f=!(e.doc.contains(t)||null!==d&&e.doc.contains(d));if(t.parentNode&&!f){var p=S(t.parentNode)?e.mirror.getId(c):e.mirror.getId(t.parentNode),h=u(t);if(-1===p||-1===h)return s.addNode(t);var v=X(t,{doc:e.doc,map:e.mirror.map,blockClass:e.blockClass,blockSelector:e.blockSelector,maskTextClass:e.maskTextClass,maskTextSelector:e.maskTextSelector,skipChild:!0,inlineStylesheet:e.inlineStylesheet,maskInputOptions:e.maskInputOptions,maskTextFn:e.maskTextFn,maskInputFn:e.maskInputFn,slimDOMOptions:e.slimDOMOptions,recordCanvas:e.recordCanvas,inlineImages:e.inlineImages,onSerialize:function(n){ce(n)&&e.iframeManager.addIframe(n),de(t)&&e.shadowDomManager.addShadowRoot(t.shadowRoot,document)},onIframeLoad:function(t,n){e.iframeManager.attachIframe(t,n),e.shadowDomManager.observeAttachShadow(t)}});v&&a.push({parentId:p,nextId:h,node:v})}};e.mapRemoves.length;)e.mirror.removeNodeFromMap(e.mapRemoves.shift());try{for(var c=n(e.movedSet),d=c.next();!d.done;d=c.next()){var f=d.value;_e(e.removes,f,e.mirror)&&!e.movedSet.has(f.parentNode)||l(f)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}try{for(var p=n(e.addedSet),h=p.next();!h.done;h=p.next()){f=h.value;ye(e.droppedSet,f)||_e(e.removes,f,e.mirror)?ye(e.movedSet,f)?l(f):e.droppedSet.add(f):l(f)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}for(var v=null;s.length;){var g=null;if(v){var m=e.mirror.getId(v.value.parentNode),_=u(v.value);-1!==m&&-1!==_&&(g=v)}if(!g)for(var y=s.length-1;y>=0;y--){var b=s.get(y);if(b){m=e.mirror.getId(b.value.parentNode),_=u(b.value);if(-1!==m&&-1!==_){g=b;break}}}if(!g){for(;s.head;)s.removeNode(s.head.value);break}v=g.previous,s.removeNode(g.value),l(g.value)}var k={texts:e.texts.map((function(t){return{id:e.mirror.getId(t.node),value:t.value}})).filter((function(t){return e.mirror.has(t.id)})),attributes:e.attributes.map((function(t){return{id:e.mirror.getId(t.node),attributes:t.attributes}})).filter((function(t){return e.mirror.has(t.id)})),removes:e.removes,adds:a};(k.texts.length||k.attributes.length||k.removes.length||k.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.mutationCb(k))}},this.processMutation=function(t){var r,i,o,a;if(!se(t.target))switch(t.type){case"characterData":var s=t.target.textContent;ae(t.target,e.blockClass)||s===t.oldValue||e.texts.push({value:Q(t.target,e.maskTextClass,e.maskTextSelector)&&s?e.maskTextFn?e.maskTextFn(s):s.replace(/[\S]/g,"*"):s,node:t.target});break;case"attributes":var u=t.target;s=t.target.getAttribute(t.attributeName);if("value"===t.attributeName&&(s=C({maskInputOptions:e.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:s,maskInputFn:e.maskInputFn})),ae(t.target,e.blockClass)||s===t.oldValue)return;var l=e.attributes.find((function(e){return e.node===t.target}));if(l||(l={node:t.target,attributes:{}},e.attributes.push(l)),"style"===t.attributeName){var c=e.doc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue),void 0!==l.attributes.style&&null!==l.attributes.style||(l.attributes.style={});var d=l.attributes.style;try{for(var f=n(Array.from(u.style)),p=f.next();!p.done;p=f.next()){var h=p.value,v=u.style.getPropertyValue(h),g=u.style.getPropertyPriority(h);v===c.style.getPropertyValue(h)&&g===c.style.getPropertyPriority(h)||(d[h]=""===g?v:[v,g])}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}try{for(var m=n(Array.from(c.style)),_=m.next();!_.done;_=m.next()){h=_.value;""===u.style.getPropertyValue(h)&&(d[h]=!1)}}catch(e){o={error:e}}finally{try{_&&!_.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}}else l.attributes[t.attributeName]=G(e.doc,t.target.tagName,t.attributeName,s);break;case"childList":t.addedNodes.forEach((function(n){return e.genAdds(n,t.target)})),t.removedNodes.forEach((function(n){var r=e.mirror.getId(n),i=S(t.target)?e.mirror.getId(t.target.host):e.mirror.getId(t.target);ae(t.target,e.blockClass)||se(n)||(e.addedSet.has(n)?(me(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===r||ue(t.target,e.mirror)||(e.movedSet.has(n)&&e.movedMap[he(r,i)]?me(e.movedSet,n):e.removes.push({parentId:i,id:r,isShadow:!!S(t.target)||void 0})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!n||!ae(n,e.blockClass)){if(ve(t)){if(se(t))return;e.movedSet.add(t);var r=null;n&&ve(n)&&(r=n.__sn.id),r&&(e.movedMap[he(t.__sn.id,r)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);ae(t,e.blockClass)||t.childNodes.forEach((function(t){return e.genAdds(t)}))}}}return e.prototype.init=function(e){var t=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","recordCanvas","inlineImages","slimDOMOptions","doc","mirror","iframeManager","shadowDomManager","canvasManager"].forEach((function(n){t[n]=e[n]}))},e.prototype.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},e.prototype.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},e.prototype.isFrozen=function(){return this.frozen},e.prototype.lock=function(){this.locked=!0,this.canvasManager.lock()},e.prototype.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},e.prototype.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},e}();function me(e,t){e.delete(t),t.childNodes.forEach((function(t){return me(e,t)}))}function _e(e,t,n){var r=t.parentNode;if(!r)return!1;var i=n.getId(r);return!!e.some((function(e){return e.id===i}))||_e(e,r,n)}function ye(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||ye(e,n))}var be=[],ke="undefined"!=typeof CSSGroupingRule,we="undefined"!=typeof CSSMediaRule,Se="undefined"!=typeof CSSSupportsRule,Ce="undefined"!=typeof CSSConditionRule;function Ie(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function xe(e,t){var n,r,i=new ge;be.push(i),i.init(e);var o=window.MutationObserver||window.__rrMutationObserver,a=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);var s=new o(i.processMutations.bind(i));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Fe(e){var t=e.mouseInteractionCb,n=e.doc,r=e.mirror,i=e.blockClass,o=e.sampling;if(!1===o.mouseInteraction)return function(){};var a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,s=[];return Object.keys(q).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e]})).forEach((function(e){var o=e.toLowerCase(),a=function(e){return function(n){var o=Ie(n);if(!ae(o,i)){var a=le(n)?n.changedTouches[0]:n;if(a){var s=r.getId(o),u=a.clientX,l=a.clientY;t({type:q[e],id:s,x:u,y:l})}}}}(e);s.push(K(o,a,n))})),function(){s.forEach((function(e){return e()}))}}function Ee(e){var t=e.scrollCb,n=e.doc,r=e.mirror,i=e.blockClass;return K("scroll",te((function(e){var o=Ie(e);if(o&&!ae(o,i)){var a=r.getId(o);if(o===n){var s=n.scrollingElement||n.documentElement;t({id:a,x:s.scrollLeft,y:s.scrollTop})}else t({id:a,x:o.scrollLeft,y:o.scrollTop})}}),e.sampling.scroll||100),n)}function Re(e,n){var r=t({},e);return n||delete r.userTriggered,r}var Oe=["INPUT","TEXTAREA","SELECT"],Me=new WeakMap;function Te(e){return function(e,t){if(ke&&e.parentRule instanceof CSSGroupingRule||we&&e.parentRule instanceof CSSMediaRule||Se&&e.parentRule instanceof CSSSupportsRule||Ce&&e.parentRule instanceof CSSConditionRule){var n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else{n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Pe(e,o){var a,s;void 0===o&&(o={});var u=e.doc.defaultView;if(!u)return function(){};!function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,s=e.scrollCb,u=e.viewportResizeCb,l=e.inputCb,c=e.mediaInteractionCb,d=e.styleSheetRuleCb,f=e.styleDeclarationCb,p=e.canvasMutationCb,h=e.fontCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,i([],r(e),!1)),n.apply(void 0,i([],r(e),!1))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,i([],r(e),!1)),o.apply(void 0,i([],r(e),!1))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,i([],r(e),!1)),a.apply(void 0,i([],r(e),!1))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,i([],r(e),!1)),s.apply(void 0,i([],r(e),!1))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,i([],r(e),!1)),u.apply(void 0,i([],r(e),!1))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,i([],r(e),!1)),l.apply(void 0,i([],r(e),!1))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,i([],r(e),!1)),c.apply(void 0,i([],r(e),!1))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,i([],r(e),!1)),d.apply(void 0,i([],r(e),!1))},e.styleDeclarationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleDeclaration&&t.styleDeclaration.apply(t,i([],r(e),!1)),f.apply(void 0,i([],r(e),!1))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,i([],r(e),!1)),p.apply(void 0,i([],r(e),!1))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,i([],r(e),!1)),h.apply(void 0,i([],r(e),!1))}}(e,o);var l=xe(e,e.doc),c=function(e){var t=e.mousemoveCb,n=e.sampling,r=e.doc,i=e.mirror;if(!1===n.mousemove)return function(){};var o,a="number"==typeof n.mousemove?n.mousemove:50,s="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500,u=[],l=te((function(e){var n=Date.now()-o;t(u.map((function(e){return e.timeOffset-=n,e})),e),u=[],o=null}),s),c=te((function(e){var t=Ie(e),n=le(e)?e.changedTouches[0]:e,r=n.clientX,a=n.clientY;o||(o=Date.now()),u.push({x:r,y:a,id:i.getId(t),timeOffset:Date.now()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?$.Drag:e instanceof MouseEvent?$.MouseMove:$.TouchMove)}),a,{trailing:!1}),d=[K("mousemove",c,r),K("touchmove",c,r),K("drag",c,r)];return function(){d.forEach((function(e){return e()}))}}(e),d=Fe(e),f=Ee(e),p=function(e){var t=e.viewportResizeCb,n=-1,r=-1;return K("resize",te((function(){var e=ie(),i=oe();n===e&&r===i||(t({width:Number(i),height:Number(e)}),n=e,r=i)}),200),window)}(e),h=function(e){var n=e.inputCb,o=e.doc,a=e.mirror,s=e.blockClass,u=e.ignoreClass,l=e.maskInputOptions,c=e.maskInputFn,d=e.sampling,f=e.userTriggeredOnInput;function p(e){var t=Ie(e),n=e.isTrusted;if(t&&"OPTION"===t.tagName&&(t=t.parentElement),t&&t.tagName&&!(Oe.indexOf(t.tagName)<0)&&!ae(t,s)){var r=t.type;if(!t.classList.contains(u)){var i=t.value,a=!1;"radio"===r||"checkbox"===r?a=t.checked:(l[t.tagName.toLowerCase()]||l[r])&&(i=C({maskInputOptions:l,tagName:t.tagName,type:r,value:i,maskInputFn:c})),h(t,Re({text:i,isChecked:a,userTriggered:n},f));var d=t.name;"radio"===r&&d&&a&&o.querySelectorAll('input[type="radio"][name="'.concat(d,'"]')).forEach((function(e){e!==t&&h(e,Re({text:e.value,isChecked:!a,userTriggered:!1},f))}))}}}function h(e,r){var i=Me.get(e);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Me.set(e,r);var o=a.getId(e);n(t(t({},r),{id:o}))}}var v=("last"===d.input?["change"]:["input","change"]).map((function(e){return K(e,p,o)})),g=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),m=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"],[HTMLOptionElement.prototype,"selected"]];return g&&g.set&&v.push.apply(v,i([],r(m.map((function(e){return ne(e[0],e[1],{set:function(){p({target:this})}})}))),!1)),function(){v.forEach((function(e){return e()}))}}(e),v=function(e){var t=e.mediaInteractionCb,n=e.blockClass,r=e.mirror,i=e.sampling,o=function(e){return te((function(i){var o=Ie(i);if(o&&!ae(o,n)){var a=o,s=a.currentTime,u=a.volume,l=a.muted;t({type:e,id:r.getId(o),currentTime:s,volume:u,muted:l})}}),i.media||500)},a=[K("play",o(0)),K("pause",o(1)),K("seeked",o(2)),K("volumechange",o(3))];return function(){a.forEach((function(e){return e()}))}}(e),g=function(e,t){var n=e.styleSheetRuleCb,o=e.mirror,a=t.win,s=a.CSSStyleSheet.prototype.insertRule;a.CSSStyleSheet.prototype.insertRule=function(e,t){var r=o.getId(this.ownerNode);return-1!==r&&n({id:r,adds:[{rule:e,index:t}]}),s.apply(this,arguments)};var u=a.CSSStyleSheet.prototype.deleteRule;a.CSSStyleSheet.prototype.deleteRule=function(e){var t=o.getId(this.ownerNode);return-1!==t&&n({id:t,removes:[{index:e}]}),u.apply(this,arguments)};var l={};ke?l.CSSGroupingRule=a.CSSGroupingRule:(we&&(l.CSSMediaRule=a.CSSMediaRule),Ce&&(l.CSSConditionRule=a.CSSConditionRule),Se&&(l.CSSSupportsRule=a.CSSSupportsRule));var c={};return Object.entries(l).forEach((function(e){var t=r(e,2),a=t[0],s=t[1];c[a]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(e,t){var s=o.getId(this.parentStyleSheet.ownerNode);return-1!==s&&n({id:s,adds:[{rule:e,index:i(i([],r(Te(this)),!1),[t||0],!1)}]}),c[a].insertRule.apply(this,arguments)},s.prototype.deleteRule=function(e){var t=o.getId(this.parentStyleSheet.ownerNode);return-1!==t&&n({id:t,removes:[{index:i(i([],r(Te(this)),!1),[e],!1)}]}),c[a].deleteRule.apply(this,arguments)}})),function(){a.CSSStyleSheet.prototype.insertRule=s,a.CSSStyleSheet.prototype.deleteRule=u,Object.entries(l).forEach((function(e){var t=r(e,2),n=t[0],i=t[1];i.prototype.insertRule=c[n].insertRule,i.prototype.deleteRule=c[n].deleteRule}))}}(e,{win:u}),m=function(e,t){var n=e.styleDeclarationCb,r=e.mirror,i=t.win,o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(e,t,i){var a,s,u=r.getId(null===(s=null===(a=this.parentRule)||void 0===a?void 0:a.parentStyleSheet)||void 0===s?void 0:s.ownerNode);return-1!==u&&n({id:u,set:{property:e,value:t,priority:i},index:Te(this.parentRule)}),o.apply(this,arguments)};var a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(e){var t,i,o=r.getId(null===(i=null===(t=this.parentRule)||void 0===t?void 0:t.parentStyleSheet)||void 0===i?void 0:i.ownerNode);return-1!==o&&n({id:o,remove:{property:e},index:Te(this.parentRule)}),a.apply(this,arguments)},function(){i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}}(e,{win:u}),_=e.collectFonts?function(e){var t=e.fontCb,n=e.doc,r=n.defaultView;if(!r)return function(){};var i=[],o=new WeakMap,a=r.FontFace;r.FontFace=function(e,t,n){var r=new a(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};var s=re(n.fonts,"add",(function(e){return function(n){return setTimeout((function(){var e=o.get(n);e&&(t(e),o.delete(n))}),0),e.apply(this,[n])}}));return i.push((function(){r.FontFace=a})),i.push(s),function(){i.forEach((function(e){return e()}))}}(e):function(){},y=[];try{for(var b=n(e.plugins),k=b.next();!k.done;k=b.next()){var w=k.value;y.push(w.observer(w.callback,u,w.options))}}catch(e){a={error:e}}finally{try{k&&!k.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}return function(){be.forEach((function(e){return e.reset()})),l.disconnect(),c(),d(),f(),p(),h(),v(),g(),m(),_(),y.forEach((function(e){return e()}))}}var Ne=function(){function e(e){this.iframes=new WeakMap,this.mutationCb=e.mutationCb}return e.prototype.addIframe=function(e){this.iframes.set(e,!0)},e.prototype.addLoadListener=function(e){this.loadListener=e},e.prototype.attachIframe=function(e,t){var n;this.mutationCb({adds:[{parentId:e.__sn.id,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e)},e}(),Le=function(){function e(e){this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;var t=this;this.restorePatches.push(re(HTMLElement.prototype,"attachShadow",(function(e){return function(){var n=e.apply(this,arguments);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),n}})))}return e.prototype.addShadowRoot=function(e,n){xe(t(t({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Ee(t(t({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))},e.prototype.observeAttachShadow=function(e){if(e.contentWindow){var t=this;this.restorePatches.push(re(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(){var r=n.apply(this,arguments);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),r}})))}},e.prototype.reset=function(){this.restorePatches.forEach((function(e){return e()}))},e}();for(var De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ae="undefined"==typeof Uint8Array?[]:new Uint8Array(256),$e=0;$e<64;$e++)Ae[De.charCodeAt($e)]=$e;var qe=new Map;var Be=function(e,t,n){if(e&&(We(e,t)||"object"===s(e))){var r=function(e,t){var n=qe.get(e);return n||(n=new Map,qe.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name),i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i}};function je(e,t,n){if(e instanceof Array)return e.map((function(e){return je(e,t,n)}));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){var r=e.constructor.name,i=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=De[n[t]>>2],i+=De[(3&n[t])<<4|n[t+1]>>4],i+=De[(15&n[t+1])<<2|n[t+2]>>6],i+=De[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:r,base64:i}}return e instanceof DataView?{rr_type:e.constructor.name,args:[je(e.buffer,t,n),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof ImageData?{rr_type:e.constructor.name,args:[je(e.data,t,n),e.width,e.height]}:We(e,t)||"object"===s(e)?{rr_type:e.constructor.name,index:Be(e,t,n)}:e}var He=function(e,t,n){return i([],r(e),!1).map((function(e){return je(e,t,n)}))},We=function(e,t){var n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((function(e){return"function"==typeof t[e]}));return Boolean(n.find((function(n){return e instanceof t[n]})))};function Ue(e,t,o,a,s,u){var l,c,d=[],f=Object.getOwnPropertyNames(e),p=function(n){try{if("function"!=typeof e[n])return"continue";var l=re(e,n,(function(l){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];var f=l.apply(this,c);if(Be(f,u,e),!ae(this.canvas,a)){s.getId(this.canvas);var p=He(i([],r(c),!1),u,e),h={type:t,property:n,args:p};o(this.canvas,h)}return f}}));d.push(l)}catch(r){var c=ne(e,n,{set:function(e){o(this.canvas,{type:t,property:n,args:[e],setter:!0})}});d.push(c)}};try{for(var h=n(f),v=h.next();!v.done;v=h.next()){p(v.value)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(c=h.return)&&c.call(h)}finally{if(l)throw l.error}}return d}var Ve,ze,Ge=function(){function e(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=function(e,t){!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)},this.mutationCb=e.mutationCb,this.mirror=e.mirror,!0===e.recordCanvas&&this.initCanvasMutationObserver(e.win,e.blockClass)}return e.prototype.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},e.prototype.freeze=function(){this.frozen=!0},e.prototype.unfreeze=function(){this.frozen=!1},e.prototype.lock=function(){this.locked=!0},e.prototype.unlock=function(){this.locked=!1},e.prototype.initCanvasMutationObserver=function(e,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var o=function(e,t){var n=[];try{var o=re(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return ae(this,t)||"__context"in this||(this.__context=n),e.apply(this,i([n],r(o),!1))}}));n.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){n.forEach((function(e){return e()}))}}(e,t),a=function(e,t,o,a){var s,u,l=[],c=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),d=function(n){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[n])return"continue";var a=re(t.CanvasRenderingContext2D.prototype,n,(function(t){return function(){for(var a=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return ae(this.canvas,o)||setTimeout((function(){var t=i([],r(s),!1);if("drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement){var o=t[0],u=o.getContext("2d"),l=null==u?void 0:u.getImageData(0,0,o.width,o.height),c=null==l?void 0:l.data;t[0]=JSON.stringify(c)}e(a.canvas,{type:B["2D"],property:n,args:t})}),0),t.apply(this,s)}}));l.push(a)}catch(r){var s=ne(t.CanvasRenderingContext2D.prototype,n,{set:function(t){e(this.canvas,{type:B["2D"],property:n,args:[t],setter:!0})}});l.push(s)}};try{for(var f=n(c),p=f.next();!p.done;p=f.next())d(p.value)}catch(e){s={error:e}}finally{try{p&&!p.done&&(u=f.return)&&u.call(f)}finally{if(s)throw s.error}}return function(){l.forEach((function(e){return e()}))}}(this.processMutation.bind(this),e,t,this.mirror),s=function(e,t,n,o){var a=[];return a.push.apply(a,i([],r(Ue(t.WebGLRenderingContext.prototype,B.WebGL,e,n,o,t)),!1)),void 0!==t.WebGL2RenderingContext&&a.push.apply(a,i([],r(Ue(t.WebGL2RenderingContext.prototype,B.WebGL2,e,n,o,t)),!1)),function(){a.forEach((function(e){return e()}))}}(this.processMutation.bind(this),e,t,this.mirror);this.resetObservers=function(){o(),a(),s()}},e.prototype.startPendingCanvasMutationFlusher=function(){var e=this;requestAnimationFrame((function(){return e.flushPendingCanvasMutations()}))},e.prototype.startRAFTimestamping=function(){var e=this;requestAnimationFrame((function t(n){e.rafStamps.latestId=n,requestAnimationFrame(t)}))},e.prototype.flushPendingCanvasMutations=function(){var e=this;this.pendingCanvasMutations.forEach((function(t,n){var r=e.mirror.getId(n);e.flushPendingCanvasMutationFor(n,r)})),requestAnimationFrame((function(){return e.flushPendingCanvasMutations()}))},e.prototype.flushPendingCanvasMutationFor=function(e,t){if(!this.frozen&&!this.locked){var n=this.pendingCanvasMutations.get(e);if(n&&-1!==t){var r=n.map((function(e){e.type;var t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]);return t})),i=n[0].type;this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}},e}();function Qe(e){return t(t({},e),{timestamp:Date.now()})}var Ye={map:{},getId:function(e){return e&&e.__sn?e.__sn.id:-1},getNode:function(e){return this.map[e]||null},removeNodeFromMap:function(e){var t=this,n=e.__sn&&e.__sn.id;delete this.map[n],e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},has:function(e){return this.map.hasOwnProperty(e)},reset:function(){this.map={}}};function Je(e){void 0===e&&(e={});var i=e.emit,o=e.checkoutEveryNms,a=e.checkoutEveryNth,s=e.blockClass,u=void 0===s?"rr-block":s,l=e.blockSelector,c=void 0===l?null:l,d=e.ignoreClass,f=void 0===d?"rr-ignore":d,p=e.maskTextClass,h=void 0===p?"rr-mask":p,v=e.maskTextSelector,g=void 0===v?null:v,m=e.inlineStylesheet,_=void 0===m||m,y=e.maskAllInputs,b=e.maskInputOptions,k=e.slimDOMOptions,w=e.maskInputFn,S=e.maskTextFn,C=e.hooks,I=e.packFn,x=e.sampling,F=void 0===x?{}:x,E=e.mousemoveWait,R=e.recordCanvas,O=void 0!==R&&R,M=e.userTriggeredOnInput,T=void 0!==M&&M,P=e.collectFonts,N=void 0!==P&&P,L=e.inlineImages,D=void 0!==L&&L,q=e.plugins,B=e.keepIframeSrcFn,j=void 0===B?function(){return!1}:B;if(!i)throw new Error("emit function is required");void 0!==E&&void 0===F.mousemove&&(F.mousemove=E);var H,W=!0===y?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==b?b:{password:!0},U=!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===k,headMetaDescKeywords:"all"===k}:k||{};!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1})}();var V=0;Ve=function(e,t){var r;if(!(null===(r=be[0])||void 0===r?void 0:r.isFrozen())||e.type===A.FullSnapshot||e.type===A.IncrementalSnapshot&&e.data.source===$.Mutation||be.forEach((function(e){return e.unfreeze()})),i(function(e){var t,r;try{for(var i=n(q||[]),o=i.next();!o.done;o=i.next()){var a=o.value;a.eventProcessor&&(e=a.eventProcessor(e))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return I&&(e=I(e)),e}(e),t),e.type===A.FullSnapshot)H=e,V=0;else if(e.type===A.IncrementalSnapshot){if(e.data.source===$.Mutation&&e.data.isAttachIframe)return;V++;var s=a&&V>=a,u=o&&e.timestamp-H.timestamp>o;(s||u)&&ze(!0)}};var z=function(e){Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.Mutation},e)}))},G=function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.Scroll},e)}))},Q=function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.CanvasMutation},e)}))},Y=new Ne({mutationCb:z}),J=new Ge({recordCanvas:O,mutationCb:Q,win:window,blockClass:u,mirror:Ye}),Z=new Le({mutationCb:z,scrollCb:G,bypassOptions:{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskInputOptions:W,maskTextFn:S,maskInputFn:w,recordCanvas:O,inlineImages:D,sampling:F,slimDOMOptions:U,iframeManager:Y,canvasManager:J},mirror:Ye});ze=function(e){var t,n,i,o;void 0===e&&(e=!1),Ve(Qe({type:A.Meta,data:{href:window.location.href,width:oe(),height:ie()}}),e),be.forEach((function(e){return e.lock()}));var a=r(function(e,t){var n=t||{},r=n.blockClass,i=void 0===r?"rr-block":r,o=n.blockSelector,a=void 0===o?null:o,s=n.maskTextClass,u=void 0===s?"rr-mask":s,l=n.maskTextSelector,c=void 0===l?null:l,d=n.inlineStylesheet,f=void 0===d||d,p=n.inlineImages,h=void 0!==p&&p,v=n.recordCanvas,g=void 0!==v&&v,m=n.maskAllInputs,_=void 0!==m&&m,y=n.maskTextFn,b=n.maskInputFn,k=n.slimDOM,w=void 0!==k&&k,S=n.dataURLOptions,C=n.preserveWhiteSpace,I=n.onSerialize,x=n.onIframeLoad,F=n.iframeLoadTimeout,E=n.keepIframeSrcFn,R={};return[X(e,{doc:e,map:R,blockClass:i,blockSelector:a,maskTextClass:u,maskTextSelector:c,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===_?{password:!0}:_,maskTextFn:y,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:S,inlineImages:h,recordCanvas:g,preserveWhiteSpace:C,onSerialize:I,onIframeLoad:x,iframeLoadTimeout:F,keepIframeSrcFn:void 0===E?function(){return!1}:E}),R]}(document,{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskAllInputs:W,maskTextFn:S,slimDOM:U,recordCanvas:O,inlineImages:D,onSerialize:function(e){ce(e)&&Y.addIframe(e),de(e)&&Z.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){Y.attachIframe(e,t),Z.observeAttachShadow(e)},keepIframeSrcFn:j}),2),s=a[0],l=a[1];if(!s)return console.warn("Failed to snapshot the document");Ye.map=l,Ve(Qe({type:A.FullSnapshot,data:{node:s,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(o=null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}})),be.forEach((function(e){return e.unlock()}))};try{var ee=[];ee.push(K("DOMContentLoaded",(function(){Ve(Qe({type:A.DomContentLoaded,data:{}}))})));var te=function(e){var n;return Pe({mutationCb:z,mousemoveCb:function(e,t){return Ve(Qe({type:A.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.MouseInteraction},e)}))},scrollCb:G,viewportResizeCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.ViewportResize},e)}))},inputCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.Input},e)}))},mediaInteractionCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.StyleDeclaration},e)}))},canvasMutationCb:Q,fontCb:function(e){return Ve(Qe({type:A.IncrementalSnapshot,data:t({source:$.Font},e)}))},blockClass:u,ignoreClass:f,maskTextClass:h,maskTextSelector:g,maskInputOptions:W,inlineStylesheet:_,sampling:F,recordCanvas:O,inlineImages:D,userTriggeredOnInput:T,collectFonts:N,doc:e,maskInputFn:w,maskTextFn:S,blockSelector:c,slimDOMOptions:U,mirror:Ye,iframeManager:Y,shadowDomManager:Z,canvasManager:J,plugins:(null===(n=null==q?void 0:q.filter((function(e){return e.observer})))||void 0===n?void 0:n.map((function(e){return{observer:e.observer,options:e.options,callback:function(t){return Ve(Qe({type:A.Plugin,data:{plugin:e.name,payload:t}}))}}})))||[]},C)};Y.addLoadListener((function(e){ee.push(te(e.contentDocument))}));var ne=function(){ze(),ee.push(te(document))};return"interactive"===document.readyState||"complete"===document.readyState?ne():ee.push(K("load",(function(){Ve(Qe({type:A.Load,data:{}})),ne()}),window)),function(){ee.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}Je.addCustomEvent=function(e,t){if(!Ve)throw new Error("please add custom event after start recording");Ve(Qe({type:A.Custom,data:{tag:e,payload:t}}))},Je.freezePage=function(){be.forEach((function(e){return e.freeze()}))},Je.takeFullSnapshot=function(e){if(!ze)throw new Error("please take full snapshot after start recording");ze(e)},Je.mirror=Ye;var Xe=function(){function e(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}return e.prototype.toString=function(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t},e}(),Ke=/(^|@)\S+:\d+/,Ze=/^\s*at .*(\S+:\d+|\(native\))/m,et=/^(eval@)?(\[native code])?$/,tt={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(Ze))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: ".concat(e));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Ze)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),r=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Xe({functionName:o,fileName:a,lineNumber:i[1],columnNumber:i[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(et)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Xe({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Xe({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=t.exec(n[i]);a&&r.push(new Xe({fileName:a[2],lineNumber:parseFloat(a[1])}))}return r},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=t.exec(n[i]);a&&r.push(new Xe({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Ke)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Xe({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function nt(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var r=e.parentElement,i=[];if(r.children&&r.children.length>0)for(var o=0;o<r.children.length;o++){var a=r.children[o];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===n&&i.push(a)}i.length>1&&(n+=":eq("+i.indexOf(e)+")"),t=n+(t?">"+t:""),e=r}return t}function rt(e){return"[object Object]"===Object.prototype.toString.call(e)}function it(e,t){var r,i;if(0===t)return!0;var o=Object.keys(e);try{for(var a=n(o),s=a.next();!s.done;s=a.next()){var u=s.value;if(rt(e[u])&&it(e[u],t-1))return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return!1}function ot(e,t){var n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);var r=[],i=[];return JSON.stringify(e,(function(e,t){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?i.splice(o,1/0,e):i.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null==t)return t;if(function(e){if(rt(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(rt(e)&&it(e,n.depthOfLimit))return!0;return!1}(t))return function(e){var t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t="".concat(t.slice(0,n.stringLengthLimit),"..."));return t}(t);if(t instanceof Event){var a={};for(var s in t){var u=t[s];Array.isArray(u)?a[s]=nt(u.length?u[0]:null):a[s]=u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var at={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function st(e,t,o){var a,s,u,l=o.logger;if(!l)return function(){};u="string"==typeof l?t[l]:l;var c=0,d=[];if(o.level.includes("error")&&window){var f=function(t){var n=t.message,r=t.error,i=tt.parse(r).map((function(e){return e.toString()})),a=[ot(n,o.stringifyOptions)];e({level:"error",trace:i,payload:a})};window.addEventListener("error",f),d.push((function(){window&&window.removeEventListener("error",f)}))}try{for(var p=n(o.level),h=p.next();!h.done;h=p.next()){var v=h.value;d.push(g(u,v))}}catch(e){a={error:e}}finally{try{h&&!h.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}return function(){d.forEach((function(e){return e()}))};function g(t,n){var a=this;return t[n]?re(t,n,(function(t){return function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];t.apply(a,s);try{var l=tt.parse(new Error).map((function(e){return e.toString()})).splice(1),d=s.map((function(e){return ot(e,o.stringifyOptions)}));++c<o.lengthThreshold?e({level:n,trace:l,payload:d}):c===o.lengthThreshold&&e({level:"warn",trace:[],payload:[ot("The number of log records reached the threshold.")]})}catch(e){t.apply(void 0,i(["rrweb logger error:",e],r(s),!1))}}})):function(){}}}var ut=Array.prototype,lt=ut.forEach,ct=ut.indexOf,dt="undefined"!=typeof window?window:void 0,ft=null==dt?void 0:dt.navigator,pt=null==dt?void 0:dt.document,ht=null==ft?void 0:ft.userAgent,vt=null!=dt?dt:{};dt&&(dt.rrweb={record:Je,version:"v1",rrwebVersion:"1.1.3"},dt.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:st,options:e?Object.assign({},at,e):at}}});var gt={DEBUG:!1,LIB_VERSION:"1.103.2"},mt=Array.isArray,_t=Object.prototype,yt=_t.hasOwnProperty,bt=_t.toString,kt=mt||function(e){return"[object Array]"===bt.call(e)},wt=function(e){return"[object Uint8Array]"===bt.call(e)},St=function(e){return"function"==typeof e},Ct=function(e){return e===Object(e)&&!kt(e)},It=function(e){return void 0===e},xt=function(e){return"[object String]"==bt.call(e)},Ft=function(e){return null===e},Et=function(e){return"[object Number]"==bt.call(e)},Rt=function(e){return"[object Boolean]"===bt.call(e)},Ot="[PostHog.js]",Mt={_log:function(e){if(dt&&(gt.DEBUG||vt.POSTHOG_DEBUG)&&!It(dt.console)&&dt.console){for(var t=("__rrweb_original__"in dt.console[e]?dt.console[e].__rrweb_original__:dt.console[e]),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.apply(void 0,[Ot].concat(r))}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Mt._log.apply(Mt,["log"].concat(t))},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Mt._log.apply(Mt,["warn"].concat(t))},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Mt._log.apply(Mt,["error"].concat(t))},critical:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[Ot].concat(n))},uninitializedWarning:function(e){Mt.error("You must initialize PostHog before calling ".concat(e))}},Tt={},Pt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Nt(e,t,n){if(kt(e))if(lt&&e.forEach===lt)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)===Tt)return}function Lt(e,t,n){if(!Ft(e)&&!It(e)){if(kt(e))return Nt(e,t,n);for(var r in e)if(yt.call(e,r)&&t.call(n,e[r],r)===Tt)return}}var Dt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Nt(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function At(e,t){return-1!==e.indexOf(t)}function $t(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var qt=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Bt=function(e){try{return e()}catch(e){return}},jt=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){Mt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Mt.critical(e)}}},Ht=function(e){var t={};return Lt(e,(function(e,n){xt(e)&&e.length>0&&(t[n]=e)})),t};var Wt=["$performance_raw"];function Ut(e,t){return n=e,r=function(e,n){return n&&Wt.indexOf(n)>-1?e:xt(e)&&!Ft(t)?e.slice(0,t):e},i=new Set,function e(t,n){return t!==Object(t)?r?r(t,n):t:i.has(t)?void 0:(i.add(t),kt(t)?(o=[],Nt(t,(function(t){o.push(e(t))}))):(o={},Lt(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}function Vt(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,u=0,l="",c=[];if(!e)return e;e=zt(e);do{t=(o=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[u++]=a.charAt(t)+a.charAt(n)+a.charAt(r)+a.charAt(i)}while(s<e.length);switch(l=c.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l}var zt=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 a=e.charCodeAt(i),s=null;a<128?n++:s=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Ft(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},Gt=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 a="on"+n,s=t[a];t[a]=function(t,n,r){return function(i){if(i=i||e(null==dt?void 0:dt.event)){var o,a=!0;St(r)&&(o=r(i));var s=n.call(t,i);return!1!==o&&!1!==s||(a=!1),a}}}(t,r,s)}else Mt.error("No valid element provided to register_event")}}();function Qt(e,t){var n=function(){if(!pt)return t("document not found");var n=pt.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=pt.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):pt.body.appendChild(n)};null!=pt&&pt.body?n():null==pt||pt.addEventListener("DOMContentLoaded",n)}function Yt(e){return e?Pt(e).split(/\s+/):[]}function Jt(e){var t="";switch(s(e.className)){case"string":t=e.className;break;case"object":t=("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Yt(t)}function Xt(e){var t="";return rn(e)&&!on(e)&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,(function(e){en(e)&&e.textContent&&(t+=Pt(e.textContent).split(/(\s+)/).filter(an).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))})),Pt(t)}function Kt(e){return!!e&&1===e.nodeType}function Zt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function en(e){return!!e&&3===e.nodeType}function tn(e){return!!e&&11===e.nodeType}var nn=["a","button","form","input","select","textarea","label"];function rn(e){for(var t=e;t.parentNode&&!Zt(t,"body");t=t.parentNode){var n=Jt(t);if(At(n,"ph-sensitive")||At(n,"ph-no-capture"))return!1}if(At(Jt(e),"ph-include"))return!0;var r=e.type||"";if(xt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if(xt(i)){if(/^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,"")))return!1}return!0}function on(e){return!!(Zt(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Zt(e,"select")||Zt(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function an(e){if(Ft(e)||It(e))return!1;if(xt(e)){e=Pt(e);if(/^(?:(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,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0}function sn(e){var t=Xt(e);return an(t="".concat(t," ").concat(un(e)).trim())?t:""}function un(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=Xt(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(un(e)).trim())}catch(e){Mt.error(e)}})),t}function ln(e){return function(e){var t=e.map((function(e){var t,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class){e.attr_class.sort();var i,o=w(e.attr_class);try{for(o.s();!(i=o.n()).done;){var s=i.value;r+=".".concat(s.replace(/"/g,""))}}catch(e){o.e(e)}finally{o.f()}}var u=a(a(a(a({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),l={};return $t(u).sort((function(e,t){var n=_(e,1)[0],r=_(t,1)[0];return n.localeCompare(r)})).forEach((function(e){var t=_(e,2),n=t[0],r=t[1];return l[cn(n.toString())]=cn(r.toString())})),r+=":",r+=$t(u).map((function(e){var t=_(e,2),n=t[0],r=t[1];return"".concat(n,'="').concat(r,'"')})).join("")}));return t.join(";")}(function(e){return e.map((function(e){var t,n,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(n=e.attr__href)||void 0===n?void 0:n.slice(0,2048),attr_class:dn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return $t(e).filter((function(e){return 0===_(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=_(e,2),n=t[0],i=t[1];return r.attributes[n]=i})),r}))}(e))}function cn(e){return e.replace(/"|\\"/g,'\\"')}function dn(e){var t=e.attr__class;return t?kt(t)?t:Yt(t):void 0}var fn=function(){function e(t){u(this,e),this.clicks=[],this.enabled=t}return c(e,[{key:"isRageClick",value:function(e,t,n){if(!this.enabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),pn="$people_distinct_id",hn="__alias",vn="__timers",gn="$autocapture_disabled_server_side",mn="$session_recording_enabled_server_side",_n="$console_log_recording_enabled_server_side",yn="$session_recording_recorder_version_server_side",bn="$session_recording_network_payload_capture",kn="$sesid",wn="$session_is_sampled",Sn="$enabled_feature_flags",Cn="$early_access_features",In="$stored_person_properties",xn="$stored_group_properties",Fn="$surveys",En="$flag_call_reported",Rn="$user_state",On="$posthog_quota_limited",Mn="$client_session_props",Tn=[pn,hn,"__cmpns",vn,mn,kn,Sn,Rn,On,Cn,xn,In,Fn,En,Mn];function Pn(e,t){return t.length>e?t.slice(0,e)+"...":t}var Nn={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t,n=Ft(this._isDisabledServerSide)?!(null===(t=e.persistence)||void 0===t||!t.props[gn]):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&&!Kt(t));return t},_getAugmentPropertiesFromElement:function(e){if(!rn(e))return{};var t={};return Lt(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&&an(r)&&(t[n]=r)}})),t},_getPropertiesFromElement:function(e,t,n){var r,i=e.tagName.toLowerCase(),o={tag_name:i};nn.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=Pn(1024,sn(e)):o.$el_text=Pn(1024,Xt(e)));var a=Jt(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e})));var s=null===(r=this.config)||void 0===r?void 0:r.element_attribute_ignorelist;Lt(e.attributes,(function(n){var r;if((!on(e)||-1!==["name","id","class"].indexOf(n.name))&&((null==s||!s.includes(n.name))&&!t&&an(n.value)&&(r=n.name,!xt(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var i=n.value;"class"===n.name&&(i=Yt(i).join(" ")),o["attr__"+n.name]=Pn(1024,i)}}));for(var u=1,l=1,c=e;c=this._previousElementSibling(c);)u++,c.tagName===e.tagName&&l++;return o.nth_child=u,o.nth_of_type=l,o},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return Lt(null==pt?void 0:pt.querySelectorAll(e.css_selector),(function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),an(n)&&t.push(n)})),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return Lt(this._customProperties,(function(r){Lt(r.event_selectors,(function(i){Lt(null==pt?void 0:pt.querySelectorAll(i),(function(i){At(e,i)&&rn(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return It(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},_captureEvent:function(e,t){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$autocapture",o=this._getEventTarget(e);(en(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"));if(o&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!dt||!e||Zt(e,"html")||!Kt(e))return!1;if(null!=n&&n.url_allowlist){var r=dt.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 a=n.element_allowlist;if(a&&!a.some((function(t){return e.tagName.toLowerCase()===t})))return!1}if(null!=n&&n.css_selector_allowlist){var s=n.css_selector_allowlist;if(s&&!s.some((function(t){return e.matches(t)})))return!1}for(var u=!1,l=[e],c=!0,d=e;d.parentNode&&!Zt(d,"body");)if(tn(d.parentNode))l.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=d.parentNode||!1))break;if(nn.indexOf(c.tagName.toLowerCase())>-1)u=!0;else{var f=dt.getComputedStyle(c);f&&"pointer"===f.getPropertyValue("cursor")&&(u=!0)}l.push(c),d=c}var p=dt.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return"submit"===t.type;case"input":case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return u?"click"===t.type:"click"===t.type&&(nn.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var a,s,u=[o],l=o;l.parentNode&&!Zt(l,"body");)tn(l.parentNode)?(u.push(l.parentNode.host),l=l.parentNode.host):(u.push(l.parentNode),l=l.parentNode);var c,d=[],f={},p=!1;if(Lt(u,(function(e){var n=rn(e);"a"===e.tagName.toLowerCase()&&(c=e.getAttribute("href"),c=n&&an(c)&&c),At(Jt(e),"ph-no-capture")&&(p=!0),d.push(r._getPropertiesFromElement(e,t.config.mask_all_element_attributes,t.config.mask_all_text));var i=r._getAugmentPropertiesFromElement(e);Dt(f,i)})),t.config.mask_all_text||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?d[0].$el_text=sn(o):d[0].$el_text=Xt(o)),c&&(d[0].attr__href=c),p)return!1;var h=Dt(this._getDefaultProperties(e.type),t.elementsChainAsString?{$elements_chain:ln(d)}:{$elements:d},null!==(a=d[0])&&void 0!==a&&a.$el_text?{$el_text:null===(s=d[0])||void 0===s?void 0:s.$el_text}:{},this._getCustomProperties(u),f);return t.capture(i,h),!0}},_navigate:function(e){dt&&(dt.location.href=e)},_addDomEventHandlers:function(e){var t=this;if(dt&&pt){var n=function(n){n=n||(null==dt?void 0:dt.event),t._captureEvent(n,e)};Gt(pt,"submit",n,!1,!0),Gt(pt,"change",n,!1,!0),Gt(pt,"click",n,!1,!0)}},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;Rt(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 fn(e.config.rageclick)},afterDecideResponse:function(e,t){var n=t.config.token;this._initializedTokens.indexOf(n)>-1?Mt.info('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(d({},gn,!!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=It(t)?10:t,n=It(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return St(null==pt?void 0:pt.querySelectorAll)}};!function(e){for(var t in e)St(e[t])&&(e[t]=e[t].bind(e))}(Nn),function(e){for(var t in e)St(e[t])&&(e[t]=jt(e[t]))}(Nn);var Ln="$active_feature_flags",Dn="$override_feature_flags",An="$feature_flag_payloads",$n=function(e){var t,n={},r=w($t(e||{}));try{for(r.s();!(t=r.n()).done;){var i=_(t.value,2),o=i[0],a=i[1];a&&(n[o]=a)}}catch(e){r.e(e)}finally{r.f()}return n},qn=function(){function e(t){u(this,e),this.instance=t,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return c(e,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(Sn),t=this.instance.get_property(Dn);if(!t)return e||{};for(var n=Dt({},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||(Mt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(An)||{}}},{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;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var t=this.instance.config.token,n=this.instance.get_property(In),r=this.instance.get_property(xn),i=Vt(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(En)||{};if(t.send_event||!("send_event"in t))if(!(e in o)||!o[e].includes(i))kt(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register(d({},En,o)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r});return r}Mt.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);Mt.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]:{},i=e.featureFlags,o=e.featureFlagPayloads;if(i)if(kt(i)){var s,u={};if(i)for(var l=0;l<i.length;l++)u[i[l]]=!0;t&&t.register((d(s={},Ln,i),d(s,Sn,u),s))}else{var c,f=i,p=o;e.errorsWhileComputingFlags&&(f=a(a({},n),f),p=a(a({},r),p)),t&&t.register((d(c={},Ln,Object.keys($n(f))),d(c,Sn,f||{}),d(c,An,p||{}),c))}}(e,this.instance.persistence,t,n),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return Mt.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,!1===e)this.instance.persistence.unregister(Dn);else if(kt(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(d({},Dn,t))}else this.instance.persistence.register(d({},Dn,e))}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks(),r=n.flags,i=n.flagVariants;e(r,i)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){var n,r,i=d({},"$feature_enrollment/".concat(e),t);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:i}),this.setPersonPropertiesForFlags(i,!1);var o=a(a({},this.getFlagVariants()),{},d({},e,t));null===(n=this.instance.persistence)||void 0===n||n.register((d(r={},Ln,Object.keys($n(o))),d(r,Sn,o),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(Cn);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(d({},Cn,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(In)||{};this.instance.register(d({},In,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(In)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(xn)||{};0!==Object.keys(n).length&&Object.keys(n).forEach((function(t){n[t]=a(a({},n[t]),e[t]),delete e[t]})),this.instance.register(d({},xn,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(xn)||{};this.instance.register(d({},xn,a(a({},t),{},d({},e,{}))))}else this.instance.unregister(xn)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Et(e)&&isFinite(e)&&Math.floor(e)===e});var Bn="0123456789abcdef",jn=function(){function e(t){if(u(this,e),this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}return c(e,[{key:"toString",value:function(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Bn.charAt(this.bytes[t]>>>4)+Bn.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new 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 new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),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}(),Hn=function(){function e(){u(this,e),d(this,"timestamp",0),d(this,"counter",0),d(this,"random",new Vn)}return c(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(It(e)){this.timestamp=0;var t=this.generateOrAbort();if(It(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}},{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 jn.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),Wn=function(e){if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};dt&&!It(dt.crypto)&&crypto.getRandomValues&&(Wn=function(e){return crypto.getRandomValues(e)});var Un,Vn=function(){function e(){u(this,e),d(this,"buffer",new Uint32Array(8)),d(this,"cursor",1/0)}return c(e,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Wn(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),zn=function(){return Gn().toString()},Gn=function(){return(Un||(Un=new Hn)).generate()},Qn="Thu, 01 Jan 1970 00:00:00 GMT",Yn="";var Jn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Xn(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pt;if(Yn)return Yn;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),r=Math.min(n.length,8),i="dmn_chk_"+zn(),o=new RegExp("(^|;)\\s*"+i+"=1");!Yn&&r--;){var a=n.slice(r).join("."),s=i+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+Qn,Yn=a)}return Yn}(e);if(!n){var r=function(e){var t=e.match(Jn);return t?t[0]:""}(e);r!==n&&Mt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Kn={is_supported:function(){return!!pt},error:function(e){Mt.error("cookieStore error: "+e)},get:function(e){if(pt){try{for(var t=e+"=",n=pt.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(Kn.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){if(pt)try{var o="",a="",s=Xn(pt.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+24*n*60*60*1e3),o="; expires="+u.toUTCString()}i&&(a="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+s+a;return l.length>3686.4&&Mt.warn("cookieStore warning: large cookie, len="+l.length),pt.cookie=l,l}catch(e){return}},remove:function(e,t){try{Kn.set(e,"",-1,t)}catch(e){return}}},Zn=null,er={is_supported:function(){if(!Ft(Zn))return Zn;var e=!0;if(It(dt))e=!1;else try{var t="__mplssupport__";er.set(t,"xyz"),'"xyz"'!==er.get(t)&&(e=!1),er.remove(t)}catch(t){e=!1}return e||Mt.error("localStorage unsupported; falling back to cookie store"),Zn=e,e},error:function(e){Mt.error("localStorage error: "+e)},get:function(e){try{return null==dt?void 0:dt.localStorage.getItem(e)}catch(e){er.error(e)}return null},parse:function(e){try{return JSON.parse(er.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==dt||dt.localStorage.setItem(e,JSON.stringify(t))}catch(e){er.error(e)}},remove:function(e){try{null==dt||dt.localStorage.removeItem(e)}catch(e){er.error(e)}}},tr=["distinct_id",kn,wn],nr=a(a({},er),{},{parse:function(e){try{var t={};try{t=Kn.parse(e)||{}}catch(e){}var n=Dt(t,JSON.parse(er.get(e)||"{}"));return er.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{er.set(e,t);var o={};tr.forEach((function(e){t[e]&&(o[e]=t[e])})),Object.keys(o).length&&Kn.set(e,o,n,r,i)}catch(e){er.error(e)}},remove:function(e,t){try{null==dt||dt.localStorage.removeItem(e),Kn.remove(e,t)}catch(e){er.error(e)}}}),rr={},ir={is_supported:function(){return!0},error:function(e){Mt.error("memoryStorage error: "+e)},get:function(e){return rr[e]||null},parse:function(e){return rr[e]||null},set:function(e,t){rr[e]=t},remove:function(e){delete rr[e]}},or=null,ar={is_supported:function(){if(!Ft(or))return or;if(or=!0,It(dt))or=!1;else try{var e="__support__";ar.set(e,"xyz"),'"xyz"'!==ar.get(e)&&(or=!1),ar.remove(e)}catch(e){or=!1}return or},error:function(e){Mt.error("sessionStorage error: ",e)},get:function(e){try{return null==dt?void 0:dt.sessionStorage.getItem(e)}catch(e){ar.error(e)}return null},parse:function(e){try{return JSON.parse(ar.get(e))||null}catch(e){}return null},set:function(e,t){try{null==dt||dt.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ar.error(e)}},remove:function(e){try{null==dt||dt.sessionStorage.removeItem(e)}catch(e){ar.error(e)}}},sr=["localhost","127.0.0.1"],ur=function(e){var t=null==pt?void 0:pt.createElement("a");return It(t)?null:(t.href=e,t)},lr=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},cr=function(e,t){for(var n,r=((e.split("#")[0]||"").split("?")[1]||"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!kt(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){Mt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},dr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null};var fr={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gbraid","wbraid","fbclid","msclkid"].concat(e||[]),n={};return Lt(t,(function(e){var t=pt?cr(pt.URL,e):"";t.length&&(n[e]=t)})),n},searchEngine:function(){var e=null==pt?void 0:pt.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=fr.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(!Ft(e)){n.$search_engine=e;var r=pt?cr(pt.referrer,t):"";r.length&&(n.ph_keyword=r)}return n},browser:function(e,t,n){return t=t||"",n||At(e," OPR/")?At(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":At(e,"IEMobile")||At(e,"WPDesktop")?"Internet Explorer Mobile":At(e,"SamsungBrowser/")?"Samsung Internet":At(e,"Edge")||At(e,"Edg/")?"Microsoft Edge":At(e,"FBIOS")?"Facebook Mobile":At(e,"Chrome")?"Chrome":At(e,"CriOS")?"Chrome iOS":At(e,"UCWEB")||At(e,"UCBrowser")?"UC Browser":At(e,"FxiOS")?"Firefox iOS":At(t,"Apple")||function(e){return At(e,"Safari")&&!At(e,"Chrome")&&!At(e,"Android")}(e)?At(e,"Mobile")?"Mobile Safari":"Safari":At(e,"Android")?"Android Mobile":At(e,"Konqueror")||At(e,"konqueror")?"Konqueror":At(e,"Firefox")?"Firefox":At(e,"MSIE")||At(e,"Trident/")?"Internet Explorer":At(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+)?)/i],BlackBerry:[/BlackBerry (\d+(\.\d+)?)/,/Version\/(\d+(\.\d+)?)/],"Android Mobile":[/android\s(\d+(\.\d+)?)/],"Samsung Internet":[/SamsungBrowser\/(\d+(\.\d+)?)/],"Internet Explorer":[/(rv:|MSIE )(\d+(\.\d+)?)/],Mozilla:[/rv:(\d+(\.\d+)?)/]}[fr.browser(e,t,n)];if(It(r))return null;for(var i=0;i<r.length;i++){var o=r[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.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(null==pt?void 0:pt.referrer)||"$direct"},referringDomain:function(){var e;return null!=pt&&pt.referrer&&(null===(e=ur(pt.referrer))||void 0===e?void 0:e.host)||"$direct"},properties:function(){if(!ht)return{};var e=fr.os(ht),t=e.os_name,n=e.os_version;return Dt(Ht({$os:t,$os_version:n,$browser:fr.browser(ht,navigator.vendor,vt.opera),$device:fr.device(ht),$device_type:fr.deviceType(ht)}),{$current_url:null==dt?void 0:dt.location.href,$host:null==dt?void 0:dt.location.host,$pathname:null==dt?void 0:dt.location.pathname,$raw_user_agent:ht.length>1e3?ht.substring(0,997)+"...":ht,$browser_version:fr.browserVersion(ht,navigator.vendor,vt.opera),$browser_language:fr.browserLanguage(),$screen_height:null==dt?void 0:dt.screen.height,$screen_width:null==dt?void 0:dt.screen.width,$viewport_height:null==dt?void 0:dt.innerHeight,$viewport_width:null==dt?void 0:dt.innerWidth,$lib:"web",$lib_version:gt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:qt()/1e3})},people_properties:function(){if(!ht)return{};var e=fr.os(ht),t=e.os_name,n=e.os_version;return Dt(Ht({$os:t,$os_version:n,$browser:fr.browser(ht,navigator.vendor,vt.opera)}),{$browser_version:fr.browserVersion(ht,navigator.vendor,vt.opera)})}},pr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],hr=function(){function e(t){u(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===pr.indexOf(t.persistence.toLowerCase())&&(Mt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r=t.persistence.toLowerCase();"localstorage"===r&&er.is_supported()?this.storage=er:"localstorage+cookie"===r&&nr.is_supported()?this.storage=nr:"sessionstorage"===r&&ar.is_supported()?this.storage=ar:"memory"===r?this.storage=ir:"cookie"===r?this.storage=Kn:nr.is_supported()?this.storage=nr:this.storage=Kn,this.load(),this.update_config(t),this.save()}return c(e,[{key:"properties",value:function(){var e={};return Lt(this.props,(function(t,n){if(n===Sn&&Ct(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e["$feature/".concat(r[i])]=t[r[i]];else a=n,s=!1,(Ft(o=Tn)?s:ct&&o.indexOf===ct?-1!=o.indexOf(a):(Lt(o,(function(e){if(s||(s=e===a))return Tt})),s))||(e[n]=t);var o,a,s})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Dt({},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(Ct(e)){It(t)&&(t="None"),this.expire_days=It(n)?this.default_expiry:n;var i=!1;if(Lt(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(Ct(e)){this.expire_days=It(t)?this.default_expiry:t;var r=!1;if(Lt(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(fr.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(fr.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||fr.referrer(),$referring_domain:this.props.$referring_domain||fr.referringDomain()})}},{key:"get_referrer_info",value:function(){return Ht({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return Lt(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[vn]||{};n[e]=t,this.props[vn]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[vn]||{})[e];return It(t)||(delete this.props[vn][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[Rn]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[Rn]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[On]||{}}},{key:"set_quota_limits",value:function(e){this.props[On]=e,this.save()}}]),e}(),vr=2,gr=4;var mr=c((function e(t){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,e),d(this,"bucketSize",100),d(this,"refillRate",10),d(this,"mutationBuckets",{}),d(this,"loggedTracker",{}),d(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]}))})),d(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]})),d(this,"numberOfChanges",(function(e){var t,n,r,i,o,a,s,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===(a=e.texts)||void 0===a?void 0:a.length)&&void 0!==o?o:0)+(null!==(s=null===(u=e.adds)||void 0===u?void 0:u.length)&&void 0!==s?s:0)})),d(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=_(i.getNodeOrRelevantParent(e.id),2),a=o[0],s=o[1];if(0===i.mutationBuckets[a])return!1;(i.mutationBuckets[a]=null!==(t=i.mutationBuckets[a])&&void 0!==t?t:i.bucketSize,i.mutationBuckets[a]=Math.max(i.mutationBuckets[a]-1,0),0===i.mutationBuckets[a])&&(i.loggedTracker[a]||(i.loggedTracker[a]=!0,null===(n=(r=i.options).onBlockedNode)||void 0===n||n.call(r,a,s)));return 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)})),_r=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}(_r||{}),yr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(e){return e},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6},br=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],kr=["/s/","/e/","/i/vo/e/"];function wr(e,t,n,r){var i=null==t?void 0:t["content-length"];return i&&parseInt(i)>n?"".concat(r," body too large to record"):e}var Sr=function(e,t){var n,r,i,o=e.session_recording,s=!1!==o.recordHeaders&&t.recordHeaders,u=!1!==o.recordBody&&t.recordBody,l=!1!==o.recordPerformance&&t.recordPerformance,c=(n=o,i=Math.min(1e6,null!==(r=n.payloadSizeLimitBytes)&&void 0!==r?r:1e6),function(e){return null!=e&&e.requestBody&&(e.requestBody=wr(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=wr(e.responseBody,e.responseHeaders,i,"Response")),e}),d=function(e){return c(function(e){var t=ur(e.name);if(!(t&&t.pathname&&kr.includes(t.pathname)))return e}((t=e,Object.keys(null!==(n=t.requestHeaders)&&void 0!==n?n:{}).forEach((function(e){var n;br.includes(e.toLowerCase())&&(null===(n=t.requestHeaders)||void 0===n||delete n[e])})),t)));var t,n},f=St(e.session_recording.maskNetworkRequestFn);return f&&St(e.session_recording.maskCapturedNetworkRequestFn)&&Mt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(e.session_recording.maskCapturedNetworkRequestFn=function(t){var n=e.session_recording.maskNetworkRequestFn({url:t.name});return a(a({},t),{},{name:null==n?void 0:n.url})}),o.maskRequestFn=St(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,r,i,o=d(t);return o&&null!==(n=null===(r=(i=e.session_recording).maskCapturedNetworkRequestFn)||void 0===r?void 0:r.call(i,o))&&void 0!==n?n:void 0}:void 0,o.maskRequestFn||(o.maskRequestFn=d),a(a(a({},yr),o),{},{recordHeaders:s,recordBody:u,recordPerformance:l,recordInitialRequests:l})},Cr="__ph_opt_in_out_";function Ir(e,t){Pr(!0,e,t)}function xr(e,t){Pr(!1,e,t)}function Fr(e,t){return"1"===Tr(e,t)}function Er(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||dt,n=null==t?void 0:t.navigator,r=!1;return Lt([null==n?void 0:n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){At([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===Tr(e,t)}function Rr(e,t){Or(t=t||{}).remove(Mr(e,t),!!t.crossSubdomainCookie)}function Or(e){return"localStorage"===(e=e||{}).persistenceType?er:"localStorage+cookie"===e.persistenceType?nr:Kn}function Mr(e,t){return((t=t||{}).persistencePrefix||Cr)+e}function Tr(e,t){return Or(t).get(Mr(e,t))}function Pr(e,t,n){xt(t)&&t.length?(Or(n=n||{}).set(Mr(t,n),e?1:0,Et(n.cookieExpiration)?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):Mt.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function Nr(e){var t=!1;try{var n=e.config.token,r=e.config.respect_dnt,i=e.config.opt_out_capturing_persistence_type,o=e.config.opt_out_capturing_cookie_prefix||void 0,a=e.config.window;n&&(t=Er(n,{respectDnt:r,persistenceType:i,persistencePrefix:o,window:a}))}catch(e){Mt.error("Unexpected error when checking capturing opt-out status: "+e)}return t}var Lr,Dr=3e5,Ar=Dr;!function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet"}(Lr||(Lr={}));var $r=[Lr.MouseMove,Lr.MouseInteraction,Lr.Scroll,Lr.ViewportResize,Lr.Input,Lr.TouchMove,Lr.MediaInteraction,Lr.Drag],qr=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}},Br=function(){function e(t){var n=this;if(u(this,e),d(this,"queuedRRWebEvents",[]),d(this,"isIdle",!1),d(this,"_linkedFlagSeen",!1),d(this,"_lastActivityTimestamp",Date.now()),d(this,"windowId",null),d(this,"sessionId",null),d(this,"_linkedFlag",null),d(this,"_sampleRate",null),d(this,"_minimumDuration",null),d(this,"_recordCanvas",!1),d(this,"_canvasFps",null),d(this,"_canvasQuality",null),d(this,"_forceAllowLocalhostNetworkCapture",!1),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,null==dt||dt.addEventListener("beforeunload",(function(){n._flushBuffer()})),null==dt||dt.addEventListener("offline",(function(){n._tryAddCustomEvent("browser offline",{})})),null==dt||dt.addEventListener("online",(function(){n._tryAddCustomEvent("browser online",{})})),!this.instance.sessionManager)throw Mt.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");this.buffer=this.clearBuffer()}return c(e,[{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw Mt.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return Et(this._sampleRate)?this.instance.get_property(wn):null}},{key:"sessionDuration",get:function(){var e,t,n=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],r=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return n?n.timestamp-r:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(mn),t=!this.instance.config.disable_session_recording;return dt&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(_n),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"recordingVersion",get:function(){var e,t=this.instance.get_property(yn);return(null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recorderVersion)||t||"v1"}},{key:"networkPayloadCapture",get:function(){var e,t,n=this.instance.get_property(bn),r={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},i=(null==r?void 0:r.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==r?void 0:r.recordBody)||(null==n?void 0:n.recordBody),a=this.instance.config.capture_performance||(null==n?void 0:n.capturePerformance);return i||o||a?{recordHeaders:i,recordBody:o,recordPerformance:a}:void 0}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?xt(this._linkedFlag)&&!this._linkedFlagSeen?"buffering":Rt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this.startCaptureAndTrySendingQueuedSnapshots(),Mt.info("[SessionRecording] started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Mt.info("[SessionRecording] stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n=this.sessionId!==e;if(Et(this._sampleRate)){var r,i=this.isSampled;if(n||!Rt(i))r=Math.random()<this._sampleRate;else r=i;r||Mt.warn("[SessionSampling] Sample rate (".concat(this._sampleRate,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),null===(t=this.instance.persistence)||void 0===t||t.register(d({},wn,r))}else{var o;null===(o=this.instance.persistence)||void 0===o||o.register(d({},wn,null))}}},{key:"afterDecideResponse",value:function(e){var t,n,r,i,o,s,u,l,c,f,p,h=this;this.instance.persistence&&this.instance.persistence.register((d(p={},mn,!!e.sessionRecording),d(p,_n,null===(l=e.sessionRecording)||void 0===l?void 0:l.consoleLogRecordingEnabled),d(p,yn,null===(c=e.sessionRecording)||void 0===c?void 0:c.recorderVersion),d(p,bn,a({capturePerformance:e.capturePerformance},null===(f=e.sessionRecording)||void 0===f?void 0:f.networkPayloadCapture)),p));var v=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate;this._sampleRate=It(v)||Ft(v)?null:parseFloat(v);var g=null===(n=e.sessionRecording)||void 0===n?void 0:n.minimumDurationMilliseconds;this._minimumDuration=It(g)?null:g;var m=null===(r=e.sessionRecording)||void 0===r?void 0:r.recordCanvas;this._recordCanvas=!It(m)&&!Ft(m)&&m;var _=null===(i=e.sessionRecording)||void 0===i?void 0:i.canvasFps;this._canvasFps=It(_)?null:_;var y,b=null===(o=e.sessionRecording)||void 0===o?void 0:o.canvasQuality;(this._canvasQuality=It(b)||Ft(b)?null:parseFloat(b),this._linkedFlag=(null===(s=e.sessionRecording)||void 0===s?void 0:s.linkedFlag)||null,null!==(u=e.sessionRecording)&&void 0!==u&&u.endpoint)&&(this._endpoint=null===(y=e.sessionRecording)||void 0===y?void 0:y.endpoint);if(Et(this._sampleRate)&&this.sessionManager.onSessionId((function(e){h.makeSamplingDecision(e)})),xt(this._linkedFlag)){var k=this._linkedFlag;this.instance.onFeatureFlags((function(e){h._linkedFlagSeen=e.includes(k)}))}this.receivedDecide=!0,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:qt()})}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(!It(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||Nr(this.instance))){this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId();var t="v2"===this.recordingVersion?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.recordingVersion?Qt(this.instance.config.api_host+"/static/".concat(t,"?v=").concat(gt.LIB_VERSION),(function(n){if(n)return Mt.error("Could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==$r.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this._isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>Ar&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Ar}));var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)),!this.isIdle){var r=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,o=r.sessionId,a=this.sessionId!==o,s=this.windowId!==i;this.windowId=i,this.sessionId=o,(n||-1===[vr,gr].indexOf(e.type)&&(s||a))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(t){return Mt.warn("[Session-Recording] could not emit queued rrweb event.",t),this.queuedRRWebEvents.length<10&&this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}),!1}}},{key:"_tryAddCustomEvent",value:function(e,t){var n=this;return this._tryRRWebMethod(qr((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(qr((function(){return e.rrwebRecord.takeFullSnapshot()})))}},{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=dt.rrweb?dt.rrweb.record:dt.rrwebRecord;for(var r=this.instance.config.session_recording,i=0,o=Object.entries(r||{});i<o.length;i++){var s=_(o[i],2),u=s[0],l=s[1];u in n&&(n[u]=l)}if(!this._recordCanvas||Ft(this._canvasFps)||Ft(this._canvasQuality)||(n.recordCanvas=!0,n.sampling={canvas:this._canvasFps},n.dataURLOptions={type:"image/webp",quality:this._canvasQuality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new mr(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");Mt.info(r,{node:n}),t.log("[PostHog Recorder] "+r,"warn")}}),this._scheduleFullSnapshot();var c=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(a({emit:function(e){t.onRRwebEmit(e)},plugins:c},n)),this.instance._addCaptureHook((function(e){try{if("$pageview"===e){var n=dt?t._maskUrl(dt.location.href):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n})}}catch(e){Mt.error("Could not add $pageview to rrweb session",e)}})),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:n,activePlugins:c.map((function(e){return null==e?void 0:e.name}))})}else Mt.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var e=this;this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this._fullSnapshotTimer=setInterval((function(){e._tryTakeFullSnapshot()}),Dr)}},{key:"_gatherRRWebPlugins",value:function(){var e=[];(vt.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(vt.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&St(vt.getRecordNetworkPlugin))&&(!sr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(vt.getRecordNetworkPlugin(Sr(this.instance.config,this.networkPayloadCapture))):Mt.info("[SessionReplay-NetworkCapture] not started because we are on localhost."));return e}},{key:"onRRwebEmit",value:function(e){if(this._processQueuedEvents(),e&&Ct(e)){if(e.type===_r.Meta){var t=this._maskUrl(e.data.href);if(!t)return;e.data.href=t}e.type===_r.FullSnapshot&&this._scheduleFullSnapshot();var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var r=function(e){var t=e;if(t&&Ct(t)&&6===t.type&&Ct(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var n=[],r=0;r<t.data.payload.payload.length;r++)t.data.payload.payload[r]&&t.data.payload.payload[r].length>2e3?n.push(t.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):n.push(t.data.payload.payload[r]);return t.data.payload.payload=n,e}return e}(n),i=JSON.stringify(r).length;if(this._updateWindowAndSessionIds(r),!this.isIdle){var o={$snapshot_bytes:i,$snapshot_data:r,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(o):this.clearBuffer()}}}}},{key:"_processQueuedEvents",value:function(){var e=this;if(this.queuedRRWebEvents.length){var t=y(this.queuedRRWebEvents);this.queuedRRWebEvents=[],t.forEach((function(n){Date.now()-n.enqueuedAt>2e3?e._tryAddCustomEvent("rrwebQueueTimeout",{enqueuedAt:n.enqueuedAt,attempt:n.attempt,queueLength:t.length}):e._tryRRWebMethod(n)&&e._tryAddCustomEvent("rrwebQueueSuccess",{enqueuedAt:n.enqueuedAt,attempt:n.attempt,queueLength:t.length})}))}}},{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:"clearBuffer",value:function(){return this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_flushBuffer",value:function(){var e=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this._minimumDuration,n=this.sessionDuration,r=Et(n)&&n>=0,i=Et(t)&&r&&n<t;return"buffering"===this.status||i?(this.flushBufferTimer=setTimeout((function(){e._flushBuffer()}),2e3),this.buffer||this.clearBuffer()):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.clearBuffer()):this.buffer||this.clearBuffer()}},{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.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),Ft(this.buffer.sessionId)&&!Ft(this.sessionId)&&(this.buffer.sessionId=this.sessionId,this.buffer.windowId=this.windowId),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:e.$snapshot_data.type===vr}})}}]),e}(),jr=function(){function e(t){u(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return c(e,[{key:"call",value:function(){var e=this,t=Vt(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(In),group_properties:this.instance.get_property(xn),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=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),0!==(null==e?void 0:e.status)){if(!pt||!pt.body)return Mt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){n.parseDecideResponse(e)}),500);this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),Nn.afterDecideResponse(e,this.instance),this.instance._afterDecideResponse(e),this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e);var r=null==dt?void 0:dt.extendPostHogWithSurveys;e.surveys&&!r&&Qt(this.instance.config.api_host+"/static/surveys.js",(function(e){if(e)return Mt.error("Could not load surveys script",e);dt.extendPostHogWithSurveys(n.instance)}));var i=null==dt?void 0:dt.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&It(i)&&Qt(this.instance.config.api_host+"/static/exception-autocapture.js",(function(t){if(t)return Mt.error("Could not load exception autocapture script",t);dt.extendPostHogWithExceptionAutocapture(n.instance,e)})),e.siteApps)if(this.instance.config.opt_in_site_apps){var o,a=this.instance.config.api_host,s=w(e.siteApps);try{var u=function(){var e=o.value,t=e.id,r=e.url,i=[a,"/"===a[a.length-1]&&"/"===r[0]?r.substring(1):r].join("");vt["__$$ph_site_app_".concat(t)]=n.instance,Qt(i,(function(e){e&&Mt.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(s.s();!(o=s.n()).done;)u()}catch(e){s.e(e)}finally{s.f()}}else e.siteApps.length>0&&Mt.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else Mt.error("Failed to fetch feature flags from PostHog.")}}]),e}(),Hr=["https://app.posthog.com","https://eu.posthog.com"],Wr=["source"],Ur=null!=dt&&dt.location?dr(dt.location.hash,"__posthog")||dr(location.hash,"state"):null,Vr=function(){function e(t){u(this,e),this.instance=t}return c(e,[{key:"afterDecideResponse",value:function(e){var t=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&this.loadToolbar(a({},t))}},{key:"maybeLoadToolbar",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!dt||!pt)return!1;n=null!==(e=n)&&void 0!==e?e:dt.location,i=null!==(t=i)&&void 0!==t?t:dt.history;try{if(!r){try{dt.localStorage.setItem("test","test"),dt.localStorage.removeItem("test")}catch(e){return!1}r=null==dt?void 0:dt.localStorage}var o,a=Ur||dr(n.hash,"__posthog")||dr(n.hash,"state"),s=a?Bt((function(){return JSON.parse(atob(decodeURIComponent(a)))}))||Bt((function(){return JSON.parse(decodeURIComponent(a))})):null;return s&&"ph_authorize"===s.action?((o=s).source="url",o&&Object.keys(o).length>0&&(s.desiredHash?n.hash=s.desiredHash:i?i.replaceState("",pt.title,n.pathname+n.search):n.hash="")):((o=JSON.parse(r.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch(e){return!1}}},{key:"loadToolbar",value:function(e){var t=this;if(!dt||vt._postHogToolbarLoaded)return!1;vt._postHogToolbarLoaded=!0;var n=this.instance.config.api_host,r=3e5,i=Math.floor(Date.now()/r)*r,o="".concat(n).concat(n.endsWith("/")?"":"/","static/toolbar.js?t=").concat(i),s=!Hr.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,u=a(a({token:this.instance.config.token},e),{},{apiURL:n},s?{instrument:!1}:{});u.source;var l=v(u,Wr);return dt.localStorage.setItem("_postHogToolbarParams",JSON.stringify(l)),Qt(o,(function(e){e?Mt.error("Failed to load toolbar",e):(vt.ph_load_toolbar||vt.ph_load_editor)(u,t.instance)})),Gt(dt,"turbolinks:load",(function(){vt._postHogToolbarLoaded=!1,t.loadToolbar(u)})),!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]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,n)}}]),e}(),zr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;u(this,e),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=t}return c(e,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),e}(),Gr=function(e){f(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;return u(this,n),(r=t.call(this,i)).handlePollRequest=e,r}return c(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(),n=function(n){var r=t[n],i=r.url,o=r.data,a=r.options;Lt(o,(function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp})),e.handlePollRequest(i,o,a)};for(var r in t)n(r);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(y(n.filter((function(e){return 0===e.url.indexOf("/e")}))),y(n.filter((function(e){return 0!==e.url.indexOf("/e")})))).map((function(t){var n=t.url,r=t.data,i=t.options;e.handlePollRequest(n,r,a(a({},i),{},{transport:"sendBeacon"}))}))}},{key:"formatQueue",value:function(){var e={};return Lt(this._event_queue,(function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;It(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}(zr),Qr=Uint8Array,Yr=Uint16Array,Jr=Uint32Array,Xr=new Qr([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]),Kr=new Qr([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]),Zr=new Qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ei=function(e,t){for(var n=new Yr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new Jr(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]},ti=ei(Xr,2),ni=ti[0],ri=ti[1];ni[28]=258,ri[258]=28;for(var ii=ei(Kr,0)[1],oi=new Yr(32768),ai=0;ai<32768;++ai){var si=(43690&ai)>>>1|(21845&ai)<<1;si=(61680&(si=(52428&si)>>>2|(13107&si)<<2))>>>4|(3855&si)<<4,oi[ai]=((65280&si)>>>8|(255&si)<<8)>>>1}var ui=function(e,t,n){for(var r=e.length,i=0,o=new Yr(t);i<r;++i)++o[e[i]-1];var a,s=new Yr(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new Yr(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)a[oi[d]>>>u]=l}else for(a=new Yr(r),i=0;i<r;++i)a[i]=oi[s[e[i]-1]++]>>>15-e[i];return a},li=new Qr(288);for(ai=0;ai<144;++ai)li[ai]=8;for(ai=144;ai<256;++ai)li[ai]=9;for(ai=256;ai<280;++ai)li[ai]=7;for(ai=280;ai<288;++ai)li[ai]=8;var ci=new Qr(32);for(ai=0;ai<32;++ai)ci[ai]=5;var di,fi=ui(li,9,0),pi=ui(ci,5,0),hi=function(e){return(e/8>>0)+(7&e&&1)},vi=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Yr?Yr:e instanceof Jr?Jr:Qr)(n-t);return r.set(e.subarray(t,n)),r},gi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},mi=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},_i=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 Qr(0),0];if(1==i){var a=new Qr(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:s.f+u.f,l:s,r:u};c!=i-1;)s=n[n[l].f<n[d].f?l++:d++],u=n[l!=c&&n[l].f<n[d].f?l++:d++],n[c++]={s:-1,f:s.f+u.f,l:s,r:u};var f=o[0].s;for(r=1;r<i;++r)o[r].s>f&&(f=o[r].s);var p=new Yr(f+1),h=yi(n[c-1],p,0);if(h>t){r=0;var v=0,g=h-t,m=1<<g;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var _=o[r].s;if(!(p[_]>t))break;v+=m-(1<<h-p[_]),p[_]=t}for(v>>>=g;v>0;){var y=o[r].s;p[y]<t?v-=1<<t-p[y]++-1:++r}for(;r>=0&&v;--r){var b=o[r].s;p[b]==t&&(--p[b],++v)}h=t}return[new Qr(p),h]},yi=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},bi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Yr(++t),r=0,i=e[0],o=1,a=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[n.subarray(0,r),t]},ki=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},wi=function(e,t,n){var r=n.length,i=hi(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)},Si=function(e,t,n,r,i,o,a,s,u,l,c){gi(t,c++,n),++i[256];for(var d=_i(i,15),f=d[0],p=d[1],h=_i(o,15),v=h[0],g=h[1],m=bi(f),_=m[0],y=m[1],b=bi(v),k=b[0],w=b[1],S=new Yr(19),C=0;C<_.length;++C)S[31&_[C]]++;for(C=0;C<k.length;++C)S[31&k[C]]++;for(var I=_i(S,7),x=I[0],F=I[1],E=19;E>4&&!x[Zr[E-1]];--E);var R,O,M,T,P=l+5<<3,N=ki(i,li)+ki(o,ci)+a,L=ki(i,f)+ki(o,v)+a+14+3*E+ki(S,x)+(2*S[16]+3*S[17]+7*S[18]);if(P<=N&&P<=L)return wi(t,c,e.subarray(u,u+l));if(gi(t,c,1+(L<N)),c+=2,L<N){R=ui(f,p,0),O=f,M=ui(v,g,0),T=v;var D=ui(x,F,0);gi(t,c,y-257),gi(t,c+5,w-1),gi(t,c+10,E-4),c+=14;for(C=0;C<E;++C)gi(t,c+3*C,x[Zr[C]]);c+=3*E;for(var A=[_,k],$=0;$<2;++$){var q=A[$];for(C=0;C<q.length;++C){var B=31&q[C];gi(t,c,D[B]),c+=x[B],B>15&&(gi(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}}else R=fi,O=li,M=pi,T=ci;for(C=0;C<s;++C)if(r[C]>255){B=r[C]>>>18&31;mi(t,c,R[B+257]),c+=O[B+257],B>7&&(gi(t,c,r[C]>>>23&31),c+=Xr[B]);var j=31&r[C];mi(t,c,M[j]),c+=T[j],j>3&&(mi(t,c,r[C]>>>5&8191),c+=Kr[j])}else mi(t,c,R[r[C]]),c+=O[r[C]];return mi(t,c,R[256]),c+O[256]},Ci=new Jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ii=new Qr(0),xi=function(){for(var e=new Jr(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Fi=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=xi[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},Ei=function(e,t,n,r,i){return function(e,t,n,r,i,o){var a=e.length,s=new Qr(r+a+5*(1+Math.floor(a/7e3))+i),u=s.subarray(r,s.length-i),l=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var d=c+65535;d<a?l=wi(u,l,e.subarray(c,d)):(u[c]=o,l=wi(u,l,e.subarray(c,a)))}else{for(var f=Ci[t-1],p=f>>>13,h=8191&f,v=(1<<n)-1,g=new Yr(32768),m=new Yr(v+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&v},k=new Jr(25e3),w=new Yr(288),S=new Yr(32),C=0,I=0,x=(c=0,0),F=0,E=0;c<a;++c){var R=b(c),O=32767&c,M=m[R];if(g[O]=M,m[R]=O,F<=c){var T=a-c;if((C>7e3||x>24576)&&T>423){l=Si(e,u,0,k,w,S,I,x,E,c-E,l),x=C=I=0,E=c;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var N=2,L=0,D=h,A=O-M&32767;if(T>2&&R==b(c-A))for(var $=Math.min(p,T)-1,q=Math.min(32767,c),B=Math.min(258,T);A<=q&&--D&&O!=M;){if(e[c+N]==e[c+N-A]){for(var j=0;j<B&&e[c+j]==e[c+j-A];++j);if(j>N){if(N=j,L=A,j>$)break;var H=Math.min(A,j-2),W=0;for(P=0;P<H;++P){var U=c-A+P+32768&32767,V=U-g[U]+32768&32767;V>W&&(W=V,M=U)}}}A+=(O=M)-(M=g[O])+32768&32767}if(L){k[x++]=268435456|ri[N]<<18|ii[L];var z=31&ri[N],G=31&ii[L];I+=Xr[z]+Kr[G],++w[257+z],++S[G],F=c+N,++C}else k[x++]=e[c],++w[e[c]]}}l=Si(e,u,o,k,w,S,I,x,E,c-E,l),o||(l=wi(u,l,Ii))}return vi(s,0,r+hi(l)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},Ri=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Oi=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&&Ri(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)}},Mi=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Ti(e,t){void 0===t&&(t={});var n=Fi(),r=e.length;n.p(e);var i=Ei(e,t,Mi(t),8),o=i.length;return Oi(i,t),Ri(i,o-8,n.d()),Ri(i,o-4,r),i}function Pi(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Qr(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},a=0;a<n;++a){if(i+5>r.length){var s=new Qr(i+8+(n-a<<1));s.set(r),r=s}var u=e.charCodeAt(a);u<128||t?o(u):u<2048?(o(192|u>>>6),o(128|63&u)):u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++a))>>>18),o(128|u>>>12&63),o(128|u>>>6&63),o(128|63&u)):(o(224|u>>>12),o(128|u>>>6&63),o(128|63&u))}return vi(r,0,i)}!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(di||(di={}));var Ni=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=gt.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,a=w(i[1].split("&"));try{for(a.s();!(o=a.n()).done;){var s=o.value.split("=")[0];It(r[s])||delete r[s]}}catch(e){a.e(e)}finally{a.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 Lt(e,(function(e,r){It(e)||It(r)||"undefined"===r||(t=encodeURIComponent(e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)})),i.join(r)}(r)},Li=function e(t,n){if(n.blob&&t.buffer)return new Blob([wt(t)?t:t.buffer],{type:"text/plain"});if(n.sendBeacon||n.blob){var r=e(t,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}return"POST"!==n.method?null:(i=kt(t)||wt(t)?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(i+="&compression="+t.compression),i);var i},Di=function(e){var t=e.url,n=e.data,r=e.headers,i=e.options,o=e.callback,a=e.retriesPerformedSoFar,s=e.retryQueue,u=e.onXHRError,l=e.timeout,c=void 0===l?6e4:l,d=e.onResponse;Et(a)&&a>0&&(t=Ni(t,{retry_count:a},{}));var f=new XMLHttpRequest;f.open(i.method||"GET",t,!0);var p=Li(n,i);Lt(r,(function(e,t){f.setRequestHeader(t,e)})),"POST"!==i.method||i.blob||f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.timeout=c,f.withCredentials=!0,f.onreadystatechange=function(){if(4===f.readyState)if(null==d||d(f),200===f.status){if(o){var e;try{e=JSON.parse(f.responseText)}catch(e){return void Mt.error(e)}o(e)}}else St(u)&&u(f),(f.status<400||f.status>500)&&s.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(a||0)+1,callback:o}),null==o||o({status:0})},f.send(p)};var Ai=function(e){f(n,e);var t=m(n);function n(e,r){var i;return u(this,n),(i=t.call(this)).isPolling=!1,i.queue=[],i.areWeOnline=!0,i.onXHRError=e,i.rateLimiter=r,!It(dt)&&"onLine"in dt.navigator&&(i.areWeOnline=dt.navigator.onLine,dt.addEventListener("online",(function(){i._handleWeAreNowOnline()})),dt.addEventListener("offline",(function(){i.areWeOnline=!1}))),i}return c(n,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var n=function(e){var t=3e3*Math.pow(2,e),n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=new Date(Date.now()+n);this.queue.push({retryAt:r,requestData:e});var i="Enqueued failed request for retry in ".concat(n);navigator.onLine||(i+=" (Browser is offline)"),Mt.warn(i),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=w(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=w(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestData,r=n.url,i=n.data,o=n.options;if(this.rateLimiter.isRateLimited(o._batchKey))Mt.warn("[RetryQueue] is quota limited. Dropping request.");else try{null==dt||dt.navigator.sendBeacon(r,Li(i,a(a({},o),{},{sendBeacon:!0})))}catch(e){Mt.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,a=e.retriesPerformedSoFar;this.rateLimiter.isRateLimited(r._batchKey)||Di({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:a||0,callback:o,retryQueue:this,onXHRError:this.onXHRError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),n}(zr),$i=1800,qi=function(){function e(t,n,r,i){u(this,e),d(this,"_sessionIdChangedHandlers",[]),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=r||zn,this._windowIdGenerator=i||zn;var o=t.persistence_name||t.token,a=t.session_idle_timeout_seconds||$i;if(Et(a)?a>$i?Mt.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):a<60&&Mt.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(Mt.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),a=$i),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,60),$i),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var s=ar.parse(this._window_id_storage_key),l=ar.parse(this._primary_window_exists_storage_key);s&&!l?this._windowId=s:ar.remove(this._window_id_storage_key),ar.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return c(e,[{key:"onSessionId",value:function(e){var t=this;return It(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&&ar.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ar.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ar.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(d({},kn,[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[kn];return kt(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;null==dt||dt.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&ar.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=_(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],a=this._getWindowId(),s=o&&o>0&&Math.abs(t-o)>864e5,u=!1,l=!i,c=!e&&Math.abs(t-r)>this._sessionTimeoutMs;l||c||s?(i=this._sessionIdGenerator(),a=this._windowIdGenerator(),Mt.info("[SessionId] new session ID generated",{sessionId:i,windowId:a,changeReason:{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}}),o=t,u=!0):a||(a=this._windowIdGenerator(),u=!0);var d=0===r||!e||s?t:r,f=0===o?(new Date).getTime():o;return this._setWindowId(a),this._setSessionId(i,d,f),u&&this._sessionIdChangedHandlers.forEach((function(e){return e(i,a)})),{sessionId:i,windowId:a,sessionStartTimestamp:f}}}]),e}(),Bi=c((function e(t,n,r,i){u(this,e),this.name="posthog-js",this.setupOnce=function(e){e((function(e){var o,a,s,u,l;if("error"!==e.level||!t.__loaded)return e;e.tags||(e.tags={});var c=t.config.ui_host||t.config.api_host;e.tags["PostHog Person URL"]=c+"/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===(a=d[0])||void 0===a?void 0:a.value,$exception_type:null===(s=d[0])||void 0===s?void 0:s.type,$exception_personURL:c+"/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===(l=d[0])||void 0===l?void 0:l.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}))}})),ji=function(){function e(t){var n=this;u(this,e),d(this,"_hasSeenPageView",!1),d(this,"_updateScrollData",(function(){var e,t,r,i;n._pageViewData||(n._pageViewData=n._createPageViewData());var o=n._pageViewData,a=n._scrollY(),s=n._scrollHeight(),u=n._contentY(),l=n._contentHeight();o.lastScrollY=a,o.maxScrollY=Math.max(a,null!==(e=o.maxScrollY)&&void 0!==e?e:0),o.maxScrollHeight=Math.max(s,null!==(t=o.maxScrollHeight)&&void 0!==t?t:0),o.lastContentY=u,o.maxContentY=Math.max(u,null!==(r=o.maxContentY)&&void 0!==r?r:0),o.maxContentHeight=Math.max(l,null!==(i=o.maxContentHeight)&&void 0!==i?i:0)})),this._instance=t}return c(e,[{key:"_createPageViewData",value:function(){var e;return{pathname:null!==(e=null==dt?void 0:dt.location.pathname)&&void 0!==e?e:""}}},{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),a({$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 a({$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,a=e.maxContentY;return t=Math.ceil(t),n=Math.ceil(n),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),a=Math.ceil(a),{$prev_pageview_last_scroll:n,$prev_pageview_last_scroll_percentage:t<=1?1:Hi(n/t,0,1),$prev_pageview_max_scroll:r,$prev_pageview_max_scroll_percentage:t<=1?1:Hi(r/t,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:i<=1?1:Hi(o/i,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:i<=1?1:Hi(a/i,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){null==dt||dt.addEventListener("scroll",this._updateScrollData,!0),null==dt||dt.addEventListener("scrollend",this._updateScrollData,!0),null==dt||dt.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){null==dt||dt.removeEventListener("scroll",this._updateScrollData),null==dt||dt.removeEventListener("scrollend",this._updateScrollData),null==dt||dt.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return null==dt?void 0:dt.document.documentElement;var e,t=w(kt(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]);try{for(t.s();!(e=t.n()).done;){var n=e.value,r=null==dt?void 0:dt.document.querySelector(n);if(r)return r}}catch(e){t.e(e)}finally{t.f()}}},{key:"_scrollHeight",value:function(){var e=this._scrollElement();return e?Math.max(0,e.scrollHeight-e.clientHeight):0}},{key:"_scrollY",value:function(){if(this._instance.config.scroll_root_selector){var e=this._scrollElement();return e&&e.scrollTop||0}return dt&&(dt.scrollY||dt.pageYOffset||dt.document.documentElement.scrollTop)||0}},{key:"_contentHeight",value:function(){var e=this._scrollElement();return(null==e?void 0:e.scrollHeight)||0}},{key:"_contentY",value:function(){var e=this._scrollElement(),t=(null==e?void 0:e.clientHeight)||0;return this._scrollY()+t}}]),e}();function Hi(e,t,n){return Math.max(t,Math.min(e,n))}var Wi,Ui,Vi,zi={icontains:function(e){return!!dt&&dt.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},regex:function(e){return!!dt&&lr(dt.location.href,e)},exact:function(e){return(null==dt?void 0:dt.location.href)===e}},Gi=function(){function e(t){u(this,e),this.instance=t}return c(e,[{key:"getSurveys",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(Fn);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(d({},Fn,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){var r=n.filter((function(e){return!(!e.start_date||e.end_date)})).filter((function(e){var t,n,r,i;if(!e.conditions)return!0;var o=null===(t=e.conditions)||void 0===t||!t.url||zi[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),a=null===(i=e.conditions)||void 0===i||!i.selector||(null==pt?void 0:pt.querySelector(e.conditions.selector));return o&&a})).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}));return e(r)}),n)}}]),e}(),Qi=function(){function e(){var t=this;u(this,e),d(this,"limits",{}),d(this,"checkForLimiting",(function(e){try{var n=e.responseText;if(!n||!n.length)return;(JSON.parse(n).quota_limited||[]).forEach((function(e){Mt.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),t.limits[e]=(new Date).getTime()+6e4}))}catch(e){return void Mt.error(e)}}))}return c(e,[{key:"isRateLimited",value:function(e){var t=this.limits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Yi=function(){return a({initialPathName:(null==dt?void 0:dt.location.pathname)||"",referringDomain:fr.referringDomain()},fr.campaignParams())},Ji=function(){function e(t,n,r){var i=this;u(this,e),d(this,"_onSessionIdCallback",(function(e){var t=i._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:i._sessionSourceParamGenerator()};i._persistence.register(d({},Mn,n))}})),this._sessionIdManager=t,this._persistence=n,this._sessionSourceParamGenerator=r||Yi,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return c(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[Mn]}},{key:"getSessionProps",value:function(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}]),e}(),Xi=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","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"],Ki=function(e,t){if(!e)return!1;var n=e.toLowerCase();return Xi.concat(t||[]).some((function(e){var t=e.toLowerCase();return n.includes?n.includes(t):-1!==n.indexOf(t)}))};!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(Wi||(Wi={}));var Zi=function(){},eo={},to="posthog",no=(null==dt?void 0:dt.XMLHttpRequest)&&"withCredentials"in new XMLHttpRequest,ro=!no&&-1===(null==ht?void 0:ht.indexOf("MSIE"))&&-1===(null==ht?void 0:ht.indexOf("Mozilla")),io=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:(t=null==pt?void 0:pt.location,n=null==t?void 0:t.hostname,!!xt(n)&&"herokuapp.com"!==n.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",cookie_name:"",loaded:Zi,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==dt||null===(e=dt.location)||void 0===e?void 0:e.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!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){var t="Bad HTTP status: "+e.status+" "+e.statusText;Mt.error(t)},get_device_id:function(e){return e},_onCapture:Zi,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},oo=function(e,t,n,r){var i,o=n!==to&&Vi?n?Vi[n]:void 0:Vi,a={initComplete:!1,syncCode:!1},s=function(e){return function(t){a[e]||(a[e]=!0,a.initComplete&&a.syncCode&&(null==r||r(t)))}};if(o&&Ui===Wi.INIT_MODULE)i=o;else{if(o&&!kt(o))return void Mt.error("You have already initialized "+n);i=new so}if(i._init(e,t,n,s("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new Br(i),i.sessionRecording.startRecordingIfEnabled(),i.config.disable_scroll_properties||i.pageViewManager.startMeasuringScrollPosition(),i.__autocapture=i.config.autocapture,Nn._setIsAutocaptureEnabled(i),Nn._isAutocaptureEnabled){i.__autocapture=i.config.autocapture;Nn.enabledForProject(i.config.token,100,100)?Nn.isBrowserSupported()?Nn.init(i):(i.__autocapture=!1,Mt.info("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,Mt.info("Not in active bucket: disabling Automatic Event Collection."))}return gt.DEBUG=gt.DEBUG||i.config.debug,!It(o)&&kt(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),s("syncCode")(i),i},ao=function(){function e(){u(this,e),d(this,"__forceAllowLocalhost",!1)}return c(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){Mt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),so=function(){function e(){var t=this;u(this,e),d(this,"webPerformance",new ao),this.config=io(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=Bi,this.segmentIntegration=function(){return function(e){Promise&&Promise.resolve||Mt.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")}}}(t)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new qn(this),this.toolbar=new Vr(this),this.pageViewManager=new ji(this),this.surveys=new Gi(this),this.rateLimiter=new Qi,this.people={set:function(e,n,r){var i=xt(e)?d({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i=xt(e)?d({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}}}return c(e,[{key:"init",value:function(e,t,n){if(It(n))Mt.critical("You must name your new library: init(token, config, name)");else{if(n!==to){var r=oo(e,t,n,(function(e){Vi[n]=e,e._loaded()}));return Vi[n]=r,r}Mt.critical("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var t,n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var l,c={segmentRegister:!1,syncCode:!1},d=function(e){return function(){c[e]||(c[e]=!0,c.segmentRegister&&c.syncCode&&(null==u||u(i)))}};(this.set_config(Dt({},io(),o,{name:s,token:e,callback_fn:(s===to?s:to+"."+s)+"._jsc"})),this._jsc=function(){},null!=dt&&null!==(t=dt.rrweb)&&void 0!==t&&t.record||null!=dt&&dt.rrwebRecord)&&(this.__loaded_recorder_version=null==dt||null===(l=dt.rrweb)||void 0===l?void 0:l.version);if(this.persistence=new hr(this.config),this._requestQueue=new Gr(this._handle_queued_event.bind(this)),this._retryQueue=new Ai(this.config.on_xhr_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new qi(this.config,this.persistence),this.sessionPropsManager=new Ji(this.sessionManager,this.persistence),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new hr(a(a({},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(d("segmentRegister"))):d("segmentRegister")(),void 0!==(null===(n=o.bootstrap)||void 0===n?void 0:n.distinctID)){var f,p,h=this.config.get_device_id(zn()),v=null!==(f=o.bootstrap)&&void 0!==f&&f.isIdentifiedID?h:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(p=o.bootstrap)&&void 0!==p&&p.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:v})}if(this._hasBootstrappedFeatureFlags()){var g,m,_=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}),{}),y=Object.keys((null===(m=o.bootstrap)||void 0===m?void 0:m.featureFlagPayloads)||{}).filter((function(e){return _[e]})).reduce((function(e,t){var n,r,i,a;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===(a=i.featureFlagPayloads)||void 0===a?void 0:a[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:y})}if(!this.get_distinct_id()){var b=this.config.get_device_id(zn());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_user_state("anonymous")}null==dt||null===(r=dt.addEventListener)||void 0===r||r.call(dt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),d("syncCode")()}},{key:"_afterDecideResponse",value:function(e){var t;if(this.compression={},e.supportedCompression&&!this.config.disable_compression){var n,r={},i=w(e.supportedCompression);try{for(i.s();!(n=i.n()).done;){r[n.value]=!0}}catch(e){i.e(e)}finally{i.f()}this.compression=r}null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),e.elementsChainAsString&&(this.elementsChainAsString=e.elementsChainAsString)}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){Mt.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&pt&&this.capture("$pageview",{title:pt.title},{send_instantly:!0}),e||(new jr(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()||Nt(this.__request_queue,(function(t){e._send_request.apply(e,y(t))})),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(It(e))return null;if(no)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||eo,Zi)}},{key:"__compress_and_send_json_request",value:function(e,t,n,r){var i=function(e,t,n){return e===di.GZipJS?[Ti(Pi(t),{mtime:0}),a(a({},n),{},{blob:!0,urlQueryArgs:{compression:di.GZipJS}})]:[{data:Vt(t)},n]}(this.compression[di.GZipJS]?di.GZipJS:di.Base64,t,n),o=_(i,2),s=o[0],u=o[1];this._send_request(e,s,u,r)}},{key:"_send_request",value:function(e,t,n,r){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(n._batchKey))if(ro)this.__request_queue.push([e,t,n,r]);else{var i={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};n=Dt(i,n||{}),no||(n.method="GET");var o=dt&&"sendBeacon"in dt.navigator&&"sendBeacon"===n.transport;if(e=Ni(e,n.urlQueryArgs||{},{ip:this.config.ip}),o)try{null==dt||dt.navigator.sendBeacon(e,Li(t,a(a({},n),{},{sendBeacon:!0})))}catch(e){}else if(no||!pt)try{Di({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){Mt.error(e)}else{var s,u=pt.createElement("script");u.type="text/javascript",u.async=!0,u.defer=!0,u.src=e;var l=pt.getElementsByTagName("script")[0];null===(s=l.parentNode)||void 0===s||s.insertBefore(u,l)}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];Nt(e,(function(e){e&&(t=e[0],kt(t)?o.push(e):St(e)?e.call(n):kt(e)&&"alias"===t?r.push(e):kt(e)&&-1!==t.indexOf("capture")&&St(n[t])?o.push(e):i.push(e))}));var a=function(e,t){Nt(e,(function(e){if(kt(e[0])){var n=t;Lt(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(r,this),a(i,this),a(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:"capture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eo;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return Mt.uninitializedWarning("posthog.capture");if(!Nr(this)){var r=(n=n||eo).transport;if(r&&(n.transport=r),!It(e)&&xt(e)){if(!ht||this.config.opt_out_useragent_filter||!Ki(ht,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var i={uuid:zn(),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(i.$set=n.$set,i.$set_once=n.$set_once),(i=Ut(i,n._noTruncate?null:this.config.properties_string_max_length)).timestamp=n.timestamp||new Date;var o=a(a({},i.properties.$set),i.$set);(function(e){if(Ct(e)){for(var t in e)if(yt.call(e,t))return!1;return!0}return!1})(o)||this.setPersonPropertiesForFlags(o),Mt.info("send",i);var s=JSON.stringify(i),u=this.config.api_host+(n.endpoint||this.analyticsDefaultEndpoint),l=n!==eo;return!this.config.request_batching||l&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(u,s,n):this._requestQueue.enqueue(u,i,n),this._invokeCaptureHooks(e,i),i}}else Mt.error("No event name provided to posthog.capture")}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),Lt(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=a({},t);if(r.token=this.config.token,"$snapshot"===e){var i=a(a({},this.persistence.properties()),this.sessionPersistence.properties());return r.distinct_id=i.distinct_id,r}var o=fr.properties();if(this.sessionManager){var s=this.sessionManager.checkAndGetSessionAndWindowId(),u=s.sessionId,l=s.windowId;r.$session_id=u,r.$window_id=l}if(this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var c=this.sessionPropsManager.getSessionProps();r=Dt(r,c)}if(!this.config.disable_scroll_properties){var d={};"$pageview"===e?d=this.pageViewManager.doPageView():"$pageleave"===e&&(d=this.pageViewManager.doPageLeave()),r=Dt(r,d)}if("$pageview"===e&&pt&&(r.title=pt.title),"$performance_event"===e){var f=this.persistence.properties();return r.distinct_id=f.distinct_id,r.$current_url=o.$current_url,r}if(!It(n)){var p=(new Date).getTime()-n;r.$duration=parseFloat((p/1e3).toFixed(3))}ht&&this.config.opt_out_useragent_filter&&(r.$browser_type=Ki(ht,this.config.custom_blocked_useragents)?"bot":"browser"),r=Dt({},fr.properties(),this.persistence.properties(),this.sessionPersistence.properties(),r);var h=this.config.property_blacklist;kt(h)?Lt(h,(function(e){delete r[e]})):Mt.error("Invalid value for property_blacklist config: "+h);var v=this.config.sanitize_properties;return v&&(r=v(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(d({},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 Mt.uninitializedWarning("posthog.identify");if(e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Mt.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else{var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(hn)&&(this.unregister(hn),this.register({distinct_id:e}));var o="anonymous"===this.persistence.get_user_state();e!==r&&o?(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(En))}else Mt.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:a(a({},r),{},d({},e,t))}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags(d({},e,n))),r[e]===t||n||this.reloadFeatureFlags()}else Mt.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t,n,r,i;if(!this.__loaded)return Mt.uninitializedWarning("posthog.reset");var 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 a=this.config.get_device_id(zn());this.register_once({distinct_id:a,$device_id:e?a: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 a,s=null!==(a=e.timestampLookBack)&&void 0!==a?a:10;if(!i)return o;var u=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0);o+="?t=".concat(u)}return o}},{key:"alias",value:function(e,t){return e===this.get_property(pn)?(Mt.critical("Attempting to create alias for existing People user - aborting."),-2):(It(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(hn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Mt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var t,n,r=a({},this.config);if(Ct(e)&&(Dt(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),this.config.api_host=this.config.api_host.replace(/\/$/,""),"https://us.posthog.com"===this.config.api_host&&(this.config.api_host="https://app.posthog.com"),null===(t=this.persistence)||void 0===t||t.update_config(this.config),null===(n=this.sessionPersistence)||void 0===n||n.update_config(this.config),er.is_supported()&&"true"===er.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(gt.DEBUG=!0),this.sessionRecording&&!It(e.disable_session_recording))){var i=r.disable_session_recording!==e.disable_session_recording,o=!Nr(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(i||o)&&(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:to;return t!==to&&(t=to+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.config.opt_out_capturing_persistence_type&&er.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&&!Kn.get("ph_optout")||(Kn.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=Dt({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||{}),er.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=Dt({enable_persistence:!0},e||{}),this._gdpr_call_func(Ir,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=Dt({clear_persistence:!0},e||{});this._gdpr_call_func(xr,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Fr,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Er,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=Dt({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(Rr,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(null==dt||dt.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==dt||dt.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]]=jt(e.prototype[t[n]])}(so,["identify"]);var uo={},lo=function(){Vi.init=function(e,t,n){if(n)return Vi[n]||(Vi[n]=uo[n]=oo(e||"",t||{},n,(function(e){Vi[n]=uo[n]=e,e._loaded()}))),Vi[n];var r=Vi;return uo[to]?r=uo[to]:e&&(r=oo(e,t||{},to,(function(e){uo[to]=e,e._loaded()})),uo[to]=r),Vi=r,Ui===Wi.INIT_SNIPPET&&(vt[to]=Vi),Lt(uo,(function(e,t){t!==to&&(Vi[t]=e)})),r}};Ui=Wi.INIT_SNIPPET,It(vt.posthog)&&(vt.posthog=[]),(Vi=vt.posthog).__loaded||Vi.config&&Vi.persistence?Mt.critical("PostHog library has already been downloaded at least once."):(Lt(Vi._i,(function(e){e&&kt(e)&&(uo[e[2]]=oo.apply(void 0,y(e)))})),lo(),Vi.init(),Lt(uo,(function(e){e._loaded()})),function(){function e(){e.done||(e.done=!0,ro=!1,Lt(uo,(function(e){e._dom_loaded()})))}null!=pt&&pt.addEventListener&&("complete"===pt.readyState?e():pt.addEventListener("DOMContentLoaded",e,!1)),dt&&Gt(dt,"load",e,!0)}())}();
|
|
16
16
|
//# sourceMappingURL=array.full.js.map
|