posthog-js 1.187.1 → 1.187.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.js +1 -10
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -10
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -10
  9. package/dist/array.js.map +1 -1
  10. package/dist/array.no-external.js +1 -10
  11. package/dist/array.no-external.js.map +1 -1
  12. package/dist/dead-clicks-autocapture.js +1 -1
  13. package/dist/dead-clicks-autocapture.js.map +1 -1
  14. package/dist/exception-autocapture.js +1 -1
  15. package/dist/exception-autocapture.js.map +1 -1
  16. package/dist/external-scripts-loader.js +1 -1
  17. package/dist/external-scripts-loader.js.map +1 -1
  18. package/dist/main.js +1 -10
  19. package/dist/main.js.map +1 -1
  20. package/dist/module.full.js +1 -10
  21. package/dist/module.full.js.map +1 -1
  22. package/dist/module.full.no-external.js +1 -10
  23. package/dist/module.full.no-external.js.map +1 -1
  24. package/dist/module.js +1 -10
  25. package/dist/module.js.map +1 -1
  26. package/dist/module.no-external.js +1 -10
  27. package/dist/module.no-external.js.map +1 -1
  28. package/dist/recorder-v2.js +1 -1
  29. package/dist/recorder-v2.js.map +1 -1
  30. package/dist/recorder.js +1 -1
  31. package/dist/recorder.js.map +1 -1
  32. package/dist/surveys-preview.js +1 -1
  33. package/dist/surveys-preview.js.map +1 -1
  34. package/dist/surveys.js +1 -1
  35. package/dist/surveys.js.map +1 -1
  36. package/dist/tracing-headers.js +1 -1
  37. package/dist/tracing-headers.js.map +1 -1
  38. package/dist/web-vitals.js +1 -1
  39. package/dist/web-vitals.js.map +1 -1
  40. package/lib/package.json +1 -1
  41. package/package.json +1 -1
@@ -1,11 +1,2 @@
1
- !function(){"use strict";var e,t=Object.defineProperty,n=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i),i=Object.defineProperty,r=(e,t,n)=>((e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),o=(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))(o||{});const s={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},a={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},l=e=>{if(!(e=>"function"==typeof e)(e))return!1;return Object.getOwnPropertyNames(e.prototype||{}).some((e=>e.indexOf("__zone")))},c={};function u(e){if(c[e])return c[e];const t=globalThis[e],n=t.prototype,i=e in s?s[e]:void 0,r=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),o=e in a?a[e]:void 0,u=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(r&&u&&!l(t))return c[e]=t.prototype,t.prototype;try{const i=document.createElement("iframe");document.body.appendChild(i);const r=i.contentWindow;if(!r)return t.prototype;const o=r[e].prototype;return document.body.removeChild(i),o?c[e]=o:n}catch{return n}}const d={};function h(e,t,n){var i;const r=`${e}.${String(n)}`;if(d[r])return d[r].call(t);const o=u(e),s=null==(i=Object.getOwnPropertyDescriptor(o,n))?void 0:i.get;return s?(d[r]=s,s.call(t)):t[n]}const p={};function g(e,t,n){const i=`${e}.${String(n)}`;if(p[i])return p[i].bind(t);const r=u(e)[n];return"function"!=typeof r?t[n]:(p[i]=r,r.bind(t))}const f={childNodes:function(e){return h("Node",e,"childNodes")},parentNode:function(e){return h("Node",e,"parentNode")},parentElement:function(e){return h("Node",e,"parentElement")},textContent:function(e){return h("Node",e,"textContent")},contains:function(e,t){return g("Node",e,"contains")(t)},getRootNode:function(e){return g("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?h("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?h("Element",e,"shadowRoot"):null},querySelector:function(e,t){return h("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return h("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return u("MutationObserver").constructor}};function m(e){return e.nodeType===e.ELEMENT_NODE}function _(e){const t=e&&"host"in e&&"mode"in e&&f.host(e)||null;return Boolean(t&&"shadowRoot"in t&&f.shadowRoot(t)===e)}function v(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function y(e){try{const n=e.rules||e.cssRules;if(!n)return null;const i=Array.from(n,(t=>b(t,e.href))).join("");return(t=i).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function b(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=y(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?N(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(n)),t?N(n,t):n}}function w(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}let S=class{constructor(){r(this,"idNodeMap",new Map),r(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const n=null==(t=this.getMeta(e))?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function C(e){let{element:t,maskInputOptions:n,tagName:i,type:r,value:o,maskInputFn:s}=e,a=o||"";const l=r&&I(r);return(n[i.toLowerCase()]||l&&n[l])&&(a=s?s(a,t):"*".repeat(a.length)),a}function I(e){return e.toLowerCase()}const k="__rrweb_original__";function E(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?I(t):null}function x(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const r=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==r?void 0:r[1])&&void 0!==n?n:null}const T=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,M=/^(?:[a-z+]+:)?\/\//i,R=/^www\..*/i,A=/^(data:)([^,]*),(.*)/i;function N(e,t){return(e||"").replace(T,((e,n,i,r,o,s)=>{const a=i||o||s,l=n||r||"";if(!a)return e;if(M.test(a)||R.test(a))return`url(${l}${a}${l})`;if(A.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`}))}let F=1;const O=new RegExp("[^a-z0-9-_:]"),L=-2;function P(){return F++}let D,$;const B=/^[^ \t\n\r\u000c]+/,H=/^[, \t\n\r\u000c]+/;const q=new WeakMap;function W(e,t){return t&&""!==t.trim()?Z(e,t):t}function V(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Z(e,t){let n=q.get(e);if(n||(n=e.createElement("a"),q.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function G(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?W(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function i(e){let i;const r=e.exec(t.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(H),!(n>=t.length);){let o=i(B);if(","===o.slice(-1))o=W(e,o.substring(0,o.length-1)),r.push(o);else{let i="";o=W(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){r.push((o+i).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,r.push((o+i).trim());break}"("===e&&(s=!0)}i+=e,n+=1}}}return r.join(", ")}(e,i):"style"===n?N(i,Z(e)):"object"===t&&"data"===n?W(e,i):i:W(e,i):i}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function z(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&z(f.parentNode(e),t,n);for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return!!n&&z(f.parentNode(e),t,n)}function j(e,t,n,i){let r;if(m(e)){if(r=e,!f.childNodes(r).length)return!1}else{if(null===f.parentElement(e))return!1;r=f.parentElement(e)}try{if("string"==typeof t){if(i){if(r.closest(`.${t}`))return!0}else if(r.classList.contains(t))return!0}else if(z(r,t,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(e){}return!1}function Y(e,t){const{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:u,maskInputFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:_=!1}=t,v=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:o.Document,childNodes:[],compatMode:e.compatMode}:{type:o.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:o.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:i,blockSelector:r,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:u,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:g}=t,m=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,i,r),_=function(e){if(e instanceof HTMLFormElement)return"form";const t=I(e.tagName);return O.test(t)?"div":t}(e);let v={};const b=e.attributes.length;for(let t=0;t<b;t++){const i=e.attributes[t];U(_,i.name,i.value)||(v[i.name]=G(n,_,I(i.name),i.value))}if("link"===_&&s){const t=e.href;let i=w(n,t);if(!i&&t.includes(".css")){i=w(n,window.location.origin+"/"+t.replace(window.location.href,""))}let r=null;i&&(r=y(i)),r&&(delete v.rel,delete v.href,v._cssText=r)}if("style"===_&&e.sheet&&!(e.innerText||f.textContent(e)||"").trim().length){const t=y(e.sheet);t&&(v._cssText=t)}if("input"===_||"textarea"===_||"select"===_){const t=e.value,n=e.checked;"radio"!==v.type&&"checkbox"!==v.type&&"submit"!==v.type&&"button"!==v.type&&t?v.value=C({element:e,type:E(e),tagName:_,value:t,maskInputOptions:a,maskInputFn:l}):n&&(v.checked=n)}"option"===_&&(e.selected&&!a.select?v.selected=!0:delete v.selected);"dialog"===_&&e.open&&(v.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===_&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const r=t.getImageData,o=k in r?r[k]:r;if(new Uint32Array(o.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(v.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),i=n.createElement("canvas");i.width=e.width,i.height=e.height;t!==i.toDataURL(c.type,c.quality)&&(v.rr_dataURL=t)}if("img"===_&&u){D||(D=n.createElement("canvas"),$=D.getContext("2d"));const t=e,i=t.currentSrc||t.getAttribute("src")||"<unknown-src>",r=t.crossOrigin,o=()=>{t.removeEventListener("load",o);try{D.width=t.naturalWidth,D.height=t.naturalHeight,$.drawImage(t,0,0),v.rr_dataURL=D.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${i}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(r?v.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===_||"video"===_){const t=v;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop));if(m){const{width:t,height:n}=e.getBoundingClientRect();v={class:v.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==_||h(v.src)||(e.contentDocument||(v.rr_src=v.src),delete v.src);let S;try{customElements.get(_)&&(S=!0)}catch(e){}return{type:o.Element,tagName:_,attributes:v,childNodes:[],isSVG:V(e)||void 0,needBlock:m,rootId:g,isCustom:S}}(e,{doc:n,blockClass:r,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:d,dataURLOptions:h,inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:_,rootId:v});case e.TEXT_NODE:return function(e,t){var n;const{needsMask:i,maskTextFn:r,rootId:s}=t,a=f.parentNode(e),l=a&&a.tagName;let c=f.textContent(e);const u="STYLE"===l||void 0,d="SCRIPT"===l||void 0;if(u&&c){try{e.nextSibling||e.previousSibling||(null==(n=a.sheet)?void 0:n.cssRules)&&(c=y(a.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}c=N(c,Z(t.doc))}d&&(c="SCRIPT_PLACEHOLDER");!u&&!d&&c&&i&&(c=r?r(c,f.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:o.Text,textContent:c||"",isStyle:u,rootId:s}}(e,{doc:n,needsMask:a,maskTextFn:u,rootId:v});case e.CDATA_SECTION_NODE:return{type:o.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:o.Comment,textContent:f.textContent(e)||"",rootId:v};default:return!1}}function X(e){return null==e?"":e.toLowerCase()}function J(e,t){const{doc:n,mirror:i,blockClass:r,blockSelector:s,maskTextClass:a,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:y={},inlineImages:b=!1,recordCanvas:w=!1,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:I=5e3,onStylesheetLoad:k,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:T=(()=>!1),newlyAddedElement:M=!1}=t;let{needsMask:R}=t,{preserveWhiteSpace:A=!0}=t;if(!R){R=j(e,a,l,void 0===R)}const N=Y(e,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:R,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,dataURLOptions:y,inlineImages:b,recordCanvas:w,keepIframeSrcFn:T,newlyAddedElement:M});if(!N)return console.warn(e,"not serialized"),null;let F;F=i.hasNode(e)?i.getId(e):!function(e,t){if(t.comment&&e.type===o.Comment)return!0;if(e.type===o.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===x(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(X(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===X(e.attributes.name)||"icon"===X(e.attributes.rel)||"apple-touch-icon"===X(e.attributes.rel)||"shortcut icon"===X(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&X(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(X(e.attributes.property).match(/^(og|twitter|fb):/)||X(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===X(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===X(e.attributes.name)||"googlebot"===X(e.attributes.name)||"bingbot"===X(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===X(e.attributes.name)||"generator"===X(e.attributes.name)||"framework"===X(e.attributes.name)||"publisher"===X(e.attributes.name)||"progid"===X(e.attributes.name)||X(e.attributes.property).match(/^article:/)||X(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===X(e.attributes.name)||"yandex-verification"===X(e.attributes.name)||"csrf-token"===X(e.attributes.name)||"p:domain_verify"===X(e.attributes.name)||"verify-v1"===X(e.attributes.name)||"verification"===X(e.attributes.name)||"shopify-checkout-api-token"===X(e.attributes.name)))return!0}}return!1}(N,g)&&(A||N.type!==o.Text||N.isStyle||N.textContent.replace(/^\s+|\s+$/gm,"").length)?P():L;const O=Object.assign(N,{id:F});if(i.add(e,O),F===L)return null;S&&S(e);let D=!c;if(O.type===o.Element){D=D&&!O.needBlock,delete O.needBlock;const t=f.shadowRoot(e);t&&v(t)&&(O.isShadowHost=!0)}if((O.type===o.Document||O.type===o.Element)&&D){g.headWhitespace&&O.type===o.Element&&"head"===O.tagName&&(A=!1);const t={doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:R,maskTextClass:a,maskTextSelector:l,skipChild:c,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:y,inlineImages:b,recordCanvas:w,preserveWhiteSpace:A,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:I,onStylesheetLoad:k,stylesheetLoadTimeout:E,keepIframeSrcFn:T};if(O.type===o.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const n of Array.from(f.childNodes(e))){const e=J(n,t);e&&O.childNodes.push(e)}let _=null;if(m(e)&&(_=f.shadowRoot(e)))for(const e of Array.from(f.childNodes(_))){const n=J(e,t);n&&(v(_)&&(n.isShadow=!0),O.childNodes.push(n))}}const $=f.parentNode(e);return $&&_($)&&v($)&&(O.isShadow=!0),O.type===o.Element&&"iframe"===O.tagName&&function(e,t,n){const i=e.contentWindow;if(!i)return;let r,o=!1;try{r=i.document.readyState}catch(e){return}if("complete"!==r){const i=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),o=!0,t()}))}const s="about:blank";if(i.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&C){const n=J(t,{doc:t,mirror:i,blockClass:r,blockSelector:s,needsMask:R,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:y,inlineImages:b,recordCanvas:w,preserveWhiteSpace:A,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:I,onStylesheetLoad:k,stylesheetLoadTimeout:E,keepIframeSrcFn:T});n&&C(e,n)}}),I),O.type===o.Element&&"link"===O.tagName&&"string"==typeof O.attributes.rel&&("stylesheet"===O.attributes.rel||"preload"===O.attributes.rel&&"string"==typeof O.attributes.href&&"css"===x(O.attributes.href))&&function(e,t,n){let i,r=!1;try{i=e.sheet}catch(e){return}if(i)return;const o=setTimeout((()=>{r||(t(),r=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),r=!0,t()}))}(e,(()=>{if(k){const t=J(e,{doc:n,mirror:i,blockClass:r,blockSelector:s,needsMask:R,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:y,inlineImages:b,recordCanvas:w,preserveWhiteSpace:A,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:I,onStylesheetLoad:k,stylesheetLoadTimeout:E,keepIframeSrcFn:T});t&&k(e,t)}}),E),O}let K=class e{constructor(){__publicField2(this,"parentElement",null),__publicField2(this,"parentNode",null),__publicField2(this,"ownerDocument"),__publicField2(this,"firstChild",null),__publicField2(this,"lastChild",null),__publicField2(this,"previousSibling",null),__publicField2(this,"nextSibling",null),__publicField2(this,"ELEMENT_NODE",1),__publicField2(this,"TEXT_NODE",3),__publicField2(this,"nodeType"),__publicField2(this,"nodeName"),__publicField2(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};const Q={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ee={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},te={};function ne(e){if(te[e])return te[e];const t=globalThis[e],n=t.prototype,i=e in Q?Q[e]:void 0,r=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),o=e in ee?ee[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(r&&s&&!l(t))return te[e]=t.prototype,t.prototype;try{const i=document.createElement("iframe");document.body.appendChild(i);const r=i.contentWindow;if(!r)return t.prototype;const o=r[e].prototype;return document.body.removeChild(i),o?te[e]=o:n}catch{return n}}const ie={};function re(e,t,n){var i;const r=`${e}.${String(n)}`;if(ie[r])return ie[r].call(t);const o=ne(e),s=null==(i=Object.getOwnPropertyDescriptor(o,n))?void 0:i.get;return s?(ie[r]=s,s.call(t)):t[n]}const oe={};function se(e,t,n){const i=`${e}.${String(n)}`;if(oe[i])return oe[i].bind(t);const r=ne(e)[n];return"function"!=typeof r?t[n]:(oe[i]=r,r.bind(t))}function ae(){return ne("MutationObserver").constructor}const le={childNodes:function(e){return re("Node",e,"childNodes")},parentNode:function(e){return re("Node",e,"parentNode")},parentElement:function(e){return re("Node",e,"parentElement")},textContent:function(e){return re("Node",e,"textContent")},contains:function(e,t){return se("Node",e,"contains")(t)},getRootNode:function(e){return se("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?re("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?re("Element",e,"shadowRoot"):null},querySelector:function(e,t){return re("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return re("Element",e,"querySelectorAll")(t)},mutationObserver:ae};function ce(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const ue="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.";let de={map:{},getId:()=>(console.error(ue),-1),getNode:()=>(console.error(ue),null),removeNodeFromMap(){console.error(ue)},has:()=>(console.error(ue),!1),reset(){console.error(ue)}};function he(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=null,r=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];const l=Date.now();r||!1!==n.leading||(r=l);const c=t-(l-r),u=this;c<=0||c>t?(i&&(clearTimeout(i),i=null),r=l,e.apply(u,s)):i||!1===n.trailing||(i=setTimeout((()=>{r=!1===n.leading?0:Date.now(),i=null,e.apply(u,s)}),c))}}function pe(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window;const o=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>pe(e,t,o||{},!0)}function ge(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=r,()=>{e[t]=i}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(de=new Proxy(de,{get:(e,t,n)=>("map"===t&&console.error(ue),Reflect.get(e,t,n))}));let fe=Date.now;function me(e){var t,n,i,r;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=le.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(i=le.parentElement(o.body))?void 0:i.scrollTop)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollTop)||0}}function _e(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ve(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ye(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:le.parentElement(e)}function be(e,t,n,i){if(!e)return!1;const r=ye(e);if(!r)return!1;try{if("string"==typeof t){if(r.classList.contains(t))return!0;if(i&&null!==r.closest("."+t))return!0}else if(z(r,t,i))return!0}catch(e){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function we(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||t.getId(e)===L}function Se(e,t){if(_(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const i=le.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Se(i,t))}function Ce(e){return Boolean(e.changedTouches)}function Ie(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ke(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Ee(e){return!!e&&(e instanceof K&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(le.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(fe=()=>(new Date).getTime());let xe=class{constructor(){n(this,"id",1),n(this,"styleIDMap",new WeakMap),n(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Te(e){var t;let n=null;return"getRootNode"in e&&(null==(t=le.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&le.host(le.getRootNode(e))&&(n=le.host(le.getRootNode(e))),n}function Me(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=Te(n);)n=t;return n}(e);return le.contains(t,n)}function Re(e){const t=e.ownerDocument;return!!t&&(le.contains(t,e)||Me(e))}var Ae=(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",e))(Ae||{}),Ne=(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",e[e.CustomElement=16]="CustomElement",e))(Ne||{}),Fe=(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",e))(Fe||{}),Oe=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Oe||{}),Le=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Le||{}),Pe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Pe||{});function De(e){return"__ln"in e}class $e{constructor(){n(this,"length",0),n(this,"head",null),n(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&De(e.previousSibling)){const 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&&De(e.nextSibling)&&e.nextSibling.__ln.previous){const 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;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Be=(e,t)=>`${e}@${t}`;class He{constructor(){n(this,"frozen",!1),n(this,"locked",!1),n(this,"texts",[]),n(this,"attributes",[]),n(this,"attributeMap",new WeakMap),n(this,"removes",[]),n(this,"mapRemoves",[]),n(this,"movedMap",{}),n(this,"addedSet",new Set),n(this,"movedSet",new Set),n(this,"droppedSet",new Set),n(this,"mutationCb"),n(this,"blockClass"),n(this,"blockSelector"),n(this,"maskTextClass"),n(this,"maskTextSelector"),n(this,"inlineStylesheet"),n(this,"maskInputOptions"),n(this,"maskTextFn"),n(this,"maskInputFn"),n(this,"keepIframeSrcFn"),n(this,"recordCanvas"),n(this,"inlineImages"),n(this,"slimDOMOptions"),n(this,"dataURLOptions"),n(this,"doc"),n(this,"mirror"),n(this,"iframeManager"),n(this,"stylesheetManager"),n(this,"shadowDomManager"),n(this,"canvasManager"),n(this,"processedNodeManager"),n(this,"unattachedDoc"),n(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),n(this,"emit",(()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new $e,i=e=>{let t=e,n=L;for(;n===L;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{const o=le.parentNode(r);if(!o||!Re(r)||"TEXTAREA"===o.tagName)return;const s=_(o)?this.mirror.getId(Te(r)):this.mirror.getId(o),a=i(r);if(-1===s||-1===a)return n.addNode(r);const l=J(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Ie(e,this.mirror)&&this.iframeManager.addIframe(e),ke(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Ee(r)&&this.shadowDomManager.addShadowRoot(le.shadowRoot(r),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:s,nextId:a,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)We(this.removes,e,this.mirror)&&!this.movedSet.has(le.parentNode(e))||r(e);for(const e of this.addedSet)Ve(this.droppedSet,e)||We(this.removes,e,this.mirror)?Ve(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(le.parentNode(o.value)),n=i(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(le.parentNode(n.value));if(-1===i(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,i=le.parentNode(t);if(i&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=le.host(i);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),r(e.value)}const s={texts:this.texts.map((e=>{const t=e.node,n=le.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))})),n(this,"genTextAreaValueMutation",(e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(le.childNodes(e),(e=>le.textContent(e)||"")).join("")})),n(this,"processMutation",(e=>{if(!we(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=le.textContent(e.target);be(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:j(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ye(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){const e=E(t);i=C({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(be(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let r=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(t.contentDocument)return;n="rr_src"}if(r||(r={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e.target,r)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!U(t.tagName,n))if(r.attributes[n]=G(this.doc,I(t.tagName),I(n),i),"style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const i=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);i!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?r.styleDiff[e]=""===o?i:[i,o]:r._unchangedStyles[e]=[i,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r.styleDiff[e]=!1)}else"open"===n&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?r.attributes.rr_open_mode="modal":r.attributes.rr_open_mode="non-modal");break}case"childList":if(be(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=_(e.target)?this.mirror.getId(le.host(e.target)):this.mirror.getId(e.target);be(e.target,this.blockClass,this.blockSelector,!1)||we(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(qe(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Se(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Be(n,i)]?qe(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!_(e.target)||!v(e.target))||void 0})),this.mapRemoves.push(t))}))}})),n(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(we(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Be(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);be(e,this.blockClass,this.blockSelector,!1)||(le.childNodes(e).forEach((e=>this.genAdds(e))),Ee(e)&&le.childNodes(le.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function qe(e,t){e.delete(t),le.childNodes(t).forEach((t=>qe(e,t)))}function We(e,t,n){return 0!==e.length&&function(e,t,n){let i=le.parentNode(t);for(;i;){const t=n.getId(i);if(e.some((e=>e.id===t)))return!0;i=le.parentNode(i)}return!1}(e,t,n)}function Ve(e,t){return 0!==e.size&&Ze(e,t)}function Ze(e,t){const n=le.parentNode(t);return!!n&&(!!e.has(n)||Ze(e,n))}let Ge;const Ue=e=>{if(!Ge)return e;return function(){try{return e(...arguments)}catch(e){if(Ge&&!0===Ge(e))return;throw e}}},ze=[];function je(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Ye(e,t){const n=new He;ze.push(n),n.init(e);const i=new(ae())(Ue(n.processMutations.bind(n)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Xe(e){let{mouseInteractionCb:t,doc:n,mirror:i,blockClass:r,blockSelector:o,sampling:s}=e;if(!1===s.mouseInteraction)return()=>{};const a=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,l=[];let c=null;return Object.keys(Fe).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{let s=I(e);const a=(e=>n=>{const s=je(n);if(be(s,r,o,!0))return;let a=null,l=e;if("pointerType"in n){switch(n.pointerType){case"mouse":a=Oe.Mouse;break;case"touch":a=Oe.Touch;break;case"pen":a=Oe.Pen}a===Oe.Touch?Fe[e]===Fe.MouseDown?l="TouchStart":Fe[e]===Fe.MouseUp&&(l="TouchEnd"):Oe.Pen}else Ce(n)&&(a=Oe.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Oe.Touch||l.startsWith("Mouse")&&a===Oe.Mouse)&&(a=null)):Fe[e]===Fe.Click&&(a=c,c=null);const u=Ce(n)?n.changedTouches[0]:n;if(!u)return;const d=i.getId(s),{clientX:h,clientY:p}=u;Ue(t)({type:Fe[l],id:d,x:h,y:p,...null!==a&&{pointerType:a}})})(e);if(window.PointerEvent)switch(Fe[e]){case Fe.MouseDown:case Fe.MouseUp:s=s.replace("mouse","pointer");break;case Fe.TouchStart:case Fe.TouchEnd:return}l.push(ce(s,a,n))})),Ue((()=>{l.forEach((e=>e()))}))}function Je(e){let{scrollCb:t,doc:n,mirror:i,blockClass:r,blockSelector:o,sampling:s}=e;return ce("scroll",Ue(he(Ue((e=>{const s=je(e);if(!s||be(s,r,o,!0))return;const a=i.getId(s);if(s===n&&n.defaultView){const e=me(n.defaultView);t({id:a,x:e.left,y:e.top})}else t({id:a,x:s.scrollLeft,y:s.scrollTop})})),s.scroll||100)),n)}const Ke=["INPUT","TEXTAREA","SELECT"],Qe=new WeakMap;function et(e){return function(e,t){if(rt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||rt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||rt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||rt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function tt(e,t,n){let i,r;return e?(e.ownerNode?i=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:i}):{}}function nt(e,t){let{mirror:n,stylesheetManager:i}=e;var r,o,s;let a=null;a="#document"===t.nodeName?n.getId(t):n.getId(le.host(t));const l="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(s=null==(o=t.ownerDocument)?void 0:o.defaultView)?void 0:s.ShadowRoot,c=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&l&&c?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null==(e=c.get)?void 0:e.call(this)},set(e){var t;const n=null==(t=c.set)?void 0:t.call(this,e);if(null!==a&&-1!==a)try{i.adoptStyleSheets(e,a)}catch(e){}return n}}),Ue((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function it(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.doc.defaultView;if(!n)return()=>{};let i;!function(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:g}=e;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),n(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),r(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),o(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),s(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),c(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),u(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),d(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),g(...arguments)}}(e,t),e.recordDOM&&(i=Ye(e,e.doc));const r=function(e){let{mousemoveCb:t,sampling:n,doc:i,mirror:r}=e;if(!1===n.mousemove)return()=>{};const o="number"==typeof n.mousemove?n.mousemove:50,s="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500;let a,l=[];const c=he(Ue((e=>{const n=Date.now()-a;t(l.map((e=>(e.timeOffset-=n,e))),e),l=[],a=null})),s),u=Ue(he(Ue((e=>{const t=je(e),{clientX:n,clientY:i}=Ce(e)?e.changedTouches[0]:e;a||(a=fe()),l.push({x:n,y:i,id:r.getId(t),timeOffset:fe()-a}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ne.Drag:e instanceof MouseEvent?Ne.MouseMove:Ne.TouchMove)})),o,{trailing:!1})),d=[ce("mousemove",u,i),ce("touchmove",u,i),ce("drag",u,i)];return Ue((()=>{d.forEach((e=>e()))}))}(e),o=Xe(e),s=Je(e),a=function(e,t){let{viewportResizeCb:n}=e,{win:i}=t,r=-1,o=-1;return ce("resize",Ue(he(Ue((()=>{const e=_e(),t=ve();r===e&&o===t||(n({width:Number(t),height:Number(e)}),r=e,o=t)})),200)),i)}(e,{win:n}),l=function(e){let{inputCb:t,doc:n,mirror:i,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:u,userTriggeredOnInput:d}=e;function h(e){let t=je(e);const i=e.isTrusted,u=t&&t.tagName;if(t&&"OPTION"===u&&(t=le.parentElement(t)),!t||!u||Ke.indexOf(u)<0||be(t,r,o,!0))return;if(t.classList.contains(s)||a&&t.matches(a))return;let h=t.value,g=!1;const f=E(t)||"";"radio"===f||"checkbox"===f?g=t.checked:(l[u.toLowerCase()]||l[f])&&(h=C({element:t,maskInputOptions:l,tagName:u,type:f,value:h,maskInputFn:c})),p(t,d?{text:h,isChecked:g,userTriggered:i}:{text:h,isChecked:g});const m=t.name;"radio"===f&&m&&g&&n.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{if(e!==t){const t=e.value;p(e,d?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}}))}function p(e,n){const r=Qe.get(e);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){Qe.set(e,n);const r=i.getId(e);Ue(t)({...n,id:r})}}const g=("last"===u.input?["change"]:["input","change"]).map((e=>ce(e,Ue(h),n))),f=n.defaultView;if(!f)return()=>{g.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),_=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&g.push(..._.map((e=>pe(e[0],e[1],{set(){Ue(h)({target:this,isTrusted:!1})}},!1,f)))),Ue((()=>{g.forEach((e=>e()))}))}(e),c=function(e){let{mediaInteractionCb:t,blockClass:n,blockSelector:i,mirror:r,sampling:o,doc:s}=e;const a=Ue((e=>he(Ue((o=>{const s=je(o);if(!s||be(s,n,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=s;t({type:e,id:r.getId(s),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})})),o.media||500))),l=[ce("play",a(Pe.Play),s),ce("pause",a(Pe.Pause),s),ce("seeked",a(Pe.Seeked),s),ce("volumechange",a(Pe.VolumeChange),s),ce("ratechange",a(Pe.RateChange),s)];return Ue((()=>{l.forEach((e=>e()))}))}(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=function(e,t){let{styleSheetRuleCb:n,mirror:i,stylesheetManager:r}=e,{win:o}=t;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};const s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Ue(((e,t,o)=>{const[s,a]=o,{id:l,styleId:c}=tt(t,i,r.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:s,index:a}]}),e.apply(t,o)}))}),o.CSSStyleSheet.prototype.addRule=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.cssRules.length;const i=`${e} { ${t} }`;return o.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};const a=o.CSSStyleSheet.prototype.deleteRule;let l,c;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:Ue(((e,t,o)=>{const[s]=o,{id:a,styleId:l}=tt(t,i,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:s}]}),e.apply(t,o)}))}),o.CSSStyleSheet.prototype.removeRule=function(e){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},o.CSSStyleSheet.prototype.replace&&(l=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Ue(((e,t,o)=>{const[s]=o,{id:a,styleId:l}=tt(t,i,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replace:s}),e.apply(t,o)}))})),o.CSSStyleSheet.prototype.replaceSync&&(c=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:Ue(((e,t,o)=>{const[s]=o,{id:a,styleId:l}=tt(t,i,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replaceSync:s}),e.apply(t,o)}))}));const u={};ot("CSSGroupingRule")?u.CSSGroupingRule=o.CSSGroupingRule:(ot("CSSMediaRule")&&(u.CSSMediaRule=o.CSSMediaRule),ot("CSSConditionRule")&&(u.CSSConditionRule=o.CSSConditionRule),ot("CSSSupportsRule")&&(u.CSSSupportsRule=o.CSSSupportsRule));const d={};return Object.entries(u).forEach((e=>{let[t,o]=e;d[t]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Ue(((e,t,o)=>{const[s,a]=o,{id:l,styleId:c}=tt(t.parentStyleSheet,i,r.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:s,index:[...et(t),a||0]}]}),e.apply(t,o)}))}),o.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Ue(((e,t,o)=>{const[s]=o,{id:a,styleId:l}=tt(t.parentStyleSheet,i,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:[...et(t),s]}]}),e.apply(t,o)}))})})),Ue((()=>{o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=a,l&&(o.CSSStyleSheet.prototype.replace=l),c&&(o.CSSStyleSheet.prototype.replaceSync=c),Object.entries(u).forEach((e=>{let[t,n]=e;n.prototype.insertRule=d[t].insertRule,n.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:n}),d=nt(e,e.doc),h=function(e,t){let{styleDeclarationCb:n,mirror:i,ignoreCSSAttributes:r,stylesheetManager:o}=e,{win:s}=t;const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Ue(((e,t,s)=>{var l;const[c,u,d]=s;if(r.has(c))return a.apply(t,[c,u,d]);const{id:h,styleId:p}=tt(null==(l=t.parentRule)?void 0:l.parentStyleSheet,i,o.styleMirror);return(h&&-1!==h||p&&-1!==p)&&n({id:h,styleId:p,set:{property:c,value:u,priority:d},index:et(t.parentRule)}),e.apply(t,s)}))});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ue(((e,t,s)=>{var a;const[c]=s;if(r.has(c))return l.apply(t,[c]);const{id:u,styleId:d}=tt(null==(a=t.parentRule)?void 0:a.parentStyleSheet,i,o.styleMirror);return(u&&-1!==u||d&&-1!==d)&&n({id:u,styleId:d,remove:{property:c},index:et(t.parentRule)}),e.apply(t,s)}))}),Ue((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:n}),e.collectFonts&&(p=function(e){let{fontCb:t,doc:n}=e;const i=n.defaultView;if(!i)return()=>{};const r=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(e,t,n){const i=new s(e,t,n);return o.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const a=ge(n.fonts,"add",(function(e){return function(n){return setTimeout(Ue((()=>{const e=o.get(n);e&&(t(e),o.delete(n))})),0),e.apply(this,[n])}}));return r.push((()=>{i.FontFace=s})),r.push(a),Ue((()=>{r.forEach((e=>e()))}))}(e)));const g=function(e){const{doc:t,mirror:n,blockClass:i,blockSelector:r,selectionCb:o}=e;let s=!0;const a=Ue((()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:l,endContainer:c,endOffset:u}=o;be(s,i,r,!0)||be(c,i,r,!0)||a.push({start:n.getId(s),startOffset:l,end:n.getId(c),endOffset:u})}o({ranges:a})}));return a(),ce("selectionchange",a)}(e),f=function(e){let{doc:t,customElementCb:n}=e;const i=t.defaultView;if(!i||!i.customElements)return()=>{};const r=ge(i.customElements,"define",(function(e){return function(t,i,r){try{n({define:{name:t}})}catch(e){console.warn(`Custom element callback failed for ${t}`)}return e.apply(this,[t,i,r])}}));return r}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return Ue((()=>{ze.forEach((e=>e.reset())),null==i||i.disconnect(),r(),o(),s(),a(),l(),c(),u(),d(),h(),p(),g(),f(),m.forEach((e=>e()))}))}function rt(e){return void 0!==window[e]}function ot(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class st{constructor(e){n(this,"iframeIdToRemoteIdMap",new WeakMap),n(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,i){const r=n||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let s=r.get(t);return s||(s=this.generateIdFn(),r.set(t,s),o.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=i.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class at{constructor(e){n(this,"iframes",new WeakMap),n(this,"crossOriginIframeMap",new WeakMap),n(this,"crossOriginIframeMirror",new st(P)),n(this,"crossOriginIframeStyleMirror"),n(this,"crossOriginIframeRootIdMap",new WeakMap),n(this,"mirror"),n(this,"mutationCb"),n(this,"wrappedEmit"),n(this,"loadListener"),n(this,"stylesheetManager"),n(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new st(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(i=this.loadListener)||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ae.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Ae.IncrementalSnapshot,data:{source:Ne.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ae.Meta:case Ae.Load:case Ae.DomContentLoaded:return!1;case Ae.Plugin:return t;case Ae.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ae.IncrementalSnapshot:switch(t.data.source){case Ne.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ne.Drag:case Ne.TouchMove:case Ne.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ne.ViewportResize:return!1;case Ne.MediaInteraction:case Ne.MouseInteraction:case Ne.Scroll:case Ne.CanvasMutation:case Ne.Input:return this.replaceIds(t.data,e,["id"]),t;case Ne.StyleSheetRule:case Ne.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ne.Font:return t;case Ne.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Ne.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const r of i)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===o.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class lt{constructor(e){n(this,"shadowDoms",new WeakSet),n(this,"mutationCb"),n(this,"scrollCb"),n(this,"bypassOptions"),n(this,"mirror"),n(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!v(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Ye({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Je({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(le.host(e))),this.restoreHandlers.push(nt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(ge(e.prototype,"attachShadow",(function(e){return function(i){const r=e.call(this,i),o=le.shadowRoot(this);return o&&Re(this)&&n.addShadowRoot(o,t),r}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ut="undefined"==typeof Uint8Array?[]:new Uint8Array(256),dt=0;dt<64;dt++)ut[ct.charCodeAt(dt)]=dt;const ht=new Map;const pt=(e,t,n)=>{if(!e||!mt(e,t)&&"object"!=typeof e)return;const i=function(e,t){let n=ht.get(e);return n||(n=new Map,ht.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let r=i.indexOf(e);return-1===r&&(r=i.length,i.push(e)),r};function gt(e,t,n){if(e instanceof Array)return e.map((e=>gt(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){return{rr_type:e.constructor.name,base64:function(e){var t,n=new Uint8Array(e),i=n.length,r="";for(t=0;t<i;t+=3)r+=ct[n[t]>>2],r+=ct[(3&n[t])<<4|n[t+1]>>4],r+=ct[(15&n[t+1])<<2|n[t+2]>>6],r+=ct[63&n[t+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[gt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[gt(e.data,t,n),e.width,e.height]}}if(mt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:pt(e,t,n)}}return e}const ft=(e,t,n)=>e.map((e=>gt(e,t,n))),mt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function _t(e,t,n,i){const r=[];try{const o=ge(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r){for(var o=arguments.length,s=new Array(o>1?o-1:0),a=1;a<o;a++)s[a-1]=arguments[a];if(!be(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(r);if("__context"in this||(this.__context=e),i&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[r,...s])}}));r.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach((e=>e()))}}function vt(e,t,n,i,r,o){const s=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=ge(e,l,(function(e){return function(){for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];const u=e.apply(this,a);if(pt(u,o,this),"tagName"in this.canvas&&!be(this.canvas,i,r,!0)){const e=ft(a,o,this),i={type:t,property:l,args:e};n(this.canvas,i)}return u}}));s.push(a)}catch{const i=pe(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(i)}return s}const yt="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",bt="undefined"!=typeof window&&window.Blob&&new Blob([(wt=yt,Uint8Array.from(atob(wt),(e=>e.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var wt;function St(e){let t;try{if(t=bt&&(window.URL||window.webkitURL).createObjectURL(bt),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(window.URL||window.webkitURL).revokeObjectURL(t)})),n}catch(t){return new Worker("data:text/javascript;base64,"+yt,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class Ct{constructor(e){n(this,"pendingCanvasMutations",new Map),n(this,"rafStamps",{latestId:0,invokeId:null}),n(this,"mirror"),n(this,"mutationCb"),n(this,"resetObservers"),n(this,"frozen",!1),n(this,"locked",!1),n(this,"processMutation",((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)}));const{sampling:t="all",win:i,blockClass:r,blockSelector:o,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(i,r,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,r,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,i,r){const o=_t(t,n,i,!0),s=new Map,a=new St;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:r,height:o}=e.data;this.mutationCb({id:t,type:Le["2D"],commands:[{property:"clearRect",args:[0,0,r,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const l=1e3/e;let c,u=0;const d=e=>{u&&e-u<l||(u=e,(()=>{const e=[],r=t=>{t.querySelectorAll("canvas").forEach((t=>{be(t,n,i,!0)||e.push(t)})),t.querySelectorAll("*").forEach((e=>{e.shadowRoot&&r(e.shadowRoot)}))};return r(t.document),e})().forEach((async e=>{var t;const n=this.mirror.getId(e);if(s.get(n))return;if(0===e.width||0===e.height)return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=e.clientWidth||e.width,o=e.clientHeight||e.height,l=await createImageBitmap(e,{resizeWidth:i,resizeHeight:o});a.postMessage({id:n,bitmap:l,width:i,height:o,dataURLOptions:r.dataURLOptions},[l])}))),c=requestAnimationFrame(d)};c=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=_t(e,t,n,!1),r=function(e,t,n,i){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=ge(t.CanvasRenderingContext2D.prototype,s,(function(r){return function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return be(this.canvas,n,i,!0)||setTimeout((()=>{const n=ft(a,t,this);e(this.canvas,{type:Le["2D"],property:s,args:n})}),0),r.apply(this,a)}}));r.push(o)}catch{const n=pe(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Le["2D"],property:s,args:[t],setter:!0})}});r.push(n)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,i){const r=[];return r.push(...vt(t.WebGLRenderingContext.prototype,Le.WebGL,e,n,i,t)),void 0!==t.WebGL2RenderingContext&&r.push(...vt(t.WebGL2RenderingContext.prototype,Le.WebGL2,e,n,i,t)),()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{i(),r(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const{type:t,...n}=e;return n})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:i}),this.pendingCanvasMutations.delete(e)}}class It{constructor(e){n(this,"trackedLinkElements",new WeakSet),n(this,"mutationCb"),n(this,"adoptedStyleSheetCb"),n(this,"styleMirror",new xe),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),i.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,n)=>({rule:b(e,t.href),index:n})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class kt{constructor(){n(this,"nodeMap",new WeakMap),n(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let Et,xt,Tt,Mt=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null==(e=t.contentWindow)?void 0:e.Array.from)||Array.from,document.body.removeChild(t)}}catch(e){console.debug("Unable to override Array.from",e)}const Rt=new S;function At(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:g,maskTextFn:f,hooks:m,packFn:_,sampling:v={},dataURLOptions:y={},mousemoveWait:b,recordDOM:w=!0,recordCanvas:C=!1,recordCrossOriginIframes:I=!1,recordAfter:k=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:x=!1,inlineImages:T=!1,plugins:M,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:A=new Set([]),errorHandler:N}=e;Ge=N;const F=!I||window.parent===window;let O=!1;if(!F)try{window.parent.document&&(O=!1)}catch(e){O=!0}if(F&&!t)throw new Error("emit function is required");if(!F&&!O)return()=>{};void 0!==b&&void 0===v.mousemove&&(v.mousemove=b),Rt.reset();const L=!0===d?{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!==h?h:{password:!0},P=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p,headTitleMutations:"all"===p}:p||{};let D;!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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)}();let $=0;const B=e=>{for(const t of M||[])t.eventProcessor&&(e=t.eventProcessor(e));return _&&!O&&(e=_(e)),e};Et=(e,r)=>{var o;const s=e;if(s.timestamp=fe(),!(null==(o=ze[0])?void 0:o.isFrozen())||s.type===Ae.FullSnapshot||s.type===Ae.IncrementalSnapshot&&s.data.source===Ne.Mutation||ze.forEach((e=>e.unfreeze())),F)null==t||t(B(s),r);else if(O){const e={type:"rrweb",event:B(s),origin:window.location.origin,isCheckout:r};window.parent.postMessage(e,"*")}if(s.type===Ae.FullSnapshot)D=s,$=0;else if(s.type===Ae.IncrementalSnapshot){if(s.data.source===Ne.Mutation&&s.data.isAttachIframe)return;$++;const e=i&&$>=i,t=n&&s.timestamp-D.timestamp>n;(e||t)&&xt(!0)}};const H=e=>{Et({type:Ae.IncrementalSnapshot,data:{source:Ne.Mutation,...e}})},q=e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.Scroll,...e}}),W=e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.CanvasMutation,...e}}),V=new It({mutationCb:H,adoptedStyleSheetCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.AdoptedStyleSheet,...e}})}),Z=new at({mirror:Rt,mutationCb:H,stylesheetManager:V,recordCrossOriginIframes:I,wrappedEmit:Et});for(const e of M||[])e.getMirror&&e.getMirror({nodeMirror:Rt,crossOriginIframeMirror:Z.crossOriginIframeMirror,crossOriginIframeStyleMirror:Z.crossOriginIframeStyleMirror});const G=new kt;Tt=new Ct({recordCanvas:C,mutationCb:W,win:window,blockClass:r,blockSelector:o,mirror:Rt,sampling:v.canvas,dataURLOptions:y});const U=new lt({mutationCb:H,scrollCb:q,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:L,dataURLOptions:y,maskTextFn:f,maskInputFn:g,recordCanvas:C,inlineImages:T,sampling:v,slimDOMOptions:P,iframeManager:Z,stylesheetManager:V,canvasManager:Tt,keepIframeSrcFn:R,processedNodeManager:G},mirror:Rt});xt=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!w)return;Et({type:Ae.Meta,data:{href:window.location.href,width:ve(),height:_e()}},e),V.reset(),U.init(),ze.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new S,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:h,slimDOM:p=!1,dataURLOptions:g,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:w=(()=>!1)}=t||{};return J(e,{doc:e,mirror:n,blockClass:i,blockSelector:r,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===u?{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===u?{password:!0}:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===p,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===p?{}:p,dataURLOptions:g,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:w,newlyAddedElement:!1})}(document,{mirror:Rt,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:L,maskTextFn:f,maskInputFn:g,slimDOM:P,dataURLOptions:y,recordCanvas:C,inlineImages:T,onSerialize:e=>{Ie(e,Rt)&&Z.addIframe(e),ke(e,Rt)&&V.trackLinkElement(e),Ee(e)&&U.addShadowRoot(le.shadowRoot(e),document)},onIframeLoad:(e,t)=>{Z.attachIframe(e,t),U.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{V.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");Et({type:Ae.FullSnapshot,data:{node:t,initialOffset:me(window)}},e),ze.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&V.adoptStyleSheets(document.adoptedStyleSheets,Rt.getId(document))};try{const e=[],t=e=>{var t;return Ue(it)({mutationCb:H,mousemoveCb:(e,t)=>Et({type:Ae.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.MouseInteraction,...e}}),scrollCb:q,viewportResizeCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.ViewportResize,...e}}),inputCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.Input,...e}}),mediaInteractionCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.MediaInteraction,...e}}),styleSheetRuleCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.StyleSheetRule,...e}}),styleDeclarationCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.StyleDeclaration,...e}}),canvasMutationCb:W,fontCb:e=>Et({type:Ae.IncrementalSnapshot,data:{source:Ne.Font,...e}}),selectionCb:e=>{Et({type:Ae.IncrementalSnapshot,data:{source:Ne.Selection,...e}})},customElementCb:e=>{Et({type:Ae.IncrementalSnapshot,data:{source:Ne.CustomElement,...e}})},blockClass:r,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:L,inlineStylesheet:u,sampling:v,recordDOM:w,recordCanvas:C,inlineImages:T,userTriggeredOnInput:E,collectFonts:x,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:R,blockSelector:o,slimDOMOptions:P,dataURLOptions:y,mirror:Rt,iframeManager:Z,stylesheetManager:V,shadowDomManager:U,processedNodeManager:G,canvasManager:Tt,ignoreCSSAttributes:A,plugins:(null==(t=null==M?void 0:M.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Et({type:Ae.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},m)};Z.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{xt(),e.push(t(document)),Mt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(ce("DOMContentLoaded",(()=>{Et({type:Ae.DomContentLoaded,data:{}}),"DOMContentLoaded"===k&&n()}))),e.push(ce("load",(()=>{Et({type:Ae.Load,data:{}}),"load"===k&&n()}),window))),()=>{e.forEach((e=>e())),G.destroy(),Mt=!1,Ge=void 0}}catch(e){console.warn(e)}}var Nt,Ft;At.addCustomEvent=(e,t)=>{if(!Mt)throw new Error("please add custom event after start recording");Et({type:Ae.Custom,data:{tag:e,payload:t}})},At.freezePage=()=>{ze.forEach((e=>e.freeze()))},At.takeFullSnapshot=e=>{if(!Mt)throw new Error("please take full snapshot after start recording");xt(e)},At.mirror=Rt,(Ft=Nt||(Nt={}))[Ft.NotStarted=0]="NotStarted",Ft[Ft.Running=1]="Running",Ft[Ft.Stopped=2]="Stopped";var Ot,Lt=Object.defineProperty,Pt=(e,t,n)=>((e,t,n)=>t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Dt=Object.defineProperty,$t=(e,t,n)=>((e,t,n)=>t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Bt=Object.defineProperty,Ht=(e,t,n)=>((e,t,n)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const qt={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Wt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Vt={};function Zt(e){if(Vt[e])return Vt[e];const t=globalThis[e],n=t.prototype,i=e in qt?qt[e]:void 0,r=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),o=e in Wt?Wt[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(r&&s)return Vt[e]=t.prototype,t.prototype;try{const i=document.createElement("iframe");document.body.appendChild(i);const r=i.contentWindow;if(!r)return t.prototype;const o=r[e].prototype;return document.body.removeChild(i),o?Vt[e]=o:n}catch{return n}}const Gt={};function Ut(e,t,n){var i;const r=`${e}.${String(n)}`;if(Gt[r])return Gt[r].call(t);const o=Zt(e),s=null==(i=Object.getOwnPropertyDescriptor(o,n))?void 0:i.get;return s?(Gt[r]=s,s.call(t)):t[n]}const zt={};function jt(e,t,n){const i=`${e}.${String(n)}`;if(zt[i])return zt[i].bind(t);const r=Zt(e)[n];return"function"!=typeof r?t[n]:(zt[i]=r,r.bind(t))}const Yt={childNodes:function(e){return Ut("Node",e,"childNodes")},parentNode:function(e){return Ut("Node",e,"parentNode")},parentElement:function(e){return Ut("Node",e,"parentElement")},textContent:function(e){return Ut("Node",e,"textContent")},contains:function(e,t){return jt("Node",e,"contains")(t)},getRootNode:function(e){return jt("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ut("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ut("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ut("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ut("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Zt("MutationObserver").constructor}};class Xt{constructor(){Ht(this,"idNodeMap",new Map),Ht(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const n=null==(t=this.getMeta(e))?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Jt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Jt(Yt.parentNode(e),t,n);for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return!!n&&Jt(Yt.parentNode(e),t,n)}class Kt{constructor(){__publicField22(this,"parentElement",null),__publicField22(this,"parentNode",null),__publicField22(this,"ownerDocument"),__publicField22(this,"firstChild",null),__publicField22(this,"lastChild",null),__publicField22(this,"previousSibling",null),__publicField22(this,"nextSibling",null),__publicField22(this,"ELEMENT_NODE",1),__publicField22(this,"TEXT_NODE",3),__publicField22(this,"nodeType"),__publicField22(this,"nodeName"),__publicField22(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Kt))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Qt={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},en={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},tn={};function nn(e){if(tn[e])return tn[e];const t=globalThis[e],n=t.prototype,i=e in Qt?Qt[e]:void 0,r=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),o=e in en?en[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(r&&s)return tn[e]=t.prototype,t.prototype;try{const i=document.createElement("iframe");document.body.appendChild(i);const r=i.contentWindow;if(!r)return t.prototype;const o=r[e].prototype;return document.body.removeChild(i),o?tn[e]=o:n}catch{return n}}const rn={};function on(e,t,n){var i;const r=`${e}.${String(n)}`;if(rn[r])return rn[r].call(t);const o=nn(e),s=null==(i=Object.getOwnPropertyDescriptor(o,n))?void 0:i.get;return s?(rn[r]=s,s.call(t)):t[n]}const sn={};function an(e,t,n){const i=`${e}.${String(n)}`;if(sn[i])return sn[i].bind(t);const r=nn(e)[n];return"function"!=typeof r?t[n]:(sn[i]=r,r.bind(t))}const ln={childNodes:function(e){return on("Node",e,"childNodes")},parentNode:function(e){return on("Node",e,"parentNode")},parentElement:function(e){return on("Node",e,"parentElement")},textContent:function(e){return on("Node",e,"textContent")},contains:function(e,t){return an("Node",e,"contains")(t)},getRootNode:function(e){return an("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?on("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?on("Element",e,"shadowRoot"):null},querySelector:function(e,t){return on("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return on("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return nn("MutationObserver").constructor}};const cn="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.";let un={map:{},getId:()=>(console.error(cn),-1),getNode:()=>(console.error(cn),null),removeNodeFromMap(){console.error(cn)},has:()=>(console.error(cn),!1),reset(){console.error(cn)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(un=new Proxy(un,{get:(e,t,n)=>("map"===t&&console.error(cn),Reflect.get(e,t,n))}));let dn=Date.now;function hn(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:ln.parentElement(e)}/[1-9][0-9]{12}/.test(Date.now().toString())||(dn=()=>(new Date).getTime());function pn(e){var t;let n=null;return"getRootNode"in e&&(null==(t=ln.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ln.host(ln.getRootNode(e))&&(n=ln.host(ln.getRootNode(e))),n}function gn(e){let t,n=e;for(;t=pn(n);)n=t;return n}function fn(e){const t=e.ownerDocument;if(!t)return!1;const n=gn(e);return ln.contains(t,n)}const mn=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){$t(this,"id",1),$t(this,"styleIDMap",new WeakMap),$t(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return un},closestElementOfNode:hn,getBaseDimension:function e(t,n){var i,r;const o=null==(r=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:r.frameElement;if(!o||o===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=o.getBoundingClientRect(),a=e(o,n),l=s.height/o.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}},getNestedRule:function e(t,n){const i=t[n[0]];return 1===n.length?i:e(i.cssRules[n[1]].cssRules,n.slice(2))},getPositionsAndIndex:function(e){const t=[...e],n=t.pop();return{positions:t,index:n}},getRootShadowHost:gn,getShadowHost:pn,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,n,i,r;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=ln.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(i=ln.parentElement(o.body))?void 0:i.scrollTop)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(e){return!!e&&(e instanceof Kt&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(ln.shadowRoot(e)))},hookSetter:function e(t,n,i,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window;const s=o.Object.getOwnPropertyDescriptor(t,n);return o.Object.defineProperty(t,n,r?i:{set(e){setTimeout((()=>{i.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,n,s||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(ln.contains(t,e)||fn(e))},isAncestorRemoved:function e(t,n){if(function(e){const t=e&&"host"in e&&"mode"in e&&Yt.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Yt.shadowRoot(t)===e)}(t))return!1;const i=n.getId(t);if(!n.has(i))return!0;const r=ln.parentNode(t);return(!r||r.nodeType!==t.DOCUMENT_NODE)&&(!r||e(r,n))},isBlocked:function(e,t,n,i){if(!e)return!1;const r=hn(e);if(!r)return!1;try{if("string"==typeof t){if(r.classList.contains(t))return!0;if(i&&null!==r.closest("."+t))return!0}else if(Jt(r,t,i))return!0}catch(e){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1},isIgnored:function(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)},isSerialized:function(e,t){return-1!==t.getId(e)},isSerializedIframe:function(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))},isSerializedStylesheet:function(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))},iterateResolveTree:function e(t,n){n(t.value);for(let i=t.children.length-1;i>=0;i--)e(t.children[i],n)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return dn},on:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)},patch:function(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=r,()=>{e[t]=i}}catch{return()=>{}}},polyfill:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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)},queueToResolveTrees:function(e){const t={},n=(e,n)=>{const i={value:e,parent:n,children:[]};return t[e.node.id]=i,i},i=[];for(const r of e){const{nextId:e,parentId:o}=r;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,n(r,o.parent))}else{const e=i.indexOf(o);i.splice(e,0,n(r,null))}}else if(o in t){const e=t[o];e.children.push(n(r,e))}else i.push(n(r,null))}return i},shadowHostInDom:fn,throttle:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=null,r=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];const l=Date.now();r||!1!==n.leading||(r=l);const c=t-(l-r),u=this;c<=0||c>t?(i&&(clearTimeout(i),i=null),r=l,e.apply(u,s)):i||!1===n.trailing||(i=setTimeout((()=>{r=!1===n.leading?0:Date.now(),i=null,e.apply(u,s)}),c))}},uniqueTextMutations:function(e){const t=new Set,n=[];for(let i=e.length;i--;){const r=e[i];t.has(r.id)||(n.push(r),t.add(r.id))}return n}},Symbol.toStringTag,{value:"Module"}));for(var _n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),yn=0;yn<64;yn++)vn[_n.charCodeAt(yn)]=yn;"undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0))))("KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=")],{type:"text/javascript;charset=utf-8"});try{if(2!==Array.from([1],(e=>2*e))[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Ot=e.contentWindow)?void 0:Ot.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var bn;new Xt,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(bn||(bn={}));class wn{constructor(e){Pt(this,"fileName"),Pt(this,"functionName"),Pt(this,"lineNumber"),Pt(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Sn=/(^|@)\S+:\d+/,Cn=/^\s*at .*(\S+:\d+|\(native\))/m,In=/^(eval@)?(\[native code])?$/,kn={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Cn)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${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(Cn)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const i=t.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop()),o=i.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new wn({functionName:o,fileName:s,lineNumber:r[1],columnNumber:r[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(In)}),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 wn({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new wn({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[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){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[];for(let e=2,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new wn({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[];for(let e=0,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new wn({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Sn)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new wn({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function En(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const i=e.parentElement,r=[];if(i.children&&i.children.length>0)for(let e=0;e<i.children.length;e++){const t=i.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=`:eq(${r.indexOf(e)})`),t=n+(t?">"+t:""),e=i}return t}function xn(e){return"[object Object]"===Object.prototype.toString.call(e)}function Tn(e,t){if(0===t)return!0;const n=Object.keys(e);for(const i of n)if(xn(e[i])&&Tn(e[i],t-1))return!0;return!1}function Mn(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const i=[],r=[];return JSON.stringify(e,(function(e,t){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,e):r.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(xn(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(xn(e)&&Tn(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const i=t[n];Array.isArray(i)?e[n]=En(i.length?i[0]:null):e[n]=i}return e}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}))}const Rn={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 An(e,t,n){const i=n?Object.assign({},Rn,n):Rn,r=i.logger;if(!r)return()=>{};let o;o="string"==typeof r?t[r]:r;let s=0,a=!1;const l=[];if(i.level.includes("error")){const n=t=>{const n=t.message,r=t.error,o=kn.parse(r).map((e=>e.toString())),s=[Mn(n,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),l.push((()=>{t.removeEventListener("error",n)}));const r=t=>{let n,r;t.reason instanceof Error?(n=t.reason,r=[Mn(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Mn("Uncaught (in promise)",i.stringifyOptions),Mn(t.reason,i.stringifyOptions)]);const o=kn.parse(n).map((e=>e.toString()));e({level:"error",trace:o,payload:r})};t.addEventListener("unhandledrejection",r),l.push((()=>{t.removeEventListener("unhandledrejection",r)}))}for(const e of i.level)l.push(c(o,e));return()=>{l.forEach((e=>e()))};function c(t,n){var r=this;return t[n]?mn.patch(t,n,(t=>function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];if(t.apply(r,l),!("assert"===n&&l[0]||a)){a=!0;try{const t=kn.parse(new Error).map((e=>e.toString())).splice(1),r=("assert"===n?l.slice(1):l).map((e=>Mn(e,i.stringifyOptions)));s++,s<i.lengthThreshold?e({level:n,trace:t,payload:r}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Mn("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})):()=>{}}}const Nn=e=>({name:"rrweb/console@1",observer:An,options:e});const Fn={DEBUG:!1,LIB_VERSION:"1.187.1"},On="undefined"!=typeof window?window:void 0,Ln="undefined"!=typeof globalThis?globalThis:On,Pn=Array.prototype,Dn=Pn.forEach,$n=Pn.indexOf,Bn=null==Ln?void 0:Ln.navigator,Hn=null==Ln?void 0:Ln.document,qn=null==Ln?void 0:Ln.location,Wn=null==Ln?void 0:Ln.fetch,Vn=null!=Ln&&Ln.XMLHttpRequest&&"withCredentials"in new Ln.XMLHttpRequest?Ln.XMLHttpRequest:void 0,Zn=null==Ln?void 0:Ln.AbortController,Gn=null==Bn?void 0:Bn.userAgent,Un=null!=On?On:{},zn="[PostHog.js]",jn={_log:function(e){if(On&&(Fn.DEBUG||Un.POSTHOG_DEBUG)&&!ki(On.console)&&On.console){const r="__rrweb_original__"in On.console[e]?On.console[e].__rrweb_original__:On.console[e];for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];r(zn,...n)}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];jn._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];jn._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];jn._log("error",...t)},critical:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.error(zn,...t)},uninitializedWarning:e=>{jn.error(`You must initialize PostHog before calling ${e}`)}},Yn={},Xn=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Jn(e,t,n){if(yi(e))if(Dn&&e.forEach===Dn)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(let i=0,r=e.length;i<r;i++)if(i in e&&t.call(n,e[i],i)===Yn)return}function Kn(e,t,n){if(!Mi(e)){if(yi(e))return Jn(e,t,n);if(Fi(e)){for(const i of e.entries())if(t.call(n,i[1],i[0])===Yn)return}else for(const i in e)if(_i.call(e,i)&&t.call(n,e[i],i)===Yn)return}}const Qn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Jn(n,(function(t){for(const n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function ei(e,t){return-1!==e.indexOf(t)}function ti(e){const t=Object.keys(e);let n=t.length;const i=new Array(n);for(;n--;)i[n]=[t[n],e[t[n]]];return i}const ni=function(e){try{return e()}catch{return}},ii=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){jn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),jn.critical(e)}}},ri=function(e){const t={};return Kn(e,(function(e,n){Ei(e)&&e.length>0&&(t[n]=e)})),t},oi=function(e){return e.replace(/^\$/,"")};function si(e,t){return function(e,t){const n=new Set;return function e(i,r){if(i!==Object(i))return t?t(i,r):i;if(n.has(i))return;let o;return n.add(i),yi(i)?(o=[],Jn(i,(t=>{o.push(e(t))}))):(o={},Kn(i,((t,i)=>{n.has(t)||(o[i]=e(t,i))}))),o}(e)}(e,(e=>Ei(e)&&!Ti(t)?e.slice(0,t):e))}const ai=function(e){let t,n,i,r="",o=0;for(t=n=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<o;i++){const o=e.charCodeAt(i);let s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Ti(s)||(n>t&&(r+=e.substring(t,n)),r+=s,t=n=i+1)}return n>t&&(r+=e.substring(t,e.length)),r},li=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,i,r,o){if(t)if(t.addEventListener&&!r)t.addEventListener(n,i,!!o);else{const r="on"+n,o=t[r];t[r]=function(t,n,i){return function(r){if(!(r=r||e(null==On?void 0:On.event)))return;let o,s=!0;bi(i)&&(o=i(r));const a=n.call(t,r);return!1!==o&&!1!==a||(s=!1),s}}(t,i,o)}else jn.error("No valid element provided to register_event")}}();function ci(e){const t=null==e?void 0:e.hostname;return!!Ei(t)&&"herokuapp.com"!==t.split(".").slice(-2).join(".")}function ui(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n]}const di="$copy_autocapture",hi=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];let pi;!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(pi||(pi={}));const gi=["fatal","error","warning","log","info","debug"],fi=Array.isArray,mi=Object.prototype,_i=mi.hasOwnProperty,vi=mi.toString,yi=fi||function(e){return"[object Array]"===vi.call(e)},bi=e=>"function"==typeof e,wi=e=>bi(e)&&-1!==e.toString().indexOf("[native code]"),Si=e=>{if(!bi(e))return!1;return Object.getOwnPropertyNames(e.prototype||{}).some((e=>e.indexOf("__zone")))},Ci=e=>e===Object(e)&&!yi(e),Ii=e=>{if(Ci(e)){for(const t in e)if(_i.call(e,t))return!1;return!0}return!1},ki=e=>void 0===e,Ei=e=>"[object String]"==vi.call(e),xi=e=>Ei(e)&&0===e.trim().length,Ti=e=>null===e,Mi=e=>ki(e)||Ti(e),Ri=e=>"[object Number]"==vi.call(e),Ai=e=>"[object Boolean]"===vi.call(e),Ni=e=>e instanceof Document,Fi=e=>e instanceof FormData,Oi=e=>ei(hi,e),Li=["localhost","127.0.0.1"],Pi=e=>{const t=null==Hn?void 0:Hn.createElement("a");return ki(t)?null:(t.href=e,t)},Di=function(e,t){return!!function(e){try{new RegExp(e)}catch{return!1}return!0}(t)&&new RegExp(t).test(e)},$i=function(e){let t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&";const r=[];return Kn(e,(function(e,i){ki(e)||ki(i)||"undefined"===i||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),n=encodeURIComponent(i),r[r.length]=n+"="+t)})),r.join(i)},Bi=function(e,t){const n=((e.split("#")[0]||"").split("?")[1]||"").split("&");let i;for(let e=0;e<n.length;e++){const r=n[e].split("=");if(r[0]===t){i=r;break}}if(!yi(i)||i.length<2)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch{jn.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},Hi=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},qi="$people_distinct_id",Wi="__alias",Vi="__timers",Zi="$autocapture_disabled_server_side",Gi="$heatmaps_enabled_server_side",Ui="$exception_capture_enabled_server_side",zi="$web_vitals_enabled_server_side",ji="$dead_clicks_enabled_server_side",Yi="$web_vitals_allowed_metrics",Xi="$session_recording_enabled_server_side",Ji="$console_log_recording_enabled_server_side",Ki="$session_recording_network_payload_capture",Qi="$session_recording_canvas_recording",er="$replay_sample_rate",tr="$replay_minimum_duration",nr="$sesid",ir="$session_is_sampled",rr="$session_recording_url_trigger_activated_session",or="$session_recording_event_trigger_activated_session",sr="$enabled_feature_flags",ar="$early_access_features",lr="$stored_person_properties",cr="$stored_group_properties",ur="$surveys",dr="$surveys_activated",hr="$flag_call_reported",pr="$user_state",gr="$client_session_props",fr="$capture_rate_limit",mr="$initial_campaign_params",_r="$initial_referrer_info",vr="$initial_person_info",yr="$epp",br="__POSTHOG_TOOLBAR__",wr=[qi,Wi,"__cmpns",Vi,Xi,Gi,nr,sr,pr,ar,cr,lr,ur,hr,gr,fr,mr,_r,yr];function Sr(e){var t;return e.id===br||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function Cr(e){return!!e&&1===e.nodeType}function Ir(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function kr(e){return!!e&&3===e.nodeType}function Er(e){return!!e&&11===e.nodeType}function xr(e){return e?Xn(e).split(/\s+/):[]}function Tr(e){const t=null==On?void 0:On.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Mr(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return xr(t)}function Rr(e){return Mi(e)?null:Xn(e).split(/(\s+)/).filter((e=>Zr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ar(e){let t="";return Pr(e)&&!Dr(e)&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,(function(e){var n;kr(e)&&e.textContent&&(t+=null!==(n=Rr(e.textContent))&&void 0!==n?n:"")})),Xn(t)}function Nr(e){return ki(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}const Fr=["a","button","form","input","select","textarea","label"];function Or(e){const t=e.parentNode;return!(!t||!Cr(t))&&t}function Lr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!On||!e||Ir(e,"html")||!Cr(e))return!1;if(null!=n&&n.url_allowlist&&!Tr(n.url_allowlist))return!1;if(null!=n&&n.url_ignorelist&&Tr(n.url_ignorelist))return!1;if(null!=n&&n.dom_event_allowlist){const e=n.dom_event_allowlist;if(e&&!e.some((e=>t.type===e)))return!1}let o=!1;const s=[e];let a=!0,l=e;for(;l.parentNode&&!Ir(l,"body");)if(Er(l.parentNode))s.push(l.parentNode.host),l=l.parentNode.host;else{if(a=Or(l),!a)break;if(i||Fr.indexOf(a.tagName.toLowerCase())>-1)o=!0;else{const e=On.getComputedStyle(a);e&&"pointer"===e.getPropertyValue("cursor")&&(o=!0)}s.push(a),l=a}if(!function(e,t){const n=null==t?void 0:t.element_allowlist;if(ki(n))return!0;for(const t of e)if(n.some((e=>t.tagName.toLowerCase()===e)))return!0;return!1}(s,n))return!1;if(!function(e,t){const n=null==t?void 0:t.css_selector_allowlist;if(ki(n))return!0;for(const t of e)if(n.some((e=>t.matches(e))))return!0;return!1}(s,n))return!1;const c=On.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===t.type)return!0;const u=e.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return o?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(Fr.indexOf(u)>-1||"true"===e.getAttribute("contenteditable"))}}function Pr(e){for(let t=e;t.parentNode&&!Ir(t,"body");t=t.parentNode){const e=Mr(t);if(ei(e,"ph-sensitive")||ei(e,"ph-no-capture"))return!1}if(ei(Mr(e),"ph-include"))return!0;const t=e.type||"";if(Ei(t))switch(t.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";if(Ei(n)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Dr(e){return!!(Ir(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ir(e,"select")||Ir(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const $r="(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})",Br=new RegExp(`^(?:${$r})$`),Hr=new RegExp($r),qr="\\d{3}-?\\d{2}-?\\d{4}",Wr=new RegExp(`^(${qr})$`),Vr=new RegExp(`(${qr})`);function Zr(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Mi(e))return!1;if(Ei(e)){e=Xn(e);if((t?Br:Hr).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Wr:Vr).test(e))return!1}return!0}function Gr(e){let t=Ar(e);return t=`${t} ${Ur(e)}`.trim(),Zr(t)?t:""}function Ur(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{const n=Ar(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Ur(e)}`.trim())}catch(e){jn.error(e)}})),t}function zr(e){return function(e){const t=e.map((e=>{var t,n;let i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)i+=`.${t.replace(/"/g,"")}`}const r={...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},o={};return ti(r).sort(((e,t)=>{let[n]=e,[i]=t;return n.localeCompare(i)})).forEach((e=>{let[t,n]=e;return o[jr(t.toString())]=jr(n.toString())})),i+=":",i+=ti(r).map((e=>{let[t,n]=e;return`${t}="${n}"`})).join(""),i}));return t.join(";")}(function(e){return e.map((e=>{var t,n;const i={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:Yr(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ti(e).filter((e=>{let[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{let[t,n]=e;return i.attributes[t]=n})),i}))}(e))}function jr(e){return e.replace(/"|\\"/g,'\\"')}function Yr(e){const t=e.attr__class;return t?yi(t)?t:xr(t):void 0}const Xr="[SessionRecording]",Jr="redacted",Kr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},Qr=["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"],eo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],to=["/s/","/e/","/i/"];function no(e,t,n,i){if(Mi(e))return e;let r=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ei(r)&&(r=parseInt(r)),r>n?Xr+` ${i} body too large to record (${r} bytes)`:e}function io(e,t){if(Mi(e))return e;let n=e;return Zr(n,!1)||(n=Xr+" "+t+" body "+Jr),Kn(eo,(e=>{var i,r;null!==(i=n)&&void 0!==i&&i.length&&-1!==(null===(r=n)||void 0===r?void 0:r.indexOf(e))&&(n=Xr+" "+t+" body "+Jr+" as might contain: "+e)})),n}const ro=(e,t)=>{const n={payloadSizeLimitBytes:Kr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Kr.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Kr.payloadHostDenyList]},i=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,s=(e=>{var t;const n=Math.min(1e6,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:1e6);return e=>(null!=e&&e.requestBody&&(e.requestBody=no(e.requestBody,e.requestHeaders,n,"Request")),null!=e&&e.responseBody&&(e.responseBody=no(e.responseBody,e.responseHeaders,n,"Response")),e)})(n),a=e=>s((e=>{const t=Pi(e.name);if(!(t&&t.pathname&&to.some((e=>0===t.pathname.indexOf(e)))))return e})((e=>{const t=e.requestHeaders;return Mi(t)||Kn(Object.keys(null!=t?t:{}),(e=>{Qr.includes(e.toLowerCase())&&(t[e]=Jr)})),e})(e))),l=bi(e.session_recording.maskNetworkRequestFn);return l&&bi(e.session_recording.maskCapturedNetworkRequestFn)&&jn.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),l&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const n=e.session_recording.maskNetworkRequestFn({url:t.name});return{...t,name:null==n?void 0:n.url}}),n.maskRequestFn=bi(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var n,i,r;const o=a(t);return o&&null!==(n=null===(i=(r=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(r,o))&&void 0!==n?n:void 0}:e=>function(e){if(!ki(e))return e.requestBody=io(e.requestBody,"Request"),e.responseBody=io(e.responseBody,"Response"),e}(a(e)),{...Kr,...n,recordHeaders:i,recordBody:r,recordPerformance:o,recordInitialRequests:o}};function oo(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return bi(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=i}}catch{return()=>{}}}function so(e,t){var n;const i=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch{return null}}(e),r={hostname:i,isHostDenied:!1};if(null===(n=t.payloadHostDenyList)||void 0===n||!n.length||null==i||!i.trim().length)return r;for(const e of t.payloadHostDenyList)if(i.endsWith(e))return{hostname:i,isHostDenied:!0};return r}const ao=e=>"navigation"===e.entryType,lo=e=>"resource"===e.entryType;function co(e,t,n){if(n.recordInitialRequests){const i=t.performance.getEntries().filter((e=>ao(e)||lo(e)&&n.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>mo({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}const i=new t.PerformanceObserver((t=>{const i=t.getEntries().filter((e=>ao(e)||lo(e)&&n.initiatorTypes.includes(e.initiatorType)&&(e=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>mo({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),r=PerformanceObserver.supportedEntryTypes.filter((e=>n.performanceEntryTypeToObserve.includes(e)));return i.observe({entryTypes:r}),()=>{i.disconnect()}}function uo(e,t){return!!t&&(Ai(t)||t[e])}function ho(e){let{type:t,recordBody:n,headers:i}=e;function r(e){const t=Object.keys(i).find((e=>"content-type"===e.toLowerCase())),n=t&&i[t];return e.some((e=>null==n?void 0:n.includes(e)))}if(!n)return!1;if(Ai(n))return!0;if(yi(n))return r(n);const o=n[t];return Ai(o)?o:r(o)}async function po(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(o>10)return jn.warn("Failed to get performance entry for request",{url:n,initiatorType:t}),null;const s=function(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return e[n]}(e.performance.getEntriesByName(n),(e=>lo(e)&&e.initiatorType===t&&(ki(i)||e.startTime>=i)&&(ki(r)||e.startTime<=r)));return s||(await new Promise((e=>setTimeout(e,50*o))),po(e,t,n,i,r,o+1))}function go(e){let{body:t,options:n,url:i}=e;if(Mi(t))return null;const{hostname:r,isHostDenied:o}=so(i,n);if(o)return r+" is in deny list";if(Ei(t))return t;if(Ni(t))return t.textContent;if(Fi(t))return $i(t);if(Ci(t))try{return JSON.stringify(t)}catch{return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const fo=e=>!Ti(e)&&("navigation"===e.entryType||"resource"===e.entryType);function mo(e){let{entry:t,method:n,status:i,networkRequest:r,isInitial:o,start:s,end:a,url:l,initiatorType:c}=e;s=t?t.startTime:s,a=t?t.responseEnd:a;const u=Math.floor(Date.now()-performance.now()),d=Math.floor(u+(s||0)),h=[{...t?t.toJSON():{name:l},startTime:ki(s)?void 0:Math.round(s),endTime:ki(a)?void 0:Math.round(a),timeOrigin:u,timestamp:d,method:n,initiatorType:c||(t?t.initiatorType:void 0),status:i,requestHeaders:r.requestHeaders,requestBody:r.requestBody,responseHeaders:r.responseHeaders,responseBody:r.responseBody,isInitial:o}];if(fo(t))for(const e of t.serverTiming||[])h.push({timeOrigin:u,timestamp:d,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return h}const _o=["video/","audio/"];function vo(e){return new Promise(((t,n)=>{const i=setTimeout((()=>t("[SessionReplay] Timeout while trying to read body")),500);try{e.clone().text().then((e=>t(e)),(e=>n(e))).finally((()=>clearTimeout(i)))}catch{clearTimeout(i),t("[SessionReplay] Failed to read body")}}))}async function yo(e){let{r:t,options:n,url:i}=e;const r=function(e){var t;let{r:n,options:i,url:r}=e;if("chunked"===n.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const o=null===(t=n.headers.get("Content-Type"))||void 0===t?void 0:t.toLowerCase(),s=_o.some((e=>null==o?void 0:o.startsWith(e)));if(o&&s)return`Content-Type ${o} is not supported`;const{hostname:a,isHostDenied:l}=so(r,i);return l?a+" is in deny list":null}({r:t,options:n,url:i});return Ti(r)?vo(t):Promise.resolve(r)}function bo(e,t,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const i=uo("request",n.recordHeaders),r=uo("response",n.recordHeaders),o=oo(t,"fetch",(o=>async function(s,a){const l=new Request(s,a);let c;const u={};let d,h;try{const e={};l.headers.forEach(((t,n)=>{e[n]=t})),i&&(u.requestHeaders=e),ho({type:"request",headers:e,url:s,recordBody:n.recordBody})&&(u.requestBody=await async function(e){let{r:t,options:n,url:i}=e;const{hostname:r,isHostDenied:o}=so(i,n);return o?Promise.resolve(r+" is in deny list"):vo(t)}({r:l,options:n,url:s})),d=t.performance.now(),c=await o(l),h=t.performance.now();const a={};return c.headers.forEach(((e,t)=>{a[t]=e})),r&&(u.responseHeaders=a),ho({type:"response",headers:a,url:s,recordBody:n.recordBody})&&(u.responseBody=await yo({r:c,options:n,url:s})),c}finally{po(t,"fetch",l.url,d,h).then((t=>{var n;const i=mo({entry:t,method:l.method,status:null===(n=c)||void 0===n?void 0:n.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return()=>{o()}}let wo=null;function So(e,t,n){if(!("performance"in t))return()=>{};if(wo)return jn.warn("Network observer already initialised, doing nothing"),()=>{};const i=n?Object.assign({},Kr,n):Kr,r=t=>{const n=[];t.requests.forEach((e=>{const t=i.maskRequestFn(e);t&&n.push(t)})),n.length>0&&e({...t,requests:n})},o=co(r,t,i);let s=()=>{},a=()=>{};return(i.recordHeaders||i.recordBody)&&(s=function(e,t,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const i=uo("request",n.recordHeaders),r=uo("response",n.recordHeaders),o=oo(t.XMLHttpRequest.prototype,"open",(o=>function(s,a){let l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0;const d=this,h=new Request(a),p={};let g,f;const m={},_=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(m[e]=t,_(e,t)),i&&(p.requestHeaders=m);const v=d.send.bind(d);d.send=e=>(ho({type:"request",headers:m,url:a,recordBody:n.recordBody})&&(p.requestBody=go({body:e,options:n,url:a})),g=t.performance.now(),v(e)),d.addEventListener("readystatechange",(()=>{if(d.readyState!==d.DONE)return;f=t.performance.now();const i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{const t=e.split(": "),n=t.shift(),r=t.join(": ");n&&(i[n]=r)})),r&&(p.responseHeaders=i),ho({type:"response",headers:i,url:a,recordBody:n.recordBody})&&(p.responseBody=go({body:d.response,options:n,url:a})),po(t,"xmlhttprequest",h.url,g,f).then((t=>{const n=mo({entry:t,method:s,status:null==d?void 0:d.status,networkRequest:p,start:g,end:f,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:n})})).catch((()=>{}))})),o.call(d,s,a,l,c,u)}));return()=>{o()}}(r,t,i),a=bo(r,t,i)),wo=()=>{o(),s(),a()},wo}const Co=e=>({name:"rrweb/network@1",observer:So,options:e});let Io,ko,Eo;Un.__PosthogExtensions__=Un.__PosthogExtensions__||{},Un.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Nn,getRecordNetworkPlugin:Co},Un.__PosthogExtensions__.rrweb={record:At,version:"v2"},Un.rrweb={record:At,version:"v2"},Un.rrwebConsoleRecord={getRecordConsolePlugin:Nn},Un.getRecordNetworkPlugin=Co,function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(Io||(Io={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(ko||(ko={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(Eo||(Eo={}));var xo,To,Mo,Ro,Ao,No,Fo,Oo,Lo={},Po=[],Do=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$o=Array.isArray;function Bo(e,t){for(var n in t)e[n]=t[n];return e}function Ho(e){var t=e.parentNode;t&&t.removeChild(e)}function qo(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?xo.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Wo(e,s,i,r,null)}function Wo(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Mo:r,__i:-1,__u:0};return null==r&&null!=To.vnode&&To.vnode(o),o}function Vo(e){return e.children}function Zo(e,t){this.props=e,this.context=t}function Go(e,t){if(null==t)return e.__?Go(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Go(e):null}function Uo(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Uo(e)}}function zo(e){(!e.__d&&(e.__d=!0)&&Ro.push(e)&&!jo.__r++||Ao!==To.debounceRendering)&&((Ao=To.debounceRendering)||No)(jo)}function jo(){var e,t,n,i,r,o,s,a,l;for(Ro.sort(Fo);e=Ro.shift();)e.__d&&(t=Ro.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=Bo({},r)).__v=r.__v+1,To.vnode&&To.vnode(i),ns(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?Go(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,is(a,i,l),i.__e!=o&&Uo(i)),Ro.length>t&&Ro.sort(Fo));jo.__r=0}function Yo(e,t,n,i,r,o,s,a,l,c,u){var d,h,p,g,f,m=i&&i.__k||Po,_=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,u=c,d=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?Wo(null,r,null,null,r):$o(r)?Wo(Vo,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?Wo(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=Jo(r,n,s=i+d,u),r.__i=a,o=null,-1!==a&&(u--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&d--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?d++:a>s?u>l-s?d+=a-s:d--:d=a<s&&a==s-1?a-s:0,a!==i+d&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=Go(o)),os(o,o,!1),n[i]=null,u--);if(u)for(i=0;i<c;i++)null!=(o=n[i])&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=Go(o)),os(o,o))}(n,t,m),l=n.__d,d=0;d<_;d++)null!=(p=n.__k[d])&&"boolean"!=typeof p&&"function"!=typeof p&&(h=-1===p.__i?Lo:m[p.__i]||Lo,p.__i=d,ns(e,p,h,r,o,s,a,l,c,u),g=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&rs(h.ref,null,p),u.push(p.ref,p.__c||g,p)),null==f&&null!=g&&(f=g),65536&p.__u||h.__k===p.__k?l=Xo(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:g&&(l=g.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=f}function Xo(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Xo(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Jo(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function Ko(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Do.test(t)?n:n+"px"}function Qo(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Ko(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Ko(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?ts:es,o)):e.removeEventListener(t,o?ts:es,o);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function es(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(To.event?To.event(e):e)}function ts(e){return this.l[e.type+!0](To.event?To.event(e):e)}function ns(e,t,n,i,r,o,s,a,l,c){var u,d,h,p,g,f,m,_,v,y,b,w,S,C,I,k=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(u=To.__b)&&u(t);e:if("function"==typeof k)try{if(_=t.props,v=(u=k.contextType)&&i[u.__c],y=u?v?v.props.value:u.__:i,n.__c?m=(d=t.__c=n.__c).__=d.__E:("prototype"in k&&k.prototype.render?t.__c=d=new k(_,y):(t.__c=d=new Zo(_,y),d.constructor=k,d.render=ss),v&&v.sub(d),d.props=_,d.state||(d.state={}),d.context=y,d.__n=i,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=k.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Bo({},d.__s)),Bo(d.__s,k.getDerivedStateFromProps(_,d.__s))),p=d.props,g=d.state,d.__v=t,h)null==k.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==k.getDerivedStateFromProps&&_!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(_,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(_,d.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=_,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(_,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,g,f)}))}if(d.context=y,d.props=_,d.__P=e,d.__e=!1,w=To.__r,S=0,"prototype"in k&&k.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),C=0;C<d._sb.length;C++)d.__h.push(d._sb[C]);d._sb=[]}else do{d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(i=Bo(Bo({},i),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(f=d.getSnapshotBeforeUpdate(p,g)),Yo(e,$o(I=null!=u&&u.type===Vo&&null==u.key?u.props.children:u)?I:[I],t,n,i,r,o,s,a,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),m&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),To.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,i,r,o,s,a,l){var c,u,d,h,p,g,f,m=n.props,_=t.props,v=t.type;if("svg"===v&&(r=!0),null!=o)for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!v&&(v?p.localName===v:3===p.nodeType)){e=p,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(_);e=r?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,_.is&&_),o=null,a=!1}if(null===v)m===_||a&&e.data===_||(e.data=_);else{if(o=o&&xo.call(e.childNodes),m=n.props||Lo,!a&&null!=o)for(m={},c=0;c<e.attributes.length;c++)m[(p=e.attributes[c]).name]=p.value;for(c in m)p=m[c],"children"==c||("dangerouslySetInnerHTML"==c?d=p:"key"===c||c in _||Qo(e,c,null,p,r));for(c in _)p=_[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?g=p:"checked"==c?f=p:"key"===c||a&&"function"!=typeof p||m[c]===p||Qo(e,c,p,m[c],r);if(u)a||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),Yo(e,$o(h)?h:[h],t,n,i,r&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&Go(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&Ho(o[c]);a||(c="value",void 0!==g&&(g!==e[c]||"progress"===v&&!g||"option"===v&&g!==m[c])&&Qo(e,c,g,m[c],!1),c="checked",void 0!==f&&f!==e[c]&&Qo(e,c,f,m[c],!1))}return e}(n.__e,t,n,i,r,o,s,l,c);(u=To.diffed)&&u(t)}function is(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)rs(n[i],n[++i],n[++i]);To.__c&&To.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){To.__e(e,t.__v)}}))}function rs(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){To.__e(e,n)}}function os(e,t,n){var i,r;if(To.unmount&&To.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||rs(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){To.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&os(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||Ho(e.__e),e.__=e.__e=e.__d=void 0}function ss(e,t,n){return this.constructor(e,n)}function as(e,t,n){var i,r,o,s;To.__&&To.__(e,t),r=(i="function"==typeof n)?null:t.__k,o=[],s=[],ns(t,e=(!i&&n||t).__k=qo(Vo,null,[e]),r||Lo,Lo,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?xo.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),is(o,e,s)}function ls(e,t,n){var i,r,o,s,a=Bo({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==o?i=t[o]:"ref"==o?r=t[o]:a[o]=void 0===t[o]&&void 0!==s?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?xo.call(arguments,2):n),Wo(e.type,a,i||e.key,r||e.ref,null)}xo=Po.slice,To={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Mo=0,Zo.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Bo({},this.state),"function"==typeof e&&(e=e(Bo({},n),this.props)),e&&Bo(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),zo(this))},Zo.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zo(this))},Zo.prototype.render=Vo,Ro=[],No="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fo=function(e,t){return e.__v.__b-t.__v.__b},jo.__r=0,Oo=0;const cs=On,us=Hn,ds="seenSurvey_",hs=e=>{const t={left:"left: 30px;",right:"right: 30px;",center:"\n left: 50%;\n transform: translateX(-50%);\n "};return`\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n text-align: left;\n max-width: ${parseInt((null==e?void 0:e.maxWidth)||"300")}px;\n width: 100%;\n z-index: ${parseInt((null==e?void 0:e.zIndex)||"99999")};\n border: 1.5px solid ${(null==e?void 0:e.borderColor)||"#c9c6c6"};\n border-bottom: 0px;\n ${t[(null==e?void 0:e.position)||"right"]||"right: 30px;"}\n flex-direction: column;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n \n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: 0.6;\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ${(null==e?void 0:e.borderColor)||"#c9c6c6"};\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ${(null==e?void 0:e.submitButtonColor)||"black"} !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ${(null==e?void 0:e.borderColor)||"#c9c6c6"};\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n text-decoration: none;\n backgroundColor: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n color: ${gs((null==e?void 0:e.backgroundColor)||"#eeeded")};\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ${(null==e?void 0:e.borderColor)||"#c9c6c6"};\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ${(null==e?void 0:e.borderColor)||"#c9c6c6"};\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ${(null==e?void 0:e.ratingButtonActiveColor)||"black"};\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ${(null==e?void 0:e.ratingButtonActiveColor)||"black"};\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ${(null==e?void 0:e.backgroundColor)||"#eeeded"};\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n `};function ps(e){if("#"===e[0]){const t=e.replace(/^#/,"");return"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")"}return"rgb(255, 255, 255)"}function gs(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ms;"#"===t[0]&&(e=ps(t)),t.startsWith("rgb")&&(e=t);const n=function(e){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()]}(t);if(n&&(e=ps(n)),!e)return"black";const i=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){const e=parseInt(i[1]),t=parseInt(i[2]),n=parseInt(i[3]);return Math.sqrt(e*e*.299+t*t*.587+n*n*.114)>127.5?"black":"white"}return"black"}const fs={backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},ms="#eeeded",_s=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;i&&(localStorage.setItem(Cs(n),"true"),i.capture("survey sent",{$survey_name:n.name,$survey_id:n.id,$survey_iteration:n.current_iteration,$survey_iteration_start_date:n.current_iteration_start_date,$survey_questions:n.questions.map((e=>e.question)),sessionRecordingUrl:null===(e=i.get_session_replay_url)||void 0===e?void 0:e.call(i),...t,$set:{[Is(n,"responded")]:!0}}),cs.dispatchEvent(new Event("PHSurveySent")))},vs=(e,t,n)=>{var i;!n&&t&&(t.capture("survey dismissed",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t),$set:{[Is(e,"dismissed")]:!0}}),localStorage.setItem(Cs(e),"true"),cs.dispatchEvent(new Event("PHSurveyClosed")))},ys=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),bs=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n]))?t.reverse():t,ws=e=>(e.questions.forEach(((e,t)=>{e.originalQuestionIndex=t})),e.appearance&&e.appearance.shuffleQuestions?bs(e.questions,ys(e.questions)):e.questions),Ss=e=>{var t,n;return!(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||!n.repeatedActivation||!(e=>{var t,n,i,r,o,s;return null!=(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(i=n.values)||void 0===i?void 0:i.length)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0})(e))},Cs=e=>{let t=`${ds}${e.id}`;return e.current_iteration&&e.current_iteration>0&&(t=`${ds}${e.id}_${e.current_iteration}`),t},Is=(e,t)=>{let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n},ks=function(e,t){var n={__c:t="__cC"+Oo++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,zo(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0}),Es=e=>{let{component:t,children:n,renderAsHtml:i,style:r}=e;return ls(t,i?{dangerouslySetInnerHTML:{__html:n},style:r}:{children:n,style:r})},xs=Hn;var Ts,Ms,Rs,As,Ns=0,Fs=[],Os=[],Ls=To.__b,Ps=To.__r,Ds=To.diffed,$s=To.__c,Bs=To.unmount;function Hs(e,t){To.__h&&To.__h(Ms,e,Ns||t),Ns=0;var n=Ms.__H||(Ms.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Os}),n.__[e]}function qs(e){return Ns=1,function(e,t,n){var i=Hs(Ts++,2);if(i.t=e,!i.__c&&(i.__=[Ks(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Ms,!Ms.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};Ms.u=!0;var o=Ms.shouldComponentUpdate,s=Ms.componentWillUpdate;Ms.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},Ms.shouldComponentUpdate=r}return i.__N||i.__}(Ks,e)}function Ws(e,t){var n=Hs(Ts++,3);!To.__s&&Js(n.__H,t)&&(n.__=e,n.i=t,Ms.__H.__h.push(n))}function Vs(e){return Ns=5,Zs((function(){return{current:e}}),[])}function Zs(e,t){var n=Hs(Ts++,7);return Js(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Gs(e){var t=Ms.context[e.__c],n=Hs(Ts++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ms)),t.props.value):e.__}function Us(){for(var e;e=Fs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ys),e.__H.__h.forEach(Xs),e.__H.__h=[]}catch(t){e.__H.__h=[],To.__e(t,e.__v)}}To.__b=function(e){Ms=null,Ls&&Ls(e)},To.__r=function(e){Ps&&Ps(e),Ts=0;var t=(Ms=e.__c).__H;t&&(Rs===Ms?(t.__h=[],Ms.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Os,e.__N=e.i=void 0}))):(t.__h.forEach(Ys),t.__h.forEach(Xs),t.__h=[],Ts=0)),Rs=Ms},To.diffed=function(e){Ds&&Ds(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Fs.push(t)&&As===To.requestAnimationFrame||((As=To.requestAnimationFrame)||js)(Us)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Os&&(e.__=e.__V),e.i=void 0,e.__V=Os}))),Rs=Ms=null},To.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ys),e.__h=e.__h.filter((function(e){return!e.__||Xs(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],To.__e(n,e.__v)}})),$s&&$s(e,t)},To.unmount=function(e){Bs&&Bs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ys(e)}catch(e){t=e}})),n.__H=void 0,t&&To.__e(t,n.__v))};var zs="function"==typeof requestAnimationFrame;function js(e){var t,n=function(){clearTimeout(i),zs&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);zs&&(t=requestAnimationFrame(n))}function Ys(e){var t=Ms,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ms=t}function Xs(e){var t=Ms;e.__c=e.__(),Ms=t}function Js(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ks(e,t){return"function"==typeof t?t(e):t}var Qs=0;function ea(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Qs,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return To.vnode&&To.vnode(c),c}const ta=ea("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ea("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),na=ea("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ea("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),ia=ea("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ea("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),ra=ea("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ea("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),oa=ea("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ea("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),sa=ea("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ea("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:"black"})}),aa=ea("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ea("g",{"clip-path":"url(#clip0_2415_6911)",children:[ea("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ea("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ea("g",{mask:"url(#mask0_2415_6911)",children:[ea("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),ea("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),ea("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),ea("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),ea("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),ea("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),ea("defs",{children:ea("clipPath",{id:"clip0_2415_6911",children:ea("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),la=ea("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ea("path",{d:"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z",fill:"currentColor"})});function ca(){return ea("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",aa]})}function ua(e){let{text:t,submitDisabled:n,appearance:i,onSubmit:r,link:o}=e;const{isPreviewMode:s,isPopup:a}=Gs(ks),l=i.submitButtonTextColor||gs(i.submitButtonColor||fs.submitButtonColor);return ea("div",{className:"bottom-section",children:[ea("div",{className:"buttons",children:ea("button",{className:"form-submit",disabled:n&&!s,type:"button",style:a?{color:l}:{},onClick:()=>{s||(o&&(null==On||On.open(o)),r())},children:t})}),!i.whiteLabel&&ea(ca,{})]})}function da(e){let{question:t,description:n,descriptionContentType:i,backgroundColor:r,forceDisableHtml:o}=e;const{isPopup:s}=Gs(ks);return ea("div",{style:s?{backgroundColor:r||fs.backgroundColor}:{},children:[ea("div",{className:"survey-question",children:t}),n&&Es({component:qo("div",{className:"survey-question-description"}),children:n,renderAsHtml:!o&&"text"!==i})]})}function ha(e){let{onClick:t}=e;const{isPreviewMode:n}=Gs(ks);return ea("div",{className:"cancel-btn-wrapper",onClick:t,disabled:n,children:ea("button",{className:"form-cancel",onClick:t,disabled:n,children:sa})})}function pa(e){let{header:t,description:n,contentType:i,forceDisableHtml:r,appearance:o,onClose:s,styleOverrides:a}=e;const l=gs(o.backgroundColor||fs.backgroundColor),{isPopup:c}=Gs(ks);return ea(Vo,{children:ea("div",{className:"thank-you-message",style:{...a},children:ea("div",{className:"thank-you-message-container",children:[c&&ea(ha,{onClick:()=>s()}),ea("h3",{className:"thank-you-message-header",style:{color:l},children:t}),n&&Es({component:qo("div",{className:"thank-you-message-body"}),children:n,renderAsHtml:!r&&"text"!==i,style:{color:l}}),c&&ea(ua,{text:o.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:o,onSubmit:()=>s()})]})})})}function ga(e){var t;const n=Vs(null),[i,r]=qs(null!==(t=e.defaultTextColor)&&void 0!==t?t:"black");return Ws((()=>{if(n.current){const e=function(e){const t=cs.getComputedStyle(e).backgroundColor;if("rgba(0, 0, 0, 0)"===t)return"black";const n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(!n)return"black";const i=parseInt(n[1]),r=parseInt(n[2]),o=parseInt(n[3]);return Math.sqrt(i*i*.299+r*r*.587+o*o*.114)>127.5?"black":"white"}(n.current);r(e)}}),[e.appearance,e.forceUpdate]),{ref:n,textColor:i}}function fa(e){let{question:t,forceDisableHtml:n,appearance:i,onSubmit:r}=e;const o=Vs(null),[s,a]=qs("");return ea("div",{ref:o,children:[ea(da,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,backgroundColor:i.backgroundColor,forceDisableHtml:n}),ea("textarea",{rows:4,placeholder:null==i?void 0:i.placeholder,onInput:e=>a(e.currentTarget.value)}),ea(ua,{text:t.buttonText||"Submit",submitDisabled:!s&&!t.optional,appearance:i,onSubmit:()=>r(s)})]})}function ma(e){let{question:t,forceDisableHtml:n,appearance:i,onSubmit:r}=e;return ea(Vo,{children:[ea(da,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n}),ea(ua,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>r("link clicked")})]})}function _a(e){let{question:t,forceDisableHtml:n,displayQuestionIndex:i,appearance:r,onSubmit:o}=e;const s=t.scale,a=10===t.scale?0:1,[l,c]=qs(null);return ea(Vo,{children:[ea(da,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),ea("div",{className:"rating-section",children:[ea("div",{className:"rating-options",children:["emoji"===t.display&&ea("div",{className:"rating-options-emoji",children:(3===t.scale?ba:wa).map(((e,t)=>{const n=t+1===l;return ea("button",{className:`ratings-emoji question-${i}-rating-${t} ${n?"rating-active":null}`,value:t+1,type:"button",onClick:()=>{c(t+1)},style:{fill:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:e},t)}))}),"number"===t.display&&ea("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${s-a+1}, minmax(0, 1fr))`},children:ka(t.scale).map(((e,t)=>ea(va,{displayQuestionIndex:i,active:l===e,appearance:r,num:e,setActiveNumber:e=>{c(e)}},t)))})]}),ea("div",{className:"rating-text",children:[ea("div",{children:t.lowerBoundLabel}),ea("div",{children:t.upperBoundLabel})]})]}),ea(ua,{text:t.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:Ti(l)&&!t.optional,appearance:r,onSubmit:()=>o(l)})]})}function va(e){let{num:t,active:n,displayQuestionIndex:i,appearance:r,setActiveNumber:o}=e;const{textColor:s,ref:a}=ga({appearance:r,defaultTextColor:"black",forceUpdate:n});return ea("button",{ref:a,className:`ratings-number question-${i}-rating-${t} ${n?"rating-active":null}`,type:"button",onClick:()=>{o(t)},style:{color:s,backgroundColor:n?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:t})}function ya(e){let{question:t,forceDisableHtml:n,displayQuestionIndex:i,appearance:r,onSubmit:o}=e;const s=Vs(null),a=Zs((()=>(e=>{if(!e.shuffleOptions)return e.choices;const t=e.choices;let n="";e.hasOpenChoice&&(n=t.pop());const i=bs(t,ys(t));return e.hasOpenChoice&&(e.choices.push(n),i.push(n)),i})(t)),[t]),[l,c]=qs(t.type===ko.MultipleChoice?[]:null),[u,d]=qs(!1),[h,p]=qs(""),g=t.type===ko.SingleChoice?"radio":"checkbox";return ea("div",{ref:s,children:[ea(da,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:r.backgroundColor}),ea("div",{className:"multiple-choice-options",children:a.map(((e,n)=>{let r="choice-option";const o=e,s=e;return t.hasOpenChoice&&n===t.choices.length-1&&(r+=" choice-option-open"),ea("div",{className:r,children:[ea("input",{type:g,id:`surveyQuestion${i}Choice${n}`,name:`question${i}`,value:o,disabled:!o,onInput:()=>t.hasOpenChoice&&n===t.choices.length-1?d(!u):t.type===ko.SingleChoice?c(o):t.type===ko.MultipleChoice&&yi(l)?l.includes(o)?c(l.filter((e=>e!==o))):c([...l,o]):void 0}),ea("label",{htmlFor:`surveyQuestion${i}Choice${n}`,style:{color:"black"},children:t.hasOpenChoice&&n===t.choices.length-1?ea(Vo,{children:[ea("span",{children:[s,":"]}),ea("input",{type:"text",id:`surveyQuestion${i}Choice${n}Open`,name:`question${i}`,onInput:e=>{const n=e.currentTarget.value;return t.type===ko.SingleChoice?c(n):t.type===ko.MultipleChoice&&yi(l)?p(n):void 0}})]}):s}),ea("span",{className:"choice-check",style:{color:"black"},children:la})]})}))}),ea(ua,{text:t.buttonText||"Submit",submitDisabled:(Ti(l)||yi(l)&&!u&&0===l.length||yi(l)&&u&&!h&&0===l.length&&!t.optional)&&!t.optional,appearance:r,onSubmit:()=>{u&&t.type===ko.MultipleChoice?yi(l)&&o([...l,h]):o(l)}})]})}const ba=[ia,na,ta],wa=[ra,ia,na,ta,oa],Sa=[1,2,3,4,5],Ca=[1,2,3,4,5,6,7],Ia=[0,1,2,3,4,5,6,7,8,9,10];function ka(e){switch(e){case 5:default:return Sa;case 7:return Ca;case 10:return Ia}}const Ea=On,xa=Hn;class Ta{constructor(e){this.posthog=e,this.surveyInFocus=null}canShowNextEventBasedSurvey=()=>{const e=xa.querySelectorAll("div[class^=PostHogSurvey]");var t;return!(e.length>0)||1===(null===(t=e[e.length-1].shadowRoot)||void 0===t?void 0:t.childElementCount)};handlePopoverSurvey=e=>{var t;const n=null===(t=e.conditions)||void 0===t?void 0:t.seenSurveyWaitPeriodInDays,i=localStorage.getItem("lastSeenSurveyDate");if(n&&i){const e=new Date,t=Math.abs(e.getTime()-new Date(i).getTime());if(Math.ceil(t/864e5)<n)return}const r=(e=>!!localStorage.getItem(Cs(e))&&!Ss(e))(e);if(!r){this.addSurveyToFocus(e.id);const t=((e,t,n)=>{const i=us.createElement("div");i.className=`PostHogSurvey${t}`;const r=i.attachShadow({mode:"open"});if(e){const t=Object.assign(us.createElement("style"),{innerText:e});r.appendChild(t)}return us.body.appendChild(i),r})(hs(null==e?void 0:e.appearance),e.id);as(ea(Aa,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!0},"popover-survey"),t)}};handleWidget=e=>{const t=function(e){var t;const n=xs.createElement("div");n.className=`PostHogWidget${e.id}`;const i=n.attachShadow({mode:"open"}),r=`\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ${(null===(t=e.appearance)||void 0===t?void 0:t.widgetColor)||"#e0a045"};\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: 9999999;\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n `;return i.append(Object.assign(xs.createElement("style"),{innerText:r})),xs.body.appendChild(n),i}(e),n=hs(e.appearance);t.appendChild(Object.assign(xa.createElement("style"),{innerText:n})),as(ea(Fa,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus},"feedback-survey"),t)};handleWidgetSelector=e=>{var t;const n=(null===(t=e.appearance)||void 0===t?void 0:t.widgetSelector)&&xa.querySelector(e.appearance.widgetSelector);if(n)if(0===xa.querySelectorAll(`.PostHogWidget${e.id}`).length)this.handleWidget(e);else if(1===xa.querySelectorAll(`.PostHogWidget${e.id}`).length&&!n.getAttribute("PHWidgetSurveyClickListener")){var i,r;const t=null===(i=xa.querySelector(`.PostHogWidget${e.id}`))||void 0===i||null===(r=i.shadowRoot)||void 0===r?void 0:r.querySelector(".survey-form");n.addEventListener("click",(()=>{t&&(t.style.display="none"===t.style.display?"block":"none",t.addEventListener("PHSurveyClosed",(()=>{this.removeSurveyFromFocus(e.id),t.style.display="none"})))})),n.setAttribute("PHWidgetSurveyClickListener","true")}};sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var n,i;return((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)}))}canRenderSurvey=e=>{const t={visible:!1};if(e.end_date)return t.disabledReason=`survey was completed on ${e.end_date}`,t;if(e.type!=Io.Popover)return t.disabledReason="Only Popover survey types can be rendered",t;if(!(!e.linked_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.linked_flag_key)))return t.disabledReason=`linked feature flag ${e.linked_flag_key} is false`,t;if(!(!e.targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.targeting_flag_key)))return t.disabledReason=`targeting feature flag ${e.targeting_flag_key} is false`,t;return!e.internal_targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key)?(t.visible=!0,t):(t.disabledReason=`internal targeting feature flag ${e.internal_targeting_flag_key} is false`,t)};renderSurvey=(e,t)=>{as(ea(Aa,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!1},"popover-survey"),t)};callSurveysAndEvaluateDisplayLogic=(()=>{var e=this;return function(){var t;let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=e.posthog)||void 0===t||t.getActiveMatchingSurveys((t=>{const n=t.filter((e=>"api"!==e.type));e.sortSurveysByAppearanceDelay(n).forEach((t=>{if(Ti(e.surveyInFocus)){var n,i,r;if(t.type===Io.Widget)"tab"===(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)&&0===xa.querySelectorAll(`.PostHogWidget${t.id}`).length&&e.handleWidget(t),"selector"===(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)&&null!==(r=t.appearance)&&void 0!==r&&r.widgetSelector&&e.handleWidgetSelector(t);t.type===Io.Popover&&e.canShowNextEventBasedSurvey()&&e.handlePopoverSurvey(t)}}))}),n)}})();addSurveyToFocus=e=>{Ti(this.surveyInFocus)||jn.error(`Survey ${[...this.surveyInFocus]} already in focus. Cannot add survey ${e}.`),this.surveyInFocus=e};removeSurveyFromFocus=e=>{this.surveyInFocus!==e&&jn.error(`Survey ${e} is not in focus. Cannot remove survey ${e}.`),this.surveyInFocus=null};getTestAPI(){return{addSurveyToFocus:this.addSurveyToFocus,removeSurveyFromFocus:this.removeSurveyFromFocus,surveyInFocus:this.surveyInFocus,canShowNextEventBasedSurvey:this.canShowNextEventBasedSurvey,handleWidget:this.handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,handleWidgetSelector:this.handleWidgetSelector,sortSurveysByAppearanceDelay:this.sortSurveysByAppearanceDelay}}}function Ma(e){if(!xa||!Ea)return;const t=new Ta(e);return t.callSurveysAndEvaluateDisplayLogic(!0),setInterval((()=>{t.callSurveysAndEvaluateDisplayLogic(!1)}),1e3),t}function Ra(e,t,n,i,r){const[o,s]=qs(i||0===n),[a,l]=qs(!1);return Ws((()=>{if(i||!t)return;const o=()=>{r(e.id),s(!1)},a=()=>{var t,n;null!==(t=e.appearance)&&void 0!==t&&t.displayThankYouMessage?(l(!0),r(e.id),null!==(n=e.appearance)&&void 0!==n&&n.autoDisappear&&setTimeout((()=>{s(!1)}),5e3)):(r(e.id),s(!1))},c=()=>{var n;s(!0),Ea.dispatchEvent(new Event("PHSurveyShown")),t.capture("survey shown",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(n=t.get_session_replay_url)||void 0===n?void 0:n.call(t)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())};return Ea.addEventListener("PHSurveyClosed",o),Ea.addEventListener("PHSurveySent",a),n>0?(()=>{const e=setTimeout((()=>{c()}),n);return()=>{clearTimeout(e),Ea.removeEventListener("PHSurveyClosed",o),Ea.removeEventListener("PHSurveySent",a)}})():(c(),()=>{Ea.removeEventListener("PHSurveyClosed",o),Ea.removeEventListener("PHSurveySent",a)})}),[]),{isPopupVisible:o,isSurveySent:a,setIsPopupVisible:s}}function Aa(e){var t,n,i,r,o,s;let{survey:a,forceDisableHtml:l,posthog:c,style:u,previewPageIndex:d,removeSurveyFromFocus:h,isPopup:p}=e;const g=Number.isInteger(d),f=null!==(t=a.appearance)&&void 0!==t&&t.surveyPopupDelaySeconds?1e3*a.appearance.surveyPopupDelaySeconds:0,{isPopupVisible:m,isSurveySent:_,setIsPopupVisible:v}=Ra(a,c,f,g,h),y=_||d===a.questions.length,b=null!==(n=u)&&void 0!==n&&n.left&&Ri(null===(i=u)||void 0===i?void 0:i.left)?{left:u.left-40}:{};return g&&(u=u||{},u.left="unset",u.right="unset",u.transform="unset"),m?ea(ks.Provider,{value:{isPreviewMode:g,previewPageIndex:d,handleCloseSurveyPopup:()=>vs(a,c,g),isPopup:p||!1},children:y?ea(pa,{header:(null===(r=a.appearance)||void 0===r?void 0:r.thankYouMessageHeader)||"Thank you!",description:(null===(o=a.appearance)||void 0===o?void 0:o.thankYouMessageDescription)||"",forceDisableHtml:!!l,contentType:null===(s=a.appearance)||void 0===s?void 0:s.thankYouMessageDescriptionContentType,appearance:a.appearance||fs,styleOverrides:{...u,...b},onClose:()=>v(!1)}):ea(Na,{survey:a,forceDisableHtml:!!l,posthog:c,styleOverrides:u})}):ea(Vo,{})}function Na(e){var t,n;let{survey:i,forceDisableHtml:r,posthog:o,styleOverrides:s}=e;const a=gs((null===(t=i.appearance)||void 0===t?void 0:t.backgroundColor)||fs.backgroundColor),[l,c]=qs({}),{isPreviewMode:u,previewPageIndex:d,handleCloseSurveyPopup:h,isPopup:p}=Gs(ks),[g,f]=qs(d||0),m=Zs((()=>ws(i)),[i]);Ws((()=>{f(null!=d?d:0)}),[d]);return ea("form",{className:"survey-form",style:p?{color:a,borderColor:null===(n=i.appearance)||void 0===n?void 0:n.borderColor,...s}:{},children:m.map(((e,t)=>{var n;const{originalQuestionIndex:s}=e;return(u?g===s:g===t)&&ea("div",{className:"survey-box",style:p?{backgroundColor:(null===(n=i.appearance)||void 0===n?void 0:n.backgroundColor)||fs.backgroundColor}:{},children:[p&&ea(ha,{onClick:()=>h()}),Oa({question:e,forceDisableHtml:r,displayQuestionIndex:t,appearance:i.appearance||fs,onSubmit:e=>(e=>{let{res:t,originalQuestionIndex:n,displayQuestionIndex:r}=e;if(!o)return;const s=0===n?"$survey_response":`$survey_response_${n}`;if(c({...l,[s]:t}),!o.getNextSurveyStep)return void(r===i.questions.length-1?_s({...l,[s]:t},i,o):f(r+1));const a=o.getNextSurveyStep(i,r,t);a===Eo.End?_s({...l,[s]:t},i,o):f(a)})({res:e,originalQuestionIndex:s,displayQuestionIndex:t})})]})}))})}function Fa(e){var t,n;let{survey:i,forceDisableHtml:r,posthog:o,readOnly:s,removeSurveyFromFocus:a}=e;const[l,c]=qs(!1),[u,d]=qs({}),h=Vs(null);return Ws((()=>{var e,t;if(!s&&o){if("tab"===(null===(e=i.appearance)||void 0===e?void 0:e.widgetType)&&h.current){var n;const e=h.current.getBoundingClientRect(),t={top:"50%",left:parseInt(""+(e.right-360)),bottom:"auto",borderRadius:10,borderBottom:`1.5px solid ${(null===(n=i.appearance)||void 0===n?void 0:n.borderColor)||"#c9c6c6"}`};d(t)}if("selector"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)){const e=xa.querySelector(i.appearance.widgetSelector||"");null==e||e.addEventListener("click",(()=>{c(!l)})),null==e||e.setAttribute("PHWidgetSurveyClickListener","true")}}}),[]),ea(Vo,{children:["tab"===(null===(t=i.appearance)||void 0===t?void 0:t.widgetType)&&ea("div",{className:"ph-survey-widget-tab",ref:h,onClick:()=>!s&&c(!l),style:{color:gs(i.appearance.widgetColor)},children:[ea("div",{className:"ph-survey-widget-tab-icon"}),(null===(n=i.appearance)||void 0===n?void 0:n.widgetLabel)||""]}),l&&ea(Aa,{posthog:o,survey:i,forceDisableHtml:r,style:u,removeSurveyFromFocus:a,isPopup:!0},"feedback-widget-survey")]})}const Oa=e=>{let{question:t,forceDisableHtml:n,displayQuestionIndex:i,appearance:r,onSubmit:o}=e;const s={[ko.Open]:fa,[ko.Link]:ma,[ko.Rating]:_a,[ko.SingleChoice]:ya,[ko.MultipleChoice]:ya},a={question:t,forceDisableHtml:n,appearance:r,onSubmit:o},l={[ko.Open]:{},[ko.Link]:{},[ko.Rating]:{displayQuestionIndex:i},[ko.SingleChoice]:{displayQuestionIndex:i},[ko.MultipleChoice]:{displayQuestionIndex:i}};return ea(s[t.type],{...{...a,...l[t.type]}})};function La(e){return!ki(Event)&&Pa(e,Event)}function Pa(e,t){try{return e instanceof t}catch{return!1}}function Da(e){return Ti(e)||!Ci(e)&&!bi(e)}function $a(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function Ba(e){return $a(e,"DOMError")}Un.__PosthogExtensions__=Un.__PosthogExtensions__||{},Un.__PosthogExtensions__.canActivateRepeatedly=Ss,Un.__PosthogExtensions__.generateSurveys=Ma,Un.extendPostHogWithSurveys=Ma;const Ha=/\(error: (.*)\)/,qa=50,Wa="?";function Va(e,t,n,i){const r={platform:"javascript",filename:e,function:"<anonymous>"===t?Wa:t,in_app:!0};return ki(n)||(r.lineno=n),ki(i)||(r.colno=i),r}const Za=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ga=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ua=/\((\S*)(?::(\d+))(?::(\d+))\)/,za=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ja=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ya=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const i=t.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[],r=e.split("\n");for(let e=t;e<r.length;e++){const t=r[e];if(t.length>1024)continue;const o=Ha.test(t)?t.replace(Ha,"$1"):t;if(!o.match(/\S*Error: /)){for(const e of i){const t=e(o);if(t){n.push(t);break}}if(n.length>=qa)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,qa).map((e=>({...e,filename:e.filename||Xa(t).filename,function:e.function||Wa})))}(n)}}(...[[30,e=>{const t=Za.exec(e);if(t){const[,e,n,i]=t;return Va(e,Wa,+n,+i)}const n=Ga.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){const e=Ua.exec(n[2]);e&&(n[2]=e[1],n[3]=e[2],n[4]=e[3])}const[e,t]=Ja(n[1]||Wa,n[2]);return Va(t,e,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,e=>{const t=za.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=ja.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Wa;return[n,e]=Ja(n,e),Va(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]);function Xa(e){return e[e.length-1]||{}}const Ja=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:Wa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Ka=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Qa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=e.stacktrace||e.stack||"",i=function(e){if(e&&el.test(e.message))return 1;return 0}(e);try{const e=Ya(n,i);return e.slice(0,e.length-t)}catch{}return[]}const el=/Minified React error #\d+;/i;function tl(e,t){var n,i;const r=Qa(e),o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null!==(i=null==t?void 0:t.synthetic)&&void 0!==i&&i;return{$exception_list:[{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:function(e){const t=e.message;if(t.error&&"string"==typeof t.error.message)return t.error.message;return t}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:o,synthetic:s}}],$exception_level:"error"}}function nl(e,t){var n,i,r;const o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(r=null==t?void 0:t.defaultExceptionType)&&void 0!==r?r:"Error",value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:s}};if(null!=t&&t.syntheticException){const e=Qa(t.syntheticException,1);e.length&&(a.stacktrace={frames:e,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function il(e){return Ei(e)&&!xi(e)&&gi.indexOf(e)>=0}function rl(e,t){var n,i;const r=null===(n=null==t?void 0:t.handled)||void 0===n||n,o=null===(i=null==t?void 0:t.synthetic)||void 0===i||i,s=null!=t&&t.overrideExceptionType?t.overrideExceptionType:La(e)?e.constructor.name:"Error",a=null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:`Non-Error exception captured with keys: ${function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40;const n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(let e=n.length;e>0;e--){const i=n.slice(0,e).join(", ");if(!(i.length>t))return e===n.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}(e)}`,l={type:s,value:a,mechanism:{handled:r,synthetic:o}};if(null!=t&&t.syntheticException){const e=Qa(null==t?void 0:t.syntheticException,1);e.length&&(l.stacktrace={frames:e,type:"raw"})}return{$exception_list:[l],$exception_level:il(e.level)?e.level:"error"}}function ol(e,t){let[n,i,r,o,s]=e,a={$exception_list:[]};const l=s||n;if(Ba(l)||function(e){return $a(e,"DOMException")}(l)){const e=l;if(function(e){return"stack"in e}(l))a=tl(l,t);else{const n=e.name||(Ba(e)?"DOMError":"DOMException"),i=e.message?`${n}: ${e.message}`:n,r=Ba(e)?"DOMError":"DOMException";a=nl(i,{...t,overrideExceptionType:r,defaultExceptionMessage:i})}return"code"in e&&(a.$exception_DOMException_code=`${e.code}`),a}if(function(e){return $a(e,"ErrorEvent")}(l)&&l.error)return tl(l.error,t);if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Pa(e,Error)}}(l))return tl(l,t);if(function(e){return $a(e,"Object")}(l)||La(l)){return rl(l,t)}if(ki(s)&&Ei(n)){let e="Error",i=n;const r=n.match(Ka);return r&&(e=r[1],i=r[2]),nl(i,{...t,overrideExceptionType:e,defaultExceptionMessage:i})}return nl(l,t)}function sl(e){let[t]=e;const n=function(e){if(Da(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t);return Da(n)?nl(`Non-Error promise rejection captured with value: ${String(n)}`,{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):ol([n],{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(n)})}const al={wrapOnError:e=>{const t=On;t||jn.info("window not available, cannot wrap onerror");const n=t.onerror;return t.onerror=function(){for(var t,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];const s=ol(r);return e(s),null!==(t=null==n?void 0:n(...r))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null===(e=t.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=n}},wrapUnhandledRejection:e=>{const t=On;t||jn.info("window not available, cannot wrap onUnhandledRejection");const n=t.onunhandledrejection;return t.onunhandledrejection=function(){for(var i,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];const a=sl(o);return e(a),null!==(i=null==n?void 0:n.apply(t,o))&&void 0!==i&&i},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null===(e=t.onunhandledrejection)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=n}}};Un.__PosthogExtensions__=Un.__PosthogExtensions__||{},Un.__PosthogExtensions__.errorWrappingFunctions=al,Un.__PosthogExtensions__.parseErrorAsProperties=ol,Un.posthogErrorWrappingFunctions=al,Un.parseErrorAsProperties=ol;const ll=(e,t)=>{const{sessionId:n,windowId:i}=e.checkAndGetSessionAndWindowId(!0);t.headers.set("X-POSTHOG-SESSION-ID",n),t.headers.set("X-POSTHOG-WINDOW-ID",i)};Un.__PosthogExtensions__=Un.__PosthogExtensions__||{};const cl={_patchFetch:e=>oo(On,"fetch",(t=>async function(n,i){const r=new Request(n,i);return ll(e,r),t(r)})),_patchXHR:e=>oo(On.XMLHttpRequest.prototype,"open",(t=>function(n,i){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;const a=new Request(i);return ll(e,a),t.call(this,n,a.url,r,o,s)}))};Un.__PosthogExtensions__.tracingHeadersPatchFns=cl,Un.postHogTracingHeadersPatchFns=cl;var ul,dl,hl,pl=-1,gl=function(e){addEventListener("pageshow",(function(t){t.persisted&&(pl=t.timeStamp,e(t))}),!0)},fl=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ml=function(){var e=fl();return e&&e.activationStart||0},_l=function(e,t){var n=fl(),i="navigate";return pl>=0?i="back-forward-cache":n&&(document.prerendering||ml()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},vl=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},yl=function(e,t,n,i){var r,o;return function(s){t.value>=0&&(s||i)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},bl=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},wl=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},Sl=function(e){var t=!1;return function(){t||(e(),t=!0)}},Cl=-1,Il=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},kl=function(e){"hidden"===document.visibilityState&&Cl>-1&&(Cl="visibilitychange"===e.type?e.timeStamp:0,xl())},El=function(){addEventListener("visibilitychange",kl,!0),addEventListener("prerenderingchange",kl,!0)},xl=function(){removeEventListener("visibilitychange",kl,!0),removeEventListener("prerenderingchange",kl,!0)},Tl=function(){return Cl<0&&(Cl=Il(),El(),gl((function(){setTimeout((function(){Cl=Il(),El()}),0)}))),{get firstHiddenTime(){return Cl}}},Ml=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Rl=[1800,3e3],Al=function(e,t){t=t||{},Ml((function(){var n,i=Tl(),r=_l("FCP"),o=vl("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-ml(),0),r.entries.push(e),n(!0)))}))}));o&&(n=yl(e,r,Rl,t.reportAllChanges),gl((function(i){r=_l("FCP"),n=yl(e,r,Rl,t.reportAllChanges),bl((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},Nl=[.1,.25],Fl=[2500,4e3],Ol={},Ll=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Pl=function(e){if("loading"===document.readyState)return"loading";var t=Ll();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},Dl=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$l=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var i=e,r=i.id?"#"+i.id:Dl(i)+(i.classList&&i.classList.value&&i.classList.value.trim()&&i.classList.value.trim().length?"."+i.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+r.length>(t||100)-1)return n||r;if(n=n?r+">"+n:r,i.id)break;e=i.parentNode}}catch(e){}return n},Bl=-1,Hl=function(e,t){var n=Ll(),i="navigate";return Bl>=0?i="back-forward-cache":n&&(document.prerendering||function(){var e=Ll();return e&&e.activationStart||0}()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:-1,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},ql=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},Wl=function(e,t,n,i){var r,o;return function(s){t.value>=0&&(s||i)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Vl=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},Zl=0,Gl=1/0,Ul=0,zl=function(e){e.forEach((function(e){e.interactionId&&(Gl=Math.min(Gl,e.interactionId),Ul=Math.max(Ul,e.interactionId),Zl=Ul?(Ul-Gl)/7+1:0)}))},jl=function(){"interactionCount"in performance||ul||(ul=ql("event",zl,{type:"event",buffered:!0,durationThreshold:0}))},Yl=[],Xl=new Map,Jl=0,Kl=function(){return(ul?Zl:performance.interactionCount||0)-Jl},Ql=[],ec=function(e){if(Ql.forEach((function(t){return t(e)})),e.interactionId||"first-input"===e.entryType){var t=Yl[Yl.length-1],n=Xl.get(e.interactionId);if(n||Yl.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Xl.set(i.id,i),Yl.push(i)}Yl.sort((function(e,t){return t.latency-e.latency})),Yl.length>10&&Yl.splice(10).forEach((function(e){return Xl.delete(e.id)}))}}},tc=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=function(e){var t=!1;return function(){t||(e(),t=!0)}}(e),"hidden"===document.visibilityState?e():(n=t(e),Vl(e)),n},nc=[200,500],ic=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()}((function(){var n;jl();var i,r=Hl("INP"),o=function(e){tc((function(){e.forEach(ec);var t,n=(t=Math.min(Yl.length-1,Math.floor(Kl()/50)),Yl[t]);n&&n.latency!==r.value&&(r.value=n.latency,r.entries=n.entries,i())}))},s=ql("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});i=Wl(e,r,nc,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),Vl((function(){o(s.takeRecords()),i(!0)})),function(e){addEventListener("pageshow",(function(t){t.persisted&&(Bl=t.timeStamp,e(t))}),!0)}((function(){Jl=0,Yl.length=0,Xl.clear(),r=Hl("INP"),i=Wl(e,r,nc,t.reportAllChanges)})))})))},rc=[],oc=[],sc=new WeakMap,ac=new Map,lc=-1,cc=function(e){rc=rc.concat(e),uc()},uc=function(){lc<0&&(lc=tc(dc))},dc=function(){ac.size>10&&ac.forEach((function(e,t){Xl.has(t)||ac.delete(t)}));var e=Yl.map((function(e){return sc.get(e.entries[0])})),t=oc.length-50;oc=oc.filter((function(n,i){return i>=t||e.includes(n)}));for(var n=new Set,i=0;i<oc.length;i++){var r=oc[i];hc(r.startTime,r.processingEnd).forEach((function(e){n.add(e)}))}for(var o=0;o<50;o++){var s=rc[rc.length-1-o];if(!s||s.startTime<hl)break;n.add(s)}rc=Array.from(n),lc=-1};Ql.push((function(e){e.interactionId&&e.target&&!ac.has(e.interactionId)&&ac.set(e.interactionId,e.target)}),(function(e){var t,n=e.startTime+e.duration;hl=Math.max(hl,e.processingEnd);for(var i=oc.length-1;i>=0;i--){var r=oc[i];if(Math.abs(n-r.renderTime)<=8){(t=r).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:[e]},oc.push(t)),(e.interactionId||"first-input"===e.entryType)&&sc.set(e,t),uc()}));var hc=function(e,t){for(var n,i=[],r=0;n=rc[r];r++)if(!(n.startTime+n.duration<e)){if(n.startTime>t)break;i.push(n)}return i};const pc={onLCP:function(e,t){t=t||{},Ml((function(){var n,i=Tl(),r=_l("LCP"),o=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-ml(),0),r.entries=[e],n())}))},s=vl("largest-contentful-paint",o);if(s){n=yl(e,r,Fl,t.reportAllChanges);var a=Sl((function(){Ol[r.id]||(o(s.takeRecords()),s.disconnect(),Ol[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=Sl(e),"hidden"===document.visibilityState?e():(n=t(e),wl(e)),n}(a)}),!0)})),wl(a),gl((function(i){r=_l("LCP"),n=yl(e,r,Fl,t.reportAllChanges),bl((function(){r.value=performance.now()-i.timeStamp,Ol[r.id]=!0,n(!0)}))}))}}))},onCLS:function(e,t){t=t||{},Al(Sl((function(){var n,i=_l("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,n())},a=vl("layout-shift",s);a&&(n=yl(e,i,Nl,t.reportAllChanges),wl((function(){s(a.takeRecords()),n(!0)})),gl((function(){r=0,i=_l("CLS",0),n=yl(e,i,Nl,t.reportAllChanges),bl((function(){return n()}))})),setTimeout(n,0))})))},onFCP:Al,onINP:function(e,t){dl||(dl=ql("long-animation-frame",cc)),ic((function(t){var n=function(e){var t=e.entries[0],n=sc.get(t),i=t.processingStart,r=n.processingEnd,o=n.entries.sort((function(e,t){return e.processingStart-t.processingStart})),s=hc(t.startTime,r),a=e.entries.find((function(e){return e.target})),l=a&&a.target||ac.get(t.interactionId),c=[t.startTime+t.duration,r].concat(s.map((function(e){return e.startTime+e.duration}))),u=Math.max.apply(Math,c),d={interactionTarget:$l(l),interactionTargetElement:l,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:u,processedEventEntries:o,longAnimationFrameEntries:s,inputDelay:i-t.startTime,processingDuration:r-i,presentationDelay:Math.max(u-r,0),loadState:Pl(t.startTime)};return Object.assign(e,{attribution:d})}(t);e(n)}),t)}};Un.__PosthogExtensions__=Un.__PosthogExtensions__||{},Un.__PosthogExtensions__.postHogWebVitalsCallbacks=pc,Un.postHogWebVitalsCallbacks=pc;class gc{constructor(){this.clicks=[]}isRageClick(e,t,n){const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<30&&n-i.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}}function fc(e,t){return t.length>e?t.slice(0,e)+"...":t}function mc(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!Cr(t));return t}function _c(e,t,n,i){const r=e.tagName.toLowerCase(),o={tag_name:r};Fr.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?o.$el_text=fc(1024,Gr(e)):o.$el_text=fc(1024,Ar(e)));const s=Mr(e);s.length>0&&(o.classes=s.filter((function(e){return""!==e}))),Kn(e.attributes,(function(n){var r;if((!Dr(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&((null==i||!i.includes(n.name))&&!t&&Zr(n.value)&&(r=n.name,!Ei(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){let e=n.value;"class"===n.name&&(e=xr(e).join(" ")),o["attr__"+n.name]=fc(1024,e)}}));let a=1,l=1,c=e;for(;c=mc(c);)a++,c.tagName===e.tagName&&l++;return o.nth_child=a,o.nth_of_type=l,o}function vc(e,t){var n,i;let{e:r,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:a,elementsChainAsString:l}=t;const c=[e];let u=e;for(;u.parentNode&&!Ir(u,"body");)Er(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);const d=[],h={};let p,g=!1,f=!1;if(Kn(c,(e=>{const t=Pr(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&Zr(g)&&g);ei(Mr(e),"ph-no-capture")&&(f=!0),d.push(_c(e,o,s,a));const n=function(e){if(!Pr(e))return{};const t={};return Kn(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&Zr(i)&&(t[n]=i)}})),t}(e);Qn(h,n)})),f)return{props:{},explicitNoCapture:f};if(s||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?d[0].$el_text=Gr(e):d[0].$el_text=Ar(e)),g){var m,_;d[0].attr__href=g;const e=null===(m=Pi(g))||void 0===m?void 0:m.host,t=null==On||null===(_=On.location)||void 0===_?void 0:_.host;e&&t&&e!==t&&(p=g)}return{props:Qn({$event_type:r.type,$ce_version:1},l?{$elements_chain:zr(d)}:{$elements:d},null!==(n=d[0])&&void 0!==n&&n.$el_text?{$el_text:null===(i=d[0])||void 0===i?void 0:i.$el_text}:{},p&&"click"===r.type?{$external_click_url:p}:{},h)}}class yc{_initialized=!1;_isDisabledServerSide=null;rageclicks=new gc;_elementsChainAsString=!1;constructor(e){this.instance=e,this._elementSelectors=null}get config(){var e,t;const n=Ci(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null===(e=n.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),n.url_ignorelist=null===(t=n.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),n}_addDomEventHandlers(){if(!this.isBrowserSupported())return void jn.info("Disabling Automatic Event Collection because this browser is not supported");if(!On||!Hn)return;const e=e=>{e=e||(null==On?void 0:On.event);try{this._captureEvent(e)}catch(e){jn.error("Failed to capture event",e)}},t=e=>{e=e||(null==On?void 0:On.event),this._captureEvent(e,di)};li(Hn,"submit",e,!1,!0),li(Hn,"change",e,!1,!0),li(Hn,"click",e,!1,!0),this.config.capture_copied_text&&(li(Hn,"copy",t,!1,!0),li(Hn,"cut",t,!1,!0))}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}afterDecideResponse(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Zi]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t;const n=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{const i=null==Hn?void 0:Hn.querySelectorAll(t);null==i||i.forEach((i=>{e===i&&n.push(t)}))})),n}get isEnabled(){var e,t;const n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[Zi],i=this._isDisabledServerSide;if(Ti(i)&&!Ai(n)&&!this.instance.config.advanced_disable_decide)return!1;const r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!r}_captureEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(!this.isEnabled)return;let n=Nr(e);var i;(kr(n)&&(n=n.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)&&(this.instance.config.rageclick&&null!==(i=this.rageclicks)&&void 0!==i&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick"));const r=t===di;if(n&&Lr(n,e,this.config,r,r?["copy","cut"]:void 0)){const{props:i,explicitNoCapture:r}=vc(n,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(r)return!1;const s=this.getElementSelectors(n);if(s&&s.length>0&&(i.$element_selectors=s),t===di){var o;const t=Rr(null==On||null===(o=On.getSelection())||void 0===o?void 0:o.toString()),n=e.type||"clipboard";if(!t)return!1;i.$selected_content=t,i.$copy_type=n}return this.instance.capture(t,i),!0}}isBrowserSupported(){return bi(null==Hn?void 0:Hn.querySelectorAll)}}const bc={};function wc(e){return function(e,t){const n=bc[e];if(n)return n;let i=t[e];if(wi(i)&&!Si(i))return bc[e]=i.bind(t);const r=t.document;if(r&&bi(r.createElement))try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const n=t.contentWindow;n&&n[e]&&(i=n[e]),r.head.removeChild(t)}catch(t){jn.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}return i&&bi(i)?bc[e]=i.bind(t):i}("MutationObserver",e)}function Sc(e,t){return Ri(e)&&e>=t}class Cc{_clicks=[];_defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,__onCapture:e});asRequiredConfig(e){var t,n,i,r;const o=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:o.element_attribute_ignorelist,scroll_threshold_ms:null!==(n=null==e?void 0:e.scroll_threshold_ms)&&void 0!==n?n:o.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:o.selection_change_threshold_ms,mutation_threshold_ms:null!==(r=null==e?void 0:e.mutation_threshold_ms)&&void 0!==r?r:o.mutation_threshold_ms,__onCapture:o.__onCapture}}constructor(e,t){this.instance=e,this._config=this.asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startMutationObserver(e)}_startMutationObserver(e){if(!this._mutationObserver){const t=wc(Un);this._mutationObserver=new t((e=>{this.onMutation(e)})),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,Un.removeEventListener("click",this._onClick),Un.removeEventListener("scroll",this._onScroll,!0),Un.removeEventListener("selectionchange",this._onSelectionChange)}onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Un.addEventListener("click",this._onClick)}_onClick=e=>{const t=function(e){const t=Nr(e);return t?{node:t,originalEvent:e,timestamp:Date.now()}:null}(e);Ti(t)||this._ignoreClick(t)||this._clicks.push(t),this._clicks.length&&ki(this._checkClickTimer)&&(this._checkClickTimer=Un.setTimeout((()=>{this._checkClicks()}),1e3))};_startScrollObserver(){Un.addEventListener("scroll",this._onScroll,!0)}_onScroll=()=>{const e=Date.now();e%50==0&&this._clicks.forEach((t=>{ki(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))};_startSelectionChangedObserver(){Un.addEventListener("selectionchange",this._onSelectionChange)}_onSelectionChange=()=>{this._lastSelectionChanged=Date.now()};_ignoreClick(e){if(!e)return!0;if(Sr(e.node))return!0;const t=this._clicks.some((t=>t.node===e.node&&Math.abs(t.timestamp-e.timestamp)<1e3));return!!t||!(!Ir(e.node,"html")&&Cr(e.node)&&!Fr.includes(e.node.tagName.toLowerCase()))}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const n of e){var t;n.mutationDelayMs=null!==(t=n.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&n.timestamp<=this._lastMutation?this._lastMutation-n.timestamp:void 0,n.absoluteDelayMs=Date.now()-n.timestamp,n.selectionChangedDelayMs=this._lastSelectionChanged&&n.timestamp<=this._lastSelectionChanged?this._lastSelectionChanged-n.timestamp:void 0;const e=Sc(n.scrollDelayMs,this._config.scroll_threshold_ms),i=Sc(n.selectionChangedDelayMs,this._config.selection_change_threshold_ms),r=Sc(n.mutationDelayMs,this._config.mutation_threshold_ms),o=Sc(n.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),s=Ri(n.scrollDelayMs)&&n.scrollDelayMs<this._config.scroll_threshold_ms,a=Ri(n.mutationDelayMs)&&n.mutationDelayMs<this._config.mutation_threshold_ms,l=Ri(n.selectionChangedDelayMs)&&n.selectionChangedDelayMs<this._config.selection_change_threshold_ms;s||a||l||(e||r||o||i?this._onCapture(n,{$dead_click_last_mutation_timestamp:this._lastMutation,$dead_click_event_timestamp:n.timestamp,$dead_click_scroll_timeout:e,$dead_click_mutation_timeout:r,$dead_click_absolute_timeout:o,$dead_click_selection_changed_timeout:i}):n.absoluteDelayMs<this._config.mutation_threshold_ms&&this._clicks.push(n))}this._clicks.length&&ki(this._checkClickTimer)&&(this._checkClickTimer=Un.setTimeout((()=>{this._checkClicks()}),1e3))}_captureDeadClick(e,t){this.instance.capture("$dead_click",{...t,...vc(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1}).props,$dead_click_scroll_delay_ms:e.scrollDelayMs,$dead_click_mutation_delay_ms:e.mutationDelayMs,$dead_click_absolute_delay_ms:e.absoluteDelayMs,$dead_click_selection_changed_delay_ms:e.selectionChangedDelayMs},{timestamp:new Date(e.timestamp)})}}Un.__PosthogExtensions__=Un.__PosthogExtensions__||{},Un.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new Cc(e,t);const Ic="$active_feature_flags",kc="$override_feature_flags",Ec="$feature_flag_payloads",xc=e=>{const t={};for(const[n,i]of ti(e||{}))i&&(t[n]=i);return t};class Tc{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){const e=this.instance.get_property(sr),t=this.instance.get_property(kc);if(!t)return e||{};const n=Qn({},e),i=Object.keys(t);for(let e=0;e<i.length;e++)n[i[e]]=t[i[e]];return this._override_warning||(jn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}getFlagPayloads(){return this.instance.get_property(Ec)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())}),5)}_reloadFeatureFlagsRequest(){if(this.instance.config.advanced_disable_feature_flags)return;this.setReloadingPaused(!0);const e=this.instance.config.token,t=this.instance.get_property(lr),n=this.instance.get_property(cr),i={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:n,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:this.instance.config.disable_compression?void 0:pi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var t;this.setReloadingPaused(!1);let n=!0;200===e.statusCode&&(this.$anon_distinct_id=void 0,n=!1),this.receivedFeatureFlags(null!==(t=e.json)&&void 0!==t?t:{},n),this._startReloadTimer()}})}getFeatureFlag(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0))return void jn.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.");const n=this.getFlagVariants()[e],i=`${n}`,r=this.instance.get_property(hr)||{};var o;!t.send_event&&"send_event"in t||(e in r&&r[e].includes(i)||(yi(r[e])?r[e].push(i):r[e]=[i],null===(o=this.instance.persistence)||void 0===o||o.register({[hr]:r}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})));return n}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){let 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);jn.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(!this.instance.persistence)return;this.instance.decideEndpointWasHit=!0;const n=this.getFlagVariants(),i=this.getFlagPayloads();!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=e.featureFlags,o=e.featureFlagPayloads;if(!r)return;if(yi(r)){const e={};if(r)for(let t=0;t<r.length;t++)e[r[t]]=!0;return void(t&&t.register({[Ic]:r,[sr]:e}))}let s=r,a=o;e.errorsWhileComputingFlags&&(s={...n,...s},a={...i,...a}),t&&t.register({[Ic]:Object.keys(xc(s)),[sr]:s||{},[Ec]:a||{}})}(e,this.instance.persistence,n,i),this._fireFeatureFlagsCallbacks(t)}override(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return jn.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(kc);else if(yi(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register({[kc]:t})}else this.instance.persistence.register({[kc]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){const{flags:t,flagVariants:n}=this._prepareFeatureFlagsForCallbacks();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var n;const i={[`$feature_enrollment/${e}`]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:i}),this.setPersonPropertiesForFlags(i,!1);const r={...this.getFlagVariants(),[e]:t};null===(n=this.instance.persistence)||void 0===n||n.register({[Ic]:Object.keys(xc(r)),[sr]:r}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.instance.get_property(ar);if(n&&!t)return e(n);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api",`/api/early_access_features/?token=${this.instance.config.token}`),method:"GET",callback:t=>{var n;if(!t.json)return;const i=t.json.earlyAccessFeatures;return null===(n=this.instance.persistence)||void 0===n||n.register({[ar]:i}),e(i)}})}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}_fireFeatureFlagsCallbacks(e){const{flags:t,flagVariants:n}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.instance.get_property(lr)||{};this.instance.register({[lr]:{...n,...e}}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(lr)}setGroupPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.instance.get_property(cr)||{};0!==Object.keys(n).length&&Object.keys(n).forEach((t=>{n[t]={...n[t],...e[t]},delete e[t]})),this.instance.register({[cr]:{...n,...e}}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.instance.get_property(cr)||{};this.instance.register({[cr]:{...t,[e]:{}}})}else this.instance.unregister(cr)}}
2
- /**
3
- * uuidv7: An experimental implementation of the proposed UUID Version 7
4
- *
5
- * @license Apache-2.0
6
- * @copyright 2021-2023 LiosK
7
- * @packageDocumentation
8
- *
9
- * from https://github.com/LiosK/uuidv7/blob/e501462ea3d23241de13192ceae726956f9b3b7d/src/index.ts
10
- */Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ri(e)&&isFinite(e)&&Math.floor(e)===e});const Mc="0123456789abcdef";class Rc{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||e<0||t<0||n<0||i<0||e>0xffffffffffff||t>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new Rc(r)}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e=e+Mc.charAt(this.bytes[t]>>>4)+Mc.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}clone(){return new Rc(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){const n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}class Ac{timestamp=0;counter=0;random=new Oc;generate(){const e=this.generateOrAbort();if(ki(e)){this.timestamp=0;const e=this.generateOrAbort();if(ki(e))throw new Error("Could not generate UUID after timestamp reset");return e}return e}generateOrAbort(){const 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 Rc.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}let Nc,Fc=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};On&&!ki(On.crypto)&&crypto.getRandomValues&&(Fc=e=>crypto.getRandomValues(e));class Oc{buffer=new Uint32Array(8);cursor=1/0;nextUint32(){return this.cursor>=this.buffer.length&&(Fc(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}const Lc=()=>Pc().toString(),Pc=()=>(Nc||(Nc=new Ac)).generate(),Dc="Thu, 01 Jan 1970 00:00:00 GMT";let $c="";const Bc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Hc(e,t){if(t){let t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hn;if($c)return $c;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const n=e.split(".");let i=Math.min(n.length,8);const r="dmn_chk_"+Lc(),o=new RegExp("(^|;)\\s*"+r+"=1");for(;!$c&&i--;){const e=n.slice(i).join("."),s=r+"=1;domain=."+e;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+Dc,$c=e)}return $c}(e);if(!t){const n=(e=>{const t=e.match(Bc);return t?t[0]:""})(e);n!==t&&jn.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}const qc={is_supported:()=>!!Hn,error:function(e){jn.error("cookieStore error: "+e)},get:function(e){if(Hn){try{const t=e+"=",n=Hn.cookie.split(";").filter((e=>e.length));for(let e=0;e<n.length;e++){let i=n[e];for(;" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){let t;try{t=JSON.parse(qc.get(e))||{}}catch{}return t},set:function(e,t,n,i,r){if(Hn)try{let o="",s="";const a=Hc(Hn.location.hostname,i);if(n){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),o="; expires="+e.toUTCString()}r&&(s="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+a+s;return l.length>3686.4&&jn.warn("cookieStore warning: large cookie, len="+l.length),Hn.cookie=l,l}catch{return}},remove:function(e,t){try{qc.set(e,"",-1,t)}catch{return}}};let Wc=null;const Vc={is_supported:function(){if(!Ti(Wc))return Wc;let e=!0;if(ki(On))e=!1;else try{const t="__mplssupport__",n="xyz";Vc.set(t,n),'"xyz"'!==Vc.get(t)&&(e=!1),Vc.remove(t)}catch{e=!1}return e||jn.error("localStorage unsupported; falling back to cookie store"),Wc=e,e},error:function(e){jn.error("localStorage error: "+e)},get:function(e){try{return null==On?void 0:On.localStorage.getItem(e)}catch(e){Vc.error(e)}return null},parse:function(e){try{return JSON.parse(Vc.get(e))||{}}catch{}return null},set:function(e,t){try{null==On||On.localStorage.setItem(e,JSON.stringify(t))}catch(e){Vc.error(e)}},remove:function(e){try{null==On||On.localStorage.removeItem(e)}catch(e){Vc.error(e)}}},Zc=["distinct_id",nr,ir,yr],Gc={...Vc,parse:function(e){try{let t={};try{t=qc.parse(e)||{}}catch{}const n=Qn(t,JSON.parse(Vc.get(e)||"{}"));return Vc.set(e,n),n}catch{}return null},set:function(e,t,n,i,r,o){try{Vc.set(e,t,void 0,void 0,o);const s={};Zc.forEach((e=>{t[e]&&(s[e]=t[e])})),Object.keys(s).length&&qc.set(e,s,n,i,r,o)}catch(e){Vc.error(e)}},remove:function(e,t){try{null==On||On.localStorage.removeItem(e),qc.remove(e,t)}catch(e){Vc.error(e)}}},Uc={},zc={is_supported:function(){return!0},error:function(e){jn.error("memoryStorage error: "+e)},get:function(e){return Uc[e]||null},parse:function(e){return Uc[e]||null},set:function(e,t){Uc[e]=t},remove:function(e){delete Uc[e]}};let jc=null;const Yc={is_supported:function(){if(!Ti(jc))return jc;if(jc=!0,ki(On))jc=!1;else try{const e="__support__",t="xyz";Yc.set(e,t),'"xyz"'!==Yc.get(e)&&(jc=!1),Yc.remove(e)}catch{jc=!1}return jc},error:function(e){jn.error("sessionStorage error: ",e)},get:function(e){try{return null==On?void 0:On.sessionStorage.getItem(e)}catch(e){Yc.error(e)}return null},parse:function(e){try{return JSON.parse(Yc.get(e))||null}catch{}return null},set:function(e,t){try{null==On||On.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Yc.error(e)}},remove:function(e){try{null==On||On.sessionStorage.removeItem(e)}catch(e){Yc.error(e)}}},Xc="Mobile",Jc="iOS",Kc="Android",Qc="Tablet",eu=Kc+" "+Qc,tu="iPad",nu="Apple",iu=nu+" Watch",ru="Safari",ou="BlackBerry",su="Samsung",au=su+"Browser",lu=su+" Internet",cu="Chrome",uu=cu+" OS",du=cu+" "+Jc,hu="Internet Explorer",pu=hu+" "+Xc,gu="Opera",fu=gu+" Mini",mu="Edge",_u="Microsoft "+mu,vu="Firefox",yu=vu+" "+Jc,bu="Nintendo",wu="PlayStation",Su="Xbox",Cu=Kc+" "+Xc,Iu=Xc+" "+ru,ku="Windows",Eu=ku+" Phone",xu="Nokia",Tu="Ouya",Mu="Generic",Ru=Mu+" "+Xc.toLowerCase(),Au=Mu+" "+Qc.toLowerCase(),Nu="Konqueror",Fu="(\\d+(\\.\\d+)?)",Ou=new RegExp("Version/"+Fu),Lu=new RegExp(Su,"i"),Pu=new RegExp(wu+" \\w+","i"),Du=new RegExp(bu+" \\w+","i"),$u=new RegExp(ou+"|PlayBook|BB10","i"),Bu={"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"};const Hu=(e,t)=>t&&ei(t,nu)||function(e){return ei(e,ru)&&!ei(e,cu)&&!ei(e,Kc)}(e),qu=function(e,t){return t=t||"",ei(e," OPR/")&&ei(e,"Mini")?fu:ei(e," OPR/")?gu:$u.test(e)?ou:ei(e,"IE"+Xc)||ei(e,"WPDesktop")?pu:ei(e,au)?lu:ei(e,mu)||ei(e,"Edg/")?_u:ei(e,"FBIOS")?"Facebook "+Xc:ei(e,"UCWEB")||ei(e,"UCBrowser")?"UC Browser":ei(e,"CriOS")?du:ei(e,"CrMo")?cu:ei(e,Kc)&&ei(e,ru)?Cu:ei(e,cu)?cu:ei(e,"FxiOS")?yu:ei(e.toLowerCase(),Nu.toLowerCase())?Nu:Hu(e,t)?ei(e,Xc)?Iu:ru:ei(e,vu)?vu:ei(e,"MSIE")||ei(e,"Trident/")?hu:ei(e,"Gecko")?vu:""},Wu={[pu]:[new RegExp("rv:"+Fu)],[_u]:[new RegExp(mu+"?\\/"+Fu)],[cu]:[new RegExp("("+cu+"|CrMo)\\/"+Fu)],[du]:[new RegExp("CriOS\\/"+Fu)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Fu)],[ru]:[Ou],[Iu]:[Ou],[gu]:[new RegExp("(Opera|OPR)\\/"+Fu)],[vu]:[new RegExp(vu+"\\/"+Fu)],[yu]:[new RegExp("FxiOS\\/"+Fu)],[Nu]:[new RegExp("Konqueror[:/]?"+Fu,"i")],[ou]:[new RegExp(ou+" "+Fu),Ou],[Cu]:[new RegExp("android\\s"+Fu,"i")],[lu]:[new RegExp(au+"\\/"+Fu)],[hu]:[new RegExp("(rv:|MSIE )"+Fu)],Mozilla:[new RegExp("rv:"+Fu)]},Vu=[[new RegExp(Su+"; "+Su+" (.*?)[);]","i"),e=>[Su,e&&e[1]||""]],[new RegExp(bu,"i"),[bu,""]],[new RegExp(wu,"i"),[wu,""]],[$u,[ou,""]],[new RegExp(ku,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Eu,""];if(new RegExp(Xc).test(t)&&!/IEMobile\b/.test(t))return[ku+" "+Xc,""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){const e=n[1];let i=Bu[e]||"";return/arm/i.test(t)&&(i="RT"),[ku,i]}return[ku,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){const t=[e[3],e[4],e[5]||"0"];return[Jc,t.join(".")]}return[Jc,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=ki(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Kc+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Kc+")","i"),e=>{if(e&&e[2]){const t=[e[2],e[3],e[4]||"0"];return[Kc,t.join(".")]}return[Kc,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];if(e&&e[1]){const n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[uu,""]],[/Linux|debian/i,["Linux",""]]],Zu=function(e){return Du.test(e)?bu:Pu.test(e)?wu:Lu.test(e)?Su:new RegExp(Tu,"i").test(e)?Tu:new RegExp("("+Eu+"|WPDesktop)","i").test(e)?Eu:/iPad/.test(e)?tu:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?iu:$u.test(e)?ou:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(xu,"i").test(e)?xu:/(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(Xc).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)?Kc:eu:Kc:new RegExp("(pda|"+Xc+")","i").test(e)?Ru:new RegExp(Qc,"i").test(e)&&!new RegExp(Qc+" pc","i").test(e)?Au:""},Gu="https?://(.*)",Uu=["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","rdt_cid"],zu={campaignParams:function(e){return Hn?this._campaignParamsFromUrl(Hn.URL,e):{}},_campaignParamsFromUrl:function(e,t){const n=Uu.concat(t||[]),i={};return Kn(n,(function(t){const n=Bi(e,t);i[t]=n||null})),i},_searchEngine:function(e){return e?0===e.search(Gu+"google.([^/?]*)")?"google":0===e.search(Gu+"bing.com")?"bing":0===e.search(Gu+"yahoo.com")?"yahoo":0===e.search(Gu+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){const t=zu._searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(!Ti(t)){i.$search_engine=t;const e=Hn?Bi(Hn.referrer,n):"";e.length&&(i.ph_keyword=e)}return i},searchInfo:function(){const e=null==Hn?void 0:Hn.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:qu,browserVersion:function(e,t){const n=qu(e,t),i=Wu[n];if(ki(i))return null;for(let t=0;t<i.length;t++){const n=i[t],r=e.match(n);if(r)return parseFloat(r[r.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(let t=0;t<Vu.length;t++){const[n,i]=Vu[t],r=n.exec(e),o=r&&(bi(i)?i(r,e):i);if(o)return o}return["",""]},device:Zu,deviceType:function(e){const t=Zu(e);return t===tu||t===eu||"Kobo"===t||"Kindle Fire"===t||t===Au?Qc:t===bu||t===Su||t===wu||t===Tu?"Console":t===iu?"Wearable":t?Xc:"Desktop"},referrer:function(){return(null==Hn?void 0:Hn.referrer)||"$direct"},referringDomain:function(){var e;return null!=Hn&&Hn.referrer&&(null===(e=Pi(Hn.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:null==qn?void 0:qn.href}},initialPersonPropsFromInfo:function(e){var t;const{r:n,u:i}=e,r={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(t=Pi(n))||void 0===t?void 0:t.host};if(i){r.$initial_current_url=i;const e=Pi(i);r.$initial_host=null==e?void 0:e.host,r.$initial_pathname=null==e?void 0:e.pathname;Kn(this._campaignParamsFromUrl(i),(function(e,t){r["$initial_"+oi(t)]=e}))}if(n){Kn(this._searchInfoFromReferrer(n),(function(e,t){r["$initial_"+oi(t)]=e}))}return r},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},properties:function(){if(!Gn)return{};const[e,t]=zu.os(Gn);return Qn(ri({$os:e,$os_version:t,$browser:zu.browser(Gn,navigator.vendor),$device:zu.device(Gn),$device_type:zu.deviceType(Gn),$timezone:zu.timezone()}),{$current_url:null==qn?void 0:qn.href,$host:null==qn?void 0:qn.host,$pathname:null==qn?void 0:qn.pathname,$raw_user_agent:Gn.length>1e3?Gn.substring(0,997)+"...":Gn,$browser_version:zu.browserVersion(Gn,navigator.vendor),$browser_language:zu.browserLanguage(),$screen_height:null==On?void 0:On.screen.height,$screen_width:null==On?void 0:On.screen.width,$viewport_height:null==On?void 0:On.innerHeight,$viewport_width:null==On?void 0:On.innerWidth,$lib:"web",$lib_version:Fn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!Gn)return{};const[e,t]=zu.os(Gn);return Qn(ri({$os:e,$os_version:t,$browser:zu.browser(Gn,navigator.vendor)}),{$browser_version:zu.browserVersion(Gn,navigator.vendor)})}},ju=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Yu{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(e=>{let 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"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&jn.info("Persistence loaded",e.persistence,{...this.props}),this.update_config(e,e),this.save()}buildStorage(e){let t;-1===ju.indexOf(e.persistence.toLowerCase())&&(jn.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=e.persistence.toLowerCase();return t="localstorage"===n&&Vc.is_supported()?Vc:"localstorage+cookie"===n&&Gc.is_supported()?Gc:"sessionstorage"===n&&Yc.is_supported()?Yc:"memory"===n?zc:"cookie"===n?qc:Gc.is_supported()?Gc:qc,t}properties(){const e={};return Kn(this.props,(function(t,n){if(n===sr&&Ci(t)){const n=Object.keys(t);for(let i=0;i<n.length;i++)e[`$feature/${n[i]}`]=t[n[i]]}else(function(e,t){let n=!1;return Ti(e)?n:$n&&e.indexOf===$n?-1!=e.indexOf(t):(Kn(e,(function(e){if(n||(n=e===t))return Yn})),n)})(wr,n)||(e[n]=t)})),e}load(){if(this.disabled)return;const e=this.storage.parse(this.name);e&&(this.props=Qn({},e))}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Ci(e)){ki(t)&&(t="None"),this.expire_days=ki(n)?this.default_expiry:n;let i=!1;if(Kn(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Ci(e)){this.expire_days=ki(t)?this.default_expiry:t;let n=!1;if(Kn(e,((t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this.props[i]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){const e=zu.campaignParams(this.config.custom_campaign_params);Ii(ri(e))||this.register(zu.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0}}update_search_keyword(){this.register(zu.searchInfo())}update_referrer_info(){this.register_once(zu.referrerInfo(),void 0)}set_initial_person_info(){this.props[mr]||this.props[_r]||this.register_once({[vr]:zu.initialPersonInfo()},void 0)}get_referrer_info(){return ri({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){const e={};Kn([_r,mr],(t=>{const n=this.props[t];n&&Kn(n,(function(t,n){e["$initial_"+oi(n)]=t}))}));const t=this.props[vr];if(t){const n=zu.initialPersonPropsFromInfo(t);Qn(e,n)}return e}safe_merge(e){return Kn(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(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){const t=this.buildStorage(e),n=this.props;this.clear(),this.storage=t,this.props=n,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){const n=this.props[Vi]||{};n[e]=t,this.props[Vi]=n,this.save()}remove_event_timer(e){const t=(this.props[Vi]||{})[e];return ki(t)||(delete this.props[Vi][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function Xu(e){var t;return(null===(t=JSON.stringify(e,function(){const e=[];return function(t,n){if(Ci(n)){for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}return n}}()))||void 0===t?void 0:t.length)||0}function Ju(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),n=e.data.slice(0,t),i=e.data.slice(t);return[Ju({size:Xu(n),data:n,sessionId:e.sessionId,windowId:e.windowId}),Ju({size:Xu(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var Ku=(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",e))(Ku||{}),Qu=(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",e[e.CustomElement=16]="CustomElement",e))(Qu||{});function ed(e,t,n,i){return t>n&&(jn.warn("min cannot be greater than max."),t=n),Ri(e)?e>n?(i&&jn.warn(i+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(i&&jn.warn(i+" cannot be less than min: "+t+". Using min value instead."),t):e:(i&&jn.warn(i+" must be a number. Defaulting to max value:"+n),n)}class td{bucketSize=100;refillRate=10;mutationBuckets={};loggedTracker={};constructor(e){var t,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rrweb=e,this.options=i,this.refillRate=ed(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ed(null!==(n=this.options.bucketSize)&&void 0!==n?n:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}refillBuckets=()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))};getNodeOrRelevantParent=e=>{const t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this.rrweb.mirror.getId(e),e]}return[e,t]};numberOfChanges=e=>{var t,n,i,r,o,s,a,l;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(i=null===(r=e.attributes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)+(null!==(o=null===(s=e.texts)||void 0===s?void 0:s.length)&&void 0!==o?o:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)};throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,n=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t;const[n,i]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[n])return!1;var r,o;(this.mutationBuckets[n]=null!==(t=this.mutationBuckets[n])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[n]=Math.max(this.mutationBuckets[n]-1,0),0===this.mutationBuckets[n])&&(this.loggedTracker[n]||(this.loggedTracker[n]=!0,null===(r=(o=this.options).onBlockedNode)||void 0===r||r.call(o,n,i)));return e})));const i=this.numberOfChanges(t);return 0!==i||n===i?e:void 0}}var nd=Uint8Array,id=Uint16Array,rd=Uint32Array,od=new nd([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]),sd=new nd([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]),ad=new nd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ld=function(e,t){for(var n=new id(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new rd(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},cd=ld(od,2),ud=cd[0],dd=cd[1];ud[28]=258,dd[258]=28;for(var hd=ld(sd,0)[1],pd=new id(32768),gd=0;gd<32768;++gd){var fd=(43690&gd)>>>1|(21845&gd)<<1;fd=(61680&(fd=(52428&fd)>>>2|(13107&fd)<<2))>>>4|(3855&fd)<<4,pd[gd]=((65280&fd)>>>8|(255&fd)<<8)>>>1}var md=function(e,t,n){for(var i=e.length,r=0,o=new id(t);r<i;++r)++o[e[r]-1];var s,a=new id(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new id(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var c=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[pd[d]>>>l]=c}else for(s=new id(i),r=0;r<i;++r)s[r]=pd[a[e[r]-1]++]>>>15-e[r];return s},_d=new nd(288);for(gd=0;gd<144;++gd)_d[gd]=8;for(gd=144;gd<256;++gd)_d[gd]=9;for(gd=256;gd<280;++gd)_d[gd]=7;for(gd=280;gd<288;++gd)_d[gd]=8;var vd=new nd(32);for(gd=0;gd<32;++gd)vd[gd]=5;var yd=md(_d,9,0),bd=md(vd,5,0),wd=function(e){return(e/8>>0)+(7&e&&1)},Sd=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof id?id:e instanceof rd?rd:nd)(n-t);return i.set(e.subarray(t,n)),i},Cd=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8},Id=function(e,t,n){n<<=7&t;var i=t/8>>0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},kd=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new nd(0),0];if(1==r){var s=new nd(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new id(h+1),g=Ed(n[u-1],p,0);if(g>t){i=0;var f=0,m=g-t,_=1<<m;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var v=o[i].s;if(!(p[v]>t))break;f+=_-(1<<g-p[v]),p[v]=t}for(f>>>=m;f>0;){var y=o[i].s;p[y]<t?f-=1<<t-p[y]++-1:++i}for(;i>=0&&f;--i){var b=o[i].s;p[b]==t&&(--p[b],++f)}g=t}return[new nd(p),g]},Ed=function(e,t,n){return-1==e.s?Math.max(Ed(e.l,t,n+1),Ed(e.r,t,n+1)):t[e.s]=n},xd=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new id(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Td=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Md=function(e,t,n){var i=n.length,r=wd(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Rd=function(e,t,n,i,r,o,s,a,l,c,u){Cd(t,u++,n),++r[256];for(var d=kd(r,15),h=d[0],p=d[1],g=kd(o,15),f=g[0],m=g[1],_=xd(h),v=_[0],y=_[1],b=xd(f),w=b[0],S=b[1],C=new id(19),I=0;I<v.length;++I)C[31&v[I]]++;for(I=0;I<w.length;++I)C[31&w[I]]++;for(var k=kd(C,7),E=k[0],x=k[1],T=19;T>4&&!E[ad[T-1]];--T);var M,R,A,N,F=c+5<<3,O=Td(r,_d)+Td(o,vd)+s,L=Td(r,h)+Td(o,f)+s+14+3*T+Td(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(F<=O&&F<=L)return Md(t,u,e.subarray(l,l+c));if(Cd(t,u,1+(L<O)),u+=2,L<O){M=md(h,p,0),R=h,A=md(f,m,0),N=f;var P=md(E,x,0);Cd(t,u,y-257),Cd(t,u+5,S-1),Cd(t,u+10,T-4),u+=14;for(I=0;I<T;++I)Cd(t,u+3*I,E[ad[I]]);u+=3*T;for(var D=[v,w],$=0;$<2;++$){var B=D[$];for(I=0;I<B.length;++I){var H=31&B[I];Cd(t,u,P[H]),u+=E[H],H>15&&(Cd(t,u,B[I]>>>5&127),u+=B[I]>>>12)}}}else M=yd,R=_d,A=bd,N=vd;for(I=0;I<a;++I)if(i[I]>255){H=i[I]>>>18&31;Id(t,u,M[H+257]),u+=R[H+257],H>7&&(Cd(t,u,i[I]>>>23&31),u+=od[H]);var q=31&i[I];Id(t,u,A[q]),u+=N[q],q>3&&(Id(t,u,i[I]>>>5&8191),u+=sd[q])}else Id(t,u,M[i[I]]),u+=R[i[I]];return Id(t,u,M[256]),u+R[256]},Ad=new rd([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Nd=function(){for(var e=new rd(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Fd=function(){var e=4294967295;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=Nd[255&n^t[i]]^n>>>8;e=n},d:function(){return 4294967295^e}}},Od=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new nd(i+s+5*(1+Math.floor(s/7e3))+r),l=a.subarray(i,a.length-r),c=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?c=Md(l,c,e.subarray(u,d)):(l[u]=o,c=Md(l,c,e.subarray(u,s)))}else{for(var h=Ad[t-1],p=h>>>13,g=8191&h,f=(1<<n)-1,m=new id(32768),_=new id(f+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&f},w=new rd(25e3),S=new id(288),C=new id(32),I=0,k=0,E=(u=0,0),x=0,T=0;u<s;++u){var M=b(u),R=32767&u,A=_[M];if(m[R]=A,_[M]=R,x<=u){var N=s-u;if((I>7e3||E>24576)&&N>423){c=Rd(e,l,0,w,S,C,k,E,T,u-T,c),E=I=k=0,T=u;for(var F=0;F<286;++F)S[F]=0;for(F=0;F<30;++F)C[F]=0}var O=2,L=0,P=g,D=R-A&32767;if(N>2&&M==b(u-D))for(var $=Math.min(p,N)-1,B=Math.min(32767,u),H=Math.min(258,N);D<=B&&--P&&R!=A;){if(e[u+O]==e[u+O-D]){for(var q=0;q<H&&e[u+q]==e[u+q-D];++q);if(q>O){if(O=q,L=D,q>$)break;var W=Math.min(D,q-2),V=0;for(F=0;F<W;++F){var Z=u-D+F+32768&32767,G=Z-m[Z]+32768&32767;G>V&&(V=G,A=Z)}}}D+=(R=A)-(A=m[R])+32768&32767}if(L){w[E++]=268435456|dd[O]<<18|hd[L];var U=31&dd[O],z=31&hd[L];k+=od[U]+sd[z],++S[257+U],++C[z],x=u+O,++I}else w[E++]=e[u],++S[e[u]]}}c=Rd(e,l,o,w,S,C,k,E,T,u-T,c)}return Sd(a,0,i+wd(c)+r)}(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,i,!r)},Ld=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Pd=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&&Ld(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}},Dd=function(e){return 10+(e.filename&&e.filename.length+1||0)};function $d(e,t){void 0===t&&(t={});var n=Fd(),i=e.length;n.p(e);var r=Od(e,t,Dd(t),8),o=r.length;return Pd(r,t),Ld(r,o-8,n.d()),Ld(r,o-4,i),r}function Bd(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new nd(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new nd(r+8+(n-s<<1));a.set(i),i=a}var l=e.charCodeAt(s);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return Sd(i,0,r)}const Hd=3e5,qd=[Qu.MouseMove,Qu.MouseInteraction,Qu.Scroll,Qu.ViewportResize,Qu.Input,Qu.TouchMove,Qu.MediaInteraction,Qu.Drag],Wd=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}),Vd="[SessionRecording]";function Zd(e){return function(e,t){for(var n="",i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}($d(Bd(JSON.stringify(e))),!0)}function Gd(e){return e.type===Ku.Custom&&"sessionIdle"===e.data.tag}function Ud(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class zd{queuedRRWebEvents=[];isIdle=!1;_linkedFlagSeen=!1;_lastActivityTimestamp=Date.now();_linkedFlag=null;_removePageViewCaptureHook=void 0;_onSessionIdListener=void 0;_persistDecideOnSessionListener=void 0;_samplingSessionListener=void 0;_urlTriggers=[];_urlBlocklist=[];_urlBlocked=!1;_eventTriggers=[];_removeEventTriggerCaptureHook=void 0;_forceAllowLocalhostNetworkCapture=!1;get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==Un||null===(e=Un.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Vd+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:Hd}get isSampled(){const e=this.instance.get_property(ir);return Ai(e)?e:null}get sessionDuration(){var e,t;const 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],{sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return n?n.timestamp-i:null}get isRecordingEnabled(){const e=!!this.instance.get_property(Xi),t=!this.instance.config.disable_session_recording;return On&&e&&t}get isConsoleLogCaptureEnabled(){const e=!!this.instance.get_property(Ji),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,n,i,r,o;const s=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(Qi),l=null!==(e=null!==(t=null==s?void 0:s.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,c=null!==(n=null!==(i=null==s?void 0:s.canvasFps)&&void 0!==i?i:null==a?void 0:a.fps)&&void 0!==n?n:0,u=null!==(r=null!==(o=null==s?void 0:s.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:0;return{enabled:l,fps:ed(c,0,12,"canvas recording fps"),quality:ed(u,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t;const n=this.instance.get_property(Ki),i={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},r=(null==i?void 0:i.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==i?void 0:i.recordBody)||(null==n?void 0:n.recordBody),s=Ci(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(Ai(s)?s:null==n?void 0:n.capturePerformance);return r||o||a?{recordHeaders:r,recordBody:o,recordPerformance:a}:void 0}get sampleRate(){const e=this.instance.get_property(er);return Ri(e)?e:null}get minimumDuration(){const e=this.instance.get_property(tr);return Ri(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?Mi(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":this._urlBlocked?"paused":Ai(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;if(0===this._urlTriggers.length)return"trigger_disabled";return(null===(e=this.instance)||void 0===e?void 0:e.get_property(rr))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;if(0===this._eventTriggers.length)return"trigger_disabled";return(null===(e=this.instance)||void 0===e?void 0:e.get_property(or))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){const e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw jn.error(Vd+" started without valid sessionManager"),new Error(Vd+" started without valid sessionManager. This is a bug.");const{sessionId:t,windowId:n}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=n,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&jn.warn(Vd+` session_idle_threshold_ms (${this.sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this.sessionManager.sessionTimeoutMs}). Session will never be detected as idle`)}_onBeforeUnload=()=>{this._flushBuffer()};_onOffline=()=>{this._tryAddCustomEvent("browser offline",{})};_onOnline=()=>{this._tryAddCustomEvent("browser online",{})};_onVisibilityChange=()=>{if(null!=Hn&&Hn.visibilityState){const e="window "+Hn.visibilityState;this._tryAddCustomEvent(e,{})}};startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),null==On||On.addEventListener("beforeunload",this._onBeforeUnload),null==On||On.addEventListener("offline",this._onOffline),null==On||On.addEventListener("online",this._onOnline),null==On||On.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Mi(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance._addCaptureHook((e=>{try{if("$pageview"===e){const e=On?this._maskUrl(On.location.href):"";if(!e)return;this._tryAddCustomEvent("$pageview",{href:e})}}catch(e){jn.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,n)=>{var i,r,o,s;n&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:n}),null===(i=this.instance)||void 0===i||null===(r=i.persistence)||void 0===r||r.unregister(or),null===(o=this.instance)||void 0===o||null===(s=o.persistence)||void 0===s||s.unregister(rr))})))):this.stopRecording()}stopRecording(){var e,t,n,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==On||On.removeEventListener("beforeunload",this._onBeforeUnload),null==On||On.removeEventListener("offline",this._onOffline),null==On||On.removeEventListener("online",this._onOnline),null==On||On.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(e=this._removePageViewCaptureHook)||void 0===e||e.call(this),this._removePageViewCaptureHook=void 0,null===(t=this._removeEventTriggerCaptureHook)||void 0===t||t.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(i=this._samplingSessionListener)||void 0===i||i.call(this),this._samplingSessionListener=void 0,jn.info(Vd+" stopped"))}makeSamplingDecision(e){var t;const n=this.sessionId!==e,i=this.sampleRate;var r;if(!Ri(i))return void(null===(r=this.instance.persistence)||void 0===r||r.register({[ir]:null}));const o=this.isSampled;let s;const a=n||!Ai(o);if(a){s=Math.random()<i}else s=o;a&&(s?this._reportStarted("sampled"):jn.warn(Vd+` Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:s})),null===(t=this.instance.persistence)||void 0===t||t.register({[ir]:s})}afterDecideResponse(e){var t,n,i,r,o,s;(this._persistDecideResponse(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(n=e.sessionRecording)&&void 0!==n&&n.endpoint)&&(this._endpoint=null===(s=e.sessionRecording)||void 0===s?void 0:s.endpoint);if(this._setupSampling(),!Mi(this._linkedFlag)&&!this._linkedFlagSeen){const e=Ei(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,t=Ei(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((n,i)=>{const r=Ci(i)&&e in i,o=t?i[e]===t:r;o&&this._reportStarted("linked_flag_matched",{linkedFlag:e,linkedVariant:t}),this._linkedFlagSeen=o}))}null!==(i=e.sessionRecording)&&void 0!==i&&i.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(r=e.sessionRecording)&&void 0!==r&&r.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(o=e.sessionRecording)&&void 0!==o&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Ri(this.sampleRate)&&Mi(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistDecideResponse(e){if(this.instance.persistence){var t;const n=this.instance.persistence,i=()=>{var t,i,r,o,s,a,l;const c=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,u=Mi(c)?null:parseFloat(c),d=null===(i=e.sessionRecording)||void 0===i?void 0:i.minimumDurationMilliseconds;n.register({[Xi]:!!e.sessionRecording,[Ji]:null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled,[Ki]:{capturePerformance:e.capturePerformance,...null===(o=e.sessionRecording)||void 0===o?void 0:o.networkPayloadCapture},[Qi]:{enabled:null===(s=e.sessionRecording)||void 0===s?void 0:s.recordCanvas,fps:null===(a=e.sessionRecording)||void 0===a?void 0:a.canvasFps,quality:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasQuality},[er]:u,[tr]:ki(d)?null:d})};i(),null===(t=this._persistDecideOnSessionListener)||void 0===t||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(e){var t;let 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:Date.now()})}_startCapture(e){if(!ki(Object.assign)&&!ki(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,n;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=Un.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"recorder",(e=>{if(e)return jn.error(Vd+" could not load recorder",e);this._onScriptLoaded()}));jn.info(Vd+" starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}isInteractiveEvent(e){var t;return 3===e.type&&-1!==qd.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this.isInteractiveEvent(e);if(!t&&!this.isIdle){e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer())}let 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)return;const{windowId:i,sessionId:r}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this.sessionId!==r,s=this.windowId!==i;this.windowId=i,this.sessionId=r,o||s?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this._scheduleFullSnapshot()}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):jn.warn(Vd+" could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Wd((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Wd((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e;const t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},n=this.instance.config.session_recording;for(const[e,i]of Object.entries(n||{}))e in t&&("maskInputOptions"===e?t.maskInputOptions={password:!0,...i}:t[e]=i);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),!this.rrwebRecord)return void jn.error(Vd+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new td(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{const n=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;jn.info(n,{node:t}),this.log(Vd+" "+n,"warn")}});const i=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord({emit:e=>{this.onRRwebEmit(e)},plugins:i,...t}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:i.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle)return;const e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}_gatherRRWebPlugins(){var e,t,n,i;const r=[],o=null===(e=Un.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&r.push(o());const s=null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.rrwebPlugins)||void 0===i?void 0:i.getRecordNetworkPlugin;if(this.networkPayloadCapture&&bi(s)){!Li.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(ro(this.instance.config,this.networkPayloadCapture))):jn.info(Vd+" NetworkCapture not started because we are on localhost.")}return r}onRRwebEmit(e){var t;if(this._processQueuedEvents(),!e||!Ci(e))return;if(e.type===Ku.Meta){const t=this._maskUrl(e.data.href);if(this._lastHref=t,!t)return;e.data.href=t}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"===this.status&&!function(e){return e.type===Ku.Custom&&"recording paused"===e.data.tag}(e))return;e.type===Ku.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Ku.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();const n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(!n)return;const i=function(e){const t=e;if(t&&Ci(t)&&6===t.type&&Ci(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]"));const n=[];for(let e=0;e<t.data.payload.payload.length;e++)t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?n.push(t.data.payload.payload[e].slice(0,2e3)+"...[truncated]"):n.push(t.data.payload.payload[e]);return t.data.payload.payload=n,e}return e}(n);if(this._updateWindowAndSessionIds(i),this.isIdle&&!Gd(i))return;if(Gd(i)){const e=i.data.payload;if(e){const t=e.lastActivityTimestamp,n=e.threshold;i.timestamp=t+n}}const r=null===(t=this.instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(Xu(e)<1024)return e;try{if(e.type===Ku.FullSnapshot)return{...e,data:Zd(e.data),cv:"2024-10"};if(e.type===Ku.IncrementalSnapshot&&e.data.source===Qu.Mutation)return{...e,cv:"2024-10",data:{...e.data,texts:Zd(e.data.texts),attributes:Zd(e.data.attributes),removes:Zd(e.data.removes),adds:Zd(e.data.adds)}};if(e.type===Ku.IncrementalSnapshot&&e.data.source===Qu.StyleSheetRule)return{...e,cv:"2024-10",data:{...e.data,adds:Zd(e.data.adds),removes:Zd(e.data.removes)}}}catch(e){jn.error(Vd+" could not compress event - will use uncompressed event",e)}return e}(i):i,o={$snapshot_bytes:Xu(r),$snapshot_data:r,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(o):this.clearBuffer()}_pageViewFallBack(){if(this.instance.config.capture_pageview||!On)return;const e=this._maskUrl(On.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}_processQueuedEvents(){if(this.queuedRRWebEvents.length){const e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(e){const t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var n;let i={url:e};return i=t.maskNetworkRequestFn(i),null===(n=i)||void 0===n?void 0:n.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);const e=this.minimumDuration,t=this.sessionDuration,n=Ri(t)&&t>=0,i=Ri(e)&&n&&t<e;if("buffering"===this.status||i)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;if(this.buffer.data.length>0){Ju(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId})}))}return this.clearBuffer()}_captureSnapshotBuffered(e){var t;const n=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+n>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0===On||!On.location.href)return;const e=On.location.href,t="paused"===this.status,n=Ud(e,this._urlBlocklist);n&&!t?this._pauseRecording():!n&&t&&this._resumeRecording(),Ud(e,this._urlTriggers)&&this._activateTrigger("url")}_activateTrigger(e){var t,n;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register({["url"===e?rr:or]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==Hn||null===(e=Hn.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),jn.info(Vd+" recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==Hn||null===(e=Hn.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),jn.info(Vd+" recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&Mi(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){jn.error(Vd+"Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[ir]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),jn.info(Vd+" "+e.replace("_"," "),t),ei(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}class jd{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}call(){const e={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(lr),group_properties:this.instance.get_property(cr),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:e,compression:this.instance.config.disable_compression?void 0:pi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>this.parseDecideResponse(e.json)})}parseDecideResponse(e){this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();const t=!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:{},t),t)jn.error("Failed to fetch feature flags from PostHog.");else{if(!Hn||!Hn.body)return jn.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.parseDecideResponse(e)}),500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps)for(const{id:t,url:o}of e.siteApps){var n,i,r;Un[`__$$ph_site_app_${t}`]=this.instance,null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=(r=n).loadSiteApp)||void 0===i||i.call(r,this.instance,o,(e=>{if(e)return jn.error(`Error while initializing PostHog app with config id ${t}`,e)}))}else e.siteApps.length>0&&jn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}const Yd=null!=On&&On.location?Hi(On.location.hash,"__posthog")||Hi(location.hash,"state"):null,Xd="_postHogToolbarParams";var Jd;!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Jd||(Jd={}));class Kd{constructor(e){this.instance=e}setToolbarState(e){Un.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=Un.ph_toolbar_state)&&void 0!==e?e:Jd.UNINITIALIZED}maybeLoadToolbar(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!On||!Hn)return!1;n=null!==(e=n)&&void 0!==e?e:On.location,r=null!==(t=r)&&void 0!==t?t:On.history;try{if(!i){try{On.localStorage.setItem("test","test"),On.localStorage.removeItem("test")}catch{return!1}i=null==On?void 0:On.localStorage}const e=Yd||Hi(n.hash,"__posthog")||Hi(n.hash,"state");let t;const o=e?ni((()=>JSON.parse(atob(decodeURIComponent(e)))))||ni((()=>JSON.parse(decodeURIComponent(e)))):null;return o&&"ph_authorize"===o.action?(t=o,t.source="url",t&&Object.keys(t).length>0&&(o.desiredHash?n.hash=o.desiredHash:r?r.replaceState(r.state,"",n.pathname+n.search):n.hash="")):(t=JSON.parse(i.getItem(Xd)||"{}"),t.source="localstorage",delete t.userIntent),!(!t.token||this.instance.config.token!==t.token)&&(this.loadToolbar(t),!0)}catch{return!1}}_callLoadToolbar(e){(Un.ph_load_toolbar||Un.ph_load_editor)(e,this.instance)}loadToolbar(e){const t=!(null==Hn||!Hn.getElementById(br));if(!On||t)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,i={token:this.instance.config.token,...e,apiURL:this.instance.requestRouter.endpointFor("ui"),...n?{instrument:!1}:{}};if(On.localStorage.setItem(Xd,JSON.stringify({...i,source:void 0})),this.getToolbarState()===Jd.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Jd.UNINITIALIZED){var r,o;this.setToolbarState(Jd.LOADING),null===(r=Un.__PosthogExtensions__)||void 0===r||null===(o=r.loadExternalDependency)||void 0===o||o.call(r,this.instance,"toolbar",(e=>{if(e)return jn.error("Failed to load toolbar",e),void this.setToolbarState(Jd.UNINITIALIZED);this.setToolbarState(Jd.LOADED),this._callLoadToolbar(i)})),li(On,"turbolinks:load",(()=>{this.setToolbarState(Jd.UNINITIALIZED),this.loadToolbar(i)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){let 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)}}class Qd{isPaused=!0;queue=[];flushTimeoutMs=3e3;constructor(e){this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();const e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),n=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];n.map((e=>{this.sendRequest({...e,transport:"sendBeacon"})}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){const e=this.formatQueue();for(const t in e){const n=e[t],i=(new Date).getTime();n.data&&yi(n.data)&&Kn(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),this.sendRequest(n)}}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){const e={};return Kn(this.queue,(t=>{var n;const i=t,r=(i?i.batchKey:null)||i.url;ki(e[r])&&(e[r]={...i,data:[]}),null===(n=e[r].data)||void 0===n||n.push(i.data)})),this.queue=[],e}}const eh=!!Vn||!!Wn,th="text/plain",nh=(e,t)=>{const[n,i]=e.split("?"),r={...t};null==i||i.split("&").forEach((e=>{const[t]=e.split("=");delete r[t]}));let o=$i(r);return o=o?(i?i+"&":"")+o:i,`${n}?${o}`},ih=e=>{let{data:t,compression:n}=e;if(!t)return;if(n===pi.GZipJS){const e=$d(Bd(JSON.stringify(t)),{mtime:0}),n=new Blob([e],{type:th});return{contentType:th,body:n,estimatedSize:n.size}}if(n===pi.Base64){const e=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n,i,r,o,s,a,l,c,u=0,d=0,h="";const p=[];if(!e)return e;e=ai(e);do{n=e.charCodeAt(u++),i=e.charCodeAt(u++),r=e.charCodeAt(u++),c=n<<16|i<<8|r,o=c>>18&63,s=c>>12&63,a=c>>6&63,l=63&c,p[d++]=t.charAt(o)+t.charAt(s)+t.charAt(a)+t.charAt(l)}while(u<e.length);switch(h=p.join(""),e.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"="}return h}(JSON.stringify(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const i=JSON.stringify(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},rh=e=>{var t;const n=new Vn;n.open(e.method||"GET",e.url,!0);const{contentType:i,body:r}=null!==(t=ih(e))&&void 0!==t?t:{};Kn(e.headers,(function(e,t){n.setRequestHeader(t,e)})),i&&n.setRequestHeader("Content-Type",i),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(4===n.readyState){var t;const i={statusCode:n.status,text:n.responseText};if(200===n.status)try{i.json=JSON.parse(n.responseText)}catch{}null===(t=e.callback)||void 0===t||t.call(e,i)}},n.send(r)},oh=e=>{var t,n;const{contentType:i,body:r,estimatedSize:o}=null!==(t=ih(e))&&void 0!==t?t:{},s=new Headers;Kn(e.headers,(function(e,t){s.append(t,e)})),i&&s.append("Content-Type",i);const a=e.url;let l=null;if(Zn){const t=new Zn;l={signal:t.signal,timeout:setTimeout((()=>t.abort()),e.timeout)}}Wn(a,{method:(null==e?void 0:e.method)||"GET",headers:s,keepalive:"POST"===e.method&&(o||0)<52428.8,body:r,signal:null===(n=l)||void 0===n?void 0:n.signal}).then((t=>t.text().then((n=>{var i;const r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){jn.error(e)}null===(i=e.callback)||void 0===i||i.call(e,r)})))).catch((t=>{var n;jn.error(t),null===(n=e.callback)||void 0===n||n.call(e,{statusCode:0,text:t})})).finally((()=>l?clearTimeout(l.timeout):null))},sh=e=>{const t=nh(e.url,{beacon:"1"});try{var n;const{contentType:i,body:r}=null!==(n=ih(e))&&void 0!==n?n:{},o="string"==typeof r?new Blob([r],{type:i}):r;Bn.sendBeacon(t,o)}catch{}},ah=[];Vn&&ah.push({transport:"XHR",method:rh}),Wn&&ah.push({transport:"fetch",method:oh}),null!=Bn&&Bn.sendBeacon&&ah.push({transport:"sendBeacon",method:sh});class lh{isPolling=!1;pollIntervalMs=3e3;queue=[];constructor(e){this.instance=e,this.queue=[],this.areWeOnline=!0,!ki(On)&&"onLine"in On.navigator&&(this.areWeOnline=On.navigator.onLine,On.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),On.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){let{retriesPerformedSoFar:t,...n}=e;Ri(t)&&t>0&&(n.url=nh(n.url,{retry_count:t})),this.instance._send_request({...n,callback:e=>{var i;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue({retriesPerformedSoFar:t,...n}):null===(i=n.callback)||void 0===i||i.call(n,e)}})}enqueue(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const n=function(e){const t=3e3*Math.pow(2,e),n=t/2,i=Math.min(18e5,t),r=(Math.random()-.5)*(i-n);return Math.ceil(i+r)}(t),i=Date.now()+n;this.queue.push({retryAt:i,requestOptions:e});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),jn.warn(r),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){const e=Date.now(),t=[],n=this.queue.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.queue=t,n.length>0)for(const{requestOptions:e}of n)this.retriableRequest(e)}unload(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);for(const{requestOptions:e}of this.queue)try{this.instance._send_request({...e,transport:"sendBeacon"})}catch(e){jn.error(e)}this.queue=[]}}class ch{_sessionIdChangedHandlers=[];constructor(e,t,n,i){var r;this.config=e,this.persistence=t,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Lc,this._windowIdGenerator=i||Lc;const o=e.persistence_name||e.token,s=e.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ed(s,60,1800,"session_idle_timeout_seconds"),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){const e=Yc.parse(this._window_id_storage_key),t=Yc.parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Yc.remove(this._window_id_storage_key),Yc.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{const e=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),e)}catch(e){jn.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ki(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&Yc.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Yc.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Yc.parse(this._window_id_storage_key):null}_setSessionId(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[nr]:[t,e,n]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];const e=this.persistence.props[nr];return yi(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==On||On.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&&Yc.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime();let[n,i,r]=this._getSessionId(),o=this._getWindowId();const s=Ri(r)&&r>0&&Math.abs(t-r)>864e5;let a=!1;const l=!i,c=!e&&Math.abs(t-n)>this.sessionTimeoutMs;l||c||s?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),jn.info("[SessionId] new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}}),r=t,a=!0):o||(o=this._windowIdGenerator(),a=!0);const u=0===n||!e||s?t:n,d=0===r?(new Date).getTime():r;return this._setWindowId(o),this._setSessionId(i,u,d),a&&this._sessionIdChangedHandlers.forEach((e=>e(i,o,a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:d,changeReason:a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:n}}}let uh;!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(uh||(uh={}));const dh="i.posthog.com";class hh{_regionCache={};constructor(e){this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${dh}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=uh.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=uh.EU:this._regionCache[this.apiHost]=uh.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this.uiHost+t;if(this.region===uh.CUSTOM)return this.apiHost+t;const n=dh+t;switch(e){case"assets":return`https://${this.region}-assets.${n}`;case"api":return`https://${this.region}.${n}`}}}const ph="posthog-js";function gh(e){let{organization:t,projectId:n,prefix:i,severityAllowList:r=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o=>{var s,a,l,c,u;if(!("*"===r||r.includes(o.level))||!e.__loaded)return o;o.tags||(o.tags={});const d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const h=(null===(s=o.exception)||void 0===s?void 0:s.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));const p={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:o.level,$exception_list:h,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(c=h[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(u=h[0])||void 0===u?void 0:u.type,$sentry_tags:o.tags,$level:o.level};return t&&n&&(p.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),e.exceptions.sendExceptionEvent(p),o}}class fh{constructor(e,t,n,i,r){this.name=ph,this.setupOnce=function(o){o(gh(e,{organization:t,projectId:n,prefix:i,severityAllowList:r}))}}}function mh(e,t){const n=e.config.segment;if(!n)return t();!function(e,t){const n=e.config.segment;if(!n)return t();const i=n=>{const i=()=>n.anonymousId()||Lc();e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(pr,"identified")),t()},r=n.user();"then"in r&&bi(r.then)?r.then((e=>i(e))):i(r)}(e,(()=>{n.register((e=>{Promise&&Promise.resolve||jn.warn("This browser does not have Promise support, and can not use the segment integration");const t=(t,n)=>{var i;if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(jn.info("Segment integration does not have a userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(jn.info("Segment integration has a userId set, identifying with PostHog"),e.identify(t.event.userId));const r=e._calculate_event_properties(n,null!==(i=t.event.properties)&&void 0!==i?i:{},new Date);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class _h{constructor(e){this._instance=e}doPageView(e){var t;const n=this._previousPageViewProperties(e);return this._currentPath=null!==(t=null==On?void 0:On.location.pathname)&&void 0!==t?t:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=e,n}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){const t=this._currentPath,n=this._prevPageviewTimestamp,i=this._instance.scrollManager.getContext();if(!n)return{};let r={};if(i){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:n,maxContentHeight:o,lastContentY:s,maxContentY:a}=i;if(!(ki(e)||ki(t)||ki(n)||ki(o)||ki(s)||ki(a))){e=Math.ceil(e),t=Math.ceil(t),n=Math.ceil(n),o=Math.ceil(o),s=Math.ceil(s),a=Math.ceil(a);r={$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:e<=1?1:ed(t/e,0,1),$prev_pageview_max_scroll:n,$prev_pageview_max_scroll_percentage:e<=1?1:ed(n/e,0,1),$prev_pageview_last_content:s,$prev_pageview_last_content_percentage:o<=1?1:ed(s/o,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:o<=1?1:ed(a/o,0,1)}}}return t&&(r.$prev_pageview_pathname=t),n&&(r.$prev_pageview_duration=(e.getTime()-n.getTime())/1e3),r}}class vh{events={};constructor(){this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(const n of this.events[e]||[])n(t);for(const n of this.events["*"]||[])n(e,t)}}class yh{_debugEventEmitter=new vh;constructor(e){this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!ki(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;const e=(e,t)=>{this.on(e,t)};null===(t=this.instance)||void 0===t||t._addCaptureHook(e)}}register(e){var t,n;if(!ki(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,n;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(n=e.steps)||void 0===n||n.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(n=this.instance)&&void 0!==n&&n.autocapture)){var i;const t=new Set;e.forEach((e=>{var n;null===(n=e.steps)||void 0===n||n.forEach((e=>{null!=e&&e.selector&&t.add(null==e?void 0:e.selector)}))})),null===(i=this.instance)||void 0===i||i.autocapture.setElementSelectors(t)}}on(e,t){var n;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(n=this.actionRegistry)||void 0===n?void 0:n.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const n of t.steps)if(this.checkStep(e,n))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStep=(e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t);checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event);checkStepUrl(e,t){if(null!=t&&t.url){var n;const i=null==e||null===(n=e.properties)||void 0===n?void 0:n.$current_url;if(!i||"string"!=typeof i)return!1;if(!yh.matchString(i,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(e,t,n){switch(n){case"regex":return!!On&&Di(e,t);case"exact":return t===e;case"contains":const n=yh.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return Di(e,n);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if(null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text){if(!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!yh.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!yh.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!yh.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1}if(null!=t&&t.selector){var n;const i=null==e||null===(n=e.properties)||void 0===n?void 0:n.$element_selectors;if(!i)return!1;if(!i.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class bh{static SURVEY_SHOWN_EVENT_NAME="survey shown";constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;ki(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){const t=e.filter((e=>{var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(n=e.conditions)||void 0===n||null===(i=n.actions)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new yh(this.instance),this.actionMatcher.init();const e=e=>{this.onAction(e)};this.actionMatcher._addActionHook(e)}t.forEach((e=>{var t,n,i,r,o,s,a,l,c,u;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(n=e.conditions)&&void 0!==n&&null!==(i=n.actions)&&void 0!==i&&i.values&&(null===(r=e.conditions)||void 0===r||null===(o=r.actions)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c||null===(u=c.values)||void 0===u||u.forEach((t=>{if(t&&t.name){const n=this.actionToSurveys.get(t.name);n&&n.push(e.id),this.actionToSurveys.set(t.name,n||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0===e.filter((e=>{var t,n,i,r;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i||null===(r=i.values)||void 0===r?void 0:r.length)>0})).length)return;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,n,i;null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(i=n.values)||void 0===i||i.forEach((t=>{if(t&&t.name){const n=this.eventToSurveys.get(t.name);n&&n.push(e.id),this.eventToSurveys.set(t.name,n||[e.id])}}))}))}onEvent(e,t){var n,i;const r=(null===(n=this.instance)||void 0===n||null===(i=n.persistence)||void 0===i?void 0:i.props[dr])||[];if(bh.SURVEY_SHOWN_EVENT_NAME==e&&t&&r.length>0){var o;const e=null==t||null===(o=t.properties)||void 0===o?void 0:o.$survey_id;if(e){const t=r.indexOf(e);t>=0&&(r.splice(t,1),this._updateActivatedSurveys(r))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,n;const i=(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n?void 0:n.props[dr])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,n;null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register({[dr]:[...new Set(e)]})}getSurveys(){var e,t;const n=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[dr];return n||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}const wh="[Surveys]",Sh={icontains:e=>!!On&&On.location.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:e=>!!On&&-1===On.location.href.toLowerCase().indexOf(e.toLowerCase()),regex:e=>!!On&&Di(On.location.href,e),not_regex:e=>!!On&&!Di(On.location.href,e),exact:e=>(null==On?void 0:On.location.href)===e,is_not:e=>(null==On?void 0:On.location.href)!==e};class Ch{constructor(e){this.instance=e,this._surveyEventReceiver=null}afterDecideResponse(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");const e=(()=>{const e=[];for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);null!=n&&n.startsWith(ds)&&e.push(n)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e;const t=null==Un||null===(e=Un.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;var n,i;this.instance.config.disable_surveys||!this._decideServerResponse||t||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new bh(this.instance)),null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"surveys",(e=>{var t,n;if(e)return jn.error(wh,"Could not load surveys script",e);this._surveyManager=null===(t=Un.__PosthogExtensions__)||void 0===t||null===(n=t.generateSurveys)||void 0===n?void 0:n.call(t,this.instance)})))}getSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new bh(this.instance));const n=this.instance.get_property(ur);if(n&&!t)return e(n);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api",`/api/surveys/?token=${this.instance.config.token}`),method:"GET",transport:"XHR",callback:t=>{var n;if(200!==t.statusCode||!t.json)return e([]);const i=t.json.surveys||[],r=i.filter((e=>{var t,n,i,r,o,s,a,l,c,u,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i?void 0:i.values)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));var o;r.length>0&&(null===(o=this._surveyEventReceiver)||void 0===o||o.register(r));return null===(n=this.instance.persistence)||void 0===n||n.register({[ur]:i}),e(i)}})}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var n;const i=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,n,i,r;if(!e.conditions)return!0;const o=null===(t=e.conditions)||void 0===t||!t.url||Sh[null!==(n=null===(i=e.conditions)||void 0===i?void 0:i.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),s=null===(r=e.conditions)||void 0===r||!r.selector||(null==Hn?void 0:Hn.querySelector(e.conditions.selector));return o&&s})),r=null===(n=this._surveyEventReceiver)||void 0===n?void 0:n.getSurveys(),o=i.filter((e=>{var t,n,i,o,s,a,l,c,u,d;if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;const h=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),p=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),g=(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(i=n.events)||void 0===i?void 0:i.values)&&(null===(o=e.conditions)||void 0===o||null===(s=o.events)||void 0===s?void 0:s.values.length)>0,f=(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d?void 0:d.values.length)>0,m=!g&&!f||(null==r?void 0:r.includes(e.id)),_=this._canActivateRepeatedly(e),v=!(e.internal_targeting_flag_key&&!_)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return h&&p&&v&&m}));return e(o)}),t)}getNextSurveyStep(e,t,n){var i;const r=e.questions[t],o=t+1;if(null===(i=r.branching)||void 0===i||!i.type)return t===e.questions.length-1?Eo.End:o;if(r.branching.type===Eo.End)return Eo.End;if(r.branching.type===Eo.SpecificQuestion){if(Number.isInteger(r.branching.index))return r.branching.index}else if(r.branching.type===Eo.ResponseBased){if(r.type===ko.SingleChoice){var s,a;const e=r.choices.indexOf(`${n}`);if(null!==(s=r.branching)&&void 0!==s&&null!==(a=s.responseValues)&&void 0!==a&&a.hasOwnProperty(e)){const t=r.branching.responseValues[e];return Number.isInteger(t)?t:t===Eo.End?Eo.End:o}}else if(r.type===ko.Rating){var l,c;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");const e=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(n,r.scale);if(null!==(l=r.branching)&&void 0!==l&&null!==(c=l.responseValues)&&void 0!==c&&c.hasOwnProperty(e)){const t=r.branching.responseValues[e];return Number.isInteger(t)?t:t===Eo.End?Eo.End:o}}return o}return jn.warn(wh,"Falling back to next question index due to unexpected branching type"),o}_canActivateRepeatedly(e){var t;return Mi(null===(t=Un.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(jn.warn(wh,"canActivateRepeatedly is not defined, must init before calling"),!1):Un.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){Mi(this._surveyManager)?jn.warn(wh,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((t=>{const n=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(n)}))}renderSurvey(e,t){Mi(this._surveyManager)?jn.warn(wh,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((n=>{const i=n.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(i,null==Hn?void 0:Hn.querySelector(t))}))}}class Ih{serverLimits={};lastEventRateLimited=!1;constructor(e){var t,n;this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(n=e.config.rate_limiting)||void 0===n?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,n;let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const r=(new Date).getTime(),o=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(fr))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:r};o.tokens+=(r-o.last)/1e3*this.captureEventsPerSecond,o.last=r,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);const s=o.tokens<1;return s||i||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to ${this.captureEventsPerSecond} events per second and ${this.captureEventsBurstLimit} events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,null===(n=this.instance.persistence)||void 0===n||n.set_property(fr,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{const e=JSON.parse(t);(e.quota_limited||[]).forEach((e=>{jn.info(`[RateLimiter] ${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void jn.warn(`[RateLimiter] could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}}}const kh=()=>({initialPathName:(null==qn?void 0:qn.pathname)||"",referringDomain:zu.referringDomain(),...zu.campaignParams()});class Eh{constructor(e,t,n){this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=n||kh,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[gr]}_onSessionIdCallback=e=>{const t=this._getStoredProps();if(t&&t.sessionId===e)return;const n={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[gr]:n})};getSessionProps(){var e;const 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}:{}}}const xh=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","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","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Th=function(e,t){if(!e)return!1;const n=e.toLowerCase();return xh.concat(t||[]).some((e=>{const t=e.toLowerCase();return-1!==n.indexOf(t)}))},Mh=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&Th(n,t))return!0;try{const n=null==e?void 0:e.userAgentData;if(null!=n&&n.brands&&n.brands.some((e=>Th(null==e?void 0:e.brand,t))))return!0}catch{}return!!e.webdriver},Rh="[Dead Clicks]",Ah=()=>!0,Nh=e=>{var t;const n=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(ji)),i=e.instance.config.capture_dead_clicks;return Ai(i)?i:n};class Fh{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}afterDecideResponse(e){this.instance.persistence&&this.instance.persistence.register({[ji]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,n,i;null!==(t=Un.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"dead-clicks-autocapture",(t=>{t?jn.error(Rh+" failed to load script",t):e()}))}start(){var e;if(Hn){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=Un.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){const e=Ci(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Un.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(Hn),jn.info(`${Rh} starting...`)}}else jn.error(Rh+" `document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,jn.info(`${Rh} stopping...`))}}class Oh{rageclicks=new gc;_enabledServerSide=!1;_initialized=!1;_flushInterval=null;constructor(e){var t;this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[Gi]),null==On||On.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){let e=5e3;return Ci(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ki(this.instance.config.capture_heatmaps)?ki(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;jn.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}afterDecideResponse(e){const t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Gi]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){const e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){On&&Hn&&(li(Hn,"click",(e=>this._onClick(e||(null==On?void 0:On.event))),!1,!0),li(Hn,"mousemove",(e=>this._onMouseMove(e||(null==On?void 0:On.event))),!1,!0),this.deadClicksCapture=new Fh(this.instance,Ah,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,t,n){let i=e;for(;i&&Cr(i)&&!Ir(i,"body");){if(i===n)return!1;if(ei(t,null==On?void 0:On.getComputedStyle(i).position))return!0;i=Or(i)}return!1}(Nr(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}_onClick(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(Sr(e.target))return;const i=this._getProperties(e,n);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture({...i,type:"rageclick"}),this._capture(i)}_onMouseMove(e){Sr(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(!On)return;const t=On.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}flush(){this.buffer&&!Ii(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Lh{constructor(e){this.instance=e}getContext(){return this.context}resetContext(){const e=this.context;return setTimeout(this._updateScrollData,0),e}_updateScrollData=()=>{var e,t,n,i;this.context||(this.context={});const r=this.scrollElement(),o=this.scrollY(),s=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=o+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(s,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(n=this.context.maxContentY)&&void 0!==n?n:0),this.context.maxContentHeight=Math.max(l,null!==(i=this.context.maxContentHeight)&&void 0!==i?i:0)};startMeasuringScrollPosition(){null==On||On.addEventListener("scroll",this._updateScrollData,!0),null==On||On.addEventListener("scrollend",this._updateScrollData,!0),null==On||On.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==On?void 0:On.document.documentElement;{const e=yi(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(const t of e){const e=null==On?void 0:On.document.querySelector(t);if(e)return e}}}scrollY(){if(this.instance.config.scroll_root_selector){const e=this.scrollElement();return e&&e.scrollTop||0}return On&&(On.scrollY||On.pageYOffset||On.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){const e=this.scrollElement();return e&&e.scrollLeft||0}return On&&(On.scrollX||On.pageXOffset||On.document.documentElement.scrollLeft)||0}}class Ph{_restoreXHRPatch=void 0;_restoreFetchPatch=void 0;constructor(e){this.instance=e}_loadScript(e){var t,n,i;null!==(t=Un.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"tracing-headers",(t=>{if(t)return jn.error("[TRACING-HEADERS] failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}_startCapturing=()=>{var e,t,n,i;ki(this._restoreXHRPatch)&&(null===(e=Un.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));ki(this._restoreFetchPatch)&&(null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.tracingHeadersPatchFns)||void 0===i||i._patchFetch(this.instance.sessionManager))}}let Dh;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Dh||(Dh={}));class $h{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Dh.DENIED:this.storedConsent}isOptedOut(){return this.consent===Dh.DENIED||this.consent===Dh.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){const e=this.storage.get(this.storageKey);return"1"===e?Dh.GRANTED:"0"===e?Dh.DENIED:Dh.PENDING}get storage(){if(!this._storage){const e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?Vc:qc;const t="localStorage"===e?qc:Vc;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!ui([null==Bn?void 0:Bn.doNotTrack,null==Bn?void 0:Bn.msDoNotTrack,Un.doNotTrack],(e=>ei([!0,1,"1","yes"],e)))}}const Bh="[Exception Autocapture]";class Hh{originalOnUnhandledRejectionHandler=void 0;constructor(e){var t;this.instance=e,this.remoteEnabled=!(null===(t=this.instance.persistence)||void 0===t||!t.props[Ui]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var e;return!(null==On||null===(e=On.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(jn.info(Bh+" enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,n;this.hasHandlers&&e(),null===(t=Un.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"exception-autocapture",(t=>{if(t)return jn.error(Bh+" failed to load script",t);e()}))}startCapturing=()=>{var e,t,n,i;if(!On||!this.isEnabled||this.hasHandlers||this.isCapturing)return;const r=null===(e=Un.__PosthogExtensions__)||void 0===e||null===(t=e.errorWrappingFunctions)||void 0===t?void 0:t.wrapOnError,o=null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.errorWrappingFunctions)||void 0===i?void 0:i.wrapUnhandledRejection;if(r&&o)try{this.unwrapOnError=r(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){jn.error(Bh+" failed to start",e),this.stopCapturing()}else jn.error(Bh+" failed to load error wrapping functions - cannot start")};stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}afterDecideResponse(e){const t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[Ui]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){const t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL=`${t}/project/${this.instance.config.token}/person/${this.instance.get_distinct_id()}`,this.instance.exceptions.sendExceptionEvent(e)}}const qh=9e5,Wh="[Web Vitals]";class Vh{_enabledServerSide=!1;_initialized=!1;buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0};constructor(e){var t;this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[zi]),this.startIfEnabled()}get allowedMetrics(){var e,t;const n=Ci(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return ki(n)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[Yi])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ci(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){const e=Ci(this.instance.config.capture_performance)&&Ri(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:qh;return 0<e&&e<=6e4?qh:e}get isEnabled(){const e=Ci(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Ai(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(jn.info(Wh+" enabled, starting..."),this.loadScript(this._startCapturing))}afterDecideResponse(e){const t=Ci(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ci(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[zi]:t}),this.instance.persistence.register({[Yi]:n})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,n,i;null!==(t=Un.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(n=Un.__PosthogExtensions__)||void 0===n||null===(i=n.loadExternalDependency)||void 0===i||i.call(n,this.instance,"web-vitals",(t=>{t?jn.error(Wh+" failed to load script",t):e()}))}_currentURL(){const e=On?On.location.href:void 0;return e||jn.error(Wh+"Could not determine current URL"),e}_flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,t)=>({...e,[`$web_vitals_${t.name}_event`]:{...t},[`$web_vitals_${t.name}_value`]:t.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})};_addToBuffer=e=>{var t;const n=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if(ki(n))return void jn.error(Wh+"Could not read session ID. Dropping metrics!");this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};const i=this._currentURL();if(ki(i))return;if(Mi(null==e?void 0:e.name)||Mi(null==e?void 0:e.value))return void jn.error(Wh+"Invalid metric received",e);if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void jn.error(Wh+"Ignoring metric with value >= "+this._maxAllowedValue,e);this.buffer.url!==i&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),ki(this.buffer.url)&&(this.buffer.url=i),this.buffer.firstMetricTimestamp=ki(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push({...e,$current_url:i,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()}),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()};_startCapturing=()=>{let e,t,n,i;const r=Un.__PosthogExtensions__;ki(r)||ki(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:i}=r.postHogWebVitalsCallbacks),e&&t&&n&&i?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this)),this._initialized=!0):jn.error(Wh+"web vitals callbacks not loaded - not starting")}}const Zh={icontains:(e,t)=>!!On&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!On&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!On&&Di(t.href,e),not_regex:(e,t)=>!!On&&!Di(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Gh{constructor(e){this.instance=e;const t=e=>{this.applyFeatureFlagChanges(e)};this.instance.onFeatureFlags&&this.instance.onFeatureFlags(t),this._flagToExperiments=new Map}applyFeatureFlagChanges(e){Mi(this._flagToExperiments)||this.instance.config.disable_web_experiments||(Gh.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var n;const t=this.instance.getFeatureFlag(e),i=null===(n=this._flagToExperiments)||void 0===n?void 0:n.get(e);t&&null!=i&&i.variants[t]&&this.applyTransforms(i.name,t,i.variants[t].transforms)}})))}afterDecideResponse(e){this._is_bot()?Gh.logInfo("Refusing to render web experiment since the viewer is a likely bot"):(this._featureFlags=e.featureFlags,this.loadIfEnabled(),this.previewWebExperiment())}previewWebExperiment(){const e=Gh.getWindowLocation();if(null!=e&&e.search){const t=Bi(null==e?void 0:e.search,"__experiment_id"),n=Bi(null==e?void 0:e.search,"__experiment_variant");t&&n&&(Gh.logInfo(`previewing web experiments ${t} && ${n}`),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),n,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperimentsAndEvaluateDisplayLogic=(()=>{var e=this;return function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e.getWebExperiments((t=>{Gh.logInfo("retrieved web experiments from the server"),e._flagToExperiments=new Map,t.forEach((t=>{if(t.feature_flag_key&&e._featureFlags&&e._featureFlags[t.feature_flag_key]){var n;if(e._flagToExperiments)Gh.logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(n=e._flagToExperiments)||void 0===n||n.set(t.feature_flag_key,t);const i=e._featureFlags[t.feature_flag_key];i&&t.variants[i]&&e.applyTransforms(t.name,i,t.variants[i].transforms)}else if(t.variants)for(const n in t.variants){const i=t.variants[n];Gh.matchesTestVariant(i)&&e.applyTransforms(t.name,n,i.transforms)}}))}),t)}})();getWebExperiments(e,t,n){if(this.instance.config.disable_web_experiments&&!n)return e([]);const i=this.instance.get_property("$web_experiments");if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.instance.config.token}`),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);const n=t.json.experiments||[];return e(n)}})}showPreviewWebExperiment(e,t,n){const i=n.filter((t=>t.id===e));i&&i.length>0&&(Gh.logInfo(`Previewing web experiment [${i[0].name}] with variant [${t}]`),this.applyTransforms(i[0].name,t,i[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!Mi(e.conditions)&&(Gh.matchUrlConditions(e)&&Gh.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(Mi(e.conditions)||Mi(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;const n=Gh.getWindowLocation();if(n){var i,r,o;return null===(i=e.conditions)||void 0===i||!i.url||Zh[null!==(r=null===(o=e.conditions)||void 0===o?void 0:o.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n)}return!1}static getWindowLocation(){return null==On?void 0:On.location}static matchUTMConditions(e){var t;if(Mi(e.conditions)||Mi(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const n=zu.campaignParams();if(n.utm_source){var i,r,o,s,a,l,c,u,d,h,p,g,f,m,_,v;const t=null===(i=e.conditions)||void 0===i||null===(r=i.utm)||void 0===r||!r.utm_campaign||(null===(o=e.conditions)||void 0===o||null===(s=o.utm)||void 0===s?void 0:s.utm_campaign)==n.utm_campaign,y=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(c=e.conditions)||void 0===c||null===(u=c.utm)||void 0===u?void 0:u.utm_source)==n.utm_source,b=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(p=e.conditions)||void 0===p||null===(g=p.utm)||void 0===g?void 0:g.utm_medium)==n.utm_medium,w=null===(f=e.conditions)||void 0===f||null===(m=f.utm)||void 0===m||!m.utm_term||(null===(_=e.conditions)||void 0===_||null===(v=_.utm)||void 0===v?void 0:v.utm_term)==n.utm_term;return t&&b&&w&&y}return!1}static logInfo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];jn.info(`[WebExperiments] ${e}`,n)}applyTransforms(e,t,n,i){var r;this._is_bot()?Gh.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?n.forEach((n=>{if(n.selector){var r;Gh.logInfo(`applying transform of variant ${t} for experiment ${e} `,n);let s=0;const a=null===(r=document)||void 0===r?void 0:r.querySelectorAll(n.selector);var o;if(null==a||a.forEach((e=>{const t=e;s+=1,n.attributes&&n.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),n.text&&(t.innerText=n.text),n.html&&(t.parentElement?t.parentElement.innerHTML=n.html:t.innerHTML=n.html),n.css&&t.setAttribute("style",n.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:i,$web_experiment_document_url:null===(o=Gh.getWindowLocation())||void 0===o?void 0:o.href,$web_experiment_elements_modified:s})}})):(Gh.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:i,$web_experiment_variant:t,$web_experiment_document_url:null===(r=Gh.getWindowLocation())||void 0===r?void 0:r.href,$web_experiment_elements_modified:0}))}_is_bot(){return Bn&&this.instance?Mh(Bn,this.instance.config.custom_blocked_useragents):void 0}}class Uh{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}const zh={},jh=()=>{},Yh="posthog";let Xh=!eh&&-1===(null==Gn?void 0:Gn.indexOf("MSIE"))&&-1===(null==Gn?void 0:Gn.indexOf("Mozilla"));const Jh=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:ci(null==Hn?void 0:Hn.location),persistence:"localStorage+cookie",persistence_name:"",loaded:jh,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:qn&&Ei(null==qn?void 0:qn.search)&&-1!==qn.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==On||null===(e=On.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_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:e=>{const t="Bad HTTP status: "+e.statusCode+" "+e.text;jn.error(t)},get_device_id:e=>e,_onCapture:jh,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},Kh=e=>{const t={};ki(e.process_person)||(t.person_profiles=e.process_person),ki(e.xhr_headers)||(t.request_headers=e.xhr_headers),ki(e.cookie_name)||(t.persistence_name=e.cookie_name),ki(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);const n=Qn({},t,e);return yi(e.property_blacklist)&&(ki(e.property_denylist)?n.property_denylist=e.property_blacklist:yi(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:jn.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class Qh{get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){jn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}__forceAllowLocalhost=!1}class ep{webPerformance=new Qh;version=Fn.LIB_VERSION;_internalEventEmitter=new vh;constructor(){this.config=Jh(),this.decideEndpointWasHit=!1,this.SentryIntegration=fh,this.sentryIntegration=e=>function(e,t){const n=gh(e,t);return{name:ph,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new Tc(this),this.toolbar=new Kd(this),this.scrollManager=new Lh(this),this.pageViewManager=new _h(this),this.surveys=new Ch(this),this.experiments=new Gh(this),this.exceptions=new Uh(this),this.rateLimiter=new Ih(this),this.requestRouter=new hh(this),this.consent=new $h(this),this.people={set:(e,t,n)=>{const i=Ei(e)?{[e]:t}:e;this.setPersonProperties(i),null==n||n({})},set_once:(e,t,n)=>{const i=Ei(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==n||n({})}},this.on("eventCaptured",(e=>jn.info(`send "${null==e?void 0:e.event}"`,e)))}init(e,t,n){if(n&&n!==Yh){var i;const r=null!==(i=zh[n])&&void 0!==i?i:new ep;return r._init(e,t,n),zh[n]=r,zh[Yh][n]=r,r}return this._init(e,t,n)}_init(e){var t,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(ki(e)||xi(e))return jn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return jn.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(Qn({},Jh(),Kh(i),{name:r,token:e})),this.config.on_xhr_error&&jn.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:pi.GZipJS,this.persistence=new Yu(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yu({...this.config,persistence:"sessionStorage"});const o={...this.persistence.props},s={...this.sessionPersistence.props};if(this._requestQueue=new Qd((e=>this._send_retriable_request(e))),this._retryQueue=new lh(this),this.__request_queue=[],this.sessionManager=new ch(this.config,this.persistence),this.sessionPropsManager=new Eh(this.sessionManager,this.persistence),new Ph(this).startIfEnabledOrStop(),this.sessionRecording=new zd(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new yc(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Oh(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Vh(this),this.exceptionObserver=new Hh(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Fh(this,Nh),this.deadClicksAutocapture.startIfEnabled(),Fn.DEBUG=Fn.DEBUG||this.config.debug,Fn.DEBUG&&jn.info("Starting in debug mode",{this:this,config:i,thisC:{...this.config},p:o,s:s}),this._sync_opt_out_with_persistence(),void 0!==(null===(t=i.bootstrap)||void 0===t?void 0:t.distinctID)){var a,l;const e=this.config.get_device_id(Lc()),t=null!==(a=i.bootstrap)&&void 0!==a&&a.isIdentifiedID?e:i.bootstrap.distinctID;this.persistence.set_property(pr,null!==(l=i.bootstrap)&&void 0!==l&&l.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:t})}if(this._hasBootstrappedFeatureFlags()){var c,u;const e=Object.keys((null===(c=i.bootstrap)||void 0===c?void 0:c.featureFlags)||{}).filter((e=>{var t,n;return!(null===(t=i.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])})).reduce(((e,t)=>{var n,r;return e[t]=(null===(n=i.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),t=Object.keys((null===(u=i.bootstrap)||void 0===u?void 0:u.featureFlagPayloads)||{}).filter((t=>e[t])).reduce(((e,t)=>{var n,r,o,s;null!==(n=i.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(o=i.bootstrap)||void 0===o||null===(s=o.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:e,featureFlagPayloads:t})}if(!this.get_distinct_id()){const e=this.config.get_device_id(Lc());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(pr,"anonymous")}return null==On||null===(n=On.addEventListener)||void 0===n||n.call(On,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),i.segment?mh(this,(()=>this._loaded())):this._loaded(),bi(this.config._onCapture)&&this.config._onCapture!==jh&&(jn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_afterDecideResponse(e){var t,n,i,r,o,s,a,l,c;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ei(e.supportedCompression,pi.GZipJS)?pi.GZipJS:ei(e.supportedCompression,pi.Base64)?pi.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(n=this.sessionRecording)||void 0===n||n.afterDecideResponse(e),null===(i=this.autocapture)||void 0===i||i.afterDecideResponse(e),null===(r=this.heatmaps)||void 0===r||r.afterDecideResponse(e),null===(o=this.experiments)||void 0===o||o.afterDecideResponse(e),null===(s=this.surveys)||void 0===s||s.afterDecideResponse(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.afterDecideResponse(e),null===(l=this.exceptionObserver)||void 0===l||l.afterDecideResponse(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.afterDecideResponse(e)}_loaded(){const e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){jn.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),e||(new jd(this).call(),this.featureFlags.resetRequestQueue())}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||Jn(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Xh?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=nh(e.url,{ip:this.config.ip?1:0}),e.headers={...this.config.request_headers},e.compression="best-available"===e.compression?this.compression:e.compression,(e=>{var t,n,i;const r={...e};r.timeout=r.timeout||6e4,r.url=nh(r.url,{_:(new Date).getTime().toString(),ver:Fn.LIB_VERSION,compression:r.compression});const o=null!==(t=r.transport)&&void 0!==t?t:"XHR",s=null!==(n=null===(i=ui(ah,(e=>e.transport===o)))||void 0===i?void 0:i.method)&&void 0!==n?n:ah[0].method;if(!s)throw new Error("No available transport method");s(r)})({...e,callback:t=>{var n,i,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(i=(r=this.config).on_request_error)||void 0===i||i.call(r,t));null===(n=e.callback)||void 0===n||n.call(e,t)}})))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){let t;const n=[],i=[],r=[];Jn(e,(e=>{e&&(t=e[0],yi(t)?r.push(e):bi(e)?e.call(this):yi(e)&&"alias"===t?n.push(e):yi(e)&&-1!==t.indexOf("capture")&&bi(this[t])?r.push(e):i.push(e))}));const o=function(e,t){Jn(e,(function(e){if(yi(e[0])){let n=t;Kn(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};o(n,this),o(i,this),o(r,this)}_hasBootstrappedFeatureFlags(){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}push(e){this._execute_array([e])}capture(e,t,n){var i;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void jn.uninitializedWarning("posthog.capture");if(this.consent.isOptedOut())return;if(ki(e)||!Ei(e))return void jn.error("No event name provided to posthog.capture");if(!this.config.opt_out_useragent_filter&&this._is_bot())return;const r=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null!=r&&r.isRateLimited)return void jn.critical("This capture call is ignored due to client rate limiting.");this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();const o=new Date,s=(null==n?void 0:n.timestamp)||o;let a={uuid:Lc(),event:e,properties:this._calculate_event_properties(e,t||{},s)};r&&(a.properties.$lib_rate_limit_remaining_tokens=r.remainingTokens);(null==n?void 0:n.$set)&&(a.$set=null==n?void 0:n.$set);const l=this._calculate_set_once_properties(null==n?void 0:n.$set_once);l&&(a.$set_once=l),a=si(a,null!=n&&n._noTruncate?null:this.config.properties_string_max_length),a.timestamp=s,ki(null==n?void 0:n.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=o);const c={...a.properties.$set,...a.$set};if(Ii(c)||this.setPersonPropertiesForFlags(c),!Mi(this.config.before_send)){const e=this._runBeforeSend(a);if(!e)return;a=e}this._internalEventEmitter.emit("eventCaptured",a);const u={method:"POST",url:null!==(i=null==n?void 0:n._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",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(u):this._requestQueue.enqueue(u),a}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,t,n){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;const i=this.persistence.remove_event_timer(e);let r={...t};if(r.token=this.config.token,"$snapshot"===e){const e={...this.persistence.properties(),...this.sessionPersistence.properties()};return r.distinct_id=e.distinct_id,(!Ei(r.distinct_id)&&!Ri(r.distinct_id)||xi(r.distinct_id))&&jn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),r}const o=zu.properties();if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId();r.$session_id=e,r.$window_id=t}if(this.requestRouter.region===uh.CUSTOM&&(r.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){const e=this.sessionPropsManager.getSessionProps();r=Qn(r,e)}if(!this.config.disable_scroll_properties){let t={};"$pageview"===e?t=this.pageViewManager.doPageView(n):"$pageleave"===e&&(t=this.pageViewManager.doPageLeave(n)),r=Qn(r,t)}if("$pageview"===e&&Hn&&(r.title=Hn.title),!ki(i)){const e=n.getTime()-i;r.$duration=parseFloat((e/1e3).toFixed(3))}Gn&&this.config.opt_out_useragent_filter&&(r.$browser_type=this._is_bot()?"bot":"browser"),r=Qn({},o,this.persistence.properties(),this.sessionPersistence.properties(),r),r.$is_identified=this._isIdentified(),yi(this.config.property_denylist)?Kn(this.config.property_denylist,(function(e){delete r[e]})):jn.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const s=this.config.sanitize_properties;s&&(r=s(r,e));const a=this._hasPersonProcessing();return r.$process_person_profile=a,a&&this._requirePersonProcessing("_calculate_event_properties"),r}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;let t=Qn({},this.persistence.get_initial_props(),e||{});const n=this.config.sanitize_properties;return n&&(t=n(t,"$set_once")),Ii(t)?void 0:t}register(e,t){var n;null===(n=this.persistence)||void 0===n||n.register(e,t)}register_once(e,t,n){var i;null===(i=this.persistence)||void 0===i||i.register_once(e,t,n)}register_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){const t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,n;return null!==(t=null===(n=this.sessionManager)||void 0===n?void 0:n.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}identify(e,t,n){if(!this.__loaded||!this.persistence)return jn.uninitializedWarning("posthog.identify");if(Ri(e)&&(e=e.toString(),jn.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!e)return void jn.error("Unique user id has not been set in posthog.identify");if(["distinct_id","distinctid"].includes(e.toLowerCase()))return void jn.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);if(!this._requirePersonProcessing("posthog.identify"))return;const i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){const e=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:e},"")}e!==i&&e!==this.get_property(Wi)&&(this.unregister(Wi),this.register({distinct_id:e}));const r="anonymous"===(this.persistence.get_property(pr)||"anonymous");e!==i&&r?(this.persistence.set_property(pr,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(hr))}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,n){if(!e||!t)return void jn.error("posthog.group requires a group type and group key");if(!this._requirePersonProcessing("posthog.group"))return;const i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:{...i,[e]:t}}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),i[e]===t||n||this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,i,r,o;if(jn.info("reset"),!this.__loaded)return jn.uninitializedWarning("posthog.reset");const s=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),null===(i=this.surveys)||void 0===i||i.reset(),null===(r=this.persistence)||void 0===r||r.set_property(pr,"anonymous"),null===(o=this.sessionManager)||void 0===o||o.resetSessionId();const a=this.config.get_device_id(Lc());this.register_once({distinct_id:a,$device_id:e?a:s},"")}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if(null!=e&&e.withTimestamp&&n){var r;const t=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!n)return i;i+=`?t=${Math.max(Math.floor(((new Date).getTime()-n)/1e3)-t,0)}`}return i}alias(e,t){return e===this.get_property(qi)?(jn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(ki(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Wi,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(jn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t={...this.config};var n,i,r,o;Ci(e)&&(Qn(this.config,Kh(e)),null===(n=this.persistence)||void 0===n||n.update_config(this.config,t),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yu({...this.config,persistence:"sessionStorage"}),Vc.is_supported()&&"true"===Vc.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(Fn.DEBUG=!0,jn.info("set_config",{config:e,oldConfig:t,newConfig:{...this.config}})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(r=this.autocapture)||void 0===r||r.startIfEnabled(),null===(o=this.heatmaps)||void 0===o||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){const t=!0===e,n={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(n).some(Boolean)){var i,r,o,s,a;if(null===(i=this.sessionManager)||void 0===i||i.checkAndGetSessionAndWindowId(),n.sampling)null===(r=this.sessionRecording)||void 0===r||r.overrideSampling();if(n.linked_flag)null===(o=this.sessionRecording)||void 0===o||o.overrideLinkedFlag();if(n.url_trigger)null===(s=this.sessionRecording)||void 0===s||s.overrideTrigger("url");if(n.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started)}captureException(e,t){var n;const i=new Error("PostHog syntheticException"),r=bi(null===(n=Un.__PosthogExtensions__)||void 0===n?void 0:n.parseErrorAsProperties)?Un.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:i}):{$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}],...t};this.exceptions.sendExceptionEvent(r)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:Yh;return t!==Yh&&(t=Yh+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(pr))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(pr))}_hasPersonProcessing(){var e,t,n,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Ii(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[Wi])&&(null===(n=this.persistence)||void 0===n||null===(i=n.props)||void 0===i||!i[yr]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(jn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(yr,!0),!0)}_sync_opt_out_with_persistence(){var e,t;const n=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default,r=this.config.disable_persistence||n&&!!i;var o,s;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==r&&(null===(o=this.persistence)||void 0===o||o.set_disabled(r));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==r&&(null===(s=this.sessionPersistence)||void 0===s||s.set_disabled(r))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),ki(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Bn?Mh(Bn,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Hn&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:Hn.title},{send_instantly:!0}))}debug(e){!1===e?(null==On||On.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==On||On.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}))}_runBeforeSend(e){if(Mi(this.config.before_send))return e;const t=yi(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const i of t){if(n=i(n),Mi(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return Oi(e.event)?jn.warn(`${t}. This can cause unexpected behavior.`):jn.info(t),null}n.properties&&!Ii(n.properties)||jn.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}return n}}!function(e,t){for(let n=0;n<t.length;n++)e.prototype[t[n]]=ii(e.prototype[t[n]])}(ep,["identify"]);!function(){const e=zh[Yh]=new ep,t=Un.posthog;t&&Kn(t._i,(function(n){if(n&&yi(n)){const i=e.init(n[0],n[1],n[2]),r=t[n[2]]||t;i&&(i._execute_array.call(i.people,r.people),i._execute_array(r))}})),Un.posthog=e,function(){function e(){e.done||(e.done=!0,Xh=!1,Kn(zh,(function(e){e._dom_loaded()})))}null!=Hn&&Hn.addEventListener&&("complete"===Hn.readyState?e():Hn.addEventListener("DOMContentLoaded",e,!1)),On&&li(On,"load",e,!0)}()}()}();
1
+ !function(){"use strict";function e(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 t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,l,"next",e)}function l(e){n(s,i,o,a,l,"throw",e)}a(void 0)}))}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(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}var s,a=["type"],l=Object.defineProperty,c=(e,t,n)=>((e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),u=Object.defineProperty,d=(e,t,n)=>((e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),h=(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))(h||{}),p={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},v={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},g=e=>!!(e=>"function"==typeof e)(e)&&Object.getOwnPropertyNames(e.prototype||{}).some((e=>e.indexOf("__zone"))),f={};function m(e){if(f[e])return f[e];var t=globalThis[e],n=t.prototype,r=e in p?p[e]:void 0,i=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),o=e in v?v[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(i&&s&&!g(t))return f[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var c=l[e].prototype;return document.body.removeChild(a),c?f[e]=c:n}catch(e){return n}}var _={};function y(e,t,n){var r,i="".concat(e,".").concat(String(n));if(_[i])return _[i].call(t);var o=m(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(_[i]=s,s.call(t)):t[n]}var b={};function w(e,t,n){var r="".concat(e,".").concat(String(n));if(b[r])return b[r].bind(t);var i=m(e)[n];return"function"!=typeof i?t[n]:(b[r]=i,i.bind(t))}var S={childNodes:function(e){return y("Node",e,"childNodes")},parentNode:function(e){return y("Node",e,"parentNode")},parentElement:function(e){return y("Node",e,"parentElement")},textContent:function(e){return y("Node",e,"textContent")},contains:function(e,t){return w("Node",e,"contains")(t)},getRootNode:function(e){return w("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?y("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?y("Element",e,"shadowRoot"):null},querySelector:function(e,t){return y("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return y("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return m("MutationObserver").constructor}};function C(e){return e.nodeType===e.ELEMENT_NODE}function I(e){var t=e&&"host"in e&&"mode"in e&&S.host(e)||null;return Boolean(t&&"shadowRoot"in t&&S.shadowRoot(t)===e)}function k(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function E(e){try{var t=e.rules||e.cssRules;if(!t)return null;var n=Array.from(t,(t=>x(t,e.href))).join("");return(r=n).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),r}catch(e){return null}var r}function x(e,t){if(function(e){return"styleSheet"in e}(e)){var n;try{n=E(e.styleSheet)||function(e){var{cssText:t}=e;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(t){n=e.cssText}return e.styleSheet.href?H(n,e.styleSheet.href):n}var r,i=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,i=i.replace(r,"$1\\$2")),t?H(i,t):i}function T(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}let M=class{constructor(){d(this,"idNodeMap",new Map),d(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var n=null==(t=this.getMeta(e))?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function R(e){var{element:t,maskInputOptions:n,tagName:r,type:i,value:o,maskInputFn:s}=e,a=o||"",l=i&&A(i);return(n[r.toLowerCase()]||l&&n[l])&&(a=s?s(a,t):"*".repeat(a.length)),a}function A(e){return e.toLowerCase()}var N="__rrweb_original__";function F(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}function O(e,t){var n,r;try{r=new URL(e,null!=t?t:window.location.href)}catch(e){return null}var i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==i?void 0:i[1])&&void 0!==n?n:null}var L=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,P=/^(?:[a-z+]+:)?\/\//i,D=/^www\..*/i,B=/^(data:)([^,]*),(.*)/i;function H(e,t){return(e||"").replace(L,((e,n,r,i,o,s)=>{var a,l=r||o||s,c=n||i||"";if(!l)return e;if(P.test(l)||D.test(l))return"url(".concat(c).concat(l).concat(c,")");if(B.test(l))return"url(".concat(c).concat(l).concat(c,")");if("/"===l[0])return"url(".concat(c).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)).concat(c,")");var u=t.split("/"),d=l.split("/");for(var h of(u.pop(),d))"."!==h&&(".."===h?u.pop():u.push(h));return"url(".concat(c).concat(u.join("/")).concat(c,")")}))}var q,W,$=1,V=new RegExp("[^a-z0-9-_:]"),Z=-2;function G(){return $++}var U=/^[^ \t\n\r\u000c]+/,j=/^[, \t\n\r\u000c]+/;var z=new WeakMap;function Y(e,t){return t&&""!==t.trim()?J(e,t):t}function X(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function J(e,t){var n=z.get(e);if(n||(n=e.createElement("a"),z.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function K(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?Y(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?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(j),!(n>=t.length);){var o=r(U);if(","===o.slice(-1))o=Y(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=Y(e,o);for(var a=!1;;){var l=t.charAt(n);if(""===l){i.push((o+s).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){n+=1,i.push((o+s).trim());break}"("===l&&(a=!0)}s+=l,n+=1}}}return i.join(", ")}(e,r):"style"===n?H(r,J(e)):"object"===t&&"data"===n?Y(e,r):r:Y(e,r):r}function Q(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function ee(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ee(S.parentNode(e),t,n);for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return!!n&&ee(S.parentNode(e),t,n)}function te(e,t,n,r){var i;if(C(e)){if(i=e,!S.childNodes(i).length)return!1}else{if(null===S.parentElement(e))return!1;i=S.parentElement(e)}try{if("string"==typeof t){if(r){if(i.closest(".".concat(t)))return!0}else if(i.classList.contains(t))return!0}else if(ee(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(e){}return!1}function ne(e,t){var{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:f=!1}=t,m=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:h.Document,childNodes:[],compatMode:e.compatMode}:{type:h.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:h.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:m};case e.ELEMENT_NODE:return function(e,t){for(var n,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:u,recordCanvas:d,keepIframeSrcFn:p,newlyAddedElement:v=!1,rootId:g}=t,f=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,i,o),m=function(e){if(e instanceof HTMLFormElement)return"form";var t=A(e.tagName);return V.test(t)?"div":t}(e),_={},y=e.attributes.length,b=0;b<y;b++){var w=e.attributes[b];Q(m,w.name,w.value)||(_[w.name]=K(r,m,A(w.name),w.value))}if("link"===m&&s){var C=e.href,I=T(r,C);if(!I&&C.includes(".css"))I=T(r,window.location.origin+"/"+C.replace(window.location.href,""));var k=null;I&&(k=E(I)),k&&(delete _.rel,delete _.href,_._cssText=k)}if("style"===m&&e.sheet&&!(e.innerText||S.textContent(e)||"").trim().length){var x=E(e.sheet);x&&(_._cssText=x)}if("input"===m||"textarea"===m||"select"===m){var M=e.value,O=e.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&M?_.value=R({element:e,type:F(e),tagName:m,value:M,maskInputOptions:a,maskInputFn:l}):O&&(_.checked=O)}"option"===m&&(e.selected&&!a.select?_.selected=!0:delete _.selected);"dialog"===m&&e.open&&(_.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===m&&d)if("2d"===e.__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=N in i?i[N]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(_.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var L=e.toDataURL(c.type,c.quality),P=r.createElement("canvas");P.width=e.width,P.height=e.height,L!==P.toDataURL(c.type,c.quality)&&(_.rr_dataURL=L)}if("img"===m&&u){q||(q=r.createElement("canvas"),W=q.getContext("2d"));var D=e,B=D.currentSrc||D.getAttribute("src")||"<unknown-src>",H=D.crossOrigin,$=()=>{D.removeEventListener("load",$);try{q.width=D.naturalWidth,q.height=D.naturalHeight,W.drawImage(D,0,0),_.rr_dataURL=q.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==D.crossOrigin)return D.crossOrigin="anonymous",void(D.complete&&0!==D.naturalWidth?$():D.addEventListener("load",$));console.warn("Cannot inline img src=".concat(B,"! Error: ").concat(e))}"anonymous"===D.crossOrigin&&(H?_.crossOrigin=H:D.removeAttribute("crossorigin"))};D.complete&&0!==D.naturalWidth?$():D.addEventListener("load",$)}if("audio"===m||"video"===m){var Z=_;Z.rr_mediaState=e.paused?"paused":"played",Z.rr_mediaCurrentTime=e.currentTime,Z.rr_mediaPlaybackRate=e.playbackRate,Z.rr_mediaMuted=e.muted,Z.rr_mediaLoop=e.loop,Z.rr_mediaVolume=e.volume}v||(e.scrollLeft&&(_.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(_.rr_scrollTop=e.scrollTop));if(f){var{width:G,height:U}=e.getBoundingClientRect();_={class:_.class,rr_width:"".concat(G,"px"),rr_height:"".concat(U,"px")}}"iframe"!==m||p(_.src)||(e.contentDocument||(_.rr_src=_.src),delete _.src);try{customElements.get(m)&&(n=!0)}catch(e){}return{type:h.Element,tagName:m,attributes:_,childNodes:[],isSVG:X(e)||void 0,needBlock:f,rootId:g,isCustom:n}}(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:f,rootId:m});case e.TEXT_NODE:return function(e,t){var n,{needsMask:r,maskTextFn:i,rootId:o}=t,s=S.parentNode(e),a=s&&s.tagName,l=S.textContent(e),c="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(c&&l){try{e.nextSibling||e.previousSibling||(null==(n=s.sheet)?void 0:n.cssRules)&&(l=E(s.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=H(l,J(t.doc))}u&&(l="SCRIPT_PLACEHOLDER");!c&&!u&&l&&r&&(l=i?i(l,S.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:h.Text,textContent:l||"",isStyle:c,rootId:o}}(e,{doc:n,needsMask:s,maskTextFn:c,rootId:m});case e.CDATA_SECTION_NODE:return{type:h.CDATA,textContent:"",rootId:m};case e.COMMENT_NODE:return{type:h.Comment,textContent:S.textContent(e)||"",rootId:m};default:return!1}}function re(e){return null==e?"":e.toLowerCase()}function ie(e,t){var{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:v,dataURLOptions:g={},inlineImages:f=!1,recordCanvas:m=!1,onSerialize:_,onIframeLoad:y,iframeLoadTimeout:b=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:x=(()=>!1),newlyAddedElement:T=!1}=t,{needsMask:M}=t,{preserveWhiteSpace:R=!0}=t;M||(M=te(e,s,a,void 0===M));var A,N=ne(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:M,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:m,keepIframeSrcFn:x,newlyAddedElement:T});if(!N)return console.warn(e,"not serialized"),null;A=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===h.Comment)return!0;if(e.type===h.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===O(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===re(e.attributes.name)||"icon"===re(e.attributes.rel)||"apple-touch-icon"===re(e.attributes.rel)||"shortcut icon"===re(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===re(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===re(e.attributes.name)||"googlebot"===re(e.attributes.name)||"bingbot"===re(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===re(e.attributes.name)||"generator"===re(e.attributes.name)||"framework"===re(e.attributes.name)||"publisher"===re(e.attributes.name)||"progid"===re(e.attributes.name)||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===re(e.attributes.name)||"yandex-verification"===re(e.attributes.name)||"csrf-token"===re(e.attributes.name)||"p:domain_verify"===re(e.attributes.name)||"verify-v1"===re(e.attributes.name)||"verification"===re(e.attributes.name)||"shopify-checkout-api-token"===re(e.attributes.name)))return!0}}return!1}(N,v)&&(R||N.type!==h.Text||N.isStyle||N.textContent.replace(/^\s+|\s+$/gm,"").length)?G():Z;var F=Object.assign(N,{id:A});if(r.add(e,F),A===Z)return null;_&&_(e);var L=!l;if(F.type===h.Element){L=L&&!F.needBlock,delete F.needBlock;var P=S.shadowRoot(e);P&&k(P)&&(F.isShadowHost=!0)}if((F.type===h.Document||F.type===h.Element)&&L){v.headWhitespace&&F.type===h.Element&&"head"===F.tagName&&(R=!1);var D={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:v,dataURLOptions:g,inlineImages:f,recordCanvas:m,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:x};if(F.type===h.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(var B of Array.from(S.childNodes(e))){var H=ie(B,D);H&&F.childNodes.push(H)}var q=null;if(C(e)&&(q=S.shadowRoot(e)))for(var W of Array.from(S.childNodes(q))){var $=ie(W,D);$&&(k(q)&&($.isShadow=!0),F.childNodes.push($))}}var V=S.parentNode(e);return V&&I(V)&&k(V)&&(F.isShadow=!0),F.type===h.Element&&"iframe"===F.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 s="about:blank";if(r.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((()=>{o||(t(),o=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),o=!0,t()}))}}}(e,(()=>{var t=e.contentDocument;if(t&&y){var n=ie(t,{doc:t,mirror:r,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:v,dataURLOptions:g,inlineImages:f,recordCanvas:m,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:x});n&&y(e,n)}}),b),F.type===h.Element&&"link"===F.tagName&&"string"==typeof F.attributes.rel&&("stylesheet"===F.attributes.rel||"preload"===F.attributes.rel&&"string"==typeof F.attributes.href&&"css"===O(F.attributes.href))&&function(e,t,n){var r,i=!1;try{r=e.sheet}catch(e){return}if(!r){var o=setTimeout((()=>{i||(t(),i=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),i=!0,t()}))}}(e,(()=>{if(w){var t=ie(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:v,dataURLOptions:g,inlineImages:f,recordCanvas:m,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:x});t&&w(e,t)}}),E),F}let oe=class e{constructor(){__publicField2(this,"parentElement",null),__publicField2(this,"parentNode",null),__publicField2(this,"ownerDocument"),__publicField2(this,"firstChild",null),__publicField2(this,"lastChild",null),__publicField2(this,"previousSibling",null),__publicField2(this,"nextSibling",null),__publicField2(this,"ELEMENT_NODE",1),__publicField2(this,"TEXT_NODE",3),__publicField2(this,"nodeType"),__publicField2(this,"nodeName"),__publicField2(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var se={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ae={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},le={};function ce(e){if(le[e])return le[e];var t=globalThis[e],n=t.prototype,r=e in se?se[e]:void 0,i=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),o=e in ae?ae[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(i&&s&&!g(t))return le[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var c=l[e].prototype;return document.body.removeChild(a),c?le[e]=c:n}catch(e){return n}}var ue={};function de(e,t,n){var r,i="".concat(e,".").concat(String(n));if(ue[i])return ue[i].call(t);var o=ce(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(ue[i]=s,s.call(t)):t[n]}var he={};function pe(e,t,n){var r="".concat(e,".").concat(String(n));if(he[r])return he[r].bind(t);var i=ce(e)[n];return"function"!=typeof i?t[n]:(he[r]=i,i.bind(t))}function ve(){return ce("MutationObserver").constructor}var ge={childNodes:function(e){return de("Node",e,"childNodes")},parentNode:function(e){return de("Node",e,"parentNode")},parentElement:function(e){return de("Node",e,"parentElement")},textContent:function(e){return de("Node",e,"textContent")},contains:function(e,t){return pe("Node",e,"contains")(t)},getRootNode:function(e){return pe("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?de("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?de("Element",e,"shadowRoot"):null},querySelector:function(e,t){return de("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return de("Element",e,"querySelectorAll")(t)},mutationObserver:ve};function fe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var me="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.",_e={map:{},getId:()=>(console.error(me),-1),getNode:()=>(console.error(me),null),removeNodeFromMap(){console.error(me)},has:()=>(console.error(me),!1),reset(){console.error(me)}};function ye(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,i=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var l=Date.now();i||!1!==n.leading||(i=l);var c=t-(l-i),u=this;c<=0||c>t?(r&&(clearTimeout(r),r=null),i=l,e.apply(u,s)):r||!1===n.trailing||(r=setTimeout((()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(u,s)}),c))}}function be(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window,o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>be(e,t,o||{},!0)}function we(e,t,n){try{if(!(t in e))return()=>{};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,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(_e=new Proxy(_e,{get:(e,t,n)=>("map"===t&&console.error(me),Reflect.get(e,t,n))}));var Se=Date.now;function Ce(e){var t,n,r,i,o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=ge.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(r=ge.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function Ie(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ke(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ee(e){return e?e.nodeType===e.ELEMENT_NODE?e:ge.parentElement(e):null}function xe(e,t,n,r){if(!e)return!1;var i=Ee(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(ee(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function Te(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||t.getId(e)===Z}function Me(e,t){if(I(e))return!1;var n=t.getId(e);if(!t.has(n))return!0;var r=ge.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||Me(r,t))}function Re(e){return Boolean(e.changedTouches)}function Ae(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ne(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Fe(e){return!!e&&(e instanceof oe&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(ge.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Se=()=>(new Date).getTime());let Oe=class{constructor(){c(this,"id",1),c(this,"styleIDMap",new WeakMap),c(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n);var n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Le(e){var t,n=null;return"getRootNode"in e&&(null==(t=ge.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ge.host(ge.getRootNode(e))&&(n=ge.host(ge.getRootNode(e))),n}function Pe(e){var t=e.ownerDocument;if(!t)return!1;var n=function(e){for(var t,n=e;t=Le(n);)n=t;return n}(e);return ge.contains(t,n)}function De(e){var t=e.ownerDocument;return!!t&&(ge.contains(t,e)||Pe(e))}var Be=(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",e))(Be||{}),He=(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",e[e.CustomElement=16]="CustomElement",e))(He||{}),qe=(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",e))(qe||{}),We=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(We||{}),$e=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))($e||{}),Ve=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ve||{});function Ze(e){return"__ln"in e}class Ge{constructor(){c(this,"length",0),c(this,"head",null),c(this,"tail",null)}get(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}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Ze(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&&Ze(e.nextSibling)&&e.nextSibling.__ln.previous){var r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}var Ue,je=(e,t)=>"".concat(e,"@").concat(t);class ze{constructor(){c(this,"frozen",!1),c(this,"locked",!1),c(this,"texts",[]),c(this,"attributes",[]),c(this,"attributeMap",new WeakMap),c(this,"removes",[]),c(this,"mapRemoves",[]),c(this,"movedMap",{}),c(this,"addedSet",new Set),c(this,"movedSet",new Set),c(this,"droppedSet",new Set),c(this,"mutationCb"),c(this,"blockClass"),c(this,"blockSelector"),c(this,"maskTextClass"),c(this,"maskTextSelector"),c(this,"inlineStylesheet"),c(this,"maskInputOptions"),c(this,"maskTextFn"),c(this,"maskInputFn"),c(this,"keepIframeSrcFn"),c(this,"recordCanvas"),c(this,"inlineImages"),c(this,"slimDOMOptions"),c(this,"dataURLOptions"),c(this,"doc"),c(this,"mirror"),c(this,"iframeManager"),c(this,"stylesheetManager"),c(this,"shadowDomManager"),c(this,"canvasManager"),c(this,"processedNodeManager"),c(this,"unattachedDoc"),c(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),c(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var e=[],t=new Set,n=new Ge,r=e=>{for(var t=e,n=Z;n===Z;)n=(t=t&&t.nextSibling)&&this.mirror.getId(t);return n},i=i=>{var o=ge.parentNode(i);if(o&&De(i)&&"TEXTAREA"!==o.tagName){var s=I(o)?this.mirror.getId(Le(i)):this.mirror.getId(o),a=r(i);if(-1===s||-1===a)return n.addNode(i);var l=ie(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Ae(e,this.mirror)&&this.iframeManager.addIframe(e),Ne(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Fe(i)&&this.shadowDomManager.addShadowRoot(ge.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:s,nextId:a,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var o of this.movedSet)Xe(this.removes,o,this.mirror)&&!this.movedSet.has(ge.parentNode(o))||i(o);for(var s of this.addedSet)Je(this.droppedSet,s)||Xe(this.removes,s,this.mirror)?Je(this.movedSet,s)?i(s):this.droppedSet.add(s):i(s);for(var a=null;n.length;){var l=null;if(a){var c=this.mirror.getId(ge.parentNode(a.value)),u=r(a.value);-1!==c&&-1!==u&&(l=a)}if(!l)for(var d=n.tail;d;){var h=d;if(d=d.previous,h){var p=this.mirror.getId(ge.parentNode(h.value));if(-1===r(h.value))continue;if(-1!==p){l=h;break}var v=h.value,g=ge.parentNode(v);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var f=ge.host(g);if(-1!==this.mirror.getId(f)){l=h;break}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}a=l.previous,n.removeNode(l.value),i(l.value)}var m={texts:this.texts.map((e=>{var t=e.node,n=ge.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{var{attributes:t}=e;if("string"==typeof t.style){var n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(m))}})),c(this,"genTextAreaValueMutation",(e=>{var t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(ge.childNodes(e),(e=>ge.textContent(e)||"")).join("")})),c(this,"processMutation",(e=>{if(!Te(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=ge.textContent(e.target);xe(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:te(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ee(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var n=e.target,r=e.attributeName,i=e.target.getAttribute(r);if("value"===r){var o=F(n);i=R({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(xe(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;var s=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(i)){if(n.contentDocument)return;r="rr_src"}if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Q(n.tagName,r))if(s.attributes[r]=K(this.doc,A(n.tagName),A(r),i),"style"===r){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}var a=this.unattachedDoc.createElement("span");for(var l of(e.oldValue&&a.setAttribute("style",e.oldValue),Array.from(n.style))){var c=n.style.getPropertyValue(l),u=n.style.getPropertyPriority(l);c!==a.style.getPropertyValue(l)||u!==a.style.getPropertyPriority(l)?s.styleDiff[l]=""===u?c:[c,u]:s._unchangedStyles[l]=[c,u]}for(var d of Array.from(a.style))""===n.style.getPropertyValue(d)&&(s.styleDiff[d]=!1)}else"open"===r&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?s.attributes.rr_open_mode="modal":s.attributes.rr_open_mode="non-modal");break;case"childList":if(xe(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{var n=this.mirror.getId(t),r=I(e.target)?this.mirror.getId(ge.host(e.target)):this.mirror.getId(e.target);xe(e.target,this.blockClass,this.blockSelector,!1)||Te(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Ye(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Me(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[je(n,r)]?Ye(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!I(e.target)||!k(e.target))||void 0})),this.mapRemoves.push(t))}))}})),c(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Te(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[je(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);xe(e,this.blockClass,this.blockSelector,!1)||(ge.childNodes(e).forEach((e=>this.genAdds(e))),Fe(e)&&ge.childNodes(ge.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Ye(e,t){e.delete(t),ge.childNodes(t).forEach((t=>Ye(e,t)))}function Xe(e,t,n){return 0!==e.length&&function(e,t,n){var r=ge.parentNode(t),i=function(){var t=n.getId(r);if(e.some((e=>e.id===t)))return{v:!0};r=ge.parentNode(r)};for(;r;){var o=i();if("object"==typeof o)return o.v}return!1}(e,t,n)}function Je(e,t){return 0!==e.size&&Ke(e,t)}function Ke(e,t){var n=ge.parentNode(t);return!!n&&(!!e.has(n)||Ke(e,n))}var Qe=e=>{if(!Ue)return e;return function(){try{return e(...arguments)}catch(e){if(Ue&&!0===Ue(e))return;throw e}}},et=[];function tt(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]}catch(e){}return e&&e.target}function nt(e,t){var n=new ze;et.push(n),n.init(e);var r=new(ve())(Qe(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function rt(e){var{mouseInteractionCb:n,doc:r,mirror:i,blockClass:o,blockSelector:s,sampling:a}=e;if(!1===a.mouseInteraction)return()=>{};var l=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,c=[],u=null;return Object.keys(qe).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e])).forEach((e=>{var a=A(e),l=(e=>r=>{var a=tt(r);if(!xe(a,o,s,!0)){var l=null,c=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=We.Mouse;break;case"touch":l=We.Touch;break;case"pen":l=We.Pen}l===We.Touch?qe[e]===qe.MouseDown?c="TouchStart":qe[e]===qe.MouseUp&&(c="TouchEnd"):We.Pen}else Re(r)&&(l=We.Touch);null!==l?(u=l,(c.startsWith("Touch")&&l===We.Touch||c.startsWith("Mouse")&&l===We.Mouse)&&(l=null)):qe[e]===qe.Click&&(l=u,u=null);var d=Re(r)?r.changedTouches[0]:r;if(d){var h=i.getId(a),{clientX:p,clientY:v}=d;Qe(n)(t({type:qe[c],id:h,x:p,y:v},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(qe[e]){case qe.MouseDown:case qe.MouseUp:a=a.replace("mouse","pointer");break;case qe.TouchStart:case qe.TouchEnd:return}c.push(fe(a,l,r))})),Qe((()=>{c.forEach((e=>e()))}))}function it(e){var{scrollCb:t,doc:n,mirror:r,blockClass:i,blockSelector:o,sampling:s}=e;return fe("scroll",Qe(ye(Qe((e=>{var s=tt(e);if(s&&!xe(s,i,o,!0)){var a=r.getId(s);if(s===n&&n.defaultView){var l=Ce(n.defaultView);t({id:a,x:l.left,y:l.top})}else t({id:a,x:s.scrollLeft,y:s.scrollTop})}})),s.scroll||100)),n)}var ot=["INPUT","TEXTAREA","SELECT"],st=new WeakMap;function at(e){return function(e,t){if(dt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||dt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||dt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||dt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){var r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function lt(e,t,n){var r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function ct(e,t){var n,r,i,{mirror:o,stylesheetManager:s}=e,a=null;a="#document"===t.nodeName?o.getId(t):o.getId(ge.host(t));var l="#document"===t.nodeName?null==(n=t.defaultView)?void 0:n.Document:null==(i=null==(r=t.ownerDocument)?void 0:r.defaultView)?void 0:i.ShadowRoot,c=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&l&&c?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null==(e=c.get)?void 0:e.call(this)},set(e){var t,n=null==(t=c.set)?void 0:t.call(this,e);if(null!==a&&-1!==a)try{s.adoptStyleSheets(e,a)}catch(e){}return n}}),Qe((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function ut(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.doc.defaultView;if(!i)return()=>{};!function(e,t){var{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:v}=e;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),n(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),r(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),i(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),o(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),s(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),c(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),u(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),d(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),v(...arguments)}}(e,r),e.recordDOM&&(n=nt(e,e.doc));var o=function(e){var{mousemoveCb:t,sampling:n,doc:r,mirror:i}=e;if(!1===n.mousemove)return()=>{};var o,s="number"==typeof n.mousemove?n.mousemove:50,a="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500,l=[],c=ye(Qe((e=>{var n=Date.now()-o;t(l.map((e=>(e.timeOffset-=n,e))),e),l=[],o=null})),a),u=Qe(ye(Qe((e=>{var t=tt(e),{clientX:n,clientY:r}=Re(e)?e.changedTouches[0]:e;o||(o=Se()),l.push({x:n,y:r,id:i.getId(t),timeOffset:Se()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?He.Drag:e instanceof MouseEvent?He.MouseMove:He.TouchMove)})),s,{trailing:!1})),d=[fe("mousemove",u,r),fe("touchmove",u,r),fe("drag",u,r)];return Qe((()=>{d.forEach((e=>e()))}))}(e),s=rt(e),a=it(e),l=function(e,t){var{viewportResizeCb:n}=e,{win:r}=t,i=-1,o=-1;return fe("resize",Qe(ye(Qe((()=>{var e=Ie(),t=ke();i===e&&o===t||(n({width:Number(t),height:Number(e)}),i=e,o=t)})),200)),r)}(e,{win:i}),c=function(e){var{inputCb:n,doc:r,mirror:i,blockClass:o,blockSelector:s,ignoreClass:a,ignoreSelector:l,maskInputOptions:c,maskInputFn:u,sampling:d,userTriggeredOnInput:h}=e;function p(e){var t=tt(e),n=e.isTrusted,i=t&&t.tagName;if(t&&"OPTION"===i&&(t=ge.parentElement(t)),t&&i&&!(ot.indexOf(i)<0)&&!xe(t,o,s,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var d=t.value,p=!1,g=F(t)||"";"radio"===g||"checkbox"===g?p=t.checked:(c[i.toLowerCase()]||c[g])&&(d=R({element:t,maskInputOptions:c,tagName:i,type:g,value:d,maskInputFn:u})),v(t,h?{text:d,isChecked:p,userTriggered:n}:{text:d,isChecked:p});var f=t.name;"radio"===g&&f&&p&&r.querySelectorAll('input[type="radio"][name="'.concat(f,'"]')).forEach((e=>{if(e!==t){var n=e.value;v(e,h?{text:n,isChecked:!p,userTriggered:!1}:{text:n,isChecked:!p})}}))}}function v(e,r){var o=st.get(e);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){st.set(e,r);var s=i.getId(e);Qe(n)(t(t({},r),{},{id:s}))}}var g=("last"===d.input?["change"]:["input","change"]).map((e=>fe(e,Qe(p),r))),f=r.defaultView;if(!f)return()=>{g.forEach((e=>e()))};var m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),_=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&g.push(..._.map((e=>be(e[0],e[1],{set(){Qe(p)({target:this,isTrusted:!1})}},!1,f)))),Qe((()=>{g.forEach((e=>e()))}))}(e),u=function(e){var{mediaInteractionCb:t,blockClass:n,blockSelector:r,mirror:i,sampling:o,doc:s}=e,a=Qe((e=>ye(Qe((o=>{var s=tt(o);if(s&&!xe(s,n,r,!0)){var{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=s;t({type:e,id:i.getId(s),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}})),o.media||500))),l=[fe("play",a(Ve.Play),s),fe("pause",a(Ve.Pause),s),fe("seeked",a(Ve.Seeked),s),fe("volumechange",a(Ve.VolumeChange),s),fe("ratechange",a(Ve.RateChange),s)];return Qe((()=>{l.forEach((e=>e()))}))}(e),d=()=>{},h=()=>{},p=()=>{},v=()=>{};e.recordDOM&&(d=function(e,t){var{styleSheetRuleCb:n,mirror:r,stylesheetManager:i}=e,{win:o}=t;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};var s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Qe(((e,t,o)=>{var[s,a]=o,{id:l,styleId:c}=lt(t,r,i.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:s,index:a}]}),e.apply(t,o)}))}),o.CSSStyleSheet.prototype.addRule=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.cssRules.length,r="".concat(e," { ").concat(t," }");return o.CSSStyleSheet.prototype.insertRule.apply(this,[r,n])};var a,l,c=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(c,{apply:Qe(((e,t,o)=>{var[s]=o,{id:a,styleId:l}=lt(t,r,i.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:s}]}),e.apply(t,o)}))}),o.CSSStyleSheet.prototype.removeRule=function(e){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},o.CSSStyleSheet.prototype.replace&&(a=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Qe(((e,t,o)=>{var[s]=o,{id:a,styleId:l}=lt(t,r,i.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replace:s}),e.apply(t,o)}))})),o.CSSStyleSheet.prototype.replaceSync&&(l=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Qe(((e,t,o)=>{var[s]=o,{id:a,styleId:l}=lt(t,r,i.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replaceSync:s}),e.apply(t,o)}))}));var u={};ht("CSSGroupingRule")?u.CSSGroupingRule=o.CSSGroupingRule:(ht("CSSMediaRule")&&(u.CSSMediaRule=o.CSSMediaRule),ht("CSSConditionRule")&&(u.CSSConditionRule=o.CSSConditionRule),ht("CSSSupportsRule")&&(u.CSSSupportsRule=o.CSSSupportsRule));var d={};return Object.entries(u).forEach((e=>{var[t,o]=e;d[t]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Qe(((e,t,o)=>{var[s,a]=o,{id:l,styleId:c}=lt(t.parentStyleSheet,r,i.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:s,index:[...at(t),a||0]}]}),e.apply(t,o)}))}),o.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Qe(((e,t,o)=>{var[s]=o,{id:a,styleId:l}=lt(t.parentStyleSheet,r,i.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:[...at(t),s]}]}),e.apply(t,o)}))})})),Qe((()=>{o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=c,a&&(o.CSSStyleSheet.prototype.replace=a),l&&(o.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach((e=>{var[t,n]=e;n.prototype.insertRule=d[t].insertRule,n.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:i}),h=ct(e,e.doc),p=function(e,t){var{styleDeclarationCb:n,mirror:r,ignoreCSSAttributes:i,stylesheetManager:o}=e,{win:s}=t,a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Qe(((e,t,s)=>{var l,[c,u,d]=s;if(i.has(c))return a.apply(t,[c,u,d]);var{id:h,styleId:p}=lt(null==(l=t.parentRule)?void 0:l.parentStyleSheet,r,o.styleMirror);return(h&&-1!==h||p&&-1!==p)&&n({id:h,styleId:p,set:{property:c,value:u,priority:d},index:at(t.parentRule)}),e.apply(t,s)}))});var l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Qe(((e,t,s)=>{var a,[c]=s;if(i.has(c))return l.apply(t,[c]);var{id:u,styleId:d}=lt(null==(a=t.parentRule)?void 0:a.parentStyleSheet,r,o.styleMirror);return(u&&-1!==u||d&&-1!==d)&&n({id:u,styleId:d,remove:{property:c},index:at(t.parentRule)}),e.apply(t,s)}))}),Qe((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:i}),e.collectFonts&&(v=function(e){var{fontCb:t,doc:n}=e,r=n.defaultView;if(!r)return()=>{};var i=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(e,t,n){var r=new s(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 a=we(n.fonts,"add",(function(e){return function(n){return setTimeout(Qe((()=>{var e=o.get(n);e&&(t(e),o.delete(n))})),0),e.apply(this,[n])}}));return i.push((()=>{r.FontFace=s})),i.push(a),Qe((()=>{i.forEach((e=>e()))}))}(e)));var g=function(e){var{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e,s=!0,a=Qe((()=>{var e=t.getSelection();if(!(!e||s&&(null==e?void 0:e.isCollapsed))){s=e.isCollapsed||!1;for(var a=[],l=e.rangeCount||0,c=0;c<l;c++){var u=e.getRangeAt(c),{startContainer:d,startOffset:h,endContainer:p,endOffset:v}=u;xe(d,r,i,!0)||xe(p,r,i,!0)||a.push({start:n.getId(d),startOffset:h,end:n.getId(p),endOffset:v})}o({ranges:a})}}));return a(),fe("selectionchange",a)}(e),f=function(e){var{doc:t,customElementCb:n}=e,r=t.defaultView;if(!r||!r.customElements)return()=>{};var i=we(r.customElements,"define",(function(e){return function(t,r,i){try{n({define:{name:t}})}catch(e){console.warn("Custom element callback failed for ".concat(t))}return e.apply(this,[t,r,i])}}));return i}(e),m=[];for(var _ of e.plugins)m.push(_.observer(_.callback,i,_.options));return Qe((()=>{et.forEach((e=>e.reset())),null==n||n.disconnect(),o(),s(),a(),l(),c(),u(),d(),h(),p(),v(),g(),f(),m.forEach((e=>e()))}))}function dt(e){return void 0!==window[e]}function ht(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class pt{constructor(e){c(this,"iframeIdToRemoteIdMap",new WeakMap),c(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,r){var i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e),s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.set(s,t)),s}getIds(e,t){var n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){var r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;var i=r.get(t);return i||-1}getRemoteIds(e,t){var n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){var t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class vt{constructor(e){c(this,"iframes",new WeakMap),c(this,"crossOriginIframeMap",new WeakMap),c(this,"crossOriginIframeMirror",new pt(G)),c(this,"crossOriginIframeStyleMirror"),c(this,"crossOriginIframeRootIdMap",new WeakMap),c(this,"mirror"),c(this,"mutationCb"),c(this,"wrappedEmit"),c(this,"loadListener"),c(this,"stylesheetManager"),c(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new pt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var n=this.crossOriginIframeMap.get(e.source);if(n){var r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var n;switch(t.type){case Be.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:Be.IncrementalSnapshot,data:{source:He.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Be.Meta:case Be.Load:case Be.DomContentLoaded:return!1;case Be.Plugin:return t;case Be.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Be.IncrementalSnapshot:switch(t.data.source){case He.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case He.Drag:case He.TouchMove:case He.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case He.ViewportResize:return!1;case He.MediaInteraction:case He.MouseInteraction:case He.Scroll:case He.CanvasMutation:case He.Input:return this.replaceIds(t.data,e,["id"]),t;case He.StyleSheetRule:case He.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case He.Font:return t;case He.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case He.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,r){for(var i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===h.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class gt{constructor(e){c(this,"shadowDoms",new WeakSet),c(this,"mutationCb"),c(this,"scrollCb"),c(this,"bypassOptions"),c(this,"mirror"),c(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(k(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var r=nt(t(t({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>r.disconnect())),this.restoreHandlers.push(it(t(t({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(ge.host(e))),this.restoreHandlers.push(ct({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var n=this;this.restoreHandlers.push(we(e.prototype,"attachShadow",(function(e){return function(r){var i=e.call(this,r),o=ge.shadowRoot(this);return o&&De(this)&&n.addShadowRoot(o,t),i}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),_t=0;_t<64;_t++)mt[ft.charCodeAt(_t)]=_t;var yt=new Map;var bt=(e,t,n)=>{if(e&&(Ct(e,t)||"object"==typeof e)){var r=function(e,t){var n=yt.get(e);return n||(n=new Map,yt.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 wt(e,t,n){if(e instanceof Array)return e.map((e=>wt(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)return{rr_type:e.constructor.name,base64:function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=ft[n[t]>>2],i+=ft[(3&n[t])<<4|n[t+1]>>4],i+=ft[(15&n[t+1])<<2|n[t+2]>>6],i+=ft[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)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[wt(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){var r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}return e instanceof ImageData?{rr_type:e.constructor.name,args:[wt(e.data,t,n),e.width,e.height]}:Ct(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:bt(e,t,n)}:e}var St=(e,t,n)=>e.map((e=>wt(e,t,n))),Ct=(e,t)=>{var n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function It(e,t,n,r){var i=[];try{var o=we(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(i){for(var o=arguments.length,s=new Array(o>1?o-1:0),a=1;a<o;a++)s[a-1]=arguments[a];if(!xe(this,t,n,!0)){var l=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=l),r&&["webgl","webgl2"].includes(l))if(s[0]&&"object"==typeof s[0]){var c=s[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...s])}}));i.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach((e=>e()))}}function kt(e,t,n,r,i,o){var s=[],a=Object.getOwnPropertyNames(e),l=function(a){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))return"continue";try{if("function"!=typeof e[a])return"continue";var l=we(e,a,(function(e){return function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];var u=e.apply(this,l);if(bt(u,o,this),"tagName"in this.canvas&&!xe(this.canvas,r,i,!0)){var d=St(l,o,this),h={type:t,property:a,args:d};n(this.canvas,h)}return u}}));s.push(l)}catch(r){var c=be(e,a,{set(e){n(this.canvas,{type:t,property:a,args:[e],setter:!0})}});s.push(c)}};for(var c of a)l(c);return s}var Et,xt,Tt,Mt,Rt="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",At="undefined"!=typeof window&&window.Blob&&new Blob([(Et=Rt,Uint8Array.from(atob(Et),(e=>e.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});function Nt(e){var t;try{if(!(t=At&&(window.URL||window.webkitURL).createObjectURL(At)))throw"";var n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(window.URL||window.webkitURL).revokeObjectURL(t)})),n}catch(t){return new Worker("data:text/javascript;base64,"+Rt,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class Ft{constructor(e){c(this,"pendingCanvasMutations",new Map),c(this,"rafStamps",{latestId:0,invokeId:null}),c(this,"mirror"),c(this,"mutationCb"),c(this,"resetObservers"),c(this,"frozen",!1),c(this,"locked",!1),c(this,"processMutation",((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)}));var{sampling:t="all",win:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,i,o){var s=this,a=It(t,n,i,!0),l=new Map,c=new Nt;c.onmessage=e=>{var{id:t}=e.data;if(l.set(t,!1),"base64"in e.data){var{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:$e["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})}};var u,d=1e3/e,h=0,p=e=>{var a,v;h&&e-h<d?u=requestAnimationFrame(p):(h=e,(a=[],v=e=>{e.querySelectorAll("canvas").forEach((e=>{xe(e,n,i,!0)||a.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&v(e.shadowRoot)}))},v(t.document),a).forEach(function(){var e=r((function*(e){var t,n=s.mirror.getId(e);if(!l.get(n)&&0!==e.width&&0!==e.height){if(l.set(n,!0),["webgl","webgl2"].includes(e.__context)){var r=e.getContext(e.__context);!1===(null==(t=null==r?void 0:r.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}var i=e.clientWidth||e.width,a=e.clientHeight||e.height,u=yield createImageBitmap(e,{resizeWidth:i,resizeHeight:a});c.postMessage({id:n,bitmap:u,width:i,height:a,dataURLOptions:o.dataURLOptions},[u])}}));return function(t){return e.apply(this,arguments)}}()),u=requestAnimationFrame(p))};u=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var r=It(e,t,n,!1),i=function(e,t,n,r){var i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),s=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return"continue";var s=we(t.CanvasRenderingContext2D.prototype,o,(function(i){return function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return xe(this.canvas,n,r,!0)||setTimeout((()=>{var n=St(a,t,this);e(this.canvas,{type:$e["2D"],property:o,args:n})}),0),i.apply(this,a)}}));i.push(s)}catch(n){var a=be(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:$e["2D"],property:o,args:[t],setter:!0})}});i.push(a)}};for(var a of o)s(a);return()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){var i=[];return i.push(...kt(t.WebGLRenderingContext.prototype,$e.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...kt(t.WebGL2RenderingContext.prototype,$e.WebGL2,e,n,r,t)),()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{var n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var n=this.pendingCanvasMutations.get(e);if(n&&-1!==t){var r=n.map((e=>o(e,a))),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}}}class Ot{constructor(e){c(this,"trackedLinkElements",new WeakSet),c(this,"mutationCb"),c(this,"adoptedStyleSheetCb"),c(this,"styleMirror",new Oe),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var n=this;if(0!==e.length){var r={id:t,styleIds:[]},i=[],o=function(e){var t=void 0;n.styleMirror.has(e)?t=n.styleMirror.getId(e):(t=n.styleMirror.add(e),i.push({styleId:t,rules:Array.from(e.rules||CSSRule,((t,n)=>({rule:x(t,e.href),index:n})))})),r.styleIds.push(t)};for(var s of e)o(s);i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Lt{constructor(){c(this,"nodeMap",new WeakMap),c(this,"active",!1)}inOtherBuffer(e,t){var n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}var Pt=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Dt=document.createElement("iframe");document.body.appendChild(Dt),Array.from=(null==(s=Dt.contentWindow)?void 0:s.Array.from)||Array.from,document.body.removeChild(Dt)}}catch(e){console.debug("Unable to override Array.from",e)}var Bt,Ht,qt=new M;function Wt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{emit:n,checkoutEveryNms:r,checkoutEveryNth:i,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:v,maskInputFn:g,maskTextFn:f,hooks:m,packFn:_,sampling:y={},dataURLOptions:b={},mousemoveWait:w,recordDOM:S=!0,recordCanvas:C=!1,recordCrossOriginIframes:I=!1,recordAfter:k=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:x=!1,inlineImages:T=!1,plugins:R,keepIframeSrcFn:A=(()=>!1),ignoreCSSAttributes:N=new Set([]),errorHandler:F}=e;Ue=F;var O=!I||window.parent===window,L=!1;if(!O)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(O&&!n)throw new Error("emit function is required");if(!O&&!L)return()=>{};void 0!==w&&void 0===y.mousemove&&(y.mousemove=w),qt.reset();var P,D=!0===h?{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!==p?p:{password:!0},B=!0===v||"all"===v?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===v,headMetaDescKeywords:"all"===v,headTitleMutations:"all"===v}:v||{};!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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)}();var H=0,q=e=>{for(var t of R||[])t.eventProcessor&&(e=t.eventProcessor(e));return _&&!L&&(e=_(e)),e};xt=(e,t)=>{var o,s=e;if(s.timestamp=Se(),!(null==(o=et[0])?void 0:o.isFrozen())||s.type===Be.FullSnapshot||s.type===Be.IncrementalSnapshot&&s.data.source===He.Mutation||et.forEach((e=>e.unfreeze())),O)null==n||n(q(s),t);else if(L){var a={type:"rrweb",event:q(s),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(s.type===Be.FullSnapshot)P=s,H=0;else if(s.type===Be.IncrementalSnapshot){if(s.data.source===He.Mutation&&s.data.isAttachIframe)return;H++;var l=i&&H>=i,c=r&&s.timestamp-P.timestamp>r;(l||c)&&Tt(!0)}};var W=e=>{xt({type:Be.IncrementalSnapshot,data:t({source:He.Mutation},e)})},$=e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.Scroll},e)}),V=e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.CanvasMutation},e)}),Z=new Ot({mutationCb:W,adoptedStyleSheetCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.AdoptedStyleSheet},e)})}),G=new vt({mirror:qt,mutationCb:W,stylesheetManager:Z,recordCrossOriginIframes:I,wrappedEmit:xt});for(var U of R||[])U.getMirror&&U.getMirror({nodeMirror:qt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});var j=new Lt;Mt=new Ft({recordCanvas:C,mutationCb:V,win:window,blockClass:o,blockSelector:s,mirror:qt,sampling:y.canvas,dataURLOptions:b});var z=new gt({mutationCb:W,scrollCb:$,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:D,dataURLOptions:b,maskTextFn:f,maskInputFn:g,recordCanvas:C,inlineImages:T,sampling:y,slimDOMOptions:B,iframeManager:G,stylesheetManager:Z,canvasManager:Mt,keepIframeSrcFn:A,processedNodeManager:j},mirror:qt});Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(S){xt({type:Be.Meta,data:{href:window.location.href,width:ke(),height:Ie()}},e),Z.reset(),z.init(),et.forEach((e=>e.lock()));var t=function(e,t){var{mirror:n=new M,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:h,slimDOM:p=!1,dataURLOptions:v,preserveWhiteSpace:g,onSerialize:f,onIframeLoad:m,iframeLoadTimeout:_,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:w=(()=>!1)}=t||{};return ie(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===u?{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===u?{password:!0}:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===p,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===p?{}:p,dataURLOptions:v,inlineImages:l,recordCanvas:c,preserveWhiteSpace:g,onSerialize:f,onIframeLoad:m,iframeLoadTimeout:_,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:w,newlyAddedElement:!1})}(document,{mirror:qt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:D,maskTextFn:f,maskInputFn:g,slimDOM:B,dataURLOptions:b,recordCanvas:C,inlineImages:T,onSerialize:e=>{Ae(e,qt)&&G.addIframe(e),Ne(e,qt)&&Z.trackLinkElement(e),Fe(e)&&z.addShadowRoot(ge.shadowRoot(e),document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),z.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{Z.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");xt({type:Be.FullSnapshot,data:{node:t,initialOffset:Ce(window)}},e),et.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Z.adoptStyleSheets(document.adoptedStyleSheets,qt.getId(document))}};try{var Y=[],X=e=>{var n;return Qe(ut)({mutationCb:W,mousemoveCb:(e,t)=>xt({type:Be.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.MouseInteraction},e)}),scrollCb:$,viewportResizeCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.ViewportResize},e)}),inputCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.Input},e)}),mediaInteractionCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.MediaInteraction},e)}),styleSheetRuleCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.StyleSheetRule},e)}),styleDeclarationCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.StyleDeclaration},e)}),canvasMutationCb:V,fontCb:e=>xt({type:Be.IncrementalSnapshot,data:t({source:He.Font},e)}),selectionCb:e=>{xt({type:Be.IncrementalSnapshot,data:t({source:He.Selection},e)})},customElementCb:e=>{xt({type:Be.IncrementalSnapshot,data:t({source:He.CustomElement},e)})},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:u,maskInputOptions:D,inlineStylesheet:d,sampling:y,recordDOM:S,recordCanvas:C,inlineImages:T,userTriggeredOnInput:E,collectFonts:x,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:A,blockSelector:s,slimDOMOptions:B,dataURLOptions:b,mirror:qt,iframeManager:G,stylesheetManager:Z,shadowDomManager:z,processedNodeManager:j,canvasManager:Mt,ignoreCSSAttributes:N,plugins:(null==(n=null==R?void 0:R.filter((e=>e.observer)))?void 0:n.map((e=>({observer:e.observer,options:e.options,callback:t=>xt({type:Be.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},m)};G.addLoadListener((e=>{try{Y.push(X(e.contentDocument))}catch(e){console.warn(e)}}));var J=()=>{Tt(),Y.push(X(document)),Pt=!0};return"interactive"===document.readyState||"complete"===document.readyState?J():(Y.push(fe("DOMContentLoaded",(()=>{xt({type:Be.DomContentLoaded,data:{}}),"DOMContentLoaded"===k&&J()}))),Y.push(fe("load",(()=>{xt({type:Be.Load,data:{}}),"load"===k&&J()}),window))),()=>{Y.forEach((e=>e())),j.destroy(),Pt=!1,Ue=void 0}}catch(e){console.warn(e)}}Wt.addCustomEvent=(e,t)=>{if(!Pt)throw new Error("please add custom event after start recording");xt({type:Be.Custom,data:{tag:e,payload:t}})},Wt.freezePage=()=>{et.forEach((e=>e.freeze()))},Wt.takeFullSnapshot=e=>{if(!Pt)throw new Error("please take full snapshot after start recording");Tt(e)},Wt.mirror=qt,(Ht=Bt||(Bt={}))[Ht.NotStarted=0]="NotStarted",Ht[Ht.Running=1]="Running",Ht[Ht.Stopped=2]="Stopped";var $t,Vt=Object.defineProperty,Zt=(e,t,n)=>((e,t,n)=>t in e?Vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Gt=Object.defineProperty,Ut=(e,t,n)=>((e,t,n)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),jt=Object.defineProperty,zt=(e,t,n)=>((e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Yt={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Xt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Jt={};function Kt(e){if(Jt[e])return Jt[e];var t=globalThis[e],n=t.prototype,r=e in Yt?Yt[e]:void 0,i=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),o=e in Xt?Xt[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(i&&s)return Jt[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var c=l[e].prototype;return document.body.removeChild(a),c?Jt[e]=c:n}catch(e){return n}}var Qt={};function en(e,t,n){var r,i="".concat(e,".").concat(String(n));if(Qt[i])return Qt[i].call(t);var o=Kt(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(Qt[i]=s,s.call(t)):t[n]}var tn={};function nn(e,t,n){var r="".concat(e,".").concat(String(n));if(tn[r])return tn[r].bind(t);var i=Kt(e)[n];return"function"!=typeof i?t[n]:(tn[r]=i,i.bind(t))}var rn={childNodes:function(e){return en("Node",e,"childNodes")},parentNode:function(e){return en("Node",e,"parentNode")},parentElement:function(e){return en("Node",e,"parentElement")},textContent:function(e){return en("Node",e,"textContent")},contains:function(e,t){return nn("Node",e,"contains")(t)},getRootNode:function(e){return nn("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?en("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?en("Element",e,"shadowRoot"):null},querySelector:function(e,t){return en("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return en("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Kt("MutationObserver").constructor}};class on{constructor(){zt(this,"idNodeMap",new Map),zt(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var n=null==(t=this.getMeta(e))?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function sn(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&sn(rn.parentNode(e),t,n);for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return!!n&&sn(rn.parentNode(e),t,n)}class an{constructor(){__publicField22(this,"parentElement",null),__publicField22(this,"parentNode",null),__publicField22(this,"ownerDocument"),__publicField22(this,"firstChild",null),__publicField22(this,"lastChild",null),__publicField22(this,"previousSibling",null),__publicField22(this,"nextSibling",null),__publicField22(this,"ELEMENT_NODE",1),__publicField22(this,"TEXT_NODE",3),__publicField22(this,"nodeType"),__publicField22(this,"nodeName"),__publicField22(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof an))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}var ln={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},cn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},un={};function dn(e){if(un[e])return un[e];var t=globalThis[e],n=t.prototype,r=e in ln?ln[e]:void 0,i=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),o=e in cn?cn[e]:void 0,s=Boolean(o&&o.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(i&&s)return un[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var l=a.contentWindow;if(!l)return t.prototype;var c=l[e].prototype;return document.body.removeChild(a),c?un[e]=c:n}catch(e){return n}}var hn={};function pn(e,t,n){var r,i="".concat(e,".").concat(String(n));if(hn[i])return hn[i].call(t);var o=dn(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(hn[i]=s,s.call(t)):t[n]}var vn={};function gn(e,t,n){var r="".concat(e,".").concat(String(n));if(vn[r])return vn[r].bind(t);var i=dn(e)[n];return"function"!=typeof i?t[n]:(vn[r]=i,i.bind(t))}var fn={childNodes:function(e){return pn("Node",e,"childNodes")},parentNode:function(e){return pn("Node",e,"parentNode")},parentElement:function(e){return pn("Node",e,"parentElement")},textContent:function(e){return pn("Node",e,"textContent")},contains:function(e,t){return gn("Node",e,"contains")(t)},getRootNode:function(e){return gn("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?pn("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?pn("Element",e,"shadowRoot"):null},querySelector:function(e,t){return pn("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return pn("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return dn("MutationObserver").constructor}};var mn="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.",_n={map:{},getId:()=>(console.error(mn),-1),getNode:()=>(console.error(mn),null),removeNodeFromMap(){console.error(mn)},has:()=>(console.error(mn),!1),reset(){console.error(mn)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(_n=new Proxy(_n,{get:(e,t,n)=>("map"===t&&console.error(mn),Reflect.get(e,t,n))}));var yn=Date.now;function bn(e){return e?e.nodeType===e.ELEMENT_NODE?e:fn.parentElement(e):null}/[1-9][0-9]{12}/.test(Date.now().toString())||(yn=()=>(new Date).getTime());function wn(e){var t,n=null;return"getRootNode"in e&&(null==(t=fn.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&fn.host(fn.getRootNode(e))&&(n=fn.host(fn.getRootNode(e))),n}function Sn(e){for(var t,n=e;t=wn(n);)n=t;return n}function Cn(e){var t=e.ownerDocument;if(!t)return!1;var n=Sn(e);return fn.contains(t,n)}for(var In=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){Ut(this,"id",1),Ut(this,"styleIDMap",new WeakMap),Ut(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n);var n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return _n},closestElementOfNode:bn,getBaseDimension:function e(t,n){var r,i,o=null==(i=null==(r=t.ownerDocument)?void 0:r.defaultView)?void 0:i.frameElement;if(!o||o===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};var s=o.getBoundingClientRect(),a=e(o,n),l=s.height/o.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}},getNestedRule:function e(t,n){var r=t[n[0]];return 1===n.length?r:e(r.cssRules[n[1]].cssRules,n.slice(2))},getPositionsAndIndex:function(e){var t=[...e],n=t.pop();return{positions:t,index:n}},getRootShadowHost:Sn,getShadowHost:wn,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,n,r,i,o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=fn.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(r=fn.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(e){return!!e&&(e instanceof an&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(fn.shadowRoot(e)))},hookSetter:function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window,s=o.Object.getOwnPropertyDescriptor(t,n);return o.Object.defineProperty(t,n,i?r:{set(e){setTimeout((()=>{r.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,n,s||{},!0)},inDom:function(e){var t=e.ownerDocument;return!!t&&(fn.contains(t,e)||Cn(e))},isAncestorRemoved:function e(t,n){if(i=(r=t)&&"host"in r&&"mode"in r&&rn.host(r)||null,Boolean(i&&"shadowRoot"in i&&rn.shadowRoot(i)===r))return!1;var r,i,o=n.getId(t);if(!n.has(o))return!0;var s=fn.parentNode(t);return(!s||s.nodeType!==t.DOCUMENT_NODE)&&(!s||e(s,n))},isBlocked:function(e,t,n,r){if(!e)return!1;var i=bn(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(sn(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1},isIgnored:function(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)},isSerialized:function(e,t){return-1!==t.getId(e)},isSerializedIframe:function(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))},isSerializedStylesheet:function(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))},iterateResolveTree:function e(t,n){n(t.value);for(var r=t.children.length-1;r>=0;r--)e(t.children[r],n)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return yn},on:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)},patch:function(e,t,n){try{if(!(t in e))return()=>{};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,()=>{e[t]=r}}catch(e){return()=>{}}},polyfill:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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)},queueToResolveTrees:function(e){var t={},n=(e,n)=>{var r={value:e,parent:n,children:[]};return t[e.node.id]=r,r},r=[];for(var i of e){var{nextId:o,parentId:s}=i;if(o&&o in t){var a=t[o];if(a.parent){var l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,n(i,a.parent))}else{var c=r.indexOf(a);r.splice(c,0,n(i,null))}}else if(s in t){var u=t[s];u.children.push(n(i,u))}else r.push(n(i,null))}return r},shadowHostInDom:Cn,throttle:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,i=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var l=Date.now();i||!1!==n.leading||(i=l);var c=t-(l-i),u=this;c<=0||c>t?(r&&(clearTimeout(r),r=null),i=l,e.apply(u,s)):r||!1===n.trailing||(r=setTimeout((()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(u,s)}),c))}},uniqueTextMutations:function(e){for(var t=new Set,n=[],r=e.length;r--;){var i=e[r];t.has(i.id)||(n.push(i),t.add(i.id))}return n}},Symbol.toStringTag,{value:"Module"})),kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En="undefined"==typeof Uint8Array?[]:new Uint8Array(256),xn=0;xn<64;xn++)En[kn.charCodeAt(xn)]=xn;var Tn;"undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0))))("KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=")],{type:"text/javascript;charset=utf-8"});try{if(2!==Array.from([1],(e=>2*e))[0]){var Mn=document.createElement("iframe");document.body.appendChild(Mn),Array.from=(null==($t=Mn.contentWindow)?void 0:$t.Array.from)||Array.from,document.body.removeChild(Mn)}}catch(e){console.debug("Unable to override Array.from",e)}new on,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Tn||(Tn={}));class Rn{constructor(e){Zt(this,"fileName"),Zt(this,"functionName"),Zt(this,"lineNumber"),Zt(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?"".concat(this.functionName," (").concat(this.fileName,":").concat(e,":").concat(t,")"):"".concat(this.fileName,":").concat(e,":").concat(t)}}var An=/(^|@)\S+:\d+/,Nn=/^\s*at .*(\S+:\d+|\(native\))/m,Fn=/^(eval@)?(\[native code])?$/,On={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Nn)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},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(Nn)}),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,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Rn({functionName:o,fileName:s,lineNumber:i[1],columnNumber:i[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Fn)}),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 Rn({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Rn({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 s=t.exec(n[i]);s&&r.push(new Rn({fileName:s[2],lineNumber:parseFloat(s[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 s=t.exec(n[i]);s&&r.push(new Rn({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(An)&&!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 Rn({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Ln(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 s=r.children[o];s.localName&&s.localName.toLowerCase&&s.localName.toLowerCase()===n&&i.push(s)}i.length>1&&(n+=":eq(".concat(i.indexOf(e),")")),t=n+(t?">"+t:""),e=r}return t}function Pn(e){return"[object Object]"===Object.prototype.toString.call(e)}function Dn(e,t){if(0===t)return!0;var n=Object.keys(e);for(var r of n)if(Pn(e[r])&&Dn(e[r],t-1))return!0;return!1}function Bn(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(void 0===t)return"undefined";if(function(e){if(Pn(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Pn(e)&&Dn(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("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var s={};for(var a in t){var l=t[a];Array.isArray(l)?s[a]=Ln(l.length?l[0]:null):s[a]=l}return s}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 Hn={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 qn(e,t,n){var r,i=n?Object.assign({},Hn,n):Hn,o=i.logger;if(!o)return()=>{};r="string"==typeof o?t[o]:o;var s=0,a=!1,l=[];if(i.level.includes("error")){var c=t=>{var n=t.message,r=t.error,o=On.parse(r).map((e=>e.toString())),s=[Bn(n,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",c),l.push((()=>{t.removeEventListener("error",c)}));var u=t=>{var n,r;t.reason instanceof Error?(n=t.reason,r=[Bn("Uncaught (in promise) ".concat(n.name,": ").concat(n.message),i.stringifyOptions)]):(n=new Error,r=[Bn("Uncaught (in promise)",i.stringifyOptions),Bn(t.reason,i.stringifyOptions)]);var o=On.parse(n).map((e=>e.toString()));e({level:"error",trace:o,payload:r})};t.addEventListener("unhandledrejection",u),l.push((()=>{t.removeEventListener("unhandledrejection",u)}))}for(var d of i.level)l.push(h(r,d));return()=>{l.forEach((e=>e()))};function h(t,n){var r=this;return t[n]?In.patch(t,n,(t=>function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];if(t.apply(r,l),!("assert"===n&&l[0]||a)){a=!0;try{var u=On.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===n?l.slice(1):l).map((e=>Bn(e,i.stringifyOptions)));++s<i.lengthThreshold?e({level:n,trace:u,payload:d}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Bn("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})):()=>{}}}var Wn=e=>({name:"rrweb/console@1",observer:qn,options:e}),$n={DEBUG:!1,LIB_VERSION:"1.187.2"},Vn="undefined"!=typeof window?window:void 0,Zn="undefined"!=typeof globalThis?globalThis:Vn,Gn=Array.prototype,Un=Gn.forEach,jn=Gn.indexOf,zn=null==Zn?void 0:Zn.navigator,Yn=null==Zn?void 0:Zn.document,Xn=null==Zn?void 0:Zn.location,Jn=null==Zn?void 0:Zn.fetch,Kn=null!=Zn&&Zn.XMLHttpRequest&&"withCredentials"in new Zn.XMLHttpRequest?Zn.XMLHttpRequest:void 0,Qn=null==Zn?void 0:Zn.AbortController,er=null==zn?void 0:zn.userAgent,tr=null!=Vn?Vn:{},nr="[PostHog.js]",rr={_log:function(e){if(Vn&&($n.DEBUG||tr.POSTHOG_DEBUG)&&!Fr(Vn.console)&&Vn.console){for(var t=("__rrweb_original__"in Vn.console[e]?Vn.console[e].__rrweb_original__:Vn.console[e]),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t(nr,...r)}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];rr._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];rr._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];rr._log("error",...t)},critical:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.error(nr,...t)},uninitializedWarning:e=>{rr.error("You must initialize PostHog before calling ".concat(e))}},ir={},or=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function sr(e,t,n){if(xr(e))if(Un&&e.forEach===Un)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)===ir)return}function ar(e,t,n){if(!Dr(e)){if(xr(e))return sr(e,t,n);if(Wr(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===ir)return}else for(var i in e)if(kr.call(e,i)&&t.call(n,e[i],i)===ir)return}}var lr=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 sr(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e};function cr(e,t){return-1!==e.indexOf(t)}function ur(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 dr=function(e){try{return e()}catch(e){return}},hr=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){rr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),rr.critical(e)}}},pr=function(e){var t={};return ar(e,(function(e,n){Or(e)&&e.length>0&&(t[n]=e)})),t},vr=function(e){return e.replace(/^\$/,"")};function gr(e,t){return n=e,r=e=>Or(e)&&!Pr(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),xr(t)?(o=[],sr(t,(t=>{o.push(e(t))}))):(o={},ar(t,((t,n)=>{i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}var fr=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<r;i++){var s=e.charCodeAt(i),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),Pr(a)||(n>t&&(o+=e.substring(t,n)),o+=a,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},mr=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,o){if(t)if(t.addEventListener&&!i)t.addEventListener(n,r,!!o);else{var s="on"+n,a=t[s];t[s]=function(t,n,r){return function(i){if(i=i||e(null==Vn?void 0:Vn.event)){var o,s=!0;Tr(r)&&(o=r(i));var a=n.call(t,i);return!1!==o&&!1!==a||(s=!1),s}}}(t,r,a)}else rr.error("No valid element provided to register_event")}}();function _r(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}var yr,br="$copy_autocapture",wr=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(yr||(yr={}));var Sr=["fatal","error","warning","log","info","debug"],Cr=Array.isArray,Ir=Object.prototype,kr=Ir.hasOwnProperty,Er=Ir.toString,xr=Cr||function(e){return"[object Array]"===Er.call(e)},Tr=e=>"function"==typeof e,Mr=e=>Tr(e)&&-1!==e.toString().indexOf("[native code]"),Rr=e=>!!Tr(e)&&Object.getOwnPropertyNames(e.prototype||{}).some((e=>e.indexOf("__zone"))),Ar=e=>e===Object(e)&&!xr(e),Nr=e=>{if(Ar(e)){for(var t in e)if(kr.call(e,t))return!1;return!0}return!1},Fr=e=>void 0===e,Or=e=>"[object String]"==Er.call(e),Lr=e=>Or(e)&&0===e.trim().length,Pr=e=>null===e,Dr=e=>Fr(e)||Pr(e),Br=e=>"[object Number]"==Er.call(e),Hr=e=>"[object Boolean]"===Er.call(e),qr=e=>e instanceof Document,Wr=e=>e instanceof FormData,$r=e=>cr(wr,e),Vr=["localhost","127.0.0.1"],Zr=e=>{var t=null==Yn?void 0:Yn.createElement("a");return Fr(t)?null:(t.href=e,t)},Gr=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},Ur=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return ar(e,(function(e,r){Fr(e)||Fr(r)||"undefined"===r||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t)})),i.join(r)},jr=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(!xr(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(e){rr.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},zr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Yr="$people_distinct_id",Xr="__alias",Jr="__timers",Kr="$autocapture_disabled_server_side",Qr="$heatmaps_enabled_server_side",ei="$exception_capture_enabled_server_side",ti="$web_vitals_enabled_server_side",ni="$dead_clicks_enabled_server_side",ri="$web_vitals_allowed_metrics",ii="$session_recording_enabled_server_side",oi="$console_log_recording_enabled_server_side",si="$session_recording_network_payload_capture",ai="$session_recording_canvas_recording",li="$replay_sample_rate",ci="$replay_minimum_duration",ui="$sesid",di="$session_is_sampled",hi="$session_recording_url_trigger_activated_session",pi="$session_recording_event_trigger_activated_session",vi="$enabled_feature_flags",gi="$early_access_features",fi="$stored_person_properties",mi="$stored_group_properties",_i="$surveys",yi="$surveys_activated",bi="$flag_call_reported",wi="$user_state",Si="$client_session_props",Ci="$capture_rate_limit",Ii="$initial_campaign_params",ki="$initial_referrer_info",Ei="$initial_person_info",xi="$epp",Ti="__POSTHOG_TOOLBAR__",Mi=[Yr,Xr,"__cmpns",Jr,ii,Qr,ui,vi,wi,gi,mi,fi,_i,bi,Si,Ci,Ii,ki,xi];function Ri(e){var t;return e.id===Ti||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function Ai(e){return!!e&&1===e.nodeType}function Ni(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Fi(e){return!!e&&3===e.nodeType}function Oi(e){return!!e&&11===e.nodeType}function Li(e){return e?or(e).split(/\s+/):[]}function Pi(e){var t=null==Vn?void 0:Vn.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Di(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Li(t)}function Bi(e){return Dr(e)?null:or(e).split(/(\s+)/).filter((e=>Ki(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Hi(e){var t="";return Zi(e)&&!Gi(e)&&e.childNodes&&e.childNodes.length&&ar(e.childNodes,(function(e){var n;Fi(e)&&e.textContent&&(t+=null!==(n=Bi(e.textContent))&&void 0!==n?n:"")})),or(t)}function qi(e){return Fr(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Wi=["a","button","form","input","select","textarea","label"];function $i(e){var t=e.parentNode;return!(!t||!Ai(t))&&t}function Vi(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(!Vn||!e||Ni(e,"html")||!Ai(e))return!1;if(null!=n&&n.url_allowlist&&!Pi(n.url_allowlist))return!1;if(null!=n&&n.url_ignorelist&&Pi(n.url_ignorelist))return!1;if(null!=n&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some((e=>t.type===e)))return!1}for(var s=!1,a=[e],l=!0,c=e;c.parentNode&&!Ni(c,"body");)if(Oi(c.parentNode))a.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=$i(c)))break;if(r||Wi.indexOf(l.tagName.toLowerCase())>-1)s=!0;else{var u=Vn.getComputedStyle(l);u&&"pointer"===u.getPropertyValue("cursor")&&(s=!0)}a.push(l),c=l}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(Fr(n))return!0;var r=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var i of e){var o=r(i);if("object"==typeof o)return o.v}return!1}(a,n))return!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(Fr(n))return!0;var r=function(e){if(n.some((t=>e.matches(t))))return{v:!0}};for(var i of e){var o=r(i);if("object"==typeof o)return o.v}return!1}(a,n))return!1;var d=Vn.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){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 s?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(Wi.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}function Zi(e){for(var t=e;t.parentNode&&!Ni(t,"body");t=t.parentNode){var n=Di(t);if(cr(n,"ph-sensitive")||cr(n,"ph-no-capture"))return!1}if(cr(Di(e),"ph-include"))return!0;var r=e.type||"";if(Or(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if(Or(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 Gi(e){return!!(Ni(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ni(e,"select")||Ni(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ui="(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})",ji=new RegExp("^(?:".concat(Ui,")$")),zi=new RegExp(Ui),Yi="\\d{3}-?\\d{2}-?\\d{4}",Xi=new RegExp("^(".concat(Yi,")$")),Ji=new RegExp("(".concat(Yi,")"));function Ki(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Dr(e))return!1;if(Or(e)){if(e=or(e),(t?ji:zi).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Xi:Ji).test(e))return!1}return!0}function Qi(e){var t=Hi(e);return Ki(t="".concat(t," ").concat(eo(e)).trim())?t:""}function eo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ar(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=Hi(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(eo(e)).trim())}catch(e){rr.error(e)}})),t}function to(e){return function(e){var n=e.map((e=>{var n,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var o of(e.attr_class.sort(),e.attr_class))i+=".".concat(o.replace(/"/g,""));var s=t(t(t(t({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(n=e.nth_child)&&void 0!==n?n:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),a={};return ur(s).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return a[no(t.toString())]=no(n.toString())})),i+=":",i+=ur(s).map((e=>{var[t,n]=e;return"".concat(t,'="').concat(n,'"')})).join("")}));return n.join(";")}(function(e){return e.map((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:ro(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ur(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,n]=e;return r.attributes[t]=n})),r}))}(e))}function no(e){return e.replace(/"|\\"/g,'\\"')}function ro(e){var t=e.attr__class;return t?xr(t)?t:Li(t):void 0}var io="[SessionRecording]",oo="redacted",so={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ao=["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"],lo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],co=["/s/","/e/","/i/"];function uo(e,t,n,r){if(Dr(e))return e;var i=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Or(i)&&(i=parseInt(i)),i>n?io+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function ho(e,t){if(Dr(e))return e;var n=e;return Ki(n,!1)||(n=io+" "+t+" body "+oo),ar(lo,(e=>{var r,i;null!==(r=n)&&void 0!==r&&r.length&&-1!==(null===(i=n)||void 0===i?void 0:i.indexOf(e))&&(n=io+" "+t+" body "+oo+" as might contain: "+e)})),n}var po=(e,n)=>{var r,i,o,s={payloadSizeLimitBytes:so.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...so.performanceEntryTypeToObserve],payloadHostDenyList:[...n.payloadHostDenyList||[],...so.payloadHostDenyList]},a=!1!==e.session_recording.recordHeaders&&n.recordHeaders,l=!1!==e.session_recording.recordBody&&n.recordBody,c=!1!==e.capture_performance&&n.recordPerformance,u=(r=s,o=Math.min(1e6,null!==(i=r.payloadSizeLimitBytes)&&void 0!==i?i:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=uo(e.requestBody,e.requestHeaders,o,"Request")),null!=e&&e.responseBody&&(e.responseBody=uo(e.responseBody,e.responseHeaders,o,"Response")),e)),d=e=>{return u((e=>{var t=Zr(e.name);if(!(t&&t.pathname&&co.some((e=>0===t.pathname.indexOf(e)))))return e})((n=(t=e).requestHeaders,Dr(n)||ar(Object.keys(null!=n?n:{}),(e=>{ao.includes(e.toLowerCase())&&(n[e]=oo)})),t)));var t,n},h=Tr(e.session_recording.maskNetworkRequestFn);return h&&Tr(e.session_recording.maskCapturedNetworkRequestFn)&&rr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=n=>{var r=e.session_recording.maskNetworkRequestFn({url:n.name});return t(t({},n),{},{name:null==r?void 0:r.url})}),s.maskRequestFn=Tr(e.session_recording.maskCapturedNetworkRequestFn)?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}:e=>function(e){if(!Fr(e))return e.requestBody=ho(e.requestBody,"Request"),e.responseBody=ho(e.responseBody,"Response"),e}(d(e)),t(t(t({},so),s),{},{recordHeaders:a,recordBody:l,recordPerformance:c,recordInitialRequests:c})};function vo(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return Tr(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}function go(e,t){var n,r=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),i={hostname:r,isHostDenied:!1};if(null===(n=t.payloadHostDenyList)||void 0===n||!n.length||null==r||!r.trim().length)return i;for(var o of t.payloadHostDenyList)if(r.endsWith(o))return{hostname:r,isHostDenied:!0};return i}var fo=e=>"navigation"===e.entryType,mo=e=>"resource"===e.entryType;function _o(e,t,n){if(n.recordInitialRequests){var r=t.performance.getEntries().filter((e=>fo(e)||mo(e)&&n.initiatorTypes.includes(e.initiatorType)));e({requests:r.flatMap((e=>ko({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var i=new t.PerformanceObserver((t=>{var r=t.getEntries().filter((e=>fo(e)||mo(e)&&n.initiatorTypes.includes(e.initiatorType)&&(e=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:r.flatMap((e=>ko({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),o=PerformanceObserver.supportedEntryTypes.filter((e=>n.performanceEntryTypeToObserve.includes(e)));return i.observe({entryTypes:o}),()=>{i.disconnect()}}function yo(e,t){return!!t&&(Hr(t)||t[e])}function bo(e){var{type:t,recordBody:n,headers:r}=e;function i(e){var t=Object.keys(r).find((e=>"content-type"===e.toLowerCase())),n=t&&r[t];return e.some((e=>null==n?void 0:n.includes(e)))}if(!n)return!1;if(Hr(n))return!0;if(xr(n))return i(n);var o=n[t];return Hr(o)?o:i(o)}function wo(e,t,n,r,i){return So.apply(this,arguments)}function So(){return So=r((function*(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(o>10)return rr.warn("Failed to get performance entry for request",{url:n,initiatorType:t}),null;var s=function(e,t){for(var n=e.length-1;n>=0;n-=1)if(t(e[n]))return e[n]}(e.performance.getEntriesByName(n),(e=>mo(e)&&e.initiatorType===t&&(Fr(r)||e.startTime>=r)&&(Fr(i)||e.startTime<=i)));return s||(yield new Promise((e=>setTimeout(e,50*o))),wo(e,t,n,r,i,o+1))})),So.apply(this,arguments)}function Co(e){var{body:t,options:n,url:r}=e;if(Dr(t))return null;var{hostname:i,isHostDenied:o}=go(r,n);if(o)return i+" is in deny list";if(Or(t))return t;if(qr(t))return t.textContent;if(Wr(t))return Ur(t);if(Ar(t))try{return JSON.stringify(t)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}var Io=e=>!Pr(e)&&("navigation"===e.entryType||"resource"===e.entryType);function ko(e){var{entry:n,method:r,status:i,networkRequest:o,isInitial:s,start:a,end:l,url:c,initiatorType:u}=e;a=n?n.startTime:a,l=n?n.responseEnd:l;var d=Math.floor(Date.now()-performance.now()),h=Math.floor(d+(a||0)),p=[t(t({},n?n.toJSON():{name:c}),{},{startTime:Fr(a)?void 0:Math.round(a),endTime:Fr(l)?void 0:Math.round(l),timeOrigin:d,timestamp:h,method:r,initiatorType:u||(n?n.initiatorType:void 0),status:i,requestHeaders:o.requestHeaders,requestBody:o.requestBody,responseHeaders:o.responseHeaders,responseBody:o.responseBody,isInitial:s})];if(Io(n))for(var v of n.serverTiming||[])p.push({timeOrigin:d,timestamp:h,startTime:Math.round(n.startTime),name:v.name,duration:v.duration,entryType:"serverTiming"});return p}var Eo=["video/","audio/"];function xo(e){return new Promise(((t,n)=>{var r=setTimeout((()=>t("[SessionReplay] Timeout while trying to read body")),500);try{e.clone().text().then((e=>t(e)),(e=>n(e))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t("[SessionReplay] Failed to read body")}}))}function To(){return To=r((function*(e){var{r:t,options:n,url:r}=e,{hostname:i,isHostDenied:o}=go(r,n);return o?Promise.resolve(i+" is in deny list"):xo(t)})),To.apply(this,arguments)}function Mo(){return Mo=r((function*(e){var{r:t,options:n,url:r}=e,i=function(e){var t,{r:n,options:r,url:i}=e;if("chunked"===n.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var o=null===(t=n.headers.get("Content-Type"))||void 0===t?void 0:t.toLowerCase(),s=Eo.some((e=>null==o?void 0:o.startsWith(e)));if(o&&s)return"Content-Type ".concat(o," is not supported");var{hostname:a,isHostDenied:l}=go(i,r);return l?a+" is in deny list":null}({r:t,options:n,url:r});return Pr(i)?xo(t):Promise.resolve(i)})),Mo.apply(this,arguments)}function Ro(e,t,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};var i=yo("request",n.recordHeaders),o=yo("response",n.recordHeaders),s=vo(t,"fetch",(s=>function(){var a=r((function*(r,a){var l,c,u,d=new Request(r,a),h={};try{var p={};d.headers.forEach(((e,t)=>{p[t]=e})),i&&(h.requestHeaders=p),bo({type:"request",headers:p,url:r,recordBody:n.recordBody})&&(h.requestBody=yield function(e){return To.apply(this,arguments)}({r:d,options:n,url:r})),c=t.performance.now(),l=yield s(d),u=t.performance.now();var v={};return l.headers.forEach(((e,t)=>{v[t]=e})),o&&(h.responseHeaders=v),bo({type:"response",headers:v,url:r,recordBody:n.recordBody})&&(h.responseBody=yield function(e){return Mo.apply(this,arguments)}({r:l,options:n,url:r})),l}finally{wo(t,"fetch",d.url,c,u).then((t=>{var n,r=ko({entry:t,method:d.method,status:null===(n=l)||void 0===n?void 0:n.status,networkRequest:h,start:c,end:u,url:d.url,initiatorType:"fetch"});e({requests:r})})).catch((()=>{}))}}));return function(e,t){return a.apply(this,arguments)}}()));return()=>{s()}}var Ao=null;function No(e,n,r){if(!("performance"in n))return()=>{};if(Ao)return rr.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},so,r):so,o=n=>{var r=[];n.requests.forEach((e=>{var t=i.maskRequestFn(e);t&&r.push(t)})),r.length>0&&e(t(t({},n),{},{requests:r}))},s=_o(o,n,i),a=()=>{},l=()=>{};return(i.recordHeaders||i.recordBody)&&(a=function(e,t,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};var r=yo("request",n.recordHeaders),i=yo("response",n.recordHeaders),o=vo(t.XMLHttpRequest.prototype,"open",(o=>function(s,a){var l,c,u=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],d=arguments.length>3?arguments[3]:void 0,h=arguments.length>4?arguments[4]:void 0,p=this,v=new Request(a),g={},f={},m=p.setRequestHeader.bind(p);p.setRequestHeader=(e,t)=>(f[e]=t,m(e,t)),r&&(g.requestHeaders=f);var _=p.send.bind(p);p.send=e=>(bo({type:"request",headers:f,url:a,recordBody:n.recordBody})&&(g.requestBody=Co({body:e,options:n,url:a})),l=t.performance.now(),_(e)),p.addEventListener("readystatechange",(()=>{if(p.readyState===p.DONE){c=t.performance.now();var r={};p.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{var t=e.split(": "),n=t.shift(),i=t.join(": ");n&&(r[n]=i)})),i&&(g.responseHeaders=r),bo({type:"response",headers:r,url:a,recordBody:n.recordBody})&&(g.responseBody=Co({body:p.response,options:n,url:a})),wo(t,"xmlhttprequest",v.url,l,c).then((t=>{var n=ko({entry:t,method:s,status:null==p?void 0:p.status,networkRequest:g,start:l,end:c,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:n})})).catch((()=>{}))}})),o.call(p,s,a,u,d,h)}));return()=>{o()}}(o,n,i),l=Ro(o,n,i)),Ao=()=>{s(),a(),l()}}var Fo,Oo,Lo,Po=e=>({name:"rrweb/network@1",observer:No,options:e});tr.__PosthogExtensions__=tr.__PosthogExtensions__||{},tr.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Wn,getRecordNetworkPlugin:Po},tr.__PosthogExtensions__.rrweb={record:Wt,version:"v2"},tr.rrweb={record:Wt,version:"v2"},tr.rrwebConsoleRecord={getRecordConsolePlugin:Wn},tr.getRecordNetworkPlugin=Po,function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(Fo||(Fo={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(Oo||(Oo={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(Lo||(Lo={}));var Do,Bo,Ho,qo,Wo,$o,Vo,Zo,Go={},Uo=[],jo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zo=Array.isArray;function Yo(e,t){for(var n in t)e[n]=t[n];return e}function Xo(e){var t=e.parentNode;t&&t.removeChild(e)}function Jo(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Do.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Ko(e,s,r,i,null)}function Ko(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++Ho:i,__i:-1,__u:0};return null==i&&null!=Bo.vnode&&Bo.vnode(o),o}function Qo(e){return e.children}function es(e,t){this.props=e,this.context=t}function ts(e,t){if(null==t)return e.__?ts(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?ts(e):null}function ns(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return ns(e)}}function rs(e){(!e.__d&&(e.__d=!0)&&qo.push(e)&&!is.__r++||Wo!==Bo.debounceRendering)&&((Wo=Bo.debounceRendering)||$o)(is)}function is(){var e,t,n,r,i,o,s,a,l;for(qo.sort(Vo);e=qo.shift();)e.__d&&(t=qo.length,r=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=Yo({},i)).__v=i.__v+1,Bo.vnode&&Bo.vnode(r),hs(s,r,i,n.__n,void 0!==s.ownerSVGElement,32&i.__u?[o]:null,a,null==o?ts(i):o,!!(32&i.__u),l),r.__.__k[r.__i]=r,ps(a,r,l),r.__e!=o&&ns(r)),qo.length>t&&qo.sort(Vo));is.__r=0}function os(e,t,n,r,i,o,s,a,l,c,u){var d,h,p,v,g,f=r&&r.__k||Uo,m=t.length;for(n.__d=l,function(e,t,n){var r,i,o,s,a,l=t.length,c=n.length,u=c,d=0;for(e.__k=[],r=0;r<l;r++)null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?Ko(null,i,null,null,i):zo(i)?Ko(Qo,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?Ko(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=as(i,n,s=r+d,u),i.__i=a,o=null,-1!==a&&(u--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&d--,"function"!=typeof i.type&&(i.__u|=65536)):a!==s&&(a===s+1?d++:a>s?u>l-s?d+=a-s:d--:d=a<s&&a==s-1?a-s:0,a!==r+d&&(i.__u|=65536))):(o=n[r])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=ts(o)),gs(o,o,!1),n[r]=null,u--);if(u)for(r=0;r<c;r++)null!=(o=n[r])&&0==(131072&o.__u)&&(o.__e==e.__d&&(e.__d=ts(o)),gs(o,o))}(n,t,f),l=n.__d,d=0;d<m;d++)null!=(p=n.__k[d])&&"boolean"!=typeof p&&"function"!=typeof p&&(h=-1===p.__i?Go:f[p.__i]||Go,p.__i=d,hs(e,p,h,i,o,s,a,l,c,u),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&vs(h.ref,null,p),u.push(p.ref,p.__c||v,p)),null==g&&null!=v&&(g=v),65536&p.__u||h.__k===p.__k?l=ss(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:v&&(l=v.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=g}function ss(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=ss(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function as(e,t,n,r){var i=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return a;a++}}return-1}function ls(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||jo.test(t)?n:n+"px"}function cs(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ls(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||ls(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?ds:us,o)):e.removeEventListener(t,o?ds:us,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function us(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Bo.event?Bo.event(e):e)}function ds(e){return this.l[e.type+!0](Bo.event?Bo.event(e):e)}function hs(e,t,n,r,i,o,s,a,l,c){var u,d,h,p,v,g,f,m,_,y,b,w,S,C,I,k=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(u=Bo.__b)&&u(t);e:if("function"==typeof k)try{if(m=t.props,_=(u=k.contextType)&&r[u.__c],y=u?_?_.props.value:u.__:r,n.__c?f=(d=t.__c=n.__c).__=d.__E:("prototype"in k&&k.prototype.render?t.__c=d=new k(m,y):(t.__c=d=new es(m,y),d.constructor=k,d.render=fs),_&&_.sub(d),d.props=m,d.state||(d.state={}),d.context=y,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=k.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Yo({},d.__s)),Yo(d.__s,k.getDerivedStateFromProps(m,d.__s))),p=d.props,v=d.state,d.__v=t,h)null==k.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==k.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,v,g)}))}if(d.context=y,d.props=m,d.__P=e,d.__e=!1,w=Bo.__r,S=0,"prototype"in k&&k.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),C=0;C<d._sb.length;C++)d.__h.push(d._sb[C]);d._sb=[]}else do{d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=Yo(Yo({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(g=d.getSnapshotBeforeUpdate(p,v)),os(e,zo(I=null!=u&&u.type===Qo&&null==u.key?u.props.children:u)?I:[I],t,n,r,i,o,s,a,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),f&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),Bo.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a,l){var c,u,d,h,p,v,g,f=n.props,m=t.props,_=t.type;if("svg"===_&&(i=!0),null!=o)for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!_&&(_?p.localName===_:3===p.nodeType)){e=p,o[c]=null;break}if(null==e){if(null===_)return document.createTextNode(m);e=i?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,m.is&&m),o=null,a=!1}if(null===_)f===m||a&&e.data===m||(e.data=m);else{if(o=o&&Do.call(e.childNodes),f=n.props||Go,!a&&null!=o)for(f={},c=0;c<e.attributes.length;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"children"==c||("dangerouslySetInnerHTML"==c?d=p:"key"===c||c in m||cs(e,c,null,p,i));for(c in m)p=m[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?v=p:"checked"==c?g=p:"key"===c||a&&"function"!=typeof p||f[c]===p||cs(e,c,p,f[c],i);if(u)a||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),os(e,zo(h)?h:[h],t,n,r,i&&"foreignObject"!==_,o,s,o?o[0]:n.__k&&ts(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&Xo(o[c]);a||(c="value",void 0!==v&&(v!==e[c]||"progress"===_&&!v||"option"===_&&v!==f[c])&&cs(e,c,v,f[c],!1),c="checked",void 0!==g&&g!==e[c]&&cs(e,c,g,f[c],!1))}return e}(n.__e,t,n,r,i,o,s,l,c);(u=Bo.diffed)&&u(t)}function ps(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)vs(n[r],n[++r],n[++r]);Bo.__c&&Bo.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Bo.__e(e,t.__v)}}))}function vs(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Bo.__e(e,n)}}function gs(e,t,n){var r,i;if(Bo.unmount&&Bo.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||vs(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Bo.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&gs(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||Xo(e.__e),e.__=e.__e=e.__d=void 0}function fs(e,t,n){return this.constructor(e,n)}function ms(e,t,n){var r,i,o,s;Bo.__&&Bo.__(e,t),i=(r="function"==typeof n)?null:t.__k,o=[],s=[],hs(t,e=(!r&&n||t).__k=Jo(Qo,null,[e]),i||Go,Go,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Do.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),ps(o,e,s)}function _s(e,t,n){var r,i,o,s,a=Yo({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==o?r=t[o]:"ref"==o?i=t[o]:a[o]=void 0===t[o]&&void 0!==s?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?Do.call(arguments,2):n),Ko(e.type,a,r||e.key,i||e.ref,null)}Do=Uo.slice,Bo={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},Ho=0,es.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Yo({},this.state),"function"==typeof e&&(e=e(Yo({},n),this.props)),e&&Yo(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),rs(this))},es.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),rs(this))},es.prototype.render=Qo,qo=[],$o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vo=function(e,t){return e.__v.__b-t.__v.__b},is.__r=0,Zo=0;var ys=Vn,bs=Yn,ws="seenSurvey_",Ss=e=>'\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n text-align: left;\n max-width: '.concat(parseInt((null==e?void 0:e.maxWidth)||"300"),"px;\n width: 100%;\n z-index: ").concat(parseInt((null==e?void 0:e.zIndex)||"99999"),";\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n border-bottom: 0px;\n ").concat({left:"left: 30px;",right:"right: 30px;",center:"\n left: 50%;\n transform: translateX(-50%);\n "}[(null==e?void 0:e.position)||"right"]||"right: 30px;","\n flex-direction: column;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",';\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n \n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: 0.6;\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ').concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ").concat((null==e?void 0:e.submitButtonColor)||"black"," !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n text-decoration: none;\n backgroundColor: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n color: ").concat(Is((null==e?void 0:e.backgroundColor)||"#eeeded"),";\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ");function Cs(e){if("#"===e[0]){var t=e.replace(/^#/,"");return"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")"}return"rgb(255, 255, 255)"}function Is(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Es;"#"===t[0]&&(e=Cs(t)),t.startsWith("rgb")&&(e=t);var n=function(e){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()]}(t);if(n&&(e=Cs(n)),!e)return"black";var r=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(r){var i=parseInt(r[1]),o=parseInt(r[2]),s=parseInt(r[3]);return Math.sqrt(i*i*.299+o*o*.587+s*s*.114)>127.5?"black":"white"}return"black"}var ks={backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},Es="#eeeded",xs=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;i&&(localStorage.setItem(Fs(r),"true"),i.capture("survey sent",t(t({$survey_name:r.name,$survey_id:r.id,$survey_iteration:r.current_iteration,$survey_iteration_start_date:r.current_iteration_start_date,$survey_questions:r.questions.map((e=>e.question)),sessionRecordingUrl:null===(e=i.get_session_replay_url)||void 0===e?void 0:e.call(i)},n),{},{$set:{[Os(r,"responded")]:!0}})),ys.dispatchEvent(new Event("PHSurveySent")))},Ts=(e,t,n)=>{var r;!n&&t&&(t.capture("survey dismissed",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(r=t.get_session_replay_url)||void 0===r?void 0:r.call(t),$set:{[Os(e,"dismissed")]:!0}}),localStorage.setItem(Fs(e),"true"),ys.dispatchEvent(new Event("PHSurveyClosed")))},Ms=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Rs=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n]))?t.reverse():t,As=e=>(e.questions.forEach(((e,t)=>{e.originalQuestionIndex=t})),e.appearance&&e.appearance.shuffleQuestions?Rs(e.questions,Ms(e.questions)):e.questions),Ns=e=>{var t,n;return!(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||!n.repeatedActivation||!(e=>{var t,n,r,i,o,s;return null!=(null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(r=n.values)||void 0===r?void 0:r.length)&&(null===(i=e.conditions)||void 0===i||null===(o=i.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0})(e))},Fs=e=>{var t="".concat(ws).concat(e.id);return e.current_iteration&&e.current_iteration>0&&(t="".concat(ws).concat(e.id,"_").concat(e.current_iteration)),t},Os=(e,t)=>{var n="$survey_".concat(t,"/").concat(e.id);return e.current_iteration&&e.current_iteration>0&&(n="$survey_".concat(t,"/").concat(e.id,"/").concat(e.current_iteration)),n},Ls=function(e,t){var n={__c:t="__cC"+Zo++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,rs(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0}),Ps=e=>{var{component:t,children:n,renderAsHtml:r,style:i}=e;return _s(t,r?{dangerouslySetInnerHTML:{__html:n},style:i}:{children:n,style:i})},Ds=Yn;var Bs,Hs,qs,Ws,$s=0,Vs=[],Zs=[],Gs=Bo.__b,Us=Bo.__r,js=Bo.diffed,zs=Bo.__c,Ys=Bo.unmount;function Xs(e,t){Bo.__h&&Bo.__h(Hs,e,$s||t),$s=0;var n=Hs.__H||(Hs.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Zs}),n.__[e]}function Js(e){return $s=1,function(e,t,n){var r=Xs(Bs++,2);if(r.t=e,!r.__c&&(r.__=[la(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Hs,!Hs.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};Hs.u=!0;var o=Hs.shouldComponentUpdate,s=Hs.componentWillUpdate;Hs.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}s&&s.call(this,e,t,n)},Hs.shouldComponentUpdate=i}return r.__N||r.__}(la,e)}function Ks(e,t){var n=Xs(Bs++,3);!Bo.__s&&aa(n.__H,t)&&(n.__=e,n.i=t,Hs.__H.__h.push(n))}function Qs(e){return $s=5,ea((function(){return{current:e}}),[])}function ea(e,t){var n=Xs(Bs++,7);return aa(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function ta(e){var t=Hs.context[e.__c],n=Xs(Bs++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Hs)),t.props.value):e.__}function na(){for(var e;e=Vs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(oa),e.__H.__h.forEach(sa),e.__H.__h=[]}catch(t){e.__H.__h=[],Bo.__e(t,e.__v)}}Bo.__b=function(e){Hs=null,Gs&&Gs(e)},Bo.__r=function(e){Us&&Us(e),Bs=0;var t=(Hs=e.__c).__H;t&&(qs===Hs?(t.__h=[],Hs.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Zs,e.__N=e.i=void 0}))):(t.__h.forEach(oa),t.__h.forEach(sa),t.__h=[],Bs=0)),qs=Hs},Bo.diffed=function(e){js&&js(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Vs.push(t)&&Ws===Bo.requestAnimationFrame||((Ws=Bo.requestAnimationFrame)||ia)(na)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Zs&&(e.__=e.__V),e.i=void 0,e.__V=Zs}))),qs=Hs=null},Bo.__c=function(e,t){t.some((function(e){try{e.__h.forEach(oa),e.__h=e.__h.filter((function(e){return!e.__||sa(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Bo.__e(n,e.__v)}})),zs&&zs(e,t)},Bo.unmount=function(e){Ys&&Ys(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{oa(e)}catch(e){t=e}})),n.__H=void 0,t&&Bo.__e(t,n.__v))};var ra="function"==typeof requestAnimationFrame;function ia(e){var t,n=function(){clearTimeout(r),ra&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ra&&(t=requestAnimationFrame(n))}function oa(e){var t=Hs,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Hs=t}function sa(e){var t=Hs;e.__c=e.__(),Hs=t}function aa(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function la(e,t){return"function"==typeof t?t(e):t}var ca=0;function ua(e,t,n,r,i,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--ca,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Bo.vnode&&Bo.vnode(c),c}var da=ua("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ua("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),ha=ua("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ua("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),pa=ua("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ua("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),va=ua("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ua("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),ga=ua("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ua("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),fa=ua("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ua("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:"black"})}),ma=ua("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ua("g",{"clip-path":"url(#clip0_2415_6911)",children:[ua("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ua("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ua("g",{mask:"url(#mask0_2415_6911)",children:[ua("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),ua("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),ua("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),ua("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),ua("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),ua("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),ua("defs",{children:ua("clipPath",{id:"clip0_2415_6911",children:ua("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),_a=ua("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ua("path",{d:"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z",fill:"currentColor"})});function ya(){return ua("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",ma]})}function ba(e){var{text:t,submitDisabled:n,appearance:r,onSubmit:i,link:o}=e,{isPreviewMode:s,isPopup:a}=ta(Ls),l=r.submitButtonTextColor||Is(r.submitButtonColor||ks.submitButtonColor);return ua("div",{className:"bottom-section",children:[ua("div",{className:"buttons",children:ua("button",{className:"form-submit",disabled:n&&!s,type:"button",style:a?{color:l}:{},onClick:()=>{s||(o&&(null==Vn||Vn.open(o)),i())},children:t})}),!r.whiteLabel&&ua(ya,{})]})}function wa(e){var{question:t,description:n,descriptionContentType:r,backgroundColor:i,forceDisableHtml:o}=e,{isPopup:s}=ta(Ls);return ua("div",{style:s?{backgroundColor:i||ks.backgroundColor}:{},children:[ua("div",{className:"survey-question",children:t}),n&&Ps({component:Jo("div",{className:"survey-question-description"}),children:n,renderAsHtml:!o&&"text"!==r})]})}function Sa(e){var{onClick:t}=e,{isPreviewMode:n}=ta(Ls);return ua("div",{className:"cancel-btn-wrapper",onClick:t,disabled:n,children:ua("button",{className:"form-cancel",onClick:t,disabled:n,children:fa})})}function Ca(e){var{header:n,description:r,contentType:i,forceDisableHtml:o,appearance:s,onClose:a,styleOverrides:l}=e,c=Is(s.backgroundColor||ks.backgroundColor),{isPopup:u}=ta(Ls);return ua(Qo,{children:ua("div",{className:"thank-you-message",style:t({},l),children:ua("div",{className:"thank-you-message-container",children:[u&&ua(Sa,{onClick:()=>a()}),ua("h3",{className:"thank-you-message-header",style:{color:c},children:n}),r&&Ps({component:Jo("div",{className:"thank-you-message-body"}),children:r,renderAsHtml:!o&&"text"!==i,style:{color:c}}),u&&ua(ba,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>a()})]})})})}function Ia(e){var t,n=Qs(null),[r,i]=Js(null!==(t=e.defaultTextColor)&&void 0!==t?t:"black");return Ks((()=>{if(n.current){var e=function(e){var t=ys.getComputedStyle(e).backgroundColor;if("rgba(0, 0, 0, 0)"===t)return"black";var n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(!n)return"black";var r=parseInt(n[1]),i=parseInt(n[2]),o=parseInt(n[3]);return Math.sqrt(r*r*.299+i*i*.587+o*o*.114)>127.5?"black":"white"}(n.current);i(e)}}),[e.appearance,e.forceUpdate]),{ref:n,textColor:r}}function ka(e){var{question:t,forceDisableHtml:n,appearance:r,onSubmit:i}=e,o=Qs(null),[s,a]=Js("");return ua("div",{ref:o,children:[ua(wa,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,backgroundColor:r.backgroundColor,forceDisableHtml:n}),ua("textarea",{rows:4,placeholder:null==r?void 0:r.placeholder,onInput:e=>a(e.currentTarget.value)}),ua(ba,{text:t.buttonText||"Submit",submitDisabled:!s&&!t.optional,appearance:r,onSubmit:()=>i(s)})]})}function Ea(e){var{question:t,forceDisableHtml:n,appearance:r,onSubmit:i}=e;return ua(Qo,{children:[ua(wa,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n}),ua(ba,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked")})]})}function xa(e){var{question:t,forceDisableHtml:n,displayQuestionIndex:r,appearance:i,onSubmit:o}=e,s=t.scale,a=10===t.scale?0:1,[l,c]=Js(null);return ua(Qo,{children:[ua(wa,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:i.backgroundColor}),ua("div",{className:"rating-section",children:[ua("div",{className:"rating-options",children:["emoji"===t.display&&ua("div",{className:"rating-options-emoji",children:(3===t.scale?Ra:Aa).map(((e,t)=>{var n=t+1===l;return ua("button",{className:"ratings-emoji question-".concat(r,"-rating-").concat(t," ").concat(n?"rating-active":null),value:t+1,type:"button",onClick:()=>{c(t+1)},style:{fill:n?i.ratingButtonActiveColor:i.ratingButtonColor,borderColor:i.borderColor},children:e},t)}))}),"number"===t.display&&ua("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat(".concat(s-a+1,", minmax(0, 1fr))")},children:La(t.scale).map(((e,t)=>ua(Ta,{displayQuestionIndex:r,active:l===e,appearance:i,num:e,setActiveNumber:e=>{c(e)}},t)))})]}),ua("div",{className:"rating-text",children:[ua("div",{children:t.lowerBoundLabel}),ua("div",{children:t.upperBoundLabel})]})]}),ua(ba,{text:t.buttonText||(null==i?void 0:i.submitButtonText)||"Submit",submitDisabled:Pr(l)&&!t.optional,appearance:i,onSubmit:()=>o(l)})]})}function Ta(e){var{num:t,active:n,displayQuestionIndex:r,appearance:i,setActiveNumber:o}=e,{textColor:s,ref:a}=Ia({appearance:i,defaultTextColor:"black",forceUpdate:n});return ua("button",{ref:a,className:"ratings-number question-".concat(r,"-rating-").concat(t," ").concat(n?"rating-active":null),type:"button",onClick:()=>{o(t)},style:{color:s,backgroundColor:n?i.ratingButtonActiveColor:i.ratingButtonColor,borderColor:i.borderColor},children:t})}function Ma(e){var{question:t,forceDisableHtml:n,displayQuestionIndex:r,appearance:i,onSubmit:o}=e,s=Qs(null),a=ea((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,n="";e.hasOpenChoice&&(n=t.pop());var r=Rs(t,Ms(t));return e.hasOpenChoice&&(e.choices.push(n),r.push(n)),r})(t)),[t]),[l,c]=Js(t.type===Oo.MultipleChoice?[]:null),[u,d]=Js(!1),[h,p]=Js(""),v=t.type===Oo.SingleChoice?"radio":"checkbox";return ua("div",{ref:s,children:[ua(wa,{question:t.question,description:t.description,descriptionContentType:t.descriptionContentType,forceDisableHtml:n,backgroundColor:i.backgroundColor}),ua("div",{className:"multiple-choice-options",children:a.map(((e,n)=>{var i="choice-option",o=e,s=e;return t.hasOpenChoice&&n===t.choices.length-1&&(i+=" choice-option-open"),ua("div",{className:i,children:[ua("input",{type:v,id:"surveyQuestion".concat(r,"Choice").concat(n),name:"question".concat(r),value:o,disabled:!o,onInput:()=>t.hasOpenChoice&&n===t.choices.length-1?d(!u):t.type===Oo.SingleChoice?c(o):t.type===Oo.MultipleChoice&&xr(l)?l.includes(o)?c(l.filter((e=>e!==o))):c([...l,o]):void 0}),ua("label",{htmlFor:"surveyQuestion".concat(r,"Choice").concat(n),style:{color:"black"},children:t.hasOpenChoice&&n===t.choices.length-1?ua(Qo,{children:[ua("span",{children:[s,":"]}),ua("input",{type:"text",id:"surveyQuestion".concat(r,"Choice").concat(n,"Open"),name:"question".concat(r),onInput:e=>{var n=e.currentTarget.value;return t.type===Oo.SingleChoice?c(n):t.type===Oo.MultipleChoice&&xr(l)?p(n):void 0}})]}):s}),ua("span",{className:"choice-check",style:{color:"black"},children:_a})]})}))}),ua(ba,{text:t.buttonText||"Submit",submitDisabled:(Pr(l)||xr(l)&&!u&&0===l.length||xr(l)&&u&&!h&&0===l.length&&!t.optional)&&!t.optional,appearance:i,onSubmit:()=>{u&&t.type===Oo.MultipleChoice?xr(l)&&o([...l,h]):o(l)}})]})}var Ra=[pa,ha,da],Aa=[va,pa,ha,da,ga],Na=[1,2,3,4,5],Fa=[1,2,3,4,5,6,7],Oa=[0,1,2,3,4,5,6,7,8,9,10];function La(e){switch(e){case 5:default:return Na;case 7:return Fa;case 10:return Oa}}var Pa=Vn,Da=Yn;class Ba{constructor(e){var t=this;i(this,"canShowNextEventBasedSurvey",(()=>{var e,t=Da.querySelectorAll("div[class^=PostHogSurvey]");return!(t.length>0)||1===(null===(e=t[t.length-1].shadowRoot)||void 0===e?void 0:e.childElementCount)})),i(this,"handlePopoverSurvey",(e=>{var t,n=null===(t=e.conditions)||void 0===t?void 0:t.seenSurveyWaitPeriodInDays,r=localStorage.getItem("lastSeenSurveyDate");if(n&&r){var i=new Date,o=Math.abs(i.getTime()-new Date(r).getTime());if(Math.ceil(o/864e5)<n)return}var s=(e=>!!localStorage.getItem(Fs(e))&&!Ns(e))(e);if(!s){this.addSurveyToFocus(e.id);var a=((e,t,n)=>{var r=bs.createElement("div");r.className="PostHogSurvey".concat(t);var i=r.attachShadow({mode:"open"});if(e){var o=Object.assign(bs.createElement("style"),{innerText:e});i.appendChild(o)}return bs.body.appendChild(r),i})(Ss(null==e?void 0:e.appearance),e.id);ms(ua(qa,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!0},"popover-survey"),a)}})),i(this,"handleWidget",(e=>{var t=function(e){var t,n=Ds.createElement("div");n.className="PostHogWidget".concat(e.id);var r,i=n.attachShadow({mode:"open"}),o=(r=null===(t=e.appearance)||void 0===t?void 0:t.widgetColor,"\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ".concat(r||"#e0a045",";\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: 9999999;\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n "));return i.append(Object.assign(Ds.createElement("style"),{innerText:o})),Ds.body.appendChild(n),i}(e),n=Ss(e.appearance);t.appendChild(Object.assign(Da.createElement("style"),{innerText:n})),ms(ua($a,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus},"feedback-survey"),t)})),i(this,"handleWidgetSelector",(e=>{var t,n=(null===(t=e.appearance)||void 0===t?void 0:t.widgetSelector)&&Da.querySelector(e.appearance.widgetSelector);if(n)if(0===Da.querySelectorAll(".PostHogWidget".concat(e.id)).length)this.handleWidget(e);else if(1===Da.querySelectorAll(".PostHogWidget".concat(e.id)).length&&!n.getAttribute("PHWidgetSurveyClickListener")){var r,i,o=null===(r=Da.querySelector(".PostHogWidget".concat(e.id)))||void 0===r||null===(i=r.shadowRoot)||void 0===i?void 0:i.querySelector(".survey-form");n.addEventListener("click",(()=>{o&&(o.style.display="none"===o.style.display?"block":"none",o.addEventListener("PHSurveyClosed",(()=>{this.removeSurveyFromFocus(e.id),o.style.display="none"})))})),n.setAttribute("PHWidgetSurveyClickListener","true")}})),i(this,"canRenderSurvey",(e=>{var t={visible:!1};return e.end_date?(t.disabledReason="survey was completed on ".concat(e.end_date),t):e.type!=Fo.Popover?(t.disabledReason="Only Popover survey types can be rendered",t):!e.linked_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.linked_flag_key)?!e.targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.targeting_flag_key)?!e.internal_targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key)?(t.visible=!0,t):(t.disabledReason="internal targeting feature flag ".concat(e.internal_targeting_flag_key," is false"),t):(t.disabledReason="targeting feature flag ".concat(e.targeting_flag_key," is false"),t):(t.disabledReason="linked feature flag ".concat(e.linked_flag_key," is false"),t)})),i(this,"renderSurvey",((e,t)=>{ms(ua(qa,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!1},"popover-survey"),t)})),i(this,"callSurveysAndEvaluateDisplayLogic",(function(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=t.posthog)||void 0===e||e.getActiveMatchingSurveys((e=>{var n=e.filter((e=>"api"!==e.type));t.sortSurveysByAppearanceDelay(n).forEach((e=>{if(Pr(t.surveyInFocus)){var n,r,i;if(e.type===Fo.Widget)"tab"===(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)&&0===Da.querySelectorAll(".PostHogWidget".concat(e.id)).length&&t.handleWidget(e),"selector"===(null===(r=e.appearance)||void 0===r?void 0:r.widgetType)&&null!==(i=e.appearance)&&void 0!==i&&i.widgetSelector&&t.handleWidgetSelector(e);e.type===Fo.Popover&&t.canShowNextEventBasedSurvey()&&t.handlePopoverSurvey(e)}}))}),n)})),i(this,"addSurveyToFocus",(e=>{Pr(this.surveyInFocus)||rr.error("Survey ".concat([...this.surveyInFocus]," already in focus. Cannot add survey ").concat(e,".")),this.surveyInFocus=e})),i(this,"removeSurveyFromFocus",(e=>{this.surveyInFocus!==e&&rr.error("Survey ".concat(e," is not in focus. Cannot remove survey ").concat(e,".")),this.surveyInFocus=null})),this.posthog=e,this.surveyInFocus=null}sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var n,r;return((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(r=t.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds)||0)}))}getTestAPI(){return{addSurveyToFocus:this.addSurveyToFocus,removeSurveyFromFocus:this.removeSurveyFromFocus,surveyInFocus:this.surveyInFocus,canShowNextEventBasedSurvey:this.canShowNextEventBasedSurvey,handleWidget:this.handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,handleWidgetSelector:this.handleWidgetSelector,sortSurveysByAppearanceDelay:this.sortSurveysByAppearanceDelay}}}function Ha(e){if(Da&&Pa){var t=new Ba(e);return t.callSurveysAndEvaluateDisplayLogic(!0),setInterval((()=>{t.callSurveysAndEvaluateDisplayLogic(!1)}),1e3),t}}function qa(e){var n,r,i,o,s,a,{survey:l,forceDisableHtml:c,posthog:u,style:d,previewPageIndex:h,removeSurveyFromFocus:p,isPopup:v}=e,g=Number.isInteger(h),f=null!==(n=l.appearance)&&void 0!==n&&n.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,{isPopupVisible:m,isSurveySent:_,setIsPopupVisible:y}=function(e,t,n,r,i){var[o,s]=Js(r||0===n),[a,l]=Js(!1);return Ks((()=>{if(!r&&t){var o,a=()=>{i(e.id),s(!1)},c=()=>{var t,n;null!==(t=e.appearance)&&void 0!==t&&t.displayThankYouMessage?(l(!0),i(e.id),null!==(n=e.appearance)&&void 0!==n&&n.autoDisappear&&setTimeout((()=>{s(!1)}),5e3)):(i(e.id),s(!1))},u=()=>{var n;s(!0),Pa.dispatchEvent(new Event("PHSurveyShown")),t.capture("survey shown",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(n=t.get_session_replay_url)||void 0===n?void 0:n.call(t)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())};return Pa.addEventListener("PHSurveyClosed",a),Pa.addEventListener("PHSurveySent",c),n>0?(o=setTimeout((()=>{u()}),n),()=>{clearTimeout(o),Pa.removeEventListener("PHSurveyClosed",a),Pa.removeEventListener("PHSurveySent",c)}):(u(),()=>{Pa.removeEventListener("PHSurveyClosed",a),Pa.removeEventListener("PHSurveySent",c)})}}),[]),{isPopupVisible:o,isSurveySent:a,setIsPopupVisible:s}}(l,u,f,g,p),b=_||h===l.questions.length,w=null!==(r=d)&&void 0!==r&&r.left&&Br(null===(i=d)||void 0===i?void 0:i.left)?{left:d.left-40}:{};return g&&((d=d||{}).left="unset",d.right="unset",d.transform="unset"),m?ua(Ls.Provider,{value:{isPreviewMode:g,previewPageIndex:h,handleCloseSurveyPopup:()=>Ts(l,u,g),isPopup:v||!1},children:b?ua(Ca,{header:(null===(o=l.appearance)||void 0===o?void 0:o.thankYouMessageHeader)||"Thank you!",description:(null===(s=l.appearance)||void 0===s?void 0:s.thankYouMessageDescription)||"",forceDisableHtml:!!c,contentType:null===(a=l.appearance)||void 0===a?void 0:a.thankYouMessageDescriptionContentType,appearance:l.appearance||ks,styleOverrides:t(t({},d),w),onClose:()=>y(!1)}):ua(Wa,{survey:l,forceDisableHtml:!!c,posthog:u,styleOverrides:d})}):ua(Qo,{})}function Wa(e){var n,r,{survey:i,forceDisableHtml:o,posthog:s,styleOverrides:a}=e,l=Is((null===(n=i.appearance)||void 0===n?void 0:n.backgroundColor)||ks.backgroundColor),[c,u]=Js({}),{isPreviewMode:d,previewPageIndex:h,handleCloseSurveyPopup:p,isPopup:v}=ta(Ls),[g,f]=Js(h||0),m=ea((()=>As(i)),[i]);Ks((()=>{f(null!=h?h:0)}),[h]);return ua("form",{className:"survey-form",style:v?t({color:l,borderColor:null===(r=i.appearance)||void 0===r?void 0:r.borderColor},a):{},children:m.map(((e,n)=>{var r,{originalQuestionIndex:a}=e;return(d?g===a:g===n)&&ua("div",{className:"survey-box",style:v?{backgroundColor:(null===(r=i.appearance)||void 0===r?void 0:r.backgroundColor)||ks.backgroundColor}:{},children:[v&&ua(Sa,{onClick:()=>p()}),Va({question:e,forceDisableHtml:o,displayQuestionIndex:n,appearance:i.appearance||ks,onSubmit:e=>(e=>{var{res:n,originalQuestionIndex:r,displayQuestionIndex:o}=e;if(s){var a=0===r?"$survey_response":"$survey_response_".concat(r);if(u(t(t({},c),{},{[a]:n})),s.getNextSurveyStep){var l=s.getNextSurveyStep(i,o,n);l===Lo.End?xs(t(t({},c),{},{[a]:n}),i,s):f(l)}else o===i.questions.length-1?xs(t(t({},c),{},{[a]:n}),i,s):f(o+1)}})({res:e,originalQuestionIndex:a,displayQuestionIndex:n})})]})}))})}function $a(e){var t,n,{survey:r,forceDisableHtml:i,posthog:o,readOnly:s,removeSurveyFromFocus:a}=e,[l,c]=Js(!1),[u,d]=Js({}),h=Qs(null);return Ks((()=>{var e,t;if(!s&&o){if("tab"===(null===(e=r.appearance)||void 0===e?void 0:e.widgetType)&&h.current){var n,i=h.current.getBoundingClientRect(),a={top:"50%",left:parseInt("".concat(i.right-360)),bottom:"auto",borderRadius:10,borderBottom:"1.5px solid ".concat((null===(n=r.appearance)||void 0===n?void 0:n.borderColor)||"#c9c6c6")};d(a)}if("selector"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)){var u=Da.querySelector(r.appearance.widgetSelector||"");null==u||u.addEventListener("click",(()=>{c(!l)})),null==u||u.setAttribute("PHWidgetSurveyClickListener","true")}}}),[]),ua(Qo,{children:["tab"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)&&ua("div",{className:"ph-survey-widget-tab",ref:h,onClick:()=>!s&&c(!l),style:{color:Is(r.appearance.widgetColor)},children:[ua("div",{className:"ph-survey-widget-tab-icon"}),(null===(n=r.appearance)||void 0===n?void 0:n.widgetLabel)||""]}),l&&ua(qa,{posthog:o,survey:r,forceDisableHtml:i,style:u,removeSurveyFromFocus:a,isPopup:!0},"feedback-widget-survey")]})}var Va=e=>{var{question:n,forceDisableHtml:r,displayQuestionIndex:i,appearance:o,onSubmit:s}=e,a={[Oo.Open]:ka,[Oo.Link]:Ea,[Oo.Rating]:xa,[Oo.SingleChoice]:Ma,[Oo.MultipleChoice]:Ma},l={question:n,forceDisableHtml:r,appearance:o,onSubmit:s},c={[Oo.Open]:{},[Oo.Link]:{},[Oo.Rating]:{displayQuestionIndex:i},[Oo.SingleChoice]:{displayQuestionIndex:i},[Oo.MultipleChoice]:{displayQuestionIndex:i}},u=a[n.type],d=t(t({},l),c[n.type]);return ua(u,t({},d))};function Za(e){return!Fr(Event)&&Ga(e,Event)}function Ga(e,t){try{return e instanceof t}catch(e){return!1}}function Ua(e){return Pr(e)||!Ar(e)&&!Tr(e)}function ja(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function za(e){return ja(e,"DOMError")}tr.__PosthogExtensions__=tr.__PosthogExtensions__||{},tr.__PosthogExtensions__.canActivateRepeatedly=Ns,tr.__PosthogExtensions__.generateSurveys=Ha,tr.extendPostHogWithSurveys=Ha;var Ya=/\(error: (.*)\)/,Xa=50,Ja="?";function Ka(e,t,n,r){var i={platform:"javascript",filename:e,function:"<anonymous>"===t?Ja:t,in_app:!0};return Fr(n)||(i.lineno=n),Fr(r)||(i.colno=r),i}var Qa=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,el=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tl=/\((\S*)(?::(\d+))(?::(\d+))\)/,nl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,il=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],o=e.split("\n"),s=n;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var l=Ya.test(a)?a.replace(Ya,"$1"):a;if(!l.match(/\S*Error: /)){for(var c of i){var u=c(l);if(u){r.push(u);break}}if(r.length>=Xa)break}}}return function(e){if(!e.length)return[];var n=Array.from(e);return n.reverse(),n.slice(0,Xa).map((e=>t(t({},e),{},{filename:e.filename||ol(n).filename,function:e.function||Ja})))}(r)}}(...[[30,e=>{var t=Qa.exec(e);if(t){var[,n,r,i]=t;return Ka(n,Ja,+r,+i)}var o=el.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var s=tl.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[a,l]=sl(o[1]||Ja,o[2]);return Ka(l,a,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,e=>{var t=nl.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=rl.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||Ja;return[i,r]=sl(i,r),Ka(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]);function ol(e){return e[e.length-1]||{}}var sl=(e,t)=>{var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Ja,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},al=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function ll(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(e){if(e&&cl.test(e.message))return 1;return 0}(e);try{var i=il(n,r);return i.slice(0,i.length-t)}catch(e){}return[]}var cl=/Minified React error #\d+;/i;function ul(e,t){var n,r,i=ll(e),o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null!==(r=null==t?void 0:t.synthetic)&&void 0!==r&&r;return{$exception_list:[{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:function(e){var t=e.message;if(t.error&&"string"==typeof t.error.message)return t.error.message;return t}(e),stacktrace:{frames:i,type:"raw"},mechanism:{handled:o,synthetic:s}}],$exception_level:"error"}}function dl(e,t){var n,r,i,o=null===(n=null==t?void 0:t.handled)||void 0===n||n,s=null===(r=null==t?void 0:t.synthetic)||void 0===r||r,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(i=null==t?void 0:t.defaultExceptionType)&&void 0!==i?i:"Error",value:null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:s}};if(null!=t&&t.syntheticException){var l=ll(t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function hl(e){return Or(e)&&!Lr(e)&&Sr.indexOf(e)>=0}function pl(e,t){var n,r,i=null===(n=null==t?void 0:t.handled)||void 0===n||n,o=null===(r=null==t?void 0:t.synthetic)||void 0===r||r,s=null!=t&&t.overrideExceptionType?t.overrideExceptionType:Za(e)?e.constructor.name:"Error",a=null!=t&&t.overrideExceptionMessage?t.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:"".concat(i.slice(0,t),"...")}return""}(e)),l={type:s,value:a,mechanism:{handled:i,synthetic:o}};if(null!=t&&t.syntheticException){var c=ll(null==t?void 0:t.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:hl(e.level)?e.level:"error"}}function vl(e,n){var[r,i,o,s,a]=e,l={$exception_list:[]},c=a||r;if(za(c)||function(e){return ja(e,"DOMException")}(c)){var u=c;if(function(e){return"stack"in e}(c))l=ul(c,n);else{var d=u.name||(za(u)?"DOMError":"DOMException"),h=u.message?"".concat(d,": ").concat(u.message):d,p=za(u)?"DOMError":"DOMException";l=dl(h,t(t({},n),{},{overrideExceptionType:p,defaultExceptionMessage:h}))}return"code"in u&&(l.$exception_DOMException_code="".concat(u.code)),l}if(function(e){return ja(e,"ErrorEvent")}(c)&&c.error)return ul(c.error,n);if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Ga(e,Error)}}(c))return ul(c,n);if(function(e){return ja(e,"Object")}(c)||Za(c))return pl(c,n);if(Fr(a)&&Or(r)){var v="Error",g=r,f=r.match(al);return f&&(v=f[1],g=f[2]),dl(g,t(t({},n),{},{overrideExceptionType:v,defaultExceptionMessage:g}))}return dl(c,n)}function gl(e){var[t]=e,n=function(e){if(Ua(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}(t);return Ua(n)?dl("Non-Error promise rejection captured with value: ".concat(String(n)),{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):vl([n],{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(n)})}var fl={wrapOnError:e=>{var t=Vn;t||rr.info("window not available, cannot wrap onerror");var n=t.onerror;return t.onerror=function(){for(var t,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=vl(i);return e(s),null!==(t=null==n?void 0:n(...i))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null===(e=t.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=n}},wrapUnhandledRejection:e=>{var t=Vn;t||rr.info("window not available, cannot wrap onUnhandledRejection");var n=t.onunhandledrejection;return t.onunhandledrejection=function(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];var a=gl(o);return e(a),null!==(r=null==n?void 0:n.apply(t,o))&&void 0!==r&&r},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null===(e=t.onunhandledrejection)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=n}}};tr.__PosthogExtensions__=tr.__PosthogExtensions__||{},tr.__PosthogExtensions__.errorWrappingFunctions=fl,tr.__PosthogExtensions__.parseErrorAsProperties=vl,tr.posthogErrorWrappingFunctions=fl,tr.parseErrorAsProperties=vl;var ml=(e,t)=>{var{sessionId:n,windowId:r}=e.checkAndGetSessionAndWindowId(!0);t.headers.set("X-POSTHOG-SESSION-ID",n),t.headers.set("X-POSTHOG-WINDOW-ID",r)};tr.__PosthogExtensions__=tr.__PosthogExtensions__||{};var _l={_patchFetch:e=>vo(Vn,"fetch",(t=>function(){var n=r((function*(n,r){var i=new Request(n,r);return ml(e,i),t(i)}));return function(e,t){return n.apply(this,arguments)}}())),_patchXHR:e=>vo(Vn.XMLHttpRequest.prototype,"open",(t=>function(n,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,a=new Request(r);return ml(e,a),t.call(this,n,a.url,i,o,s)}))};tr.__PosthogExtensions__.tracingHeadersPatchFns=_l,tr.postHogTracingHeadersPatchFns=_l;var yl,bl,wl,Sl=-1,Cl=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Sl=t.timeStamp,e(t))}),!0)},Il=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},kl=function(){var e=Il();return e&&e.activationStart||0},El=function(e,t){var n=Il(),r="navigate";return Sl>=0?r="back-forward-cache":n&&(document.prerendering||kl()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},xl=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},Tl=function(e,t,n,r){var i,o;return function(s){t.value>=0&&(s||r)&&((o=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Ml=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},Rl=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},Al=function(e){var t=!1;return function(){t||(e(),t=!0)}},Nl=-1,Fl=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Ol=function(e){"hidden"===document.visibilityState&&Nl>-1&&(Nl="visibilitychange"===e.type?e.timeStamp:0,Pl())},Ll=function(){addEventListener("visibilitychange",Ol,!0),addEventListener("prerenderingchange",Ol,!0)},Pl=function(){removeEventListener("visibilitychange",Ol,!0),removeEventListener("prerenderingchange",Ol,!0)},Dl=function(){return Nl<0&&(Nl=Fl(),Ll(),Cl((function(){setTimeout((function(){Nl=Fl(),Ll()}),0)}))),{get firstHiddenTime(){return Nl}}},Bl=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Hl=[1800,3e3],ql=function(e,t){t=t||{},Bl((function(){var n,r=Dl(),i=El("FCP"),o=xl("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-kl(),0),i.entries.push(e),n(!0)))}))}));o&&(n=Tl(e,i,Hl,t.reportAllChanges),Cl((function(r){i=El("FCP"),n=Tl(e,i,Hl,t.reportAllChanges),Ml((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},Wl=[.1,.25],$l=[2500,4e3],Vl={},Zl=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Gl=function(e){if("loading"===document.readyState)return"loading";var t=Zl();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},Ul=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},jl=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:Ul(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?"."+r.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},zl=-1,Yl=function(e,t){var n=Zl(),r="navigate";return zl>=0?r="back-forward-cache":n&&(document.prerendering||function(){var e=Zl();return e&&e.activationStart||0}()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:-1,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},Xl=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},Jl=function(e,t,n,r){var i,o;return function(s){t.value>=0&&(s||r)&&((o=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Kl=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},Ql=0,ec=1/0,tc=0,nc=function(e){e.forEach((function(e){e.interactionId&&(ec=Math.min(ec,e.interactionId),tc=Math.max(tc,e.interactionId),Ql=tc?(tc-ec)/7+1:0)}))},rc=function(){"interactionCount"in performance||yl||(yl=Xl("event",nc,{type:"event",buffered:!0,durationThreshold:0}))},ic=[],oc=new Map,sc=0,ac=function(){return(yl?Ql:performance.interactionCount||0)-sc},lc=[],cc=function(e){if(lc.forEach((function(t){return t(e)})),e.interactionId||"first-input"===e.entryType){var t=ic[ic.length-1],n=oc.get(e.interactionId);if(n||ic.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};oc.set(r.id,r),ic.push(r)}ic.sort((function(e,t){return t.latency-e.latency})),ic.length>10&&ic.splice(10).forEach((function(e){return oc.delete(e.id)}))}}},uc=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=function(e){var t=!1;return function(){t||(e(),t=!0)}}(e),"hidden"===document.visibilityState?e():(n=t(e),Kl(e)),n},dc=[200,500],hc=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()}((function(){var n;rc();var r,i=Yl("INP"),o=function(e){uc((function(){e.forEach(cc);var t,n=(t=Math.min(ic.length-1,Math.floor(ac()/50)),ic[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())}))},s=Xl("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=Jl(e,i,dc,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),Kl((function(){o(s.takeRecords()),r(!0)})),function(e){addEventListener("pageshow",(function(t){t.persisted&&(zl=t.timeStamp,e(t))}),!0)}((function(){sc=0,ic.length=0,oc.clear(),i=Yl("INP"),r=Jl(e,i,dc,t.reportAllChanges)})))})))},pc=[],vc=[],gc=new WeakMap,fc=new Map,mc=-1,_c=function(e){pc=pc.concat(e),yc()},yc=function(){mc<0&&(mc=uc(bc))},bc=function(){fc.size>10&&fc.forEach((function(e,t){oc.has(t)||fc.delete(t)}));var e=ic.map((function(e){return gc.get(e.entries[0])})),t=vc.length-50;vc=vc.filter((function(n,r){return r>=t||e.includes(n)}));for(var n=new Set,r=0;r<vc.length;r++){var i=vc[r];wc(i.startTime,i.processingEnd).forEach((function(e){n.add(e)}))}for(var o=0;o<50;o++){var s=pc[pc.length-1-o];if(!s||s.startTime<wl)break;n.add(s)}pc=Array.from(n),mc=-1};lc.push((function(e){e.interactionId&&e.target&&!fc.has(e.interactionId)&&fc.set(e.interactionId,e.target)}),(function(e){var t,n=e.startTime+e.duration;wl=Math.max(wl,e.processingEnd);for(var r=vc.length-1;r>=0;r--){var i=vc[r];if(Math.abs(n-i.renderTime)<=8){(t=i).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:[e]},vc.push(t)),(e.interactionId||"first-input"===e.entryType)&&gc.set(e,t),yc()}));var wc=function(e,t){for(var n,r=[],i=0;n=pc[i];i++)if(!(n.startTime+n.duration<e)){if(n.startTime>t)break;r.push(n)}return r},Sc={onLCP:function(e,t){t=t||{},Bl((function(){var n,r=Dl(),i=El("LCP"),o=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-kl(),0),i.entries=[e],n())}))},s=xl("largest-contentful-paint",o);if(s){n=Tl(e,i,$l,t.reportAllChanges);var a=Al((function(){Vl[i.id]||(o(s.takeRecords()),s.disconnect(),Vl[i.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=Al(e),"hidden"===document.visibilityState?e():(n=t(e),Rl(e)),n}(a)}),!0)})),Rl(a),Cl((function(r){i=El("LCP"),n=Tl(e,i,$l,t.reportAllChanges),Ml((function(){i.value=performance.now()-r.timeStamp,Vl[i.id]=!0,n(!0)}))}))}}))},onCLS:function(e,t){t=t||{},ql(Al((function(){var n,r=El("CLS",0),i=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,o.push(e)):(i=e.value,o=[e])}})),i>r.value&&(r.value=i,r.entries=o,n())},a=xl("layout-shift",s);a&&(n=Tl(e,r,Wl,t.reportAllChanges),Rl((function(){s(a.takeRecords()),n(!0)})),Cl((function(){i=0,r=El("CLS",0),n=Tl(e,r,Wl,t.reportAllChanges),Ml((function(){return n()}))})),setTimeout(n,0))})))},onFCP:ql,onINP:function(e,t){bl||(bl=Xl("long-animation-frame",_c)),hc((function(t){var n=function(e){var t=e.entries[0],n=gc.get(t),r=t.processingStart,i=n.processingEnd,o=n.entries.sort((function(e,t){return e.processingStart-t.processingStart})),s=wc(t.startTime,i),a=e.entries.find((function(e){return e.target})),l=a&&a.target||fc.get(t.interactionId),c=[t.startTime+t.duration,i].concat(s.map((function(e){return e.startTime+e.duration}))),u=Math.max.apply(Math,c),d={interactionTarget:jl(l),interactionTargetElement:l,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:u,processedEventEntries:o,longAnimationFrameEntries:s,inputDelay:r-t.startTime,processingDuration:i-r,presentationDelay:Math.max(u-i,0),loadState:Gl(t.startTime)};return Object.assign(e,{attribution:d})}(t);e(n)}),t)}};tr.__PosthogExtensions__=tr.__PosthogExtensions__||{},tr.__PosthogExtensions__.postHogWebVitalsCallbacks=Sc,tr.postHogWebVitalsCallbacks=Sc;class Cc{constructor(){this.clicks=[]}isRageClick(e,t,n){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}}function Ic(e,t){return t.length>e?t.slice(0,e)+"...":t}function kc(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ai(t));return t}function Ec(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};Wi.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=Ic(1024,Qi(e)):o.$el_text=Ic(1024,Hi(e)));var s=Di(e);s.length>0&&(o.classes=s.filter((function(e){return""!==e}))),ar(e.attributes,(function(n){var i;if((!Gi(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&((null==r||!r.includes(n.name))&&!t&&Ki(n.value)&&(i=n.name,!Or(i)||"_ngcontent"!==i.substring(0,10)&&"_nghost"!==i.substring(0,7)))){var s=n.value;"class"===n.name&&(s=Li(s).join(" ")),o["attr__"+n.name]=Ic(1024,s)}}));for(var a=1,l=1,c=e;c=kc(c);)a++,c.tagName===e.tagName&&l++;return o.nth_child=a,o.nth_of_type=l,o}function xc(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:a,elementsChainAsString:l}=t,c=[e],u=e;u.parentNode&&!Ni(u,"body");)Oi(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],p={},v=!1,g=!1;if(ar(c,(e=>{var t=Zi(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Ki(v)&&v),cr(Di(e),"ph-no-capture")&&(g=!0),h.push(Ec(e,o,s,a));var n=function(e){if(!Zi(e))return{};var t={};return ar(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&Ki(r)&&(t[n]=r)}})),t}(e);lr(p,n)})),g)return{props:{},explicitNoCapture:g};if(s||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?h[0].$el_text=Qi(e):h[0].$el_text=Hi(e)),v){var f,m;h[0].attr__href=v;var _=null===(f=Zr(v))||void 0===f?void 0:f.host,y=null==Vn||null===(m=Vn.location)||void 0===m?void 0:m.host;_&&y&&_!==y&&(d=v)}return{props:lr({$event_type:i.type,$ce_version:1},l?{$elements_chain:to(h)}:{$elements:h},null!==(n=h[0])&&void 0!==n&&n.$el_text?{$el_text:null===(r=h[0])||void 0===r?void 0:r.$el_text}:{},d&&"click"===i.type?{$external_click_url:d}:{},p)}}class Tc{constructor(e){i(this,"_initialized",!1),i(this,"_isDisabledServerSide",null),i(this,"rageclicks",new Cc),i(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,n=Ar(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null===(e=n.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),n.url_ignorelist=null===(t=n.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),n}_addDomEventHandlers(){if(this.isBrowserSupported()){if(Vn&&Yn){var e=e=>{e=e||(null==Vn?void 0:Vn.event);try{this._captureEvent(e)}catch(e){rr.error("Failed to capture event",e)}},t=e=>{e=e||(null==Vn?void 0:Vn.event),this._captureEvent(e,br)};mr(Yn,"submit",e,!1,!0),mr(Yn,"change",e,!1,!0),mr(Yn,"click",e,!1,!0),this.config.capture_copied_text&&(mr(Yn,"copy",t,!1,!0),mr(Yn,"cut",t,!1,!0))}}else rr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}afterDecideResponse(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Kr]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,n=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{var r=null==Yn?void 0:Yn.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e,t,n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[Kr],r=this._isDisabledServerSide;if(Pr(r)&&!Hr(n)&&!this.instance.config.advanced_disable_decide)return!1;var i=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}_captureEvent(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var n,r=qi(e);if(Fi(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this.instance.config.rageclick&&null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick");var i=t===br;if(r&&Vi(r,e,this.config,i,i?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:s}=xc(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(s)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(o.$element_selectors=a),t===br){var l,c=Bi(null==Vn||null===(l=Vn.getSelection())||void 0===l?void 0:l.toString()),u=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=u}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Tr(null==Yn?void 0:Yn.querySelectorAll)}}var Mc={};function Rc(e){return function(e,t){var n=Mc[e];if(n)return n;var r=t[e];if(Mr(r)&&!Rr(r))return Mc[e]=r.bind(t);var i=t.document;if(i&&Tr(i.createElement))try{var o=i.createElement("iframe");o.hidden=!0,i.head.appendChild(o);var s=o.contentWindow;s&&s[e]&&(r=s[e]),i.head.removeChild(o)}catch(t){rr.warn("Could not create sandbox iframe for ".concat(e," check, bailing to assignableWindow.").concat(e,": "),t)}return r&&Tr(r)?Mc[e]=r.bind(t):r}("MutationObserver",e)}function Ac(e,t){return Br(e)&&e>=t}class Nc{asRequiredConfig(e){var t,n,r,i,o=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:o.element_attribute_ignorelist,scroll_threshold_ms:null!==(n=null==e?void 0:e.scroll_threshold_ms)&&void 0!==n?n:o.scroll_threshold_ms,selection_change_threshold_ms:null!==(r=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==r?r:o.selection_change_threshold_ms,mutation_threshold_ms:null!==(i=null==e?void 0:e.mutation_threshold_ms)&&void 0!==i?i:o.mutation_threshold_ms,__onCapture:o.__onCapture}}constructor(e,t){i(this,"_clicks",[]),i(this,"_defaultConfig",(e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,__onCapture:e}))),i(this,"_onClick",(e=>{var t=function(e){var t=qi(e);return t?{node:t,originalEvent:e,timestamp:Date.now()}:null}(e);Pr(t)||this._ignoreClick(t)||this._clicks.push(t),this._clicks.length&&Fr(this._checkClickTimer)&&(this._checkClickTimer=tr.setTimeout((()=>{this._checkClicks()}),1e3))})),i(this,"_onScroll",(()=>{var e=Date.now();e%50==0&&this._clicks.forEach((t=>{Fr(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))})),i(this,"_onSelectionChange",(()=>{this._lastSelectionChanged=Date.now()})),this.instance=e,this._config=this.asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startMutationObserver(e)}_startMutationObserver(e){if(!this._mutationObserver){var t=Rc(tr);this._mutationObserver=new t((e=>{this.onMutation(e)})),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,tr.removeEventListener("click",this._onClick),tr.removeEventListener("scroll",this._onScroll,!0),tr.removeEventListener("selectionchange",this._onSelectionChange)}onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){tr.addEventListener("click",this._onClick)}_startScrollObserver(){tr.addEventListener("scroll",this._onScroll,!0)}_startSelectionChangedObserver(){tr.addEventListener("selectionchange",this._onSelectionChange)}_ignoreClick(e){if(!e)return!0;if(Ri(e.node))return!0;var t=this._clicks.some((t=>t.node===e.node&&Math.abs(t.timestamp-e.timestamp)<1e3));return!!t||!(!Ni(e.node,"html")&&Ai(e.node)&&!Wi.includes(e.node.tagName.toLowerCase()))}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var n;t.mutationDelayMs=null!==(n=t.mutationDelayMs)&&void 0!==n?n:this._lastMutation&&t.timestamp<=this._lastMutation?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&t.timestamp<=this._lastSelectionChanged?this._lastSelectionChanged-t.timestamp:void 0;var r=Ac(t.scrollDelayMs,this._config.scroll_threshold_ms),i=Ac(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),o=Ac(t.mutationDelayMs,this._config.mutation_threshold_ms),s=Ac(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=Br(t.scrollDelayMs)&&t.scrollDelayMs<this._config.scroll_threshold_ms,l=Br(t.mutationDelayMs)&&t.mutationDelayMs<this._config.mutation_threshold_ms,c=Br(t.selectionChangedDelayMs)&&t.selectionChangedDelayMs<this._config.selection_change_threshold_ms;a||l||c||(r||o||s||i?this._onCapture(t,{$dead_click_last_mutation_timestamp:this._lastMutation,$dead_click_event_timestamp:t.timestamp,$dead_click_scroll_timeout:r,$dead_click_mutation_timeout:o,$dead_click_absolute_timeout:s,$dead_click_selection_changed_timeout:i}):t.absoluteDelayMs<this._config.mutation_threshold_ms&&this._clicks.push(t))}this._clicks.length&&Fr(this._checkClickTimer)&&(this._checkClickTimer=tr.setTimeout((()=>{this._checkClicks()}),1e3))}}_captureDeadClick(e,n){this.instance.capture("$dead_click",t(t(t({},n),xc(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1}).props),{},{$dead_click_scroll_delay_ms:e.scrollDelayMs,$dead_click_mutation_delay_ms:e.mutationDelayMs,$dead_click_absolute_delay_ms:e.absoluteDelayMs,$dead_click_selection_changed_delay_ms:e.selectionChangedDelayMs}),{timestamp:new Date(e.timestamp)})}}tr.__PosthogExtensions__=tr.__PosthogExtensions__||{},tr.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new Nc(e,t);var Fc="$active_feature_flags",Oc="$override_feature_flags",Lc="$feature_flag_payloads",Pc=e=>{var t={};for(var[n,r]of ur(e||{}))r&&(t[n]=r);return t};class Dc{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(vi),t=this.instance.get_property(Oc);if(!t)return e||{};for(var n=lr({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this._override_warning||(rr.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}getFlagPayloads(){return this.instance.get_property(Lc)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())}),5)}_reloadFeatureFlagsRequest(){if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var e=this.instance.config.token,t=this.instance.get_property(fi),n=this.instance.get_property(mi),r={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:n,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:r,compression:this.instance.config.disable_compression?void 0:yr.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var t;this.setReloadingPaused(!1);var n=!0;200===e.statusCode&&(this.$anon_distinct_id=void 0,n=!1),this.receivedFeatureFlags(null!==(t=e.json)&&void 0!==t?t:{},n),this._startReloadTimer()}})}}getFeatureFlag(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(bi)||{};if(t.send_event||!("send_event"in t))if(!(e in o)||!o[e].includes(i))xr(o[e])?o[e].push(i):o[e]=[i],null===(n=this.instance.persistence)||void 0===n||n.register({[bi]:o}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:r});return r}rr.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(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);rr.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,n){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads();!function(e,n){var 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(xr(o)){var a={};if(o)for(var l=0;l<o.length;l++)a[o[l]]=!0;n&&n.register({[Fc]:o,[vi]:a})}else{var c=o,u=s;e.errorsWhileComputingFlags&&(c=t(t({},r),c),u=t(t({},i),u)),n&&n.register({[Fc]:Object.keys(Pc(c)),[vi]:c||{},[Lc]:u||{}})}}(e,this.instance.persistence,r,i),this._fireFeatureFlagsCallbacks(n)}}override(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return rr.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(Oc);else if(xr(e)){for(var n={},r=0;r<e.length;r++)n[e[r]]=!0;this.instance.persistence.register({[Oc]:n})}else this.instance.persistence.register({[Oc]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var{flags:t,flagVariants:n}=this._prepareFeatureFlagsForCallbacks();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n){var r,i={["$feature_enrollment/".concat(e)]:n};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:n,$set:i}),this.setPersonPropertiesForFlags(i,!1);var o=t(t({},this.getFlagVariants()),{},{[e]:n});null===(r=this.instance.persistence)||void 0===r||r.register({[Fc]:Object.keys(Pc(o)),[vi]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.instance.get_property(gi);if(n&&!t)return e(n);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:t=>{var n;if(t.json){var r=t.json.earlyAccessFeatures;return null===(n=this.instance.persistence)||void 0===n||n.register({[gi]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:n}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(fi)||{};this.instance.register({[fi]:t(t({},r),e)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(fi)}setGroupPropertiesForFlags(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(mi)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((n=>{r[n]=t(t({},r[n]),e[n]),delete e[n]})),this.instance.register({[mi]:t(t({},r),e)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this.instance.get_property(mi)||{};this.instance.register({[mi]:t(t({},n),{},{[e]:{}})})}else this.instance.unregister(mi)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Br(e)&&isFinite(e)&&Math.floor(e)===e});var Bc="0123456789abcdef";class Hc{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||e<0||t<0||n<0||r<0||e>0xffffffffffff||t>4095||n>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|t>>>8,i[7]=t,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new Hc(i)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Bc.charAt(this.bytes[t]>>>4)+Bc.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}clone(){return new Hc(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(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}}class qc{constructor(){i(this,"timestamp",0),i(this,"counter",0),i(this,"random",new Vc)}generate(){var e=this.generateOrAbort();if(Fr(e)){this.timestamp=0;var t=this.generateOrAbort();if(Fr(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){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 Hc.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var Wc,$c=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};Vn&&!Fr(Vn.crypto)&&crypto.getRandomValues&&($c=e=>crypto.getRandomValues(e));class Vc{constructor(){i(this,"buffer",new Uint32Array(8)),i(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&($c(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Zc=()=>Gc().toString(),Gc=()=>(Wc||(Wc=new qc)).generate(),Uc="Thu, 01 Jan 1970 00:00:00 GMT",jc="";var zc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Yc(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yn;if(jc)return jc;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_"+Zc(),o=new RegExp("(^|;)\\s*"+i+"=1");!jc&&r--;){var s=n.slice(r).join("."),a=i+"=1;domain=."+s;t.cookie=a,o.test(t.cookie)&&(t.cookie=a+";expires="+Uc,jc=s)}return jc}(e);if(!n){var r=(e=>{var t=e.match(zc);return t?t[0]:""})(e);r!==n&&rr.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Xc={is_supported:()=>!!Yn,error:function(e){rr.error("cookieStore error: "+e)},get:function(e){if(Yn){try{for(var t=e+"=",n=Yn.cookie.split(";").filter((e=>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(Xc.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){if(Yn)try{var o="",s="",a=Yc(Yn.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),o="; expires="+l.toUTCString()}i&&(s="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+a+s;return c.length>3686.4&&rr.warn("cookieStore warning: large cookie, len="+c.length),Yn.cookie=c,c}catch(e){return}},remove:function(e,t){try{Xc.set(e,"",-1,t)}catch(e){return}}},Jc=null,Kc={is_supported:function(){if(!Pr(Jc))return Jc;var e=!0;if(Fr(Vn))e=!1;else try{var t="__mplssupport__";Kc.set(t,"xyz"),'"xyz"'!==Kc.get(t)&&(e=!1),Kc.remove(t)}catch(t){e=!1}return e||rr.error("localStorage unsupported; falling back to cookie store"),Jc=e,e},error:function(e){rr.error("localStorage error: "+e)},get:function(e){try{return null==Vn?void 0:Vn.localStorage.getItem(e)}catch(e){Kc.error(e)}return null},parse:function(e){try{return JSON.parse(Kc.get(e))||{}}catch(e){}return null},set:function(e,t){try{null==Vn||Vn.localStorage.setItem(e,JSON.stringify(t))}catch(e){Kc.error(e)}},remove:function(e){try{null==Vn||Vn.localStorage.removeItem(e)}catch(e){Kc.error(e)}}},Qc=["distinct_id",ui,di,xi],eu=t(t({},Kc),{},{parse:function(e){try{var t={};try{t=Xc.parse(e)||{}}catch(e){}var n=lr(t,JSON.parse(Kc.get(e)||"{}"));return Kc.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i,o){try{Kc.set(e,t,void 0,void 0,o);var s={};Qc.forEach((e=>{t[e]&&(s[e]=t[e])})),Object.keys(s).length&&Xc.set(e,s,n,r,i,o)}catch(e){Kc.error(e)}},remove:function(e,t){try{null==Vn||Vn.localStorage.removeItem(e),Xc.remove(e,t)}catch(e){Kc.error(e)}}}),tu={},nu={is_supported:function(){return!0},error:function(e){rr.error("memoryStorage error: "+e)},get:function(e){return tu[e]||null},parse:function(e){return tu[e]||null},set:function(e,t){tu[e]=t},remove:function(e){delete tu[e]}},ru=null,iu={is_supported:function(){if(!Pr(ru))return ru;if(ru=!0,Fr(Vn))ru=!1;else try{var e="__support__";iu.set(e,"xyz"),'"xyz"'!==iu.get(e)&&(ru=!1),iu.remove(e)}catch(e){ru=!1}return ru},error:function(e){rr.error("sessionStorage error: ",e)},get:function(e){try{return null==Vn?void 0:Vn.sessionStorage.getItem(e)}catch(e){iu.error(e)}return null},parse:function(e){try{return JSON.parse(iu.get(e))||null}catch(e){}return null},set:function(e,t){try{null==Vn||Vn.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){iu.error(e)}},remove:function(e){try{null==Vn||Vn.sessionStorage.removeItem(e)}catch(e){iu.error(e)}}},ou="Mobile",su="iOS",au="Android",lu="Tablet",cu=au+" "+lu,uu="iPad",du="Apple",hu=du+" Watch",pu="Safari",vu="BlackBerry",gu="Samsung",fu=gu+"Browser",mu=gu+" Internet",_u="Chrome",yu=_u+" OS",bu=_u+" "+su,wu="Internet Explorer",Su=wu+" "+ou,Cu="Opera",Iu=Cu+" Mini",ku="Edge",Eu="Microsoft "+ku,xu="Firefox",Tu=xu+" "+su,Mu="Nintendo",Ru="PlayStation",Au="Xbox",Nu=au+" "+ou,Fu=ou+" "+pu,Ou="Windows",Lu=Ou+" Phone",Pu="Nokia",Du="Ouya",Bu="Generic",Hu=Bu+" "+ou.toLowerCase(),qu=Bu+" "+lu.toLowerCase(),Wu="Konqueror",$u="(\\d+(\\.\\d+)?)",Vu=new RegExp("Version/"+$u),Zu=new RegExp(Au,"i"),Gu=new RegExp(Ru+" \\w+","i"),Uu=new RegExp(Mu+" \\w+","i"),ju=new RegExp(vu+"|PlayBook|BB10","i"),zu={"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 Yu=(e,t)=>t&&cr(t,du)||function(e){return cr(e,pu)&&!cr(e,_u)&&!cr(e,au)}(e),Xu=function(e,t){return t=t||"",cr(e," OPR/")&&cr(e,"Mini")?Iu:cr(e," OPR/")?Cu:ju.test(e)?vu:cr(e,"IE"+ou)||cr(e,"WPDesktop")?Su:cr(e,fu)?mu:cr(e,ku)||cr(e,"Edg/")?Eu:cr(e,"FBIOS")?"Facebook "+ou:cr(e,"UCWEB")||cr(e,"UCBrowser")?"UC Browser":cr(e,"CriOS")?bu:cr(e,"CrMo")?_u:cr(e,au)&&cr(e,pu)?Nu:cr(e,_u)?_u:cr(e,"FxiOS")?Tu:cr(e.toLowerCase(),Wu.toLowerCase())?Wu:Yu(e,t)?cr(e,ou)?Fu:pu:cr(e,xu)?xu:cr(e,"MSIE")||cr(e,"Trident/")?wu:cr(e,"Gecko")?xu:""},Ju={[Su]:[new RegExp("rv:"+$u)],[Eu]:[new RegExp(ku+"?\\/"+$u)],[_u]:[new RegExp("("+_u+"|CrMo)\\/"+$u)],[bu]:[new RegExp("CriOS\\/"+$u)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$u)],[pu]:[Vu],[Fu]:[Vu],[Cu]:[new RegExp("(Opera|OPR)\\/"+$u)],[xu]:[new RegExp(xu+"\\/"+$u)],[Tu]:[new RegExp("FxiOS\\/"+$u)],[Wu]:[new RegExp("Konqueror[:/]?"+$u,"i")],[vu]:[new RegExp(vu+" "+$u),Vu],[Nu]:[new RegExp("android\\s"+$u,"i")],[mu]:[new RegExp(fu+"\\/"+$u)],[wu]:[new RegExp("(rv:|MSIE )"+$u)],Mozilla:[new RegExp("rv:"+$u)]},Ku=[[new RegExp(Au+"; "+Au+" (.*?)[);]","i"),e=>[Au,e&&e[1]||""]],[new RegExp(Mu,"i"),[Mu,""]],[new RegExp(Ru,"i"),[Ru,""]],[ju,[vu,""]],[new RegExp(Ou,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Lu,""];if(new RegExp(ou).test(t)&&!/IEMobile\b/.test(t))return[Ou+" "+ou,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=zu[r]||"";return/arm/i.test(t)&&(i="RT"),[Ou,i]}return[Ou,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[su,t.join(".")]}return[su,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Fr(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+au+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+au+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[au,t.join(".")]}return[au,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,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/,[yu,""]],[/Linux|debian/i,["Linux",""]]],Qu=function(e){return Uu.test(e)?Mu:Gu.test(e)?Ru:Zu.test(e)?Au:new RegExp(Du,"i").test(e)?Du:new RegExp("("+Lu+"|WPDesktop)","i").test(e)?Lu:/iPad/.test(e)?uu:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?hu:ju.test(e)?vu:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Pu,"i").test(e)?Pu:/(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(ou).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)?au:cu:au:new RegExp("(pda|"+ou+")","i").test(e)?Hu:new RegExp(lu,"i").test(e)&&!new RegExp(lu+" pc","i").test(e)?qu:""},ed="https?://(.*)",td=["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","rdt_cid"],nd={campaignParams:function(e){return Yn?this._campaignParamsFromUrl(Yn.URL,e):{}},_campaignParamsFromUrl:function(e,t){var n=td.concat(t||[]),r={};return ar(n,(function(t){var n=jr(e,t);r[t]=n||null})),r},_searchEngine:function(e){return e?0===e.search(ed+"google.([^/?]*)")?"google":0===e.search(ed+"bing.com")?"bing":0===e.search(ed+"yahoo.com")?"yahoo":0===e.search(ed+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=nd._searchEngine(e),n="yahoo"!=t?"q":"p",r={};if(!Pr(t)){r.$search_engine=t;var i=Yn?jr(Yn.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=null==Yn?void 0:Yn.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:Xu,browserVersion:function(e,t){var n=Xu(e,t),r=Ju[n];if(Fr(r))return null;for(var i=0;i<r.length;i++){var o=r[i],s=e.match(o);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<Ku.length;t++){var[n,r]=Ku[t],i=n.exec(e),o=i&&(Tr(r)?r(i,e):r);if(o)return o}return["",""]},device:Qu,deviceType:function(e){var t=Qu(e);return t===uu||t===cu||"Kobo"===t||"Kindle Fire"===t||t===qu?lu:t===Mu||t===Au||t===Ru||t===Du?"Console":t===hu?"Wearable":t?ou:"Desktop"},referrer:function(){return(null==Yn?void 0:Yn.referrer)||"$direct"},referringDomain:function(){var e;return null!=Yn&&Yn.referrer&&(null===(e=Zr(Yn.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:null==Xn?void 0:Xn.href}},initialPersonPropsFromInfo:function(e){var t,{r:n,u:r}=e,i={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(t=Zr(n))||void 0===t?void 0:t.host};if(r){i.$initial_current_url=r;var o=Zr(r);i.$initial_host=null==o?void 0:o.host,i.$initial_pathname=null==o?void 0:o.pathname,ar(this._campaignParamsFromUrl(r),(function(e,t){i["$initial_"+vr(t)]=e}))}n&&ar(this._searchInfoFromReferrer(n),(function(e,t){i["$initial_"+vr(t)]=e}));return i},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},properties:function(){if(!er)return{};var[e,t]=nd.os(er);return lr(pr({$os:e,$os_version:t,$browser:nd.browser(er,navigator.vendor),$device:nd.device(er),$device_type:nd.deviceType(er),$timezone:nd.timezone()}),{$current_url:null==Xn?void 0:Xn.href,$host:null==Xn?void 0:Xn.host,$pathname:null==Xn?void 0:Xn.pathname,$raw_user_agent:er.length>1e3?er.substring(0,997)+"...":er,$browser_version:nd.browserVersion(er,navigator.vendor),$browser_language:nd.browserLanguage(),$screen_height:null==Vn?void 0:Vn.screen.height,$screen_width:null==Vn?void 0:Vn.screen.width,$viewport_height:null==Vn?void 0:Vn.innerHeight,$viewport_width:null==Vn?void 0:Vn.innerWidth,$lib:"web",$lib_version:$n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!er)return{};var[e,t]=nd.os(er);return lr(pr({$os:e,$os_version:t,$browser:nd.browser(er,navigator.vendor)}),{$browser_version:nd.browserVersion(er,navigator.vendor)})}},rd=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class id{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(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"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&rr.info("Persistence loaded",e.persistence,t({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){-1===rd.indexOf(e.persistence.toLowerCase())&&(rr.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Kc.is_supported()?Kc:"localstorage+cookie"===t&&eu.is_supported()?eu:"sessionstorage"===t&&iu.is_supported()?iu:"memory"===t?nu:"cookie"===t?Xc:eu.is_supported()?eu:Xc}properties(){var e={};return ar(this.props,(function(t,n){if(n===vi&&Ar(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e["$feature/".concat(r[i])]=t[r[i]];else s=n,a=!1,(Pr(o=Mi)?a:jn&&o.indexOf===jn?-1!=o.indexOf(s):(ar(o,(function(e){if(a||(a=e===s))return ir})),a))||(e[n]=t);var o,s,a})),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=lr({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Ar(e)){Fr(t)&&(t="None"),this.expire_days=Fr(n)?this.default_expiry:n;var r=!1;if(ar(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Ar(e)){this.expire_days=Fr(t)?this.default_expiry:t;var n=!1;if(ar(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=nd.campaignParams(this.config.custom_campaign_params);Nr(pr(e))||this.register(nd.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0}}update_search_keyword(){this.register(nd.searchInfo())}update_referrer_info(){this.register_once(nd.referrerInfo(),void 0)}set_initial_person_info(){this.props[Ii]||this.props[ki]||this.register_once({[Ei]:nd.initialPersonInfo()},void 0)}get_referrer_info(){return pr({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};ar([ki,Ii],(t=>{var n=this.props[t];n&&ar(n,(function(t,n){e["$initial_"+vr(n)]=t}))}));var t=this.props[Ei];if(t){var n=nd.initialPersonPropsFromInfo(t);lr(e,n)}return e}safe_merge(e){return ar(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(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()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Jr]||{};n[e]=t,this.props[Jr]=n,this.save()}remove_event_timer(e){var t=(this.props[Jr]||{})[e];return Fr(t)||(delete this.props[Jr][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function od(e){var t,n;return(null===(t=JSON.stringify(e,(n=[],function(e,t){if(Ar(t)){for(;n.length>0&&n.at(-1)!==this;)n.pop();return n.includes(t)?"[Circular]":(n.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function sd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),i=e.data.slice(n);return[sd({size:od(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),sd({size:od(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var ad=(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",e))(ad||{}),ld=(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",e[e.CustomElement=16]="CustomElement",e))(ld||{});function cd(e,t,n,r){return t>n&&(rr.warn("min cannot be greater than max."),t=n),Br(e)?e>n?(r&&rr.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&rr.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&rr.warn(r+" must be a number. Defaulting to max value:"+n),n)}class ud{constructor(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,"bucketSize",100),i(this,"refillRate",10),i(this,"mutationBuckets",{}),i(this,"loggedTracker",{}),i(this,"refillBuckets",(()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))})),i(this,"getNodeOrRelevantParent",(e=>{var t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var n=t.closest("svg");if(n)return[this.rrweb.mirror.getId(n),n]}return[e,t]})),i(this,"numberOfChanges",(e=>{var t,n,r,i,o,s,a,l;return(null!==(t=null===(n=e.removes)||void 0===n?void 0:n.length)&&void 0!==t?t:0)+(null!==(r=null===(i=e.attributes)||void 0===i?void 0:i.length)&&void 0!==r?r:0)+(null!==(o=null===(s=e.texts)||void 0===s?void 0:s.length)&&void 0!==o?o:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),i(this,"throttleMutations",(e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,n=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t,n,r,[i,o]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[i])return!1;(this.mutationBuckets[i]=null!==(t=this.mutationBuckets[i])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[i]=Math.max(this.mutationBuckets[i]-1,0),0===this.mutationBuckets[i])&&(this.loggedTracker[i]||(this.loggedTracker[i]=!0,null===(n=(r=this.options).onBlockedNode)||void 0===n||n.call(r,i,o)));return e})));var r=this.numberOfChanges(t);return 0!==r||n===r?e:void 0})),this.rrweb=e,this.options=r,this.refillRate=cd(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=cd(null!==(n=this.options.bucketSize)&&void 0!==n?n:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}}var dd=Uint8Array,hd=Uint16Array,pd=Uint32Array,vd=new dd([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]),gd=new dd([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]),fd=new dd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),md=function(e,t){for(var n=new hd(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new pd(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]},_d=md(vd,2),yd=_d[0],bd=_d[1];yd[28]=258,bd[258]=28;for(var wd=md(gd,0)[1],Sd=new hd(32768),Cd=0;Cd<32768;++Cd){var Id=(43690&Cd)>>>1|(21845&Cd)<<1;Id=(61680&(Id=(52428&Id)>>>2|(13107&Id)<<2))>>>4|(3855&Id)<<4,Sd[Cd]=((65280&Id)>>>8|(255&Id)<<8)>>>1}var kd=function(e,t,n){for(var r=e.length,i=0,o=new hd(t);i<r;++i)++o[e[i]-1];var s,a=new hd(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new hd(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],d=a[e[i]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[Sd[d]>>>l]=c}else for(s=new hd(r),i=0;i<r;++i)s[i]=Sd[a[e[i]-1]++]>>>15-e[i];return s},Ed=new dd(288);for(Cd=0;Cd<144;++Cd)Ed[Cd]=8;for(Cd=144;Cd<256;++Cd)Ed[Cd]=9;for(Cd=256;Cd<280;++Cd)Ed[Cd]=7;for(Cd=280;Cd<288;++Cd)Ed[Cd]=8;var xd=new dd(32);for(Cd=0;Cd<32;++Cd)xd[Cd]=5;var Td=kd(Ed,9,0),Md=kd(xd,5,0),Rd=function(e){return(e/8>>0)+(7&e&&1)},Ad=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof hd?hd:e instanceof pd?pd:dd)(n-t);return r.set(e.subarray(t,n)),r},Nd=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Fd=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},Od=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 dd(0),0];if(1==i){var s=new dd(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=o[0].s;for(r=1;r<i;++r)o[r].s>h&&(h=o[r].s);var p=new hd(h+1),v=Ld(n[u-1],p,0);if(v>t){r=0;var g=0,f=v-t,m=1<<f;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;g+=m-(1<<v-p[_]),p[_]=t}for(g>>>=f;g>0;){var y=o[r].s;p[y]<t?g-=1<<t-p[y]++-1:++r}for(;r>=0&&g;--r){var b=o[r].s;p[b]==t&&(--p[b],++g)}v=t}return[new dd(p),v]},Ld=function(e,t,n){return-1==e.s?Math.max(Ld(e.l,t,n+1),Ld(e.r,t,n+1)):t[e.s]=n},Pd=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new hd(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},Dd=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Bd=function(e,t,n){var r=n.length,i=Rd(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)},Hd=function(e,t,n,r,i,o,s,a,l,c,u){Nd(t,u++,n),++i[256];for(var d=Od(i,15),h=d[0],p=d[1],v=Od(o,15),g=v[0],f=v[1],m=Pd(h),_=m[0],y=m[1],b=Pd(g),w=b[0],S=b[1],C=new hd(19),I=0;I<_.length;++I)C[31&_[I]]++;for(I=0;I<w.length;++I)C[31&w[I]]++;for(var k=Od(C,7),E=k[0],x=k[1],T=19;T>4&&!E[fd[T-1]];--T);var M,R,A,N,F=c+5<<3,O=Dd(i,Ed)+Dd(o,xd)+s,L=Dd(i,h)+Dd(o,g)+s+14+3*T+Dd(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(F<=O&&F<=L)return Bd(t,u,e.subarray(l,l+c));if(Nd(t,u,1+(L<O)),u+=2,L<O){M=kd(h,p,0),R=h,A=kd(g,f,0),N=g;var P=kd(E,x,0);Nd(t,u,y-257),Nd(t,u+5,S-1),Nd(t,u+10,T-4),u+=14;for(I=0;I<T;++I)Nd(t,u+3*I,E[fd[I]]);u+=3*T;for(var D=[_,w],B=0;B<2;++B){var H=D[B];for(I=0;I<H.length;++I){var q=31&H[I];Nd(t,u,P[q]),u+=E[q],q>15&&(Nd(t,u,H[I]>>>5&127),u+=H[I]>>>12)}}}else M=Td,R=Ed,A=Md,N=xd;for(I=0;I<a;++I)if(r[I]>255){q=r[I]>>>18&31;Fd(t,u,M[q+257]),u+=R[q+257],q>7&&(Nd(t,u,r[I]>>>23&31),u+=vd[q]);var W=31&r[I];Fd(t,u,A[W]),u+=N[W],W>3&&(Fd(t,u,r[I]>>>5&8191),u+=gd[W])}else Fd(t,u,M[r[I]]),u+=R[r[I]];return Fd(t,u,M[256]),u+R[256]},qd=new pd([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wd=function(){for(var e=new pd(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),$d=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Wd[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},Vd=function(e,t,n,r,i){return function(e,t,n,r,i,o){var s=e.length,a=new dd(r+s+5*(1+Math.floor(s/7e3))+i),l=a.subarray(r,a.length-i),c=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?c=Bd(l,c,e.subarray(u,d)):(l[u]=o,c=Bd(l,c,e.subarray(u,s)))}else{for(var h=qd[t-1],p=h>>>13,v=8191&h,g=(1<<n)-1,f=new hd(32768),m=new hd(g+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&g},w=new pd(25e3),S=new hd(288),C=new hd(32),I=0,k=0,E=(u=0,0),x=0,T=0;u<s;++u){var M=b(u),R=32767&u,A=m[M];if(f[R]=A,m[M]=R,x<=u){var N=s-u;if((I>7e3||E>24576)&&N>423){c=Hd(e,l,0,w,S,C,k,E,T,u-T,c),E=I=k=0,T=u;for(var F=0;F<286;++F)S[F]=0;for(F=0;F<30;++F)C[F]=0}var O=2,L=0,P=v,D=R-A&32767;if(N>2&&M==b(u-D))for(var B=Math.min(p,N)-1,H=Math.min(32767,u),q=Math.min(258,N);D<=H&&--P&&R!=A;){if(e[u+O]==e[u+O-D]){for(var W=0;W<q&&e[u+W]==e[u+W-D];++W);if(W>O){if(O=W,L=D,W>B)break;var $=Math.min(D,W-2),V=0;for(F=0;F<$;++F){var Z=u-D+F+32768&32767,G=Z-f[Z]+32768&32767;G>V&&(V=G,A=Z)}}}D+=(R=A)-(A=f[R])+32768&32767}if(L){w[E++]=268435456|bd[O]<<18|wd[L];var U=31&bd[O],j=31&wd[L];k+=vd[U]+gd[j],++S[257+U],++C[j],x=u+O,++I}else w[E++]=e[u],++S[e[u]]}}c=Hd(e,l,o,w,S,C,k,E,T,u-T,c)}return Ad(a,0,r+Rd(c)+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)},Zd=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Gd=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&&Zd(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)}},Ud=function(e){return 10+(e.filename&&e.filename.length+1||0)};function jd(e,t){void 0===t&&(t={});var n=$d(),r=e.length;n.p(e);var i=Vd(e,t,Ud(t),8),o=i.length;return Gd(i,t),Zd(i,o-8,n.d()),Zd(i,o-4,r),i}function zd(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new dd(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;s<n;++s){if(i+5>r.length){var a=new dd(i+8+(n-s<<1));a.set(r),r=a}var l=e.charCodeAt(s);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return Ad(r,0,i)}var Yd=3e5,Xd=[ld.MouseMove,ld.MouseInteraction,ld.Scroll,ld.ViewportResize,ld.Input,ld.TouchMove,ld.MediaInteraction,ld.Drag],Jd=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}),Kd="[SessionRecording]";function Qd(e){return function(e,t){for(var n="",r=0;r<e.length;){var i=e[r++];i<128||t?n+=String.fromCharCode(i):i<224?n+=String.fromCharCode((31&i)<<6|63&e[r++]):i<240?n+=String.fromCharCode((15&i)<<12|(63&e[r++])<<6|63&e[r++]):(i=((15&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}return n}(jd(zd(JSON.stringify(e))),!0)}function eh(e){return e.type===ad.Custom&&"sessionIdle"===e.data.tag}function th(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class nh{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==tr||null===(e=tr.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Kd+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:Yd}get isSampled(){var e=this.instance.get_property(di);return Hr(e)?e:null}get sessionDuration(){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],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return n?n.timestamp-r:null}get isRecordingEnabled(){var e=!!this.instance.get_property(ii),t=!this.instance.config.disable_session_recording;return Vn&&e&&t}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(oi),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,n,r,i,o,s=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(ai),l=null!==(e=null!==(t=null==s?void 0:s.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,c=null!==(n=null!==(r=null==s?void 0:s.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==n?n:0,u=null!==(i=null!==(o=null==s?void 0:s.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==i?i:0;return{enabled:l,fps:cd(c,0,12,"canvas recording fps"),quality:cd(u,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,n=this.instance.get_property(si),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),s=Ar(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(Hr(s)?s:null==n?void 0:n.capturePerformance);return i||o||a?{recordHeaders:i,recordBody:o,recordPerformance:a}:void 0}get sampleRate(){var e=this.instance.get_property(li);return Br(e)?e:null}get minimumDuration(){var e=this.instance.get_property(ci);return Br(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?Dr(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":this._urlBlocked?"paused":Hr(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(hi))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(pi))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(i(this,"queuedRRWebEvents",[]),i(this,"isIdle",!1),i(this,"_linkedFlagSeen",!1),i(this,"_lastActivityTimestamp",Date.now()),i(this,"_linkedFlag",null),i(this,"_removePageViewCaptureHook",void 0),i(this,"_onSessionIdListener",void 0),i(this,"_persistDecideOnSessionListener",void 0),i(this,"_samplingSessionListener",void 0),i(this,"_urlTriggers",[]),i(this,"_urlBlocklist",[]),i(this,"_urlBlocked",!1),i(this,"_eventTriggers",[]),i(this,"_removeEventTriggerCaptureHook",void 0),i(this,"_forceAllowLocalhostNetworkCapture",!1),i(this,"_onBeforeUnload",(()=>{this._flushBuffer()})),i(this,"_onOffline",(()=>{this._tryAddCustomEvent("browser offline",{})})),i(this,"_onOnline",(()=>{this._tryAddCustomEvent("browser online",{})})),i(this,"_onVisibilityChange",(()=>{if(null!=Yn&&Yn.visibilityState){var e="window "+Yn.visibilityState;this._tryAddCustomEvent(e,{})}})),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw rr.error(Kd+" started without valid sessionManager"),new Error(Kd+" started without valid sessionManager. This is a bug.");var{sessionId:t,windowId:n}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=n,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&rr.warn(Kd+" session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),null==Vn||Vn.addEventListener("beforeunload",this._onBeforeUnload),null==Vn||Vn.addEventListener("offline",this._onOffline),null==Vn||Vn.addEventListener("online",this._onOnline),null==Vn||Vn.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Dr(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance._addCaptureHook((e=>{try{if("$pageview"===e){var t=Vn?this._maskUrl(Vn.location.href):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){rr.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,n)=>{var r,i,o,s;n&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:n}),null===(r=this.instance)||void 0===r||null===(i=r.persistence)||void 0===i||i.unregister(pi),null===(o=this.instance)||void 0===o||null===(s=o.persistence)||void 0===s||s.unregister(hi))})))):this.stopRecording()}stopRecording(){var e,t,n,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==Vn||Vn.removeEventListener("beforeunload",this._onBeforeUnload),null==Vn||Vn.removeEventListener("offline",this._onOffline),null==Vn||Vn.removeEventListener("online",this._onOnline),null==Vn||Vn.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(e=this._removePageViewCaptureHook)||void 0===e||e.call(this),this._removePageViewCaptureHook=void 0,null===(t=this._removeEventTriggerCaptureHook)||void 0===t||t.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(r=this._samplingSessionListener)||void 0===r||r.call(this),this._samplingSessionListener=void 0,rr.info(Kd+" stopped"))}makeSamplingDecision(e){var t,n=this.sessionId!==e,r=this.sampleRate;if(Br(r)){var i,o=this.isSampled,s=n||!Hr(o);if(s)i=Math.random()<r;else i=o;s&&(i?this._reportStarted("sampled"):rr.warn(Kd+" Sample rate (".concat(r,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:i})),null===(t=this.instance.persistence)||void 0===t||t.register({[di]:i})}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register({[di]:null})}}afterDecideResponse(e){var t,n,r,i,o,s;(this._persistDecideResponse(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(n=e.sessionRecording)&&void 0!==n&&n.endpoint)&&(this._endpoint=null===(s=e.sessionRecording)||void 0===s?void 0:s.endpoint);if(this._setupSampling(),!Dr(this._linkedFlag)&&!this._linkedFlagSeen){var a=Or(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,l=Or(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((e,t)=>{var n=Ar(t)&&a in t,r=l?t[a]===l:n;r&&this._reportStarted("linked_flag_matched",{linkedFlag:a,linkedVariant:l}),this._linkedFlagSeen=r}))}null!==(r=e.sessionRecording)&&void 0!==r&&r.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(i=e.sessionRecording)&&void 0!==i&&i.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(o=e.sessionRecording)&&void 0!==o&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Br(this.sampleRate)&&Dr(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistDecideResponse(e){if(this.instance.persistence){var n,r=this.instance.persistence,i=()=>{var n,i,o,s,a,l,c,u=null===(n=e.sessionRecording)||void 0===n?void 0:n.sampleRate,d=Dr(u)?null:parseFloat(u),h=null===(i=e.sessionRecording)||void 0===i?void 0:i.minimumDurationMilliseconds;r.register({[ii]:!!e.sessionRecording,[oi]:null===(o=e.sessionRecording)||void 0===o?void 0:o.consoleLogRecordingEnabled,[si]:t({capturePerformance:e.capturePerformance},null===(s=e.sessionRecording)||void 0===s?void 0:s.networkPayloadCapture),[ai]:{enabled:null===(a=e.sessionRecording)||void 0===a?void 0:a.recordCanvas,fps:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasFps,quality:null===(c=e.sessionRecording)||void 0===c?void 0:c.canvasQuality},[li]:d,[ci]:Fr(h)?null:h})};i(),null===(n=this._persistDecideOnSessionListener)||void 0===n||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(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:Date.now()})}_startCapture(e){if(!Fr(Object.assign)&&!Fr(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,n;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=tr.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"recorder",(e=>{if(e)return rr.error(Kd+" could not load recorder",e);this._onScriptLoaded()}));rr.info(Kd+" starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}isInteractiveEvent(e){var t;return 3===e.type&&-1!==Xd.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());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{windowId:r,sessionId:i}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this.sessionId!==i,s=this.windowId!==r;this.windowId=r,this.sessionId=i,o||s?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):rr.warn(Kd+" could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Jd((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Jd((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},r=this.instance.config.session_recording;for(var[i,o]of Object.entries(r||{}))i in n&&("maskInputOptions"===i?n.maskInputOptions=t({password:!0},o):n[i]=o);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 ud(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{var n="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");rr.info(n,{node:t}),this.log(Kd+" "+n,"warn")}});var s=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t({emit:e=>{this.onRRwebEmit(e)},plugins:s},n)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:n,activePlugins:s.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else rr.error(Kd+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_gatherRRWebPlugins(){var e,t,n,r,i=[],o=null===(e=tr.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&i.push(o());var s=null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.rrwebPlugins)||void 0===r?void 0:r.getRecordNetworkPlugin;this.networkPayloadCapture&&Tr(s)&&(!Vr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(s(po(this.instance.config,this.networkPayloadCapture))):rr.info(Kd+" NetworkCapture not started because we are on localhost."));return i}onRRwebEmit(e){var n;if(this._processQueuedEvents(),e&&Ar(e)){if(e.type===ad.Meta){var r=this._maskUrl(e.data.href);if(this._lastHref=r,!r)return;e.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"!==this.status||function(e){return e.type===ad.Custom&&"recording paused"===e.data.tag}(e)){e.type===ad.FullSnapshot&&this._scheduleFullSnapshot(),e.type===ad.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(i){var o=function(e){var t=e;if(t&&Ar(t)&&6===t.type&&Ar(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}(i);if(this._updateWindowAndSessionIds(o),!this.isIdle||eh(o)){if(eh(o)){var s=o.data.payload;if(s){var a=s.lastActivityTimestamp,l=s.threshold;o.timestamp=a+l}}var c=null===(n=this.instance.config.session_recording.compress_events)||void 0===n||n?function(e){if(od(e)<1024)return e;try{if(e.type===ad.FullSnapshot)return t(t({},e),{},{data:Qd(e.data),cv:"2024-10"});if(e.type===ad.IncrementalSnapshot&&e.data.source===ld.Mutation)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{texts:Qd(e.data.texts),attributes:Qd(e.data.attributes),removes:Qd(e.data.removes),adds:Qd(e.data.adds)})});if(e.type===ad.IncrementalSnapshot&&e.data.source===ld.StyleSheetRule)return t(t({},e),{},{cv:"2024-10",data:t(t({},e.data),{},{adds:Qd(e.data.adds),removes:Qd(e.data.removes)})})}catch(e){rr.error(Kd+" could not compress event - will use uncompressed event",e)}return e}(o):o,u={$snapshot_bytes:od(c),$snapshot_data:c,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(u):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&Vn){var e=this._maskUrl(Vn.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(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}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,n=Br(t)&&t>=0,r=Br(e)&&n&&t<e;if("buffering"===this.status||r)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&sd(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId})}));return this.clearBuffer()}_captureSnapshotBuffered(e){var t,n=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+n>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0!==Vn&&Vn.location.href){var e=Vn.location.href,t="paused"===this.status,n=th(e,this._urlBlocklist);n&&!t?this._pauseRecording():!n&&t&&this._resumeRecording(),th(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,n;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register({["url"===e?hi:pi]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==Yn||null===(e=Yn.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),rr.info(Kd+" recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==Yn||null===(e=Yn.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),rr.info(Kd+" recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&Dr(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){rr.error(Kd+"Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[di]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),rr.info(Kd+" "+e.replace("_"," "),t),cr(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}class rh{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}call(){var e={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(fi),group_properties:this.instance.get_property(mi),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:e,compression:this.instance.config.disable_compression?void 0:yr.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>this.parseDecideResponse(e.json)})}parseDecideResponse(e){var t=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var n=!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:{},n),n)rr.error("Failed to fetch feature flags from PostHog.");else{if(!Yn||!Yn.body)return rr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.parseDecideResponse(e)}),500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps){var r=function(e,n){var r,i;tr["__$$ph_site_app_".concat(e)]=t.instance,null===(r=tr.__PosthogExtensions__)||void 0===r||null===(i=r.loadSiteApp)||void 0===i||i.call(r,t.instance,n,(t=>{if(t)return rr.error("Error while initializing PostHog app with config id ".concat(e),t)}))};for(var{id:i,url:o}of e.siteApps)r(i,o)}else e.siteApps.length>0&&rr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}var ih,oh=null!=Vn&&Vn.location?zr(Vn.location.hash,"__posthog")||zr(location.hash,"state"):null,sh="_postHogToolbarParams";!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(ih||(ih={}));class ah{constructor(e){this.instance=e}setToolbarState(e){tr.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=tr.ph_toolbar_state)&&void 0!==e?e:ih.UNINITIALIZED}maybeLoadToolbar(){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(!Vn||!Yn)return!1;n=null!==(e=n)&&void 0!==e?e:Vn.location,i=null!==(t=i)&&void 0!==t?t:Vn.history;try{if(!r){try{Vn.localStorage.setItem("test","test"),Vn.localStorage.removeItem("test")}catch(e){return!1}r=null==Vn?void 0:Vn.localStorage}var o,s=oh||zr(n.hash,"__posthog")||zr(n.hash,"state"),a=s?dr((()=>JSON.parse(atob(decodeURIComponent(s)))))||dr((()=>JSON.parse(decodeURIComponent(s)))):null;return a&&"ph_authorize"===a.action?((o=a).source="url",o&&Object.keys(o).length>0&&(a.desiredHash?n.hash=a.desiredHash:i?i.replaceState(i.state,"",n.pathname+n.search):n.hash="")):((o=JSON.parse(r.getItem(sh)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch(e){return!1}}_callLoadToolbar(e){(tr.ph_load_toolbar||tr.ph_load_editor)(e,this.instance)}loadToolbar(e){var n=!(null==Yn||!Yn.getElementById(Ti));if(!Vn||n)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,i=t(t({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Vn.localStorage.setItem(sh,JSON.stringify(t(t({},i),{},{source:void 0}))),this.getToolbarState()===ih.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===ih.UNINITIALIZED){var o,s;this.setToolbarState(ih.LOADING),null===(o=tr.__PosthogExtensions__)||void 0===o||null===(s=o.loadExternalDependency)||void 0===s||s.call(o,this.instance,"toolbar",(e=>{if(e)return rr.error("Failed to load toolbar",e),void this.setToolbarState(ih.UNINITIALIZED);this.setToolbarState(ih.LOADED),this._callLoadToolbar(i)})),mr(Vn,"turbolinks:load",(()=>{this.setToolbarState(ih.UNINITIALIZED),this.loadToolbar(i)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){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)}}class lh{constructor(e){i(this,"isPaused",!0),i(this,"queue",[]),i(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},n=Object.values(e),r=[...n.filter((e=>0===e.url.indexOf("/e"))),...n.filter((e=>0!==e.url.indexOf("/e")))];r.map((e=>{this.sendRequest(t(t({},e),{},{transport:"sendBeacon"}))}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),n=function(n){var r=t[n],i=(new Date).getTime();r.data&&xr(r.data)&&ar(r.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.sendRequest(r)};for(var r in t)n(r)}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return ar(this.queue,(n=>{var r,i=n,o=(i?i.batchKey:null)||i.url;Fr(e[o])&&(e[o]=t(t({},i),{},{data:[]})),null===(r=e[o].data)||void 0===r||r.push(i.data)})),this.queue=[],e}}var ch=!!Kn||!!Jn,uh="text/plain",dh=(e,n)=>{var[r,i]=e.split("?"),o=t({},n);null==i||i.split("&").forEach((e=>{var[t]=e.split("=");delete o[t]}));var s=Ur(o);return s=s?(i?i+"&":"")+s:i,"".concat(r,"?").concat(s)},hh=e=>{var{data:t,compression:n}=e;if(t){if(n===yr.GZipJS){var r=jd(zd(JSON.stringify(t)),{mtime:0}),i=new Blob([r],{type:uh});return{contentType:uh,body:i,estimatedSize:i.size}}if(n===yr.Base64){var o=function(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=fr(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,u[l++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(JSON.stringify(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=JSON.stringify(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ph=[];Kn&&ph.push({transport:"XHR",method:e=>{var t,n=new Kn;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=null!==(t=hh(e))&&void 0!==t?t:{};ar(e.headers,(function(e,t){n.setRequestHeader(t,e)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(4===n.readyState){var t,r={statusCode:n.status,text:n.responseText};if(200===n.status)try{r.json=JSON.parse(n.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,r)}},n.send(i)}}),Jn&&ph.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:o}=null!==(t=hh(e))&&void 0!==t?t:{},s=new Headers;ar(e.headers,(function(e,t){s.append(t,e)})),r&&s.append("Content-Type",r);var a=e.url,l=null;if(Qn){var c=new Qn;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}Jn(a,{method:(null==e?void 0:e.method)||"GET",headers:s,keepalive:"POST"===e.method&&(o||0)<52428.8,body:i,signal:null===(n=l)||void 0===n?void 0:n.signal}).then((t=>t.text().then((n=>{var r,i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(e){rr.error(e)}null===(r=e.callback)||void 0===r||r.call(e,i)})))).catch((t=>{var n;rr.error(t),null===(n=e.callback)||void 0===n||n.call(e,{statusCode:0,text:t})})).finally((()=>l?clearTimeout(l.timeout):null))}}),null!=zn&&zn.sendBeacon&&ph.push({transport:"sendBeacon",method:e=>{var t=dh(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=null!==(n=hh(e))&&void 0!==n?n:{},o="string"==typeof i?new Blob([i],{type:r}):i;zn.sendBeacon(t,o)}catch(e){}}});var vh=["retriesPerformedSoFar"];class gh{constructor(e){i(this,"isPolling",!1),i(this,"pollIntervalMs",3e3),i(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!Fr(Vn)&&"onLine"in Vn.navigator&&(this.areWeOnline=Vn.navigator.onLine,Vn.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),Vn.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=o(e,vh);Br(n)&&n>0&&(r.url=dh(r.url,{retry_count:n})),this.instance._send_request(t(t({},r),{},{callback:e=>{var i;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=n?n:0)<10?this.enqueue(t({retriesPerformedSoFar:n},r)):null===(i=r.callback)||void 0===i||i.call(r,e)}}))}enqueue(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)"),rr.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){var e=Date.now(),t=[],n=this.queue.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.queue=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(t(t({},e),{},{transport:"sendBeacon"}))}catch(e){rr.error(e)}this.queue=[]}}var fh;class mh{constructor(e,t,n,r){var o;i(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=t,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Zc,this._windowIdGenerator=r||Zc;var s=e.persistence_name||e.token,a=e.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*cd(a,60,1800,"session_idle_timeout_seconds"),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var l=iu.parse(this._window_id_storage_key),c=iu.parse(this._primary_window_exists_storage_key);l&&!c?this._windowId=l:iu.remove(this._window_id_storage_key),iu.set(this._primary_window_exists_storage_key,!0)}if(null!==(o=this.config.bootstrap)&&void 0!==o&&o.sessionID)try{var u=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),u)}catch(e){rr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Fr(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&iu.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&iu.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?iu.parse(this._window_id_storage_key):null}_setSessionId(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[ui]:[t,e,n]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[ui];return xr(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==Vn||Vn.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&&iu.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){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,r,i]=this._getSessionId(),o=this._getWindowId(),s=Br(i)&&i>0&&Math.abs(t-i)>864e5,a=!1,l=!r,c=!e&&Math.abs(t-n)>this.sessionTimeoutMs;l||c||s?(r=this._sessionIdGenerator(),o=this._windowIdGenerator(),rr.info("[SessionId] new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}}),i=t,a=!0):o||(o=this._windowIdGenerator(),a=!0);var u=0===n||!e||s?t:n,d=0===i?(new Date).getTime():i;return this._setWindowId(o),this._setSessionId(r,u,d),a&&this._sessionIdChangedHandlers.forEach((e=>e(r,o,a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:d,changeReason:a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:n}}}!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(fh||(fh={}));var _h="i.posthog.com";class yh{constructor(e){i(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(_h),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=fh.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=fh.EU:this._regionCache[this.apiHost]=fh.CUSTOM),this._regionCache[this.apiHost]}endpointFor(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+t;if(this.region===fh.CUSTOM)return this.apiHost+t;var n=_h+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(n);case"api":return"https://".concat(this.region,".").concat(n)}}}var bh="posthog-js";function wh(e){var{organization:t,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o=>{var s,a,l,c,u;if(!("*"===i||i.includes(o.level))||!e.__loaded)return o;o.tags||(o.tags={});var d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h=(null===(s=o.exception)||void 0===s?void 0:s.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));var p={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:o.level,$exception_list:h,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(c=h[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(u=h[0])||void 0===u?void 0:u.type,$sentry_tags:o.tags,$level:o.level};return t&&n&&(p.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),e.exceptions.sendExceptionEvent(p),o}}class Sh{constructor(e,t,n,r,i){this.name=bh,this.setupOnce=function(o){o(wh(e,{organization:t,projectId:n,prefix:r,severityAllowList:i}))}}}function Ch(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||Zc();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(wi,"identified")),t()},i=n.user();"then"in i&&Tr(i.then)?i.then((e=>r(e))):r(i)}(e,(()=>{n.register((e=>{Promise&&Promise.resolve||rr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,n)=>{var r;if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(rr.info("Segment integration does not have a userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(rr.info("Segment integration has a userId set, identifying with PostHog"),e.identify(t.event.userId));var i=e._calculate_event_properties(n,null!==(r=t.event.properties)&&void 0!==r?r:{},new Date);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class Ih{constructor(e){this._instance=e}doPageView(e){var t,n=this._previousPageViewProperties(e);return this._currentPath=null!==(t=null==Vn?void 0:Vn.location.pathname)&&void 0!==t?t:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=e,n}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,n=this._prevPageviewTimestamp,r=this._instance.scrollManager.getContext();if(!n)return{};var i={};if(r){var{maxScrollHeight:o,lastScrollY:s,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=r;if(!(Fr(o)||Fr(s)||Fr(a)||Fr(l)||Fr(c)||Fr(u)))o=Math.ceil(o),s=Math.ceil(s),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),i={$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:o<=1?1:cd(s/o,0,1),$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:o<=1?1:cd(a/o,0,1),$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:l<=1?1:cd(c/l,0,1),$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:l<=1?1:cd(u/l,0,1)}}return t&&(i.$prev_pageview_pathname=t),n&&(i.$prev_pageview_duration=(e.getTime()-n.getTime())/1e3),i}}class kh{constructor(){i(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.events[e]||[])n(t);for(var r of this.events["*"]||[])r(e,t)}}class Eh{constructor(e){i(this,"_debugEventEmitter",new kh),i(this,"checkStep",((e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t))),i(this,"checkStepEvent",((e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event))),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!Fr(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,n;if(!Fr(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,n;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(n=e.steps)||void 0===n||n.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(n=this.instance)&&void 0!==n&&n.autocapture)){var r,i=new Set;e.forEach((e=>{var t;null===(t=e.steps)||void 0===t||t.forEach((e=>{null!=e&&e.selector&&i.add(null==e?void 0:e.selector)}))})),null===(r=this.instance)||void 0===r||r.autocapture.setElementSelectors(i)}}on(e,t){var n;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(n=this.actionRegistry)||void 0===n?void 0:n.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var n of t.steps)if(this.checkStep(e,n))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(null!=t&&t.url){var n,r=null==e||null===(n=e.properties)||void 0===n?void 0:n.$current_url;if(!r||"string"!=typeof r)return!1;if(!Eh.matchString(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(e,t,n){switch(n){case"regex":return!!Vn&&Gr(e,t);case"exact":return t===e;case"contains":var r=Eh.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return Gr(e,r);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!Eh.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!Eh.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!Eh.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1;if(null!=t&&t.selector){var n,r=null==e||null===(n=e.properties)||void 0===n?void 0:n.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class xh{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;Fr(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter((e=>{var t,n,r,i;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(n=e.conditions)||void 0===n||null===(r=n.actions)||void 0===r||null===(i=r.values)||void 0===i?void 0:i.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new Eh(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,n,r,i,o,s,a,l,c,u;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(n=e.conditions)&&void 0!==n&&null!==(r=n.actions)&&void 0!==r&&r.values&&(null===(i=e.conditions)||void 0===i||null===(o=i.actions)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c||null===(u=c.values)||void 0===u||u.forEach((t=>{if(t&&t.name){var n=this.actionToSurveys.get(t.name);n&&n.push(e.id),this.actionToSurveys.set(t.name,n||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0!==e.filter((e=>{var t,n,r,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r||null===(i=r.values)||void 0===i?void 0:i.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,n,r;null===(t=e.conditions)||void 0===t||null===(n=t.events)||void 0===n||null===(r=n.values)||void 0===r||r.forEach((t=>{if(t&&t.name){var n=this.eventToSurveys.get(t.name);n&&n.push(e.id),this.eventToSurveys.set(t.name,n||[e.id])}}))}))}}onEvent(e,t){var n,r,i=(null===(n=this.instance)||void 0===n||null===(r=n.persistence)||void 0===r?void 0:r.props[yi])||[];if(xh.SURVEY_SHOWN_EVENT_NAME==e&&t&&i.length>0){var o,s=null==t||null===(o=t.properties)||void 0===o?void 0:o.$survey_id;if(s){var a=i.indexOf(s);a>=0&&(i.splice(a,1),this._updateActivatedSurveys(i))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,n,r=(null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n?void 0:n.props[yi])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,n;null===(t=this.instance)||void 0===t||null===(n=t.persistence)||void 0===n||n.register({[yi]:[...new Set(e)]})}getSurveys(){var e,t,n=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[yi];return n||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}i(xh,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Th="[Surveys]",Mh={icontains:e=>!!Vn&&Vn.location.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:e=>!!Vn&&-1===Vn.location.href.toLowerCase().indexOf(e.toLowerCase()),regex:e=>!!Vn&&Gr(Vn.location.href,e),not_regex:e=>!!Vn&&!Gr(Vn.location.href,e),exact:e=>(null==Vn?void 0:Vn.location.href)===e,is_not:e=>(null==Vn?void 0:Vn.location.href)!==e};class Rh{constructor(e){this.instance=e,this._surveyEventReceiver=null}afterDecideResponse(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);null!=n&&n.startsWith(ws)&&e.push(n)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e,t,n,r=null==tr||null===(e=tr.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||r||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new xh(this.instance)),null===(t=tr.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"surveys",(e=>{var t,n;if(e)return rr.error(Th,"Could not load surveys script",e);this._surveyManager=null===(t=tr.__PosthogExtensions__)||void 0===t||null===(n=t.generateSurveys)||void 0===n?void 0:n.call(t,this.instance)})))}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new xh(this.instance));var n=this.instance.get_property(_i);if(n&&!t)return e(n);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{var n;if(200!==t.statusCode||!t.json)return e([]);var r,i=t.json.surveys||[],o=i.filter((e=>{var t,n,r,i,o,s,a,l,c,u,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r?void 0:r.values)&&(null===(i=e.conditions)||void 0===i||null===(o=i.events)||void 0===o||null===(s=o.values)||void 0===s?void 0:s.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));o.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(o));return null===(n=this.instance.persistence)||void 0===n||n.register({[_i]:i}),e(i)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var n,r=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,n,r,i;if(!e.conditions)return!0;var o=null===(t=e.conditions)||void 0===t||!t.url||Mh[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url),s=null===(i=e.conditions)||void 0===i||!i.selector||(null==Yn?void 0:Yn.querySelector(e.conditions.selector));return o&&s})),i=null===(n=this._surveyEventReceiver)||void 0===n?void 0:n.getSurveys(),o=r.filter((e=>{var t,n,r,o,s,a,l,c,u,d;if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;var h=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),p=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),v=(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r?void 0:r.values)&&(null===(o=e.conditions)||void 0===o||null===(s=o.events)||void 0===s?void 0:s.values.length)>0,g=(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d?void 0:d.values.length)>0,f=!v&&!g||(null==i?void 0:i.includes(e.id)),m=this._canActivateRepeatedly(e),_=!(e.internal_targeting_flag_key&&!m)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return h&&p&&_&&f}));return e(o)}),t)}getNextSurveyStep(e,t,n){var r,i=e.questions[t],o=t+1;if(null===(r=i.branching)||void 0===r||!r.type)return t===e.questions.length-1?Lo.End:o;if(i.branching.type===Lo.End)return Lo.End;if(i.branching.type===Lo.SpecificQuestion){if(Number.isInteger(i.branching.index))return i.branching.index}else if(i.branching.type===Lo.ResponseBased){if(i.type===Oo.SingleChoice){var s,a,l=i.choices.indexOf("".concat(n));if(null!==(s=i.branching)&&void 0!==s&&null!==(a=s.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var c=i.branching.responseValues[l];return Number.isInteger(c)?c:c===Lo.End?Lo.End:o}}else if(i.type===Oo.Rating){var u,d;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");var h=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(n,i.scale);if(null!==(u=i.branching)&&void 0!==u&&null!==(d=u.responseValues)&&void 0!==d&&d.hasOwnProperty(h)){var p=i.branching.responseValues[h];return Number.isInteger(p)?p:p===Lo.End?Lo.End:o}}return o}return rr.warn(Th,"Falling back to next question index due to unexpected branching type"),o}_canActivateRepeatedly(e){var t;return Dr(null===(t=tr.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(rr.warn(Th,"canActivateRepeatedly is not defined, must init before calling"),!1):tr.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){Dr(this._surveyManager)?rr.warn(Th,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((t=>{var n=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(n)}))}renderSurvey(e,t){Dr(this._surveyManager)?rr.warn(Th,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((n=>{var r=n.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(r,null==Yn?void 0:Yn.querySelector(t))}))}}class Ah{constructor(e){var t,n;i(this,"serverLimits",{}),i(this,"lastEventRateLimited",!1),i(this,"checkForLimiting",(e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{rr.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void rr.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}})),this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(n=e.config.rate_limiting)||void 0===n?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=(new Date).getTime(),o=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Ci))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:i};o.tokens+=(i-o.last)/1e3*this.captureEventsPerSecond,o.last=i,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||r||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,null===(n=this.instance.persistence)||void 0===n||n.set_property(Ci,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Nh=()=>t({initialPathName:(null==Xn?void 0:Xn.pathname)||"",referringDomain:nd.referringDomain()},nd.campaignParams());class Fh{constructor(e,t,n){i(this,"_onSessionIdCallback",(e=>{var t=this._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[Si]:n})}})),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=n||Nh,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[Si]}getSessionProps(){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}:{}}}var Oh=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","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","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Lh=function(e,t){if(!e)return!1;var n=e.toLowerCase();return Oh.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==n.indexOf(t)}))},Ph=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Lh(n,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>Lh(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},Dh="[Dead Clicks]",Bh=()=>!0,Hh=e=>{var t,n=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(ni)),r=e.instance.config.capture_dead_clicks;return Hr(r)?r:n};class qh{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}afterDecideResponse(e){this.instance.persistence&&this.instance.persistence.register({[ni]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,n,r;null!==(t=tr.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"dead-clicks-autocapture",(t=>{t?rr.error(Dh+" failed to load script",t):e()}))}start(){var e;if(Yn){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=tr.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=Ar(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=tr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(Yn),rr.info("".concat(Dh," starting..."))}}else rr.error(Dh+" `document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,rr.info("".concat(Dh," stopping...")))}}class Wh{constructor(e){var t;i(this,"rageclicks",new Cc),i(this,"_enabledServerSide",!1),i(this,"_initialized",!1),i(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[Qr]),null==Vn||Vn.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){var e=5e3;return Ar(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Fr(this.instance.config.capture_heatmaps)?Fr(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;rr.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}afterDecideResponse(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Qr]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){Vn&&Yn&&(mr(Yn,"click",(e=>this._onClick(e||(null==Vn?void 0:Vn.event))),!1,!0),mr(Yn,"mousemove",(e=>this._onMouseMove(e||(null==Vn?void 0:Vn.event))),!1,!0),this.deadClicksCapture=new qh(this.instance,Bh,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),o=function(e,t,n){for(var r=e;r&&Ai(r)&&!Ni(r,"body");){if(r===n)return!1;if(cr(t,null==Vn?void 0:Vn.getComputedStyle(r).position))return!0;r=$i(r)}return!1}(qi(e),["fixed","sticky"],i);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}_onClick(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!Ri(e.target)){var i=this._getProperties(e,r);null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(t(t({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){Ri(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(Vn){var t=Vn.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}flush(){this.buffer&&!Nr(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class $h{constructor(e){i(this,"_updateScrollData",(()=>{var e,t,n,r;this.context||(this.context={});var i=this.scrollElement(),o=this.scrollY(),s=i?Math.max(0,i.scrollHeight-i.clientHeight):0,a=o+((null==i?void 0:i.clientHeight)||0),l=(null==i?void 0:i.scrollHeight)||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(s,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(n=this.context.maxContentY)&&void 0!==n?n:0),this.context.maxContentHeight=Math.max(l,null!==(r=this.context.maxContentHeight)&&void 0!==r?r:0)})),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){null==Vn||Vn.addEventListener("scroll",this._updateScrollData,!0),null==Vn||Vn.addEventListener("scrollend",this._updateScrollData,!0),null==Vn||Vn.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==Vn?void 0:Vn.document.documentElement;var e=xr(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var t of e){var n=null==Vn?void 0:Vn.document.querySelector(t);if(n)return n}}scrollY(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Vn&&(Vn.scrollY||Vn.pageYOffset||Vn.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Vn&&(Vn.scrollX||Vn.pageXOffset||Vn.document.documentElement.scrollLeft)||0}}class Vh{constructor(e){i(this,"_restoreXHRPatch",void 0),i(this,"_restoreFetchPatch",void 0),i(this,"_startCapturing",(()=>{var e,t,n,r;Fr(this._restoreXHRPatch)&&(null===(e=tr.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));Fr(this._restoreFetchPatch)&&(null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.tracingHeadersPatchFns)||void 0===r||r._patchFetch(this.instance.sessionManager))})),this.instance=e}_loadScript(e){var t,n,r;null!==(t=tr.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"tracing-headers",(t=>{if(t)return rr.error("[TRACING-HEADERS] failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Zh;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Zh||(Zh={}));class Gh{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Zh.DENIED:this.storedConsent}isOptedOut(){return this.consent===Zh.DENIED||this.consent===Zh.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return"1"===e?Zh.GRANTED:"0"===e?Zh.DENIED:Zh.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?Kc:Xc;var t="localStorage"===e?Xc:Kc;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!_r([null==zn?void 0:zn.doNotTrack,null==zn?void 0:zn.msDoNotTrack,tr.doNotTrack],(e=>cr([!0,1,"1","yes"],e)))}}var Uh="[Exception Autocapture]";class jh{constructor(e){var t;i(this,"originalOnUnhandledRejectionHandler",void 0),i(this,"startCapturing",(()=>{var e,t,n,r;if(Vn&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var i=null===(e=tr.__PosthogExtensions__)||void 0===e||null===(t=e.errorWrappingFunctions)||void 0===t?void 0:t.wrapOnError,o=null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.errorWrappingFunctions)||void 0===r?void 0:r.wrapUnhandledRejection;if(i&&o)try{this.unwrapOnError=i(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){rr.error(Uh+" failed to start",e),this.stopCapturing()}else rr.error(Uh+" failed to load error wrapping functions - cannot start")}})),this.instance=e,this.remoteEnabled=!(null===(t=this.instance.persistence)||void 0===t||!t.props[ei]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var e;return!(null==Vn||null===(e=Vn.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(rr.info(Uh+" enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,n;this.hasHandlers&&e(),null===(t=tr.__PosthogExtensions__)||void 0===t||null===(n=t.loadExternalDependency)||void 0===n||n.call(t,this.instance,"exception-autocapture",(t=>{if(t)return rr.error(Uh+" failed to load script",t);e()}))}stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}afterDecideResponse(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[ei]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}var zh=9e5,Yh="[Web Vitals]";class Xh{constructor(e){var n;i(this,"_enabledServerSide",!1),i(this,"_initialized",!1),i(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),i(this,"_flushToCapture",(()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,n)=>t(t({},e),{},{["$web_vitals_".concat(n.name,"_event")]:t({},n),["$web_vitals_".concat(n.name,"_value")]:n.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),i(this,"_addToBuffer",(e=>{var n,r=null===(n=this.instance.sessionManager)||void 0===n?void 0:n.checkAndGetSessionAndWindowId(!0);if(Fr(r))rr.error(Yh+"Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this._currentURL();if(!Fr(i))if(Dr(null==e?void 0:e.name)||Dr(null==e?void 0:e.value))rr.error(Yh+"Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)rr.error(Yh+"Ignoring metric with value >= "+this._maxAllowedValue,e);else this.buffer.url!==i&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Fr(this.buffer.url)&&(this.buffer.url=i),this.buffer.firstMetricTimestamp=Fr(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(t(t({},e),{},{$current_url:i,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}})),i(this,"_startCapturing",(()=>{var e,t,n,r,i=tr.__PosthogExtensions__;Fr(i)||Fr(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this._addToBuffer.bind(this)),this._initialized=!0):rr.error(Yh+"web vitals callbacks not loaded - not starting")})),this.instance=e,this._enabledServerSide=!(null===(n=this.instance.persistence)||void 0===n||!n.props[ti]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=Ar(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Fr(n)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[ri])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ar(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=Ar(this.instance.config.capture_performance)&&Br(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:zh;return 0<e&&e<=6e4?zh:e}get isEnabled(){var e=Ar(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Hr(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(rr.info(Yh+" enabled, starting..."),this.loadScript(this._startCapturing))}afterDecideResponse(e){var t=Ar(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ar(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[ti]:t}),this.instance.persistence.register({[ri]:n})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,n,r;null!==(t=tr.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(n=tr.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"web-vitals",(t=>{t?rr.error(Yh+" failed to load script",t):e()}))}_currentURL(){var e=Vn?Vn.location.href:void 0;return e||rr.error(Yh+"Could not determine current URL"),e}}var Jh={icontains:(e,t)=>!!Vn&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Vn&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!Vn&&Gr(t.href,e),not_regex:(e,t)=>!!Vn&&!Gr(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Kh{constructor(e){var t=this;i(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.getWebExperiments((e=>{Kh.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key&&t._featureFlags&&t._featureFlags[e.feature_flag_key]){var n;if(t._flagToExperiments)Kh.logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(n=t._flagToExperiments)||void 0===n||n.set(e.feature_flag_key,e);var r=t._featureFlags[e.feature_flag_key];r&&e.variants[r]&&t.applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var i in e.variants){var o=e.variants[i];Kh.matchesTestVariant(o)&&t.applyTransforms(e.name,i,o.transforms)}}))}),e)})),this.instance=e;this.instance.onFeatureFlags&&this.instance.onFeatureFlags((e=>{this.applyFeatureFlagChanges(e)})),this._flagToExperiments=new Map}applyFeatureFlagChanges(e){Dr(this._flagToExperiments)||this.instance.config.disable_web_experiments||(Kh.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var n,r=this.instance.getFeatureFlag(e),i=null===(n=this._flagToExperiments)||void 0===n?void 0:n.get(e);r&&null!=i&&i.variants[r]&&this.applyTransforms(i.name,r,i.variants[r].transforms)}})))}afterDecideResponse(e){this._is_bot()?Kh.logInfo("Refusing to render web experiment since the viewer is a likely bot"):(this._featureFlags=e.featureFlags,this.loadIfEnabled(),this.previewWebExperiment())}previewWebExperiment(){var e=Kh.getWindowLocation();if(null!=e&&e.search){var t=jr(null==e?void 0:e.search,"__experiment_id"),n=jr(null==e?void 0:e.search,"__experiment_variant");t&&n&&(Kh.logInfo("previewing web experiments ".concat(t," && ").concat(n)),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),n,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.instance.config.disable_web_experiments&&!n)return e([]);var r=this.instance.get_property("$web_experiments");if(r&&!t)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var n=t.json.experiments||[];return e(n)}})}showPreviewWebExperiment(e,t,n){var r=n.filter((t=>t.id===e));r&&r.length>0&&(Kh.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(r[0].name,t,r[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!Dr(e.conditions)&&(Kh.matchUrlConditions(e)&&Kh.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(Dr(e.conditions)||Dr(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;var n,r,i,o=Kh.getWindowLocation();return!!o&&(null===(n=e.conditions)||void 0===n||!n.url||Jh[null!==(r=null===(i=e.conditions)||void 0===i?void 0:i.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return null==Vn?void 0:Vn.location}static matchUTMConditions(e){var t;if(Dr(e.conditions)||Dr(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var n=nd.campaignParams();if(n.utm_source){var r,i,o,s,a,l,c,u,d,h,p,v,g,f,m,_,y=null===(r=e.conditions)||void 0===r||null===(i=r.utm)||void 0===i||!i.utm_campaign||(null===(o=e.conditions)||void 0===o||null===(s=o.utm)||void 0===s?void 0:s.utm_campaign)==n.utm_campaign,b=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(c=e.conditions)||void 0===c||null===(u=c.utm)||void 0===u?void 0:u.utm_source)==n.utm_source,w=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(p=e.conditions)||void 0===p||null===(v=p.utm)||void 0===v?void 0:v.utm_medium)==n.utm_medium,S=null===(g=e.conditions)||void 0===g||null===(f=g.utm)||void 0===f||!f.utm_term||(null===(m=e.conditions)||void 0===m||null===(_=m.utm)||void 0===_?void 0:_.utm_term)==n.utm_term;return y&&w&&S&&b}return!1}static logInfo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];rr.info("[WebExperiments] ".concat(e),n)}applyTransforms(e,t,n,r){var i;this._is_bot()?Kh.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?n.forEach((n=>{if(n.selector){var i;Kh.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),n);var o,s=0,a=null===(i=document)||void 0===i?void 0:i.querySelectorAll(n.selector);if(null==a||a.forEach((e=>{var t=e;s+=1,n.attributes&&n.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),n.text&&(t.innerText=n.text),n.html&&(t.parentElement?t.parentElement.innerHTML=n.html:t.innerHTML=n.html),n.css&&t.setAttribute("style",n.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:r,$web_experiment_document_url:null===(o=Kh.getWindowLocation())||void 0===o?void 0:o.href,$web_experiment_elements_modified:s})}})):(Kh.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:r,$web_experiment_variant:t,$web_experiment_document_url:null===(i=Kh.getWindowLocation())||void 0===i?void 0:i.href,$web_experiment_elements_modified:0}))}_is_bot(){return zn&&this.instance?Ph(zn,this.instance.config.custom_blocked_useragents):void 0}}class Qh{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var ep={},tp=()=>{},np="posthog",rp=!ch&&-1===(null==er?void 0:er.indexOf("MSIE"))&&-1===(null==er?void 0:er.indexOf("Mozilla")),ip=()=>{var e,t,n;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(t=null==Yn?void 0:Yn.location,n=null==t?void 0:t.hostname,!!Or(n)&&"herokuapp.com"!==n.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",loaded:tp,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Xn&&Or(null==Xn?void 0:Xn.search)&&-1!==Xn.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Vn||null===(e=Vn.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_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:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;rr.error(t)},get_device_id:e=>e,_onCapture:tp,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},op=e=>{var t={};Fr(e.process_person)||(t.person_profiles=e.process_person),Fr(e.xhr_headers)||(t.request_headers=e.xhr_headers),Fr(e.cookie_name)||(t.persistence_name=e.cookie_name),Fr(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var n=lr({},t,e);return xr(e.property_blacklist)&&(Fr(e.property_denylist)?n.property_denylist=e.property_blacklist:xr(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:rr.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class sp{constructor(){i(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){rr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ap{constructor(){i(this,"webPerformance",new sp),i(this,"version",$n.LIB_VERSION),i(this,"_internalEventEmitter",new kh),this.config=ip(),this.decideEndpointWasHit=!1,this.SentryIntegration=Sh,this.sentryIntegration=e=>function(e,t){var n=wh(e,t);return{name:bh,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new Dc(this),this.toolbar=new ah(this),this.scrollManager=new $h(this),this.pageViewManager=new Ih(this),this.surveys=new Rh(this),this.experiments=new Kh(this),this.exceptions=new Qh(this),this.rateLimiter=new Ah(this),this.requestRouter=new yh(this),this.consent=new Gh(this),this.people={set:(e,t,n)=>{var r=Or(e)?{[e]:t}:e;this.setPersonProperties(r),null==n||n({})},set_once:(e,t,n)=>{var r=Or(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==n||n({})}},this.on("eventCaptured",(e=>rr.info('send "'.concat(null==e?void 0:e.event,'"'),e)))}init(e,t,n){if(n&&n!==np){var r,i=null!==(r=ep[n])&&void 0!==r?r:new ap;return i._init(e,t,n),ep[n]=i,ep[np][n]=i,i}return this._init(e,t,n)}_init(e){var n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(Fr(e)||Lr(e))return rr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return rr.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(lr({},ip(),op(i),{name:o,token:e})),this.config.on_xhr_error&&rr.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:yr.GZipJS,this.persistence=new id(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new id(t(t({},this.config),{},{persistence:"sessionStorage"}));var s=t({},this.persistence.props),a=t({},this.sessionPersistence.props);if(this._requestQueue=new lh((e=>this._send_retriable_request(e))),this._retryQueue=new gh(this),this.__request_queue=[],this.sessionManager=new mh(this.config,this.persistence),this.sessionPropsManager=new Fh(this.sessionManager,this.persistence),new Vh(this).startIfEnabledOrStop(),this.sessionRecording=new nh(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Tc(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Wh(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Xh(this),this.exceptionObserver=new jh(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new qh(this,Hh),this.deadClicksAutocapture.startIfEnabled(),$n.DEBUG=$n.DEBUG||this.config.debug,$n.DEBUG&&rr.info("Starting in debug mode",{this:this,config:i,thisC:t({},this.config),p:s,s:a}),this._sync_opt_out_with_persistence(),void 0!==(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)){var l,c,u=this.config.get_device_id(Zc()),d=null!==(l=i.bootstrap)&&void 0!==l&&l.isIdentifiedID?u:i.bootstrap.distinctID;this.persistence.set_property(wi,null!==(c=i.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:d})}if(this._hasBootstrappedFeatureFlags()){var h,p,v=Object.keys((null===(h=i.bootstrap)||void 0===h?void 0:h.featureFlags)||{}).filter((e=>{var t,n;return!(null===(t=i.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])})).reduce(((e,t)=>{var n,r;return e[t]=(null===(n=i.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),g=Object.keys((null===(p=i.bootstrap)||void 0===p?void 0:p.featureFlagPayloads)||{}).filter((e=>v[e])).reduce(((e,t)=>{var n,r,o,s;null!==(n=i.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(o=i.bootstrap)||void 0===o||null===(s=o.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:g})}if(!this.get_distinct_id()){var f=this.config.get_device_id(Zc());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(wi,"anonymous")}return null==Vn||null===(r=Vn.addEventListener)||void 0===r||r.call(Vn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),i.segment?Ch(this,(()=>this._loaded())):this._loaded(),Tr(this.config._onCapture)&&this.config._onCapture!==tp&&(rr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_afterDecideResponse(e){var t,n,r,i,o,s,a,l,c;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=cr(e.supportedCompression,yr.GZipJS)?yr.GZipJS:cr(e.supportedCompression,yr.Base64)?yr.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(n=this.sessionRecording)||void 0===n||n.afterDecideResponse(e),null===(r=this.autocapture)||void 0===r||r.afterDecideResponse(e),null===(i=this.heatmaps)||void 0===i||i.afterDecideResponse(e),null===(o=this.experiments)||void 0===o||o.afterDecideResponse(e),null===(s=this.surveys)||void 0===s||s.afterDecideResponse(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.afterDecideResponse(e),null===(l=this.exceptionObserver)||void 0===l||l.afterDecideResponse(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.afterDecideResponse(e)}_loaded(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){rr.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),e||(new rh(this).call(),this.featureFlags.resetRequestQueue())}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||sr(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(rp?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=dh(e.url,{ip:this.config.ip?1:0}),e.headers=t({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,(e=>{var n,r,i,o=t({},e);o.timeout=o.timeout||6e4,o.url=dh(o.url,{_:(new Date).getTime().toString(),ver:$n.LIB_VERSION,compression:o.compression});var s=null!==(n=o.transport)&&void 0!==n?n:"XHR",a=null!==(r=null===(i=_r(ph,(e=>e.transport===s)))||void 0===i?void 0:i.method)&&void 0!==r?r:ph[0].method;if(!a)throw new Error("No available transport method");a(o)})(t(t({},e),{},{callback:t=>{var n,r,i;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(r=(i=this.config).on_request_error)||void 0===r||r.call(i,t));null===(n=e.callback)||void 0===n||n.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,n=[],r=[],i=[];sr(e,(e=>{e&&(t=e[0],xr(t)?i.push(e):Tr(e)?e.call(this):xr(e)&&"alias"===t?n.push(e):xr(e)&&-1!==t.indexOf("capture")&&Tr(this[t])?i.push(e):r.push(e))}));var o=function(e,t){sr(e,(function(e){if(xr(e[0])){var n=t;ar(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};o(n,this),o(r,this),o(i,this)}_hasBootstrappedFeatureFlags(){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}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Fr(e)&&Or(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=(null==r?void 0:r.timestamp)||s,l={uuid:Zc(),event:e,properties:this._calculate_event_properties(e,n||{},a)};o&&(l.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==r?void 0:r.$set)&&(l.$set=null==r?void 0:r.$set);var c=this._calculate_set_once_properties(null==r?void 0:r.$set_once);c&&(l.$set_once=c),(l=gr(l,null!=r&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,Fr(null==r?void 0:r.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=s);var u=t(t({},l.properties.$set),l.$set);if(Nr(u)||this.setPersonPropertiesForFlags(u),!Dr(this.config.before_send)){var d=this._runBeforeSend(l);if(!d)return;l=d}this._internalEventEmitter.emit("eventCaptured",l);var h={method:"POST",url:null!==(i=null==r?void 0:r._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(h):this._requestQueue.enqueue(h),l}rr.critical("This capture call is ignored due to client rate limiting.")}}else rr.error("No event name provided to posthog.capture")}else rr.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,n,r){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(e),o=t({},n);if(o.token=this.config.token,"$snapshot"===e){var s=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!Or(o.distinct_id)&&!Br(o.distinct_id)||Lr(o.distinct_id))&&rr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var a=nd.properties();if(this.sessionManager){var{sessionId:l,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId();o.$session_id=l,o.$window_id=c}if(this.requestRouter.region===fh.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var u=this.sessionPropsManager.getSessionProps();o=lr(o,u)}if(!this.config.disable_scroll_properties){var d={};"$pageview"===e?d=this.pageViewManager.doPageView(r):"$pageleave"===e&&(d=this.pageViewManager.doPageLeave(r)),o=lr(o,d)}if("$pageview"===e&&Yn&&(o.title=Yn.title),!Fr(i)){var h=r.getTime()-i;o.$duration=parseFloat((h/1e3).toFixed(3))}er&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=lr({},a,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),xr(this.config.property_denylist)?ar(this.config.property_denylist,(function(e){delete o[e]})):rr.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(o=p(o,e));var v=this._hasPersonProcessing();return o.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),o}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=lr({},this.persistence.get_initial_props(),e||{}),n=this.config.sanitize_properties;return n&&(t=n(t,"$set_once")),Nr(t)?void 0:t}register(e,t){var n;null===(n=this.persistence)||void 0===n||n.register(e,t)}register_once(e,t,n){var r;null===(r=this.persistence)||void 0===r||r.register_once(e,t,n)}register_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,n;return null!==(t=null===(n=this.sessionManager)||void 0===n?void 0:n.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}identify(e,t,n){if(!this.__loaded||!this.persistence)return rr.uninitializedWarning("posthog.identify");if(Br(e)&&(e=e.toString(),rr.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()))rr.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 if(this._requirePersonProcessing("posthog.identify")){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(Xr)&&(this.unregister(Xr),this.register({distinct_id:e}));var o="anonymous"===(this.persistence.get_property(wi)||"anonymous");e!==r&&o?(this.persistence.set_property(wi,"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(bi))}}else rr.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,n,r){if(e&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},i),{},{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else rr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,o;if(rr.info("reset"),!this.__loaded)return rr.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(n=this.sessionPersistence)||void 0===n||n.clear(),null===(r=this.surveys)||void 0===r||r.reset(),null===(i=this.persistence)||void 0===i||i.set_property(wi,"anonymous"),null===(o=this.sessionManager)||void 0===o||o.resetSessionId();var a=this.config.get_device_id(Zc());this.register_once({distinct_id:a,$device_id:e?a:s},"")}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(null!=e&&e.withTimestamp&&n){var i,o=null!==(i=e.timestampLookBack)&&void 0!==i?i:10;if(!n)return r;var s=Math.max(Math.floor(((new Date).getTime()-n)/1e3)-o,0);r+="?t=".concat(s)}return r}alias(e,t){return e===this.get_property(Yr)?(rr.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Fr(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Xr,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(rr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n,r,i,o,s=t({},this.config);Ar(e)&&(lr(this.config,op(e)),null===(n=this.persistence)||void 0===n||n.update_config(this.config,s),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new id(t(t({},this.config),{},{persistence:"sessionStorage"})),Kc.is_supported()&&"true"===Kc.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&($n.DEBUG=!0,rr.info("set_config",{config:e,oldConfig:s,newConfig:t({},this.config)})),null===(r=this.sessionRecording)||void 0===r||r.startIfEnabledOrStop(),null===(i=this.autocapture)||void 0===i||i.startIfEnabled(),null===(o=this.heatmaps)||void 0===o||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=!0===e,n={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,i,o,s,a;if(null===(r=this.sessionManager)||void 0===r||r.checkAndGetSessionAndWindowId(),n.sampling)null===(i=this.sessionRecording)||void 0===i||i.overrideSampling();if(n.linked_flag)null===(o=this.sessionRecording)||void 0===o||o.overrideLinkedFlag();if(n.url_trigger)null===(s=this.sessionRecording)||void 0===s||s.overrideTrigger("url");if(n.event_trigger)null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started)}captureException(e,n){var r,i=new Error("PostHog syntheticException"),o=Tr(null===(r=tr.__PosthogExtensions__)||void 0===r?void 0:r.parseErrorAsProperties)?tr.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:i}):t({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},n);this.exceptions.sendExceptionEvent(o)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:np;return t!==np&&(t=np+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(wi))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(wi))}_hasPersonProcessing(){var e,t,n,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Nr(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[Xr])&&(null===(n=this.persistence)||void 0===n||null===(r=n.props)||void 0===r||!r[xi]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(rr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(xi,!0),!0)}_sync_opt_out_with_persistence(){var e,t,n,r,i=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||i&&!!o;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==s&&(null===(n=this.persistence)||void 0===n||n.set_disabled(s));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==s&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(s))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),Fr(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return zn?Ph(zn,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Yn&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:Yn.title},{send_instantly:!0}))}debug(e){!1===e?(null==Vn||Vn.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==Vn||Vn.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}))}_runBeforeSend(e){if(Dr(this.config.before_send))return e;var t=xr(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),Dr(n)){var i="Event '".concat(e.event,"' was rejected in beforeSend function");return $r(e.event)?rr.warn("".concat(i,". This can cause unexpected behavior.")):rr.info(i),null}n.properties&&!Nr(n.properties)||rr.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return n}}!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=hr(e.prototype[t[n]])}(ap,["identify"]);var lp,cp;lp=ep[np]=new ap,(cp=tr.posthog)&&ar(cp._i,(function(e){if(e&&xr(e)){var t=lp.init(e[0],e[1],e[2]),n=cp[e[2]]||cp;t&&(t._execute_array.call(t.people,n.people),t._execute_array(n))}})),tr.posthog=lp,function(){function e(){e.done||(e.done=!0,rp=!1,ar(ep,(function(e){e._dom_loaded()})))}null!=Yn&&Yn.addEventListener&&("complete"===Yn.readyState?e():Yn.addEventListener("DOMContentLoaded",e,!1)),Vn&&mr(Vn,"load",e,!0)}()}();
11
2
  //# sourceMappingURL=array.full.no-external.js.map