posthog-js 1.111.2 → 1.112.0

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.
Files changed (80) hide show
  1. package/dist/array.full.js +1 -1
  2. package/dist/array.full.js.map +1 -1
  3. package/dist/array.js +1 -1
  4. package/dist/array.js.map +1 -1
  5. package/dist/es.js +1 -1
  6. package/dist/es.js.map +1 -1
  7. package/dist/exception-autocapture.js +1 -1
  8. package/dist/exception-autocapture.js.map +1 -1
  9. package/dist/lib/src/decide.d.ts +1 -1
  10. package/dist/lib/src/posthog-core.d.ts +8 -12
  11. package/dist/lib/src/posthog-featureflags.d.ts +2 -2
  12. package/dist/lib/src/rate-limiter.d.ts +2 -2
  13. package/dist/lib/src/request-queue.d.ts +13 -8
  14. package/dist/lib/src/request.d.ts +4 -0
  15. package/dist/lib/src/retry-queue.d.ts +14 -15
  16. package/dist/lib/src/types.d.ts +30 -45
  17. package/dist/lib/src/utils/globals.d.ts +4 -0
  18. package/dist/lib/src/utils/request-utils.d.ts +0 -2
  19. package/dist/module.d.ts +73 -98
  20. package/dist/module.js +1 -1
  21. package/dist/module.js.map +1 -1
  22. package/dist/recorder-v2.js +2 -2
  23. package/dist/recorder-v2.js.map +1 -1
  24. package/dist/recorder.js +1 -1
  25. package/dist/recorder.js.map +1 -1
  26. package/dist/surveys-module-previews.js +1 -1
  27. package/dist/surveys-module-previews.js.map +1 -1
  28. package/dist/surveys.js +1 -1
  29. package/dist/surveys.js.map +1 -1
  30. package/lib/package.json +1 -1
  31. package/lib/src/decide.d.ts +1 -1
  32. package/lib/src/decide.js +17 -9
  33. package/lib/src/decide.js.map +1 -1
  34. package/lib/src/extensions/exception-autocapture/index.js +0 -1
  35. package/lib/src/extensions/exception-autocapture/index.js.map +1 -1
  36. package/lib/src/extensions/replay/sessionrecording.js +0 -4
  37. package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
  38. package/lib/src/posthog-core.d.ts +8 -12
  39. package/lib/src/posthog-core.js +177 -332
  40. package/lib/src/posthog-core.js.map +1 -1
  41. package/lib/src/posthog-featureflags.d.ts +2 -2
  42. package/lib/src/posthog-featureflags.js +76 -51
  43. package/lib/src/posthog-featureflags.js.map +1 -1
  44. package/lib/src/posthog-surveys.js +14 -6
  45. package/lib/src/posthog-surveys.js.map +1 -1
  46. package/lib/src/rate-limiter.d.ts +2 -2
  47. package/lib/src/rate-limiter.js +1 -1
  48. package/lib/src/rate-limiter.js.map +1 -1
  49. package/lib/src/request-queue.d.ts +13 -8
  50. package/lib/src/request-queue.js +56 -87
  51. package/lib/src/request-queue.js.map +1 -1
  52. package/lib/src/request.d.ts +4 -0
  53. package/lib/src/request.js +213 -0
  54. package/lib/src/request.js.map +1 -0
  55. package/lib/src/retry-queue.d.ts +14 -15
  56. package/lib/src/retry-queue.js +66 -82
  57. package/lib/src/retry-queue.js.map +1 -1
  58. package/lib/src/types.d.ts +30 -45
  59. package/lib/src/types.js.map +1 -1
  60. package/lib/src/utils/event-utils.js +7 -0
  61. package/lib/src/utils/event-utils.js.map +1 -1
  62. package/lib/src/utils/globals.d.ts +4 -0
  63. package/lib/src/utils/globals.js +2 -1
  64. package/lib/src/utils/globals.js.map +1 -1
  65. package/lib/src/utils/request-utils.d.ts +0 -2
  66. package/lib/src/utils/request-utils.js +1 -4
  67. package/lib/src/utils/request-utils.js.map +1 -1
  68. package/package.json +1 -1
  69. package/dist/lib/src/base-request-queue.d.ts +0 -12
  70. package/dist/lib/src/compression.d.ts +0 -3
  71. package/dist/lib/src/send-request.d.ts +0 -6
  72. package/lib/src/base-request-queue.d.ts +0 -12
  73. package/lib/src/base-request-queue.js +0 -33
  74. package/lib/src/base-request-queue.js.map +0 -1
  75. package/lib/src/compression.d.ts +0 -3
  76. package/lib/src/compression.js +0 -35
  77. package/lib/src/compression.js.map +0 -1
  78. package/lib/src/send-request.d.ts +0 -6
  79. package/lib/src/send-request.js +0 -204
  80. package/lib/src/send-request.js.map +0 -1
@@ -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 w(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 w(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)?w(e,t):void 0}}function w(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 k(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 x="__rrweb_original__";var I,E,F=1,R=new RegExp("[^a-z0-9-_:]"),O=-2;function T(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(M).join(""):null}catch(e){return null}}function M(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=T(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,j,H,B,W=/^[^ \t\n\r\u000c]+/,U=/^[, \t\n\r\u000c]+/;function z(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function V(){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]?z(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=z(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=z(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,V()):"object"===t&&"data"===n&&r?z(e,r):r:z(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,w=n.keepIframeSrcFn;if(s.__sn){var k=s.__sn.id;i=1===k?void 0:k}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),F=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return R.test(t)?"div":t}(t),O={},M=0,P=Array.from(t.attributes);M<P.length;M++){var N=P[M],L=N.name,A=N.value;O[L]=G(s,F,L,A)}if("link"===F&&f){var $=Array.from(s.styleSheets).find((function(e){return e.href===t.href})),q=null;$&&(q=T($)),q&&(delete O.rel,delete O.href,O._cssText=D(q,$.href))}if("style"===F&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(q=T(t.sheet))&&(O._cssText=D(q,V()));if("input"===F||"textarea"===F||"select"===F){A=t.value;"radio"!==O.type&&"checkbox"!==O.type&&"submit"!==O.type&&"button"!==O.type&&A?O.value=C({type:O.type,tagName:F,value:A,maskInputOptions:h,maskInputFn:g}):t.checked&&(O.checked=t.checked)}if("option"===F&&(t.selected&&!h.select?O.selected=!0:delete O.selected),"canvas"===F&&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=x in i?i[x]: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 j=t.toDataURL(_.type,_.quality),H=document.createElement("canvas");H.width=t.width,H.height=t.height,j!==H.toDataURL(_.type,_.quality)&&(O.rr_dataURL=j)}if("img"===F&&y){I||(I=s.createElement("canvas"),E=I.getContext("2d"));var B=t,W=B.crossOrigin;B.crossOrigin="anonymous";var U=function(){try{I.width=B.naturalWidth,I.height=B.naturalHeight,E.drawImage(B,0,0),O.rr_dataURL=I.toDataURL(_.type,_.quality)}catch(e){console.warn("Cannot inline img src="+B.currentSrc+"! Error: "+e)}W?O.crossOrigin=W:delete O.crossOrigin};B.complete&&0!==B.naturalWidth?U():B.onload=U}if("audio"!==F&&"video"!==F||(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 z=t.getBoundingClientRect(),Q=z.width,J=z.height;O={class:O.class,rr_width:Q+"px",rr_height:J+"px"}}return"iframe"!==F||w(O.src)||(t.contentDocument||(O.rr_src=O.src),delete O.src),{type:e.Element,tagName:F,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,V())}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,w=n.inlineImages,k=void 0!==w&&w,C=n.recordCanvas,x=void 0!==C&&C,I=n.onSerialize,E=n.onIframeLoad,R=n.iframeLoadTimeout,T=void 0===R?5e3:R,M=n.keepIframeSrcFn,P=void 0===M?function(){return!1}:M,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:k,recordCanvas:x,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)?F++:O;var A=Object.assign(D,{id:r});if(t.__sn=A,r===O)return null;o[r]=t,I&&I(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:k,recordCanvas:x,preserveWhiteSpace:L,onSerialize:I,onIframeLoad:E,iframeLoadTimeout:T,keepIframeSrcFn:P},j=0,H=Array.from(t.childNodes);j<H.length;j++){(U=X(H[j],q))&&A.childNodes.push(U)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var B=0,W=Array.from(t.shadowRoot.childNodes);B<W.length;B++){var U;(U=X(W[B],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&&E){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:k,recordCanvas:x,preserveWhiteSpace:L,onSerialize:I,onIframeLoad:E,iframeLoadTimeout:T,keepIframeSrcFn:P});n&&E(t,n)}}),T),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"}(j||(j={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange"}(H||(H={})),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"}(B||(B={}));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 w={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};(w.texts.length||w.attributes.length||w.removes.length||w.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.mutationCb(w))}},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=[],we="undefined"!=typeof CSSGroupingRule,ke="undefined"!=typeof CSSMediaRule,Se="undefined"!=typeof CSSSupportsRule,Ce="undefined"!=typeof CSSConditionRule;function xe(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 Ie(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 Ee(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=xe(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 Fe(e){var t=e.scrollCb,n=e.doc,r=e.mirror,i=e.blockClass;return K("scroll",te((function(e){var o=xe(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"],Te=new WeakMap;function Me(e){return function(e,t){if(we&&e.parentRule instanceof CSSGroupingRule||ke&&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=Ie(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=xe(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=Ee(e),f=Fe(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=xe(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=Te.get(e);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Te.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=xe(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={};we?l.CSSGroupingRule=a.CSSGroupingRule:(ke&&(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(Me(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(Me(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:Me(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:Me(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),w=b.next();!w.done;w=b.next()){var k=w.value;y.push(k.observer(k.callback,u,k.options))}}catch(e){a={error:e}}finally{try{w&&!w.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){Ie(t(t({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Fe(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 je=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 He(e,t,n){if(e instanceof Array)return e.map((function(e){return He(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:[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]}:We(e,t)||"object"===s(e)?{rr_type:e.constructor.name,index:je(e,t,n)}:e}var Be=function(e,t,n){return i([],r(e),!1).map((function(e){return He(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(je(f,u,e),!ae(this.canvas,a)){s.getId(this.canvas);var p=Be(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,Ve,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:j["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:j["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,j.WebGL,e,n,o,t)),!1)),void 0!==t.WebGL2RenderingContext&&a.push.apply(a,i([],r(Ue(t.WebGL2RenderingContext.prototype,j.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 Ye(e){return t(t({},e),{timestamp:Date.now()})}var Qe={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,w=e.slimDOMOptions,k=e.maskInputFn,S=e.maskTextFn,C=e.hooks,x=e.packFn,I=e.sampling,E=void 0===I?{}:I,F=e.mousemoveWait,R=e.recordCanvas,O=void 0!==R&&R,T=e.userTriggeredOnInput,M=void 0!==T&&T,P=e.collectFonts,N=void 0!==P&&P,L=e.inlineImages,D=void 0!==L&&L,q=e.plugins,j=e.keepIframeSrcFn,H=void 0===j?function(){return!1}:j;if(!i)throw new Error("emit function is required");void 0!==F&&void 0===E.mousemove&&(E.mousemove=F);var B,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===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===w,headMetaDescKeywords:"all"===w}:w||{};!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 z=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 x&&(e=x(e)),e}(e),t),e.type===A.FullSnapshot)B=e,z=0;else if(e.type===A.IncrementalSnapshot){if(e.data.source===$.Mutation&&e.data.isAttachIframe)return;z++;var s=a&&z>=a,u=o&&e.timestamp-B.timestamp>o;(s||u)&&Ve(!0)}};var V=function(e){ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.Mutation},e)}))},G=function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.Scroll},e)}))},Y=function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.CanvasMutation},e)}))},Q=new Ne({mutationCb:V}),J=new Ge({recordCanvas:O,mutationCb:Y,win:window,blockClass:u,mirror:Qe}),Z=new Le({mutationCb:V,scrollCb:G,bypassOptions:{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskInputOptions:W,maskTextFn:S,maskInputFn:k,recordCanvas:O,inlineImages:D,sampling:E,slimDOMOptions:U,iframeManager:Q,canvasManager:J},mirror:Qe});Ve=function(e){var t,n,i,o;void 0===e&&(e=!1),ze(Ye({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,w=n.slimDOM,k=void 0!==w&&w,S=n.dataURLOptions,C=n.preserveWhiteSpace,x=n.onSerialize,I=n.onIframeLoad,E=n.iframeLoadTimeout,F=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===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,dataURLOptions:S,inlineImages:h,recordCanvas:g,preserveWhiteSpace:C,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:E,keepIframeSrcFn:void 0===F?function(){return!1}:F}),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)&&Q.addIframe(e),de(e)&&Z.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){Q.attachIframe(e,t),Z.observeAttachShadow(e)},keepIframeSrcFn:H}),2),s=a[0],l=a[1];if(!s)return console.warn("Failed to snapshot the document");Qe.map=l,ze(Ye({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(Ye({type:A.DomContentLoaded,data:{}}))})));var te=function(e){var n;return Pe({mutationCb:V,mousemoveCb:function(e,t){return ze(Ye({type:A.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.MouseInteraction},e)}))},scrollCb:G,viewportResizeCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.ViewportResize},e)}))},inputCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.Input},e)}))},mediaInteractionCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.StyleDeclaration},e)}))},canvasMutationCb:Y,fontCb:function(e){return ze(Ye({type:A.IncrementalSnapshot,data:t({source:$.Font},e)}))},blockClass:u,ignoreClass:f,maskTextClass:h,maskTextSelector:g,maskInputOptions:W,inlineStylesheet:_,sampling:E,recordCanvas:O,inlineImages:D,userTriggeredOnInput:M,collectFonts:N,doc:e,maskInputFn:k,maskTextFn:S,blockSelector:c,slimDOMOptions:U,mirror:Qe,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(Ye({type:A.Plugin,data:{plugin:e.name,payload:t}}))}}})))||[]},C)};Q.addLoadListener((function(e){ee.push(te(e.contentDocument))}));var ne=function(){Ve(),ee.push(te(document))};return"interactive"===document.readyState||"complete"===document.readyState?ne():ee.push(K("load",(function(){ze(Ye({type:A.Load,data:{}})),ne()}),window)),function(){ee.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}Je.addCustomEvent=function(e,t){if(!ze)throw new Error("please add custom event after start recording");ze(Ye({type:A.Custom,data:{tag:e,payload:t}}))},Je.freezePage=function(){be.forEach((function(e){return e.freeze()}))},Je.takeFullSnapshot=function(e){if(!Ve)throw new Error("please take full snapshot after start recording");Ve(e)},Je.mirror=Qe;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="undefined"!=typeof window?window:void 0,lt="undefined"!=typeof globalThis?globalThis:ut,ct=Array.prototype,dt=ct.forEach,ft=ct.indexOf,pt=null==lt?void 0:lt.navigator,ht=null==lt?void 0:lt.document,vt=null==lt?void 0:lt.location,gt=null==lt?void 0:lt.fetch,mt=null==lt?void 0:lt.XMLHttpRequest,_t=null==pt?void 0:pt.userAgent,yt=null!=ut?ut:{};ut&&(ut.rrweb={record:Je,version:"v1",rrwebVersion:"1.1.3"},ut.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:st,options:e?Object.assign({},at,e):at}}});var bt={DEBUG:!1,LIB_VERSION:"1.111.2"},wt=Array.isArray,kt=Object.prototype,St=kt.hasOwnProperty,Ct=kt.toString,xt=wt||function(e){return"[object Array]"===Ct.call(e)},It=function(e){return"[object Uint8Array]"===Ct.call(e)},Et=function(e){return"function"==typeof e},Ft=function(e){return e===Object(e)&&!xt(e)},Rt=function(e){return void 0===e},Ot=function(e){return"[object String]"==Ct.call(e)},Tt=function(e){return null===e},Mt=function(e){return Rt(e)||Tt(e)},Pt=function(e){return"[object Number]"==Ct.call(e)},Nt=function(e){return"[object Boolean]"===Ct.call(e)},Lt=function(e){return e instanceof FormData},Dt="[PostHog.js]",At={_log:function(e){if(ut&&(bt.DEBUG||yt.POSTHOG_DEBUG)&&!Rt(ut.console)&&ut.console){for(var t=("__rrweb_original__"in ut.console[e]?ut.console[e].__rrweb_original__:ut.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,[Dt].concat(r))}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];At._log.apply(At,["log"].concat(t))},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];At._log.apply(At,["warn"].concat(t))},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];At._log.apply(At,["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,[Dt].concat(n))},uninitializedWarning:function(e){At.error("You must initialize PostHog before calling ".concat(e))}},$t={},qt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function jt(e,t,n){if(xt(e))if(dt&&e.forEach===dt)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===$t)return}function Ht(e,t,n){if(!Mt(e)){if(xt(e))return jt(e,t,n);if(Lt(e)){var r,i=k(e.entries());try{for(i.s();!(r=i.n()).done;){var o=r.value;if(t.call(n,o[1],o[0])===$t)return}}catch(e){i.e(e)}finally{i.f()}}else for(var a in e)if(St.call(e,a)&&t.call(n,e[a],a)===$t)return}}var Bt=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 jt(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function Wt(e,t){return-1!==e.indexOf(t)}function Ut(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 zt=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Vt=function(e){try{return e()}catch(e){return}},Gt=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){At.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),At.critical(e)}}},Yt=function(e){var t={};return Ht(e,(function(e,n){Ot(e)&&e.length>0&&(t[n]=e)})),t};function Qt(e,t){return n=e,r=function(e){return Ot(e)&&!Tt(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),xt(t)?(o=[],jt(t,(function(t){o.push(e(t))}))):(o={},Ht(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}function Jt(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,u=0,l="",c=[];if(!e)return e;e=Xt(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 Xt=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),Tt(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},Kt=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==ut?void 0:ut.event)){var o,a=!0;Et(r)&&(o=r(i));var s=n.call(t,i);return!1!==o&&!1!==s||(a=!1),a}}}(t,r,s)}else At.error("No valid element provided to register_event")}}();function Zt(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 en(e){return e?qt(e).split(/\s+/):[]}function tn(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 en(t)}function nn(e){return Mt(e)?null:qt(e).split(/(\s+)/).filter(hn).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rn(e){var t="";return fn(e)&&!pn(e)&&e.childNodes&&e.childNodes.length&&Ht(e.childNodes,(function(e){var n;sn(e)&&e.textContent&&(t+=null!==(n=nn(e.textContent))&&void 0!==n?n:"")})),qt(t)}function on(e){return!!e&&1===e.nodeType}function an(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function sn(e){return!!e&&3===e.nodeType}function un(e){return!!e&&11===e.nodeType}var ln=["a","button","form","input","select","textarea","label"];function cn(e){var t=e.parentNode;return!(!t||!on(t))&&t}function dn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!ut||!e||an(e,"html")||!on(e))return!1;if(null!=n&&n.url_allowlist){var o=ut.location.href,a=n.url_allowlist;if(a&&!a.some((function(e){return o.match(e)})))return!1}if(null!=n&&n.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((function(e){return t.type===e})))return!1}for(var l=!1,c=[e],d=!0,f=e;f.parentNode&&!an(f,"body");)if(un(f.parentNode))c.push(f.parentNode.host),f=f.parentNode.host;else{if(!(d=cn(f)))break;if(r||ln.indexOf(d.tagName.toLowerCase())>-1)l=!0;else{var p=ut.getComputedStyle(d);p&&"pointer"===p.getPropertyValue("cursor")&&(l=!0)}c.push(d),f=d}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(Rt(n))return!0;var r,i=k(e);try{var o=function(){var e=r.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(i.s();!(r=i.n()).done;){var a=o();if("object"===s(a))return a.v}}catch(e){i.e(e)}finally{i.f()}return!1}(c,n))return!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(Rt(n))return!0;var r,i=k(e);try{var o=function(){var e=r.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(i.s();!(r=i.n()).done;){var a=o();if("object"===s(a))return a.v}}catch(e){i.e(e)}finally{i.f()}return!1}(c,n))return!1;var h=ut.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return l?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(ln.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}function fn(e){for(var t=e;t.parentNode&&!an(t,"body");t=t.parentNode){var n=tn(t);if(Wt(n,"ph-sensitive")||Wt(n,"ph-no-capture"))return!1}if(Wt(tn(e),"ph-include"))return!0;var r=e.type||"";if(Ot(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if(Ot(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 pn(e){return!!(an(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||an(e,"select")||an(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function hn(e){if(Mt(e))return!1;if(Ot(e)){e=qt(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 vn(e){var t=rn(e);return hn(t="".concat(t," ").concat(gn(e)).trim())?t:""}function gn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ht(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=rn(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(gn(e)).trim())}catch(e){At.error(e)}})),t}function mn(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=k(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 Ut(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[_n(n.toString())]=_n(r.toString())})),r+=":",r+=Ut(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:yn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ut(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 _n(e){return e.replace(/"|\\"/g,'\\"')}function yn(e){var t=e.attr__class;return t?xt(t)?t:en(t):void 0}var bn=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}(),wn="$people_distinct_id",kn="__alias",Sn="__timers",Cn="$autocapture_disabled_server_side",xn="$session_recording_enabled_server_side",In="$console_log_recording_enabled_server_side",En="$session_recording_recorder_version_server_side",Fn="$session_recording_network_payload_capture",Rn="$session_recording_canvas_recording",On="$sesid",Tn="$session_is_sampled",Mn="$enabled_feature_flags",Pn="$early_access_features",Nn="$stored_person_properties",Ln="$stored_group_properties",Dn="$surveys",An="$flag_call_reported",$n="$user_state",qn="$posthog_quota_limited",jn="$client_session_props",Hn=[wn,kn,"__cmpns",Sn,xn,On,Mn,$n,qn,Pn,Ln,Nn,Dn,An,jn],Bn="$copy_autocapture";function Wn(e,t){return t.length>e?t.slice(0,e)+"...":t}var Un={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t,n=Tt(this._isDisabledServerSide)?!(null===(t=e.persistence)||void 0===t||!t.props[Cn]):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&&!on(t));return t},_getAugmentPropertiesFromElement:function(e){if(!fn(e))return{};var t={};return Ht(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&&hn(r)&&(t[n]=r)}})),t},_getPropertiesFromElement:function(e,t,n){var r,i=e.tagName.toLowerCase(),o={tag_name:i};ln.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=Wn(1024,vn(e)):o.$el_text=Wn(1024,rn(e)));var a=tn(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;Ht(e.attributes,(function(n){var r;if((!pn(e)||-1!==["name","id","class"].indexOf(n.name))&&((null==s||!s.includes(n.name))&&!t&&hn(n.value)&&(r=n.name,!Ot(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var i=n.value;"class"===n.name&&(i=en(i).join(" ")),o["attr__"+n.name]=Wn(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 Ht(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),hn(n)&&t.push(n)})),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return Ht(this._customProperties,(function(r){Ht(r.event_selectors,(function(i){Ht(null==ht?void 0:ht.querySelectorAll(i),(function(i){Wt(e,i)&&fn(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return Rt(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=arguments.length>3?arguments[3]:void 0,a=this._getEventTarget(e);(sn(a)&&(a=a.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"));var s=i===Bn;if(a&&dn(a,e,this.config,s,s?["copy","cut"]:void 0)){for(var u,l,c=[a],d=a;d.parentNode&&!an(d,"body");)un(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var f,p=[],h={},v=!1;if(Ht(c,(function(e){var n=fn(e);"a"===e.tagName.toLowerCase()&&(f=e.getAttribute("href"),f=n&&hn(f)&&f),Wt(tn(e),"ph-no-capture")&&(v=!0),p.push(r._getPropertiesFromElement(e,t.config.mask_all_element_attributes,t.config.mask_all_text));var i=r._getAugmentPropertiesFromElement(e);Bt(h,i)})),t.config.mask_all_text||("a"===a.tagName.toLowerCase()||"button"===a.tagName.toLowerCase()?p[0].$el_text=vn(a):p[0].$el_text=rn(a)),f&&(p[0].attr__href=f),v)return!1;var g=Bt(this._getDefaultProperties(e.type),t.elementsChainAsString?{$elements_chain:mn(p)}:{$elements:p},null!==(u=p[0])&&void 0!==u&&u.$el_text?{$el_text:null===(l=p[0])||void 0===l?void 0:l.$el_text}:{},this._getCustomProperties(c),h,o||{});if(i===Bn){var m,_=nn(null==ut||null===(m=ut.getSelection())||void 0===m?void 0:m.toString()),y=e.type||"clipboard";if(!_)return!1;g.$selected_content=_,g.$copy_type=y}return t.capture(i,g),!0}},_navigate:function(e){ut&&(ut.location.href=e)},_addDomEventHandlers:function(e){var t=this;if(ut&&ht){var n=function(n){n=n||(null==ut?void 0:ut.event),t._captureEvent(n,e)},r=function(n){n=n||(null==ut?void 0:ut.event),t._captureEvent(n,e,Bn)};Kt(ht,"submit",n,!1,!0),Kt(ht,"change",n,!1,!0),Kt(ht,"click",n,!1,!0),Ft(e.config.autocapture)&&e.config.autocapture.capture_copied_text&&(Kt(ht,"copy",r,!1,!0),Kt(ht,"cut",r,!1,!0))}},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;Nt(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 bn(e.config.rageclick)},afterDecideResponse:function(e,t){var n=t.config.token;this._initializedTokens.indexOf(n)>-1?At.info('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(d({},Cn,!!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=Rt(t)?10:t,n=Rt(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return Et(null==ht?void 0:ht.querySelectorAll)}};!function(e){for(var t in e)Et(e[t])&&(e[t]=e[t].bind(e))}(Un),function(e){for(var t in e)Et(e[t])&&(e[t]=Gt(e[t]))}(Un);var zn="$active_feature_flags",Vn="$override_feature_flags",Gn="$feature_flag_payloads",Yn=function(e){var t,n={},r=k(Ut(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(Mn),t=this.instance.get_property(Vn);if(!t)return e||{};for(var n=Bt({},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||(At.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(Gn)||{}}},{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(Nn),r=this.instance.get_property(Ln),i=Jt(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.requestRouter.endpointFor("api","/decide/?v=3"),{data:i},{method:"POST"},(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(An)||{};if(t.send_event||!("send_event"in t))if(!(e in o)||!o[e].includes(i))xt(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register(d({},An,o)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r});return r}At.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);At.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(xt(i)){var s,u={};if(i)for(var l=0;l<i.length;l++)u[i[l]]=!0;t&&t.register((d(s={},zn,i),d(s,Mn,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={},zn,Object.keys(Yn(f))),d(c,Mn,f||{}),d(c,Gn,p||{}),c))}}(e,this.instance.persistence,t,n),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return At.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,!1===e)this.instance.persistence.unregister(Vn);else if(xt(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(d({},Vn,t))}else this.instance.persistence.register(d({},Vn,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={},zn,Object.keys(Yn(o))),d(r,Mn,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(Pn);if(r&&!n)return e(r);this.instance._send_request(this.instance.requestRouter.endpointFor("api","/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({},Pn,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(Nn)||{};this.instance.register(d({},Nn,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Nn)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(Ln)||{};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({},Ln,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(Ln)||{};this.instance.register(d({},Ln,a(a({},t),{},d({},e,{}))))}else this.instance.unregister(Ln)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Pt(e)&&isFinite(e)&&Math.floor(e)===e});var Jn="0123456789abcdef",Xn=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+Jn.charAt(this.bytes[t]>>>4)+Jn.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}(),Kn=function(){function e(){u(this,e),d(this,"timestamp",0),d(this,"counter",0),d(this,"random",new tr)}return c(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Rt(e)){this.timestamp=0;var t=this.generateOrAbort();if(Rt(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 Xn.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}(),Zn=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};ut&&!Rt(ut.crypto)&&crypto.getRandomValues&&(Zn=function(e){return crypto.getRandomValues(e)});var er,tr=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&&(Zn(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),nr=function(){return rr().toString()},rr=function(){return(er||(er=new Kn)).generate()},ir="Thu, 01 Jan 1970 00:00:00 GMT",or="";var ar=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function sr(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ht;if(or)return or;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_"+nr(),o=new RegExp("(^|;)\\s*"+i+"=1");!or&&r--;){var a=n.slice(r).join("."),s=i+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+ir,or=a)}return or}(e);if(!n){var r=function(e){var t=e.match(ar);return t?t[0]:""}(e);r!==n&&At.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var ur,lr={is_supported:function(){return!!ht},error:function(e){At.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(lr.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){if(ht)try{var o="",a="",s=sr(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&&At.warn("cookieStore warning: large cookie, len="+l.length),ht.cookie=l,l}catch(e){return}},remove:function(e,t){try{lr.set(e,"",-1,t)}catch(e){return}}},cr=null,dr={is_supported:function(){if(!Tt(cr))return cr;var e=!0;if(Rt(ut))e=!1;else try{var t="__mplssupport__";dr.set(t,"xyz"),'"xyz"'!==dr.get(t)&&(e=!1),dr.remove(t)}catch(t){e=!1}return e||At.error("localStorage unsupported; falling back to cookie store"),cr=e,e},error:function(e){At.error("localStorage error: "+e)},get:function(e){try{return null==ut?void 0:ut.localStorage.getItem(e)}catch(e){dr.error(e)}return null},parse:function(e){try{return JSON.parse(dr.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==ut||ut.localStorage.setItem(e,JSON.stringify(t))}catch(e){dr.error(e)}},remove:function(e){try{null==ut||ut.localStorage.removeItem(e)}catch(e){dr.error(e)}}},fr=["distinct_id",On,Tn],pr=a(a({},dr),{},{parse:function(e){try{var t={};try{t=lr.parse(e)||{}}catch(e){}var n=Bt(t,JSON.parse(dr.get(e)||"{}"));return dr.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{dr.set(e,t);var o={};fr.forEach((function(e){t[e]&&(o[e]=t[e])})),Object.keys(o).length&&lr.set(e,o,n,r,i)}catch(e){dr.error(e)}},remove:function(e,t){try{null==ut||ut.localStorage.removeItem(e),lr.remove(e,t)}catch(e){dr.error(e)}}}),hr={},vr={is_supported:function(){return!0},error:function(e){At.error("memoryStorage error: "+e)},get:function(e){return hr[e]||null},parse:function(e){return hr[e]||null},set:function(e,t){hr[e]=t},remove:function(e){delete hr[e]}},gr=null,mr={is_supported:function(){if(!Tt(gr))return gr;if(gr=!0,Rt(ut))gr=!1;else try{var e="__support__";mr.set(e,"xyz"),'"xyz"'!==mr.get(e)&&(gr=!1),mr.remove(e)}catch(e){gr=!1}return gr},error:function(e){At.error("sessionStorage error: ",e)},get:function(e){try{return null==ut?void 0:ut.sessionStorage.getItem(e)}catch(e){mr.error(e)}return null},parse:function(e){try{return JSON.parse(mr.get(e))||null}catch(e){}return null},set:function(e,t){try{null==ut||ut.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){mr.error(e)}},remove:function(e){try{null==ut||ut.sessionStorage.removeItem(e)}catch(e){mr.error(e)}}},_r=["localhost","127.0.0.1"],yr=!(!mt||!("withCredentials"in new mt))||!!gt,br=function(e){var t=null==ht?void 0:ht.createElement("a");return Rt(t)?null:(t.href=e,t)},wr=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},kr=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return Ht(e,(function(e,r){Rt(e)||Rt(r)||"undefined"===r||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)})),i.join(r)},Sr=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(!xt(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){At.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Cr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},xr="Mobile",Ir="iOS",Er="Android",Fr="Tablet",Rr=Er+" "+Fr,Or="iPad",Tr="Apple",Mr=Tr+" Watch",Pr="Safari",Nr="BlackBerry",Lr="Samsung",Dr=Lr+"Browser",Ar=Lr+" Internet",$r="Chrome",qr=$r+" OS",jr=$r+" "+Ir,Hr="Internet Explorer",Br=Hr+" "+xr,Wr="Opera",Ur=Wr+" Mini",zr="Edge",Vr="Microsoft "+zr,Gr="Firefox",Yr=Gr+" "+Ir,Qr="Nintendo",Jr="PlayStation",Xr="Xbox",Kr=Er+" "+xr,Zr=xr+" "+Pr,ei="Windows",ti=ei+" Phone",ni="Nokia",ri="Ouya",ii="Generic",oi=ii+" "+xr.toLowerCase(),ai=ii+" "+Fr.toLowerCase(),si="Konqueror",ui="(\\d+(\\.\\d+)?)",li=new RegExp("Version/"+ui),ci=new RegExp(Xr,"i"),di=new RegExp(Jr+" \\w+","i"),fi=new RegExp(Qr+" \\w+","i"),pi=new RegExp(Nr+"|PlayBook|BB10","i"),hi={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var vi=function(e,t){return t&&Wt(t,Tr)||function(e){return Wt(e,Pr)&&!Wt(e,$r)&&!Wt(e,Er)}(e)},gi=function(e,t,n){return n?Wr:(t=t||"",Wt(e," OPR/")&&Wt(e,"Mini")?Ur:Wt(e," OPR/")?Wr:pi.test(e)?Nr:Wt(e,"IE"+xr)||Wt(e,"WPDesktop")?Br:Wt(e,Dr)?Ar:Wt(e,zr)||Wt(e,"Edg/")?Vr:Wt(e,"FBIOS")?"Facebook "+xr:Wt(e,$r)?$r:Wt(e,"CriOS")?jr:Wt(e,"UCWEB")||Wt(e,"UCBrowser")?"UC Browser":Wt(e,"FxiOS")?Yr:Wt(e,Er)?Kr:Wt(e.toLowerCase(),si.toLowerCase())?si:vi(e,t)?Wt(e,xr)?Zr:Pr:Wt(e,Gr)?Gr:Wt(e,"MSIE")||Wt(e,"Trident/")?Hr:Wt(e,"Gecko")?Gr:"")},mi=(d(ur={},Br,[new RegExp("rv:"+ui)]),d(ur,Vr,[new RegExp(zr+"?\\/"+ui)]),d(ur,$r,[new RegExp($r+"/"+ui)]),d(ur,jr,[new RegExp("CriOS\\/"+ui)]),d(ur,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+ui)]),d(ur,Pr,[li]),d(ur,Zr,[li]),d(ur,Wr,[new RegExp("(Opera|OPR)\\/"+ui)]),d(ur,Gr,[new RegExp(Gr+"\\/"+ui)]),d(ur,Yr,[new RegExp("FxiOS\\/"+ui)]),d(ur,si,[new RegExp("Konqueror[:/]?"+ui,"i")]),d(ur,Nr,[new RegExp(Nr+" "+ui),li]),d(ur,Kr,[new RegExp("android\\s"+ui)]),d(ur,Ar,[new RegExp(Dr+"\\/"+ui)]),d(ur,Hr,[new RegExp("(rv:|MSIE )"+ui)]),d(ur,"Mozilla",[new RegExp("rv:"+ui)]),ur),_i=[[new RegExp(Xr+"; "+Xr+" (.*?)[);]","i"),function(e){return[Xr,e&&e[1]||""]}],[new RegExp(Qr,"i"),[Qr,""]],[new RegExp(Jr,"i"),[Jr,""]],[pi,[Nr,""]],[new RegExp(ei,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[ti,""];if(new RegExp(xr).test(t)&&!/IEMobile\b/.test(t))return[ei+" "+xr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=hi[r]||"";return/arm/i.test(t)&&(i="RT"),[ei,i]}return[ei,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Ir,t.join(".")]}return[Ir,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=Rt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Er+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Er+")","i"),function(e){if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Er,t.join(".")]}return[Er,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[qr,""]],[/Linux|debian/i,["Linux",""]]],yi=function(e){return fi.test(e)?Qr:di.test(e)?Jr:ci.test(e)?Xr:new RegExp(ri,"i").test(e)?ri:new RegExp("("+ti+"|WPDesktop)","i").test(e)?ti:/iPad/.test(e)?Or:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Mr:pi.test(e)?Nr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ni,"i").test(e)?ni:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(xr).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Er:Rr:Er:new RegExp("(pda|"+xr+")","i").test(e)?oi:new RegExp(Fr,"i").test(e)&&!new RegExp(Fr+" pc","i").test(e)?ai:""},bi="https?://(.*)",wi={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 Ht(t,(function(e){var t=ht?Sr(ht.URL,e):"";t.length&&(n[e]=t)})),n},searchEngine:function(){var e=null==ht?void 0:ht.referrer;return e?0===e.search(bi+"google.([^/?]*)")?"google":0===e.search(bi+"bing.com")?"bing":0===e.search(bi+"yahoo.com")?"yahoo":0===e.search(bi+"duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=wi.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(!Tt(e)){n.$search_engine=e;var r=ht?Sr(ht.referrer,t):"";r.length&&(n.ph_keyword=r)}return n},browser:gi,browserVersion:function(e,t,n){var r=gi(e,t,n),i=mi[r];if(Rt(i))return null;for(var o=0;o<i.length;o++){var a=i[o],s=e.match(a);if(s)return parseFloat(s[s.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(var t=0;t<_i.length;t++){var n=_(_i[t],2),r=n[0],i=n[1],o=r.exec(e),a=o&&(Et(i)?i(o,e):i);if(a)return a}return["",""]},device:yi,deviceType:function(e){var t=yi(e);return t===Or||t===Rr||"Kobo"===t||"Kindle Fire"===t||t===ai?Fr:t===Qr||t===Xr||t===Jr||t===ri?"Console":t===Mr?"Wearable":t?xr:"Desktop"},referrer:function(){return(null==ht?void 0:ht.referrer)||"$direct"},referringDomain:function(){var e;return null!=ht&&ht.referrer&&(null===(e=br(ht.referrer))||void 0===e?void 0:e.host)||"$direct"},properties:function(){if(!_t)return{};var e=_(wi.os(_t),2),t=e[0],n=e[1];return Bt(Yt({$os:t,$os_version:n,$browser:wi.browser(_t,navigator.vendor,yt.opera),$device:wi.device(_t),$device_type:wi.deviceType(_t)}),{$current_url:null==vt?void 0:vt.href,$host:null==vt?void 0:vt.host,$pathname:null==vt?void 0:vt.pathname,$raw_user_agent:_t.length>1e3?_t.substring(0,997)+"...":_t,$browser_version:wi.browserVersion(_t,navigator.vendor,yt.opera),$browser_language:wi.browserLanguage(),$screen_height:null==ut?void 0:ut.screen.height,$screen_width:null==ut?void 0:ut.screen.width,$viewport_height:null==ut?void 0:ut.innerHeight,$viewport_width:null==ut?void 0:ut.innerWidth,$lib:"web",$lib_version:bt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:zt()/1e3})},people_properties:function(){if(!_t)return{};var e=_(wi.os(_t),2),t=e[0],n=e[1];return Bt(Yt({$os:t,$os_version:n,$browser:wi.browser(_t,navigator.vendor,yt.opera)}),{$browser_version:wi.browserVersion(_t,navigator.vendor,yt.opera)})}},ki=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Si=function(){function e(t){u(this,e),this.config=t,this.props={},this.campaign_params_saved=!1,this.name=function(e){var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"}(t),this.storage=this.buildStorage(t),this.load(),this.update_config(t,t),this.save()}return c(e,[{key:"buildStorage",value:function(e){-1===ki.indexOf(e.persistence.toLowerCase())&&(At.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&dr.is_supported()?dr:"localstorage+cookie"===t&&pr.is_supported()?pr:"sessionstorage"===t&&mr.is_supported()?mr:"memory"===t?vr:"cookie"===t?lr:pr.is_supported()?pr:lr}},{key:"properties",value:function(){var e={};return Ht(this.props,(function(t,n){if(n===Mn&&Ft(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,(Tt(o=Hn)?s:ft&&o.indexOf===ft?-1!=o.indexOf(a):(Ht(o,(function(e){if(s||(s=e===a))return $t})),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=Bt({},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(Ft(e)){Rt(t)&&(t="None"),this.expire_days=Rt(n)?this.default_expiry:n;var i=!1;if(Ht(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(Ft(e)){this.expire_days=Rt(t)?this.default_expiry:t;var r=!1;if(Ht(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(wi.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(wi.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||wi.referrer(),$referring_domain:this.props.$referring_domain||wi.referringDomain()})}},{key:"get_referrer_info",value:function(){return Yt({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return Ht(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e,t){if(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),e.persistence!==t.persistence){var n=this.buildStorage(e),r=this.props;this.clear(),this.storage=n,this.props=r,this.save()}}},{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[Sn]||{};n[e]=t,this.props[Sn]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[Sn]||{})[e];return Rt(t)||(delete this.props[Sn][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[$n]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[$n]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[qn]||{}}},{key:"set_quota_limits",value:function(e){this.props[qn]=e,this.save()}}]),e}(),Ci=2,xi=4;var Ii=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)})),Ei=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}(Ei||{}),Fi={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},Ri=["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"],Oi=["/s/","/e/","/i/"];function Ti(e,t,n,r){if(Mt(e))return e;var i=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ot(i)&&(i=parseInt(i)),i>n?"[SessionReplay] ".concat(r," body too large to record (").concat(i," bytes)"):e}var Mi=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=Ti(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=Ti(e.responseBody,e.responseHeaders,i,"Response")),e}),d=function(e){return c(function(e){var t=br(e.name);if(!(t&&t.pathname&&Oi.some((function(e){return 0===t.pathname.indexOf(e)}))))return e}((t=e,Object.keys(null!==(n=t.requestHeaders)&&void 0!==n?n:{}).forEach((function(e){var n;Ri.includes(e.toLowerCase())&&(null===(n=t.requestHeaders)||void 0===n||delete n[e])})),t)));var t,n},f=Et(e.session_recording.maskNetworkRequestFn);return f&&Et(e.session_recording.maskCapturedNetworkRequestFn)&&At.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=Et(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({},Fi),o),{},{recordHeaders:s,recordBody:u,recordPerformance:l,recordInitialRequests:l})},Pi="__ph_opt_in_out_";function Ni(e,t){Bi(!0,e,t)}function Li(e,t){Bi(!1,e,t)}function Di(e,t){return"1"===Hi(e,t)}function Ai(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||ut,n=null==t?void 0:t.navigator,r=!1;return Ht([null==n?void 0:n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Wt([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===Hi(e,t)}function $i(e,t){qi(t=t||{}).remove(ji(e,t),!!t.crossSubdomainCookie)}function qi(e){return"localStorage"===(e=e||{}).persistenceType?dr:"localStorage+cookie"===e.persistenceType?pr:lr}function ji(e,t){return((t=t||{}).persistencePrefix||Pi)+e}function Hi(e,t){return qi(t).get(ji(e,t))}function Bi(e,t,n){Ot(t)&&t.length?(qi(n=n||{}).set(ji(t,n),e?1:0,Pt(n.cookieExpiration)?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):At.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function Wi(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=Ai(n,{respectDnt:r,persistenceType:i,persistencePrefix:o,window:a}))}catch(e){At.error("Unexpected error when checking capturing opt-out status: "+e)}return t}var Ui,zi=3e5,Vi=zi;!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"}(Ui||(Ui={}));var Gi=[Ui.MouseMove,Ui.MouseInteraction,Ui.Scroll,Ui.ViewportResize,Ui.Input,Ui.TouchMove,Ui.MediaInteraction,Ui.Drag],Yi=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}},Qi="[SessionRecording]",Ji=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,"_forceAllowLocalhostNetworkCapture",!1),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,null==ut||ut.addEventListener("beforeunload",(function(){n._flushBuffer()})),null==ut||ut.addEventListener("offline",(function(){n._tryAddCustomEvent("browser offline",{})})),null==ut||ut.addEventListener("online",(function(){n._tryAddCustomEvent("browser online",{})})),!this.instance.sessionManager)throw At.error(Qi+" started without valid sessionManager"),new Error(Qi+" 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 At.error(Qi+" started without valid sessionManager"),new Error(Qi+" started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return Pt(this._sampleRate)?this.instance.get_property(Tn):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(xn),t=!this.instance.config.disable_session_recording;return ut&&e&&t}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(In),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}},{key:"canvasRecording",get:function(){var e=this.instance.get_property(Rn);return e&&e.fps&&e.quality?{enabled:e.enabled,fps:e.fps,quality:e.quality}:void 0}},{key:"recordingVersion",get:function(){var e,t=this.instance.get_property(En);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(Fn),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?Mt(this._linkedFlag)||this._linkedFlagSeen?Nt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this._startCapture(),At.info(Qi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,At.info(Qi+" stopped"))}},{key:"makeSamplingDecision",value:function(e){var t,n=this.sessionId!==e;if(Pt(this._sampleRate)){var r,i=this.isSampled;if(n||!Nt(i))r=Math.random()<this._sampleRate;else r=i;r||At.warn(Qi+" 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({},Tn,r))}else{var o;null===(o=this.instance.persistence)||void 0===o||o.register(d({},Tn,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={},xn,!!e.sessionRecording),d(p,In,null===(o=e.sessionRecording)||void 0===o?void 0:o.consoleLogRecordingEnabled),d(p,En,null===(s=e.sessionRecording)||void 0===s?void 0:s.recorderVersion),d(p,Fn,a({capturePerformance:e.capturePerformance},null===(u=e.sessionRecording)||void 0===u?void 0:u.networkPayloadCapture)),d(p,Rn,{enabled:null===(l=e.sessionRecording)||void 0===l?void 0:l.recordCanvas,fps:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasFps,quality:null===(f=e.sessionRecording)||void 0===f?void 0:f.canvasQuality}),p));var v=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate;this._sampleRate=Mt(v)?null:parseFloat(v);var g,m=null===(n=e.sessionRecording)||void 0===n?void 0:n.minimumDurationMilliseconds;(this._minimumDuration=Rt(m)?null:m,this._linkedFlag=(null===(r=e.sessionRecording)||void 0===r?void 0:r.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(g=e.sessionRecording)||void 0===g?void 0:g.endpoint);if(Pt(this._sampleRate)&&this.sessionManager.onSessionId((function(e){h.makeSamplingDecision(e)})),!Mt(this._linkedFlag)){var _,y,b=Ot(this._linkedFlag)?this._linkedFlag:null===(_=this._linkedFlag)||void 0===_?void 0:_.flag,w=Ot(this._linkedFlag)?null:null===(y=this._linkedFlag)||void 0===y?void 0:y.variant;this.instance.onFeatureFlags((function(e,t){var n=Ft(t)&&b in t,r=w?t[b]===w:n;r&&At.info(Qi+" linked flag matched",{linkedFlag:b,linkedVariant:w}),h._linkedFlagSeen=r}))}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:zt()})}},{key:"_startCapture",value:function(){var e=this;if(!Rt(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||Wi(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?Zt(this.instance.requestRouter.endpointFor("assets","/static/".concat(t,"?v=").concat(bt.LIB_VERSION)),(function(n){if(n)return At.error(Qi+" could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==Gi.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>Vi&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Vi}));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===[Ci,xi].indexOf(e.type)&&(s||a))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(t){return At.warn(Qi+" 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(Yi((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(Yi((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=ut.rrweb?ut.rrweb.record:ut.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.canvasRecording&&this.canvasRecording.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this.canvasRecording.fps},n.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new Ii(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");At.info(r,{node:n}),t.log(Qi+" "+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=ut?t._maskUrl(ut.location.href):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n}),t._tryTakeFullSnapshot()}}catch(e){At.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}))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else At.error(Qi+"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()}),zi)}},{key:"_gatherRRWebPlugins",value:function(){var e=[];(yt.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(yt.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&Et(yt.getRecordNetworkPlugin))&&(!_r.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(yt.getRecordNetworkPlugin(Mi(this.instance.config,this.networkPayloadCapture))):At.info(Qi+" NetworkCapture not started because we are on localhost."));return e}},{key:"onRRwebEmit",value:function(e){if(this._processQueuedEvents(),e&&Ft(e)){if(e.type===Ei.Meta){var t=this._maskUrl(e.data.href);if(!t)return;e.data.href=t}e.type===Ei.FullSnapshot&&this._scheduleFullSnapshot();var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var r=function(e){var t=e;if(t&&Ft(t)&&6===t.type&&Ft(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||r.type===Ei.Custom){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=Pt(n)&&n>=0,i=Pt(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()),Tt(this.buffer.sessionId)&&!Tt(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,{method:"POST",_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===Ci}})}}]),e}(),Xi=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=Jt(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Nn),group_properties:this.instance.get_property(Ln),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(this.instance.requestRouter.endpointFor("api","/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 At.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),Un.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==ut?void 0:ut.extendPostHogWithSurveys;e.surveys&&!r&&Zt(this.instance.requestRouter.endpointFor("assets","/static/surveys.js"),(function(e){if(e)return At.error("Could not load surveys script",e);ut.extendPostHogWithSurveys(n.instance)}));var i=null==ut?void 0:ut.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&Rt(i)&&Zt(this.instance.requestRouter.endpointFor("assets","/static/exception-autocapture.js"),(function(t){if(t)return At.error("Could not load exception autocapture script",t);ut.extendPostHogWithExceptionAutocapture(n.instance,e)})),e.siteApps)if(this.instance.config.opt_in_site_apps){var o,a=k(e.siteApps);try{var s=function(){var e=o.value,t=e.id,r=e.url,i=n.instance.requestRouter.endpointFor("api",r);yt["__$$ph_site_app_".concat(t)]=n.instance,Zt(i,(function(e){e&&At.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(a.s();!(o=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}}else e.siteApps.length>0&&At.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else At.error("Failed to fetch feature flags from PostHog.")}}]),e}(),Ki=["source"],Zi=null!=ut&&ut.location?Cr(ut.location.hash,"__posthog")||Cr(location.hash,"state"):null,eo=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(!ut||!ht)return!1;n=null!==(e=n)&&void 0!==e?e:ut.location,i=null!==(t=i)&&void 0!==t?t:ut.history;try{if(!r){try{ut.localStorage.setItem("test","test"),ut.localStorage.removeItem("test")}catch(e){return!1}r=null==ut?void 0:ut.localStorage}var o,a=Zi||Cr(n.hash,"__posthog")||Cr(n.hash,"state"),s=a?Vt((function(){return JSON.parse(atob(decodeURIComponent(a)))}))||Vt((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(!ut||yt._postHogToolbarLoaded)return!1;yt._postHogToolbarLoaded=!0;var n=3e5,r=Math.floor(Date.now()/n)*n,i=this.instance.requestRouter.endpointFor("assets","/static/toolbar.js?t=".concat(r)),o="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=a(a({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},o?{instrument:!1}:{});s.source;var u=v(s,Ki);return ut.localStorage.setItem("_postHogToolbarParams",JSON.stringify(u)),Zt(i,(function(e){e?At.error("Failed to load toolbar",e):(yt.ph_load_toolbar||yt.ph_load_editor)(s,t.instance)})),Kt(ut,"turbolinks:load",(function(){yt._postHogToolbarLoaded=!1,t.loadToolbar(s)})),!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}(),to=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}(),no=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;Ht(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 Ht(this._event_queue,(function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;Rt(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}(to),ro=Uint8Array,io=Uint16Array,oo=Uint32Array,ao=new ro([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]),so=new ro([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]),uo=new ro([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lo=function(e,t){for(var n=new io(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new oo(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]},co=lo(ao,2),fo=co[0],po=co[1];fo[28]=258,po[258]=28;for(var ho=lo(so,0)[1],vo=new io(32768),go=0;go<32768;++go){var mo=(43690&go)>>>1|(21845&go)<<1;mo=(61680&(mo=(52428&mo)>>>2|(13107&mo)<<2))>>>4|(3855&mo)<<4,vo[go]=((65280&mo)>>>8|(255&mo)<<8)>>>1}var _o=function(e,t,n){for(var r=e.length,i=0,o=new io(t);i<r;++i)++o[e[i]-1];var a,s=new io(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new io(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[vo[d]>>>u]=l}else for(a=new io(r),i=0;i<r;++i)a[i]=vo[s[e[i]-1]++]>>>15-e[i];return a},yo=new ro(288);for(go=0;go<144;++go)yo[go]=8;for(go=144;go<256;++go)yo[go]=9;for(go=256;go<280;++go)yo[go]=7;for(go=280;go<288;++go)yo[go]=8;var bo=new ro(32);for(go=0;go<32;++go)bo[go]=5;var wo,ko=_o(yo,9,0),So=_o(bo,5,0),Co=function(e){return(e/8>>0)+(7&e&&1)},xo=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof io?io:e instanceof oo?oo:ro)(n-t);return r.set(e.subarray(t,n)),r},Io=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Eo=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},Fo=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 ro(0),0];if(1==i){var a=new ro(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 io(f+1),h=Ro(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 ro(p),h]},Ro=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},Oo=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new io(++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]},To=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Mo=function(e,t,n){var r=n.length,i=Co(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)},Po=function(e,t,n,r,i,o,a,s,u,l,c){Io(t,c++,n),++i[256];for(var d=Fo(i,15),f=d[0],p=d[1],h=Fo(o,15),v=h[0],g=h[1],m=Oo(f),_=m[0],y=m[1],b=Oo(v),w=b[0],k=b[1],S=new io(19),C=0;C<_.length;++C)S[31&_[C]]++;for(C=0;C<w.length;++C)S[31&w[C]]++;for(var x=Fo(S,7),I=x[0],E=x[1],F=19;F>4&&!I[uo[F-1]];--F);var R,O,T,M,P=l+5<<3,N=To(i,yo)+To(o,bo)+a,L=To(i,f)+To(o,v)+a+14+3*F+To(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(P<=N&&P<=L)return Mo(t,c,e.subarray(u,u+l));if(Io(t,c,1+(L<N)),c+=2,L<N){R=_o(f,p,0),O=f,T=_o(v,g,0),M=v;var D=_o(I,E,0);Io(t,c,y-257),Io(t,c+5,k-1),Io(t,c+10,F-4),c+=14;for(C=0;C<F;++C)Io(t,c+3*C,I[uo[C]]);c+=3*F;for(var A=[_,w],$=0;$<2;++$){var q=A[$];for(C=0;C<q.length;++C){var j=31&q[C];Io(t,c,D[j]),c+=I[j],j>15&&(Io(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}}else R=ko,O=yo,T=So,M=bo;for(C=0;C<s;++C)if(r[C]>255){j=r[C]>>>18&31;Eo(t,c,R[j+257]),c+=O[j+257],j>7&&(Io(t,c,r[C]>>>23&31),c+=ao[j]);var H=31&r[C];Eo(t,c,T[H]),c+=M[H],H>3&&(Eo(t,c,r[C]>>>5&8191),c+=so[H])}else Eo(t,c,R[r[C]]),c+=O[r[C]];return Eo(t,c,R[256]),c+O[256]},No=new oo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lo=new ro(0),Do=function(){for(var e=new oo(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Ao=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Do[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},$o=function(e,t,n,r,i){return function(e,t,n,r,i,o){var a=e.length,s=new ro(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=Mo(u,l,e.subarray(c,d)):(u[c]=o,l=Mo(u,l,e.subarray(c,a)))}else{for(var f=No[t-1],p=f>>>13,h=8191&f,v=(1<<n)-1,g=new io(32768),m=new io(v+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&v},w=new oo(25e3),k=new io(288),S=new io(32),C=0,x=0,I=(c=0,0),E=0,F=0;c<a;++c){var R=b(c),O=32767&c,T=m[R];if(g[O]=T,m[R]=O,E<=c){var M=a-c;if((C>7e3||I>24576)&&M>423){l=Po(e,u,0,w,k,S,x,I,F,c-F,l),I=C=x=0,F=c;for(var P=0;P<286;++P)k[P]=0;for(P=0;P<30;++P)S[P]=0}var N=2,L=0,D=h,A=O-T&32767;if(M>2&&R==b(c-A))for(var $=Math.min(p,M)-1,q=Math.min(32767,c),j=Math.min(258,M);A<=q&&--D&&O!=T;){if(e[c+N]==e[c+N-A]){for(var H=0;H<j&&e[c+H]==e[c+H-A];++H);if(H>N){if(N=H,L=A,H>$)break;var B=Math.min(A,H-2),W=0;for(P=0;P<B;++P){var U=c-A+P+32768&32767,z=U-g[U]+32768&32767;z>W&&(W=z,T=U)}}}A+=(O=T)-(T=g[O])+32768&32767}if(L){w[I++]=268435456|po[N]<<18|ho[L];var V=31&po[N],G=31&ho[L];x+=ao[V]+so[G],++k[257+V],++S[G],E=c+N,++C}else w[I++]=e[c],++k[e[c]]}}l=Po(e,u,o,w,k,S,x,I,F,c-F,l),o||(l=Mo(u,l,Lo))}return xo(s,0,r+Co(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)},qo=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},jo=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&&qo(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)}},Ho=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Bo(e,t){void 0===t&&(t={});var n=Ao(),r=e.length;n.p(e);var i=$o(e,t,Ho(t),8),o=i.length;return jo(i,t),qo(i,o-8,n.d()),qo(i,o-4,r),i}function Wo(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new ro(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 ro(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 xo(r,0,i)}!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(wo||(wo={}));var Uo=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=bt.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,a=k(i[1].split("&"));try{for(a.s();!(o=a.n()).done;){var s=o.value.split("=")[0];Rt(r[s])||delete r[s]}}catch(e){a.e(e)}finally{a.f()}}var u=e.indexOf("?")>-1?"&":"?";return e+u+kr(r)},zo=function e(t,n){if(n.blob&&t.buffer)return new Blob([It(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=xt(t)||It(t)?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(i+="&compression="+t.compression),i);var i},Vo=function(e){if(gt&&"fetch"===e.options.transport){var t,n=zo(e.data,e.options),r=new Headers;Ht(r,(function(e,t){r.append(t,e)})),"POST"!==e.options.method||e.options.blob||r.append("Content-Type","application/x-www-form-urlencoded");var i=e.url;return Pt(e.retriesPerformedSoFar)&&e.retriesPerformedSoFar>0&&(i=Uo(i,{retry_count:e.retriesPerformedSoFar},{})),void gt(i,{method:(null===(t=e.options)||void 0===t?void 0:t.method)||"GET",headers:r,keepalive:"POST"===e.options.method,body:n}).then((function(t){var n=t.status;return t.text().then((function(t){var i,o;if(null===(i=e.onResponse)||void 0===i||i.call(e,{statusCode:n,responseText:t}),200!==n)Et(e.onError)&&e.onError({statusCode:n,responseText:t}),(n<400||n>500)&&e.retryQueue.enqueue(a(a({},e),{},{headers:r,retriesPerformedSoFar:(e.retriesPerformedSoFar||0)+1})),null===(o=e.callback)||void 0===o||o.call(e,{status:0});else try{var s;null===(s=e.callback)||void 0===s||s.call(e,JSON.parse(t))}catch(e){At.error(e)}}))})).catch((function(t){var n;At.error(t),null===(n=e.callback)||void 0===n||n.call(e,{status:0})}))}return Go(e)},Go=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.onError,l=e.timeout,c=void 0===l?6e4:l,d=e.onResponse;Pt(a)&&a>0&&(t=Uo(t,{retry_count:a},{}));var f=new XMLHttpRequest;f.open(i.method||"GET",t,!0);var p=zo(n,i);Ht(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){var e={statusCode:f.status,responseText:f.responseText};if(null==d||d(e),200===f.status){if(o){var l;try{l=JSON.parse(f.responseText)}catch(e){return void At.error(e)}o(l)}}else Et(u)&&u(e),(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 Yo,Qo=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.onRequestError=e,i.rateLimiter=r,!Rt(ut)&&"onLine"in ut.navigator&&(i.areWeOnline=ut.navigator.onLine,ut.addEventListener("online",(function(){i._handleWeAreNowOnline()})),ut.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)"),At.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=k(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=k(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))At.warn("[RetryQueue] is quota limited. Dropping request.");else try{null==ut||ut.navigator.sendBeacon(r,zo(i,a(a({},o),{},{sendBeacon:!0})))}catch(e){At.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)||Vo({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:a||0,callback:o,retryQueue:this,onError:this.onRequestError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),n}(to),Jo=1800,Xo=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||nr,this._windowIdGenerator=i||nr;var o=t.persistence_name||t.token,a=t.session_idle_timeout_seconds||Jo;if(Pt(a)?a>Jo?At.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):a<60&&At.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(At.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),a=Jo),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,60),Jo),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var s=mr.parse(this._window_id_storage_key),l=mr.parse(this._primary_window_exists_storage_key);s&&!l?this._windowId=s:mr.remove(this._window_id_storage_key),mr.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return c(e,[{key:"onSessionId",value:function(e){var t=this;return Rt(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&&mr.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&mr.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?mr.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({},On,[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[On];return xt(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==ut||ut.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&mr.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(),At.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}();!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(Yo||(Yo={}));var Ko=function(){function e(t){u(this,e),d(this,"_regionCache",{}),this.instance=t}return c(e,[{key:"apiHost",get:function(){return this.instance.config.api_host.trim().replace(/\/$/,"")}},{key:"uiHost",get:function(){var e;return null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"")}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Yo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Yo.EU:this._regionCache[this.apiHost]=Yo.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return(this.uiHost||this.apiHost)+t;if(this.region===Yo.CUSTOM)return this.apiHost+t;var n="i.posthog.com"+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}}]),e}(),Zo=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.requestRouter.endpointFor("ui","/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,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,$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}))}})),ea=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==ut?void 0:ut.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:ta(n/t,0,1),$prev_pageview_max_scroll:r,$prev_pageview_max_scroll_percentage:t<=1?1:ta(r/t,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:i<=1?1:ta(o/i,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:i<=1?1:ta(a/i,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){null==ut||ut.addEventListener("scroll",this._updateScrollData,!0),null==ut||ut.addEventListener("scrollend",this._updateScrollData,!0),null==ut||ut.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){null==ut||ut.removeEventListener("scroll",this._updateScrollData),null==ut||ut.removeEventListener("scrollend",this._updateScrollData),null==ut||ut.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return null==ut?void 0:ut.document.documentElement;var e,t=k(xt(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==ut?void 0:ut.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 ut&&(ut.scrollY||ut.pageYOffset||ut.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 ta(e,t,n){return Math.max(t,Math.min(e,n))}var na,ra,ia,oa={icontains:function(e){return!!ut&&ut.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},regex:function(e){return!!ut&&wr(ut.location.href,e)},exact:function(e){return(null==ut?void 0:ut.location.href)===e}},aa=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(Dn);if(r&&!n)return e(r);this.instance._send_request(this.instance.requestRouter.endpointFor("api","/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({},Dn,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||oa[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}(),sa=function(){function e(){var t=this;u(this,e),d(this,"limits",{}),d(this,"checkForLimiting",(function(e){var n=e.responseText;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((function(e){At.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),t.limits[e]=(new Date).getTime()+6e4}))}catch(e){return void At.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:n})}}))}return c(e,[{key:"isRateLimited",value:function(e){var t=this.limits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),ua=function(){return a({initialPathName:(null==vt?void 0:vt.pathname)||"",referringDomain:wi.referringDomain()},wi.campaignParams())},la=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({},jn,n))}})),this._sessionIdManager=t,this._persistence=n,this._sessionSourceParamGenerator=r||ua,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return c(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[jn]}},{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}(),ca=["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"],da=function(e,t){if(!e)return!1;var n=e.toLowerCase();return ca.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"}(na||(na={}));var fa=function(){},pa={},ha="posthog",va=!yr&&-1===(null==_t?void 0:_t.indexOf("MSIE"))&&-1===(null==_t?void 0:_t.indexOf("Mozilla")),ga=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,!!Ot(n)&&"herokuapp.com"!==n.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",cookie_name:"",loaded:fa,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==ut||null===(e=ut.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:[],property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_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_request_error:function(e){var t="Bad HTTP status: "+e.statusCode+" "+e.responseText;At.error(t)},get_device_id:function(e){return e},_onCapture:fa,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},ma=function(e,t,n,r){var i,o=n!==ha&&ia?n?ia[n]:void 0:ia,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&&ra===na.INIT_MODULE)i=o;else{if(o&&!xt(o))return void At.error("You have already initialized "+n);i=new ya}if(i._init(e,t,n,s("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new Ji(i),i.sessionRecording.startRecordingIfEnabled(),i.config.disable_scroll_properties||i.pageViewManager.startMeasuringScrollPosition(),i.__autocapture=i.config.autocapture,Un._setIsAutocaptureEnabled(i),Un._isAutocaptureEnabled){i.__autocapture=i.config.autocapture;Un.enabledForProject(i.config.token,100,100)?Un.isBrowserSupported()?Un.init(i):(i.__autocapture=!1,At.info("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,At.info("Not in active bucket: disabling Automatic Event Collection."))}return bt.DEBUG=bt.DEBUG||i.config.debug,!Rt(o)&&xt(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),s("syncCode")(i),i},_a=function(){function e(){u(this,e),d(this,"__forceAllowLocalhost",!1)}return c(e,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){At.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),ya=function(){function e(){var t=this;u(this,e),d(this,"webPerformance",new _a),this.config=ga(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=Zo,this.segmentIntegration=function(){return function(e){Promise&&Promise.resolve||At.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.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new Qn(this),this.toolbar=new eo(this),this.pageViewManager=new ea(this),this.surveys=new aa(this),this.rateLimiter=new sa,this.requestRouter=new Ko(this),this.people={set:function(e,n,r){var i=Ot(e)?d({},e,n):e;t.setPersonProperties(i),null==r||r({})},set_once:function(e,n,r){var i=Ot(e)?d({},e,n):e;t.setPersonProperties(void 0,i),null==r||r({})}}}return c(e,[{key:"init",value:function(e,t,n){if(Rt(n))At.critical("You must name your new library: init(token, config, name)");else if(Rt(e)||function(e){return Ot(e)&&0===e.trim().length}(e))At.critical("You must provide a token to initialize posthog");else{if(n!==ha){var r=ma(e,t,n,(function(e){ia[n]=e,e._loaded()}));return ia[n]=r,r}At.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)))}};(o.request_headers=o.request_headers||o.xhr_headers,this.set_config(Bt({},ga(),o,{name:s,token:e})),null!=ut&&null!==(t=ut.rrweb)&&void 0!==t&&t.record||null!=ut&&ut.rrwebRecord)&&(this.__loaded_recorder_version=null==ut||null===(l=ut.rrweb)||void 0===l?void 0:l.version);if(this.persistence=new Si(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new Si(a(a({},this.config),{},{persistence:"sessionStorage"})),this._requestQueue=new no(this._handle_queued_event.bind(this)),this._retryQueue=new Qo(this.config.on_request_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new Xo(this.config,this.persistence),this.sessionPropsManager=new la(this.sessionManager,this.persistence),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(nr()),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(nr());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_user_state("anonymous")}null==ut||null===(r=ut.addEventListener)||void 0===r||r.call(ut,"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=k(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){At.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 Xi(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()||jt(this.__request_queue,(function(t){e._send_request.apply(e,y(t))})),this.__request_queue=[],this._start_queue_if_opted_in()}},{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||pa,fa)}},{key:"__compress_and_send_json_request",value:function(e,t,n,r){var i=function(e,t,n){return e===wo.GZipJS?[Bo(Wo(t),{mtime:0}),a(a({},n),{},{blob:!0,urlQueryArgs:{compression:wo.GZipJS}})]:[{data:Jt(t)},n]}(this.compression[wo.GZipJS]?wo.GZipJS:wo.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(va)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=Bt(i,n||{}),yr||(n.method="GET");var o=ut&&"sendBeacon"in ut.navigator&&"sendBeacon"===n.transport;if(e=Uo(e,n.urlQueryArgs||{},{ip:this.config.ip}),o)try{null==ut||ut.navigator.sendBeacon(e,zo(t,a(a({},n),{},{sendBeacon:!0})))}catch(e){}else if(yr||!ht)try{Vo({url:e,data:t,headers:this.config.request_headers,options:n,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onError:this.config.on_request_error,onResponse:this.rateLimiter.checkForLimiting})}catch(e){At.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=[];jt(e,(function(e){e&&(t=e[0],xt(t)?o.push(e):Et(e)?e.call(n):xt(e)&&"alias"===t?r.push(e):xt(e)&&-1!==t.indexOf("capture")&&Et(n[t])?o.push(e):i.push(e))}));var a=function(e,t){jt(e,(function(e){if(xt(e[0])){var n=t;Ht(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,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pa;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return At.uninitializedWarning("posthog.capture");if(!Wi(this)){var i=(r=r||pa).transport;if(i&&(r.transport=i),!Rt(e)&&Ot(e)){if(!_t||this.config.opt_out_useragent_filter||!da(_t,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 o={uuid:nr(),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(o.$set=r.$set,o.$set_once=r.$set_once),(o=Qt(o,r._noTruncate?null:this.config.properties_string_max_length)).timestamp=r.timestamp||new Date,Rt(r.timestamp)||(o.properties.$event_time_override_provided=!0,o.properties.$event_time_override_system_time=new Date);var s=a(a({},o.properties.$set),o.$set);(function(e){if(Ft(e)){for(var t in e)if(St.call(e,t))return!1;return!0}return!1})(s)||this.setPersonPropertiesForFlags(s),At.info("send",o);var u=JSON.stringify(o),l=null!==(n=r._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),c=r!==pa;return!this.config.request_batching||c&&!r._batchKey||r.send_instantly?this.__compress_and_send_json_request(l,u,r):this._requestQueue.enqueue(l,o,r),this._invokeCaptureHooks(e,o),o}}else At.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),Ht(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=wi.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=Bt(r,c)}if(!this.config.disable_scroll_properties){var d={};"$pageview"===e?d=this.pageViewManager.doPageView():"$pageleave"===e&&(d=this.pageViewManager.doPageLeave()),r=Bt(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(!Rt(n)){var p=(new Date).getTime()-n;r.$duration=parseFloat((p/1e3).toFixed(3))}(_t&&this.config.opt_out_useragent_filter&&(r.$browser_type=da(_t,this.config.custom_blocked_useragents)?"bot":"browser"),r=Bt({},wi.properties(),this.persistence.properties(),this.sessionPersistence.properties(),r),xt(this.config.property_denylist)&&xt(this.config.property_blacklist))?Ht([].concat(y(this.config.property_blacklist),y(this.config.property_denylist)),(function(e){delete r[e]})):At.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var h=this.config.sanitize_properties;return h&&(r=h(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 At.uninitializedWarning("posthog.identify");if(Pt(e)&&(e=e.toString(),At.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))At.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(kn)&&(this.unregister(kn),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(An))}else At.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 At.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 At.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(nr());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.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionId,r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/replay/"+n);if(null!=e&&e.withTimestamp&&r){var o,a=null!==(o=e.timestampLookBack)&&void 0!==o?o:10;if(!r)return i;var s=Math.max(Math.floor(((new Date).getTime()-r)/1e3)-a,0);i+="?t=".concat(s)}return i}},{key:"alias",value:function(e,t){return e===this.get_property(wn)?(At.critical("Attempting to create alias for existing People user - aborting."),-2):(Rt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(kn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(At.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var t,n=a({},this.config);if(Ft(e)&&(Bt(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),null===(t=this.persistence)||void 0===t||t.update_config(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new Si(a(a({},this.config),{},{persistence:"sessionStorage"})),dr.is_supported()&&"true"===dr.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(bt.DEBUG=!0),this.sessionRecording&&!Rt(e.disable_session_recording))){var r=n.disable_session_recording!==e.disable_session_recording,i=!Wi(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(r||i)&&(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:ha;return t!==ha&&(t=ha+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.config.opt_out_capturing_persistence_type&&dr.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&&!lr.get("ph_optout")||(lr.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=Bt({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||{}),dr.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=Bt({enable_persistence:!0},e||{}),this._gdpr_call_func(Ni,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=Bt({clear_persistence:!0},e||{});this._gdpr_call_func(Li,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Di,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Ai,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=Bt({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func($i,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(null==ut||ut.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==ut||ut.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]]=Gt(e.prototype[t[n]])}(ya,["identify"]);var ba={},wa=function(){ia.init=function(e,t,n){if(n)return ia[n]||(ia[n]=ba[n]=ma(e||"",t||{},n,(function(e){ia[n]=ba[n]=e,e._loaded()}))),ia[n];var r=ia;return ba[ha]?r=ba[ha]:e&&(r=ma(e,t||{},ha,(function(e){ba[ha]=e,e._loaded()})),ba[ha]=r),ia=r,ra===na.INIT_SNIPPET&&(yt[ha]=ia),Ht(ba,(function(e,t){t!==ha&&(ia[t]=e)})),r}};ra=na.INIT_SNIPPET,Rt(yt.posthog)&&(yt.posthog=[]),(ia=yt.posthog).__loaded||ia.config&&ia.persistence?At.critical("PostHog library has already been downloaded at least once."):(Ht(ia._i,(function(e){e&&xt(e)&&(ba[e[2]]=ma.apply(void 0,y(e)))})),wa(),ia.init(),Ht(ba,(function(e){e._loaded()})),function(){function e(){e.done||(e.done=!0,va=!1,Ht(ba,(function(e){e._dom_loaded()})))}null!=ht&&ht.addEventListener&&("complete"===ht.readyState?e():ht.addEventListener("DOMContentLoaded",e,!1)),ut&&Kt(ut,"load",e,!0)}())}();
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(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 p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)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)||v(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 h(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(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 v(e,t){if(e){if("string"==typeof e)return g(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)?g(e,t):void 0}}function g(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 m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=v(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 _(e){var t,n=null===(t=e)||void 0===t?void 0:t.host;return Boolean(n&&n.shadowRoot&&n.shadowRoot===e)}function y(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 b="__rrweb_original__";var w,k,S=1,C=new RegExp("[^a-z0-9-_:]"),x=-2;function I(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(F).join(""):null}catch(e){return null}}function F(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=I(e.styleSheet)||t}catch(e){}return t}var E=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,R=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,T=/^(data:)([^,]*),(.*)/i;function O(e,t){return(e||"").replace(E,(function(e,n,r,i,o,a){var s,u=r||o||a,l=n||i||"";if(!u)return e;if(!R.test(u))return"url("+l+u+l+")";if(T.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 M,P,N,L,D,A,$=/^[^ \t\n\r\u000c]+/,q=/^[, \t\n\r\u000c]+/;function H(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function j(){var e=document.createElement("a");return e.href="",e.href}function B(e,t,n,r){return"src"===n||"href"===n&&r||"xlink:href"===n&&r&&"#"!==r[0]?H(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(q),!(n>=t.length);){var o=r($);if(","===o.slice(-1))o=H(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=H(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?O(r,j()):"object"===t&&"data"===n&&r?H(e,r):r:H(e,r)}function W(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))||W(e.parentNode,t,n)}return e.nodeType,e.TEXT_NODE,W(e.parentNode,t,n)}function U(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,S=n.inlineImages,x=n.recordCanvas,F=n.keepIframeSrcFn;if(s.__sn){var E=s.__sn.id;i=1===E?void 0:E}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 R=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),T=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return C.test(t)?"div":t}(t),M={},P=0,N=Array.from(t.attributes);P<N.length;P++){var L=N[P],D=L.name,A=L.value;M[D]=B(s,T,D,A)}if("link"===T&&f){var $=Array.from(s.styleSheets).find((function(e){return e.href===t.href})),q=null;$&&(q=I($)),q&&(delete M.rel,delete M.href,M._cssText=O(q,$.href))}if("style"===T&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(q=I(t.sheet))&&(M._cssText=O(q,j()));if("input"===T||"textarea"===T||"select"===T){A=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&A?M.value=y({type:M.type,tagName:T,value:A,maskInputOptions:h,maskInputFn:g}):t.checked&&(M.checked=t.checked)}if("option"===T&&(t.selected&&!h.select?M.selected=!0:delete M.selected),"canvas"===T&&x)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=b in i?i[b]: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)||(M.rr_dataURL=t.toDataURL(_.type,_.quality));else if(!("__context"in t)){var H=t.toDataURL(_.type,_.quality),U=document.createElement("canvas");U.width=t.width,U.height=t.height,H!==U.toDataURL(_.type,_.quality)&&(M.rr_dataURL=H)}if("img"===T&&S){w||(w=s.createElement("canvas"),k=w.getContext("2d"));var V=t,z=V.crossOrigin;V.crossOrigin="anonymous";var G=function(){try{w.width=V.naturalWidth,w.height=V.naturalHeight,k.drawImage(V,0,0),M.rr_dataURL=w.toDataURL(_.type,_.quality)}catch(e){console.warn("Cannot inline img src="+V.currentSrc+"! Error: "+e)}z?M.crossOrigin=z:delete M.crossOrigin};V.complete&&0!==V.naturalWidth?G():V.onload=G}if("audio"!==T&&"video"!==T||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop),R){var Y=t.getBoundingClientRect(),J=Y.width,Q=Y.height;M={class:M.class,rr_width:J+"px",rr_height:Q+"px"}}return"iframe"!==T||F(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src),{type:e.Element,tagName:T,attributes:M,childNodes:[],isSVG:(a=t,Boolean("svg"===a.tagName||a.ownerSVGElement)||void 0),needBlock:R,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=O(K,j())}return ee&&(K="SCRIPT_PLACEHOLDER"),!Z&&!ee&&W(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 V(e){return void 0===e?"":e.toLowerCase()}function z(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,y=n.slimDOMOptions,b=n.dataURLOptions,w=void 0===b?{}:b,k=n.inlineImages,C=void 0!==k&&k,I=n.recordCanvas,F=void 0!==I&&I,E=n.onSerialize,R=n.onIframeLoad,T=n.iframeLoadTimeout,O=void 0===T?5e3:T,M=n.keepIframeSrcFn,P=void 0===M?function(){return!1}:M,N=n.preserveWhiteSpace,L=void 0===N||N,D=U(t,{doc:i,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,dataURLOptions:w,inlineImages:C,recordCanvas:F,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&&(V(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===V(t.attributes.name)||"icon"===V(t.attributes.rel)||"apple-touch-icon"===V(t.attributes.rel)||"shortcut icon"===V(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&V(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(V(t.attributes.property).match(/^(og|twitter|fb):/)||V(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===V(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===V(t.attributes.name)||"googlebot"===V(t.attributes.name)||"bingbot"===V(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===V(t.attributes.name)||"generator"===V(t.attributes.name)||"framework"===V(t.attributes.name)||"publisher"===V(t.attributes.name)||"progid"===V(t.attributes.name)||V(t.attributes.property).match(/^article:/)||V(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===V(t.attributes.name)||"yandex-verification"===V(t.attributes.name)||"csrf-token"===V(t.attributes.name)||"p:domain_verify"===V(t.attributes.name)||"verify-v1"===V(t.attributes.name)||"verification"===V(t.attributes.name)||"shopify-checkout-api-token"===V(t.attributes.name)))return!0}}return!1}(D,y)&&(L||D.type!==e.Text||D.isStyle||D.textContent.replace(/^\s+|\s+$/gm,"").length)?S++:x;var A=Object.assign(D,{id:r});if(t.__sn=A,r===x)return null;o[r]=t,E&&E(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)&&$){y.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:y,dataURLOptions:w,inlineImages:C,recordCanvas:F,preserveWhiteSpace:L,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:O,keepIframeSrcFn:P},H=0,j=Array.from(t.childNodes);H<j.length;H++){(G=z(j[H],q))&&A.childNodes.push(G)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var B=0,W=Array.from(t.shadowRoot.childNodes);B<W.length;B++){var G;(G=z(W[B],q))&&(G.isShadow=!0,A.childNodes.push(G))}}return t.parentNode&&_(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&&R){var n=z(e,{doc:e,map:o,blockClass:a,blockSelector:s,maskTextClass:u,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:v,maskTextFn:g,maskInputFn:m,slimDOMOptions:y,dataURLOptions:w,inlineImages:C,recordCanvas:F,preserveWhiteSpace:L,onSerialize:E,onIframeLoad:R,iframeLoadTimeout:O,keepIframeSrcFn:P});n&&R(t,n)}}),O),A}function G(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"}(M||(M={})),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"}(P||(P={})),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"}(N||(N={})),function(e){e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2"}(L||(L={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange"}(D||(D={})),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"}(A||(A={}));var Y="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.",J={map:{},getId:function(){return console.error(Y),-1},getNode:function(){return console.error(Y),null},removeNodeFromMap:function(){console.error(Y)},has:function(){return console.error(Y),!1},reset:function(){console.error(Y)}};function Q(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 X(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 X(e,t,o||{},!0)}}function K(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 Z(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ee(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function te(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||te(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,te(e.parentNode,t)}function ne(e){return"__sn"in e&&e.__sn.id===x}function re(e,t){if(_(e))return!1;var n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||re(e.parentNode,t))}function ie(e){return Boolean(e.changedTouches)}function oe(t){return"__sn"in t&&(t.__sn.type===e.Element&&"iframe"===t.__sn.tagName)}function ae(e){return Boolean(null==e?void 0:e.shadowRoot)}function se(e){return"__ln"in e}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(J=new Proxy(J,{get:function(e,t,n){return"map"===t&&console.error(Y),Reflect.get(e,t,n)}}));var ue=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&&se(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&&se(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}(),le=function(e,t){return"".concat(e,"@").concat(t)};function ce(e){return"__sn"in e}var de=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 ue,u=function(t){for(var n=t,r=x;r===x;)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=_(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=z(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){oe(n)&&e.iframeManager.addIframe(n),ae(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;pe(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;he(e.droppedSet,f)||pe(e.removes,f,e.mirror)?he(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),y=u(v.value);-1!==m&&-1!==y&&(g=v)}if(!g)for(var b=s.length-1;b>=0;b--){var w=s.get(b);if(w){m=e.mirror.getId(w.value.parentNode),y=u(w.value);if(-1!==m&&-1!==y){g=w;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(!ne(t.target))switch(t.type){case"characterData":var s=t.target.textContent;te(t.target,e.blockClass)||s===t.oldValue||e.texts.push({value:W(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=y({maskInputOptions:e.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:s,maskInputFn:e.maskInputFn})),te(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)),b=m.next();!b.done;b=m.next()){h=b.value;""===u.style.getPropertyValue(h)&&(d[h]=!1)}}catch(e){o={error:e}}finally{try{b&&!b.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}}else l.attributes[t.attributeName]=B(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=_(t.target)?e.mirror.getId(t.target.host):e.mirror.getId(t.target);te(t.target,e.blockClass)||ne(n)||(e.addedSet.has(n)?(fe(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===r||re(t.target,e.mirror)||(e.movedSet.has(n)&&e.movedMap[le(r,i)]?fe(e.movedSet,n):e.removes.push({parentId:i,id:r,isShadow:!!_(t.target)||void 0})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!n||!te(n,e.blockClass)){if(ce(t)){if(ne(t))return;e.movedSet.add(t);var r=null;n&&ce(n)&&(r=n.__sn.id),r&&(e.movedMap[le(t.__sn.id,r)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);te(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 fe(e,t){e.delete(t),t.childNodes.forEach((function(t){return fe(e,t)}))}function pe(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}))||pe(e,r,n)}function he(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||he(e,n))}var ve=[],ge="undefined"!=typeof CSSGroupingRule,me="undefined"!=typeof CSSMediaRule,_e="undefined"!=typeof CSSSupportsRule,ye="undefined"!=typeof CSSConditionRule;function be(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 we(e,t){var n,r,i=new de;ve.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 ke(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(N).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=be(n);if(!te(o,i)){var a=ie(n)?n.changedTouches[0]:n;if(a){var s=r.getId(o),u=a.clientX,l=a.clientY;t({type:N[e],id:s,x:u,y:l})}}}}(e);s.push(G(o,a,n))})),function(){s.forEach((function(e){return e()}))}}function Se(e){var t=e.scrollCb,n=e.doc,r=e.mirror,i=e.blockClass;return G("scroll",Q((function(e){var o=be(e);if(o&&!te(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 Ce(e,n){var r=t({},e);return n||delete r.userTriggered,r}var xe=["INPUT","TEXTAREA","SELECT"],Ie=new WeakMap;function Fe(e){return function(e,t){if(ge&&e.parentRule instanceof CSSGroupingRule||me&&e.parentRule instanceof CSSMediaRule||_e&&e.parentRule instanceof CSSSupportsRule||ye&&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 Ee(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=we(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=Q((function(e){var n=Date.now()-o;t(u.map((function(e){return e.timeOffset-=n,e})),e),u=[],o=null}),s),c=Q((function(e){var t=be(e),n=ie(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?P.Drag:e instanceof MouseEvent?P.MouseMove:P.TouchMove)}),a,{trailing:!1}),d=[G("mousemove",c,r),G("touchmove",c,r),G("drag",c,r)];return function(){d.forEach((function(e){return e()}))}}(e),d=ke(e),f=Se(e),p=function(e){var t=e.viewportResizeCb,n=-1,r=-1;return G("resize",Q((function(){var e=Z(),i=ee();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=be(e),n=e.isTrusted;if(t&&"OPTION"===t.tagName&&(t=t.parentElement),t&&t.tagName&&!(xe.indexOf(t.tagName)<0)&&!te(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=y({maskInputOptions:l,tagName:t.tagName,type:r,value:i,maskInputFn:c})),h(t,Ce({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,Ce({text:e.value,isChecked:!a,userTriggered:!1},f))}))}}}function h(e,r){var i=Ie.get(e);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ie.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 G(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 X(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 Q((function(i){var o=be(i);if(o&&!te(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=[G("play",o(0)),G("pause",o(1)),G("seeked",o(2)),G("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={};ge?l.CSSGroupingRule=a.CSSGroupingRule:(me&&(l.CSSMediaRule=a.CSSMediaRule),ye&&(l.CSSConditionRule=a.CSSConditionRule),_e&&(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(Fe(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(Fe(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:Fe(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:Fe(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=K(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(){},b=[];try{for(var w=n(e.plugins),k=w.next();!k.done;k=w.next()){var S=k.value;b.push(S.observer(S.callback,u,S.options))}}catch(e){a={error:e}}finally{try{k&&!k.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return function(){ve.forEach((function(e){return e.reset()})),l.disconnect(),c(),d(),f(),p(),h(),v(),g(),m(),_(),b.forEach((function(e){return e()}))}}var Re=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}(),Te=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(K(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){we(t(t({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Se(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(K(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 Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Me="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Pe=0;Pe<64;Pe++)Me[Oe.charCodeAt(Pe)]=Pe;var Ne=new Map;var Le=function(e,t,n){if(e&&($e(e,t)||"object"===s(e))){var r=function(e,t){var n=Ne.get(e);return n||(n=new Map,Ne.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 De(e,t,n){if(e instanceof Array)return e.map((function(e){return De(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+=Oe[n[t]>>2],i+=Oe[(3&n[t])<<4|n[t+1]>>4],i+=Oe[(15&n[t+1])<<2|n[t+2]>>6],i+=Oe[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:[De(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:[De(e.data,t,n),e.width,e.height]}:$e(e,t)||"object"===s(e)?{rr_type:e.constructor.name,index:Le(e,t,n)}:e}var Ae=function(e,t,n){return i([],r(e),!1).map((function(e){return De(e,t,n)}))},$e=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 qe(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=K(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(Le(f,u,e),!te(this.canvas,a)){s.getId(this.canvas);var p=Ae(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=X(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 He,je,Be=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=K(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return te(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=K(t.CanvasRenderingContext2D.prototype,n,(function(t){return function(){for(var a=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return te(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:L["2D"],property:n,args:t})}),0),t.apply(this,s)}}));l.push(a)}catch(r){var s=X(t.CanvasRenderingContext2D.prototype,n,{set:function(t){e(this.canvas,{type:L["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(qe(t.WebGLRenderingContext.prototype,L.WebGL,e,n,o,t)),!1)),void 0!==t.WebGL2RenderingContext&&a.push.apply(a,i([],r(qe(t.WebGL2RenderingContext.prototype,L.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 We(e){return t(t({},e),{timestamp:Date.now()})}var Ue={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 Ve(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,w=e.slimDOMOptions,k=e.maskInputFn,S=e.maskTextFn,C=e.hooks,x=e.packFn,I=e.sampling,F=void 0===I?{}:I,E=e.mousemoveWait,R=e.recordCanvas,T=void 0!==R&&R,O=e.userTriggeredOnInput,N=void 0!==O&&O,L=e.collectFonts,D=void 0!==L&&L,A=e.inlineImages,$=void 0!==A&&A,q=e.plugins,H=e.keepIframeSrcFn,j=void 0===H?function(){return!1}:H;if(!i)throw new Error("emit function is required");void 0!==E&&void 0===F.mousemove&&(F.mousemove=E);var B,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===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===w,headMetaDescKeywords:"all"===w}:w||{};!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;He=function(e,t){var r;if(!(null===(r=ve[0])||void 0===r?void 0:r.isFrozen())||e.type===M.FullSnapshot||e.type===M.IncrementalSnapshot&&e.data.source===P.Mutation||ve.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 x&&(e=x(e)),e}(e),t),e.type===M.FullSnapshot)B=e,V=0;else if(e.type===M.IncrementalSnapshot){if(e.data.source===P.Mutation&&e.data.isAttachIframe)return;V++;var s=a&&V>=a,u=o&&e.timestamp-B.timestamp>o;(s||u)&&je(!0)}};var Y=function(e){He(We({type:M.IncrementalSnapshot,data:t({source:P.Mutation},e)}))},J=function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.Scroll},e)}))},Q=function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.CanvasMutation},e)}))},X=new Re({mutationCb:Y}),K=new Be({recordCanvas:T,mutationCb:Q,win:window,blockClass:u,mirror:Ue}),te=new Te({mutationCb:Y,scrollCb:J,bypassOptions:{blockClass:u,blockSelector:c,maskTextClass:h,maskTextSelector:g,inlineStylesheet:_,maskInputOptions:W,maskTextFn:S,maskInputFn:k,recordCanvas:T,inlineImages:$,sampling:F,slimDOMOptions:U,iframeManager:X,canvasManager:K},mirror:Ue});je=function(e){var t,n,i,o;void 0===e&&(e=!1),He(We({type:M.Meta,data:{href:window.location.href,width:ee(),height:Z()}}),e),ve.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,w=n.slimDOM,k=void 0!==w&&w,S=n.dataURLOptions,C=n.preserveWhiteSpace,x=n.onSerialize,I=n.onIframeLoad,F=n.iframeLoadTimeout,E=n.keepIframeSrcFn,R={};return[z(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===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,dataURLOptions:S,inlineImages:h,recordCanvas:g,preserveWhiteSpace:C,onSerialize:x,onIframeLoad:I,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:T,inlineImages:$,onSerialize:function(e){oe(e)&&X.addIframe(e),ae(e)&&te.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){X.attachIframe(e,t),te.observeAttachShadow(e)},keepIframeSrcFn:j}),2),s=a[0],l=a[1];if(!s)return console.warn("Failed to snapshot the document");Ue.map=l,He(We({type:M.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}}})),ve.forEach((function(e){return e.unlock()}))};try{var ne=[];ne.push(G("DOMContentLoaded",(function(){He(We({type:M.DomContentLoaded,data:{}}))})));var re=function(e){var n;return Ee({mutationCb:Y,mousemoveCb:function(e,t){return He(We({type:M.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.MouseInteraction},e)}))},scrollCb:J,viewportResizeCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.ViewportResize},e)}))},inputCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.Input},e)}))},mediaInteractionCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.StyleDeclaration},e)}))},canvasMutationCb:Q,fontCb:function(e){return He(We({type:M.IncrementalSnapshot,data:t({source:P.Font},e)}))},blockClass:u,ignoreClass:f,maskTextClass:h,maskTextSelector:g,maskInputOptions:W,inlineStylesheet:_,sampling:F,recordCanvas:T,inlineImages:$,userTriggeredOnInput:N,collectFonts:D,doc:e,maskInputFn:k,maskTextFn:S,blockSelector:c,slimDOMOptions:U,mirror:Ue,iframeManager:X,shadowDomManager:te,canvasManager:K,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 He(We({type:M.Plugin,data:{plugin:e.name,payload:t}}))}}})))||[]},C)};X.addLoadListener((function(e){ne.push(re(e.contentDocument))}));var ie=function(){je(),ne.push(re(document))};return"interactive"===document.readyState||"complete"===document.readyState?ie():ne.push(G("load",(function(){He(We({type:M.Load,data:{}})),ie()}),window)),function(){ne.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}Ve.addCustomEvent=function(e,t){if(!He)throw new Error("please add custom event after start recording");He(We({type:M.Custom,data:{tag:e,payload:t}}))},Ve.freezePage=function(){ve.forEach((function(e){return e.freeze()}))},Ve.takeFullSnapshot=function(e){if(!je)throw new Error("please take full snapshot after start recording");je(e)},Ve.mirror=Ue;var ze=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}(),Ge=/(^|@)\S+:\d+/,Ye=/^\s*at .*(\S+:\d+|\(native\))/m,Je=/^(eval@)?(\[native code])?$/,Qe={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(Ye))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(Ye)}),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 ze({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(Je)}),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 ze({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new ze({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 ze({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 ze({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(Ge)&&!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 ze({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Xe(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 Ke(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ze(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(Ke(e[u])&&Ze(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 et(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(Ke(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Ke(e)&&Ze(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]=Xe(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 tt={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 nt(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=Qe.parse(r).map((function(e){return e.toString()})),a=[et(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]?K(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=Qe.parse(new Error).map((function(e){return e.toString()})).splice(1),d=s.map((function(e){return et(e,o.stringifyOptions)}));++c<o.lengthThreshold?e({level:n,trace:l,payload:d}):c===o.lengthThreshold&&e({level:"warn",trace:[],payload:[et("The number of log records reached the threshold.")]})}catch(e){t.apply(void 0,i(["rrweb logger error:",e],r(s),!1))}}})):function(){}}}var rt="undefined"!=typeof window?window:void 0,it="undefined"!=typeof globalThis?globalThis:rt,ot=Array.prototype,at=ot.forEach,st=ot.indexOf,ut=null==it?void 0:it.navigator,lt=null==it?void 0:it.document,ct=null==it?void 0:it.location,dt=null==it?void 0:it.fetch,ft=null!=it&&it.XMLHttpRequest&&"withCredentials"in new it.XMLHttpRequest?it.XMLHttpRequest:void 0,pt=null==it?void 0:it.AbortController,ht=null==ut?void 0:ut.userAgent,vt=null!=rt?rt:{};rt&&(rt.rrweb={record:Ve,version:"v1",rrwebVersion:"1.1.3"},rt.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:nt,options:e?Object.assign({},tt,e):tt}}});var gt={DEBUG:!1,LIB_VERSION:"1.112.0"},mt=Array.isArray,_t=Object.prototype,yt=_t.hasOwnProperty,bt=_t.toString,wt=mt||function(e){return"[object Array]"===bt.call(e)},kt=function(e){return"function"==typeof e},St=function(e){return e===Object(e)&&!wt(e)},Ct=function(e){return void 0===e},xt=function(e){return"[object String]"==bt.call(e)},It=function(e){return null===e},Ft=function(e){return Ct(e)||It(e)},Et=function(e){return"[object Number]"==bt.call(e)},Rt=function(e){return"[object Boolean]"===bt.call(e)},Tt=function(e){return e instanceof FormData},Ot="[PostHog.js]",Mt={_log:function(e){if(rt&&(gt.DEBUG||vt.POSTHOG_DEBUG)&&!Ct(rt.console)&&rt.console){for(var t=("__rrweb_original__"in rt.console[e]?rt.console[e].__rrweb_original__:rt.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))}},Pt={},Nt=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Lt(e,t,n){if(wt(e))if(at&&e.forEach===at)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)===Pt)return}function Dt(e,t,n){if(!Ft(e)){if(wt(e))return Lt(e,t,n);if(Tt(e)){var r,i=m(e.entries());try{for(i.s();!(r=i.n()).done;){var o=r.value;if(t.call(n,o[1],o[0])===Pt)return}}catch(e){i.e(e)}finally{i.f()}}else for(var a in e)if(yt.call(e,a)&&t.call(n,e[a],a)===Pt)return}}var At=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 Lt(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function $t(e,t){return-1!==e.indexOf(t)}function qt(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 Ht=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},jt=function(e){try{return e()}catch(e){return}},Bt=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)}}},Wt=function(e){var t={};return Dt(e,(function(e,n){xt(e)&&e.length>0&&(t[n]=e)})),t};function Ut(e,t){return n=e,r=function(e){return xt(e)&&!It(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=[],Lt(t,(function(t){o.push(e(t))}))):(o={},Dt(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}var Vt=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),It(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},zt=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==rt?void 0:rt.event)){var o,a=!0;kt(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 Gt(e,t){var n=function(){if(!lt)return t("document not found");var n=lt.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=lt.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):lt.body.appendChild(n)};null!=lt&&lt.body?n():null==lt||lt.addEventListener("DOMContentLoaded",n)}function Yt(e){return e?Nt(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 Qt(e){return Ft(e)?null:Nt(e).split(/(\s+)/).filter(un).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Xt(e){var t="";return an(e)&&!sn(e)&&e.childNodes&&e.childNodes.length&&Dt(e.childNodes,(function(e){var n;en(e)&&e.textContent&&(t+=null!==(n=Qt(e.textContent))&&void 0!==n?n:"")})),Nt(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){var t=e.parentNode;return!(!t||!Kt(t))&&t}function on(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!rt||!e||Zt(e,"html")||!Kt(e))return!1;if(null!=n&&n.url_allowlist){var o=rt.location.href,a=n.url_allowlist;if(a&&!a.some((function(e){return o.match(e)})))return!1}if(null!=n&&n.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((function(e){return t.type===e})))return!1}for(var l=!1,c=[e],d=!0,f=e;f.parentNode&&!Zt(f,"body");)if(tn(f.parentNode))c.push(f.parentNode.host),f=f.parentNode.host;else{if(!(d=rn(f)))break;if(r||nn.indexOf(d.tagName.toLowerCase())>-1)l=!0;else{var p=rt.getComputedStyle(d);p&&"pointer"===p.getPropertyValue("cursor")&&(l=!0)}c.push(d),f=d}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(Ct(n))return!0;var r,i=m(e);try{var o=function(){var e=r.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(i.s();!(r=i.n()).done;){var a=o();if("object"===s(a))return a.v}}catch(e){i.e(e)}finally{i.f()}return!1}(c,n))return!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(Ct(n))return!0;var r,i=m(e);try{var o=function(){var e=r.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(i.s();!(r=i.n()).done;){var a=o();if("object"===s(a))return a.v}}catch(e){i.e(e)}finally{i.f()}return!1}(c,n))return!1;var h=rt.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return l?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(nn.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}function an(e){for(var t=e;t.parentNode&&!Zt(t,"body");t=t.parentNode){var n=Jt(t);if($t(n,"ph-sensitive")||$t(n,"ph-no-capture"))return!1}if($t(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 sn(e){return!!(Zt(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Zt(e,"select")||Zt(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function un(e){if(Ft(e))return!1;if(xt(e)){e=Nt(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=Xt(e);return un(t="".concat(t," ").concat(cn(e)).trim())?t:""}function cn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Dt(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(cn(e)).trim())}catch(e){Mt.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=m(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 qt(u).sort((function(e,t){var n=p(e,1)[0],r=p(t,1)[0];return n.localeCompare(r)})).forEach((function(e){var t=p(e,2),n=t[0],r=t[1];return l[fn(n.toString())]=fn(r.toString())})),r+=":",r+=qt(u).map((function(e){var t=p(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 qt(e).filter((function(e){return 0===p(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=p(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:Yt(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",wn="$session_recording_recorder_version_server_side",kn="$session_recording_network_payload_capture",Sn="$session_recording_canvas_recording",Cn="$sesid",xn="$session_is_sampled",In="$enabled_feature_flags",Fn="$early_access_features",En="$stored_person_properties",Rn="$stored_group_properties",Tn="$surveys",On="$flag_call_reported",Mn="$user_state",Pn="$posthog_quota_limited",Nn="$client_session_props",Ln=[vn,gn,"__cmpns",mn,yn,Cn,In,Mn,Pn,Fn,Rn,En,Tn,On,Nn],Dn="$copy_autocapture";function An(e,t){return t.length>e?t.slice(0,e)+"...":t}var $n,qn={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t,n=It(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&&!Kt(t));return t},_getAugmentPropertiesFromElement:function(e){if(!an(e))return{};var t={};return Dt(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};nn.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=An(1024,ln(e)):o.$el_text=An(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;Dt(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,!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]=An(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 Dt(null==lt?void 0:lt.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 Dt(this._customProperties,(function(r){Dt(r.event_selectors,(function(i){Dt(null==lt?void 0:lt.querySelectorAll(i),(function(i){$t(e,i)&&an(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return Ct(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=arguments.length>3?arguments[3]:void 0,a=this._getEventTarget(e);(en(a)&&(a=a.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"));var s=i===Dn;if(a&&on(a,e,this.config,s,s?["copy","cut"]:void 0)){for(var u,l,c=[a],d=a;d.parentNode&&!Zt(d,"body");)tn(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var f,p=[],h={},v=!1;if(Dt(c,(function(e){var n=an(e);"a"===e.tagName.toLowerCase()&&(f=e.getAttribute("href"),f=n&&un(f)&&f),$t(Jt(e),"ph-no-capture")&&(v=!0),p.push(r._getPropertiesFromElement(e,t.config.mask_all_element_attributes,t.config.mask_all_text));var i=r._getAugmentPropertiesFromElement(e);At(h,i)})),t.config.mask_all_text||("a"===a.tagName.toLowerCase()||"button"===a.tagName.toLowerCase()?p[0].$el_text=ln(a):p[0].$el_text=Xt(a)),f&&(p[0].attr__href=f),v)return!1;var g=At(this._getDefaultProperties(e.type),t.elementsChainAsString?{$elements_chain:dn(p)}:{$elements:p},null!==(u=p[0])&&void 0!==u&&u.$el_text?{$el_text:null===(l=p[0])||void 0===l?void 0:l.$el_text}:{},this._getCustomProperties(c),h,o||{});if(i===Dn){var m,_=Qt(null==rt||null===(m=rt.getSelection())||void 0===m?void 0:m.toString()),y=e.type||"clipboard";if(!_)return!1;g.$selected_content=_,g.$copy_type=y}return t.capture(i,g),!0}},_navigate:function(e){rt&&(rt.location.href=e)},_addDomEventHandlers:function(e){var t=this;if(rt&&lt){var n=function(n){n=n||(null==rt?void 0:rt.event),t._captureEvent(n,e)},r=function(n){n=n||(null==rt?void 0:rt.event),t._captureEvent(n,e,Dn)};zt(lt,"submit",n,!1,!0),zt(lt,"change",n,!1,!0),zt(lt,"click",n,!1,!0),St(e.config.autocapture)&&e.config.autocapture.capture_copied_text&&(zt(lt,"copy",r,!1,!0),zt(lt,"cut",r,!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 hn(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({},_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=Ct(t)?10:t,n=Ct(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return kt(null==lt?void 0:lt.querySelectorAll)}};!function(e){for(var t in e)kt(e[t])&&(e[t]=e[t].bind(e))}(qn),function(e){for(var t in e)kt(e[t])&&(e[t]=Bt(e[t]))}(qn),function(e){e.GZipJS="gzip-js",e.Base64="base64"}($n||($n={}));var Hn="$active_feature_flags",jn="$override_feature_flags",Bn="$feature_flag_payloads",Wn=function(e){var t,n={},r=m(qt(e||{}));try{for(r.s();!(t=r.n()).done;){var i=p(t.value,2),o=i[0],a=i[1];a&&(n[o]=a)}}catch(e){r.e(e)}finally{r.f()}return n},Un=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(jn);if(!t)return e||{};for(var n=At({},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(Bn)||{}}},{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(En),r=this.instance.get_property(Rn),i={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({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:i,compression:$n.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){var n;e.setReloadingPaused(!1);var r=!0;200===t.statusCode&&(e.$anon_distinct_id=void 0,r=!1),e.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},r),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(On)||{};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({},On,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,t){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.featureFlags,s=e.featureFlagPayloads;if(o)if(wt(o)){var u,l={};if(o)for(var c=0;c<o.length;c++)l[o[c]]=!0;t&&t.register((d(u={},Hn,o),d(u,In,l),u))}else{var f=o,p=s;e.errorsWhileComputingFlags&&(f=a(a({},r),f),p=a(a({},i),p)),t&&t.register((d(n={},Hn,Object.keys(Wn(f))),d(n,In,f||{}),d(n,Bn,p||{}),n))}}(e,this.instance.persistence,n,r),this._fireFeatureFlagsCallbacks(t)}}},{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(jn);else if(wt(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(d({},jn,t))}else this.instance.persistence.register(d({},jn,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={},Hn,Object.keys(Wn(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(Fn);if(r&&!n)return e(r);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(n){var r;if(n.json){var i=n.json.earlyAccessFeatures;return null===(r=t.instance.persistence)||void 0===r||r.register(d({},Fn,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(e){var t=this._prepareFeatureFlagsForCallbacks(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((function(t){return t(n,r,{errorsLoading:e})}))}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(En)||{};this.instance.register(d({},En,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(En)}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.instance.get_property(Rn)||{};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({},Rn,a(a({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.instance.get_property(Rn)||{};this.instance.register(d({},Rn,a(a({},t),{},d({},e,{}))))}else this.instance.unregister(Rn)}}]),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 Vn="0123456789abcdef",zn=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+Vn.charAt(this.bytes[t]>>>4)+Vn.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}(),Gn=function(){function e(){u(this,e),d(this,"timestamp",0),d(this,"counter",0),d(this,"random",new Qn)}return c(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Ct(e)){this.timestamp=0;var t=this.generateOrAbort();if(Ct(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 zn.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}(),Yn=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};rt&&!Ct(rt.crypto)&&crypto.getRandomValues&&(Yn=function(e){return crypto.getRandomValues(e)});var Jn,Qn=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&&(Yn(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),Xn=function(){return Kn().toString()},Kn=function(){return(Jn||(Jn=new Gn)).generate()},Zn="Thu, 01 Jan 1970 00:00:00 GMT",er="";var tr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function nr(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;if(er)return er;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_"+Xn(),o=new RegExp("(^|;)\\s*"+i+"=1");!er&&r--;){var a=n.slice(r).join("."),s=i+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+Zn,er=a)}return er}(e);if(!n){var r=function(e){var t=e.match(tr);return t?t[0]:""}(e);r!==n&&Mt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var rr,ir={is_supported:function(){return!!lt},error:function(e){Mt.error("cookieStore error: "+e)},get:function(e){if(lt){try{for(var t=e+"=",n=lt.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(ir.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){if(lt)try{var o="",a="",s=nr(lt.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),lt.cookie=l,l}catch(e){return}},remove:function(e,t){try{ir.set(e,"",-1,t)}catch(e){return}}},or=null,ar={is_supported:function(){if(!It(or))return or;var e=!0;if(Ct(rt))e=!1;else try{var t="__mplssupport__";ar.set(t,"xyz"),'"xyz"'!==ar.get(t)&&(e=!1),ar.remove(t)}catch(t){e=!1}return e||Mt.error("localStorage unsupported; falling back to cookie store"),or=e,e},error:function(e){Mt.error("localStorage error: "+e)},get:function(e){try{return null==rt?void 0:rt.localStorage.getItem(e)}catch(e){ar.error(e)}return null},parse:function(e){try{return JSON.parse(ar.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==rt||rt.localStorage.setItem(e,JSON.stringify(t))}catch(e){ar.error(e)}},remove:function(e){try{null==rt||rt.localStorage.removeItem(e)}catch(e){ar.error(e)}}},sr=["distinct_id",Cn,xn],ur=a(a({},ar),{},{parse:function(e){try{var t={};try{t=ir.parse(e)||{}}catch(e){}var n=At(t,JSON.parse(ar.get(e)||"{}"));return ar.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{ar.set(e,t);var o={};sr.forEach((function(e){t[e]&&(o[e]=t[e])})),Object.keys(o).length&&ir.set(e,o,n,r,i)}catch(e){ar.error(e)}},remove:function(e,t){try{null==rt||rt.localStorage.removeItem(e),ir.remove(e,t)}catch(e){ar.error(e)}}}),lr={},cr={is_supported:function(){return!0},error:function(e){Mt.error("memoryStorage error: "+e)},get:function(e){return lr[e]||null},parse:function(e){return lr[e]||null},set:function(e,t){lr[e]=t},remove:function(e){delete lr[e]}},dr=null,fr={is_supported:function(){if(!It(dr))return dr;if(dr=!0,Ct(rt))dr=!1;else try{var e="__support__";fr.set(e,"xyz"),'"xyz"'!==fr.get(e)&&(dr=!1),fr.remove(e)}catch(e){dr=!1}return dr},error:function(e){Mt.error("sessionStorage error: ",e)},get:function(e){try{return null==rt?void 0:rt.sessionStorage.getItem(e)}catch(e){fr.error(e)}return null},parse:function(e){try{return JSON.parse(fr.get(e))||null}catch(e){}return null},set:function(e,t){try{null==rt||rt.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){fr.error(e)}},remove:function(e){try{null==rt||rt.sessionStorage.removeItem(e)}catch(e){fr.error(e)}}},pr=["localhost","127.0.0.1"],hr=function(e){var t=null==lt?void 0:lt.createElement("a");return Ct(t)?null:(t.href=e,t)},vr=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},gr=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return Dt(e,(function(e,r){Ct(e)||Ct(r)||"undefined"===r||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)})),i.join(r)},mr=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){Mt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},_r=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},yr="Mobile",br="iOS",wr="Android",kr="Tablet",Sr=wr+" "+kr,Cr="iPad",xr="Apple",Ir=xr+" Watch",Fr="Safari",Er="BlackBerry",Rr="Samsung",Tr=Rr+"Browser",Or=Rr+" Internet",Mr="Chrome",Pr=Mr+" OS",Nr=Mr+" "+br,Lr="Internet Explorer",Dr=Lr+" "+yr,Ar="Opera",$r=Ar+" Mini",qr="Edge",Hr="Microsoft "+qr,jr="Firefox",Br=jr+" "+br,Wr="Nintendo",Ur="PlayStation",Vr="Xbox",zr=wr+" "+yr,Gr=yr+" "+Fr,Yr="Windows",Jr=Yr+" Phone",Qr="Nokia",Xr="Ouya",Kr="Generic",Zr=Kr+" "+yr.toLowerCase(),ei=Kr+" "+kr.toLowerCase(),ti="Konqueror",ni="(\\d+(\\.\\d+)?)",ri=new RegExp("Version/"+ni),ii=new RegExp(Vr,"i"),oi=new RegExp(Ur+" \\w+","i"),ai=new RegExp(Wr+" \\w+","i"),si=new RegExp(Er+"|PlayBook|BB10","i"),ui={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var li=function(e,t){return t&&$t(t,xr)||function(e){return $t(e,Fr)&&!$t(e,Mr)&&!$t(e,wr)}(e)},ci=function(e,t,n){return n?Ar:(t=t||"",$t(e," OPR/")&&$t(e,"Mini")?$r:$t(e," OPR/")?Ar:si.test(e)?Er:$t(e,"IE"+yr)||$t(e,"WPDesktop")?Dr:$t(e,Tr)?Or:$t(e,qr)||$t(e,"Edg/")?Hr:$t(e,"FBIOS")?"Facebook "+yr:$t(e,Mr)?Mr:$t(e,"CriOS")?Nr:$t(e,"UCWEB")||$t(e,"UCBrowser")?"UC Browser":$t(e,"FxiOS")?Br:$t(e,wr)?zr:$t(e.toLowerCase(),ti.toLowerCase())?ti:li(e,t)?$t(e,yr)?Gr:Fr:$t(e,jr)?jr:$t(e,"MSIE")||$t(e,"Trident/")?Lr:$t(e,"Gecko")?jr:"")},di=(d(rr={},Dr,[new RegExp("rv:"+ni)]),d(rr,Hr,[new RegExp(qr+"?\\/"+ni)]),d(rr,Mr,[new RegExp(Mr+"/"+ni)]),d(rr,Nr,[new RegExp("CriOS\\/"+ni)]),d(rr,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+ni)]),d(rr,Fr,[ri]),d(rr,Gr,[ri]),d(rr,Ar,[new RegExp("(Opera|OPR)\\/"+ni)]),d(rr,jr,[new RegExp(jr+"\\/"+ni)]),d(rr,Br,[new RegExp("FxiOS\\/"+ni)]),d(rr,ti,[new RegExp("Konqueror[:/]?"+ni,"i")]),d(rr,Er,[new RegExp(Er+" "+ni),ri]),d(rr,zr,[new RegExp("android\\s"+ni)]),d(rr,Or,[new RegExp(Tr+"\\/"+ni)]),d(rr,Lr,[new RegExp("(rv:|MSIE )"+ni)]),d(rr,"Mozilla",[new RegExp("rv:"+ni)]),rr),fi=[[new RegExp(Vr+"; "+Vr+" (.*?)[);]","i"),function(e){return[Vr,e&&e[1]||""]}],[new RegExp(Wr,"i"),[Wr,""]],[new RegExp(Ur,"i"),[Ur,""]],[si,[Er,""]],[new RegExp(Yr,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[Jr,""];if(new RegExp(yr).test(t)&&!/IEMobile\b/.test(t))return[Yr+" "+yr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=ui[r]||"";return/arm/i.test(t)&&(i="RT"),[Yr,i]}return[Yr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[br,t.join(".")]}return[br,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=Ct(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+wr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wr+")","i"),function(e){if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[wr,t.join(".")]}return[wr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Pr,""]],[/Linux|debian/i,["Linux",""]]],pi=function(e){return ai.test(e)?Wr:oi.test(e)?Ur:ii.test(e)?Vr:new RegExp(Xr,"i").test(e)?Xr:new RegExp("("+Jr+"|WPDesktop)","i").test(e)?Jr:/iPad/.test(e)?Cr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ir:si.test(e)?Er:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Qr,"i").test(e)?Qr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(yr).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?wr:Sr:wr:new RegExp("(pda|"+yr+")","i").test(e)?Zr:new RegExp(kr,"i").test(e)&&!new RegExp(kr+" pc","i").test(e)?ei:""},hi="https?://(.*)",vi={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid"].concat(e||[]),n={};return Dt(t,(function(e){var t=lt?mr(lt.URL,e):"";t.length&&(n[e]=t)})),n},searchEngine:function(){var e=null==lt?void 0:lt.referrer;return e?0===e.search(hi+"google.([^/?]*)")?"google":0===e.search(hi+"bing.com")?"bing":0===e.search(hi+"yahoo.com")?"yahoo":0===e.search(hi+"duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=vi.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(!It(e)){n.$search_engine=e;var r=lt?mr(lt.referrer,t):"";r.length&&(n.ph_keyword=r)}return n},browser:ci,browserVersion:function(e,t,n){var r=ci(e,t,n),i=di[r];if(Ct(i))return null;for(var o=0;o<i.length;o++){var a=i[o],s=e.match(a);if(s)return parseFloat(s[s.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(var t=0;t<fi.length;t++){var n=p(fi[t],2),r=n[0],i=n[1],o=r.exec(e),a=o&&(kt(i)?i(o,e):i);if(a)return a}return["",""]},device:pi,deviceType:function(e){var t=pi(e);return t===Cr||t===Sr||"Kobo"===t||"Kindle Fire"===t||t===ei?kr:t===Wr||t===Vr||t===Ur||t===Xr?"Console":t===Ir?"Wearable":t?yr:"Desktop"},referrer:function(){return(null==lt?void 0:lt.referrer)||"$direct"},referringDomain:function(){var e;return null!=lt&&lt.referrer&&(null===(e=hr(lt.referrer))||void 0===e?void 0:e.host)||"$direct"},properties:function(){if(!ht)return{};var e=p(vi.os(ht),2),t=e[0],n=e[1];return At(Wt({$os:t,$os_version:n,$browser:vi.browser(ht,navigator.vendor,vt.opera),$device:vi.device(ht),$device_type:vi.deviceType(ht)}),{$current_url:null==ct?void 0:ct.href,$host:null==ct?void 0:ct.host,$pathname:null==ct?void 0:ct.pathname,$raw_user_agent:ht.length>1e3?ht.substring(0,997)+"...":ht,$browser_version:vi.browserVersion(ht,navigator.vendor,vt.opera),$browser_language:vi.browserLanguage(),$screen_height:null==rt?void 0:rt.screen.height,$screen_width:null==rt?void 0:rt.screen.width,$viewport_height:null==rt?void 0:rt.innerHeight,$viewport_width:null==rt?void 0:rt.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:Ht()/1e3})},people_properties:function(){if(!ht)return{};var e=p(vi.os(ht),2),t=e[0],n=e[1];return At(Wt({$os:t,$os_version:n,$browser:vi.browser(ht,navigator.vendor,vt.opera)}),{$browser_version:vi.browserVersion(ht,navigator.vendor,vt.opera)})}},gi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mi=function(){function e(t){u(this,e),this.config=t,this.props={},this.campaign_params_saved=!1,this.name=function(e){var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"}(t),this.storage=this.buildStorage(t),this.load(),this.update_config(t,t),this.save()}return c(e,[{key:"buildStorage",value:function(e){-1===gi.indexOf(e.persistence.toLowerCase())&&(Mt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&ar.is_supported()?ar:"localstorage+cookie"===t&&ur.is_supported()?ur:"sessionstorage"===t&&fr.is_supported()?fr:"memory"===t?cr:"cookie"===t?ir:ur.is_supported()?ur:ir}},{key:"properties",value:function(){var e={};return Dt(this.props,(function(t,n){if(n===In&&St(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,(It(o=Ln)?s:st&&o.indexOf===st?-1!=o.indexOf(a):(Dt(o,(function(e){if(s||(s=e===a))return Pt})),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=At({},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(St(e)){Ct(t)&&(t="None"),this.expire_days=Ct(n)?this.default_expiry:n;var i=!1;if(Dt(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(St(e)){this.expire_days=Ct(t)?this.default_expiry:t;var r=!1;if(Dt(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(vi.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(vi.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||vi.referrer(),$referring_domain:this.props.$referring_domain||vi.referringDomain()})}},{key:"get_referrer_info",value:function(){return Wt({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return Dt(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e,t){if(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),e.persistence!==t.persistence){var n=this.buildStorage(e),r=this.props;this.clear(),this.storage=n,this.props=r,this.save()}}},{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 Ct(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[Pn]||{}}},{key:"set_quota_limits",value:function(e){this.props[Pn]=e,this.save()}}]),e}(),_i=2,yi=4;var bi=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=p(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)})),wi=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}(wi||{}),ki={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},Si=["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"],Ci=["/s/","/e/","/i/"];function xi(e,t,n,r){if(Ft(e))return e;var i=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return xt(i)&&(i=parseInt(i)),i>n?"[SessionReplay] ".concat(r," body too large to record (").concat(i," bytes)"):e}var Ii=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=xi(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=xi(e.responseBody,e.responseHeaders,i,"Response")),e}),d=function(e){return c(function(e){var t=hr(e.name);if(!(t&&t.pathname&&Ci.some((function(e){return 0===t.pathname.indexOf(e)}))))return e}((t=e,Object.keys(null!==(n=t.requestHeaders)&&void 0!==n?n:{}).forEach((function(e){var n;Si.includes(e.toLowerCase())&&(null===(n=t.requestHeaders)||void 0===n||delete n[e])})),t)));var t,n},f=kt(e.session_recording.maskNetworkRequestFn);return f&&kt(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=kt(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({},ki),o),{},{recordHeaders:s,recordBody:u,recordPerformance:l,recordInitialRequests:l})},Fi="__ph_opt_in_out_";function Ei(e,t){Di(!0,e,t)}function Ri(e,t){Di(!1,e,t)}function Ti(e,t){return"1"===Li(e,t)}function Oi(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||rt,n=null==t?void 0:t.navigator,r=!1;return Dt([null==n?void 0:n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){$t([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===Li(e,t)}function Mi(e,t){Pi(t=t||{}).remove(Ni(e,t),!!t.crossSubdomainCookie)}function Pi(e){return"localStorage"===(e=e||{}).persistenceType?ar:"localStorage+cookie"===e.persistenceType?ur:ir}function Ni(e,t){return((t=t||{}).persistencePrefix||Fi)+e}function Li(e,t){return Pi(t).get(Ni(e,t))}function Di(e,t,n){xt(t)&&t.length?(Pi(n=n||{}).set(Ni(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 Ai(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=Oi(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 $i,qi=3e5,Hi=qi;!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"}($i||($i={}));var ji=[$i.MouseMove,$i.MouseInteraction,$i.Scroll,$i.ViewportResize,$i.Input,$i.TouchMove,$i.MediaInteraction,$i.Drag],Bi=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}},Wi="[SessionRecording]",Ui=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,"_forceAllowLocalhostNetworkCapture",!1),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,null==rt||rt.addEventListener("beforeunload",(function(){n._flushBuffer()})),null==rt||rt.addEventListener("offline",(function(){n._tryAddCustomEvent("browser offline",{})})),null==rt||rt.addEventListener("online",(function(){n._tryAddCustomEvent("browser online",{})})),!this.instance.sessionManager)throw Mt.error(Wi+" started without valid sessionManager"),new Error(Wi+" 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(Wi+" started without valid sessionManager"),new Error(Wi+" started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return Et(this._sampleRate)?this.instance.get_property(xn):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 rt&&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:"canvasRecording",get:function(){var e=this.instance.get_property(Sn);return e&&e.fps&&e.quality?{enabled:e.enabled,fps:e.fps,quality:e.quality}:void 0}},{key:"recordingVersion",get:function(){var e,t=this.instance.get_property(wn);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(kn),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?Ft(this._linkedFlag)||this._linkedFlagSeen?Rt(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this._startCapture(),Mt.info(Wi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Mt.info(Wi+" 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(Wi+" 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({},xn,r))}else{var o;null===(o=this.instance.persistence)||void 0===o||o.register(d({},xn,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===(o=e.sessionRecording)||void 0===o?void 0:o.consoleLogRecordingEnabled),d(p,wn,null===(s=e.sessionRecording)||void 0===s?void 0:s.recorderVersion),d(p,kn,a({capturePerformance:e.capturePerformance},null===(u=e.sessionRecording)||void 0===u?void 0:u.networkPayloadCapture)),d(p,Sn,{enabled:null===(l=e.sessionRecording)||void 0===l?void 0:l.recordCanvas,fps:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasFps,quality:null===(f=e.sessionRecording)||void 0===f?void 0:f.canvasQuality}),p));var v=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate;this._sampleRate=Ft(v)?null:parseFloat(v);var g,m=null===(n=e.sessionRecording)||void 0===n?void 0:n.minimumDurationMilliseconds;(this._minimumDuration=Ct(m)?null:m,this._linkedFlag=(null===(r=e.sessionRecording)||void 0===r?void 0:r.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(g=e.sessionRecording)||void 0===g?void 0:g.endpoint);if(Et(this._sampleRate)&&this.sessionManager.onSessionId((function(e){h.makeSamplingDecision(e)})),!Ft(this._linkedFlag)){var _,y,b=xt(this._linkedFlag)?this._linkedFlag:null===(_=this._linkedFlag)||void 0===_?void 0:_.flag,w=xt(this._linkedFlag)?null:null===(y=this._linkedFlag)||void 0===y?void 0:y.variant;this.instance.onFeatureFlags((function(e,t){var n=St(t)&&b in t,r=w?t[b]===w:n;r&&Mt.info(Wi+" linked flag matched",{linkedFlag:b,linkedVariant:w}),h._linkedFlagSeen=r}))}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:Ht()})}},{key:"_startCapture",value:function(){var e=this;if(!Ct(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||Ai(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?Gt(this.instance.requestRouter.endpointFor("assets","/static/".concat(t,"?v=").concat(gt.LIB_VERSION)),(function(n){if(n)return Mt.error(Wi+" could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==ji.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>Hi&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Hi}));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===[_i,yi].indexOf(e.type)&&(s||a))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(t){return Mt.warn(Wi+" 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(Bi((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(Bi((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=rt.rrweb?rt.rrweb.record:rt.rrwebRecord;for(var r=this.instance.config.session_recording,i=0,o=Object.entries(r||{});i<o.length;i++){var s=p(o[i],2),u=s[0],l=s[1];u in n&&(n[u]=l)}if(this.canvasRecording&&this.canvasRecording.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this.canvasRecording.fps},n.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new bi(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(Wi+" "+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=rt?t._maskUrl(rt.location.href):"";if(!n)return;t._tryAddCustomEvent("$pageview",{href:n}),t._tryTakeFullSnapshot()}}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}))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Mt.error(Wi+"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()}),qi)}},{key:"_gatherRRWebPlugins",value:function(){var e=[];(vt.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(vt.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&kt(vt.getRecordNetworkPlugin))&&(!pr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(vt.getRecordNetworkPlugin(Ii(this.instance.config,this.networkPayloadCapture))):Mt.info(Wi+" NetworkCapture not started because we are on localhost."));return e}},{key:"onRRwebEmit",value:function(e){if(this._processQueuedEvents(),e&&St(e)){if(e.type===wi.Meta){var t=this._maskUrl(e.data.href);if(!t)return;e.data.href=t}e.type===wi.FullSnapshot&&this._scheduleFullSnapshot();var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var r=function(e){var t=e;if(t&&St(t)&&6===t.type&&St(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||r.type===wi.Custom){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=h(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()),It(this.buffer.sessionId)&&!It(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,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings"})}}]),e}(),Vi=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={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(En),group_properties:this.instance.get_property(Rn),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({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:$n.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){return e.parseDecideResponse(t.json)}})}},{key:"parseDecideResponse",value:function(e){var t,n=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var r=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(null!=e?e:{},r),r)Mt.error("Failed to fetch feature flags from PostHog.");else{if(!lt||!lt.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),qn.afterDecideResponse(e,this.instance),this.instance._afterDecideResponse(e);var i=null==rt?void 0:rt.extendPostHogWithSurveys;e.surveys&&!i&&Gt(this.instance.requestRouter.endpointFor("assets","/static/surveys.js"),(function(e){if(e)return Mt.error("Could not load surveys script",e);rt.extendPostHogWithSurveys(n.instance)}));var o=null==rt?void 0:rt.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&Ct(o)&&Gt(this.instance.requestRouter.endpointFor("assets","/static/exception-autocapture.js"),(function(t){if(t)return Mt.error("Could not load exception autocapture script",t);rt.extendPostHogWithExceptionAutocapture(n.instance,e)})),e.siteApps)if(this.instance.config.opt_in_site_apps){var a,s=m(e.siteApps);try{var u=function(){var e=a.value,t=e.id,r=e.url,i=n.instance.requestRouter.endpointFor("api",r);vt["__$$ph_site_app_".concat(t)]=n.instance,Gt(i,(function(e){e&&Mt.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(s.s();!(a=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.')}}}]),e}(),zi=["source"],Gi=null!=rt&&rt.location?_r(rt.location.hash,"__posthog")||_r(location.hash,"state"):null,Yi=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(!rt||!lt)return!1;n=null!==(e=n)&&void 0!==e?e:rt.location,i=null!==(t=i)&&void 0!==t?t:rt.history;try{if(!r){try{rt.localStorage.setItem("test","test"),rt.localStorage.removeItem("test")}catch(e){return!1}r=null==rt?void 0:rt.localStorage}var o,a=Gi||_r(n.hash,"__posthog")||_r(n.hash,"state"),s=a?jt((function(){return JSON.parse(atob(decodeURIComponent(a)))}))||jt((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("",lt.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(!rt||vt._postHogToolbarLoaded)return!1;vt._postHogToolbarLoaded=!0;var n=3e5,r=Math.floor(Date.now()/n)*n,i=this.instance.requestRouter.endpointFor("assets","/static/toolbar.js?t=".concat(r)),o="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=a(a({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},o?{instrument:!1}:{});s.source;var u=f(s,zi);return rt.localStorage.setItem("_postHogToolbarParams",JSON.stringify(u)),Gt(i,(function(e){e?Mt.error("Failed to load toolbar",e):(vt.ph_load_toolbar||vt.ph_load_editor)(s,t.instance)})),zt(rt,"turbolinks:load",(function(){vt._postHogToolbarLoaded=!1,t.loadToolbar(s)})),!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}(),Ji=function(){function e(t){u(this,e),d(this,"isPaused",!0),d(this,"queue",[]),d(this,"flushTimeoutMs",3e3),this.sendRequest=t}return c(e,[{key:"enqueue",value:function(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var e=this;this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t);[].concat(h(n.filter((function(e){return 0===e.url.indexOf("/e")}))),h(n.filter((function(e){return 0!==e.url.indexOf("/e")})))).map((function(t){e.sendRequest(a(a({},t),{},{transport:"sendBeacon"}))}))}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((function(){if(e.clearFlushTimeout(),e.queue.length>0){var t=e.formatQueue(),n=function(n){var r=t[n],i=(new Date).getTime();r.data&&wt(r.data)&&Dt(r.data,(function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.sendRequest(r)};for(var r in t)n(r)}}),this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var e={};return Dt(this.queue,(function(t){var n,r=t,i=(r?r.batchKey:null)||r.url;Ct(e[i])&&(e[i]=a(a({},r),{},{data:[]})),null===(n=e[i].data)||void 0===n||n.push(r.data)})),this.queue=[],e}}]),e}(),Qi=Uint8Array,Xi=Uint16Array,Ki=Uint32Array,Zi=new Qi([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]),eo=new Qi([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]),to=new Qi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),no=function(e,t){for(var n=new Xi(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new Ki(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]},ro=no(Zi,2),io=ro[0],oo=ro[1];io[28]=258,oo[258]=28;for(var ao=no(eo,0)[1],so=new Xi(32768),uo=0;uo<32768;++uo){var lo=(43690&uo)>>>1|(21845&uo)<<1;lo=(61680&(lo=(52428&lo)>>>2|(13107&lo)<<2))>>>4|(3855&lo)<<4,so[uo]=((65280&lo)>>>8|(255&lo)<<8)>>>1}var co=function(e,t,n){for(var r=e.length,i=0,o=new Xi(t);i<r;++i)++o[e[i]-1];var a,s=new Xi(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new Xi(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[so[d]>>>u]=l}else for(a=new Xi(r),i=0;i<r;++i)a[i]=so[s[e[i]-1]++]>>>15-e[i];return a},fo=new Qi(288);for(uo=0;uo<144;++uo)fo[uo]=8;for(uo=144;uo<256;++uo)fo[uo]=9;for(uo=256;uo<280;++uo)fo[uo]=7;for(uo=280;uo<288;++uo)fo[uo]=8;var po=new Qi(32);for(uo=0;uo<32;++uo)po[uo]=5;var ho=co(fo,9,0),vo=co(po,5,0),go=function(e){return(e/8>>0)+(7&e&&1)},mo=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Xi?Xi:e instanceof Ki?Ki:Qi)(n-t);return r.set(e.subarray(t,n)),r},_o=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},yo=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},bo=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 Qi(0),0];if(1==i){var a=new Qi(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 Xi(f+1),h=wo(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 Qi(p),h]},wo=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},ko=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Xi(++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]},So=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Co=function(e,t,n){var r=n.length,i=go(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)},xo=function(e,t,n,r,i,o,a,s,u,l,c){_o(t,c++,n),++i[256];for(var d=bo(i,15),f=d[0],p=d[1],h=bo(o,15),v=h[0],g=h[1],m=ko(f),_=m[0],y=m[1],b=ko(v),w=b[0],k=b[1],S=new Xi(19),C=0;C<_.length;++C)S[31&_[C]]++;for(C=0;C<w.length;++C)S[31&w[C]]++;for(var x=bo(S,7),I=x[0],F=x[1],E=19;E>4&&!I[to[E-1]];--E);var R,T,O,M,P=l+5<<3,N=So(i,fo)+So(o,po)+a,L=So(i,f)+So(o,v)+a+14+3*E+So(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(P<=N&&P<=L)return Co(t,c,e.subarray(u,u+l));if(_o(t,c,1+(L<N)),c+=2,L<N){R=co(f,p,0),T=f,O=co(v,g,0),M=v;var D=co(I,F,0);_o(t,c,y-257),_o(t,c+5,k-1),_o(t,c+10,E-4),c+=14;for(C=0;C<E;++C)_o(t,c+3*C,I[to[C]]);c+=3*E;for(var A=[_,w],$=0;$<2;++$){var q=A[$];for(C=0;C<q.length;++C){var H=31&q[C];_o(t,c,D[H]),c+=I[H],H>15&&(_o(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}}else R=ho,T=fo,O=vo,M=po;for(C=0;C<s;++C)if(r[C]>255){H=r[C]>>>18&31;yo(t,c,R[H+257]),c+=T[H+257],H>7&&(_o(t,c,r[C]>>>23&31),c+=Zi[H]);var j=31&r[C];yo(t,c,O[j]),c+=M[j],j>3&&(yo(t,c,r[C]>>>5&8191),c+=eo[j])}else yo(t,c,R[r[C]]),c+=T[r[C]];return yo(t,c,R[256]),c+T[256]},Io=new Ki([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fo=new Qi(0),Eo=function(){for(var e=new Ki(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Ro=function(e,t,n,r,i){return function(e,t,n,r,i,o){var a=e.length,s=new Qi(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=Co(u,l,e.subarray(c,d)):(u[c]=o,l=Co(u,l,e.subarray(c,a)))}else{for(var f=Io[t-1],p=f>>>13,h=8191&f,v=(1<<n)-1,g=new Xi(32768),m=new Xi(v+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&v},w=new Ki(25e3),k=new Xi(288),S=new Xi(32),C=0,x=0,I=(c=0,0),F=0,E=0;c<a;++c){var R=b(c),T=32767&c,O=m[R];if(g[T]=O,m[R]=T,F<=c){var M=a-c;if((C>7e3||I>24576)&&M>423){l=xo(e,u,0,w,k,S,x,I,E,c-E,l),I=C=x=0,E=c;for(var P=0;P<286;++P)k[P]=0;for(P=0;P<30;++P)S[P]=0}var N=2,L=0,D=h,A=T-O&32767;if(M>2&&R==b(c-A))for(var $=Math.min(p,M)-1,q=Math.min(32767,c),H=Math.min(258,M);A<=q&&--D&&T!=O;){if(e[c+N]==e[c+N-A]){for(var j=0;j<H&&e[c+j]==e[c+j-A];++j);if(j>N){if(N=j,L=A,j>$)break;var B=Math.min(A,j-2),W=0;for(P=0;P<B;++P){var U=c-A+P+32768&32767,V=U-g[U]+32768&32767;V>W&&(W=V,O=U)}}}A+=(T=O)-(O=g[T])+32768&32767}if(L){w[I++]=268435456|oo[N]<<18|ao[L];var z=31&oo[N],G=31&ao[L];x+=Zi[z]+eo[G],++k[257+z],++S[G],F=c+N,++C}else w[I++]=e[c],++k[e[c]]}}l=xo(e,u,o,w,k,S,x,I,E,c-E,l),o||(l=Co(u,l,Fo))}return mo(s,0,r+go(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)},To=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Oo(e,t){void 0===t&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Eo[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,o=Ro(e,t,10+((i=t).filename&&i.filename.length+1||0),8),a=o.length;return 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&&To(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)}}(o,t),To(o,a-8,n.d()),To(o,a-4,r),o}var Mo=!!ft||!!dt,Po=function(e,t){var n=p(e.split("?"),2),r=n[0],i=n[1],o=a({},t);null==i||i.split("&").forEach((function(e){var t=p(e.split("="),1)[0];delete o[t]}));var s=gr(o);return s=s?(i?i+"&":"")+s:i,"".concat(r,"?").concat(s)},No=function(e){return"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e))},Lo=function(e){var t=e.data,n=e.compression,r=e.transport,i=e.method;if(!t)return null;if(n===$n.GZipJS){var o=Oo(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Qi(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 Qi(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 mo(r,0,i)}(JSON.stringify(t)),{mtime:0});return new Blob([o],{type:"text/plain"})}if(n===$n.Base64){var a=function(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,u=0,l="",c=[];if(!e)return e;e=Vt(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}(JSON.stringify(t));return No(a)}if("sendBeacon"===r){var s=No(t);return new Blob([s],{type:"application/x-www-form-urlencoded"})}return"POST"!==i?null:No(t)},Do=function(e){var t=new ft;t.open(e.method||"GET",e.url,!0);var n=Lo(e);Dt(e.headers,(function(e,n){t.setRequestHeader(n,e)})),"POST"===e.method&&"string"==typeof n&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.timeout&&(t.timeout=e.timeout),t.withCredentials=!0,t.onreadystatechange=function(){if(4===t.readyState){var n,r={statusCode:t.status,text:t.responseText};if(200===t.status)try{r.json=JSON.parse(t.responseText)}catch(e){}null===(n=e.callback)||void 0===n||n.call(e,r)}},t.send(n)},Ao=function(e){var t,n=Lo(e),r=new Headers;Dt(r,(function(e,t){r.append(t,e)})),"POST"===e.method&&"string"==typeof n&&r.append("Content-Type","application/x-www-form-urlencoded");var i=e.url,o=null;if(pt){var a=new pt;o={signal:a.signal,timeout:setTimeout((function(){return a.abort()}),e.timeout)}}dt(i,{method:(null==e?void 0:e.method)||"GET",headers:r,keepalive:"POST"===e.method,body:n,signal:null===(t=o)||void 0===t?void 0:t.signal}).then((function(t){return t.text().then((function(n){var r,i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(e){Mt.error(e)}null===(r=e.callback)||void 0===r||r.call(e,i)}))})).catch((function(t){var n;Mt.error(t),null===(n=e.callback)||void 0===n||n.call(e,{statusCode:0,text:t})})).finally((function(){return o?clearTimeout(o.timeout):null}))},$o=function(e){try{var t;null==rt||null===(t=rt.navigator)||void 0===t||t.sendBeacon(e.url,Lo(e))}catch(e){}},qo=function(e){var t;if(lt){var n=lt.createElement("script");n.type="text/javascript",n.async=!0,n.defer=!0,n.src=e.url;var r=lt.getElementsByTagName("script")[0];null===(t=r.parentNode)||void 0===t||t.insertBefore(n,r)}},Ho=["retriesPerformedSoFar"];var jo,Bo=function(){function e(t){var n=this;u(this,e),d(this,"isPolling",!1),d(this,"pollIntervalMs",3e3),d(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Ct(rt)&&"onLine"in rt.navigator&&(this.areWeOnline=rt.navigator.onLine,rt.addEventListener("online",(function(){n.areWeOnline=!0,n.flush()})),rt.addEventListener("offline",(function(){n.areWeOnline=!1})))}return c(e,[{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,r=f(e,Ho);Et(n)&&n>0&&(r.url=Po(r.url,{retry_count:n})),this.instance._send_request(a(a({},r),{},{callback:function(e){var i;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=n?n:0)<10?t.enqueue(a({},r)):null===(i=r.callback)||void 0===i||i.call(r,e)}}))}},{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;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=Date.now()+n;this.queue.push({retryAt:r,requestOptions: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.pollIntervalMs)}},{key:"flush",value:function(){var e=Date.now(),t=[],n=this.queue.filter((function(n){return n.retryAt<e||(t.push(n),!1)}));if(this.queue=t,n.length>0){var r,i=m(n);try{for(i.s();!(r=i.n()).done;){var o=r.value.requestOptions;this.retriableRequest(o)}}catch(e){i.e(e)}finally{i.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var e,t=m(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestOptions;try{this.instance._send_request(a(a({},n),{},{transport:"sendBeacon"}))}catch(e){Mt.error(e)}}}catch(e){t.e(e)}finally{t.f()}this.queue=[]}}]),e}(),Wo=1800,Uo=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||Xn,this._windowIdGenerator=i||Xn;var o=t.persistence_name||t.token,a=t.session_idle_timeout_seconds||Wo;if(Et(a)?a>Wo?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=Wo),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,60),Wo),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var s=fr.parse(this._window_id_storage_key),l=fr.parse(this._primary_window_exists_storage_key);s&&!l?this._windowId=s:fr.remove(this._window_id_storage_key),fr.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return c(e,[{key:"onSessionId",value:function(e){var t=this;return Ct(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&&fr.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&fr.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?fr.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({},Cn,[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[Cn];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==rt||rt.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&fr.remove(e._primary_window_exists_storage_key)}))}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),n=p(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],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}();!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(jo||(jo={}));var Vo=function(){function e(t){u(this,e),d(this,"_regionCache",{}),this.instance=t}return c(e,[{key:"apiHost",get:function(){return this.instance.config.api_host.trim().replace(/\/$/,"")}},{key:"uiHost",get:function(){var e;return null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"")}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=jo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=jo.EU:this._regionCache[this.apiHost]=jo.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return(this.uiHost||this.apiHost)+t;if(this.region===jo.CUSTOM)return this.apiHost+t;var n="i.posthog.com"+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}}]),e}(),zo=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.requestRouter.endpointFor("ui","/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,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,$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}))}})),Go=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==rt?void 0:rt.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:Yo(n/t,0,1),$prev_pageview_max_scroll:r,$prev_pageview_max_scroll_percentage:t<=1?1:Yo(r/t,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:i<=1?1:Yo(o/i,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:i<=1?1:Yo(a/i,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){null==rt||rt.addEventListener("scroll",this._updateScrollData,!0),null==rt||rt.addEventListener("scrollend",this._updateScrollData,!0),null==rt||rt.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){null==rt||rt.removeEventListener("scroll",this._updateScrollData),null==rt||rt.removeEventListener("scrollend",this._updateScrollData),null==rt||rt.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return null==rt?void 0:rt.document.documentElement;var e,t=m(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==rt?void 0:rt.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 rt&&(rt.scrollY||rt.pageYOffset||rt.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 Yo(e,t,n){return Math.max(t,Math.min(e,n))}var Jo={icontains:function(e){return!!rt&&rt.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},regex:function(e){return!!rt&&vr(rt.location.href,e)},exact:function(e){return(null==rt?void 0:rt.location.href)===e}},Qo=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(Tn);if(r&&!n)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(n){var r;if(200!==n.statusCode||!n.json)return e([]);var i=n.json.surveys||[];return null===(r=t.instance.persistence)||void 0===r||r.register(d({},Tn,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||Jo[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==lt?void 0:lt.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}(),Xo=function(){function e(){var t=this;u(this,e),d(this,"limits",{}),d(this,"checkForLimiting",(function(e){var n=e.text;if(n&&n.length)try{(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.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:n})}}))}return c(e,[{key:"isRateLimited",value:function(e){var t=this.limits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),Ko=function(){return a({initialPathName:(null==ct?void 0:ct.pathname)||"",referringDomain:vi.referringDomain()},vi.campaignParams())},Zo=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({},Nn,n))}})),this._sessionIdManager=t,this._persistence=n,this._sessionSourceParamGenerator=r||Ko,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return c(e,[{key:"_getStoredProps",value:function(){return this._persistence.props[Nn]}},{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}(),ea=["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"],ta=function(e,t){if(!e)return!1;var n=e.toLowerCase();return ea.concat(t||[]).some((function(e){var t=e.toLowerCase();return n.includes?n.includes(t):-1!==n.indexOf(t)}))},na={},ra=function(){},ia="posthog",oa=!Mo&&-1===(null==ht?void 0:ht.indexOf("MSIE"))&&-1===(null==ht?void 0:ht.indexOf("Mozilla")),aa=function(){var e,t,n;return{api_host:"https://app.posthog.com",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(t=null==lt?void 0:lt.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:ra,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==rt||null===(e=rt.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:[],property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_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,feature_flag_request_timeout_ms:3e3,on_request_error:function(e){var t="Bad HTTP status: "+e.statusCode+" "+e.text;Mt.error(t)},get_device_id:function(e){return e},_onCapture:ra,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},sa=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}(),ua=function(){function e(){var t=this;u(this,e),d(this,"webPerformance",new sa),d(this,"compression",$n.Base64),this.config=aa(),this.decideEndpointWasHit=!1,this.SentryIntegration=zo,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.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new Un(this),this.toolbar=new Yi(this),this.pageViewManager=new Go(this),this.surveys=new Qo(this),this.rateLimiter=new Xo,this.requestRouter=new Vo(this),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(t,n,r){if(r&&r!==ia){var i,o=null!==(i=na[r])&&void 0!==i?i:new e;return o._init(t,n,r),na[r]=o,na[ia][r]=o,o}return this._init(t,n,r)}},{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;if(Ct(e)||function(e){return xt(e)&&0===e.trim().length}(e))Mt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()");else{if(!this.__loaded){var u;if(this.__loaded=!0,this.config={},this._triggered_notifs=[],o.request_headers=o.request_headers||o.xhr_headers,this.set_config(At({},aa(),o,{name:s,token:e})),null!=rt&&null!==(t=rt.rrweb)&&void 0!==t&&t.record||null!=rt&&rt.rrwebRecord)this.__loaded_recorder_version=null==rt||null===(u=rt.rrweb)||void 0===u?void 0:u.version;if(this.persistence=new mi(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new mi(a(a({},this.config),{},{persistence:"sessionStorage"})),this._requestQueue=new Ji((function(e){return i._send_request(e)})),this._retryQueue=new Bo(this),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new Uo(this.config,this.persistence),this.sessionPropsManager=new Zo(this.sessionManager,this.persistence),this.sessionRecording=new Ui(this),this.sessionRecording.startRecordingIfEnabled(),this.config.disable_scroll_properties||this.pageViewManager.startMeasuringScrollPosition(),this.__autocapture=this.config.autocapture,qn._setIsAutocaptureEnabled(this),qn._isAutocaptureEnabled){this.__autocapture=this.config.autocapture;qn.enabledForProject(this.config.token,100,100)?qn.isBrowserSupported()?qn.init(this):(this.__autocapture=!1,Mt.info("Disabling Automatic Event Collection because this browser is not supported")):(this.__autocapture=!1,Mt.info("Not in active bucket: disabling Automatic Event Collection."))}if(gt.DEBUG=gt.DEBUG||this.config.debug,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"))),void 0!==(null===(n=o.bootstrap)||void 0===n?void 0:n.distinctID)){var l,c,d=this.config.get_device_id(Xn()),f=null!==(l=o.bootstrap)&&void 0!==l&&l.isIdentifiedID?d:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(c=o.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:f})}if(this._hasBootstrappedFeatureFlags()){var p,h,v=Object.keys((null===(p=o.bootstrap)||void 0===p?void 0:p.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}),{}),g=Object.keys((null===(h=o.bootstrap)||void 0===h?void 0:h.featureFlagPayloads)||{}).filter((function(e){return v[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:v,featureFlagPayloads:g})}if(!this.get_distinct_id()){var m=this.config.get_device_id(Xn());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_user_state("anonymous")}return null==rt||null===(r=rt.addEventListener)||void 0===r||r.call(rt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),o.segment?o.segment.register(this.segmentIntegration()).then((function(){i._loaded()})):this._loaded(),this}Mt.warn("You have already initialized PostHog! Re-initialising is a no-op")}}},{key:"_afterDecideResponse",value:function(e){var t;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=$t(e.supportedCompression,$n.GZipJS)?$n.GZipJS:$t(e.supportedCompression,$n.Base64)?$n.Base64:void 0),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,t=this.config.advanced_disable_decide;t||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&&setTimeout((function(){lt&&e.capture("$pageview",{title:lt.title},{send_instantly:!0})}),1),t||(new Vi(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.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||Lt(this.__request_queue,(function(t){return e._send_retriable_request(t)})),this.__request_queue=[],this._start_queue_if_opted_in()}},{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:"_send_request",value:function(e){var t=this;this.__loaded&&(oa?this.__request_queue.push(e):this.rateLimiter.isRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Po(e.url,{ip:this.config.ip?1:0}),e.headers=this.config.request_headers,function(e){var t,n=a({},e);n.timeout=n.timeout||6e4,n.url=Po(n.url,{_:(new Date).getTime().toString(),ver:gt.LIB_VERSION,compression:n.compression}),"sendBeacon"===n.transport&&null!=rt&&null!==(t=rt.navigator)&&void 0!==t&&t.sendBeacon?$o(n):"fetch"===n.transport&&dt?Ao(n):ft||!lt?Do(n):qo(n)}(a(a({},e),{},{callback:function(n){var r,i,o;(t.rateLimiter.checkForLimiting(n),n.statusCode>=400)&&(null===(i=(o=t.config).on_request_error)||void 0===i||i.call(o,n));null===(r=e.callback)||void 0===r||r.call(e,n)}}))))}},{key:"_send_retriable_request",value:function(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];Lt(e,(function(e){e&&(t=e[0],wt(t)?o.push(e):kt(e)?e.call(n):wt(e)&&"alias"===t?r.push(e):wt(e)&&-1!==t.indexOf("capture")&&kt(n[t])?o.push(e):i.push(e))}));var a=function(e,t){Lt(e,(function(e){if(wt(e[0])){var n=t;Dt(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,n){var r;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return Mt.uninitializedWarning("posthog.capture");if(!Ai(this))if(!Ct(e)&&xt(e)){if(!ht||this.config.opt_out_useragent_filter||!ta(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:Xn(),event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(i.$set=null==n?void 0:n.$set,i.$set_once=null==n?void 0:n.$set_once),(i=Ut(i,null!=n&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=(null==n?void 0:n.timestamp)||new Date,Ct(null==n?void 0:n.timestamp)||(i.properties.$event_time_override_provided=!0,i.properties.$event_time_override_system_time=new Date);var o=a(a({},i.properties.$set),i.$set);(function(e){if(St(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={method:"POST",url:null!==(r=null==n?void 0:n._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:i,compression:this.compression,batchKey:null==n?void 0:n._batchKey};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this._send_retriable_request(s):this._requestQueue.enqueue(s),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),Dt(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=vi.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=At(r,c)}if(!this.config.disable_scroll_properties){var d={};"$pageview"===e?d=this.pageViewManager.doPageView():"$pageleave"===e&&(d=this.pageViewManager.doPageLeave()),r=At(r,d)}if("$pageview"===e&&lt&&(r.title=lt.title),"$performance_event"===e){var f=this.persistence.properties();return r.distinct_id=f.distinct_id,r.$current_url=o.$current_url,r}if(!Ct(n)){var p=(new Date).getTime()-n;r.$duration=parseFloat((p/1e3).toFixed(3))}(ht&&this.config.opt_out_useragent_filter&&(r.$browser_type=ta(ht,this.config.custom_blocked_useragents)?"bot":"browser"),r=At({},vi.properties(),this.persistence.properties(),this.sessionPersistence.properties(),r),wt(this.config.property_denylist)&&wt(this.config.property_blacklist))?Dt([].concat(h(this.config.property_blacklist),h(this.config.property_denylist)),(function(e){delete r[e]})):Mt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);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(Et(e)&&(e=e.toString(),Mt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),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(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(On))}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(Xn());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.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionId,r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/replay/"+n);if(null!=e&&e.withTimestamp&&r){var o,a=null!==(o=e.timestampLookBack)&&void 0!==o?o:10;if(!r)return i;var s=Math.max(Math.floor(((new Date).getTime()-r)/1e3)-a,0);i+="?t=".concat(s)}return i}},{key:"alias",value:function(e,t){return e===this.get_property(vn)?(Mt.critical("Attempting to create alias for existing People user - aborting."),-2):(Ct(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(gn,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=a({},this.config);if(St(e)&&(At(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),null===(t=this.persistence)||void 0===t||t.update_config(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new mi(a(a({},this.config),{},{persistence:"sessionStorage"})),ar.is_supported()&&"true"===ar.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(gt.DEBUG=!0),this.sessionRecording&&!Ct(e.disable_session_recording))){var r=n.disable_session_recording!==e.disable_session_recording,i=!Ai(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(r||i)&&(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:ia;return t!==ia&&(t=ia+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.config.opt_out_capturing_persistence_type&&ar.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&&!ir.get("ph_optout")||(ir.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=At({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||{}),ar.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=At({enable_persistence:!0},e||{}),this._gdpr_call_func(Ei,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=At({clear_persistence:!0},e||{});this._gdpr_call_func(Ri,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Ti,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Oi,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=At({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(Mi,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(null==rt||rt.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==rt||rt.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]]=Bt(e.prototype[t[n]])}(ua,["identify"]);var la,ca;la=na[ia]=new ua,(ca=vt.posthog)&&Dt(ca._i,(function(e){if(e&&wt(e)){var t=la.init(e[0],e[1],e[2]),n=ca[e[2]]||ca;t&&(t._execute_array.call(t.people,n.people),t._execute_array(n))}})),vt.posthog=la,function(){function e(){e.done||(e.done=!0,oa=!1,Dt(na,(function(e){e._dom_loaded()})))}null!=lt&&lt.addEventListener&&("complete"===lt.readyState?e():lt.addEventListener("DOMContentLoaded",e,!1)),rt&&zt(rt,"load",e,!0)}()}();
16
16
  //# sourceMappingURL=array.full.js.map