posthog-js 1.410.2 → 1.410.3

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.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t,r,i,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,n)}function t(t){return function(){var r=this,i=arguments;return new Promise((function(n,s){var o=t.apply(r,i);function a(t){e(o,n,s,a,l,"next",t)}function l(t){e(o,n,s,a,l,"throw",t)}a(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},r.apply(null,arguments)}function i(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}var n,s=["type"],o=Object.defineProperty,a=(e,t,r)=>((e,t,r)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),l=(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))(l||{}),u=(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))(u||{}),c=(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))(c||{}),d=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(d||{}),h=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(h||{}),p=(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))(p||{}),_=(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))(_||{});function g(e,t){return-1!==e.indexOf(t)}var v={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},f={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},m={};function y(e){if(m[e])return m[e];var t=function(e){var t,r,i=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in v?v[e]:void 0,n=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),s=e in f?f[e]:void 0,o=Boolean(s&&s.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(n&&o)return m[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var c=u[e].prototype;return c?(function(e){return g(e,"AppleWebKit")&&!g(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),m[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var b={};function S(e,t,r){var i,n=e+"."+String(r);if(b[n])return b[n].call(t);var s=y(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(b[n]=o,o.call(t)):t[r]}var w={};function k(e,t,r){var i=e+"."+String(r);if(w[i])return w[i].bind(t);var n=y(e)[r];return"function"!=typeof n?t[r]:(w[i]=n,n.bind(t))}function x(){return y("MutationObserver").constructor}function C(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n={next:i},s=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return n.next.apply(this,t)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else e[t]=n.next}}catch(e){return()=>{}}}var I={childNodes:e=>S("Node",e,"childNodes"),parentNode:e=>S("Node",e,"parentNode"),parentElement:e=>S("Node",e,"parentElement"),textContent:e=>S("Node",e,"textContent"),contains:(e,t)=>k("Node",e,"contains")(t),getRootNode:e=>k("Node",e,"getRootNode")(),host:e=>e&&"host"in e?S("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?S("Element",e,"shadowRoot"):null,querySelector:(e,t)=>k("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>k("Element",e,"querySelectorAll")(t),mutationObserver:x,patch:C};function E(e){return e.nodeType===e.ELEMENT_NODE}function T(e){var t=e&&"host"in e&&"mode"in e&&I.host(e)||null;return Boolean(t&&"shadowRoot"in t&&I.shadowRoot(t)===e)}function M(e){return"[object ShadowRoot]"==={}.toString.call(e)}function R(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(i=Array.from(t,(e=>P(e,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(e){return null}var i}function P(e,t){var r;if(function(e){return"styleSheet"in e}(e)){var i;try{i=R(e.styleSheet)||function(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return U(i,e.styleSheet.href)}catch(e){}return i}var n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?U(n,t):n}class F{constructor(){a(this,"idNodeMap",new Map),a(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-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);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e))),E(e)){var r=I.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function L(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,n=e.type,s=e.maskInputFn,o=e.value||"",a=n&&A(n);return(r[i.toLowerCase()]||a&&r[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function A(e){return e.toLowerCase()}var O="__rrweb_original__";function D(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}catch(e){return null}}var N=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,B=/^(?:[a-z+]+:)?\/\//i,q=/^www\..*/i,H=/^(data:)([^,]*),(.*)/i;function U(e,t){return(e||"").replace(N,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(B.test(l)||q.test(l))return"url("+u+l+u+")";if(H.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var c=t.split("/"),d=l.split("/");for(var h of(c.pop(),d))"."!==h&&(".."===h?c.pop():c.push(h));return"url("+u+c.join("/")+u+")"}))}var z,W,V="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",j=4096,G=1,Q=new RegExp("[^a-z0-9-_:]"),Z=-2;function Y(){return G++}var K=/^[^ \t\n\r\u000c]+/,J=/^[, \t\n\r\u000c]+/,X=new WeakMap;function ee(e,t){return t&&""!==t.trim()?te(e,t):t}function te(e,t){var r=X.get(e);if(r||(r=e.createElement("a"),X.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function re(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?V:e}(e,t.maxBase64ImageLength):e}function ie(e,t,r,i,n,s){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&n){var a=null==(o=n.sheet)?void 0:o.href;if(a)return a}var l=ee(e,i);if(l.startsWith("data:")){if("img"===t&&n){var u=l;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(u=function(e,t,r,i){if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>j||e.naturalHeight>j)return t;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(e,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):t}catch(e){return t}}(n,l,s.type,s.quality)),re(u,s)}if("image"===t)return re(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=ee(e,i);return"image"===t&&c.startsWith("data:")?re(c,s):c}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,n=e.exec(t.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(J),t.length>r;){var s=i(K);if(","===s.slice(-1))s=ee(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=ee(e,s);for(var a=!1;;){var l=t.charAt(r);if(""===l){n.push((s+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,n.push((s+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return n.join(", ")}(e,i):"style"===r?U(i,te(e)):"object"===t&&"data"===r?ee(e,i):i:ee(e,i)}function ne(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function se(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&se(I.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&se(I.parentNode(e),t,r)}function oe(e,t,r,i){var n;if(E(e)){if(!I.childNodes(n=e).length)return!1}else{if(null===I.parentElement(e))return!1;n=I.parentElement(e)}try{if("string"==typeof t){if(i){if(n.closest("."+t))return!0}else if(n.classList.contains(t))return!0}else if(se(n,t,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(e){}return!1}function ae(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var le=new Map;function ue(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function ce(e){return null==e?"":e.toLowerCase()}var de=50,he=!1,pe=!1;function _e(e,t){var r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,c=t.inlineStylesheet,d=void 0===c||c,h=t.maskInputOptions,p=void 0===h?{}:h,g=t.maskTextFn,v=t.maskInputFn,f=t.slimDOMOptions,m=t.dataURLOptions,y=void 0===m?{}:m,b=t.inlineImages,S=void 0!==b&&b,w=t.recordCanvas,k=void 0!==w&&w,x=t.canvasMaskingConfigured,C=t.onSerialize,P=t.onIframeLoad,F=t.iframeLoadTimeout,N=void 0===F?5e3:F,B=t.onIframeListenerRegistered,q=t.onStylesheetLoad,H=t.stylesheetLoadTimeout,V=void 0===H?5e3:H,j=t.keepIframeSrcFn,G=void 0===j?()=>!1:j,K=t.newlyAddedElement,J=void 0!==K&&K,X=t.depth,ee=void 0===X?0:X,re=t.maxDepth,se=void 0===re?de:re,ge=t.needsMask,ve=t.preserveWhiteSpace,fe=void 0===ve||ve;if(ee>=se)return pe=!0,he||(he=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+se+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;ge||(ge=oe(e,o,a,void 0===ge));var me,ye=function(e,t){var r=t.doc,i=t.blockClass,n=t.blockSelector,s=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,c=t.maskInputFn,d=t.dataURLOptions,h=void 0===d?{}:d,p=t.inlineImages,g=t.recordCanvas,v=t.canvasMaskingConfigured,f=t.keepIframeSrcFn,m=t.newlyAddedElement,y=void 0!==m&&m,b=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:_.Document,childNodes:[],compatMode:e.compatMode}:{type:_.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:_.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s,o=t.doc,a=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,c=t.maskInputFn,d=t.dataURLOptions,h=void 0===d?{}:d,p=t.inlineImages,g=t.recordCanvas,v=t.canvasMaskingConfigured,f=t.keepIframeSrcFn,m=t.newlyAddedElement,y=void 0!==m&&m,b=t.rootId,S=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),w=function(e){if(e instanceof HTMLFormElement)return"form";var t=A(e.tagName);return Q.test(t)?"div":t}(e),k={},x=e.attributes.length,C=0;x>C;C++){var E=e.attributes[C];ne(w,E.name)||(k[E.name]=ie(o,w,A(E.name),E.value,e,h))}if("link"===w&&a){var T=e.sheet;if(!T){var M=function(e){return e.href}(e);M&&!(T=ue(o,M))&&M.includes(".css")&&(T=ue(o,window.location.origin+"/"+M.replace(window.location.href,"")))}var P=null;T&&(P=R(T)),P&&(delete k.rel,delete k.href,k._cssText=P)}if("style"===w&&e.sheet&&!(e.innerText||I.textContent(e)||"").trim().length){var F=R(e.sheet);F&&(k._cssText=F)}if("input"===w||"textarea"===w||"select"===w){var N=e.value,B=e.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&N?k.value=L({element:e,type:D(e),tagName:w,value:N,maskInputOptions:u,maskInputFn:c}):B&&(k.checked=B)}if("option"===w&&(e.selected&&!u.select?k.selected=!0:delete k.selected),"dialog"===w&&e.open)try{k.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===w&&g&&!(null==v?void 0:v()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var n=t.getImageData;if(new Uint32Array((O in n?n[O]:n).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(k.rr_dataURL=e.toDataURL(h.type,h.quality));else if(!("__context"in e)){var q=e.toDataURL(h.type,h.quality),H=o.createElement("canvas");H.width=e.width,H.height=e.height,q!==H.toDataURL(h.type,h.quality)&&(k.rr_dataURL=q)}if("img"===w&&p){z||(z=o.createElement("canvas"),W=z.getContext("2d"));var U=e,V=U.currentSrc||U.getAttribute("src")||"<unknown-src>",j=U.crossOrigin,G=()=>{ae(U,"load",G);try{z.width=U.naturalWidth,z.height=U.naturalHeight,W.drawImage(U,0,0),k.rr_dataURL=z.toDataURL(h.type,h.quality)}catch(e){if("anonymous"!==U.crossOrigin)return U.crossOrigin="anonymous",void(U.complete&&0!==U.naturalWidth?G():U.addEventListener("load",G));console.warn("Cannot inline img src="+V+"! Error: "+e)}"anonymous"===U.crossOrigin&&(j?k.crossOrigin=j:U.removeAttribute("crossorigin"))};U.complete&&0!==U.naturalWidth?G():U.addEventListener("load",G)}if("audio"===w||"video"===w){var Z=k;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}if(y||(e.scrollLeft&&(k.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(k.rr_scrollTop=e.scrollTop)),S){var Y=e.getBoundingClientRect(),K=Y.width,J=Y.height,X=Y.left,ee=Y.top,te=null==(r=o.defaultView)?void 0:r.getComputedStyle(e);k={class:k.class,rr_width:K+"px",rr_height:J+"px",rr_left:Math.floor(X+((null==(i=o.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(ee+((null==(n=o.defaultView)?void 0:n.scrollY)||0))+"px"},te&&(k.rr_position=te.position||"static",te.transform&&"none"!==te.transform&&(k.rr_transform=te.transform),te.display&&te.display.startsWith("inline")&&(k.rr_display=te.display))}"iframe"!==w||f(k.src)||(e.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(w)&&(s=!0)}catch(e){}return{type:_.Element,tagName:w,attributes:k,childNodes:[],isSVG:(re=e,Boolean("svg"===re.tagName||re.ownerSVGElement)||void 0),needBlock:S,rootId:b,isCustom:s};var re}(e,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:g,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:y,rootId:b});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,n=t.maskTextFn,s=t.rootId,o=I.parentNode(e),a=o&&o.tagName,l=I.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if(null==(r=o.sheet)?void 0:r.cssRules){var d=R(o.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(l=d)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}l=U(l,te(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,I.parentElement(e)):l.replace(/[\S]/g,"*")),{type:_.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:b});case e.CDATA_SECTION_NODE:return{type:_.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:_.Comment,textContent:I.textContent(e)||"",rootId:b};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,keepIframeSrcFn:G,newlyAddedElement:J});if(!ye)return console.warn(e,"not serialized"),null;me=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===_.Comment)return!0;if(e.type===_.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e,t){var r,i;try{i=new URL(e,window.location.href)}catch(e){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(ce(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ce(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ce(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&ce(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ce(e.attributes.property).match(/^(og|twitter|fb):/)||ce(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===ce(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(ce(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ce(e.attributes.name))||ce(e.attributes.property).match(/^article:/)||ce(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ce(e.attributes.name)))return!0}}return!1}(ye,f)||!fe&&ye.type===_.Text&&!ye.isStyle&&!ye.textContent.replace(/^\s+|\s+$/gm,"").length?Z:Y();var be=Object.assign(ye,{id:me});if(i.add(e,be),me===Z)return null;C&&C(e);var Se=!u;if(be.type===_.Element){Se=Se&&!be.needBlock,delete be.needBlock;var we=I.shadowRoot(e);we&&M(we)&&(be.isShadowHost=!0)}if((be.type===_.Document||be.type===_.Element)&&Se){f.headWhitespace&&be.type===_.Element&&"head"===be.tagName&&(fe=!1);var ke={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onIframeListenerRegistered:B,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee+1,maxDepth:se};if(be.type===_.Element&&"textarea"===be.tagName&&void 0!==be.attributes.value);else for(var xe of Array.from(I.childNodes(e))){var Ce=_e(xe,ke);Ce&&be.childNodes.push(Ce)}var Ie=null;if(E(e)&&(Ie=I.shadowRoot(e)))for(var Ee of Array.from(I.childNodes(Ie))){var Te=_e(Ee,ke);Te&&(M(Ie)&&(Te.isShadow=!0),be.childNodes.push(Te))}}var Me=I.parentNode(e);if(Me&&T(Me)&&M(Me)&&(be.isShadow=!0),be.type===_.Element&&"iframe"===be.tagName){var Re=function(e,t,r){var i,n=()=>{},s=e.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(e){return n}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),ae(e,"load",c),e.addEventListener("load",o),t())},c=()=>u();return l=setTimeout(u,r),e.addEventListener("load",c),()=>{null!==l&&(clearTimeout(l),l=null),a?ae(e,"load",o):(a=!0,ae(e,"load",c))}}var d,h="about:blank";try{d=s.location.href}catch(e){return n}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),ae(e,"load",o)}}return e.addEventListener("load",o),()=>{ae(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&P){var r=_e(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onIframeListenerRegistered:B,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee+1,maxDepth:se});r&&P(e,r)}}),N);null==B||B(e,Re)}return be.type===_.Element&&"link"===be.tagName&&"stylesheet"===be.attributes.rel&&function(t,l,u){if(!le.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,_=!1,m=()=>{if(!_){_=!0;try{(()=>{if(q){var t=_e(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee,maxDepth:se});t&&q(e,t)}})()}finally{le.delete(t),h.abort()}}},b=setTimeout(m,u);h.signal.addEventListener("abort",(()=>clearTimeout(b)),{once:!0}),t.addEventListener("load",m,{signal:h.signal,once:!0}),le.set(t,h)}}}(e,0,V),be}function ge(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class ve{constructor(){a(this,"parentElement",null),a(this,"parentNode",null),a(this,"ownerDocument"),a(this,"firstChild",null),a(this,"lastChild",null),a(this,"previousSibling",null),a(this,"nextSibling",null),a(this,"ELEMENT_NODE",1),a(this,"TEXT_NODE",3),a(this,"nodeType"),a(this,"nodeName"),a(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof ve))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"}}function fe(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>me(r,e,t,i)}function me(e,t,r,i){ye((()=>{var n=e.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(e,t,r,i):n.call(e,t,r))}))}function ye(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var be="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.",Se={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be)},has(){return console.error(be),!1},reset(){console.error(be)}};function we(e,t,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];var l=Date.now();n||!1!==r.leading||(n=l);var u=t-(l-n),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),n=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function ke(e,t,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(e){return}s.set.call(this,e)}}}),()=>ke(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Se=new Proxy(Se,{get(e,t,r){return"map"===t&&console.error(be),Reflect.get(e,t,r)}}));var xe=Date.now;function Ce(e){var t,r,i,n,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=I.parentElement(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=I.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function Ie(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ee(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Te(e){return e?e.nodeType===e.ELEMENT_NODE?e:I.parentElement(e):null}function Me(e,t,r,i){if(!e)return!1;var n=Te(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(i&&null!==n.closest("."+t))return!0}else if(se(n,t,i))return!0}catch(e){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Re(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Z}function Pe(e,t){if(T(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=I.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Pe(i,t))}function Fe(e){return Boolean(e.changedTouches)}function Le(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ae(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Oe(e){return!!e&&(e instanceof ve&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(I.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(xe=()=>(new Date).getTime());class De{constructor(){a(this,"id",1),a(this,"styleIDMap",new WeakMap),a(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):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}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 Ne(e){var t,r=null;return"getRootNode"in e&&(null==(t=I.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(e))&&(r=I.host(I.getRootNode(e))),r}function Be(e){var t=e.ownerDocument;return!!t&&(I.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Ne(r);)r=t;return r}(e);return I.contains(t,r)}(e))}function qe(e){return"__ln"in e}class He{constructor(){a(this,"length",0),a(this,"head",null),a(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)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&&qe(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&qe(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.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 $e,Ue=(e,t)=>e+"@"+t;class ze{constructor(){a(this,"frozen",!1),a(this,"locked",!1),a(this,"texts",[]),a(this,"attributes",[]),a(this,"attributeMap",new WeakMap),a(this,"removes",[]),a(this,"mapRemoves",[]),a(this,"movedMap",{}),a(this,"addedSet",new Set),a(this,"movedSet",new Set),a(this,"droppedSet",new Set),a(this,"removesSubTreeCache",new Set),a(this,"mutationCb"),a(this,"blockClass"),a(this,"blockSelector"),a(this,"maskTextClass"),a(this,"maskTextSelector"),a(this,"inlineStylesheet"),a(this,"maskInputOptions"),a(this,"maskTextFn"),a(this,"maskInputFn"),a(this,"keepIframeSrcFn"),a(this,"recordCanvas"),a(this,"canvasMaskingConfigured"),a(this,"inlineImages"),a(this,"slimDOMOptions"),a(this,"dataURLOptions"),a(this,"doc"),a(this,"mirror"),a(this,"iframeManager"),a(this,"stylesheetManager"),a(this,"shadowDomManager"),a(this,"canvasManager"),a(this,"processedNodeManager"),a(this,"unattachedDoc"),a(this,"canvasManagerReleased",!1),a(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),a(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var e=[],t=new Set,r=new He,i=e=>{for(var t=e,r=Z;r===Z;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=I.parentNode(n);if(s&&Be(n)&&"TEXTAREA"!==s.tagName){var o=T(s)?this.mirror.getId(Ne(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=_e(n,{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,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{Le(e,this.mirror)&&this.iframeManager.addIframe(e),Ae(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Oe(n)&&this.shadowDomManager.addShadowRoot(I.shadowRoot(n),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)Ve(this.removesSubTreeCache,s)&&!this.movedSet.has(I.parentNode(s))||n(s);for(var o of this.addedSet)je(this.droppedSet,o)||Ve(this.removesSubTreeCache,o)?je(this.movedSet,o)?n(o):this.droppedSet.add(o):n(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(I.parentNode(a.value)),c=i(a.value);-1!==u&&-1!==c&&(l=a)}if(!l)for(var d=r.tail;d;){var h=d;if(d=d.previous,h){var p=this.mirror.getId(I.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var _=I.parentNode(h.value);if(_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=I.host(_);if(-1!==this.mirror.getId(g)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),n(l.value)}var v={texts:this.texts.map((e=>{var t=e.node,r=I.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{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 t=e.attributes;if("string"==typeof t.style){var r=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+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};(v.texts.length||v.attributes.length||v.removes.length||v.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.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(v))}})),a(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),a(this,"genTextAreaValueMutation",(e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(I.childNodes(e),(e=>I.textContent(e)||"")).join("");t.attributes.value=L({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:D(e),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(e=>{if(!Re(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=I.textContent(e.target);Me(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:oe(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Te(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r=e.target,i=e.attributeName,n=e.target.getAttribute(i);if("value"===i){var s=D(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Me(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;var o=this.attributeMap.get(e.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(o||(this.attributes.push(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,o)),"type"===i&&"INPUT"===r.tagName&&"password"===(e.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!ne(r.tagName,i))if(o.attributes[i]=ie(this.doc,A(r.tagName),A(i),n,r,this.dataURLOptions),"style"===i){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.style.cssText=e.oldValue),Array.from(r.style))){var u=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);u!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?o.styleDiff[l]=""===c?u:[u,c]:o._unchangedStyles[l]=[u,c]}for(var d of Array.from(a.style))""===r.style.getPropertyValue(d)&&(o.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(o.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Me(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 r=this.mirror.getId(t),i=T(e.target)?this.mirror.getId(I.host(e.target)):this.mirror.getId(e.target);Me(e.target,this.blockClass,this.blockSelector,!1)||Re(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(We(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Pe(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ue(r,i)]?We(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!T(e.target)||!M(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),I.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),a(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Re(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[Ue(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Me(e,this.blockClass,this.blockSelector,!1)||(I.childNodes(e).forEach((e=>this.genAdds(e))),Oe(e)&&I.childNodes(I.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","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function We(e,t){e.delete(t),I.childNodes(t).forEach((t=>We(e,t)))}function Ve(e,t,r){return 0!==e.size&&function(e,t,r){var i=I.parentNode(t);return!!i&&e.has(i)}(e,t)}function je(e,t){return 0!==e.size&&Ge(e,t)}function Ge(e,t){var r=I.parentNode(t);return!!r&&(!!e.has(r)||Ge(e,r))}var Qe=e=>$e?function(){try{return e(...arguments)}catch(e){if($e&&!0===$e(e))return;throw e}}:e,Ze=[];function Ye(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 Ke(e,t){var r=new ze;Ze.push(r),r.init(e);var i=new(x())(Qe(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),i.observe(t,n),{observer:i,buffer:r}}function Je(e){var t=e.scrollCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Ye(e);if(o&&!Me(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=Ce(r.defaultView);l=d.left,u=d.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(c)!==h&&(a.set(c,h),t({id:c,x:l,y:u}))}},u=[fe("scroll",Qe(we(Qe((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(fe("scrollend",Qe(l),r)),()=>u.forEach((e=>e()))}function Xe(e,t){for(var r=Ze.length-1;r>=0;r--){var i=Ze[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Ze.splice(r,1))}}}var et=["INPUT","TEXTAREA","SELECT"],tt=new WeakMap;function rt(e){return function e(t,r){if(ot("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var n=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(n)}return r}(e,[])}function it(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}function nt(e,t){var r,i,n,s,o=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:I.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(n=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var t,r;try{r=null==(t=l.set)?void 0:t.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(e){}return r}}),Qe((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function st(e,t){void 0===t&&(t={});var i,n,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var r=e.mutationCb,i=e.mousemoveCb,n=e.mouseInteractionCb,s=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,c=e.styleDeclarationCb,d=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,_=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),n(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...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),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),c(...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),_(...arguments)}}(e,t),e.recordDOM){var o=Ke(e,e.doc);i=o.observer,n=o.buffer}var a,l,h,_,g,v,f,m,y,b=function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,n=e.mirror;if(!1===r.mousemove)return()=>{};var s,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],c=we(Qe((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),d=Qe(we(Qe((e=>{var t=Ye(e),r=Fe(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;s||(s=xe()),l.push({x:i,y:o,id:n.getId(t),timeOffset:xe()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)})),o,{trailing:!1})),h=[fe("mousemove",d,i),fe("touchmove",d,i),fe("drag",d,i)];return Qe((()=>{h.forEach((e=>e()))}))}(e),S=function(e){var t=e.mouseInteractionCb,i=e.doc,n=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.sampling;if(!1===a.mouseInteraction)return()=>{};var l=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[],h=null;return Object.keys(c).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e])).forEach((e=>{var a=A(e),l=(e=>i=>{var a=Ye(i);if(!Me(a,s,o,!0)){var l=null,u=e;if("pointerType"in i){switch(i.pointerType){case"mouse":l=d.Mouse;break;case"touch":l=d.Touch;break;case"pen":l=d.Pen}l===d.Touch&&(c[e]===c.MouseDown?u="TouchStart":c[e]===c.MouseUp&&(u="TouchEnd"))}else Fe(i)&&(l=d.Touch);null!==l?(h=l,(u.startsWith("Touch")&&l===d.Touch||u.startsWith("Mouse")&&l===d.Mouse)&&(l=null)):c[e]===c.Click&&(l=h,h=null);var p=Fe(i)?i.changedTouches[0]:i;if(p){var _=n.getId(a),g=p.clientX,v=p.clientY;Qe(t)(r({type:c[u],id:_,x:g,y:v},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(c[e]){case c.MouseDown:case c.MouseUp:a=a.replace("mouse","pointer");break;case c.TouchStart:case c.TouchEnd:return}u.push(fe(a,l,i))})),Qe((()=>{u.forEach((e=>e()))}))}(e),w=Je(e),k=function(e,t){var r=e.viewportResizeCb,i=t.win,n=-1,s=-1;return fe("resize",Qe(we(Qe((()=>{var e=Ie(),t=Ee();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:s}),x=function(e){var t=e.inputCb,i=e.doc,n=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.ignoreClass,l=e.ignoreSelector,u=e.maskInputOptions,c=e.maskInputFn,d=e.userTriggeredOnInput;function h(e){var t=Ye(e),r=e.isTrusted,n=i.defaultView;if(!t||!n||t instanceof n.HTMLElement){var h=t&&t.tagName;if(t&&"OPTION"===h&&(t=I.parentElement(t)),t&&h&&et.indexOf(h)>=0&&!Me(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var _=t.value,g=!1,v=D(t)||"";"radio"===v||"checkbox"===v?g=t.checked:(u[h.toLowerCase()]||u[v])&&(_=L({element:t,maskInputOptions:u,tagName:h,type:v,value:_,maskInputFn:c})),p(t,d?{text:_,isChecked:g,userTriggered:r}:{text:_,isChecked:g});var f=t.name;"radio"===v&&f&&g&&i.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;p(e,d?{text:r,isChecked:!g,userTriggered:!1}:{text:r,isChecked:!g})}}))}}}function p(e,i){var s=tt.get(e);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){tt.set(e,i);var o=n.getId(e);Qe(t)(r({},i,{id:o}))}}var _=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>fe(e,Qe(h),i))),g=i.defaultView;if(!g)return()=>{_.forEach((e=>e()))};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&_.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map((e=>ke(e[0],e[1],{set(){Qe(h)({target:this,isTrusted:!1})}},!1,g)))),Qe((()=>{_.forEach((e=>e()))}))}(e),E=(l=(a=e).mediaInteractionCb,h=a.blockClass,_=a.blockSelector,g=a.mirror,v=a.sampling,f=a.doc,m=Qe((e=>we(Qe((t=>{var r=Ye(t);if(r&&!Me(r,h,_,!0)){var i=r.currentTime,n=r.volume,s=r.muted,o=r.playbackRate,a=r.loop;l({type:e,id:g.getId(r),currentTime:i,volume:n,muted:s,playbackRate:o,loop:a})}})),v.media||500))),y=[fe("play",m(p.Play),f),fe("pause",m(p.Pause),f),fe("seeked",m(p.Seeked),f),fe("volumechange",m(p.VolumeChange),f),fe("ratechange",m(p.RateChange),f)],Qe((()=>{y.forEach((e=>e()))}))),T=()=>{},M=()=>{},R=()=>{},P=()=>{};e.recordDOM&&(T=function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,n=e.stylesheetManager,s=t.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var o=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Qe(((e,t,s)=>{var o=s[0],a=s[1],l=it(t,i,n.styleMirror),u=l.id,c=l.styleId;return(u&&-1!==u||c&&-1!==c)&&r({id:u,styleId:c,adds:[{rule:o,index:a}]}),e.apply(t,s)}))}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var a,l,u=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,removes:[{index:o}]}),e.apply(t,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,replace:o}),e.apply(t,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,replaceSync:o}),e.apply(t,s)}))}));var c={};at("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(at("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),at("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),at("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(c).forEach((e=>{var t=e[0],s=e[1];d[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Qe(((e,t,s)=>{var o=s[0],a=s[1],l=it(t.parentStyleSheet,i,n.styleMirror),u=l.id,c=l.styleId;return(u&&-1!==u||c&&-1!==c)&&r({id:u,styleId:c,adds:[{rule:o,index:[...rt(t),a||0]}]}),e.apply(t,s)}))}),s.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t.parentStyleSheet,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,removes:[{index:[...rt(t),o]}]}),e.apply(t,s)}))})})),Qe((()=>{s.CSSStyleSheet.prototype.insertRule=o,s.CSSStyleSheet.prototype.deleteRule=u,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach((e=>{var t=e[0],r=e[1];r.prototype.insertRule=d[t].insertRule,r.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:s}),M=nt(e,e.doc),R=function(e,t){var r=e.styleDeclarationCb,i=e.mirror,n=e.ignoreCSSAttributes,s=e.stylesheetManager,o=t.win,a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Qe(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2];if(n.has(u))return a.apply(t,[u,c,d]);var h=it(null==(l=t.parentRule)?void 0:l.parentStyleSheet,i,s.styleMirror),p=h.id,_=h.styleId;return(p&&-1!==p||_&&-1!==_)&&r({id:p,styleId:_,set:{property:u,value:c,priority:d},index:rt(t.parentRule)}),e.apply(t,o)}))});var l=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Qe(((e,t,o)=>{var a,u=o[0];if(n.has(u))return l.apply(t,[u]);var c=it(null==(a=t.parentRule)?void 0:a.parentStyleSheet,i,s.styleMirror),d=c.id,h=c.styleId;return(d&&-1!==d||h&&-1!==h)&&r({id:d,styleId:h,remove:{property:u},index:rt(t.parentRule)}),e.apply(t,o)}))}),Qe((()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:s}),e.collectFonts&&(P=function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=C(r.fonts,"add",(function(e){return function(r){return setTimeout(Qe((()=>{var e=s.get(r);e&&(t(e),s.delete(r))})),0),e.apply(this,[r])}}));return n.push((()=>{i.FontFace=o})),n.push(a),Qe((()=>{n.forEach((e=>e()))}))}(e)));var F=function(e){var t=e.doc,r=e.mirror,i=e.blockClass,n=e.blockSelector,s=e.selectionCb,o=!0,a=Qe((()=>{var e=t.getSelection();if(!(!e||o&&(null==e?void 0:e.isCollapsed))){o=e.isCollapsed||!1;for(var a=[],l=e.rangeCount||0,u=0;l>u;u++){var c=e.getRangeAt(u),d=c.startContainer,h=c.startOffset,p=c.endContainer,_=c.endOffset;Me(d,i,n,!0)||Me(p,i,n,!0)||a.push({start:r.getId(d),startOffset:h,end:r.getId(p),endOffset:_})}s({ranges:a})}}));return a(),fe("selectionchange",a)}(e),O=function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?C(r.customElements,"define",(function(e){return function(r,i,n){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,n])}})):()=>{}}(e),N=[];for(var B of e.plugins)N.push(B.observer(B.callback,s,B.options));return Qe((()=>{if(n){n.destroy(),n.reset();var t=Ze.indexOf(n);-1!==t&&Ze.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==i||i.disconnect(),b(),S(),w(),k(),x(),E(),T(),M(),R(),P(),F(),O(),N.forEach((e=>e()))}))}function ot(e){return void 0!==window[e]}function at(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class lt{constructor(e){a(this,"iframeIdToRemoteIdMap",new WeakMap),a(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){var n=r||this.getIdToRemoteIdMap(e),s=i||this.getRemoteIdToIdMap(e),o=n.get(t);return o||(o=this.generateIdFn(),n.set(t,o),s.set(o,t)),o}getIds(e,t){var r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,r,i)))}getRemoteId(e,t,r){var i=r||this.getRemoteIdToIdMap(e);return"number"!=typeof t?t:i.get(t)||-1}getRemoteIds(e,t){var r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,r)))}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||this.iframeIdToRemoteIdMap.set(e,t=new Map),t}getRemoteIdToIdMap(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||this.iframeRemoteIdToIdMap.set(e,t=new Map),t}}class ut{constructor(e){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new lt(Y)),a(this,"crossOriginIframeStyleMirror"),a(this,"crossOriginIframeRootIdMap",new WeakMap),a(this,"mirror"),a(this,"mutationCb"),a(this,"wrappedEmit"),a(this,"loadListener"),a(this,"pageHideListener"),a(this,"stylesheetManager"),a(this,"recordCrossOriginIframes"),a(this,"messageHandler"),a(this,"nestedIframeListeners",new Map),a(this,"attachedWindows",new WeakMap),a(this,"attachedDocuments",new WeakMap),a(this,"attachedIframes",new Map),a(this,"loadListenerDisposers",new WeakMap),a(this,"iframeElementsById",new Map),a(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new lt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null==(i=this.attachedIframes.get(e))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach((e=>ye(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{me(e.win,"pagehide",e.handler)})),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var n=this.attachedDocuments.get(e);n||this.attachedDocuments.set(e,n=new Set),n.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var o=this.handleMessage.bind(this);ye((()=>{s.addEventListener("message",o),this.nestedIframeListeners.set(s,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(s)}))}ye((()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var n=()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)};t.addEventListener("pagehide",n),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:n})}})),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 r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case l.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:l.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case l.Meta:case l.Load:case l.DomContentLoaded:return!1;case l.Plugin:return t;case l.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case l.IncrementalSnapshot:switch(t.data.source){case u.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)})),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 u.Drag:case u.TouchMove:case u.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(t.data,e,["id"]),t;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case u.Font:return t;case u.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case u.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,r,i){for(var n of i)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(r,t[n]):e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}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===_.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(me(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(me(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((e=>{ye((()=>this.mirror.removeNodeFromMap(e)))})),ye((()=>Xe(r,s))),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach(((t,r)=>{this.mirror.has(r)||e.push(r)})),e.forEach((e=>this.removeIframeById(e)))}}reattachIframes(){this.attachedIframes.forEach(((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)}))}destroy(){this.recordCrossOriginIframes&&me(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{me(t,"message",e)})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>e.add(t.element))),e.forEach((e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class ct{constructor(e){a(this,"shadowDoms",new WeakSet),a(this,"mutationCb"),a(this,"scrollCb"),a(this,"bypassOptions"),a(this,"mirror"),a(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){var i,n;if(M(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(i=null==(n=I.host(e))?void 0:n.ownerDocument)&&void 0!==i?i:t,o=Ke(r({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),a=o.observer,l=o.buffer;this.restoreHandlers.push({doc:s,handler(){a.disconnect(),l.destroy(),l.releaseCanvasManager();var e=Ze.indexOf(l);-1!==e&&Ze.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Je(r({},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(I.host(e))),this.restoreHandlers.push({doc:s,handler: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){var r=this;this.restoreHandlers.push({doc:t,handler:C(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=I.shadowRoot(this);return s&&Be(this)&&r.addShadowRoot(s,t),n}}))})}reset(){this.restoreHandlers.forEach((e=>{var t=e.handler;try{t()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}}var dt="skip-frame";function ht(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),gt=0;64>gt;gt++)_t[pt.charCodeAt(gt)]=gt;var vt=new Map,ft=(e,t,r)=>{if(e&&(bt(e,t)||"object"==typeof e)){var i=function(e,t){var r=vt.get(e);return r||vt.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),n=i.indexOf(e);return-1===n&&(n=i.length,i.push(e)),n}};function mt(e,t,r,i){if(e instanceof Array)return e.map((e=>mt(e,t,r,i)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){var n=e.constructor.name,s=function(e){var t,r=new Uint8Array(e),i=r.length,n="";for(t=0;i>t;t+=3)n+=pt[r[t]>>2],n+=pt[(3&r[t])<<4|r[t+1]>>4],n+=pt[(15&r[t+1])<<2|r[t+2]>>6],n+=pt[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e);return{rr_type:n,base64:s}}return e instanceof DataView?{rr_type:e.constructor.name,args:[mt(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[mt(e.data,t,r,i),e.width,e.height]}:bt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ft(e,t,r)}:e}var yt=(e,t,r,i)=>e.map((e=>mt(e,t,r,i))),bt=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(r.find((r=>e instanceof t[r])))},St=["webgl","webgl2"];function wt(e){return"nodeType"in e}function kt(e,t,i,n){var s=[];try{if(n){var o=function(e,t,i){var n=e.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return C(n.prototype,"configure",(function(n){return function(s){var o=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!o||wt(o)&&Me(o,t,i,!0))return n.call(this,s);wt(o)&&!("__context"in o)&&(o.__context="webgpu");var a=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return n.call(this,null!==a&&s?r({},s,{usage:"number"==typeof s.usage?s.usage|a:a}):s)}}))}(e,t,i);o&&s.push(o)}var a=C(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r){for(var s=function(e){return"experimental-webgl"===e?"webgl":e}(r),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!Me(this,t,i,!0)&&("__context"in this||(this.__context=s),n&&St.includes(s)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[r,...a])}}));s.push(a)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function xt(e,t,r,i,n,s,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=C(e,l,(function(e){return function(){for(var a=arguments.length,u=new Array(a),c=0;a>c;c++)u[c]=arguments[c];var d=e.apply(this,u);if(ft(d,s,this),"tagName"in this.canvas&&!Me(this.canvas,i,n,!0)){var h=yt(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(i){var c=ke(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(c)}};for(var c of l)u(c);return a}var Ct,It,Et,Tt='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',Mt="undefined"!=typeof self&&self.Blob&&new Blob([Tt],{type:"text/javascript;charset=utf-8"});function Rt(e){var t;try{if(!(t=Mt&&(self.URL||self.webkitURL).createObjectURL(Mt)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Tt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Pt{constructor(e){a(this,"pendingCanvasMutations",new Map),a(this,"rafStamps",{latestId:0,invokeId:null}),a(this,"mirror"),a(this,"mutationCb"),a(this,"resetObservers"),a(this,"frozen",!1),a(this,"locked",!1),a(this,"rafIdTimestamp",null),a(this,"rafIdFlush",null),a(this,"refCount",0),a(this,"torndown",!1),a(this,"resetFrameDedup",null),a(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 t=e.sampling,r=void 0===t?"all":t,i=e.win,n=e.blockClass,s=e.blockSelector,o=e.recordCanvas,l=e.dataURLOptions,u=e.resolutionScale,c=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,l),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:l,resolutionScale:u,canvasMasking:c})}onFullSnapshot(){var e;null==(e=this.resetFrameDedup)||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,r,i,n,s){var o=this;if("OffscreenCanvas"in r){var a,l="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=kt(r,i,n,!0),c=new Map;try{a=new Rt}catch(e){return}var d=!1;a.onerror=()=>{var e;d=!0,cancelAnimationFrame(p),null==(e=a.terminate)||e.call(a),this.resetFrameDedup=null},this.resetFrameDedup=()=>{a.postMessage({resetFrameDedup:!0})},a.onmessage=e=>{var t=e.data.id;if(c.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var p,_=1e3/e,g=0,v=e=>{var u,h;d||(g&&_>e-g||(g=e,(u=[],h=e=>{try{e.querySelectorAll("canvas").forEach((e=>{Me(e,i,n,!0)||u.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&h(e.shadowRoot)}))}catch(e){}},h(r.document),u).forEach(function(){var e=t((function*(e){var t,r,i=o.mirror.getId(e);if(!c.get(i)&&0!==e.width&&0!==e.height){c.set(i,!0);try{if(["webgl","webgl2"].includes(e.__context)){var n=e.getContext(e.__context);if(null==(t=null==n?void 0:n.isContextLost)?void 0:t.call(n))return void c.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var u=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(u*l)),p=Math.max(1,Math.round(d*l)),_=function(e,t,r,i,n,s){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return dt}if(void 0!==o){if(!Array.isArray(o)||!o.every(ht))return dt;var a=r/n,l=i/s;return o.filter((e=>e.width>0&&e.height>0)).map((e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}}))}}}(s.canvasMasking,e,h,p,u,d);if(_===dt)return void c.set(i,!1);var g=yield createImageBitmap(e,1>l?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});a.postMessage({id:i,bitmap:g,width:h,height:p,displayWidth:u,displayHeight:d,dataURLOptions:s.dataURLOptions,maskRegions:_},[g])}catch(e){c.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),p=requestAnimationFrame(v))};p=requestAnimationFrame(v),this.resetObservers=()=>{var e;u(),cancelAnimationFrame(p),null==(e=a.terminate)||e.call(a),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=kt(e,t,r,!1),s=function(e,t,r,i,n){var s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=C(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return Me(this.canvas,r,i,!0)||setTimeout((()=>{var r=yt(l,t,this,n);e(this.canvas,{type:h["2D"],property:o,args:r})}),0),s.apply(this,l)}}));s.push(a)}catch(r){var l=ke(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:h["2D"],property:o,args:[t],setter:!0})}});s.push(l)}};for(var l of o)a(l);return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,n){var s=[];return void 0!==t.WebGLRenderingContext&&s.push(...xt(t.WebGLRenderingContext.prototype,h.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...xt(t.WebGL2RenderingContext.prototype,h.WebGL2,e,r,i,t,n)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{n(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var n=r.map((e=>i(e,s)));this.mutationCb({id:t,type:r[0].type,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class Ft{constructor(e){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new De),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 r=this;if(0!==e.length){var i={id:t,styleIds:[]},n=[],s=function(e){var t;r.styleMirror.has(e)?t=r.styleMirror.getId(e):(t=r.styleMirror.add(e),n.push({styleId:t,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:P(t,e.href),index:r})))})),i.styleIds.push(t)};for(var o of e)s(o);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,le.forEach((e=>e.abort())),le.clear()}trackStylesheetInLinkElement(e){}}class Lt{constructor(){a(this,"nodeMap",new WeakMap),a(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).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 At=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Ot=document.createElement("iframe");document.body.appendChild(Ot),Array.from=(null==(n=Ot.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Ot)}}catch(e){console.debug("Unable to override Array.from",e)}var Dt=new F,Nt=new Set([u.Mutation,u.MediaInteraction,u.StyleSheetRule,u.CanvasMutation,u.Font,u.Log,u.StyleDeclaration,u.AdoptedStyleSheet]);function Bt(e){void 0===e&&(e={});var t=e,i=t.emit,n=t.checkoutEveryNms,s=t.checkoutEveryNth,o=t.blockClass,a=void 0===o?"rr-block":o,c=t.blockSelector,d=void 0===c?null:c,h=t.ignoreClass,p=void 0===h?"rr-ignore":h,_=t.ignoreSelector,g=void 0===_?null:_,v=t.maskTextClass,f=void 0===v?"rr-mask":v,m=t.maskTextSelector,y=void 0===m?null:m,b=t.inlineStylesheet,S=void 0===b||b,w=t.maskAllInputs,k=t.maskInputOptions,x=t.slimDOMOptions,C=t.maskInputFn,E=t.maskTextFn,T=t.hooks,M=t.packFn,R=t.sampling,P=void 0===R?{}:R,L=t.dataURLOptions,A=void 0===L?{}:L,O=t.canvasResolutionScale,D=t.canvasMasking,N=t.mousemoveWait,B=t.recordDOM,q=void 0===B||B,H=t.recordCanvas,U=void 0!==H&&H,z=t.recordCrossOriginIframes,W=void 0!==z&&z,V=t.recordAfter,j=void 0===V?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":V,G=t.userTriggeredOnInput,Q=void 0!==G&&G,Z=t.collectFonts,Y=void 0!==Z&&Z,K=t.inlineImages,J=void 0!==K&&K,X=t.plugins,ee=t.keepIframeSrcFn,te=void 0===ee?()=>!1:ee,re=t.ignoreCSSAttributes,ie=void 0===re?new Set([]):re,ne=t.attributeFilter;$e=t.errorHandler;var se=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},A),oe=!W||window.parent===window,ae=!1;if(!oe)try{window.parent.document&&(ae=!1)}catch(e){ae=!0}if(oe&&!i)throw new Error("emit function is required");if(!oe&&!ae)return()=>{};void 0!==N&&void 0===P.mousemove&&(P.mousemove=N),Dt.reset();var le,ue=!0===w?{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!==k?k:{password:!0},ce=ge(void 0!==x&&x);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var de,he,pe=0,ve=new Map,me=e=>{for(var t of X||[])t.eventProcessor&&(e=t.eventProcessor(e));return M&&!ae&&(e=M(e)),e};Ct=(e,t)=>{var r,o=e;if(o.timestamp=xe(),!(null==(r=Ze[0])?void 0:r.isFrozen())||o.type===l.FullSnapshot||o.type===l.IncrementalSnapshot&&Nt.has(o.data.source)||Ze.forEach((e=>e.unfreeze())),oe)null==i||i(me(o),t);else if(ae){var a={type:"rrweb",event:me(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===l.FullSnapshot)le=o,pe=0;else if(o.type===l.IncrementalSnapshot){if(o.data.source===u.Mutation&&o.data.isAttachIframe)return;pe++,(s&&pe>=s||n&&o.timestamp-le.timestamp>n)&&It(!0)}};var be=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map((e=>e.node.id))):null,i=new Set;if(e.adds.length>0)for(var n of e.adds){var s=Dt.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}e.removes.forEach((e=>{var r=e.id;if(!t||!t.has(r)){var n=Te.getIframeElementById(r);n&&i.has(n)?Te.forgetIframeId(r):(null==de||de(r),Te.removeIframeById(r))}})),null==he||he(),Te.cleanupDetachedIframes()}Ct({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},Se=e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),we=e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),ke=new Ft({mutationCb:be,adoptedStyleSheetCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),Te=new ut({mirror:Dt,mutationCb:be,stylesheetManager:ke,recordCrossOriginIframes:W,wrappedEmit:Ct});for(var Me of X||[])Me.getMirror&&Me.getMirror({nodeMirror:Dt,crossOriginIframeMirror:Te.crossOriginIframeMirror,crossOriginIframeStyleMirror:Te.crossOriginIframeStyleMirror});var Re=new Lt,Pe=null==D?void 0:D.configured;Et=new Pt({recordCanvas:U,mutationCb:we,win:window,blockClass:a,blockSelector:d,mirror:Dt,sampling:P.canvas,dataURLOptions:se,resolutionScale:O,canvasMasking:D});var Fe=new ct({mutationCb:be,scrollCb:Se,bypassOptions:{blockClass:a,blockSelector:d,maskTextClass:f,maskTextSelector:y,inlineStylesheet:S,maskInputOptions:ue,dataURLOptions:se,maskTextFn:E,maskInputFn:C,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,sampling:P,slimDOMOptions:ce,iframeManager:Te,stylesheetManager:ke,canvasManager:Et,keepIframeSrcFn:te,processedNodeManager:Re,attributeFilter:ne},mirror:Dt});It=function(e){if(void 0===e&&(e=!1),q){Ct({type:l.Meta,data:{href:window.location.href,width:Ee(),height:Ie()}},e),ke.reset(),Fe.init(),Ze.forEach((e=>e.lock()));var t=function(e,t){var r=t||{},i=r.mirror,n=void 0===i?new F:i,s=r.blockClass,o=r.blockSelector,a=r.maskTextClass,l=r.maskTextSelector,u=r.inlineStylesheet,c=r.inlineImages,d=void 0!==c&&c,h=r.recordCanvas,p=void 0!==h&&h,_=r.canvasMaskingConfigured,g=r.maskAllInputs,v=void 0!==g&&g,f=r.slimDOM,m=r.dataURLOptions,y=r.preserveWhiteSpace,b=r.onSerialize,S=r.onIframeLoad,w=r.iframeLoadTimeout,k=r.onIframeListenerRegistered,x=r.onStylesheetLoad,C=r.stylesheetLoadTimeout,I=r.keepIframeSrcFn,E=void 0===I?()=>!1:I,T=r.maxDepth;return _e(e,{doc:e,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===o?null:o,maskTextClass:void 0===a?"rr-mask":a,maskTextSelector:void 0===l?null:l,skipChild:!1,inlineStylesheet:void 0===u||u,maskInputOptions:!0===v?{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===v?{password:!0}:v,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:ge(void 0!==f&&f),dataURLOptions:m,inlineImages:d,recordCanvas:p,canvasMaskingConfigured:_,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:E,newlyAddedElement:!1,maxDepth:T})}(document,{mirror:Dt,blockClass:a,blockSelector:d,maskTextClass:f,maskTextSelector:y,inlineStylesheet:S,maskAllInputs:ue,maskTextFn:E,maskInputFn:C,slimDOM:ce,dataURLOptions:se,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,onSerialize(e){Le(e,Dt)&&Te.addIframe(e),Ae(e,Dt)&&ke.trackLinkElement(e),Oe(e)&&Fe.addShadowRoot(I.shadowRoot(e),document)},onIframeLoad(e,t){Te.attachIframe(e,t),Fe.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ke.attachLinkElement(e,t)},keepIframeSrcFn:te});if(!t)return console.warn("Failed to snapshot the document");Ct({type:l.FullSnapshot,data:{node:t,initialOffset:Ce(window)}},e),Ze.forEach((e=>e.unlock())),Et.onFullSnapshot(),W&&Te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ke.adoptStyleSheets(document.adoptedStyleSheets,Dt.getId(document))}};try{var De=[];de=e=>{var t=ve.get(e);t&&(t.forEach((e=>{ye(e);var t=De.indexOf(e);-1!==t&&De.splice(t,1)})),ve.delete(e))},he=()=>{for(var e of ve){var t=e[0],r=Dt.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==de||de(t)}catch(e){null==de||de(t)}else null==de||de(t)}};var Ne=e=>{var t;return Qe(st)({mutationCb:be,mousemoveCb:(e,t)=>Ct({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:Se,viewportResizeCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:we,fontCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){Ct({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){Ct({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:a,ignoreClass:p,ignoreSelector:g,maskTextClass:f,maskTextSelector:y,maskInputOptions:ue,inlineStylesheet:S,sampling:P,recordDOM:q,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,userTriggeredOnInput:Q,collectFonts:Y,doc:e,maskInputFn:C,maskTextFn:E,keepIframeSrcFn:te,blockSelector:d,slimDOMOptions:ce,dataURLOptions:se,mirror:Dt,iframeManager:Te,stylesheetManager:ke,shadowDomManager:Fe,processedNodeManager:Re,canvasManager:Et,ignoreCSSAttributes:ie,attributeFilter:ne,plugins:(null==(t=null==X?void 0:X.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ct({type:l.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},T)};Te.addLoadListener((e=>{try{var t=Dt.getId(e),r=Ne(e.contentDocument);if(De.push(r),-1!==t){var i=ve.get(t);i||ve.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Te.addPageHideListener((e=>{var t=Dt.getId(e);null==de||de(t),Xe(e)}));var Be=-1,qe=e=>Ct({type:l.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),He=()=>{var e,t,r,i,n=document,s=null!==(e=null!==(t=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==t?t:n.msFullscreenElement)&&void 0!==e?e:null,o=s?Dt.getId(s):-1;o!==Be&&(-1!==Be&&qe({id:Be,enter:!1}),Be=o,-1!==o&&qe({id:o,enter:!0}))},Ue=()=>{It(),De.push(Ne(document)),De.push(fe("fullscreenchange",He)),De.push(fe("webkitfullscreenchange",He)),De.push(fe("mozfullscreenchange",He)),De.push(fe("MSFullscreenChange",He)),At=!0};return["interactive","complete"].includes(document.readyState)?Ue():(De.push(fe("DOMContentLoaded",(()=>{Ct({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===j&&Ue()}))),De.push(fe("load",(()=>{Ct({type:l.Load,data:{}}),"load"===j&&Ue()}),window))),()=>{De.forEach((e=>ye(e))),Re.destroy(),Te.removeLoadListener(),Te.destroy(),ve.clear(),Fe.reset(),Dt.reset(),At=!1,$e=void 0}}catch(e){console.warn(e)}}Bt.addCustomEvent=(e,t)=>{if(!At)throw new Error("please add custom event after start recording");Ct({type:l.Custom,data:{tag:e,payload:t}})},Bt.freezePage=()=>{Ze.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!At)throw new Error("please take full snapshot after start recording");It(e)},Bt.mirror=Dt;var qt=Object.defineProperty,Ht=(e,t,r)=>((e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class $t{constructor(e){Ht(this,"fileName"),Ht(this,"functionName"),Ht(this,"lineNumber"),Ht(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?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var Ut=/(^|@)\S+:\d+/,zt=/^\s*at .*(\S+:\d+|\(native\))/m,Wt=/^(eval@)?(\[native code])?$/,Vt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(zt)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var 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(e){return e.stack.split("\n").filter((function(e){return!!e.match(zt)}),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,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new $t({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Wt)}),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 $t({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new $t({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(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(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new $t({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new $t({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter((function(e){return!!e.match(Ut)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new $t({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function jt(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var o=i.children[s];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&n.push(o)}n.length>1&&(r+=":eq("+n.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Gt(e){return Array.isArray(e)}function Qt(e){return"object"==typeof e&&null!==e&&!Gt(e)}function Zt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Qt(e[i])&&Zt(e[i],t-1))return!0;return!1}function Yt(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],n=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,e):n.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Qt(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Qt(o)&&Zt(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=Gt(u)?jt(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var Kt={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 Jt(e,t,r){var i,n=r?Object.assign({},Kt,r):Kt,s=n.logger;if(!s)return()=>{};i="string"==typeof s?t[s]:s;var o=0,a=!1,l=[];if(n.level.includes("error")){var u=t=>{var r=t.message,i=Vt.parse(t.error).map((e=>e.toString())),s=[Yt(r,n.stringifyOptions)];e({level:"error",trace:i,payload:s})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[Yt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Yt("Uncaught (in promise)",n.stringifyOptions),Yt(t.reason,n.stringifyOptions)]);var s=Vt.parse(r).map((e=>e.toString()));e({level:"error",trace:s,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of n.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,s,l){try{if(!(s in t))return()=>{};var u=t[s],c={next:u},d=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=Vt.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Yt(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Yt("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return c.next.apply(this,t)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),t[s]=d,()=>{if(t[s]!==d)for(var e=t[s];"function"==typeof e&&e.__rrweb_layer__;){var r=e.__rrweb_layer__;if(r.next===d)return void(r.next=c.next);e=r.next}else t[s]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Xt=e=>({name:"rrweb/console@1",observer:Jt,options:e}),er=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function tr(e){return"string"==typeof e||e}function rr(e){return"string"==typeof e?e:void 0}var ir,nr=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],sr=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),or=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ar="min_length",lr="max_length",ur=["$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"],cr=["token"],dr="NativeGzipValidationError",hr=e=>e.length>=2&&31===e[0]&&139===e[1],pr=(e,t)=>e===or.GZipJS||t===or.GZipJS||"gzip"===t,_r=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),gr=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return _r(e)||t===dr},vr=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=dr,t},fr=function(){var e=t((function*(e,t){18>e.size&&vr("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());hr(r)&&8===r[2]||vr("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(ir)return ir;ir=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;ir[e]=t>>>0}return ir})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&vr("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&vr("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function mr(e,t,r){return yr.apply(this,arguments)}function yr(){return yr=t((function*(e,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(n).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(s.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield fr(u,n),u}catch(e){if(null!=i&&i.rethrow)throw e;return r&&console.error("Failed to gzip compress data",e),null}})),yr.apply(this,arguments)}var br=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Sr=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return br.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function wr(e,t){return-1!==e.indexOf(t)}var kr=function(e){return e.trim()},xr=function(e){return e.replace(/^\$/,"")};function Cr(e){var t,r=[];return null!==(t=JSON.stringify(e,(function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}})))&&void 0!==t?t:"null"}var Ir=Object.prototype,Er=Ir.hasOwnProperty,Tr=Ir.toString,Mr=Array.isArray||function(e){return"[object Array]"===Tr.call(e)},Rr=e=>"function"==typeof e,Pr=e=>e===Object(e)&&!Mr(e),Fr=e=>{if(Pr(e)){for(var t in e)if(Er.call(e,t))return!1;return!0}return!1},Lr=e=>void 0===e,Ar=e=>"[object String]"==Tr.call(e),Or=e=>Ar(e)&&0===e.trim().length,Dr=e=>null===e,Nr=e=>Lr(e)||Dr(e),Br=e=>"[object Number]"==Tr.call(e)&&e==e,qr=e=>Br(e)&&e>0,Hr=e=>"[object Boolean]"===Tr.call(e),$r=e=>e instanceof FormData,Ur=e=>wr(ur,e),zr=e=>wr(cr,e);function Wr(e){return null===e||"object"!=typeof e}function Vr(e,t){return{}.toString.call(e)==="[object "+t+"]"}function jr(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Gr=[!0,"true",1,"1","yes"],Qr=e=>wr(Gr,e),Zr=[!1,"false",0,"0","no"];function Yr(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),Br(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),Yr(n||r,t,r,i))}class Kr{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Yr(e.bucketSize,0,100,e._logger),this._refillRate=Yr(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Yr(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),n=this._buckets[i];return n?this._applyRefill(n,r):this._buckets[i]=n={tokens:this._bucketSize,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}}var Jr="Mobile",Xr="iOS",ei="Android",ti="Tablet",ri=ei+" "+ti,ii="iPad",ni="Apple",si=ni+" Watch",oi="Safari",ai="BlackBerry",li="Samsung",ui=li+"Browser",ci=li+" Internet",di="Chrome",hi=di+" OS",pi=di+" "+Xr,_i="Internet Explorer",gi=_i+" "+Jr,vi="Opera",fi=vi+" Mini",mi="Edge",yi="Microsoft "+mi,bi="Firefox",Si=bi+" "+Xr,wi="Nintendo",ki="PlayStation",xi="Xbox",Ci=ei+" "+Jr,Ii=Jr+" "+oi,Ei="Windows",Ti=Ei+" Phone",Mi="Nokia",Ri="Ouya",Pi="Generic",Fi=Pi+" "+Jr.toLowerCase(),Li=Pi+" "+ti.toLowerCase(),Ai="Konqueror",Oi="Oculus Browser",Di="Vivaldi",Ni="Yandex",Bi="Whale",qi="DuckDuckGo",Hi="Pale Moon",$i="Waterfox",Ui="Brave",zi="Google Search App",Wi="(\\d+(\\.\\d+)?)",Vi=new RegExp("Version/"+Wi),ji=new RegExp(xi,"i"),Gi=new RegExp(ki+" \\w+","i"),Qi=new RegExp(wi+" \\w+","i"),Zi=new RegExp(ai+"|PlayBook|BB10","i"),Yi={"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"},Ki=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?Ui:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&wr(e,"GSA/")?zi:wr(e," OPR/")&&wr(e,"Mini")?fi:wr(e," OPR/")?vi:Zi.test(e)?ai:wr(e,"IE"+Jr)||wr(e,"WPDesktop")?gi:wr(e,"OculusBrowser")?Oi:wr(e,ui)?ci:wr(e,mi)||wr(e,"Edg/")?yi:wr(e,Di+"/")?Di:wr(e,"YaBrowser/")?Ni:wr(e,Bi+"/")?Bi:wr(e,qi+"/")||wr(e,"Ddg/")?qi:wr(e,"FBIOS")?"Facebook "+Jr:wr(e,"UCWEB")||wr(e,"UCBrowser")?"UC Browser":wr(e,"CriOS")?pi:wr(e,"CrMo")||wr(e,di)?di:wr(e,ei)&&wr(e,oi)?Ci:wr(e,"FxiOS")?Si:wr(e.toLowerCase(),Ai.toLowerCase())?Ai:wr(e,Ui+"/")?Ui:((e,t)=>t&&wr(t,ni)||function(e){return wr(e,oi)&&!wr(e,di)&&!wr(e,ei)}(e))(e,t)?wr(e,Jr)?Ii:oi:wr(e,"PaleMoon/")?Hi:wr(e,$i+"/")?$i:wr(e,bi)?bi:wr(e,"MSIE")||wr(e,"Trident/")?_i:wr(e,"Gecko")?bi:"")},Ji={[gi]:[new RegExp("rv:"+Wi)],[yi]:[new RegExp(mi+"?\\/"+Wi)],[di]:[new RegExp("("+di+"|CrMo)\\/"+Wi)],[pi]:[new RegExp("CriOS\\/"+Wi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Wi)],[oi]:[Vi],[Ii]:[Vi],[vi]:[new RegExp("(Opera|OPR)\\/"+Wi)],[bi]:[new RegExp(bi+"\\/"+Wi)],[Si]:[new RegExp("FxiOS\\/"+Wi)],[Ai]:[new RegExp("Konqueror[:/]?"+Wi,"i")],[ai]:[new RegExp(ai+" "+Wi),Vi],[Ci]:[new RegExp("android\\s"+Wi,"i")],[ci]:[new RegExp(ui+"\\/"+Wi)],[Oi]:[new RegExp("OculusBrowser\\/"+Wi)],[Di]:[new RegExp(Di+"\\/"+Wi)],[Ni]:[new RegExp("YaBrowser\\/"+Wi)],[Bi]:[new RegExp(Bi+"\\/"+Wi)],[Ui]:[new RegExp(Ui+"\\/"+Wi)],[qi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Wi)],[Hi]:[new RegExp("PaleMoon\\/"+Wi)],[$i]:[new RegExp($i+"\\/"+Wi)],[zi]:[new RegExp("GSA\\/"+Wi)],[_i]:[new RegExp("(rv:|MSIE )"+Wi)],Mozilla:[new RegExp("rv:"+Wi)]},Xi=function(e,t,r,i){var n=Ki(e,t,r,i),s=Ji[n];if(Lr(s))return null;for(var o=0;s.length>o;o++){var a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},en=[[new RegExp(xi+"; "+xi+" (.*?)[);]","i"),e=>[xi,e&&e[1]||""]],[new RegExp(wi,"i"),[wi,""]],[new RegExp(ki,"i"),[ki,""]],[Zi,[ai,""]],[new RegExp(Ei,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ti,""];if(new RegExp(Jr).test(t)&&!/IEMobile\b/.test(t))return[Ei+" "+Jr,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Yi[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[Ei,i]}return[Ei,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Xr,[e[3],e[4],e[5]||"0"].join(".")]:[Xr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Lr(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ei+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ei+")","i"),e=>e&&e[2]?[ei,[e[2],e[3],e[4]||"0"].join(".")]:[ei,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[hi,""]],[/Linux|debian/i,["Linux",""]]],tn=function(e){return Qi.test(e)?wi:Gi.test(e)?ki:ji.test(e)?xi:new RegExp(Ri,"i").test(e)?Ri:new RegExp("("+Ti+"|WPDesktop)","i").test(e)?Ti:/iPad/.test(e)?ii:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?si:Zi.test(e)?ai:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Mi,"i").test(e)?Mi:/(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(Jr).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)?ei:ri:new RegExp("(pda|"+Jr+")","i").test(e)?Fi:new RegExp(ti,"i").test(e)&&!new RegExp(ti+" pc","i").test(e)?Li:""},rn=function(e,t){var r,i,n,s,o=tn(e);return o===ii||o===ri||"Kobo"===o||"Kindle Fire"===o||o===Li?ti:o===wi||o===xi||o===ki||o===Ri?"Console":o===si?"Wearable":o?Jr:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(n=null==t?void 0:t.screenHeight)&&void 0!==n?n:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?Jr:ti:"Desktop"},nn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sn(e,t){return"string"==typeof(r=e)&&nn.test(r)?e:t();var r}function on(e){return e?e.split("#")[0]:e}function an(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function ln(e,t,r){return un.apply(this,arguments)}function un(){return(un=t((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,n)=>{i=an((()=>{try{null==r||r(),e()}catch(e){n(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var cn=e=>e instanceof Error,dn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},hn=dn.info;function pn(e){if(Hr(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Mr(e))return{arrayValue:{values:e.map((e=>pn(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function _n(e){var t=[];for(var r in e){var i=e[r];Dr(i)||Lr(i)||t.push({key:r,value:pn(i)})}return t}function gn(e,t){var i=dn[e.level||"info"]||hn,n=i.text,s=i.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),Nr(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),Nr(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=r({},a,e.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:n,body:{stringValue:e.body},attributes:_n(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Lr(e.trace_flags)||(u.flags=e.trace_flags),u}function vn(e,t,i){return r({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}function fn(e,t,r,i){return{resourceLogs:[{resource:{attributes:_n(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let mn=class{constructor(e,t,r,i,n,s,o){var a;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=n,this._waitForStoragePersist=s,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}reset(){this._clearFlushTimer(),this._flushPromise=null,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this._runBeforeSend(e);if(null!==t)if(t.body){if(this._checkRateLimit()){var r={record:gn(t,this._getContext())};this._onReady((()=>this._enqueue(r)))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Mr(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Log was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return t((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return t((function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o;e._evictedSinceAdvance=0;var a=Math.min(r.length,e._maxBatchRecordsPerPost),l=r.slice(0,a),u=l.map((e=>e.record)),c=fn(u,e._buildResourceAttributes(),null!==(s=e._scopeName)&&void 0!==s?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance._sendLogsBatch(c);if("too-large"===d.kind&&l.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(l.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?e._logger.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(l.length),r=null!==(o=e._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===d.kind)throw d.error}}}))()}_persistQueueAdvance(e){var r=this;return t((function*(){var t,i=Math.max(0,e-r._evictedSinceAdvance),n=null!==(t=r._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];r._instance.setPersistedProperty(sr.LogsQueue,n.slice(i)),yield r._waitForStoragePersist()}))()}_buildResourceAttributes(){return vn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(sr.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=an((()=>{this._flushTimer=void 0,this._flushInBackground()}),e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(sr.LogsQueue);return!!e&&e.length>0}shutdown(e){var r=this;return t((function*(){r._clearFlushTimer();var t=r.flush().catch((()=>{}));void 0!==e?yield ln(t,e):yield t}))()}flushWithTimeout(e){var r=this;return t((function*(){var t=r.flush();yield ln(t,e,(()=>{t.catch((()=>{}))}))}))()}_flushInBackground(){this.flush().then((()=>{this._consecutiveFlushFailures=0}),(e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())}))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}};var yn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function bn(e){return String(e)+"000000"}function Sn(e,t,r,i){var n="";return i&&(n=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+n}let wn=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,r=this._flushPromise,i=function(){var i=t((function*(){r&&(yield r.catch((()=>{}))),yield e._doFlush()}));return function(){return i.apply(this,arguments)}}(),n=i().finally((()=>{this._flushPromise===n&&(this._flushPromise=null)}));return this._flushPromise=n,n}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var i,n;try{i=t.attributes?r({},t.attributes):void 0,n=Sn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var s=this._series.get(n);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(n,s)}var o=this._typeByName.get(t.name);void 0===o?this._typeByName.set(t.name,t.type):o===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(yn.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,yn)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Mr(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Metric was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=an((()=>{this._flushTimer=void 0,this.flush().catch((e=>{this._logger.error("Metrics flush failed:",e)}))}),this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return t((function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}}))()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return r({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:_n(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:t}]}]};var t,i,n,s}_buildMetrics(e){var t=bn(Date.now()),i=new Map;for(var n of e.values()){var s,o=Sn(n.type,n.name,n.unit,void 0),a=i.get(o);a||(a=r({name:n.name},n.unit&&{unit:n.unit}),"count"===n.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===n.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(o,a));var l=_n(null!==(s=n.attributes)&&void 0!==s?s:{}),u=bn(n.windowStartMs);if("count"===n.type){var c,d={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!==(c=n.total)&&void 0!==c?c:0};a.sum.dataPoints.push(d)}else if("gauge"===n.type){var h,p={attributes:l,timeUnixNano:t,asDouble:null!==(h=n.last)&&void 0!==h?h:0};a.gauge.dataPoints.push(p)}else n.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:n.hist.count,sum:n.hist.sum,min:n.hist.min,max:n.hist.max,bucketCounts:n.hist.bucketCounts,explicitBounds:yn})}return Array.from(i.values())}_mergeWindowBack(e){var t,r;for(var i of e){var n=i[0],s=i[1],o=this._series.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=s.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this._admitNewSeries()&&this._series.set(n,s)}}};function kn(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var xn,Cn,In;function En(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return In&&r.length===Cn||(Cn=r.length,In=r.reduce(((r,i)=>{xn||(xn={});var n=xn[i];if(n)r[n[0]]=n[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,xn[i]=[l,u];break}}return r}),{})),In}}class Tn{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),s=this.parseStacktrace(i,n);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var r=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Mr(t.stacktrace.frames)&&(t.stacktrace.frames=yield r.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,n;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),r({},e,{cause:i,stack:n})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var r=this;return t((function*(){var t=e;for(var i of r.modifiers)t=yield i(t);return t}))()}convertToExceptionList(e,t){var i,n,s,o={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(n=t.handled)||void 0===n||n,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,r({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:En(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var n=(r,i)=>{if(4>=i){var n=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,n)}};return r({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>n(e,i),next:e=>n(e,i+1)})}}var Mn="?";function Rn(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?Mn:r,in_app:!0};return Lr(i)||(s.lineno=i),Lr(n)||(s.colno=n),s}var Pn=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:Mn,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Fn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ln=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,An=/\((\S*)(?::(\d+))(?::(\d+))\)/,On=(e,t)=>{var r=Fn.exec(e);if(r)return Rn(t,r[1],Mn,+r[2],+r[3]);var i=Ln.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var n=An.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=Pn(i[1]||Mn,i[2]);return Rn(t,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Dn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Nn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Bn=(e,t)=>{var r=Dn.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=Nn.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||Mn,o=Pn(s,n);return Rn(t,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},qn=/\(error: (.*)\)/,Hn=50;class $n{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Ar(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Vr(e,"DOMException")}isDOMError(e){return Vr(e,"DOMError")}}class Un{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class zn{constructor(){}match(e){return Vr(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}var Wn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Vn{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),n=i[0],s=i[1];return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Wn);return i&&(t=i[1],r=i[2]),[t,r]}}var jn=["fatal","error","warning","log","info","debug"];function Gn(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(t>=n.length)return i===r.length?n:n.length>t?n.slice(0,t)+"...":n}return""}class Qn{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(r=t.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return jr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+Gn(e)}isSeverityLevel(e){return Ar(e)&&!Or(e)&&jn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(cn(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Zn{match(e){return jr(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Gn(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Yn{match(e){return Wr(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Kn{match(e){return Vr(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!jr(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return Wr(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Jn="$message",Xn="$timestamp",es=new Set([Jn,Xn]),ts={enabled:!0,max_bytes:32768};function rs(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ts.enabled,max_bytes:ns(e.max_bytes,ts.max_bytes)}:r({},ts)}class is{constructor(e){this._entries=[],this._totalBytes=0,this._config=rs(e)}setConfig(e){this._config=rs(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=Cr(e)}catch(e){return}try{var r=JSON.parse(t);if(!Pr(r))return;var i=r,n=i[Jn],s=i[Xn];if(!Ar(n)||0===n.trim().length)return;if(!Ar(s)&&!Br(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function ns(e,t){if(!Br(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var ss="undefined"!=typeof window?window:void 0,os="undefined"!=typeof globalThis?globalThis:ss,as=null==os?void 0:os.navigator,ls=null==os?void 0:os.document,us=null==os?void 0:os.location,cs=null==os?void 0:os.fetch,ds=null!=os&&os.XMLHttpRequest&&"withCredentials"in new os.XMLHttpRequest?os.XMLHttpRequest:void 0,hs=null==os?void 0:os.AbortController,ps=null==os?void 0:os.CompressionStream,_s=null==as?void 0:as.userAgent;function gs(){return!(!ss||!1===ss.navigator.onLine)}var vs=e=>"undefined"!=typeof Document&&e instanceof Document,fs={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"},ms=function(e,t){var r=(void 0===t?{}:t).debugEnabled,i={_log(t){if(ss&&(fs.DEBUG||ss.POSTHOG_DEBUG||r)&&!Lr(ss.console)&&ss.console){for(var i=("__rrweb_original__"in ss.console[t]?ss.console[t].__rrweb_original__:ss.console[t]),n=arguments.length,s=new Array(n>1?n-1:0),o=1;n>o;o++)s[o-1]=arguments[o];i(e,...s)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>ms(e+" "+t,r)};return i},ys=ms("[PostHog.js]"),bs=ys.createLogger;function Ss(e,t){Mr(e)&&e.forEach(t)}function ws(e,t){if(!Nr(e))if(Mr(e))e.forEach(t);else if($r(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)Er.call(e,r)&&t(e[r],r)}var ks=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)void 0!==n[s]&&(e[s]=n[s]);return e};function xs(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var Cs=function(e){try{return e()}catch(e){return}},Is=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){ys.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ys.critical(e)}}},Es=function(e){var t={};return ws(e,(function(e,r){(Ar(e)&&e.length>0||Br(e))&&(t[r]=e)})),t};var Ts=["herokuapp.com","vercel.app","netlify.app"];function Ms(e){var t=null==e?void 0:e.hostname;if(!Ar(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Ts)if(r===i)return!1;return!0}function Rs(e,t,r,i){var n=null!=i?i:{},s=n.capture,o=n.passive;null==e||e.addEventListener(t,r,{capture:void 0!==s&&s,passive:void 0===o||o})}function Ps(e){return"ph_toolbar_internal"===e.name}var Fs=["localhost","127.0.0.1"],Ls=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return Cr(e)}},As=e=>{var t=null==ls?void 0:ls.createElement("a");return Lr(t)?null:(t.href=e,t)},Os=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return ws(e,(function(e,t){Lr(e)||Lr(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},Ds=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===t){r=s;break}}if(!Mr(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){ys.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ns=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Mr(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Bs=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},qs=(e,t)=>e>=t&&gs(),Hs=(e,t,r,i)=>{if(0===e){if(gs()){var n=t+1;return n===r&&i(),n}return t}return 0},$s=()=>{};function Us(e,t,r){try{if(!(t in e))return $s;var i={next:e[t]},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)}));return Rr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e[t];Rr(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else e[t]=i.next}}catch(e){return $s}}function zs(e,t){var r,i=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),n={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of t.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}function Ws(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Rr(i))return t;try{var n=i(t);return Ar(n)&&n?n:t}catch(e){return ys.error("Error in get_current_url, falling back to window.location.href",e),t}}function Vs(e){var t,r=null==ss||null==(t=ss.location)?void 0:t.href;return Lr(r)?void 0:Ws(e,r)}var js="__POSTHOG_TOOLBAR__",Gs=1,Qs=3,Zs=11;function Ys(e){return e instanceof Element&&(e.id===js||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ks(e){return!!e&&e.nodeType===Gs}function Js(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Xs(e){return!!e&&e.nodeType===Qs}function eo(e){return!!e&&e.nodeType===Zs&&Ks(e.host)}var to=1e3;function ro(e){return e?kr(e).split(/\s+/):[]}function io(e,t){var r=Vs(t);return!!(r&&e&&e.some((e=>r.match(e))))}function no(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 ro(t)}function so(e){return Nr(e)?null:kr(e).split(/(\s+)/).filter((e=>Po(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function oo(e){var t="";return wo(e)&&!ko(e)&&e.childNodes&&e.childNodes.length&&ws(e.childNodes,(function(e){var r;Xs(e)&&e.textContent&&(t+=null!==(r=so(e.textContent))&&void 0!==r?r:"")})),kr(t)}function ao(e){var t;return Lr(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var lo=["a","button","form","input","select","textarea","label"];function uo(e,t){if(Lr(t))return!0;var r,i=function(e){if(t.some((t=>function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}(e,t))))return{v:!0}};for(var n of e)if(r=i(n))return r.v;return!1}function co(e){var t=e.parentNode;return!(!t||!Ks(t))&&t}var ho=[".ph-no-autocapture","[data-ph-no-autocapture]"],po=["next","previous","prev",">","<"],_o=[...po,"+","-","−","–"],go=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,vo=[".ph-no-deadclick",".ph-no-capture"],fo=[".ph-no-rageclick",".ph-no-capture"],mo=["","text","search","email","password","url","tel","number"];function yo(e,t){if(!ss||bo(e))return!1;var r,i,n,s,o;if(Hr(t)?(r=!!t&&fo,i=void 0,n=!1):(r=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:fo,i=null==t?void 0:t.content_ignorelist,n=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===r)return!1;if(n&&function(e){return!(!e||!Ks(e))&&(!!Js(e,"textarea")||(Js(e,"input")?wr(mo,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var a=So(e,!1).targetElementList;return!function(e,t){if(!1===e||Lr(e))return!1;var r;if(!0===e)r=po;else{if(!Mr(e))return!1;if(e.length>10)return ys.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map((e=>e.toLowerCase()))}return t.some((e=>{var t=e.safeText,i=e.ariaLabel;return r.some((e=>go(t,e)||go(i,e)))}))}(i,a.map((e=>{var t;return{safeText:oo(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!uo(a,r)}var bo=e=>!e||Js(e,"html")||!Ks(e),So=(e,t)=>{if(!ss||bo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],n=e;n.parentNode&&!Js(n,"body");)if(eo(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=co(n);if(!s)break;if(t||lo.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=ss.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}catch(e){}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function wo(e){for(var t=new Set,r=0,i=e;i.parentNode&&!Js(i,"body");i=i.parentNode){if(r++>=to||t.has(i))return!1;t.add(i);var n=no(i);if(wr(n,"ph-sensitive")||wr(n,"ph-no-capture"))return!1}if(wr(no(e),"ph-include"))return!0;var s=e.type||"";if(Ar(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!Ar(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function ko(e){return!!(Js(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Js(e,"select")||Js(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var xo=new RegExp("^(?:(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}))$"),Co=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Io=[16,15,14,13],Eo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),To=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Mo=/[0-9A-Za-z_]/;function Ro(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var n=e.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),t+=n,r=!r}return t%10==0}function Po(e,t){if(void 0===t&&(t=!0),Nr(e))return!1;if(Ar(e)){e=kr(e);var r=t?xo.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Co.lastIndex=0;t=Co.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of Io){var o=n+s;if(i.length>=o){var a=i.slice(n,o);if(xo.test(a)&&Ro(a))return!0}}}return!1}(e);if(r)return!1;var i=t?Eo.test(e):function(e){var t;for(To.lastIndex=0;t=To.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&Mo.test(r)&&Mo.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function Fo(e){var t=oo(e);return Po(t=(t+" "+Lo(e)).trim())?t:""}function Lo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ws(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=oo(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Lo(e)).trim())}catch(e){ys.error("[AutoCapture]",e)}})),t}function Ao(e){return e.replace(/"|\\"/g,'\\"')}function Oo(e){var t=e.attr__class;if(t)return Mr(t)?t:ro(t)}var Do="[SessionRecording]",No="redacted",Bo=1e6;function qo(e){var t;return Math.min(Bo,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Bo)}var Ho={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:Bo,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},$o=["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"],Uo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],zo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Wo=e=>{Nr(e)||ws(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return $o.includes(t)||zo.some((e=>t.includes(e)))})(t)&&(e[t]=No)}))},Vo=["/s/","/e/","/i/"];function jo(e,t,r,i){if(Nr(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ar(n)&&(n=parseInt(n)),n>r?Do+" "+i+" body too large to record ("+n+" bytes)":e}function Go(e,t){if(Nr(e))return e;var r=e;return Po(r,!1)||(r=Do+" "+t+" body "+No),ws(Uo,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=Do+" "+t+" body "+No+" as might contain: "+e)})),r}var Qo=bs("[Recorder]"),Zo=e=>"navigation"===e.entryType,Yo=e=>"resource"===e.entryType;function Ko(e,t){return!!t&&(Hr(t)||t[e])}function Jo(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var Xo=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ea(e){var t=e.type,r=e.recordBody,i=e.headers;function n(e){var t=Object.keys(i).find((e=>"content-type"===e.toLowerCase())),r=t&&i[t];return e.some((e=>null==r?void 0:r.toLowerCase().includes(e)))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Jo(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(n(Xo))return!1;if(Hr(r))return!0;if(Mr(r))return n(r);var s=r[t];return Hr(s)?s:n(s)}function ta(e,t,r,i,n,s){return ra.apply(this,arguments)}function ra(){return ra=t((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Qo.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var s=e.length-1;s>=0;s-=1)if(Yo(o=e[s])&&o.initiatorType===t&&(Lr(i)||o.startTime>=i)&&(Lr(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),ta(e,t,r,i,n,s+1))})),ra.apply(this,arguments)}function ia(e){var t=e.body,r=e.options,i=e.url;if(Nr(t))return null;var n=zs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(Ar(t))return t;if(vs(t))return t.textContent;if($r(t))return Os(t);if(Pr(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 na=e=>!Dr(e)&&("navigation"===e.entryType||"resource"===e.entryType);function sa(e){var t=e.entry,i=e.method,n=e.status,s=e.networkRequest,o=e.isInitial,a=e.start,l=e.end,u=e.url,c=e.initiatorType;a=t?t.startTime:a,l=t?t.responseEnd:l;var d=Math.floor(Date.now()-performance.now()),h=Math.floor(d+(a||0)),p=[r({},t?t.toJSON():{name:u},{startTime:Lr(a)?void 0:Math.round(a),endTime:Lr(l)?void 0:Math.round(l),timeOrigin:d,timestamp:h,method:i,initiatorType:c||(t?t.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(na(t))for(var _ of t.serverTiming||[])p.push({timeOrigin:d,timestamp:h,startTime:Math.round(t.startTime),name:_.name,duration:_.duration,entryType:"serverTiming"});return p}var oa=["video/","audio/"];function aa(e){return Pr(e)&&Rr(e.getReader)&&Rr(e.tee)}var la=500,ua="[SessionReplay] Timeout while trying to read body",ca="[SessionReplay] Failed to read body";function da(e){return ca+": "+e}function ha(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function pa(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(ua)),la);try{e.clone().text().then((e=>t(e)),(e=>t(da(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(ca)}}))}(e);var r=qo(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>t}catch(e){return!1}}(e,r)?Promise.resolve(ha(r)):function(e,t){return new Promise((r=>{var i,n=!1;function s(){try{var e;null==(e=i)||e.cancel()}catch(e){}}function o(e){n||(n=!0,clearTimeout(l),s(),r(e))}var a,l=setTimeout((()=>o(ua)),la);try{a=e.clone()}catch(e){return void o(ca)}var u=a.body;if(aa(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(ca)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(n)s();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var n of e)r.set(n,i),i+=n.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(ha(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(da(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(da(e))))}catch(e){o(ca)}}))}(e,r)}function _a(){return _a=t((function*(e){var t=e.r,r=e.options,i=zs(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):pa(t,r)})),_a.apply(this,arguments)}function ga(){return ga=t((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,n=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=oa.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var a=zs(n,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return Dr(i)?pa(t,r):Promise.resolve(i)})),ga.apply(this,arguments)}var va=null;function fa(e,i,n){if(!("performance"in i))return()=>{};if(va)return Qo.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Ho,n):Ho,o=t=>{var i=[],n=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!n){var r=s.maskRequestFn(e);t||(n=!r),r&&i.push(r)}})),i.length>0&&e(r({},t,{requests:i}))},a=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Zo(e)||Yo(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>sa({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>Zo(e)||Yo(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>sa({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(o,i,s),l=()=>{},u=()=>{};return(s.recordHeaders||s.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Ko("request",r.recordHeaders),n=Ko("response",r.recordHeaders),s=Us(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,_=new Request(a),g={},v={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=d.send.bind(d);d.send=e=>(ea({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=ia({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",y),d.removeEventListener("abort",y),d.removeEventListener("timeout",y)},b=()=>{if(d.readyState===d.DONE){y(),p=t.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{var t=e.split(": "),r=t.shift(),n=t.join(": ");r&&(i[r]=n)})),n&&(g.responseHeaders=i),ea({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=ia({body:d.response,options:r,url:a})),ta(t,"xmlhttprequest",_.url,h,p).then((t=>{var r=sa({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:g,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",y),d.addEventListener("abort",y),d.addEventListener("timeout",y)}catch(e){Qo.error("Failed to instrument XHR for network capture",e)}s.call(d,o,a.toString(),l,u,c)}));return()=>{s()}}(o,i,s),u=function(e,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Ko("request",i.recordHeaders),s=Ko("response",i.recordHeaders),o=Us(r,"fetch",(o=>function(){var a=t((function*(t,a){var l,u;try{l=new Request(t,a)}catch(e){return Qo.error("Failed to instrument fetch for network capture",e),o(t,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),n&&(h.requestHeaders=p),!aa(null==a?void 0:a.body)&&ea({type:"request",headers:p,url:t,recordBody:i.recordBody})&&(h.requestBody=yield function(e){return _a.apply(this,arguments)}({r:l,options:i,url:t}))}catch(e){Qo.error("Failed to record fetch request for network capture",e)}c=r.performance.now(),u=Jo(t)?yield o(l):yield o(t,a),d=r.performance.now();var _={};return u.headers.forEach(((e,t)=>{_[t]=e})),s&&(h.responseHeaders=_),ea({type:"response",headers:_,url:t,recordBody:i.recordBody})&&(h.responseBody=yield function(e){return ga.apply(this,arguments)}({r:u,options:i,url:t})),u}finally{ta(r,"fetch",l.url,c,d).then((t=>{var r,i=sa({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return a.apply(this,arguments)}}()));return()=>{o()}}(o,i,s)),va=()=>{a(),l(),u(),va=null}}var ma=e=>({name:"rrweb/network@1",observer:fa,options:e}),ya="undefined"!=typeof globalThis?globalThis:ss;ya&&"undefined"==typeof self&&(ya.self=ya),ya&&"undefined"==typeof File&&(ya.File=function(){});var ba=null!=ss?ss:{};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Xt,getRecordNetworkPlugin:ma},ba.__PosthogExtensions__.rrweb={record:Bt,version:"v2",wasMaxDepthReached:()=>pe,resetMaxDepthState(){pe=!1,he=!1}},ba.rrweb={record:Bt,version:"v2"},ba.rrwebConsoleRecord={getRecordConsolePlugin:Xt},ba.getRecordNetworkPlugin=ma;var Sa,wa,ka,xa,Ca,Ia,Ea,Ta,Ma,Ra,Pa,Fa,La,Aa,Oa,Da={},Na=[],Ba=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qa=Array.isArray;function Ha(e,t){for(var r in t)e[r]=t[r];return e}function $a(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ua(e,t,r){var i,n,s,o={};for(s in t)"key"==s?i=t[s]:"ref"==s?n=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?Sa.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===o[s]&&(o[s]=e.defaultProps[s]);return za(e,o,i,n,null)}function za(e,t,r,i,n){var s={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++ka:n,__i:-1,__u:0};return null==n&&null!=wa.vnode&&wa.vnode(s),s}function Wa(e){return e.children}function Va(e,t){this.props=e,this.context=t}function $(e,t){if(null==t)return e.__?$(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?$(e):null}function ja(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Ha({},t);s.__v=t.__v+1,wa.vnode&&wa.vnode(s),rl(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?$(t):r,!!(32&t.__u),n),s.__v=t.__v,s.__.__k[s.__i]=s,nl(i,s,n),t.__e=t.__=null,s.__e!=r&&Ga(s)}}function Ga(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some((function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e})),Ga(e)}function Qa(e){(!e.__d&&(e.__d=!0)&&xa.push(e)&&!Za.__r++||Ca!=wa.debounceRendering)&&((Ca=wa.debounceRendering)||Ia)(Za)}function Za(){try{for(var e,t=1;xa.length;)xa.length>t&&xa.sort(Ea),e=xa.shift(),t=xa.length,ja(e)}finally{xa.length=Za.__r=0}}function Ya(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,_,g,v,f,m=i&&i.__k||Na,y=t.length;for(l=function(e,t,r,i,n){var s,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(n),s=0;n>s;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[s]=za(null,o,null,null,null):qa(o)?o=e.__k[s]=za(Wa,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=za(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,l=s+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=Ja(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(n>c?h--:c>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[s]=null;if(d)for(s=0;c>s;s++)null!=(a=r[s])&&0==(2&a.__u)&&(a.__e==i&&(i=$(a)),ll(a,a));return i}(r,t,m,l,y),d=0;y>d;d++)null!=(p=r.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Da,p.__i=d,v=rl(e,p,h,n,s,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&al(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=Ka(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=g,l}function Ka(e,t,r,i){var n,s;if("function"==typeof e.type){for(n=e.__k,s=0;n&&n.length>s;s++)n[s]&&(n[s].__=e,t=Ka(n[s],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=$(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ja(e,t,r,i){var n,s,o,a=e.key,l=e.type,u=t[r],c=null!=u&&0==(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return r;if(i>(c?1:0))for(n=r-1,s=r+1;n>=0||t.length>s;)if(null!=(u=t[o=0>n?s++:n--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Xa(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Ba.test(t)?r:r+"px"}function el(e,t,r,i,n){var s,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||Xa(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Xa(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(Pa,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?i?r[Ra]=i[Ra]:(r[Ra]=Fa,e.addEventListener(t,s?Aa:La,s)):e.removeEventListener(t,s?Aa:La,s);else{if("http://www.w3.org/2000/svg"==n)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&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function tl(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ma])t[Ma]=Fa++;else if(r[Ra]>t[Ma])return;return r(wa.event?wa.event(t):t)}}}function rl(e,t,r,i,n,s,o,a,l,u){var c,d,h,p,_,g,v,f,m,y,$,b,S,w,k,x,C=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=wa.__b)&&c(t);e:if("function"==typeof C){d=o.length;try{if(m=t.props,y=C.prototype&&C.prototype.render,$=(c=C.contextType)&&i[c.__c],b=c?$?$.props.value:c.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new C(m,b):(t.__c=h=new Va(m,b),h.constructor=C,h.render=ul),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=C.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Ha({},h.__s)),Ha(h.__s,C.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==C.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==C.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),Na.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(_,g,v)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=wa.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),Na.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Ha(Ha({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(_,g)),k=null!=c&&c.type===Wa&&null==c.key?sl(c.props.children):c,a=Ya(e,qa(k)?k:[k],t,r,i,n,s,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=s&&(s[s.indexOf(a)]=null),t.__e=a}else{if(null!=s)for(x=s.length;x--;)$a(s[x]);il(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||il(t);wa.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=ol(r.__e,t,r,i,n,s,o,l,u);return(c=wa.diffed)&&c(t),128&t.__u?void 0:a}function il(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(il))}function nl(e,t,r){for(var i=0;r.length>i;i++)al(r[i],r[++i],r[++i]);wa.__c&&wa.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){wa.__e(e,t.__v)}}))}function sl(e){return"object"!=typeof e||null==e||e.__b>0?e:qa(e)?e.map(sl):void 0!==e.constructor?null:Ha({},e)}function ol(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,_,g,v=r.props||Da,f=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;s.length>u;u++)if((p=s[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,s[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(n,m,f.is&&f),a&&(wa.__m&&wa.__m(t,s),a=!1),s=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(s="textarea"==m&&null!=f.defaultValue?null:s&&Sa.call(e.childNodes),!a&&null!=s)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||el(e,u,null,p,n);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?_=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||el(e,u,p,v[u],n);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Ya("template"==t.type?e.content:e,qa(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:r.__k&&$(r,0),a,l),null!=s)for(u=s.length;u--;)$a(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&el(e,u,_,v[u],n),u="checked",null!=g&&g!=e[u]&&el(e,u,g,v[u],n))}return e}function al(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){wa.__e(e,r)}}function ll(e,t,r){var i,n;if(wa.unmount&&wa.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||al(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){wa.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&ll(i[n],t,r||"function"!=typeof e.type);r||$a(e.__e),e.__c=e.__=e.__e=void 0}function ul(e,t,r){return this.constructor(e,r)}function cl(e,t,r){var i,n,s;t==document&&(t=document.documentElement),wa.__&&wa.__(e,t),i=t.__k,n=[],s=[],rl(t,e=t.__k=Ua(Wa,null,[e]),i||Da,Da,t.namespaceURI,i?null:t.firstChild?Sa.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),nl(n,e,s),e.props.children=null}Sa=Na.slice,wa={__e(e,t,r,i){for(var n,s,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},ka=0,Va.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Ha({},this.state),"function"==typeof e&&(e=e(Ha({},r),this.props)),e&&Ha(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Qa(this))},Va.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qa(this))},Va.prototype.render=Wa,xa=[],Ia="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ea=function(e,t){return e.__v.__b-t.__v.__b},Za.__r=0,Ta=Math.random().toString(8),Ma="__d"+Ta,Ra="__a"+Ta,Pa=/(PointerCapture)$|Capture$/i,Fa=0,La=tl(!1),Aa=tl(!0),Oa=0;var dl,hl,pl,_l,gl=0,vl=[],fl=wa,ml=fl.__b,yl=fl.__r,bl=fl.diffed,Sl=fl.__c,wl=fl.unmount,kl=fl.__;function xl(e,t){fl.__h&&fl.__h(hl,e,gl||t),gl=0;var r=hl.__H||(hl.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Cl(e){return gl=1,function(e,t,r){var i=xl(dl++,2);if(i.t=e,!i.__c&&(i.__=[Dl(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,e);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=hl,!hl.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s){var a=s.call(this,e,t,r);return n?a||o:a}return!n||o};hl.__f=!0;var s=hl.shouldComponentUpdate,o=hl.componentWillUpdate;hl.componentWillUpdate=function(e,t,r){if(this.__e){var i=s;s=void 0,n(e,t,r),s=i}o&&o.call(this,e,t,r)},hl.shouldComponentUpdate=n}return i.__N||i.__}(Dl,e)}function Il(e,t){var r=xl(dl++,3);!fl.__s&&Ol(r.__H,t)&&(r.__=e,r.u=t,hl.__H.__h.push(r))}function El(e){return gl=5,Tl((function(){return{current:e}}),[])}function Tl(e,t){var r=xl(dl++,7);return Ol(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ml(e){var t=hl.context[e.__c],r=xl(dl++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(hl)),t.props.value):e.__}function Rl(){for(var e;e=vl.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ll),t.__h.some(Al),t.__h=[]}catch(r){t.__h=[],fl.__e(r,e.__v)}}}fl.__b=function(e){hl=null,ml&&ml(e)},fl.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),kl&&kl(e,t)},fl.__r=function(e){yl&&yl(e),dl=0;var t=(hl=e.__c).__H;t&&(pl===hl?(t.__h=[],hl.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&Rl(),dl=0)),pl=hl},fl.diffed=function(e){bl&&bl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vl.push(t)&&_l===fl.requestAnimationFrame||((_l=fl.requestAnimationFrame)||Fl)(Rl)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),pl=hl=null},fl.__c=function(e,t){t.some((function(e){try{e.__h.some(Ll),e.__h=e.__h.filter((function(e){return!e.__||Al(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],fl.__e(r,e.__v)}})),Sl&&Sl(e,t)},fl.unmount=function(e){wl&&wl(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Ll(e)}catch(e){t=e}})),r.__H=void 0,t&&fl.__e(t,r.__v))};var Pl="function"==typeof requestAnimationFrame;function Fl(e){var t,r=function(){clearTimeout(i),Pl&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Pl&&(t=requestAnimationFrame(r))}function Ll(e){var t=hl,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),hl=t}function Al(e){var t=hl;e.__c=e.__(),hl=t}function Ol(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Dl(e,t){return"function"==typeof t?t(e):t}function Nl(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&Rr(r.then)&&r.then(void 0,(()=>{}))}}}}var Bl="gzip-js",ql="base64",Hl="events",$l="cancelEvents",Ul={Tab:"tab",Selector:"selector"},zl={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Wl={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Vl={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},jl={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Gl={End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ql="always",Zl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Yl={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_COMPLETED:"$survey_completed",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Kl="popover";function Jl(e){return"$survey_response_"+e}function Xl(e,t){if(!t)return null;var r=e[Jl(t)];return Mr(r)?[...r]:r}function eu(e,t){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!Lr(t.originalQuestionIndex)){var r,n=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,s=Xl(e,t.id);Lr(s)||(i[n]=s)}})),r({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:Xl(e,t.id)})))},e,i)}function tu(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function ru(e){return"string"==typeof e&&e.trim()?e.trim():null}function iu(e){return e.toLowerCase()}function nu(e,t,r){if(!e||!t)return null;var i=iu(t),n=Object.keys(e).find((e=>iu(e)===i));if(n)return null==r||r.debug("Found exact translation match: "+n),n;if(i.includes("-")){var s=i.split("-")[0],o=Object.keys(e).find((e=>iu(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}function su(e,t,i){var n,s=nu(e.translations,t,i),o=r({},e),a=!1;if(s){var l,u=null==(l=e.translations)?void 0:l[s];u&&(null==i||i.info("Applying survey-level translation for language: "+s),Lr(u.name)||(o.name=u.name,a=!0),o.appearance?(o.appearance=r({},o.appearance),Lr(u.thankYouMessageHeader)||(o.appearance.thankYouMessageHeader=u.thankYouMessageHeader,a=!0),Lr(u.thankYouMessageDescription)||(o.appearance.thankYouMessageDescription=u.thankYouMessageDescription,a=!0),Lr(u.thankYouMessageCloseButtonText)||(o.appearance.thankYouMessageCloseButtonText=u.thankYouMessageCloseButtonText,a=!0),Lr(u.submitButtonText)||(o.appearance.submitButtonText=u.submitButtonText,a=!0),Lr(u.backButtonText)||(o.appearance.backButtonText=u.backButtonText,a=!0)):function(e){return!(Lr(e.thankYouMessageHeader)&&Lr(e.thankYouMessageDescription)&&Lr(e.thankYouMessageCloseButtonText)&&Lr(e.submitButtonText)&&Lr(e.backButtonText))}(u)&&(a=!0))}var c=e.questions.map((e=>function(e,t,i){var n,s=nu(e.translations,t,i);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=null==(n=e.translations)?void 0:n[s];if(!o)return{question:e,matchedKey:null,hasChanges:!1};var a=r({},e),l=!1;return Lr(o.question)||(a.question=o.question,l=!0),Lr(o.description)||(a.description=o.description,l=!0),Lr(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!Lr(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!Lr(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!Lr(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return Mr(e.choices)}(o)&&(a.choices=o.choices,l=!0),{question:l?a:e,matchedKey:l?s:null,hasChanges:l}}(e,t,i))),d=c.map((e=>e.question)),h=c.some((e=>e.hasChanges)),p=null;return s||(p=(null==(n=c.find((e=>e.matchedKey)))?void 0:n.matchedKey)||null),h&&(o.questions=d,a=!0,null==i||i.info("Applied question-level translations for language: "+t)),{survey:o,matchedKey:a?s||p:null}}function ou(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function au(e){var t;return ou(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var lu=bs("[Surveys]");function uu(e){return!(!e.start_date||e.end_date)}function cu(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var du="seenSurvey_",hu="inProgressSurvey_",pu=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),_u=e=>pu(du,e),gu=e=>{try{var t=_u(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){lu.error("Failed to persist survey seen state",e)}},vu=[Vl.Popover,Vl.Widget,Vl.API],fu={ignoreConditions:!1,ignoreDelay:!1,displayType:Kl},mu="$people_distinct_id",yu="$device_id",bu="$device_model",Su="__alias",wu="__timers",ku="$autocapture_disabled_server_side",xu="$heatmaps_enabled_server_side",Cu="$exception_capture_enabled_server_side",Iu="$error_tracking_suppression_rules",Eu="$error_tracking_capture_extension_exceptions",Tu="$web_vitals_enabled_server_side",Mu="$dead_clicks_enabled_server_side",Ru="$product_tours_enabled_server_side",Pu="$web_vitals_allowed_metrics",Fu="$session_recording_remote_config",Lu="$replay_sample_rate",Au="$replay_override_sampling",Ou="$replay_override_linked_flag",Du="$replay_override_url_trigger",Nu="$replay_override_event_trigger",Bu="$sesid",qu="$session_is_sampled",Hu="$session_past_minimum_duration",$u="$session_recording_url_trigger_activated_session",Uu="$session_recording_event_trigger_activated_session",zu="$posthog_sr_group_event_trigger_",Wu="$posthog_sr_group_url_trigger_",Vu="$posthog_sr_group_sampling_",ju="$debug_first_full_snapshot_timestamp",Gu="$sess_rec_flush_size",Qu="$enabled_feature_flags",Zu="$active_feature_flags",Yu="$early_access_features",Ku="$feature_flag_details",Ju="$feature_flag_payloads",Xu="$feature_flag_request_id",ec="$minimal_flag_called_events",tc="$override_feature_flags",rc="$override_feature_flag_payloads",ic="$stored_person_properties",nc="$stored_group_properties",sc="$surveys",oc="$surveys_loaded_at",ac="$surveys_activated",lc="$surveys_activated_session",uc="ph_product_tours",cc="$flag_call_reported",dc="$flag_call_reported_session_id",hc="$feature_flag_errors",pc="$feature_flag_evaluated_at",_c="$user_state",gc="$client_session_props",vc="$capture_rate_limit",fc="$initial_campaign_params",mc="$initial_referrer_info",yc="$initial_person_info",bc="$epp",Sc="$posthog_cookieless",wc="$cookieless_mode",kc="$sdk_debug_extensions_init_method",xc="$sdk_debug_extensions_init_time_ms",Cc="$sdk_debug_recording_script_not_loaded",Ic="$sdk_debug_replay_event_trigger_status",Ec="$sdk_debug_replay_linked_flag_trigger_status",Tc="$sdk_debug_replay_matched_recording_trigger_groups",Mc="$sdk_debug_replay_remote_trigger_matching_config",Rc="$sdk_debug_replay_trigger_groups_count",Pc="$sdk_debug_replay_url_trigger_status",Fc="$session_recording_start_reason",Lc="PostHog loadExternalDependency extension not found.",Ac="on_reject",Oc="always",Dc="anonymous",Nc="identified",Bc="identified_only",qc="visibilitychange",Hc="beforeunload",$c="$pageview",Uc="$pageleave",zc="$identify",Wc="$groupidentify";Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Br(e)&&isFinite(e)&&Math.floor(e)===e});class Vc{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new Vc(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),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 Vc(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class jc{generate(){var e=this.generateOrAbort();if(!Lr(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Lr(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Vc.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())}constructor(){this._timestamp=0,this._counter=0,this._random=new Zc}}var Gc,Qc=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ss&&!Lr(ss.crypto)&&crypto.getRandomValues&&(Qc=e=>crypto.getRandomValues(e));class Zc{nextUint32(){return this._buffer.length>this._cursor||(Qc(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var Yc=()=>Kc().toString(),Kc=()=>(Gc||(Gc=new jc)).generate(),Jc=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Xc(e,t,r){return Ls({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var ed={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Jc(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Jc(t,e))))),icontains:(e,t)=>t.map(td).some((t=>e.map(td).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(td).every((t=>e.map(td).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r<parseFloat(e)))}))},td=e=>e.toLowerCase(),rd=new Set(["is_not","not_icontains","not_regex"]);function id(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,n=null==i?void 0:i[e.key],s=e.operator||"exact";if(Lr(n)||Dr(n))return rd.has(s);var o=ed[s];return!!o&&!Lr(e.value)&&!Dr(e.value)&&o(Mr(e.value)?e.value.map(String):[String(e.value)],Mr(n)?n.map(String):[String(n)])}))}function nd(e,t){return!e||Object.entries(e).every((e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(Lr(i)||Dr(i))return!1;var n=[String(i)],s=ed[r.operator];return!!s&&s(r.values,n)}))}var sd=e=>{if(ls){try{for(var t=e+"=",r=ls.cookie.split(";").filter((e=>e.length)),i=0;r.length>i;i++){for(var n=r[i];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},od="",ad=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ld={_is_supported:()=>!!ls,_error(e){ys.error("cookieStore error: "+e)},_get:sd,_parse(e){var t;try{t=JSON.parse(ld._get(e))||{}}catch(e){}return t},_set(e,t,r,i,n){if(!ls)return!1;try{var s="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=ls),od)return od;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),n="dmn_chk_"+Yc();!od&&i--;){var s=r.slice(i).join("."),o=n+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(n)&&(t.cookie=o+";max-age=0",od=s)}return od}(e);if(!r){var i=(e=>{var t=e.match(ad);return t?t[0]:""})(e);i!==r&&ys.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(ls.location.hostname,i);if(r){var l=new Date;l.setTime(l.getTime()+864e5*r),s="; expires="+l.toUTCString()}n&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ys.warn("cookieStore warning: large cookie, len="+u.length),ls.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=ls&&ls.cookie)try{ld._set(e,"",-1,t)}catch(e){return}}},ud=null,cd={_is_supported(){if(!Dr(ud))return ud;var e=!0;if(Lr(ss))e=!1;else try{var t="__mplssupport__";cd._set(t,"xyz"),'"xyz"'!==cd._get(t)&&(e=!1),cd._remove(t)}catch(t){e=!1}return e||ys.error("localStorage unsupported; falling back to cookie store"),ud=e,e},_error(e){ys.error("localStorage error: "+e)},_get(e){try{return null==ss?void 0:ss.localStorage.getItem(e)}catch(e){cd._error(e)}return null},_parse(e){try{return JSON.parse(cd._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ss||ss.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){cd._error(e)}return!1},_remove(e){try{null==ss||ss.localStorage.removeItem(e)}catch(e){cd._error(e)}}},dd=[yu,"distinct_id",Bu,qu,bc,yc,_c],hd={},pd={_is_supported:()=>!0,_error(e){ys.error("memoryStorage error: "+e)},_get:e=>hd[e]||null,_parse:e=>hd[e]||null,_set:(e,t)=>(hd[e]=t,!0),_remove(e){delete hd[e]}},_d=null,gd={_is_supported(){if(!Dr(_d))return _d;if(_d=!0,Lr(ss))_d=!1;else try{var e="__support__";gd._set(e,"xyz"),'"xyz"'!==gd._get(e)&&(_d=!1),gd._remove(e)}catch(e){_d=!1}return _d},_error(e){ys.error("sessionStorage error: ",e)},_get(e){try{return null==ss?void 0:ss.sessionStorage.getItem(e)}catch(e){gd._error(e)}return null},_parse(e){try{return JSON.parse(gd._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ss||ss.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){gd._error(e)}return!1},_remove(e){try{null==ss||ss.sessionStorage.removeItem(e)}catch(e){gd._error(e)}}},vd=bs("[Stylesheet Loader]"),fd=ss,md=ls,yd="#020617",bd={fontFamily:"inherit",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:zl.Right,widgetType:Ul.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:yd,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Sd=[zl.Center,zl.Left,zl.Right];function wd(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function kd(e){var t;void 0===e&&(e=bd.backgroundColor),"#"===e[0]&&(t=wd(e)),e.startsWith("rgb")&&(t=e);var r={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()];if(r&&(t=wd(r)),!t)return yd;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var n=parseInt(i[1]),s=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(n*n*.299+s*s*.587+o*o*.114)>127.5?yd:"white"}return yd}var xd=(e,t,i)=>{var n=Ud(e),s=md.querySelector("."+n);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=md.createElement("div");((e,t,i)=>{var n=r({},bd,i),s=e.style,o=!Sd.includes(n.position)||t===Vl.Widget&&(null==i?void 0:i.widgetType)===Ul.Tab;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),o?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",n.borderRadius+" "+n.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||kd(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",kd(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||kd(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",kd(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);var a=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor),l=a||n.inputBackground;a||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);var u=(null==i?void 0:i.inputTextColor)||kd(l);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(o,e.type,e.appearance),o.className=n;var a=o.attachShadow({mode:"open"}),l=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var n=(e=>{var t;return Rr(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return n&&(i=n(i)),i||(vd.error("prepare_external_dependency_stylesheet returned null"),null)})(md,':host{--ph-survey-font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI","Roboto",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:2147483645;--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px rgba(0,0,0,.15);--ph-survey-submit-button-color:#000;--ph-survey-submit-button-text-color:#fff;--ph-survey-rating-bg-color:#fff;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:#000;--ph-survey-rating-active-text-color:#fff;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:#fff;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:rgba(59,130,246,.8);--ph-survey-input-background:#fff;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:0.6}.ph-survey{bottom:0;height:fit-content;margin:0;max-width:85%;min-width:300px;position:fixed;width:var(--ph-survey-max-width);z-index:var(--ph-survey-z-index)}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;color:var(--ph-survey-text-primary-color);font-family:var(--ph-survey-font-family)}.ph-survey .multiple-choice-options label,.ph-survey input[type=text],.ph-survey textarea{background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;color:var(--ph-survey-input-text-color);padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input[type=text],.ph-survey textarea{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus,.ph-survey input[type=radio]:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey textarea:focus,.ph-survey textarea:focus-visible{border-color:var(--ph-survey-rating-active-bg-color);outline:1.5px solid var(--ph-survey-outline-color);outline-offset:2px}.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey textarea:focus:not(:focus-visible){outline:none}.ph-survey input[type=text]:hover:not(:focus),.ph-survey textarea:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey input[type=text],.ph-survey textarea{font-size:1rem}}.ph-survey .form-cancel,.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit,.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey label{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);border:none;border-radius:3px 3px 0 0;color:var(--ph-widget-text-color);cursor:pointer;padding:10px 12px;position:fixed;text-align:center;transition:padding .2s ease-out;z-index:var(--ph-survey-z-index)}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{gap:16px}.bottom-section,.survey-box{display:flex;flex-direction:column}.bottom-section{gap:8px}.thank-you-message-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message{display:flex;flex-direction:column;gap:8px}.survey-question{font-size:14px;font-weight:500}.survey-question-description{font-size:13px;opacity:.8;padding-top:4px}.survey-question-description,.thank-you-message-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body) embed,:is(.survey-question-description,.thank-you-message-body) iframe,:is(.survey-question-description,.thank-you-message-body) img,:is(.survey-question-description,.thank-you-message-body) object,:is(.survey-question-description,.thank-you-message-body) video{height:auto;max-width:100%}:is(.survey-question-description,.thank-you-message-body) svg{height:auto;max-width:100%}.question-textarea-wrapper{display:flex;flex-direction:column}.survey-form{animation:ph-survey-fade-in .3s ease-out forwards}.survey-form,.thank-you-message{background:var(--ph-survey-background-color);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);margin:0;padding:var(--ph-survey-box-padding);position:relative;text-align:left;width:100%;z-index:var(--ph-survey-z-index)}.survey-form input[type=text],.survey-form textarea{min-width:100%}:is(.survey-form textarea):focus,:is(.survey-form textarea):focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.08)}:is(.survey-form textarea):focus:not(:focus-visible){box-shadow:none}:is(.survey-box .question-header--empty)~.multiple-choice-options,:is(.survey-box .question-header--empty)~textarea{margin-top:0}.multiple-choice-options{border:none;display:flex;flex-direction:column;font-size:14px;gap:8px;margin:0;padding:1px 0}.multiple-choice-options .response-choice,.multiple-choice-options label{align-items:center;color:inherit;display:flex;gap:8px}.multiple-choice-options label{cursor:pointer;font-size:13px}:is(.multiple-choice-options label):hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px rgba(0,0,0,.08)}:is(.multiple-choice-options label):has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px rgba(0,0,0,.05)}.choice-option-open:is(.multiple-choice-options label){flex-wrap:wrap}:is(.multiple-choice-options label) span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--ph-survey-input-background);border-radius:3px;cursor:pointer;flex-shrink:0;height:1rem;position:relative;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;width:1rem;z-index:1}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{animation:ph-survey-checkmark-reveal .2s ease-out .1s forwards;border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;height:8px;left:4px;transform:rotate(45deg) scale(0);width:4px}.multiple-choice-options input[type=radio]:checked:after{animation:ph-survey-radio-reveal .15s ease-out .05s forwards;background:var(--ph-survey-rating-active-text-color);border-radius:50%;height:6px;left:5px;top:5px;transform:scale(0);width:6px}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{box-sizing:content-box;content:"";position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}:is(:is(.multiple-choice-options .choice-option-open) input[type=text])::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{display:flex;justify-content:space-between}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{background-color:transparent;border:none;font-size:16px;opacity:.5;padding:0}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;overflow:hidden}.rating-options-number .ratings-number{border:none;border-right:1px solid var(--ph-survey-border-color);color:var(--ph-survey-rating-text-color);cursor:pointer;font-weight:700;text-align:center}:is(.rating-options-number .ratings-number):last-of-type{border-right:0}.rating-active:is(.rating-options-number .ratings-number){background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb,var(--ph-survey-rating-active-bg-color) 14%,var(--ph-survey-rating-bg-color))}}.rating-text{font-size:11px;justify-content:space-between;opacity:.7}.form-buttons,.rating-text{display:flex;flex-direction:row}.form-buttons{gap:8px;width:100%}.form-buttons-with-back>.form-submit{flex:1 1 auto;min-width:0}.form-submit{background:var(--ph-survey-submit-button-color);border:none;border-radius:6px;box-shadow:0 2px 0 rgba(0,0,0,.045);color:var(--ph-survey-submit-button-text-color);cursor:pointer;font-weight:700;min-width:100%;padding:12px;text-align:center;user-select:none}.form-submit:not([disabled]):hover{box-shadow:0 4px 8px rgba(0,0,0,.1);transform:scale(1.02)}.form-submit:not([disabled]):active{box-shadow:0 1px 2px rgba(0,0,0,.05);transform:scale(.98)}.form-submit[disabled]{cursor:not-allowed;opacity:var(--ph-survey-disabled-button-opacity)}.form-back{background:transparent;border:1.5px solid var(--ph-survey-border-color);border-radius:6px;color:var(--ph-survey-text-primary-color);cursor:pointer;flex:0 0 auto;font-weight:600;padding:12px 16px;text-align:center;user-select:none}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{font-size:12px;margin-top:4px;opacity:.7}.form-cancel{background:#fff;border-radius:100%;cursor:pointer;line-height:0;padding:12px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%) scale(1.1)}.footer-branding{align-items:center;display:flex;font-size:11px;font-weight:500;gap:4px;justify-content:center;opacity:.6;text-decoration:none}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{font-size:14px;opacity:.8}.limit-height{max-height:256px;overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);scrollbar-width:thin}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}:is(.limit-height::-webkit-scrollbar-thumb):hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media (prefers-reduced-motion:reduce){.ph-survey *{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg) scale(0)}50%{opacity:1;transform:rotate(45deg) scale(1.2)}to{opacity:1;transform:rotate(45deg) scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(l){var u=a.querySelector("style");u&&a.removeChild(u),a.appendChild(l)}return md.body.appendChild(o),{shadow:a,isNewlyCreated:!0}},Cd=e=>{var t=e.responses,i=e.survey,n=e.surveySubmissionId,s=e.posthog,o=e.isSurveyCompleted,a=e.properties,l=e.surveyLanguage;s?(gu(i),s.capture(Zl.SENT,r({[Yl.SURVEY_NAME]:i.name,[Yl.SURVEY_ID]:i.id,[Yl.SURVEY_ITERATION]:i.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:i.current_iteration_start_date,[Yl.SURVEY_SUBMISSION_ID]:n,[Yl.SURVEY_COMPLETED]:o},l&&{[Yl.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},eu(t,i),a,{$set:{[tu(i,"responded")]:!0}})),o&&(fd.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:i.id}})),$d(i),s.reloadFeatureFlags())):lu.error("[survey sent] event not captured, PostHog instance not found.")},Id=(e,t,i)=>{return r({[Yl.SURVEY_NAME]:e.name,[Yl.SURVEY_ID]:e.id,[Yl.SURVEY_ITERATION]:e.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[Yl.SURVEY_PARTIALLY_COMPLETED]:(n=null==t?void 0:t.responses,void 0===n&&(n={}),Object.values(n).some((e=>!Nr(e))))},(null==t?void 0:t.surveyLanguage)&&{[Yl.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==i.get_session_replay_url?void 0:i.get_session_replay_url(),[Yl.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},eu(null==t?void 0:t.responses,e));var n},Ed=(e,t,i,n)=>{if(t){if(!i){var s=qd(e);t.capture(Zl.DISMISSED,r({},Id(e,s,t),n&&{[Yl.SURVEY_LANGUAGE]:n},{$set:{[tu(e,"dismissed")]:!0}})),$d(e),gu(e),fd.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else lu.error("[survey dismissed] event not captured, PostHog instance not found.")},Td=(e,t)=>{if(t){var r=(e=>pu("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=qd(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Zl.ABANDONED,Id(e,i,t),{transport:"sendBeacon"})}}else lu.error("[survey abandoned] event not captured, PostHog instance not found.")},Md=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Rd=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Pd=e=>e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Rd(e.questions,Md(e.questions)):e.questions,Fd=e=>au(e)||Hd(e),Ld=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach((function(e){e.__e=!0,Qa(e)}))},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Oa++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Ad=()=>Ml(Ld),Od=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,n,s,o,a=Ha({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==s?i=t[s]:"ref"==s?n=t[s]:a[s]=void 0===t[s]&&null!=o?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Sa.call(arguments,2):r),za(e.type,a,i||e.key,n||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Dd(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=Vs(t);if(!n)return!1;var s=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return ed[o](s,[n])}var Nd=e=>pu(hu,e),Bd=(e,t)=>{try{localStorage.setItem(Nd(e),JSON.stringify(t))}catch(e){lu.error("Error setting in-progress survey state in localStorage",e)}},qd=e=>{try{var t=localStorage.getItem(Nd(e));if(t)return JSON.parse(t)}catch(e){lu.error("Error getting in-progress survey state from localStorage",e)}return null},Hd=e=>{var t=qd(e);return!Nr(null==t?void 0:t.surveySubmissionId)},$d=e=>{try{localStorage.removeItem(Nd(e))}catch(e){lu.error("Error clearing in-progress survey state from localStorage",e)}};function Ud(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function zd(e,t,r){if(void 0===t&&(t=zl.Right),e===Vl.ExternalSurvey)return{};switch(t){case zl.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case zl.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case zl.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case zl.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case zl.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case zl.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case zl.Left:return{left:"30px"};case zl.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Vl.Widget&&r===Ul.Tab?"60px":"30px"}}}var Wd=0;function Vd(e,t,r,i,n,s){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Wd,__i:-1,__u:0,__source:n,__self:s};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return wa.vnode&&wa.vnode(u),u}var jd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Gd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Qd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Zd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Yd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Kd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Vd("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Jd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Vd("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Xd=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return Vd("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:r,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Vd("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Vd("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:r})]})},eh=Vd("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Vd("g",{"clip-path":"url(#clip0_2415_6911)",children:[Vd("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Vd("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Vd("g",{mask:"url(#mask0_2415_6911)",children:[Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"})]})]}),Vd("defs",{children:Vd("clipPath",{id:"clip0_2415_6911",children:Vd("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function th(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return Vd("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",eh]})}function rh(e){var t=e.text,r=e.submitDisabled,i=e.appearance,n=e.onSubmit,s=e.link,o=e.onPreviewSubmit,a=e.skipSubmitButton,l=e.canGoBack,u=e.onBack,c=Ml(Ld).isPreviewMode,d=!!l&&!!u,h=!a&&Vd("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){s&&(null==ss||ss.open(s)),c?null==o||o():n()},children:t});return Vd("div",{className:"bottom-section",children:[d?Vd("div",{className:"form-buttons form-buttons-with-back",children:[Vd("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&Vd(th,{urlParams:{utm_source:"survey-footer"}})]})}function ih(e){var t=e.question,r=e.forceDisableHtml;return Vd("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Vd(t.type===jl.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&Od({component:Ua("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function nh(e){return Vd("button",{className:"form-cancel",onClick:e.onClick,disabled:Ml(Ld).isPreviewMode,"aria-label":"Close survey",type:"button",children:Xd({fill:"black"})})}Vd("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Vd("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"})});var sh=ss;function oh(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onClose,a=Ml(Ld).isPopup;return Il((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Rs(sh,"keydown",e),()=>{sh.removeEventListener("keydown",e)}}),[o]),Vd("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&Vd(nh,{onClick:()=>o()}),Vd("h3",{className:"thank-you-message-header",children:t}),r&&Od({component:Ua("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&Vd(rh,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}var ah=e=>Mr(e)&&e.every((e=>Ar(e)));function lh(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,n=e.onSubmit,s=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=Ad().isPreviewMode,d=El(null),h=Cl((()=>Ar(a)?a:"")),p=h[0],_=h[1],g=null==i?void 0:i.disableAutofocus;Il((()=>{g||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,g]);var v="surveyQuestion"+o,f=Tl((()=>function(e,t,r){var i,n,s=e.trim();if(!r&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case ar:if(void 0!==o.value&&o.value>s.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case lr:if(void 0!==o.value&&s.length>o.value)return null!==(n=o.errorMessage)&&void 0!==n?n:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=kn(t.validation,ar),y=kn(t.validation,lr),b=Tl((()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y)),[m,y]),S=()=>{f||n(p.trim())},w=()=>{f||s(p.trim())};return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:t,forceDisableHtml:r,htmlFor:v}),Vd("textarea",{ref:d,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){_(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),c?w():S())},value:p}),b&&Vd("div",{className:"validation-hint",children:b})]}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function uh(e){var t=e.question,r=e.appearance,i=e.onSubmit,n=e.onPreviewSubmit,s=e.canGoBack,o=e.onBack;return Vd(Wa,{children:[Vd("div",{className:"question-container",children:Vd(ih,{question:t,forceDisableHtml:e.forceDisableHtml})}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:s,onBack:o})]})}function ch(e){var t,r=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=r.scale,h=10===r.scale?0:1,p=Cl((()=>Br(l)?l:Mr(l)&&l.length>0&&Br(parseInt(l[0]))?parseInt(l[0]):Ar(l)&&Br(parseInt(l))?parseInt(l):null)),_=p[0],g=p[1],v="emoji"===r.display&&2===r.scale,f=Ad().isPreviewMode,m=e=>f?a(e):o(e);return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:r,forceDisableHtml:i}),Vd("div",{className:"rating-section",children:[Vd("div",{className:"rating-options",children:["emoji"===r.display&&Vd("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=vh[r.scale])?void 0:t.map(((e,t)=>Vd("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===_?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;g(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&Vd("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:fh(r.scale).map(((e,t)=>Vd(dh,{displayQuestionIndex:n,active:_===e,appearance:s,num:e,setActiveNumber(e){g(e),r.skipSubmitButton&&m(e)}},t)))})]}),!v&&Vd("div",{className:"rating-text",children:[Vd("div",{children:r.lowerBoundLabel}),Vd("div",{children:r.upperBoundLabel})]})]})]}),Vd(rh,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Dr(_)&&!r.optional,appearance:s,onSubmit:()=>o(_),onPreviewSubmit:()=>a(_),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function dh(e){var t=e.num,r=e.setActiveNumber;return Vd("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function hh(e){var t=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=El(null),h=Tl((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Rd(t,Md(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),p=Cl((()=>((e,t)=>Ar(e)||ah(e)?e:t===jl.SingleChoice?null:[])(l,t.type))),_=p[0],g=p[1],v=Cl((()=>((e,t)=>{if(Ar(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(ah(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h))),f=v[0],m=v[1],y=Ad().isPreviewMode,b=t.type===jl.SingleChoice,S=t.type===jl.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var i=!f.isSelected;return m((e=>r({},e,{isSelected:i,inputValue:i?e.inputValue:""}))),b&&g(""),void(i&&setTimeout((()=>{var e;return null==(e=d.current)?void 0:e.focus()}),75))}if(b)return g(e),m((e=>r({},e,{isSelected:!1,inputValue:""}))),void(w&&(o(e),y&&a(e)));S&&Mr(_)&&(_.includes(e)?g(_.filter((t=>t!==e))):g([..._,e]))},x=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>r({},e,{inputValue:t}))),b&&g(t)},C=e=>{e.stopPropagation(),"Enter"!==e.key||I()||(e.preventDefault(),E()),"Escape"===e.key&&(e.preventDefault(),m((e=>r({},e,{isSelected:!1,inputValue:""}))),b&&g(null))},I=()=>!(t.optional||!Dr(_)&&(!Mr(_)||f.isSelected||0!==_.length)&&(!f.isSelected||""!==f.inputValue.trim())),E=()=>{f.isSelected&&S?Mr(_)&&(y?a([..._,f.inputValue]):o([..._,f.inputValue])):y?a(_):o(_)};return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:t,forceDisableHtml:i}),Vd("fieldset",{className:"multiple-choice-options limit-height",children:[Vd("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),h.map(((e,r)=>{var i=!!t.hasOpenChoice&&r===t.choices.length-1,s="surveyQuestion"+n+"Choice"+r,o=s+"Open",a=i?f.isSelected:b?_===e:Mr(_)&&_.includes(e);return Vd("label",{className:i?"choice-option-open":"",children:[Vd("div",{className:"response-choice",children:[Vd("input",{type:b?"radio":"checkbox",name:s,checked:a,onChange:()=>k(e,i),id:s,"aria-controls":o}),Vd("span",{children:i?e+":":e})]}),i&&Vd("input",{type:"text",ref:d,id:o,name:"question"+n+"Open",value:f.inputValue,onKeyDown:C,onInput:x,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:I(),appearance:s,onSubmit:E,onPreviewSubmit:E,skipSubmitButton:w,canGoBack:u,onBack:c})]})}var ph=[1,2,3,4,5],_h=[1,2,3,4,5,6,7],gh=[0,1,2,3,4,5,6,7,8,9,10],vh={2:[Kd,Jd],3:[Qd,Gd,jd],5:[Zd,Qd,Gd,jd,Yd]};function fh(e){switch(e){case 5:default:return ph;case 7:return _h;case 10:return gh}}var mh=bs("[Surveys]");function yh(e,t,r){var i,n=e.questions[t],s=t+1;if(null==(i=n.branching)||!i.type)return t===e.questions.length-1?Gl.End:s;if(n.branching.type===Gl.End)return Gl.End;if(n.branching.type===Gl.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===Gl.ResponseBased){if(n.type===jl.SingleChoice){var o,a=n.choices.indexOf(""+r);if(-1===a&&n.hasOpenChoice&&(a=n.choices.length-1),null!=(o=n.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=n.branching.responseValues[a];return Number.isInteger(l)?l:l===Gl.End?Gl.End:s}}else if(n.type===jl.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var c=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||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(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,n.scale);if(null!=(u=n.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=n.branching.responseValues[c];return Number.isInteger(d)?d:d===Gl.End?Gl.End:s}}return s}return mh.warn("Falling back to next question index due to unexpected branching type"),s}var bh="https?://(.*)",Sh=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],wh=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Sh],kh="<masked>",xh=["li_fat_id"];function Ch(e,t,r){if(!ls)return{};var i,n=t?[...Sh,...r||[]]:[],s=Ih(Ns(ls.URL,n,kh),e),o=(i={},ws(xh,(function(e){var t=sd(e);i[e]=t||null})),i);return ks(o,s)}function Ih(e,t){var r=wh.concat(t||[]),i={};return ws(r,(function(t){var r=Ds(e,t);i[t]=r||null})),i}function Eh(e){var t=function(e){return e?0===e.search(bh+"google.([^/?]*)")?"google":0===e.search(bh+"bing.com")?"bing":0===e.search(bh+"yahoo.com")?"yahoo":0===e.search(bh+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Dr(t)){i.$search_engine=t;var n=ls?Ds(ls.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function Th(){return navigator.language||navigator.userLanguage}var Mh="$direct";function Rh(){return(null==ls?void 0:ls.referrer)||Mh}function Ph(e,t,r){void 0===r&&(r=!1);var i=e?[...Sh,...t||[]]:[],n=r?on(null==us?void 0:us.href):null==us?void 0:us.href,s=null==n?void 0:n.substring(0,1e3);return{r:Rh().substring(0,1e3),u:s?Ns(s,i,kh):void 0}}function Fh(e,t){var r;void 0===t&&(t=!1);var i=e.r,n=e.u,s=t?on(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==Mh?Mh:null==(r=As(i))?void 0:r.host};if(s){o.$current_url=s;var a=As(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Ih(s);ks(o,l)}if(i){var u=Eh(i);ks(o,u)}return o}function Lh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ah(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Oh=bs("[SurveyTranslations]");function Dh(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,n=ru(e.overrideLanguage);if(n)return null==t||t.info("Using override display language: "+n),n;var s=function(e){return e&&"object"==typeof e&&"language"in e?ru(e.language):null}(r);if(s)return null==t||t.info("Using person property language: "+s),s;var o=ru(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Rr(e.get_property)?e.get_property(ic):void 0,locale:Th()},Oh)}(t);if(!r)return Oh.info("No user language detected"),{survey:e,language:null};var i=su(e,r,Oh);return{survey:i.survey,language:i.matchedKey}}var Nh=ss,Bh=ls,qh="ph:show_survey_widget",Hh="PHWidgetSurveyClickListener";function $h(e,t){try{var r=e.getBoundingClientRect(),i=Nh.innerHeight,n=Nh.innerWidth,s=r.left+r.width/2-t/2;s+t>n-20&&(s=n-t-20),20>s&&(s=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:s+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:bd.zIndex}}catch(e){return lu.warn("Failed to calculate trigger position:",e),null}}class Uh{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._prefillHandledSurveys=new Set,this.handlePageUnload=()=>{var e=this._posthog.get_property(sc);if(e)for(var t of e)Hd(t)&&Td(t,this._posthog)},this.handlePopoverSurvey=(e,t)=>{var i,n,s,o,a=this._translateSurveyForRendering(e),l=a.survey,u=a.language,c=null!=t&&t.position||null!=t&&t.selector?r({},l,{appearance:r({},l.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):l;this._clearSurveyTimeout(c.id);var d=null!=t?t:{},h=d.properties,p=d.initialResponses,_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(c,p,h,u);if(!_||null!=(i=c.appearance)&&i.displayThankYouMessage){this._addSurveyToFocus(c);var g={};if((null==(n=c.appearance)?void 0:n.position)===zl.NextToTrigger&&null!=(s=c.appearance)&&s.widgetSelector){var v,f=Bh.querySelector(c.appearance.widgetSelector);f&&(g=$h(f,parseInt((null==(v=c.appearance)?void 0:v.maxWidth)||bd.maxWidth))||{})}var m=(null==(o=c.appearance)?void 0:o.surveyPopupDelaySeconds)||0,y=xd(c,this._posthog).shadow,b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(0>=m)return cl(Vd(jh,r({},b)),y);var S=setTimeout((()=>{if(this._surveyTimeouts.delete(c.id),!this._shouldDisplaySurvey(c))return lu.info("Survey "+c.id+" no longer eligible when its display delay elapsed; not displaying"),this._removeSurveyFromFocus(c);cl(Vd(jh,r({},b,{survey:r({},c,{appearance:r({},c.appearance,{surveyPopupDelaySeconds:0})})})),y)}),1e3*m);this._surveyTimeouts.set(c.id,S)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xd(r,this._posthog),s=n.shadow;n.isNewlyCreated&&cl(Vd(Qh,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),s)},this._removeWidgetSelectorListener=e=>{this._removeSurveyFromDom(e);var t=this._widgetSelectorListeners.get(e.id);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Hh),this._widgetSelectorListeners.delete(e.id),lu.info("Removed click listener for survey "+e.id))},this._manageWidgetSelectorListener=(e,t)=>{var r=Bh.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;lu.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._removeWidgetSelectorListener(e)}if(!r.hasAttribute(Hh)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===zl.NextToTrigger?$h(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||bd.maxWidth)):{};Nh.dispatchEvent(new CustomEvent(qh,{detail:{surveyId:e.id,position:n}}))};Rs(r,"click",n),r.setAttribute(Hh,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),lu.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xd(r,this._posthog).shadow;cl(Vd(jh,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),n)},this.renderSurvey=(e,t,r)=>{var i,n=this._translateSurveyForRendering(e),s=n.survey,o=n.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(s,o,r)),cl(Vd(jh,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys((r=>{var i=r.filter((e=>t._shouldDisplaySurvey(e)));e(i)}),r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys((e=>{var r=e.filter((e=>e.type===Vl.Popover||e.type===Vl.Widget)),i=new Set(r.map((e=>e.id)));for(var n of Array.from(t._surveyTimeouts.keys()))i.has(n)||t.cancelSurvey(n);var s=t._sortSurveysByAppearanceDelay(r),o=new Set;s.forEach((e=>{if(e.type===Vl.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===Ul.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Ul.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}Dr(t._surveyInFocus)&&e.type===Vl.Popover&&t.handlePopoverSurvey(e)})),t._widgetSelectorListeners.forEach((e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{Dr(this._surveyInFocus)||lu.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&lu.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(lu.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null))}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,n=Hd(e),s=Hd(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===Ql,a=t.schedule===Ql;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)}))}_translateSurveyForRendering(e){return Dh(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=e.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var o=s.split("="),a=o[0],l=o[1];if(a&&!Lr(l)){var u=decodeURIComponent(a),c=decodeURIComponent(l);if("auto_submit"!==u||"true"!==c){var d=u.match(/^q(\d+)$/);if(d){var h=parseInt(d[1],10);t[h]||(t[h]=[]),t[h].push(c)}}else r=!0}}return{params:t,autoSubmit:r}}(Nh.location.search),n=i.params;if(0===Object.keys(n).length)return!1;lu.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,n,t);if(!s)return!1;var o=s.responses,a=s.submissionId,l=s.isSurveyCompleted,u=s.skippedResponses;return(Object.keys(u).length>0&&e.enable_partial_responses||l)&&Cd({responses:l?o:u,survey:e,surveySubmissionId:a,posthog:this._posthog,isSurveyCompleted:l,properties:r,surveyLanguage:t}),this._prefillHandledSurveys.add(e.id),l}_handleInitialResponses(e,t,r,i){var n={};for(var s of Object.entries(t)){var o=s[1];n[parseInt(s[0])]=Mr(o)?o.map(String):[String(o)]}lu.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);if(!a)return!1;var l=a.isSurveyCompleted;return Cd({responses:a.responses,survey:e,surveySubmissionId:a.submissionId,posthog:this._posthog,isSurveyCompleted:l,properties:r,surveyLanguage:i}),l}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach(((e,i)=>{if(t[i]&&e.id){var n=t[i],s=Jl(e.id);try{switch(e.type){case jl.SingleChoice:if(!e.choices||0===e.choices.length)return void ys.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(n[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void ys.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case jl.MultipleChoice:if(!e.choices||0===e.choices.length)return void ys.warn("[Survey Prefill] Question "+i+" has no choices");var a=n.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void ys.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&ys.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case jl.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void ys.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:ys.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){ys.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return lu.warn("[Survey Prefill] No valid responses after conversion"),null;var n=Yc(),s=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,n={},s=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=Jl(l.id);Lr(r[u])||(n[u]=r[u])}s.push(i);var c=yh(e,i,l.id?r[Jl(l.id)]:null);if(c===Gl.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:s};i=c}return{startQuestionIndex:i,skippedResponses:n,skippedIndices:s}}(e,s,i),a=o.startQuestionIndex,l=o.skippedResponses,u=a>=e.questions.length;return Bd(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:a,visitedIndices:o.skippedIndices,surveyLanguage:r}),lu.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:a,isSurveyCompleted:u,skippedResponses:l}}catch(e){return lu.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){var r;if(void 0===t&&(t=void 0),!e)return!0;var i,n=!(null==(r=this._posthog.featureFlags)||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),s=!0;return t&&(s=(null==(i=this._posthog.featureFlags)?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),n&&s}_isSurveyConditionMatched(e){return!e.conditions||Dd(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,n;if(!e||0===e.length)return!0;if(!_s)return!1;var s=rn(_s,{userAgentDataPlatform:null==as||null==(r=as.userAgentData)?void 0:r.platform,maxTouchPoints:null==as?void 0:as.maxTouchPoints,screenWidth:null==ss||null==(i=ss.screen)?void 0:i.width,screenHeight:null==ss||null==(n=ss.screen)?void 0:n.height,devicePixelRatio:null==ss?void 0:ss.devicePixelRatio});return ed[null!=t?t:"icontains"](e,[s])}(null==(t=e.conditions)?void 0:t.deviceTypes,null==(r=e.conditions)?void 0:r.deviceTypesMatchType)}(e)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==md||!md.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Fd(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._posthog.featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!uu(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!vu.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var n=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var s,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=new Date,n=Math.abs(i.getTime()-r.getTime());return Math.ceil(n/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,cd._get("lastSeenSurveyDate"))?(e=>!!cd._get(_u(e))&&!Fd(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(s=o.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!ou(e)&&!cu(e))return!0;var r=null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)?void 0:t.getSurveys();return!(null==r||!r.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every((e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=Bh.querySelector(Ud(e,!0));null!=t&&t.shadowRoot&&cl(null,t.shadowRoot),null==t||t.remove()}catch(t){lu.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this)}}}function zh(e,t){if(Bh&&Nh){var r,i=new Uh(e);if(e.config.disable_surveys_automatic_display)return lu.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return lu.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{Lr(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))};return n(),Rs(Bh,"visibilitychange",(()=>{Bh.hidden?Lr(r)||(clearInterval(r),r=void 0):(i.callSurveysAndEvaluateDisplayLogic(!1),n())})),i}}function Wh(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,n=e.setSurveyVisible,s=e.isPreviewMode,o=void 0!==s&&s,a=e.posthog;Il((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===Vl.Widget,s=Dd(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===Ul.Tab&&r;if(!s)return lu.info("Hiding survey "+t.id+" because URL does not match"),n(!1),i(t);o&&(lu.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),n(!0))};Rs(Nh,"popstate",r),Rs(Nh,"hashchange",r);var s=Nh.history.pushState,l=Nh.history.replaceState;return Nh.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.apply(this,t),r()},Nh.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{Nh.removeEventListener("popstate",r),Nh.removeEventListener("hashchange",r),Nh.history.pushState=s,Nh.history.replaceState=l}}}),[o,t,i,n,a])}function Vh(e){switch(void 0===e&&(e=Wl.Right),e){case Wl.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Wl.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Wl.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function jh(e){var t,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.style,h=void 0===d?{}:d,p=e.previewPageIndex,_=e.removeSurveyFromFocus,g=void 0===_?()=>{}:_,v=e.isPopup,f=void 0===v||v,m=e.onPreviewSubmit,y=void 0===m?()=>{}:m,b=e.onPreviewBack,S=void 0===b?()=>{}:b,w=e.onPopupSurveyDismissed,k=void 0===w?()=>{}:w,x=e.onCloseConfirmationMessage,C=void 0===x?()=>{}:x,I=e.properties,E=e.isSurveyCompleted,T=e.skipShownEvent,M=e.surveyLanguage,R=El(null),P=Number.isInteger(p),F=null!=(t=l.appearance)&&t.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,L=function(e,t,i,n,s,o,a,l,u){var c=Cl(n||0===i||e.type===Vl.ExternalSurvey),d=c[0],h=c[1],p=Cl(!1),_=p[0],g=p[1],v=()=>{var t=()=>{o&&s(e),h(!1)};Bh.startViewTransition?Bh.startViewTransition((()=>{var e;null==a||null==(e=a.current)||e.remove()})).finished.then((()=>{setTimeout((()=>{t()}),100)})):t()},f=t=>{t.detail.surveyId===e.id&&v()};return Il((()=>{if(t){if(!n){var s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return v();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&setTimeout((()=>{v()}),5e3)}},o=()=>{if(Dd(e,t)){h(!0),Nh.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(Zl.SHOWN,r({[Yl.SURVEY_NAME]:e.name,[Yl.SURVEY_ID]:e.id,[Yl.SURVEY_ITERATION]:e.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[Yl.SURVEY_LANGUAGE]:u},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};if(Rs(Nh,"PHSurveyClosed",f),Rs(Nh,"PHSurveySent",s),i>0){var a=setTimeout(o,i);return()=>{clearTimeout(a),Nh.removeEventListener("PHSurveyClosed",f),Nh.removeEventListener("PHSurveySent",s)}}return o(),()=>{Nh.removeEventListener("PHSurveyClosed",f),Nh.removeEventListener("PHSurveySent",s)}}}else lu.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Wh({survey:e,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:t}),{isPopupVisible:d,isSurveySent:_,setIsPopupVisible:h,hidePopupWithViewTransition:v}}(l,c,F,P,g,f,R,T,M),A=L.isPopupVisible,O=L.hidePopupWithViewTransition,D=L.isSurveySent||p===l.questions.length||!0===E,N=Tl((()=>{var e=qd(l),t=(null==e?void 0:e.surveySubmissionId)||Yc();return{isPreviewMode:P,previewPageIndex:p,onPopupSurveyDismissed(){M?Ed(l,c,P,M):Ed(l,c,P),k()},isPopup:f||!1,surveySubmissionId:t,onPreviewSubmit:y,onPreviewBack:S,posthog:c,properties:I,surveyLanguage:M}}),[P,p,f,c,l,k,y,S,I,M]);return A?Vd(Ld.Provider,{value:N,children:Vd("div",{className:"ph-survey",style:r({},zd(l.type,null==(i=l.appearance)?void 0:i.position,null==(n=l.appearance)?void 0:n.widgetType),h),ref:R,children:D?Vd(oh,{header:(null==(s=l.appearance)?void 0:s.thankYouMessageHeader)||"Thank you!",description:(null==(o=l.appearance)?void 0:o.thankYouMessageDescription)||"",forceDisableHtml:!!u,contentType:null==(a=l.appearance)?void 0:a.thankYouMessageDescriptionContentType,appearance:l.appearance||bd,onClose(){O(),C()}}):Vd(Gh,{survey:l,forceDisableHtml:!!u,posthog:c})})}):null}function Gh(e){var t,i,n=e.survey,s=e.forceDisableHtml,o=e.posthog,a=Cl((()=>{var e=qd(n);return null!=e&&e.responses&&lu.info("Survey is already in progress, filling in initial responses"),(null==e?void 0:e.responses)||{}})),l=a[0],u=a[1],c=Ml(Ld),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,_=c.onPreviewSubmit,g=c.onPreviewBack,v=c.surveySubmissionId,f=c.isPreviewMode,m=c.properties,y=c.surveyLanguage,b=Cl((()=>{var e=qd(n);return d||(null==e?void 0:e.lastQuestionIndex)||0})),S=b[0],w=b[1],k=Cl((()=>{var e,t=qd(n);return null!==(e=null==t?void 0:t.visitedIndices)&&void 0!==e?e:[]})),x=k[0],C=k[1],I=Tl((()=>Pd(n)),[n]);Il((()=>{f&&!Lr(d)&&w(d)}),[d,f]);var E=!(null==(t=n.appearance)||!t.allowGoBack)&&(f?(null!=d?d:0)>0:x.length>0),T=I.at(S);return T?Vd("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(i=n.appearance)?void 0:i.hideCancelButton)&&Vd(nh,{onClick(){h()}}),Vd("div",{className:"survey-box","data-question-index":S,children:Zh({question:T,forceDisableHtml:s,displayQuestionIndex:S,appearance:n.appearance||bd,onSubmit:e=>(e=>{var t=e.res,i=e.displayQuestionIndex,s=e.questionId;if(o)if(s){var a=Jl(s),c=r({},l,{[a]:t});u(c);var d=yh(n,i,t),h=d===Gl.End,p=[...x,i];if(h||(C(p),w(d),Bd(n,{surveySubmissionId:v,responses:c,lastQuestionIndex:d,visitedIndices:p,surveyLanguage:y})),n.enable_partial_responses||h){var _=new Set(p.map((e=>{var t;return null==(t=I[e])?void 0:t.id})).filter((e=>!!e)).map((e=>Jl(e)))),g=Object.fromEntries(Object.entries(c).filter((e=>_.has(e[0]))));Cd({responses:g,survey:n,surveySubmissionId:v,isSurveyCompleted:h,posthog:o,properties:m,surveyLanguage:y})}}else lu.error("onNextButtonClick called without a questionId.");else lu.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:S,questionId:T.id}),onPreviewSubmit:_,initialValue:T.id?l[Jl(T.id)]:void 0,canGoBack:E,onBack(){if(f)g();else if(0!==x.length){var e=x[x.length-1],t=x.slice(0,-1);C(t),w(e),Bd(n,{surveySubmissionId:v,responses:l,lastQuestionIndex:e,visitedIndices:t,surveyLanguage:y})}}})})]}):null}function Qh(e){var t,r,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=Cl(!0),_=p[0],g=p[1],v=Cl(!1),f=v[0],m=v[1],y=Cl({}),b=y[0],S=y[1],w=()=>{m(!f)};if(Il((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(lu.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),w())};return Rs(Nh,qh,t),()=>{Nh.removeEventListener(qh,t)}}}else lu.error("FeedbackWidget called without a PostHog instance.")}),[c,d,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),Wh({survey:l,setSurveyVisible:g,posthog:c}),!_)return null;var k=()=>{l.schedule!==Ql&&g(!1),setTimeout((()=>{m(!1)}),200)};return Vd(Wa,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&Vd("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===Wl.Top?"widget-tab-top":""),onClick:w,disabled:d,style:Vh(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Vd(jh,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:k,onCloseConfirmationMessage:k,surveyLanguage:h})]})}var Zh=e=>{var t=e.question,i=e.onSubmit,n=e.onPreviewSubmit,s={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){n(e)},onSubmit(e){i(e)},initialValue:e.initialValue,displayQuestionIndex:e.displayQuestionIndex,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case jl.Open:return Ua(lh,r({},s,{question:t,key:t.id}));case jl.Link:return Ua(uh,r({},s,{question:t,key:t.id}));case jl.Rating:return Ua(ch,r({},s,{question:t,key:t.id}));case jl.SingleChoice:case jl.MultipleChoice:return Ua(hh,r({},s,{question:t,key:t.id}));default:return lu.error("Unsupported question type: "+t.type),null}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.generateSurveys=zh,ba.extendPostHogWithSurveys=zh;var Yh=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),Kh=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return Yh(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var n=0,s=Math.min(e.length,r.remaining-2);s>n;){var o=Math.ceil((n+s)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?s=o-1:n=o}return Yh(t,JSON.stringify(e.slice(0,n)),r)},Jh=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Xh=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},ep=(e,t,r)=>{if(!r.truncated)if(Pr(e)){if(r.seen.has(e))return void Xh(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(ep(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else Xh(t,e,r)},tp=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!Jh(e))return!n||Yh(t,"null",r);if(Dr(e)||(e=>{try{return Br(e)||Hr(e)}catch(e){return!1}})(e))return Yh(t,JSON.stringify(e),r);if("string"==typeof e)return Kh(e,t,r);if(!Pr(e)&&!Mr(e))return Yh(t,JSON.stringify(e),r);if(i.has(e))return Kh("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Rr(o))return tp(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return Kh(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return Yh(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return tp(l,t,r,i,n,s)}if(Mr(e)){if(!Yh(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!Yh(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!tp(d,t,r,i,!0))return!1}return Yh(t,"]",r)}if(!Yh(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var _=void 0;try{_=e[p]}catch(e){continue}if(s)try{ep(_,p,s)}catch(e){}if(Jh(_)){var g=(h?"":",")+JSON.stringify(p)+":";if(g.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!Yh(t,g,r))return!1;var y=t.length,b=tp(_,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return Yh(t,"}",r)},rp={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.logs={initializeLogs(e){var t={host:ba.location.host},i=!1,n=function(n){var s=ba.console[n],o=(s=>function(){for(var o=!1,a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];try{if(l.length>0&&!i&&e.is_capturing()){var c;i=!0,o=!0;var d=((e,t)=>{for(var r=[],i={remaining:1e4,truncated:!1},n=Pr(e[0])?{result:{},keysRemaining:50,sizeRemaining:1e4,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||Yh(r," ",i))&&tp(e[s],r,i,new WeakSet,!1,0===s?n:void 0);s++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==n?void 0:n.result)||{}}})(l),h=d.body,p=d.attributes,_=r({},t,d.truncated?{body_truncated:"true"}:{});null==(c=e.logs)||c._captureConsoleLog({level:rp[n],body:h,attributes:r({"log.source":"console."+n},_,p)})}}catch(e){}finally{o&&(i=!1),s.apply(ba.console,l)}})(s);o.__rrweb_original__=(e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e})(s),ba.console[n]=o};for(var s of Object.keys(rp))n(s)}};var ip=bs("[Error tracking]");function np(){return new Tn([new $n,new Kn,new zn,new Un,new Zn,new Qn,new Vn,new Yn],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];return function(t,n){void 0===n&&(n=0);for(var s=[],o=t.split("\n"),a=n;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=qn.test(l)?l.replace(qn,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of i){var d=c(u,e);if(d){s.push(d);break}}if(s.length>=Hn)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Hn).map((e=>{return r({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||Mn});var i}))}(s)}}("web:javascript",On,Bn))}var sp=bs("[ExceptionAutocapture]"),op=np(),ap={wrapOnError(e){var t=ss;t||sp.info("window not available, cannot wrap onerror");var r=t.onerror;return t.onerror=function(){var t,i=op.buildFromUnknown((arguments.length>4?arguments[4]:void 0)||(arguments.length>0?arguments[0]:void 0),{mechanism:{handled:!1}});return e(i),!!Rr(r)&&null!==(t=r(...arguments))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.onerror)||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=r}},wrapUnhandledRejection(e){var t=ss;t||sp.info("window not available, cannot wrap onUnhandledRejection");var r=t.onunhandledrejection;return t.onunhandledrejection=function(t){var i,n=op.buildFromUnknown(t,{mechanism:{handled:!1}});return e(n),!!Rr(r)&&null!==(i=r(t))&&void 0!==i&&i},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=r}},wrapConsoleError(e){var t=console;t||sp.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];t=1==n.length?n[0]:n.join(" ");var o=n.find((e=>e instanceof Error)),a=op.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),Rr(r)&&r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.errorWrappingFunctions=ap,ba.posthogErrorWrappingFunctions=ap;var lp="X-POSTHOG-SESSION-ID",up="X-POSTHOG-WINDOW-ID",cp="X-POSTHOG-DISTINCT-ID",dp=[lp,up,cp],hp=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],pp=(e,t)=>({}.hasOwnProperty.call(e,t)),_p=e=>"object"==typeof e&&!Dr(e)||Rr(e),gp=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),vp=e=>{try{var t;return gp(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==ss||null==(t=ss.location)?void 0:t.href).toString()}catch(e){return}},fp=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(Mr(e)&&!e.includes(s))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;n.set(lp,a.sessionId),n.set(up,l),o=!0}var u=(e=>Rr(e)?e():e)(t);return u&&u!==Sc&&(n.set(cp,u),o=!0),o};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{};var mp={_patchFetch:(e,t,i)=>Us(ss,"fetch",(n=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=vp(s);if(u)if(gp(s)){var c=new Request(s,o);fp(e,t,i,c.url,c.headers),l=[c]}else{var d=new Headers(_p(o)?o.headers:void 0);if(fp(e,t,i,u,d)){var h=((e,t)=>{if(Lr(e)||Dr(e))return{headers:t};if(_p(e)){var i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var n=Object.create(i);return Object.defineProperty(n,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),n}return new Proxy({headers:t},{get:(e,t)=>pp(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>pp(e,t)||t in i,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach((e=>t.add(e))),hp.forEach((e=>{e in i&&t.add(e)})),Array.from(t)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n)return n;if("string"==typeof t&&hp.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};var s=Reflect.getOwnPropertyDescriptor(i,t);return s?r({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})}})(o,d);h&&(l=[s,h])}}}catch(e){l=a}return n.apply(this,l)})),_patchXHR:(e,t,r)=>Us(ss.XMLHttpRequest.prototype,"open",(i=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=vp(s);d&&fp(e,t,r,d,c);var h=i.call(u,n,s,o,a,l);return dp.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};ba.__PosthogExtensions__.tracingHeadersPatchFns=mp,ba.postHogTracingHeadersPatchFns=mp,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0});var yp=-1,bp=e=>{addEventListener("pageshow",(t=>{t.persisted&&(yp=t.timeStamp,e(t))}),!0)},Sp=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},wp=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},kp=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},xp=()=>{var e,t;return null!==(e=null==(t=kp())?void 0:t.activationStart)&&void 0!==e?e:0},Cp=function(e,t){void 0===t&&(t=-1);var r=kp(),i="navigate";return 0>yp?r&&(document.prerendering||xp()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Ip=new WeakMap;function Ep(e,t){var r=Ip.get(t);return r||(r=new WeakMap,Ip.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Tp{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}}var Mp,Rp=function(e,t,i){void 0===i&&(i={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return n.observe(r({type:e,buffered:!0},i)),n}}catch(e){}},Pp=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Fp=-1,Lp=new Set,Ap=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Op=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Lp)t();isFinite(Fp)||(Fp="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Op,!0))}},Dp=()=>{if(0>Fp){var e,t=xp(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Fp=null!=r?r:Ap(),addEventListener("visibilitychange",Op,!0),addEventListener("prerenderingchange",Op,!0),bp((()=>{setTimeout((()=>{Fp=Ap()}))}))}return{get firstHiddenTime(){return Fp},onHidden(e){Lp.add(e)}}},Np=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Bp=[1800,3e3],qp=function(e,t){void 0===t&&(t={}),Np((()=>{var r,i=Dp(),n=Cp("FCP"),s=Rp("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-xp(),0),n.entries.push(t),r(!0)))}));s&&(r=Sp(e,n,Bp,t.reportAllChanges),bp((i=>{n=Cp("FCP"),r=Sp(e,n,Bp,t.reportAllChanges),wp((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},Hp=[.1,.25],$p=0,Up=1/0,zp=0,Wp=e=>{for(var t of e)t.interactionId&&(Up=Math.min(Up,t.interactionId),zp=Math.max(zp,t.interactionId),$p=zp?(zp-Up)/7+1:0)},Vp=()=>{var e;return Mp?$p:null!==(e=performance.interactionCount)&&void 0!==e?e:0},jp=0;class Gp{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){jp=Vp(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((Vp()-jp)/50));return this.l[e]}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.u.get(e.interactionId);if(i||10>this.l.length||e.duration>r.L){var n;if(i?e.duration>i.L?(i.entries=[e],i.L=e.duration):e.duration===i.L&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.u.set((i={id:e.interactionId,entries:[e],L:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.L-e.L)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.u.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}}var Qp=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Pp(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},Zp=[200,500];class Yp{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var Kp=[2500,4e3],Jp={onLCP(e,t){void 0===t&&(t={}),Np((()=>{var r,i=Dp(),n=Cp("LCP"),s=Ep(t,Yp),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.h(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-xp(),0),n.entries=[o],r())},a=Rp("largest-contentful-paint",o);if(a){r=Sp(e,n,Kp,t.reportAllChanges);var l=Pp((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(Qp(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});bp((i=>{n=Cp("LCP"),r=Sp(e,n,Kp,t.reportAllChanges),wp((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},onCLS(e,t){void 0===t&&(t={});var r=Dp();qp(Pp((()=>{var i,n=Cp("CLS",0),s=Ep(t,Tp),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=Rp("layout-shift",o);a&&(i=Sp(e,n,Hp,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),bp((()=>{s.i=0,n=Cp("CLS",0),i=Sp(e,n,Hp,t.reportAllChanges),wp(i)})),setTimeout(i))})))},onFCP:qp,onINP(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Dp();Np((()=>{var i;"interactionCount"in performance||Mp||(Mp=Rp("event",Wp,{durationThreshold:0}));var n,s=Cp("INP"),o=Ep(t,Gp),a=e=>{Qp((()=>{for(var t of e)o.h(t);var r=o.T();r&&r.L!==s.value&&(s.value=r.L,s.entries=r.entries,n())}))},l=Rp("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Sp(e,s,Zp,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),bp((()=>{o.v(),s=Cp("INP"),n=Sp(e,s,Zp,t.reportAllChanges)})))}))}}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.postHogWebVitalsCallbacks=Jp,ba.postHogWebVitalsCallbacks=Jp,ba.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Jp;class Xp{constructor(e){this.disabled=!1===e;var t=Pr(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var e_="$copy_autocapture",t_=bs("[AutoCapture]");function r_(e,t){return t.length>e?t.slice(0,e)+"...":t}function i_(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ks(t));return t}function n_(e,t){var i,n,s=t.e,o=t.maskAllElementAttributes,a=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,c=t.disableCaptureUrlHashes;if(!Ks(e))return{props:{}};for(var d=[e],h=new Set([e]),p=e;p.parentNode&&!Js(p,"body")&&to>d.length;)if(eo(p.parentNode)){var _=p.parentNode.host;if(h.has(_))break;h.add(_),d.push(_),p=_}else{if(!Ks(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var g,v,f=[],m={},y=!1,b=!1;if(ws(d,(e=>{var t=wo(e);if(Js(e,"a")){var r=e.getAttribute("href");y=!!(t&&r&&Po(r))&&(c?on(r):r)}wr(no(e),"ph-no-capture")&&(b=!0),f.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};lo.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?r_(1024,Fo(e)):r_(1024,oo(e)));var a=no(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),ws(e.attributes,(function(r){var s;if((!ko(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Po(r.value)&&(!Ar(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=ro(a).join(" ")),o["attr__"+r.name]=r_(1024,"href"===r.name&&n?on(a):a)}}));for(var l=1,u=1,c=e;c=i_(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,l,c));var i=function(e){if(!wo(e))return{};var t={};return ws(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Po(i)&&(t[r]=i)}})),t}(e);ks(m,i)})),b)return{props:{},explicitNoCapture:b};if(a||(f[0].$el_text=Js(e,"a")||Js(e,"button")?Fo(e):oo(e)),y){var S,w;f[0].attr__href=y;var k=null==(S=As(y))?void 0:S.host,x=null==ss||null==(w=ss.location)?void 0:w.host;k&&x&&k!==x&&(g=y)}return{props:ks({$event_type:s.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(v=f,function(e){return e.map((e=>{var t,i,n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))n+="."+s.replace(/"/g,"");var o=r({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return xs(o).sort(((e,t)=>e[0].localeCompare(t[0]))).forEach((e=>{var t=e[1];return a[Ao(e[0].toString())]=Ao(t.toString())})),(n+=":")+xs(a).map((e=>e[0]+'="'+e[1]+'"')).join("")})).join(";")}(function(e){return e.map((e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Oo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return xs(e).filter((e=>0===e[0].indexOf("attr__"))).forEach((e=>i.attributes[e[0]]=e[1])),i}))}(v)))},null!=(i=f[0])&&i.$el_text?{$el_text:null==(n=f[0])?void 0:n.$el_text}:{},g&&"click"===s.type?{$external_click_url:g}:{},m)}}var s_={};function o_(e,t){var r=s_[e];if(r)return r;var i=t[e];if((e=>Rr(e)&&-1!==e.toString().indexOf("[native code]"))(i)&&(null==ss||!ss.Zone))return s_[e]=i.bind(t);var n=t.document;if(n&&Rr(n.createElement)){var s,o=!1;try{(s=n.createElement("iframe")).hidden=!0,n.head.appendChild(s);var a,l,u=s.contentWindow;u&&u[e]&&(i=u[e],"MutationObserver"===e&&function(e){return wr(e,"AppleWebKit")&&!wr(e,"Chrome")}(null!==(a=null==(l=t.navigator)?void 0:l.userAgent)&&void 0!==a?a:"")&&(s.classList.add("rr-block","ph-no-capture"),o=!0))}catch(t){ys.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}finally{var c;!o&&null!=(c=s)&&c.parentNode&&s.parentNode.removeChild(s)}}return i&&Rr(i)?s_[e]=i.bind(t):i}function a_(e,t){var i=ao(e);return i?r({node:i,originalEvent:e,timestamp:Date.now()},t):null}function l_(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function u_(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var c_="canvas,video,audio,embed,object";function d_(e,t){return Br(e)&&e>=t}class h_{_asRequiredConfig(e){var t,r,i,n,s,o,a,l,u=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:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._onClick=e=>{var t=a_(e,{type:"click"});Dr(t)||this._ignore(t)||this._clicks.push(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach((t=>{Lr(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{"visible"===(null==ls?void 0:ls.visibilityState)&&(this._lastVisibilityChange=Date.now())},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!Lr(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var i=e,n=null==(t=i.changedTouches)?void 0:t[0];if(n){var s=n.clientX-r.x,o=n.clientY-r.y,a=s*s+o*o,l=this._config.swipe_threshold_px;if(a>=l*l&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some((e=>Br(e)&&e>=r.timestamp))){var u;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==ls||null==ls.elementsFromPoint?void 0:ls.elementsFromPoint(r.x,r.y))&&void 0!==u?u:[]).some((e=>null==e.matches?void 0:e.matches(c_))))return;var c=a_(i,{type:"swipe",swipeDirection:l_(s,o),swipeDistancePx:Math.round(Math.sqrt(a))});Dr(c)||this._ignore(c)||this._clicks.push(c),this._scheduleCheck()}}}},this.instance=e,this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return o_("MutationObserver",e)}(ba);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)||e.disconnect(),this._mutationObserver=void 0,ba.removeEventListener("click",this._onClick),ba.removeEventListener("scroll",this._onScroll,{capture:!0}),ba.removeEventListener("selectionchange",this._onSelectionChange),ba.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),ba.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),ba.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==ls||ls.removeEventListener("visibilitychange",this._onVisibilityChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Rs(ba,"click",this._onClick)}_scheduleCheck(){this._clicks.length&&Lr(this._checkClickTimer)&&(this._checkClickTimer=ba.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){Rs(ba,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Rs(ba,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Rs(ls,"visibilitychange",this._onVisibilityChange)}_startSwipeObserver(){Rs(ba,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Rs(ba,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Rs(ba,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=Lr(this._surfacesCheckedAt)||Br(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Lr(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==ls||!ls.querySelector(c_))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){if(Ys(e.node))return!0;var t=this._clicks.some((t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp)));return!(!t&&!Js(e.node,"html")&&Ks(e.node)&&function(e,t){var r;if(!ss||bo(e))return!1;var i=Hr(t)?vo:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:vo;return!uo(So(e,!1).targetElementList,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||(r=e.node,!(!ss||bo(r))&&So(r,!1).targetElementList.some((e=>Js(e,"a"))));var t,r}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0,t.visibilityChangedDelayMs=this._lastVisibilityChange?Math.abs(t.timestamp-this._lastVisibilityChange):void 0;var i=d_(t.scrollDelayMs,this._config.scroll_threshold_ms),n=d_(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=d_(t.mutationDelayMs,this._config.mutation_threshold_ms),o=d_(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=Br(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=Br(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=Br(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=Br(t.visibilityChangedDelayMs)&&this._config.selection_change_threshold_ms>t.visibilityChangedDelayMs;if(!(a||l||u||c)){var d=d_(t.visibilityChangedDelayMs,this._config.selection_change_threshold_ms);if(i||s||o||n||d){var h=u_(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:s,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:n,[h+"_visibility_changed_timeout"]:d})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}}this._scheduleCheck()}}_captureDeadClick(e,t){var i=u_(e);this.instance.capture(i,r({},t,n_(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,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[i+"_scroll_delay_ms"]:e.scrollDelayMs,[i+"_mutation_delay_ms"]:e.mutationDelayMs,[i+"_absolute_delay_ms"]:e.absoluteDelayMs,[i+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[i+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}}ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new h_(e,t);var p_={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},__={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},g_="disabled",v_="sampled",f_="active",m_="buffering",y_="paused",b_="lazy_loading",S_="awaiting_config",w_="missing_config",k_="rrweb_error",x_="trigger",C_=x_+"_activated",I_=x_+"_pending",E_=x_+"_"+g_;function T_(e,t,r,i,n,s){return 0===t?E_:(null==e?void 0:e.get_property(r?i+r:n))===s?C_:I_}function M_(e,t,r){return t.some((t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)}))}class R_{constructor(e){this._matchers=e}triggerStatus(e){var t=this._matchers.map((t=>t.triggerStatus(e)));return t.includes(C_)?C_:t.includes(I_)?I_:E_}stop(){this._matchers.forEach((e=>e.stop()))}}class P_{constructor(e){this._matchers=e}triggerStatus(e){var t=new Set;for(var r of this._matchers)t.add(r.triggerStatus(e));switch(t.delete(E_),t.size){case 0:return E_;case 1:return Array.from(t)[0];default:return I_}}stop(){this._matchers.forEach((e=>e.stop()))}}class F_{triggerStatus(){return C_}stop(){}}var L_=e=>"sessionRecording"in e;class A_{constructor(e,t){this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._instance=e,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(L_(e)?Pr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(L_(e)?Pr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){ys.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){ys.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return T_(this._instance,this._urlTriggers.length,this._groupId,Wu,$u,e)}triggerStatus(e){var t=this._urlTriggerStatus(e),r=t===C_?C_:t===I_?I_:E_;return this._instance.register_for_session({[Pc]:r}),r}checkUrlBlocklist(e,t){var r=Vs(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=M_(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=Vs(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=M_(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===C_,l=M_(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class O_{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=I_;return Nr(this.linkedFlag)&&(e=E_),this.linkedFlagSeen&&(e=C_),this._instance.register_for_session({[Ec]:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(L_(e)?Pr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Nr(this.linkedFlag)&&!this.linkedFlagSeen){var i=Ar(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=Ar(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(Pr(r)&&i in r){var o=r[i];s=Hr(o)?!0===o:n?o===n:!!o}var a=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,a&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class D_{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(L_(e)?Pr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return T_(this._instance,this._eventTriggers.length,this._groupId,zu,Uu,e)}triggerStatus(e){var t=this._eventTriggerStatus(e),r=t===C_?C_:t===I_?I_:E_;return this._instance.register_for_session({[Ic]:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===C_,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class N_{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new A_(e,t.id),this._eventTriggerMatching=new D_(e,t.id),this._linkedFlagMatching=new O_(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map((e=>e.name)),n={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,r);var s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new R_(s):new P_(s)}else this._combinedMatching=new F_}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Wu+this.group.id:zu+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function B_(e){if(e.rrwebError)return k_;if(!e.receivedFlags)return m_;if(!e.isRecordingEnabled)return g_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=!0===e.isSampled,r=new R_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?v_:r===C_?f_:r===I_?m_:!1===e.isSampled?g_:f_}function q_(e){if(e.rrwebError)return k_;if(!e.receivedFlags)return m_;if(!e.isRecordingEnabled)return g_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=new P_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==E_,i=Hr(e.isSampled);return r&&t===I_?m_:r&&t===E_||i&&!e.isSampled?g_:!0===e.isSampled?v_:f_}function H_(){var e=[];return function(t,r){if(Pr(r)||Mr(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function $_(e){var t=JSON.stringify(e,H_());return t?new Blob([t]).size:0}function U_(e){if(Dr(e))return 4;if(Lr(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Mr(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=Lr(i)||Dr(i)?4:U_(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];Lr(l)||(o||(s+=1),o=!1,s+=a.length+3+U_(l))}return s;default:return 0}}function z_(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),n=e.sizes.slice(r);return[z_({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),z_({size:n.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var W_=Uint8Array,V_=Uint16Array,j_=Uint32Array,G_=new W_([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]),Q_=new W_([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]),Z_=new W_([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y_=function(e,t){for(var r=new V_(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new j_(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},K_=Y_(G_,2),J_=K_[1];K_[0][28]=258,J_[258]=28;for(var X_=Y_(Q_,0)[1],eg=new V_(32768),tg=0;32768>tg;++tg){var rg=(43690&tg)>>>1|(21845&tg)<<1;eg[tg]=((65280&(rg=(61680&(rg=(52428&rg)>>>2|(13107&rg)<<2))>>>4|(3855&rg)<<4))>>>8|(255&rg)<<8)>>>1}var ig=function(e,t,r){for(var i=e.length,n=0,s=new V_(t);i>n;++n)++s[e[n]-1];var o,a=new V_(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new V_(1<<t);var l=15-t;for(n=0;i>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[eg[d]>>>l]=u}else for(o=new V_(i),n=0;i>n;++n)o[n]=eg[a[e[n]-1]++]>>>15-e[n];return o},ng=new W_(288);for(tg=0;144>tg;++tg)ng[tg]=8;for(tg=144;256>tg;++tg)ng[tg]=9;for(tg=256;280>tg;++tg)ng[tg]=7;for(tg=280;288>tg;++tg)ng[tg]=8;var sg=new W_(32);for(tg=0;32>tg;++tg)sg[tg]=5;var og=ig(ng,9,0),ag=ig(sg,5,0),lg=function(e){return(e/8>>0)+(7&e&&1)},ug=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof V_?V_:e instanceof j_?j_:W_)(r-t);return i.set(e.subarray(t,r)),i},cg=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},dg=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},hg=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,s=r.slice();if(!n)return[new W_(0),0];if(1==n){var o=new W_(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(i=1;n>i;++i)s[i].s>h&&(h=s[i].s);var p=new V_(h+1),_=pg(r[c-1],p,0);if(_>t){i=0;var g=0,v=_-t,f=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n>i;++i){var m=s[i].s;if(t>=p[m])break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=s[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=s[i].s;p[b]==t&&(--p[b],++g)}_=t}return[new W_(p),_]},pg=function(e,t,r){return-1==e.s?Math.max(pg(e.l,t,r+1),pg(e.r,t,r+1)):t[e.s]=r},_g=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new V_(++t),i=0,n=e[0],s=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[r.subarray(0,i),t]},gg=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},vg=function(e,t,r){var i=r.length,n=lg(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;i>s;++s)e[n+s+4]=r[s];return 8*(n+4+i)},fg=function(e,t,r,i,n,s,o,a,l,u,c){cg(t,c++,r),++n[256];for(var d=hg(n,15),h=d[0],p=d[1],_=hg(s,15),g=_[0],v=_[1],f=_g(h),m=f[0],y=f[1],b=_g(g),S=b[0],w=b[1],k=new V_(19),x=0;m.length>x;++x)k[31&m[x]]++;for(x=0;S.length>x;++x)k[31&S[x]]++;for(var C=hg(k,7),I=C[0],E=C[1],T=19;T>4&&!I[Z_[T-1]];--T);var M,R,P,F,L=u+5<<3,A=gg(n,ng)+gg(s,sg)+o,O=gg(n,h)+gg(s,g)+o+14+3*T+gg(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return vg(t,c,e.subarray(l,l+u));if(cg(t,c,1+(A>O)),c+=2,A>O){M=ig(h,p,0),R=h,P=ig(g,v,0),F=g;var D=ig(I,E,0);for(cg(t,c,y-257),cg(t,c+5,w-1),cg(t,c+10,T-4),c+=14,x=0;T>x;++x)cg(t,c+3*x,I[Z_[x]]);c+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(x=0;q.length>x;++x)cg(t,c,D[H=31&q[x]]),c+=I[H],H>15&&(cg(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else M=og,R=ng,P=ag,F=sg;for(x=0;a>x;++x)if(i[x]>255){var H;dg(t,c,M[257+(H=i[x]>>>18&31)]),c+=R[H+257],H>7&&(cg(t,c,i[x]>>>23&31),c+=G_[H]);var U=31&i[x];dg(t,c,P[U]),c+=F[U],U>3&&(dg(t,c,i[x]>>>5&8191),c+=Q_[U])}else dg(t,c,M[i[x]]),c+=R[i[x]];return dg(t,c,M[256]),c+R[256]},mg=new j_([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yg=function(){for(var e=new j_(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),bg=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=yg[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},Sg=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new W_(i+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(i,a.length-n),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=vg(l,u,e.subarray(c,d)):(l[c]=true,u=vg(l,u,e.subarray(c,o)))}else{for(var h=mg[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new V_(32768),f=new V_(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new j_(25e3),w=new V_(288),k=new V_(32),x=0,C=0,I=(c=0,0),E=0,T=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(v[R]=P,f[M]=R,c>=E){var F=o-c;if((x>7e3||I>24576)&&F>423){u=fg(e,l,0,S,w,k,C,I,T,c-T,u),I=x=C=0,T=c;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=R-P&32767;if(F>2&&M==b(c-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,c),H=Math.min(258,F);q>=N&&--D&&R!=P;){if(e[c+A]==e[c+A-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var z=Math.min(N,U-2),W=0;for(L=0;z>L;++L){var V=c-N+L+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,P=V)}}}N+=(R=P)-(P=v[R])+32768&32767}if(O){S[I++]=268435456|J_[A]<<18|X_[O];var G=31&J_[A],Q=31&X_[O];C+=G_[G]+Q_[Q],++w[257+G],++k[Q],E=c+A,++x}else S[I++]=e[c],++w[e[c]]}}u=fg(e,l,true,S,w,k,C,I,T,c-T,u)}return ug(a,0,i+lg(u)+n)}(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,r,i)},wg=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},kg=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&wg(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}},xg=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Cg(e,t){void 0===t&&(t={});var r=bg(),i=e.length;r.p(e);var n=Sg(e,t,xg(t),8),s=n.length;return kg(n,t),wg(n,s-8,r.d()),wg(n,s-4,i),n}function Ig(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new W_(e.length+(e.length>>>1)),n=0,s=function(e){i[n++]=e},o=0;r>o;++o){if(n+5>i.length){var a=new W_(n+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?s(l):2048>l?(s(192|l>>>6),s(128|63&l)):l>55295&&57344>l?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return ug(i,0,n)}function Eg(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}class Tg{constructor(e,t){var r,i;void 0===t&&(t={}),this._loggedTracker={},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,n,s,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(n=e.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(o=e.texts)?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t[0])&&e})));var i=this._numberOfChanges(t);return 0!==i||r===i?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new Kr({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:ys})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}fs.DEBUG=!1,fs.LIB_VERSION="1.410.2",fs.LIB_NAME="web";class Mg{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(Gu,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Gu);return Pr(t=r)&&Ar(t.sessionId)&&Br(t.size)&&r.sessionId===e?r.size:0}}function Rg(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<Yr(100*t,0,100,ys)}var Pg=bs("[SessionRecording]");function Fg(e,t){return t?e:"!"+e}function Lg(e,t){return e===t||e!=="!"+t&&null}class Ag{constructor(e,t,r,i,n,s,o){this._sampleRate=null,this._recordingStatusFunction=q_,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=Br(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new R_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=B_):(this._triggerStatusMatcher=new P_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=q_),this._instance.register_for_session({[Mc]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,((e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()}))}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return Br(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&Nr(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){Pg.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!Br(n))return null==(r=this._instance.persistence)||r.unregister(qu),void(null==(i=this._instance.persistence)||i.unregister(Lu));var s=this._instance.get_property(qu),o=this._instance.get_property(Lu),a=Lg(s,e),l=Br(o)&&o!==n,u=Lr(o)&&s===e,c=l||u||!Hr(a),d=c?Rg(e,n):a;c&&(d?this._reportStarted("sampled"):Pg.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[qu]:Fg(e,d),[Lu]:Dr(o)&&s===e?null:n})}ensureSamplingDecision(e){if(Br(this._sampleRate)){var t=this._instance.get_property(qu);Hr(Lg(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Uu),null==(t=this._instance.persistence)||t.unregister($u),null==(r=this._instance.persistence)||r.unregister(qu),null==(i=this._instance.persistence)||i.unregister(Lu),null==(n=this._instance.persistence)||n.unregister(Hu)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===I_}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class Og{constructor(e,t,r,i,n){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Mc]:"v2_trigger_groups",[Rc]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):Pg.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return k_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return g_;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===C_){var a=s.group.id,l=r.get(a);Lr(l)?ys.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===I_&&(i=!0)}return n?v_:i?m_:g_}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;Br(i)&&(Dr(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var n=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var s=function(i){i.checkUrlTriggerConditions(t,r,(t=>{n._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),n.updateActiveTriggers(e),n._onTriggerActivated())}),e)};for(var o of this._triggerGroupMatchers)s(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return Pg.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var n=function(r){r.checkEventTriggerConditions(e.event,(n=>{if(i._checkGroupLevelProperties(r,e.properties)){var s=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(ic),a=s.some((t=>!t.properties||0===t.properties.length||id(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t),i._onTriggerActivated())}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){Pg.error("Could not activate event trigger for trigger groups",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,n=i.id,s=i.sampleRate,o=Vu+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(Pr(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,c=Br(p)&&p!==s,l=h===e&&Br(p)&&p===s&&Hr(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var g=u||c||d||!Hr(l),v=g?Rg(e+n,s):l;g&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:v}),this._triggerGroupSamplingResults.set(n,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:s,sampled:v}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(qu),null==(t=this._instance.persistence)||t.unregister(Lu),null==(r=this._instance.persistence)||r.unregister(Hu),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister(zu+a),null==(s=this._instance.persistence)||s.unregister(Wu+a),null==(o=this._instance.persistence)||o.unregister(Vu+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);s&&t.push({id:n,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Tc]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===I_)return!0;return!1}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||id(r,t,this._instance.get_property(ic))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new N_(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}function Dg(e){return Pr(e)?e.network_timing:e}var Ng,Bg,qg=36e5,Hg="[SessionRecording]",$g=bs(Hg),Ug=[__.MouseMove,__.MouseInteraction,__.Scroll,__.ViewportResize,__.Input,__.TouchMove,__.MediaInteraction,__.Drag],zg=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Wg(){var e;return null==ba||null==(e=ba.__PosthogExtensions__)?void 0:e.rrweb}function Vg(){var e;return null==(e=Wg())?void 0:e.record}function jg(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,H_())}}function Gg(e){return Eg(Cg(Ig(jg(e))))}function Qg(e){return Zg.apply(this,arguments)}function Zg(){return(Zg=t((function*(e){var t=jg(e),r=yield mr(t,fs.DEBUG,{rethrow:!0});return Eg(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Yg="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Kg=!1;function Jg(e){return Mr(e)&&0===e.length?Ng=null!=Ng?Ng:Gg([]):Gg(e)}function Xg(e){return ev.apply(this,arguments)}function ev(){return(ev=t((function*(e){return Mr(e)&&0===e.length?Ng||(Bg=null!=Bg?Bg:Qg([]).then((e=>(Ng=e,e))).catch((e=>{throw Ng=void 0,Bg=void 0,e}))):Qg(e)}))).apply(this,arguments)}function tv(e){return Yg&&!Kg&&function(e){return e.type===p_.FullSnapshot||e.type===p_.IncrementalSnapshot&&(e.data.source===__.Mutation||e.data.source===__.StyleSheetRule)}(e)}function rv(e){return{event:e,size:U_(e)}}function iv(e,t){return r({},e,{data:t,cv:"2024-10"})}function nv(e,t){return r({},e,{cv:"2024-10",data:r({},e.data,t)})}function sv(e){try{if(e.type===p_.FullSnapshot)return rv(iv(e,Gg(e.data)));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.Mutation)return rv(nv(e,{texts:Jg(e.data.texts),attributes:Jg(e.data.attributes),removes:Jg(e.data.removes),adds:Jg(e.data.adds)}));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.StyleSheetRule)return rv(nv(e,{adds:e.data.adds?Gg(e.data.adds):void 0,removes:e.data.removes?Gg(e.data.removes):void 0}))}catch(e){$g.error("could not compress event - will use uncompressed event",e)}return{event:e,size:$_(e)}}function ov(){return ov=t((function*(e){try{if(e.type===p_.FullSnapshot)return rv(iv(e,yield Qg(e.data)));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.Mutation){var t=yield Promise.all([Xg(e.data.texts),Xg(e.data.attributes),Xg(e.data.removes),Xg(e.data.adds)]);return rv(nv(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(e.type===p_.IncrementalSnapshot&&e.data.source===__.StyleSheetRule){var r=yield Promise.all([e.data.adds?Qg(e.data.adds):void 0,e.data.removes?Qg(e.data.removes):void 0]);return rv(nv(e,{adds:r[0],removes:r[1]}))}}catch(t){return gr(t)&&(Kg=!0),$g.error("could not compress event asynchronously - trying synchronous compression",t),sv(e)}return{event:e,size:$_(e)}})),ov.apply(this,arguments)}function av(e,t){return e.type===p_.Custom&&e.data.tag===t}function lv(e){return av(e,"sessionIdle")}function uv(e){return av(e,"$session_ending")}function cv(e){return av(e,"$session_starting")}class dv{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(Hg+" must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Lg(this._instance.get_property(qu),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return Br(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e){this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._hasWarnedClientMaskingOverride=!1,this._maskRegionsFnFailed=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,n,s;if(r&&(e!==this._sessionId||t!==this._windowId)){var o,a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(o=this._flushedSizeTracker)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(ju),this._maxDepthExceeded=!1,null==(n=Wg())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t||(this._isIdle="unknown",this.stop(),this.start("session_id_changed")),a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(s=this._strategy)||s.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Hu])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return Br(r)&&Br(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!Br(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return Br(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!Dr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Hu]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==m_?(this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=ls&&ls.visibilityState&&this._tryAddCustomEvent("window "+ls.visibilityState,{})},this._instance=e;var t=this._sessionManager.checkAndGetSessionAndWindowId(),r=t.windowId;this._sessionId=t.sessionId,this._windowId=r,this._linkedFlagMatching=new O_(this._instance),this._urlTriggerMatching=new A_(this._instance),this._eventTriggerMatching=new D_(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||$g.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new Mg(this._instance)}get _masking(){var e,t,r,i,n,s,o,a=null==(e=this._remoteConfig)?void 0:e.masking,l={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},u=null!==(n=null==l?void 0:l.maskAllInputs)&&void 0!==n?n:null==a?void 0:a.maskAllInputs,c=null!==(s=null==l?void 0:l.maskTextSelector)&&void 0!==s?s:null==a?void 0:a.maskTextSelector,d=null!==(o=null==l?void 0:l.blockSelector)&&void 0!==o?o:null==a?void 0:a.blockSelector;return Lr(u)&&Lr(c)&&Lr(d)?void 0:{maskAllInputs:null==u||u,maskTextSelector:c,blockSelector:d}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!Nr(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((e=>{var i=null==r?void 0:r[e],n=t[e];return!Lr(i)&&i!==n}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,$g.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:t}))}}}get _canvasResolutionScale(){var e;return Yr(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,bs("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,n,s,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,c=null!==(i=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:Yr(c,0,12,bs("canvas recording fps"),4),quality:Yr(d,0,1,bs("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,n={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),a=Dg(this._instance.config.capture_performance),l=Dg(null==i?void 0:i.capturePerformance),u=!!(Hr(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,i=[],n=null==(e=ba.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());var s=null==(t=ba.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this._networkPayloadCapture&&Rr(s)&&(!Fs.includes(us.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(s(((e,t)=>{var i,n={payloadSizeLimitBytes:Ho.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Ho.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Ho.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=qo(n),e=>(null!=e&&e.requestBody&&(e.requestBody=jo(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=jo(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t)=>{var r,i=As(e.name),n=0===t.indexOf("http")?null==(r=As(t))?void 0:r.pathname:t;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Vo.some((e=>0===s.indexOf(e)))))return e})((Wo((r=t).requestHeaders),Wo(r.responseHeaders),r),e.api_host));var r},c=Rr(e.session_recording.maskNetworkRequestFn);return c&&Rr(e.session_recording.maskCapturedNetworkRequestFn)&&ys.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return r({},t,{name:null==i?void 0:i.url})}),n.maskRequestFn=Rr(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r,i=u(t);return i&&null!==(r=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:e=>function(e){if(!Lr(e))return e.requestBody=Go(e.requestBody,"Request"),e.responseBody=Go(e.responseBody,"Response"),e}(u(e)),r({},Ho,n,{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture))):$g.info("NetworkCapture not started because we are on localhost.")),i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?on(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?on(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Sh,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Ns(r,i,kh))}_maskUrl(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,i=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(t.maskNetworkRequestFn){var n=t.maskNetworkRequestFn({url:e});return null==n?void 0:n.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):$g.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(zg((()=>Vg().addCustomEvent(e,t))))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!ss)return;var e=new URL(ss.location.href),t=this._maskReplayUrl(e.origin+e.pathname+e.search);this._lastHref!==t&&(this._lastHref=t,this._tryAddCustomEvent("$url_changed",{href:t}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)}))}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(zg((()=>Vg().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return Br(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_onTriggerActivated(){!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,clearInterval(this._fullSnapshotTimer),$g.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlTriggerMatching.urlBlocked&&(this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),$g.info("recording resumed"))}_activateTrigger(e,t){var r;if(!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===e?$u:Uu]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(Fu);if(e){var t;try{t=Pr(e)?e:JSON.parse(e)}catch(e){return void $g.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,n=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>qg)return $g.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(Fu))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(e){var t,r,i=this._remoteConfig;if(i){this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var n=this._sessionManager.checkAndGetSessionAndWindowId(),s=n.windowId;this._sessionId=n.sessionId,this._windowId=s,null==(t=this._instance.persistence)||t.unregister(ju),null!=i&&i.endpoint&&(this._endpoint=null==i?void 0:i.endpoint),this._strategy=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new Og(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Ag(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(i),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(Au,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Au)})),this._checkOverride(Ou,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ou)})),this._checkOverride(Nu,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Nu)})),this._checkOverride(Du,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Du)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Rs(ss,"beforeunload",this._onBeforeUnload),Rs(ss,"offline",this._onOffline),Rs(ss,"online",this._onOnline),Rs(ss,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Rr(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Rr(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",(()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId(((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)}))})):Rr(this._sessionManager.on)||$g.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Nr(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){$g.error("Could not add $pageview to rrweb session",e)}}))),this.status===f_&&this._reportStarted(e||"recording_initialized"))}else $g.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,n,s;null==ss||ss.removeEventListener("beforeunload",this._onBeforeUnload),null==ss||ss.removeEventListener("offline",this._onOffline),null==ss||ss.removeEventListener("online",this._onOnline),null==ss||ss.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(e=this._removePageViewCaptureHook)||e.call(this),this._removePageViewCaptureHook=void 0,null==(t=this._removeEventTriggerCaptureHook)||t.call(this),this._removeEventTriggerCaptureHook=void 0,null==(r=this._onSessionIdListener)||r.call(this),this._onSessionIdListener=void 0,null==(i=this._onSessionIdleResetForcedListener)||i.call(this),this._onSessionIdleResetForcedListener=void 0,null==(n=this._forceIdleSessionIdListener)||n.call(this),this._forceIdleSessionIdListener=void 0,null==(s=this._strategy)||s.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._stopRrweb)||t.call(this),this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch((()=>{})).then((()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._teardown(),$g.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),$g.info("stopped")})),!0}stop(){this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),$g.info("stopped"))}discard(){this._clearBuffer(),this._teardown(),$g.info("discarded")}_captureProcessedEvent(e,t,r,i,n){var s,o={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:n};e.type===p_.FullSnapshot&&null!=(s=Wg())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this.status!==g_?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(o)):this._clearBuffer()}_ensureFullSnapshotForSession(e,t){e.type!==p_.FullSnapshot?e.type===p_.IncrementalSnapshot&&(Lr(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,$g.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter((t=>t!==e))}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.compressionEnabled?sv(e.event):{event:e.event,size:$_(e.event)};this._captureQueuedCompressionEvent(e,t.event,t.size)}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach((e=>{this._processQueuedCompressionEventSync(e)}))}_enqueueCompression(e,r,i,n){var s=this,o={event:e,compressionEnabled:r,targetSessionId:i,targetWindowId:n,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(o),this._queuedCompressionEvents+=1;var a=function(){var i=t((function*(){try{if(o.processed)return;var t,i;try{var n=r?tv(e)?yield function(e){return ov.apply(this,arguments)}(e):sv(e):{event:e,size:$_(e)};t=n.event,i=n.size}catch(r){$g.error("could not process queued compression event - will use uncompressed event",r),t=e,i=$_(e)}s._captureQueuedCompressionEvent(o,t,i)}finally{s._finishQueuedCompressionEvent(o)}}));return function(){return i.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(a):a()}onRRwebEmit(e){var t,r,i,n,s,o,a;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&Pr(e))){if(e.type===p_.Meta){var l=this._maskReplayUrl(e.data.href);if(this._lastHref=l,!l)return;e.data.href=l}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,(()=>this._pauseRecording()),(()=>this._resumeRecording()),((e,t)=>this._activateTrigger(e,t))),!this._urlTriggerMatching.urlBlocked||function(e){return e.type===p_.Custom&&"recording paused"===e.data.tag}(e)){var u,c;e.type===p_.FullSnapshot&&(this._scheduleFullSnapshot(),null==(u=this._mutationThrottler)||u.reset(),null==(c=this._instance.persistence)||c.register_once({[ju]:e.timestamp},void 0)),e.type===p_.FullSnapshot&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)&&this._clearBufferBeforeMostRecentMeta();var d=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(d){var h=function(e){var t=e;if(t&&Pr(t)&&6===t.type&&Pr(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 r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(d),p=function(e){return uv(e)?e.data.payload:null}(h),_=function(e){return cv(e)?e.data.payload:null}(h);if(p||_){var g=null!=p?p:_;null!=g&&g.lastActivityTimestamp&&(h.timestamp=g.lastActivityTimestamp)}else this._updateWindowAndSessionIds(h);e.type===p_.FullSnapshot&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var v=null!==(i=null!==(n=null==p?void 0:p.currentSessionId)&&void 0!==n?n:null==_?void 0:_.nextSessionId)&&void 0!==i?i:this._sessionId,f=null!==(s=null!==(o=null==p?void 0:p.currentWindowId)&&void 0!==o?o:null==_?void 0:_.nextWindowId)&&void 0!==s?s:this._windowId;if(!0!==this._isIdle||function(e){return lv(e)||uv(e)||cv(e)}(h)){if(lv(h)){var m=h.data.payload;m&&(h.timestamp=m.lastActivityTimestamp+m.threshold)}var y=null===(a=this._instance.config.session_recording.compress_events)||void 0===a||a;if(this._queuedCompressionEvents>0||y&&tv(h))this._enqueueCompression(h,y,v,f);else{var b=y?sv(h):{event:h,size:$_(h)};this._captureProcessedEvent(h,b.event,b.size,v,f)}}}}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):g_}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[qu]:this.sessionId,[Lu]:null}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_currentMaskedHostname(){try{var e,t=null==ss||null==(e=ss.location)?void 0:e.href;if(!t)return;var r=this._maskReplayUrl(t);if(!r)return;return new URL(r).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_flushBuffer(){var e;this._clearFlushBufferTimer(),null==(e=this._strategy)||e.ensureSamplingDecision(this.sessionId);var t=this._isBelowMinimumDuration();if(this.status===m_||this.status===y_||this.status===g_||t)return this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this._buffer;if(this._buffer.data.length>0){var r,i=this._currentMaskedHostname();z_(this._buffer).forEach((e=>{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION,$snapshot_host:i})})),null==(r=this._strategy)||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,n=this._buffer.sessionId!==i;(n||!0!==this._isIdle&&this._buffer.size+e.$snapshot_bytes+r>943718.4)&&(this._buffer=this._flushBuffer(),n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id),this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),this._flushBufferTimer||!0===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})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1],i=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(this._buffer.data[t].type===p_.Meta){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce(((e,t)=>e+t),0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Fc]:e}),$g.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",r({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Ug.indexOf(null==(t=e.data)?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 r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var i="unknown"===this._isIdle;this._isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!0!==this._isIdle){var n=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),s=n.windowId,o=n.sessionId,a=this._sessionId!==o,l=this._windowId!==s;this._windowId=s,this._sessionId=o,a||l?(this.stop(),this.start("session_id_changed")):r&&this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t=this._sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:t.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(e=this._flushedSizeTracker)?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_rrweb_attached:!!this._stopRrweb,$sdk_debug_rrweb_start_attempted:this._rrwebStartAttempted}}_startRecorder(){var e;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var t,i,n,s={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,sampling:void 0,attributeFilter:void 0},o=this._instance.config.session_recording;for(var a of Object.entries(o||{})){var l=a[0],u=a[1];if(l in s)if("maskInputOptions"===l)s.maskInputOptions=r({password:!0},u);else if("sampling"===l){var c=null!=u?u:{},d={};Lr(c.mousemove)||(d.mousemove=c.mousemove),Lr(c.mouseInteraction)||(d.mouseInteraction=c.mouseInteraction),s.sampling=d}else s[l]=u}this._canvasRecording&&this._canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling=r({},s.sampling,{canvas:this._canvasRecording.fps}),s.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},s.canvasResolutionScale=this._canvasResolutionScale,s.canvasMasking={configured:()=>{var e;return Rr(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(Rr(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,$g.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(s.maskAllInputs=null===(t=this._masking.maskAllInputs)||void 0===t||t,s.maskTextSelector=null!==(i=this._masking.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this._masking.blockSelector)&&void 0!==n?n:void 0),this._warnIfClientMaskingShadowsServer();var h=Vg();if(h){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new Tg(h,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";$g.info(r,{node:t}),this.log(Hg+" "+r,"warn")}});var p=this._gatherRRWebPlugins();if(this._stopRrweb=h(r({emit:e=>{this.onRRwebEmit(e)},plugins:p},s)),!this._stopRrweb)return this._rrwebError=!0,void $g.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,this._lastActivityTimestamp=Date.now(),this._isIdle=Hr(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:p.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else $g.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.initSessionRecording=e=>new dv(e);class hv{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===Oc||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Ac}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}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 e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Qr(e)?1:wr(Zr,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?cd:ld;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?ld:cd;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Qr(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==as?void 0:as.doNotTrack,null==as?void 0:as.msDoNotTrack,ba.doNotTrack].some((e=>Qr(e)))}}var pv=bs("[Dead Clicks]"),_v=()=>!0,gv=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Mu)),i=e.instance.config.capture_dead_clicks;return Hr(i)?i:!!Pr(i)||r};class vv{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Mu]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?pv.error("failed to load script",t):e()}))}_start(){var e;if(ls){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=ba.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Pr(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=ba.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ls),pv.info("starting...")}}else pv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,pv.info("stopping..."))}}var fv=bs("[SegmentIntegration]");var mv="posthog-js";function yv(e,t){var i=void 0===t?{}:t,n=i.organization,s=i.projectId,o=i.prefix,a=i.severityAllowList,l=void 0===a?["error"]:a,u=i.sendExceptionsToPostHog,c=void 0===u||u;return t=>{var i,a,u,d,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,g=(null==(i=t.exception)?void 0:i.values)||[],v=g.map((e=>r({},e,{stacktrace:e.stacktrace?r({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>r({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(h=g[0])?void 0:h.type,$sentry_tags:t.tags};return n&&s&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+t.event_id),c&&(null==(_=e.exceptions)||_.sendExceptionEvent(f)),t}}class bv{constructor(e,t,r,i,n,s){this.name=mv,this.setupOnce=function(o){o(yv(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class Sv{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(ys.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var r,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(r=null==ss?void 0:ss.location.pathname)&&void 0!==r?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var s=n.maxScrollHeight,o=n.lastScrollY,a=n.maxScrollY,l=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(Lr(s)||Lr(o)||Lr(a)||Lr(l)||Lr(u)||Lr(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s>1?Yr(o/s,0,1,ys):1,h=s>1?Yr(a/s,0,1,ys):1,p=l>1?Yr(u/l,0,1,ys):1,_=l>1?Yr(c/l,0,1,ys):1;i=ks(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var wv=["flags","surveys"],kv={[mu]:{exposure:"hidden"},[Su]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[wu]:{exposure:"hidden"},[ku]:{exposure:"event"},[xu]:{exposure:"hidden"},[Cu]:{exposure:"event"},[Iu]:{exposure:"hidden"},[Eu]:{exposure:"event"},[Tu]:{exposure:"event"},[Mu]:{exposure:"event"},[Ru]:{exposure:"hidden"},[Pu]:{exposure:"event"},[Fu]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Bu]:{exposure:"hidden"},[qu]:{exposure:"event"},[Lu]:{exposure:"event",shouldSkipFromEventProperties:e=>Dr(e)},[Hu]:{exposure:"event"},[$u]:{exposure:"event"},[Uu]:{exposure:"event"},[ju]:{exposure:"event"},[Gu]:{exposure:"hidden"},[Qu]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Pr(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[Zu]:{exposure:"event",storageGroup:"flags"},[Yu]:{exposure:"hidden"},[Ku]:{exposure:"hidden",storageGroup:"flags"},[Ju]:{exposure:"event",storageGroup:"flags"},[Xu]:{exposure:"event",storageGroup:"flags",volatile:!0},[ec]:{exposure:"hidden",storageGroup:"flags"},[tc]:{exposure:"event"},[rc]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[nc]:{exposure:"hidden"},[sc]:{exposure:"hidden",storageGroup:"surveys"},[oc]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ac]:{exposure:"event"},[lc]:{exposure:"hidden"},[uc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[cc]:{exposure:"hidden"},[dc]:{exposure:"hidden"},[hc]:{exposure:"hidden"},[pc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_c]:{exposure:"hidden"},[gc]:{exposure:"hidden"},[vc]:{exposure:"hidden"},[fc]:{exposure:"hidden"},[mc]:{exposure:"hidden"},[yc]:{exposure:"hidden"},[bc]:{exposure:"hidden"},[Au]:{exposure:"event"},[Ou]:{exposure:"event"},[Du]:{exposure:"event"},[Nu]:{exposure:"event"},[kc]:{exposure:"event"},[xc]:{exposure:"event"},[Cc]:{exposure:"event"},[Ic]:{exposure:"event"},[Ec]:{exposure:"event"},[Tc]:{exposure:"event"},[Mc]:{exposure:"event"},[Rc]:{exposure:"event"},[Pc]:{exposure:"event"},[Fc]:{exposure:"event"}},xv=[[zu,{exposure:"hidden"}],[Wu,{exposure:"hidden"}],[Vu,{exposure:"hidden"}]],Cv=e=>{var t=kv[e];if(t)return t;for(var r of xv){var i=r[1];if(0===e.indexOf(r[0]))return i}},Iv={flags:pc,surveys:oc},Ev=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Tv="main";class Mv{constructor(e,t,i){if(void 0===i&&(i=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=i,this.props={},this._campaign_params_url=void 0,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._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&ys.info("Persistence loaded",e.persistence,r({},this.props)),this.update_config(e,e,t),this.save(),ss){var n=()=>this.flush();Rs(ss,"beforeunload",n,{capture:!1}),Rs(ss,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Br(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Ev.indexOf(e.persistence.toLowerCase())&&(ys.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var i=[...dd,...e];return r({},cd,{_parse(e){try{var r={};try{r=ld._parse(e)||{}}catch(e){}var i,n=JSON.parse(cd._get(e)||"{}");if(t){var s={};for(var o in r){var a=r[o];Dr(a)||""===a||(s[o]=a)}i=ks(n,s)}else i=ks(r,n);return cd._set(e,i),i}catch(e){}return null},_set(e,t,r,n,s,o){var a=cd._set(e,t,void 0,void 0,o);try{var l={};i.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ld._set(e,l,r,n,s,o)}catch(e){cd._error(e)}return a},_remove(e,t){try{null==ss||ss.localStorage.removeItem(e),ld._remove(e,t)}catch(e){cd._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return"localstorage"===s&&cd._is_supported()?(t=cd,n=!0):"localstorage+cookie"===s&&i._is_supported()?(t=i,n=!0):"sessionstorage"===s&&gd._is_supported()?t=gd:"memory"===s?t=pd:"cookie"===s?t=ld:i._is_supported()?(t=i,n=!0):t=ld,this._splitStorageEligible=n,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[pc];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return ws(this.props,((t,r)=>{var i=Cv(r);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,r===Qu?()=>this._isFeatureFlagCacheStale():()=>!1))return;i.transformToEventProperties&&ks(e,i.transformToEventProperties(t))}else if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,(()=>!1)))return;e[r]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=ks({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of wv){var t=cd._parse(this._groupEntryName(e));if(t&&!Fr(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||ks(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Cv(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=Iv[e];if(!r)return!1;var i=t[r],n=this.props[r];return Br(i)&&Br(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Cv(e))?void 0:t.storageGroup:void 0,i=r?cd._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var n=this._storage._parse(this._name);if(n&&e in n)return void this._setProp(e,n[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Lr(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Lr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Tv))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,r=e.groups;for(var i of(this._writeEntry(this._storage,this._name,t,Tv),wv)){var n,s=r[i];(!Fr(s)||null!=(n=this._slotState[i])&&n.persisted)&&this._writeEntry(cd,this._groupEntryName(i),s,i)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return ws(this.props,((r,i)=>{var n,s=null==(n=Cv(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Tv)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return ws(e,((e,t)=>{var i;r[t]=null!=(i=Cv(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n=this._slotWriteState(i);if(i===Tv||n.dirty||Lr(n.fingerprint)){var s;try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return void(n.dirty=!1)}catch(e){s=void 0}e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Tv&&(n.persisted=!0),Lr(s)||(n.fingerprint=s)):this._config.debug&&ys.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(Lr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of wv)cd._remove(this._groupEntryName(i));r?delete this._slotState[Tv]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Pr(e)){Lr(t)&&(t="None"),this._expire_days=Lr(r)?this._default_expiry:r;var i=!1;if(ws(e,((e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Pr(e)){this._expire_days=Lr(t)?this._default_expiry:t;var r=!1;if(ws(e,((t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this._setProp(i,t),r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){var e=null==ls?void 0:ls.URL;if(e!==this._campaign_params_url){var t=Ch(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Fr(Es(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==ls?void 0:ls.referrer)?Eh(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Rh(),$referring_domain:null!=ls&&ls.referrer&&(null==(e=As(ls.referrer))?void 0:e.host)||Mh},void 0)}set_initial_person_info(){this.props[fc]||this.props[mc]||this.register_once({[yc]:Ph(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};ws([mc,fc],(t=>{var r=this.props[t];r&&ws(r,(function(t,r){e["$initial_"+xr(r)]=t}))}));var t=this.props[yc];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Fh(e,t),i={};return ws(r,(function(e,t){i["$initial_"+xr(t)]=e})),i}(t,this._config.disable_capture_url_hashes);ks(e,r)}return e}safe_merge(e){return ws(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every(((e,t)=>e===i[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i?this._buildStorage(e):this._storage,s=this._resolveSplitStorage(e);if(i||s!==this._splitStorage){var o=this.props;this.clear(),this._storage=n,this._splitStorage=s,this.props=o,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({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[wu]||{};r[e]=t,this._setProp(wu,r),this.save()}remove_event_timer(e){var t=this.props[wu]||{},r=t[e];return Lr(r)||(delete t[e],this._setProp(wu,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var r;this.props[e]=t,null!=(r=Cv(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=Cv(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Rv=bs("[RateLimiter]");class Pv{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Rv.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Rv.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;void 0===e&&(e=!1);var n=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(vc))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>n&&(a.tokens=n);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(vc,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Fv=bs("[RemoteConfig]");class Lv{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=ba._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Fv.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void Fv.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Fv.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){Fv.error("Error loading remote config",e),this._onRemoteConfig()}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&ls&&"hidden"!==ls.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){e||Fv.error("Failed to fetch remote config from PostHog.");try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Fv.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var t;null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded()}catch(e){Fv.error("Error loading feature flags",e)}}}var Av=!!ds||!!cs,Ov="text/plain",Dv=!1,Nv=(e,t)=>{var r=e.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},Bv=function(e,t,i){var n;void 0===i&&(i=!0);var s=e.split("?"),o=s[0],a=s[1],l=r({},t),u=null!==(n=null==a?void 0:a.split("&").map((e=>{var t,r=e.split("="),n=r[0],s=i&&null!==(t=l[n])&&void 0!==t?t:r[1];return delete l[n],n+"="+s})))&&void 0!==n?n:[],c=Os(l);return c&&u.push(c),u.length>0?o+"?"+u.join("&"):o},qv=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===Bl){var i=Cg(Ig(Ls(t)),{mtime:0});return{contentType:Ov,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===ql){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ls(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ls(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Ls(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Hv=e=>{var t,i,n=()=>"sendBeacon"===e.transport?{url:Bv(e.url,{compression:ql}),encodedBody:qv(r({},e,{compression:ql,_encodedBody:void 0}))}:{url:Nv(e.url,"compression"),encodedBody:qv(r({},e,{compression:void 0,_encodedBody:void 0}))};try{t=qv(e)}catch(t){if(pr(e.compression,Ds(e.url,"compression")))return ys.error("Failed to gzip request body, sending uncompressed payload",t),n();throw t}return t&&pr(e.compression,Ds(e.url,"compression"))&&!((i=t.body)instanceof ArrayBuffer?hr(new Uint8Array(i)):ArrayBuffer.isView(i)&&hr(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Dv=!0,n()):{url:e.url,encodedBody:t}},$v=e=>{try{return Hv(e)}catch(t){return ys.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Uv=function(){var e=t((function*(e){var t=Ls(e.data),i=yield mr(t,fs.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return r({},e,{_encodedBody:{contentType:Ov,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),zv=/Failed to fetch|NetworkError|Load failed/i,Wv=e=>{var t=$v(e);if(t){var i=t.url,n=t.encodedBody,s=null!=n?n:{},o=s.contentType,a=s.body,l=s.estimatedSize,u=new Headers;ws(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var c=null,d=!1;if(hs){var h=new hs;c={signal:h.signal,timeout:setTimeout((()=>{var t,r;d=!0,h.abort((t=e.timeout,(r=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",r))}),e.timeout)}}var p=t=>{d&&"AbortError"===(null==t?void 0:t.name)||(e=>"TypeError"===(null==e?void 0:e.name)&&zv.test((null==e?void 0:e.message)||""))(t)?ys.warn(t):ys.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var _;cs(i,r({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(_=c)?void 0:_.signal},e.fetchOptions)).then((t=>t.text().then((r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){ys.error(e)}null==e.callback||e.callback(i)})))).catch(p).finally((()=>c?clearTimeout(c.timeout):null))}catch(e){c&&clearTimeout(c.timeout),p(e)}}},Vv=e=>{try{var t,i=Hv(e),n=i.url,s=i.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(as.sendBeacon(n,u))return;var c=Mr(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Mr(c)&&c.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(c.length/2),h=t=>Mr(e.data)?t:r({},e.data,{batch:t});return Vv(r({},e,{data:h(c.slice(0,d))})),void Vv(r({},e,{data:h(c.slice(d))}))}ys.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Wv(r({},e,{_keepaliveDisabled:!0}))}catch(e){ys.warn("Beacon send failed",e)}},jv=(e,t,i,n)=>{var s="query"===n?"POST"===t?"sent_at":"_":void 0;return Bv(i===Bl?Nv(e,"compression"):e,r({},s?{[s]:Date.now().toString()}:{},i===Bl?{}:{compression:i}))},Gv=[];cs&&Gv.push({transport:"fetch",method:Wv}),ds&&Gv.push({transport:"XHR",method(e){var t=$v(e);if(t){var r=new ds,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var n=null!=i?i:{},s=n.contentType,o=n.body;ws(e.headers,(function(e,t){r.setRequestHeader(t,e)})),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(o)}}}),null!=as&&as.sendBeacon&&Gv.push({transport:"sendBeacon",method:Vv});var Qv=3e3;class Zv{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Yr((null==t?void 0:t.flush_interval_ms)||Qv,250,5e3,ys.createLogger("flush interval"),Qv),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this._sendRequestSafely(r({},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(),r=function(){var r=t[i],n=(new Date).getTime();r.data&&Mr(r.data)&&ws(r.data,(e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){ys.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return ws(this._queue,(t=>{var i,n=t,s=(n?n.batchKey:null)||n.url;Lr(e[s])&&(e[s]=r({},n,{data:[]})),null==(i=e[s].data)||i.push(n.data)})),this._queue=[],e}}var Yv=["retriesPerformedSoFar"];class Kv{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Lr(ss)&&"onLine"in ss.navigator&&(this._areWeOnline=ss.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Rs(ss,"online",this._onlineListener),Rs(ss,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,n=i(e,Yv);qr(t)&&(n.url=Bv(n.url,{retry_count:t})),this._instance._send_request(r({},n,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(r({retriesPerformedSoFar:t},n));0===e.statusCode&&ys.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==n.callback||n.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),n=Math.random()-.5;return Math.ceil(i+n*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),ys.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter((r=>e>r.retryAt||(t.push(r),!1)));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Lr(ss)||(this._onlineListener&&(ss.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ss.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(r({},t,{transport:"sendBeacon"}))}catch(e){ys.error(e)}}this._queue=[]}}class Jv{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(s),this._context.maxScrollY=Math.max(s,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Rs(ss,"scroll",this._updateScrollData,{capture:!0}),Rs(ss,"scrollend",this._updateScrollData,{capture:!0}),Rs(ss,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ss?void 0:ss.document.documentElement;var e=Mr(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var r=null==ss?void 0:ss.document.querySelector(t);if(r)return r}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[t]||0}return ss?"y"===e?ss.scrollY||ss.pageYOffset||ss.document.documentElement.scrollTop||0:ss.scrollX||ss.pageXOffset||ss.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var Xv=e=>Ph(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class ef{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[gc]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||Xv,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[gc]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Fh(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return ws(Es(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+xr(r)]=t})),e}}class tf{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 r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}}var rf=bs("[SessionId]");class nf{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new tf,this._sessionHasBeenIdleTooLong=(e,t)=>!(!qr(e)||!qr(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Oc)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Yc,this._windowIdGenerator=r||Yc;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Yr(this._config.session_idle_timeout_seconds||1800,60,36e3,rf.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var s=gd._parse(this._window_id_storage_key),o=gd._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:gd._remove(this._window_id_storage_key),gd._set(this._primary_window_exists_storage_key,!0)}if(null!=(i=this._config.bootstrap)&&i.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.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._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){rf.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Lr(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&&gd._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&gd._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?gd._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Dr(t)&&!Dr(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!i||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Bu]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return qr(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Bu):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Dr(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Bu]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=qr(e)?e:0,r=qr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[Bu];return Mr(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&ss&&(ss.removeEventListener(Hc,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&gd._remove(this._primary_window_exists_storage_key)},Rs(ss,Hc,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===Oc)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),i=this._getSessionId(),n=i[1],s=i[2],o=this._freshestActivityTimestamp(),a=this._getWindowId(),l=qr(s)&&Math.abs(r-s)>864e5,u=!1,c=!1,d=!n,h=n,p=!d&&!e&&this._sessionHasBeenIdleTooLong(r,o);if(p){(p=this._isSessionIdleAfterCrossTabRefresh(r))||rf.info("cross-tab refresh kept the session alive",{sessionId:n});var _=this._getSessionId();n=_[1],s=_[2]}d||p||l?(n=this._sessionIdGenerator(),a=this._windowIdGenerator(),rf.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),s=r,u=!0):(a||(a=this._windowIdGenerator(),u=!0),(c=n!==h)&&(rf.info("adopted cross-tab session id",{sessionId:n,windowId:a}),u=!0));var g=qr(o)&&e&&!l?o:r,v=qr(s)?s:(new Date).getTime();this._setWindowId(a),this._setSessionId(n,g,v),e||this._resetIdleTimer();var f={noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:c};return u&&this._sessionIdChangedHandlers.forEach((e=>e(n,a,f))),{sessionId:n,windowId:a,sessionStartTimestamp:v,changeReason:u?f:void 0,lastActivityTimestamp:o}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}var sf=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&Sr(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>Sr(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function of(){return of=t((function*(){var e=null==as?void 0:as.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),r=null==t?void 0:t.model;return Ar(r)&&r.length>0?r:void 0}catch(e){return void ys.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),of.apply(this,arguments)}var af="custom",lf="i.posthog.com",uf=/^\/static\//;class cf{constructor(e){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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+lf,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":af),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(uf.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return""+r+t}if(this.region===af)return this.apiHost+t;var i=lf+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var df=bs("[PostHog ExternalIntegrations]"),hf={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class pf{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return df.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,n,s=r[0],o=r[1];!o||null!=(t=ba.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[s]||e._loadScript(hf[s],(()=>{var t;null==(t=ba.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[s])||t.start(e._instance)})),!o&&null!=(i=ba.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[s]&&(null==(n=ba.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[s])||n.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class _f{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var r=this;return t((function*(){if(r._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(r._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');r._extensions.set(e.name,e);try{var t=e.setup(r._client);t&&(yield t)}catch(t){var i=r._extensions.get(e.name)===e;i&&r._extensions.delete(e.name),r._logger.error('Failed to set up browser extension "'+e.name+'"',t),i&&r._disposeExtension(e)}}))()}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&Rr(t.then)&&t.then(void 0,(t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}))}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class gf{constructor(e){this._instance=e}get(e){var t;return null==(t=this._instance.persistence)?void 0:t.get_property(e)}set(e,t){var r;null==(r=this._instance.persistence)||r.set_property(e,t)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var vf="extensionsRemoteConfig";class ff{constructor(e){this._disposed=!1,this.instance=e,this._logger=ys.createLogger("[BrowserExtensions]"),this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new gf(e),this.onEvent=e=>Nl(this.instance.on("eventCaptured",(t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}}))),this.onRemoteConfig=e=>{if(this._disposed)return Nl((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(vf,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Nl(r)},this._runtime=new _f(this._logger,this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property(yu))&&void 0!==e?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==n?void 0:n.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==n?void 0:n.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}capture(e,r,i){var n=this;return t((function*(){i?n.instance.capture(e,r,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(e,r)}))()}registerDynamicEventProperties(e){return Nl(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(vf,e))}sendRequest(e,r){var i=this;return t((function*(){var t;void 0===r&&(r={});var n=i.instance.requestRouter.endpointFor(null!==(t=r.target)&&void 0!==t?t:"api",e),s={method:r.method,url:r.query?Bv(n,r.query):n,data:r.body,headers:r.headers,timeout:r.timeoutMs,fireCallbackOnDrop:!0,transport:r.transport};return"sendBeacon"===r.transport?(i.instance._send_request(s),{statusCode:202}):new Promise((e=>{s.callback=e,i.instance._send_request(s)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var mf={},yf=0,bf=()=>{},Sf='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',wf="Surveys module not available",kf="sanitize_properties is deprecated. Use before_send instead",xf="Invalid value for property_denylist config: ",Cf=["token","distinct_id",wc],If="posthog",Ef=!Av&&-1===(null==_s?void 0:_s.indexOf("MSIE"))&&-1===(null==_s?void 0:_s.indexOf("Mozilla")),Tf=e=>{var t;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ms(null==ls?void 0:ls.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:bf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:us&&Ar(null==us?void 0:us.search)&&-1!==us.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ss||null==(t=ss.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){ys.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Bc,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Qv},error_tracking:{},_onCapture:bf},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:_o,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},Mf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Rf=e=>{var t={};for(var r of Mf){var i=r[0],n=r[1];Lr(e[i])||(t[n]=e[i])}var s=ks({},t,e),o=e.__preview_external_dependency_versioned_paths;return Lr(o)||(Lr(e.strict_script_versioning)&&(s.strict_script_versioning=!!o),Ar(o)&&Lr(e.asset_host)&&(s.asset_host=o)),Mr(e.property_blacklist)&&(Lr(e.property_denylist)?s.property_denylist=e.property_blacklist:Mr(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:ys.error(xf+e.property_denylist)),s};class Pf{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){ys.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Ff{_replaceExtension(e,t){if(e){var r=this._extensions.indexOf(e);-1!==r&&this._extensions.splice(r,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===Oc||this.config.cookieless_mode===Ac&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Pf,this._personProcessingSetOncePropertiesSent=!1,this.version=fs.LIB_VERSION,this._internalEventEmitter=new tf,this._extensions=[],this._extensionEventPropertyProducers=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Tf(),this.SentryIntegration=bv,this.sentryIntegration=e=>function(e,t){var r=yv(e,t);return{name:mv,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Jv(this),this.pageViewManager=new Sv(this),this.rateLimiter=new Pv(this),this.requestRouter=new cf(this),this.consent=new hv(this),this.externalIntegrations=new pf(this);var t=null!==(e=Ff.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=Ar(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Ar(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>ys.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==If){var i,n=null!==(i=mf[r])&&void 0!==i?i:new Ff;return n._init(e,t,r),mf[r]=n,mf[If][r]=n,n}return this._init(e,t,r)}_init(e,t,i){var n,s;void 0===t&&(t={});var o,a=Ar(e)?e.trim():"";if(!a)return ys.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Tf(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=Tf(t.defaults),u=Rf(t),c=ks({},l,u,{name:i,token:a});Pr(l.rageclick)&&Pr(u.rageclick)&&(c.rageclick=ks({},l.rageclick,u.rageclick)),Pr(l.session_recording)&&Pr(u.session_recording)&&(c.session_recording=ks({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&ys.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Bl;var d=this._is_persistence_disabled();this.persistence=new Mv(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mv(r({},this.config,{persistence:"sessionStorage"}),d,!1);var h=r({},this.persistence.props),p=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Zv((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Kv(this),this.__request_queue=[];var _=this._inCookielessMode();if(_||(this.sessionManager=new nf(this),this.sessionPropsManager=new ef(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ys.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(_)}),0)):(ys.info("Initializing extensions synchronously"),this._initExtensions(_)),fs.DEBUG=fs.DEBUG||this.config.debug,fs.DEBUG&&ys.info("Starting in debug mode",{this:this,config:t,thisC:r({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=r({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),f=this.persistence.get_property(_c);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===Dc)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===Nc)ys.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var m=this.config.get_device_id(Yc()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(_c,t.bootstrap.isIdentifiedID?Nc:Dc),this.register({distinct_id:g,$device_id:y})}}if(_)this.register_once({distinct_id:Sc,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Yc());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(_c,Dc)}return Rs(ss,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||Yc();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(_c,Nc)),t()},n=r.user();"then"in n&&Rr(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||fv.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(fv.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(fv.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(r,t.event.properties);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,$c),identify:e=>t(e,zc),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Rr(this.config._onCapture)&&this.config._onCapture!==bf&&(ys.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&ys.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return of.apply(this,arguments)}().then((e=>{e&&this.register({[bu]:e})})).catch(bf),this}_initExtensions(e){var t,i,n,s,o,a,l,u,c=performance.now(),d=r({},Ff.__defaultExtensionClasses,this.config.__extensionClasses),h=[];d.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new d.featureFlags(this)),d.exceptions&&this._extensions.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new d.exceptions(this)),d.historyAutocapture&&this._extensions.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this._extensions.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this._extensions.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this._extensions.push(this.autocapture=new d.autocapture(this)),d.surveys&&this._extensions.push(this.surveys=null!==(n=this.surveys)&&void 0!==n?n:new d.surveys(this)),d.logs&&this._extensions.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new d.logs(this)),d.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this._extensions.push(this.productTours=new d.productTours(this)),d.heatmaps&&this._extensions.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this._extensions.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,gv)),d.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this._extensions.forEach((e=>{e.initialize&&h.push((()=>{null==e.initialize||e.initialize()}))})),h.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}})),this._processInitTaskQueue(h,c)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var r=e.shift();if(r)try{r()}catch(e){ys.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[kc]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[xc]:i}),this.config.__preview_deferred_init_extensions&&ys.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!ls||!ls.body)return ys.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=wr(i.supportedCompression,Bl)?Bl:wr(i.supportedCompression,ql)?ql:void 0),null!=(r=i.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Bc}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){ys.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=us&&us.hostname){var e=us.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new Lv(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ss(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Uc),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(n=this._retryQueue)||n.unload()):this._shouldCapturePageleave()&&this.capture(Uc,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Ef?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=r({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Lr(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,n,s=r({},e);s.timeout=s.timeout||6e4;var o,a,l,u,c,d=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Lr(s.compression)&&s.data&&(s.compression=ql),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(a=null==(c=(u=Mr(o=s.data)?o:[o])[0])||null==(l=c.properties)?void 0:l.token)&&void 0!==a?a:null==c?void 0:c.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),Mr(e)?e.map((e=>r({},e,{sent_at:t}))):r({},e,{sent_at:t})}(s.data))),s.url=jv(s.url,s.method,s.compression,s.timestampMode);var h=Gv.filter((e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport))),p=null!==(i=null==(n=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,(e=>e.transport===d)))?void 0:n.method)&&void 0!==i?i:h[0].method;if(!p)throw new Error("No available transport method");"sendBeacon"!==d&&s.data&&s.compression===Bl&&ps&&"undefined"!=typeof Promise&&!Dv?Uv(s).then((e=>{p(e)})).catch((t=>{if(_r(t))return Dv=!0,void p(r({},s,{compression:void 0,url:jv(e.url,e.method,void 0,e.timestampMode)}));gr(t)&&(Dv=!0),p(s)})):p(s)})(r({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){yf++;try{var t,r=[],i=[],n=[];Ss(e,(e=>{if(e)if(Mr(t=e[0]))n.push(e);else if(Rr(e))try{e.call(this)}catch(t){ys.error("Error executing queued PostHog call",e,t)}else Mr(e)&&"alias"===t?r.push(e):Mr(e)&&-1!==t.indexOf("capture")&&Rr(this[t])?n.push(e):i.push(e)}));var s=function(e,t){Ss(e,(function(e){try{if(Mr(e[0])){var r=t;ws(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){ys.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{yf--}}push(e){if(yf>0&&Mr(e)&&Ar(e[0])){var t=Ff.prototype[e[0]];Rr(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var n,s,o,a,l,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Lr(e)&&Ar(e)){var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var h=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){if(this._extensionEventPropertyProducers.length>0){var p={};for(var _ of this._extensionEventPropertyProducers.slice())try{ks(p,_())}catch(e){ys.error("Failed to produce browser extension event properties",e)}t=r({},p,null!=t?t:{})}var g;null!=(n=t)&&n.$current_url&&!Ar(null==(s=t)?void 0:s.$current_url)&&(ys.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(g=t)||delete g.$current_url),"$exception"!==e||null!=i&&i._originatedFromCaptureException||ys.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,f=(null==i?void 0:i.timestamp)||v,m=sn(null==i?void 0:i.uuid,Yc),y={uuid:m,event:e,properties:this.calculateEventProperties(e,t||{},f,m)};e===$c&&this.config.__preview_capture_bot_pageviews&&d&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),h&&(y.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var b="$feature_flag_called"===e&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(ec);(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);var S=null==i?void 0:i.$unset;S&&(y.$unset=S);var w=b?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==Wc,e===zc);if(w&&(y.$set_once=w),null!=i&&i._noTruncate||(a=this.config.properties_string_max_length,l=y,u=e=>Ar(e)?e.slice(0,a):e,c=new Set,y=function e(t,r){if(t!==Object(t))return u?u(t):t;if(!c.has(t)){var i;if(c.add(t),Mr(t))i=[],Ss(t,(t=>{i.push(e(t))}));else{var n={};ws(t,((t,r)=>{c.has(t)||(n[r]=e(t,r))})),i=n}return i}}(l)),y.timestamp=f,Lr(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=v),b&&(y.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return nr.forEach(i),t.forEach(i),r}(y.properties,Cf)),e===Zl.DISMISSED||e===Zl.SENT){var k,x,C=null==(k=t)?void 0:k[Yl.SURVEY_ID],I=null==(x=t)?void 0:x[Yl.SURVEY_ITERATION];gu({id:C,current_iteration:I}),y.$set=r({},y.$set,{[tu({id:C,current_iteration:I},e===Zl.SENT?"responded":"dismissed")]:!0})}else e===Zl.SHOWN&&(y.$set=r({},y.$set,{[Yl.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if("product tour shown"===e){var E,T=null==(E=t)?void 0:E.$product_tour_type;T&&(y.$set=r({},y.$set,{["$product_tour_last_seen_date/"+T]:(new Date).toISOString()}))}var M=r({},y.properties.$set,y.$set);if(Fr(M)||this.setPersonPropertiesForFlags(M),!Nr(this.config.before_send)){var R=this._runBeforeSend(y);if(!R)return;(y=R).uuid=sn(y.uuid,Yc)}this._internalEventEmitter.emit("eventCaptured",y);var P=null!==(o=null==i?void 0:i._url)&&void 0!==o?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),F={method:"POST",url:P,data:y,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(F):this._requestQueue.enqueue(F),y}ys.critical("This capture call is ignored due to client rate limiting.")}}else ys.error("No event name provided to posthog.capture")}else ys.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new ff(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}calculateEventProperties(e,t,i,n,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=r({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this._inCookielessMode()&&(a[wc]=!0),"$snapshot"===e){var l=r({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ar(a.distinct_id)&&!Br(a.distinct_id)||Or(a.distinct_id))&&ys.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=function(e,t,r,i){var n,s,o,a;if(void 0===i&&(i=!1),!_s)return{};var l,u=e?[...Sh,...t||[]]:[],c=function(e){for(var t=0;en.length>t;t++){var r=en[t],i=r[1],n=r[0].exec(e),s=n&&(Rr(i)?i(n,e):i);if(s)return s}return["",""]}(_s),d=c[0],h=c[1],p=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},_={};Lr(r)||(_.detectGoogleSearchApp=r);var g={},v=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,f=null==(s=navigator)?void 0:s.maxTouchPoints,m=null==ss||null==(o=ss.screen)?void 0:o.width,y=null==ss||null==(a=ss.screen)?void 0:a.height,b=null==ss?void 0:ss.devicePixelRatio;Lr(v)||(g.userAgentDataPlatform=v),Lr(f)||(g.maxTouchPoints=f),Lr(m)||(g.screenWidth=m),Lr(y)||(g.screenHeight=y),Lr(b)||(g.devicePixelRatio=b);var S,w=ks(Es({$os:d,$os_version:h,$browser:Ki(_s,navigator.vendor,p,_),$device:tn(_s),$device_type:rn(_s,g),$timezone:Lh(),$timezone_offset:Ah()}),{$current_url:Ns(i?on(null==us?void 0:us.href):null==us?void 0:us.href,u,kh),$host:null==us?void 0:us.host,$pathname:null==us?void 0:us.pathname,$raw_user_agent:_s.length>1e3?_s.substring(0,997)+"...":_s,$browser_version:Xi(_s,navigator.vendor,p,_),$browser_language:Th(),$browser_language_prefix:(S=Th(),"string"==typeof S?S.split("-")[0]:void 0),$screen_height:null==ss?void 0:ss.screen.height,$screen_width:null==ss?void 0:ss.screen.width,$viewport_height:null==ss?void 0:ss.innerHeight,$viewport_width:null==ss?void 0:ss.innerWidth,$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return fs.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=fs.SDK_DIST_CHANNEL),w}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime()),h=d.windowId;a.$session_id=d.sessionId,a.$window_id=h}this.sessionPropsManager&&ks(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&ks(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===af&&(a.$lib_custom_api_host=this.config.api_host),u=e!==$c||s?e!==Uc||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=ks(a,u),e===$c&&ls&&(a.title=ls.title),!Lr(o)){var _=i.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}_s&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),v=this.sessionPersistence.properties();ws(["$referrer","$referring_domain"],(e=>{e in g&&delete v[e]})),(a=ks({},c,g,v,a)).$is_identified=this._isIdentified(),Mr(this.config.property_denylist)?ws(this.config.property_denylist,(function(e){delete a[e]})):ys.error(xf+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(ys.error(kf),a=f(a,e));var m=this._hasPersonProcessing();return a.$process_person_profile=m,m&&!s&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var n=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=ks({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&(ys.error(kf),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Fr(o)?void 0:o}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:wf}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:wf})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:wf})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=fu),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:wf}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:wf})}_validateIdentifyId(e){return!e||Or(e)?(ys.critical("Unique user id has not been set in posthog.identify"),!1):e===Sc?(ys.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ys.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.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return ys.uninitializedWarning("posthog.identify");if(Br(e)&&(e=e.toString(),ys.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(yu)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Su)&&(this.unregister(Su),this.register({distinct_id:e}));var n,s=(this.persistence.get_property(_c)||Dc)===Dc,o=e!==i,a=!o&&s;if(o&&s)this.persistence.set_property(_c,Nc),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(zc,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Xc(e,t,r),null==(n=this.featureFlags)||n.setAnonymousDistinctId(i);else if(a){this.persistence.set_property(_c,Nc);var l=t||{},u=r||{};this.setPersonPropertiesForFlags({$set:l,$set_once:u},!1),this.capture("$set",{$set:l,$set_once:u}),this._cachedPersonProperties=Xc(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);o?(this.reloadFeatureFlags(),this.unregister(cc)):a&&(t||r)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=Xc(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):ys.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(Mr(e)?e:[e]).filter((e=>Ar(e)&&e.length>0));0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,i){if(e&&t){var n=this.getGroups(),s=n[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:r({},n,{[e]:t})}),s||i){var o={$group_type:e,$group_key:t};i&&(o.$group_set=i),this.capture(Wc,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else ys.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,r,i,n,s,o,a,l,u,c;if(ys.info("reset"),!this.__loaded)return ys.uninitializedWarning("posthog.reset");var d,h=this.get_property(yu),p=this.get_property(bu),_=this.get_property(Fu);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),Lr(_)||null==(d=this.persistence)||d.register({[Fu]:_}),null==(i=this.surveys)||i.reset(),null==(n=this._remoteConfigLoader)||n.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(_c,Dc),null==(c=this.sessionManager)||c.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Oc)this.register_once({distinct_id:Sc,$device_id:null},"");else{var g=this.config.get_device_id(Yc());this.register_once({distinct_id:g,$device_id:e?g:h},""),e||Lr(p)||this.register({[bu]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return t((function*(){var e,t,i,n,s,o,a;r.__loaded?(null==(e=r._remoteConfigLoader)||e.stop(),null==(t=r._browserClientAdapter)||t.dispose(),null==(i=r.logs)||i.flushLogs("sendBeacon"),null==(n=r.metrics)||n.flush("sendBeacon"),null==(s=r._requestQueue)||s.unload(),null==(o=r._retryQueue)||o.unload(),null==(a=r.featureFlags)||a.destroy()):ys.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return i}alias(e,t){return e===this.get_property(mu)?(ys.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Lr(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Su,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ys.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=r({},this.config);if(Pr(e)){var i,n,s,o,a,l,u,c,d,h,p;ks(this.config,Rf(e));var _=this._is_persistence_disabled();null==(i=this.persistence)||i.update_config(this.config,t,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mv(r({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this._checkLocalStorageForDebug(this.config.debug);Hr(g)&&(this.config.debug=g),Hr(this.config.debug)&&(this.config.debug?(fs.DEBUG=!0,cd._is_supported()&&cd._set("ph_debug",!0),ys.info("set_config",{config:e,oldConfig:t,newConfig:r({},this.config)})):(fs.DEBUG=!1,cd._is_supported()&&cd._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){fs.LIB_NAME=e,fs.LIB_VERSION=t}startSessionRecording(e){var t,r,i,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(r({},n,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Ff._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:If;return t!==If&&(t=If+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(_c))===Nc||(null==(t=this.sessionPersistence)?void 0:t.get_property(_c))===Nc}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Bc&&!this._isIdentified()&&Fr(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Su])&&(null==(t=this.persistence)||null==(t=t.props)||!t[bc]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(ys.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(bc,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ac)}_sync_opt_out_with_persistence(){var e,t,r,i,n=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(i=this.sessionPersistence)||i.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Oc){if(this._inCookielessMode()){var r,i,n,s,o;this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=new nf(this),this.pageViewManager=new Sv(this),this.persistence&&(this.sessionPropsManager=new ef(this,this.sessionManager,this.persistence));var a,l=null!==(n=null==(s=this.config.__extensionClasses)?void 0:s.sessionRecording)&&void 0!==n?n:null==(o=Ff.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ac&&(null==(u=this.surveys)||u.loadIfEnabled()),(Lr(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else ys.warn(Sf)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Oc?(this.config.cookieless_mode===Ac&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Ac&&(this.register({distinct_id:Sc,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):ys.warn(Sf)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Oc||(this.config.cookieless_mode===Ac?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return as?sf(as,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ls&&("visible"===ls.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture($c,{title:ls.title},{send_instantly:!0}),this._visibilityStateListener&&(ls.removeEventListener(qc,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Rs(ls,qc,this._visibilityStateListener)))}debug(e){!1===e?(null==ss||ss.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ss||ss.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)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ys.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,r,i,n){var s=t in e&&!Nr(e[t]),o=r in e&&!Nr(e[r]);return s?e[t]:!!o&&(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,ys)}_runBeforeSend(e){var t;if(Nr(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(zr),i=Mr(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i){if(n=s(n),Nr(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Ur(e.event)?ys.warn(o+". This can cause unexpected behavior."):ys.info(o),null}n.properties&&!Fr(n.properties)||ys.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of r)if(n.properties&&Nr(n.properties[a]))return ys.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=Hr(e)&&!e,r=cd._is_supported()&&"true"===cd._get("ph_debug");return!t&&(!!r||e)}}Ff.__defaultExtensionClasses={},Ff._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Is(e.prototype[t[r]])}(Ff,["identify"]);var Lf=bs("[ExceptionAutocapture]"),Af=bs("[TracingHeaders]"),Of=bs("[Web Vitals]"),Df=9e5,Nf="[SessionRecording]",Bf=bs(Nf),qf=bs("[Heatmaps]");function Hf(e){return Pr(e)&&"clientX"in e&&"clientY"in e&&Br(e.clientX)&&Br(e.clientY)}var $f=bs("[Product Tours]"),Uf=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(Ru))},zf=["$set_once","$set"],Wf=bs("[SiteApps]"),Vf="Error while initializing PostHog app with config id ";function jf(e,t,r){if(Nr(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Gf{constructor(e){this._debugEventEmitter=new tf,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),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,t;Lr(null==(e=this._instance)?void 0:e._addCaptureHook)||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)})))}register(e){var t,r;if(!Lr(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,r;null==(t=this._actionRegistry)||t.add(e),null==(r=e.steps)||r.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(r=this._instance)&&r.autocapture)){var i,n=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&n.add(null==e?void 0:e.selector)}))})),null==(i=this._instance)||i.autocapture.setElementSelectors(n)}}on(e,t){var r;null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry&&(null==(r=this._actionRegistry)?void 0:r.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 r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!jf(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>jf(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&jf((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>jf(e.text,t.text,t.text_matching||"exact")||jf(e.$el_text,t.text,t.text_matching||"exact")));var n,s,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(n=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!Nr(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),s=t.text,o=t.text_matching||"exact",n.some((e=>jf(e,s,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var n=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||nd(t.properties.reduce(((e,t)=>{var r=Mr(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class Qf{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,null==(t=this._instance)||null==t.onSessionId||t.onSessionId((e=>this._onSessionIdChanged(e)))}_doesEventMatchFilter(e,t){return!!e&&nd(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach((e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach((t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}}))})),r}_getMatchingItems(e,t,r){var i=(r===Hl?this._eventToItems:this._cancelEventToItems).get(e),n=[];return this._getItems((e=>{n=e.filter((e=>null==i?void 0:i.includes(e.id)))})),n.filter((i=>{var n,s=null==(n=i.conditions)||null==(n=n[r])||null==(n=n.values)?void 0:n.find((t=>t.name===e));return this._doesEventMatchFilter(s,t)}))}register(e){var t;Lr(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(e){var t=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0}));0!==t.length&&(null==this._actionMatcher&&(this._actionMatcher=new Gf(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,r,i,n,s;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(r=e.conditions)&&null!=(r=r.actions)&&r.values&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0&&(null==(n=this._actionMatcher)||n.register(e.conditions.actions.values),null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||s.forEach((t=>{if(t&&t.name){var r=this._actionToItems.get(t.name);r&&r.push(e.id),this._actionToItems.set(t.name,r||[e.id])}})))})))}_setupEventBasedItems(e){var t,r=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})),i=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0}));0===r.length&&0===i.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,Hl),this._cancelEventToItems=this._buildEventToItemMap(e,$l))}onEvent(e,t){var r,i,n=this._getLogger(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var o=this._activationOutcome(e,s);if("consume"===o)return n.info("event consumed activated item, removing it",{event:e,itemId:s}),void this._deactivateItems([s]);if("persist"===o)return n.info("shown item promoted to persisted activation",{event:e,itemId:s}),void this._persistActivation(s)}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,$l);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map((e=>e.id))}),this._deactivateItems(a.map((e=>e.id))),a.forEach((e=>this._cancelPendingItem(e.id))))}if(this._eventToItems.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,Hl);this._activateItems(l.map((e=>e.id)))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){0!==e.length&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...e])],this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter((t=>t!==e));var t=this._getPersistedActivatedIds();t.includes(e)||(this._setActivatedItems([...t,e]),this._stampActivationSession())}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getRawPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession())}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],n=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return n&&i===n?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];r&&r!==e&&(this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession())}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class Zf extends Qf{constructor(e){super(e)}_getActivatedKey(){return ac}_getActivatedSessionKey(){return lc}_getShownEventName(){return Zl.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return lu}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ac]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[lc]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(lc)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||au(r)?e===Zl.SHOWN?"consume":"ignore":e===Zl.SHOWN?"persist":e===Zl.DISMISSED||e===Zl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Yf="SDK is not enabled or survey functionality is not yet loaded",Kf="Disabled. Not loading surveys.",Jf=null!=ss&&ss.location?Bs(ss.location.hash,"__posthog")||Bs(location.hash,"state"):null,Xf="_postHogToolbarParams",em=bs("[Toolbar]"),tm=bs("[FeatureFlags]"),rm=bs("[FeatureFlags]",{debugEnabled:!0}),im="\" failed. Feature flags didn't load in time.",nm=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},sm=e=>{var t={};for(var r of xs(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},om="Refusing to render web experiment since the viewer is a likely bot",am={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Jc(t,e),not_regex:(e,t)=>!Jc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class lm{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{lm._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(lm._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t._flagToExperiments)||r.set(e.feature_flag_key,e));var i=t._instance.getFeatureFlag(e.feature_flag_key);Ar(i)&&e.variants[i]&&t._applyTransforms(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];lm._matchesTestVariant(s,t._instance)&&t._applyTransforms(e.name,n,s.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())lm._logInfo(om);else if(!this._config.disable_web_experiments){if(Nr(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();lm._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),n=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=n&&n.variants[i]&&this._applyTransforms(n.name,i,n.variants[i].transforms)}}))}}previewWebExperiment(){var e=lm.getWindowLocation();if(null!=e&&e.search){var t=Ds(null==e?void 0:e.search,"__experiment_id"),r=Ds(null==e?void 0:e.search,"__experiment_variant");t&&r&&(lm._logInfo("previewing web experiments "+t+" && "+r),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),r,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var 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._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(lm._logInfo("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this._applyTransforms(i[0].name,t,i[0].variants[t].transforms))}static _matchesTestVariant(e,t){return!Nr(e.conditions)&&lm._matchUrlConditions(e,t)&&lm._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(Nr(e.conditions)||Nr(null==(r=e.conditions)?void 0:r.url))return!0;var i=lm.getWindowLocation();if(i){var n,s,o,a=Ws(t,i.href);return null==(n=e.conditions)||!n.url||am[null!==(s=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,a)}return!1}static getWindowLocation(){return null==ss?void 0:ss.location}static _matchUTMConditions(e){var t;if(Nr(e.conditions)||Nr(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Ch();if(r.utm_source){var i,n,s,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==r.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==r.utm_medium,_=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==r.utm_term;return d&&p&&_&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];ys.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?lm._logInfo(om):"control"!==t?r.forEach((r=>{if(r.selector){var i;lm._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var n=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==n||n.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):lm._logInfo("Control variants leave the page unmodified.")}_is_bot(){return as&&this._instance?sf(as,this._config.custom_blocked_useragents):void 0}}var um=bs("[Conversations]"),cm="Conversations not available yet.",dm="console",hm={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],ss&&Rs(ss,"online",this._onOnline)}destroy(){null==ss||ss.removeEventListener("online",this._onOnline)}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,tm.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(tm.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||tm.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}_getValidFlagKeys(){var e=this._config.flag_keys;if(!Lr(e)){if(Mr(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||tm.error("Invalid flag key found:",e,"Expected non-empty string"),t}));tm.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,r=this._instance.config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var n,s,o=null!==(n=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==n?n:{},a=Object.keys(i).filter((e=>!!i[e])).reduce(((e,t)=>(e[t]=i[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var n,s,o=null!=i&&i.merge&&null!==(n=this._prop(Qu))&&void 0!==n?n:{},a=null!=i&&i.merge&&null!==(s=this._prop(Ju))&&void 0!==s?s:{},l=r({},o,e),u=r({},a,t),c={};for(var d of Object.entries(l)){var h=d[0],p=d[1];c[h]={key:h,enabled:tr(p),variant:rr(p),reason:void 0,metadata:Lr(null==u?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(Ku),t=this._prop(tc),i=this._prop(rc);if(!i&&!t)return e||{};var n=ks({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of s){var a,l,u=n[o],c=null==t?void 0:t[o],d=Lr(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,h=Lr(c)?u.variant:"string"==typeof c?c:void 0,p=null==i?void 0:i[o],_=r({},u,{enabled:d,variant:d?null!=h?h:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(_.original_enabled=null==u?void 0:u.enabled),h!==(null==u?void 0:u.variant)&&(_.original_variant=null==u?void 0:u.variant),p&&(_.metadata=r({},null==u?void 0:u.metadata,{payload:p,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),n[o]=_}return this._override_warning||(tm.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:n}),this._override_warning=!0),n}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((r=>{var i=e[r];return{key:r,enabled:tr(i),variant:rr(i),payload:er(t[r])}}))}getFlagVariants(){var e=this._prop(Qu),t=this._prop(tc);if(!t)return e||{};for(var r=ks({},e),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(tm.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(Ju),t=this._prop(rc);if(!t)return e||{};for(var r=ks({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(tm.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._hasStatusZeroCircuitBreakerTripped()||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags()&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i=this._config.token,n=this._prop(yu),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:r({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(ic)||{},{$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION}),group_properties:this._prop(nc),timezone:Lh()};Dr(n)||Lr(n)||(s.$device_id=n),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._getValidFlagKeys();Lr(o)||(s.flag_keys=o);var a=!!this._config.advanced_only_evaluate_survey_feature_flags,l=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._config.disable_compression?void 0:ql,timestampMode:"body",timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,n=!0;if(this._trackStatusZeroReachability(e.statusCode),200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),n=!1),this._requestInFlight=!1,!s.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var l,u=!(null==(r=e.json)||null==(r=r.quotaLimited)||!r.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(i=this._persistence)||i.register({[hc]:o}),u)tm.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},n,{partialResponse:a}),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}_hasStatusZeroCircuitBreakerTripped(){return qs(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Hs(e,this._consecutiveStatusZeroFailures,3,(()=>tm.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else tm.warn('getFeatureFlag for key "'+e+im)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r=this.getFlagVariants(),i=e in r,n=r[e],s=this.getFlagPayloads()[e],o=String(n),a=this._prop(Xu)||void 0,l=this._prop(pc)||void 0,u=this._prop(cc)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this._prop(dc);d&&d!==h&&(u={},null==(c=this._persistence)||c.register({[cc]:u,[dc]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,_,g,v,f,m,y,b,S,w,k;Mr(u[e])?u[e].push(o):u[e]=[o],null==(p=this._persistence)||p.register({[cc]:u});var x=this.getFeatureFlagDetails(e),C=[...null!==(_=this._prop(hc))&&void 0!==_?_:[]];Lr(n)&&C.push("flag_missing");var I={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Lr(null==x||null==(f=x.metadata)?void 0:f.has_experiment)||(I.$feature_flag_has_experiment=x.metadata.has_experiment),Lr(null==x||null==(m=x.metadata)?void 0:m.version)||(I.$feature_flag_version=x.metadata.version);var E,T=null!==(y=null==x||null==(b=x.reason)?void 0:b.description)&&void 0!==y?y:null==x||null==(S=x.reason)?void 0:S.code;T&&(I.$feature_flag_reason=T),null!=x&&null!=(w=x.metadata)&&w.id&&(I.$feature_flag_id=x.metadata.id),Lr(null==x?void 0:x.original_variant)&&Lr(null==x?void 0:x.original_enabled)||(I.$feature_flag_original_response=Lr(x.original_variant)?x.original_enabled:x.original_variant),null!=x&&null!=(k=x.metadata)&&k.original_payload&&(I.$feature_flag_original_payload=null==x||null==(E=x.metadata)?void 0:E.original_payload),C.length&&(I.$feature_flag_error=C.join(",")),this._instance.capture("$feature_flag_called",I)}if(i)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:er(s)}}}else tm.warn('getFeatureFlagResult for key "'+e+im)}getRemoteConfigPayload(e,t){var r=this._config.token,i={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION}};this._shouldIncludeEvaluationEnvironments()&&(i.evaluation_contexts=this._getValidEvaluationEnvironments());var n=this._getValidFlagKeys();Lr(n)||(i.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this._config.disable_compression?void 0:ql,timestampMode:"body",timeout:this._config.feature_flag_request_timeout_ms,callback(r){var i,n=null==(i=r.json)?void 0:i.featureFlagPayloads;t((null==n?void 0:n[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return tm.warn('isFeatureEnabled for key "'+e+im),t.defaultValue;var r=this.getFeatureFlag(e,t);return Lr(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,i){if(this._persistence){this._hasLoadedFlags=!0;var n=this.getFlagVariants(),s=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,i,n,s,o){void 0===i&&(i={}),void 0===n&&(n={}),void 0===s&&(s={});var a=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var r;return[e,null!==(r=t[e].variant)&&void 0!==r?r:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var r;return null==(r=t[e].metadata)?void 0:r.payload})).map((e=>{var r;return[e,null==(r=t[e].metadata)?void 0:r.payload]})))):e.featureFlags&&tm.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var d=e.requestId,h=e.evaluatedAt;if(Mr(u)){tm.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var _=0;u.length>_;_++)p[u[_]]=!0;t&&t.register({[Zu]:u,[Qu]:p,[ec]:!1})}else{var g=u,v=c,f=l;if(null!=o&&o.partialResponse)g=r({},i,g),v=r({},n,v),f=r({},s,f);else if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((e=>{var t;return!(null!=(t=l[e])&&t.failed)})));g=r({},i,Object.fromEntries(Object.entries(g).filter((e=>m.has(e[0]))))),v=r({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>m.has(e[0]))))),f=r({},s,Object.fromEntries(Object.entries(f||{}).filter((e=>m.has(e[0])))))}else g=r({},i,g),v=r({},n,v),f=r({},s,f);t&&t.register(r({[Zu]:Object.keys(sm(g)),[Qu]:g||{},[Ju]:v||{},[Ku]:f||{},[ec]:!0===e.minimalFlagCalledEvents},d?{[Xu]:d}:{},h?{[pc]:h}:{}))}}}(e,this._persistence,n,s,o,i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),tm.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return tm.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(tc),this._persistence.unregister(rc),this._fireFeatureFlagsCallbacks(),rm.info("All overrides cleared");if(Mr(e)){var t=nm(e);return this._persistence.register({[tc]:t}),this._fireFeatureFlagsCallbacks(),rm.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var r,i=e;if(this._override_warning=Boolean(null!==(r=i.suppressWarning)&&void 0!==r&&r),"flags"in i)if(!1===i.flags)this._persistence.unregister(tc),rm.info("Flag overrides cleared");else if(i.flags){if(Mr(i.flags)){var n=nm(i.flags);this._persistence.register({[tc]:n})}else this._persistence.register({[tc]:i.flags});rm.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._persistence.unregister(rc),rm.info("Payload overrides cleared")):i.payloads&&(this._persistence.register({[rc]:i.payloads}),rm.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[tc]:e}),this._fireFeatureFlagsCallbacks(),rm.info("Flag overrides set",{flags:e});tm.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){tm.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n,s=(this._prop(Yu)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=r({},this.getFlagVariants(),{[e]:t});null==(n=this._persistence)||n.register({[Zu]:Object.keys(sm(l)),[Qu]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(Yu),n=r?"&"+r.map((e=>"stage="+e)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+n),method:"GET",timestampMode:"query",callback:t=>{var r,i;if(t.json){var n=t.json.earlyAccessFeatures;return null==(r=this._persistence)||r.unregister(Yu),null==(i=this._persistence)||i.register({[Yu]:n}),e(n)}}})}_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,r)=>(e[r]=t[r],e)),{})}}_fireFeatureFlagsCallbacks(e){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((t=>{try{t(r,i,{errorsLoading:e})}catch(e){tm.error("Error while running feature flags callback",e)}}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(ic)||{},n=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,o={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in i||(o[a]=s[a]));this._instance.register({[ic]:r({},i,o,n)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=r({},this._prop(ic)||{});e.forEach((e=>{delete i[e]})),this._instance.register({[ic]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(ic),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(nc)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=r({},i[t],e[t]),delete e[t]})),this._instance.register({[nc]:r({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(nc)||{};this._instance.register({[nc]:r({},t,{[e]:{}})})}else this._instance.unregister(nc)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},pm={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===S_||this._recordingStatus===w_?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=g_,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw Bf.error("started without valid sessionManager"),new Error(Nf+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===Oc)throw new Error(Nf+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(Fu))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return ss&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var r=!Lr(Object.assign)&&!Lr(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),Bf.info("starting")):(this._recordingStatus=g_,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==S_&&this._recordingStatus!==w_&&(this._recordingStatus=b_),null!=ba&&null!=(t=ba.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=ba.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=ba.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return Bf.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(qu),null==(t=this._persistence)||t.unregister(Lu)}_validateSampleRate(e,t){if(Nr(e))return null;var r,i=Br(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(Bf.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,i,n=this._persistence,s=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Nr(a)&&this._resetSampling();var l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[Fu]:r({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:r({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Lr(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):(this._recordingStatus===S_&&(this._recordingStatus=w_,Bf.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):Bf.warn("log called before recorder was ready")}get _scriptName(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Fu);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,r=this._instance.get_property(Fu);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return Bf.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var i=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return Date.now()-i<=qg}_onScriptLoaded(e){var t,r;if(null==(t=ba.__PosthogExtensions__)||!t.initSessionRecording)return Bf.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Cc]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(r=ba.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===w_||this._recordingStatus===S_)return;return this._recordingStatus=S_,Bf.info("persisted remote config is stale, requesting fresh config before starting"),void new Lv(this._instance).load()}this._recordingStatus=b_,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Ou]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Au]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?Du:Nu]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}}},_m={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Xp(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,r=Pr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=null==(e=r.url_allowlist)?void 0:e.map((e=>new RegExp(e))),r.url_ignorelist=null==(t=r.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ss&&ls){var e=e=>{e=e||(null==ss?void 0:ss.event);try{this._captureEvent(e)}catch(e){t_.error("Failed to capture event",e)}};if(Rs(ls,"submit",e,{capture:!0}),Rs(ls,"change",e,{capture:!0}),Rs(ls,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ss?void 0:ss.event);try{this._captureEvent(e,e_)}catch(e){t_.error("Failed to capture copy/cut event",e)}};Rs(ls,"copy",t,{capture:!0}),Rs(ls,"cut",t,{capture:!0})}}}else t_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r=t.autocapture_opt_out;Hr(r)&&(this.instance.persistence&&this.instance.persistence.register({[ku]:r}),this._isDisabledServerSide=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var i=null==ls?void 0:ls.querySelectorAll(t);null==i||i.forEach((i=>{e===i&&r.push(t)}))})),r}get isEnabled(){var e,t,r=null==(e=this.instance.persistence)?void 0:e.props[ku],i=this._isDisabledServerSide,n=this.instance._shouldDisableFlags()&&!this._hasReceivedConfigResponse;if(Dr(i)&&!Hr(r)&&!n)return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,i=ao(e);Xs(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&yo(i,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===e_;if(i&&function(e,t,r,i,n,s){var o;if(!ss||bo(e))return!1;if(null!=r&&r.url_allowlist&&!io(r.url_allowlist,s))return!1;if(null!=r&&r.url_ignorelist&&io(r.url_ignorelist,s))return!1;if(null!=r&&r.dom_event_allowlist){var a=r.dom_event_allowlist;if(a&&!a.some((e=>t.type===e)))return!1}var l=So(e,i),u=l.parentIsUsefulElement,c=l.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(Lr(r))return!0;var i,n=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e)if(i=n(s))return i.v;return!1}(c,r))return!1;if(!uo(c,null==r?void 0:r.css_selector_allowlist))return!1;if(uo(c,null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:ho))return!1;try{var d=ss.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return u?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(lo.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this._config,n,n?["copy","cut"]:void 0,this.instance)){var s=n_(i,{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,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===e_){var l,u=so(null==ss||null==(l=ss.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=c}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Rr(null==ls?void 0:ls.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ss||null==(t=ss.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ys.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,ys.info("History API monitoring stopped")}monitorHistoryChanges(){ss&&ss.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ss&&(null==(t=ss.history[e])||!t.__posthog_wrapped__)){var r=this;Us(ss.history,e,(t=>function(i,n,s){t.call(this,i,n,s),r._capturePageview(e)}))}}_capturePageview(e){try{var t,r=null==ss||null==(t=ss.location)?void 0:t.pathname;if(!r)return;r!==this._lastPathname&&this.isEnabled&&this._instance.capture($c,{navigation_type:e}),this._lastPathname=r}catch(t){ys.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Rs(ss,"popstate",e),this._popstateListener=()=>{ss&&ss.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[xu]),this.rageclicks=new Xp(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Pr(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Nr(this._config.capture_heatmaps)?Nr(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;qf.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[xu]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){Hf(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(ls)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ss&&ls&&(this._flushHandler=this._flush.bind(this),Rs(ss,Hc,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ss?void 0:ss.event)),Rs(ls,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ss?void 0:ss.event)),Rs(ls,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new vv(this.instance,_v,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Rs(ls,qc,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ss&&ls&&(this._flushHandler&&ss.removeEventListener(Hc,this._flushHandler),this._onClickHandler&&ls.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&ls.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&ls.removeEventListener(qc,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),s=function(e,t,r){for(var i=e;i&&Ks(i)&&!Js(i,"body");){if(i===r)return!1;var n=void 0;try{var s,o,a;n=null==(s=null!==(o=null==(a=i.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:ss)?void 0:s.getComputedStyle(i).position}catch(e){return!1}if(wr(t,n))return!0;i=co(i)}return!1}(ao(e),["fixed","sticky"],n);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:r),target_fixed:s,type:t}}_onClick(e,t){var i;if(void 0===t&&(t="click"),!Ys(e.target)&&Hf(e)){var n=this._getProperties(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&yo(ao(e),this.instance.config.rageclick)&&this._capture(r({},n,{type:"rageclick"})),this._capture(n)}}_onMouseMove(e){!Ys(e.target)&&Hf(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ss){var t=this._config.disable_capture_url_hashes?on(ss.location.href):ss.location.href,r=this._config.custom_personal_data_properties,i=this._config.mask_personal_data_properties?[...Sh,...r||[]]:[],n=Ns(t,i,kh);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(e)}}_flush(){this._buffer&&!Fr(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:vv,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>r({},e,{["$web_vitals_"+t.name+"_event"]:r({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this._currentURL();if(!Lr(i))if(Nr(null==e?void 0:e.name)||Nr(null==e?void 0:e.value))Of.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==i&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Lr(this._buffer.url)&&(this._buffer.url=i),this._buffer.firstMetricTimestamp=Lr(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=r({},e,{$current_url:i,timestamp:Date.now()});Lr(n)||(s.$session_id=n.sessionId,s.$window_id=n.windowId),this._buffer.metrics.push(s),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Of.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=ba.__PosthogExtensions__;if(!Lr(n)&&!Lr(n.postHogWebVitalsCallbacks)){var s=n.postHogWebVitalsCallbacks;e=s.onLCP,t=s.onCLS,r=s.onFCP,i=s.onINP}e&&t&&r&&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&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this)),this._initialized=!0):Of.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Tu]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=Pr(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Nr(r)?(null==(t=this._instance.persistence)?void 0:t.props[Pu])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Pr(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Pr(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Pr(this._perfConfig)&&Br(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Df;return e>0&&6e4>=e?Df:e}get isEnabled(){var e=null==us?void 0:us.protocol;if("http:"!==e&&"https:"!==e)return Of.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Pr(this._perfConfig)?this._perfConfig.web_vitals:Hr(this._perfConfig)?this._perfConfig:void 0;return Hr(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Of.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=Pr(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Pr(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Tu]:r}),this._instance.persistence.register({[Pu]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Of.error("failed to load script",t):e()}))}_currentURL(){var e=ss?this._instance.config.disable_capture_url_hashes?on(ss.location.href):ss.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Sh,...t||[]]:[];return Ns(e,r,kh)}Of.error("Could not determine current URL")}}},gm={exceptionObserver:class{constructor(e){var t;this._startCapturing=()=>{var e;if(ss&&this.isEnabled&&null!=(e=ba.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=ba.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=ba.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=ba.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=r(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=i(this.captureException.bind(this)))}catch(e){Lf.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Cu]),this._rateLimiter=new Kr(r({},function(e){var t,r,i,n;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:Lf})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Pr(e)?t=r({},t,e):(Lr(e)?this._remoteEnabled:e)&&(t=r({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Lf.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Lf.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Cu]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,n=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(n)?Lf.info("Skipping exception capture because of client rate limiting.",{exception:n}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=np(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Iu))&&void 0!==t?t:[],this._exceptionStepsConfig=rs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new is(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=rs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var n=e.config;if("errorTracking"in n){var s=null!==(t=null==(r=n.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=n.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[Iu]:this._suppressionRules,[Eu]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Eu),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=r?r:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Ar(e)||0===e.trim().length)return void ip.warn("Ignoring exception step because message must be a non-empty string");var i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>es.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),n=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&ip.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(r({[Jn]:e,[Xn]:(new Date).toISOString()},n))}catch(e){ip.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void ip.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void ip.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void ip.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Nr(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(s=globalThis._posthogReleaseId)&&s.length>0?s:void 0;i&&(r.$release_id=i);try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return n&&this._exceptionStepsBuffer.clear(),n}catch(e){return ip.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void ip.error("Failed to process exception event. Ignoring this exception.",e)}var s}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:r({},e,{$exception_steps:t})}catch(t){return ip.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Jn]:e,[Xn]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Pr(e)?r({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce(((e,t)=>{var r=t.type,i=t.value;return Ar(r)&&r.length>0&&e.$exception_types.push(r),Ar(i)&&i.length>0&&e.$exception_values.push(i),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var r=e.values.map((e=>{var r=ed[e.operator],i=t[e.key];if(!r||!i)return!1;var n=Mr(e.value)?e.value:[e.value];return n.length>0&&r(n,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return ip.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap((e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}));return t.some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,r,i,n,s=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!Nr(e)&&Mr(e)}}},vm=r({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[Ru]:!!t.productTours}),!Uf(this._instance))return!this._productTourManager&&Nr(null==(r=this._persistence)?void 0:r.props[uc])||$f.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&Uf(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?$f.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=ba.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=ba.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Mr(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[uc];if(Mr(i)&&!t)return this._cachedTours=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:t=>{if(Uf(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return $f.error(n),void e([],{isLoaded:!1,error:n})}var s=Mr(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[uc]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Nr(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(uc)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},hm),fm={siteApps:class{constructor(e){this._siteAppElementPatchCount=0,this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=ba._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,n,s,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var p of Object.entries(h)){var _=p[0];c[_]={id:d[_],type:_,properties:p[1]}}var g=e.$set_once,v=e.$set;return{event:r({},i(e,zf),{properties:r({},e.properties,v?{$set:r({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:r({},null!==(s=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==s?s:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Wf.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Wf.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,i,n,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==ls?void 0:ls.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var c=[],d=this,h=new WeakSet,p=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),c.push((()=>{e[t]=i}))}},_=e=>{if(h.has(e))return e;var t=d._prepareElementForSiteApp(e);return t&&h.add(t),t},g=e=>e.map((e=>"string"==typeof e?e:_(e))).filter((e=>!Dr(e)));return p(u,"appendChild",(e=>function(t){var r=_(t);return r?e.call(this,r):t})),p(u,"insertBefore",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):t})),p(u,"replaceChild",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):r})),[null==(t=l.Element)?void 0:t.prototype,null==(r=l.Document)?void 0:r.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach((e=>{p(e,"append",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"prepend",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}))})),[null==(n=l.Element)?void 0:n.prototype,null==(s=l.CharacterData)?void 0:s.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((e=>{p(e,"before",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"after",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var n=g(r);return r.length&&!n.length?void 0:e.apply(this,n)}))})),p(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(e=>function(t,r){var i=_(r);return i?e.call(this,t,i):null})),this._restoreSiteAppElementPatches=()=>{c.forEach((e=>e())),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(Wf.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>this._runWithPreparedSiteAppElements((()=>null==t.processEvent?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,n=n=>{t.errored=!n,t.loaded=!0,Wf.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var s=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1).processEvent;s&&(t.processEvent=s),i=!0}catch(t){Wf.error(Vf+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){Wf.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements((()=>null==i.processEvent?void 0:i.processEvent(r)))}catch(t){Wf.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(e){var t,r,i,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void Wf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var s=e.config;if(null!=(i=s.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;ba["__$$ph_site_app_"+t]=n._instance,null==(e=ba.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(n._instance,r,(e=>{if(e)return Wf.error(Vf+t,e)}))};for(var a of s.siteApps)o()}else Wf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},mm={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(Lr(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=ba.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Lr(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=ba.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Af.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Mr(e)?(Mr(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Mr(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},ym=r({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){if(!e.ok)return lu.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Nr(t))return lu.warn("Flags not loaded yet. Not loading surveys.");var r=Mr(t);this._isSurveysEnabled=r?t.length>0:t,lu.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith(du)||null!=i&&i.startsWith(hu))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)lu.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)lu.info(Kf);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())lu.info("Not loading surveys in cookieless mode without consent.");else{var e=null==ba?void 0:ba.__PosthogExtensions__;if(e){if(!Lr(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var r=e.generateSurveys;if(r)return void this._completeSurveyInitialization(r,t);var i=e.loadExternalDependency;if(!i)return void this._handleSurveyLoadError(Lc);i(this._instance,"surveys",(r=>{r||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",r):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else lu.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Zf(this._instance),lu.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){lu.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return lu.info(Kf),e([]);var r,i=this._instance.get_property(sc);if(i&&!t)return e(i,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>e(t.surveys,t.context))):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{r=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timestampMode:"query",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var i;this._getSurveysInFlightPromise=null;var n=t.statusCode;if(200!==n||!t.json){var s="Surveys API could not be loaded, status: "+n;lu.error(s),this._lastSurveyRefreshFailedAt=Date.now();var o={isLoaded:!1,error:s};return e([],o),void(null==r||r({surveys:[],context:o}))}this._lastSurveyRefreshFailedAt=null;var a,l=t.json.surveys||[],u=l.filter((e=>uu(e)&&(ou(e)||cu(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(i=this._instance.persistence)||i.register({[sc]:l,[oc]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e=this._instance.get_property(oc);return Br(e)&&Date.now()-e>3e5}_isSurveyRefreshBackingOff(){return Br(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r,i={id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null};gu(i);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){lu.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Nr(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);lu.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((r=>{var i;t=null!==(i=r.find((t=>t.id===e)))&&void 0!==i?i:null})),t}_checkSurveyEligibility(e){if(Nr(this._surveyManager))return{eligible:!1,reason:Yf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(Nr(this._surveyManager))return{eligible:!1,reason:Yf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Nr(this._surveyManager))return lu.warn("init was not called"),{visible:!1,disabledReason:Yf};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Nr(this._surveyManager)?(lu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Yf})):new Promise((r=>{this.getSurveys((t=>{var i,n=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(n){var s=this._checkSurveyRenderability(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(Nr(this._surveyManager))lu.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(vu.includes(n.type)){var s=null==ls?void 0:ls.querySelector(t);if(s)return null!=(i=n.appearance)&&i.surveyPopupDelaySeconds?(lu.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;lu.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,s,r),lu.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);lu.warn("Survey element not found")}else lu.warn("Surveys of type "+n.type+" cannot be rendered in the app");else lu.warn("Survey not found")}}displaySurvey(e,t){var i;if(Nr(this._surveyManager))lu.warn("init was not called");else{var n=this._getSurveyById(e);if(n){var s=n;if(null!=(i=n.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=r({},n,{appearance:r({},n.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Kl&&t.initialResponses&&lu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this._checkSurveyEligibility(n);if(!o.eligible)return void lu.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else lu.warn("Survey not found")}}cancelPendingSurvey(e){Nr(this._surveyManager)?lu.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}},hm),bm={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){ba.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=ba.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),Ps(this.instance.config))return!1;if(!ss||!ls)return!1;e=null!=e?e:ss.location,r=null!=r?r:ss.history;try{if(!t){try{ss.localStorage.setItem("test","test"),ss.localStorage.removeItem("test")}catch(e){return!1}t=null==ss?void 0:ss.localStorage}var i,n=Jf||Bs(e.hash,"__posthog")||Bs(e.hash,"state"),s=n?Cs((()=>JSON.parse(atob(decodeURIComponent(n)))))||Cs((()=>JSON.parse(decodeURIComponent(n)))):null;return s&&"ph_authorize"===s.action?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?e.hash=s.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Xf)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}_callLoadToolbar(e){var t=ba.ph_load_toolbar||ba.ph_load_editor;!Nr(t)&&Rr(t)?t(e,this.instance):em.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==ls||!ls.getElementById(js));if(!ss||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=r({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(ss.localStorage.setItem(Xf,JSON.stringify(r({},n,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(n);else if(0===this._getToolbarState()){var s;this._setToolbarState(1),null==(s=ba.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return em.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),Rs(ss,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(n)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},Sm=r({experiments:lm},hm),wm={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;Nr(t)||(Hr(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Ps(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==ba?void 0:ba.__PosthogExtensions__;if(e&&!Lr(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(Lc);r(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else um.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),um.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else um.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){um.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():um.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Dr(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,r,i){var n=this;return t((function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,r,i):(um.warn(cm),null)}))()}getMessages(e,r){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,r):(um.warn(cm),null)}))()}markAsRead(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.markAsRead(e):(um.warn(cm),null)}))()}getTickets(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getTickets(e):(um.warn(cm),null)}))()}requestRestoreLink(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.requestRestoreLink(e):(um.warn(cm),null)}))()}restoreFromToken(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.restoreFromToken(e):(um.warn(cm),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(um.warn(cm),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},km={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=bs("[logs]"),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._onReconnect=()=>{var e,t;this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),ss&&Rs(ss,"online",this._onReconnect)}_buildCore(e,t,r,i){var n,s=function(e,t){var r,i,n,s,o,a,l,u=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,c=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,d=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,h=Lr(d)?Math.max(c,2048):Math.max(c,d),p=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(s=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==s?s:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(n=this._instance)||null==(n=n.config)?void 0:n.logs,r);return[new mn(this._createHost(e,t),s,this._logger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore((()=>this._queue),(e=>{this._queue=e}));this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},dm);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var r=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!Nr(r)&&r&&(this._isLogsEnabled=!0,this.loadIfEnabled())}}reset(){var e,t;this._queue=[],null==(e=this._core)||e.reset(),this._consoleQueue=[],null==(t=this._consoleCore)||t.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._getCore().captureLog(e)}_captureConsoleLog(e){this._getConsoleCore().captureLog(e)}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch((e=>this._logger.error("PostHog logs flush failed:",e))),this._consoleCore&&this._consoleCore.flush().catch((e=>this._logger.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=null==ba?void 0:ba.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(t=>{var r;t||null==(r=e.logs)||!r.initializeLogs?this._logger.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this._isLoaded=!0)})):this._logger.error(Lc)}else this._logger.error("PostHog Extensions not found.")}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===sr.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===sr.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>fs.LIB_NAME,getLibraryVersion:()=>fs.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(qs(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(n),t(e))},n=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}}))}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=Hs(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,fs.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,dm,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=fn(s,vn(r,fs.LIB_NAME,fs.LIB_VERSION),i,fs.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,Nr(n)||(t.sessionStartTimestamp=n),Nr(s)||(t.lastActivityTimestamp=s)}if(null!=ba&&null!=(e=ba.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?on(ba.location.href):ba.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},xm={metrics:class{constructor(e){this._logger=bs("[metrics]"),this._instance=e}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new wn(this._createHost(),function(e){var t,r,i,n,s,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(s=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==s?s:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch((e=>this._logger.error("PostHog metrics flush failed:",e)))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>fs.LIB_NAME,getLibraryVersion:()=>fs.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((i=>{var n=!1,s=e=>{n||(n=!0,clearTimeout(o),i(e))},o=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(r({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;if(t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;s({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("metrics request failed with status "+t)})}}}))}))}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Cm=r({},hm,pm,_m,gm,vm,fm,ym,mm,bm,Sm,wm,km,xm);Ff.__defaultExtensionClasses=r({},Cm),function(){fs.SDK_DIST_CHANNEL="cdn";var e=ba.posthog;if(!e||Mr(e._i)){var t=mf[If]=new Ff;if(e){var r=[];ws(e._i,(function(i){if(i&&Mr(i)){var n=t.init(i[0],i[1],i[2]),s=e[i[2]]||e;n.__loaded&&-1===r.indexOf(s)&&(r.push(s),n._execute_array.call(n.people,s.people),n._execute_array(s))}}))}t.__SV=1,ba.posthog=t,function(){function e(){e.done||(e.done=!0,Ef=!1,ws(mf,(function(e){e._dom_loaded()})))}null!=ls&&ls.addEventListener?"complete"===ls.readyState?e():Rs(ls,"DOMContentLoaded",e,{capture:!1}):ss&&ys.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}();
1
+ !function(){"use strict";function e(e,t,r,i,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,n)}function t(t){return function(){var r=this,i=arguments;return new Promise((function(n,s){var o=t.apply(r,i);function a(t){e(o,n,s,a,l,"next",t)}function l(t){e(o,n,s,a,l,"throw",t)}a(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},r.apply(null,arguments)}function i(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}var n,s=["type"],o=Object.defineProperty,a=(e,t,r)=>((e,t,r)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),l=(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))(l||{}),u=(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))(u||{}),c=(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))(c||{}),d=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(d||{}),h=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(h||{}),p=(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))(p||{}),_=(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))(_||{});function g(e,t){return-1!==e.indexOf(t)}var v={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},f={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},m={};function y(e){if(m[e])return m[e];var t=function(e){var t,r,i=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in v?v[e]:void 0,n=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),s=e in f?f[e]:void 0,o=Boolean(s&&s.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(n&&o)return m[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var c=u[e].prototype;return c?(function(e){return g(e,"AppleWebKit")&&!g(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),m[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var b={};function S(e,t,r){var i,n=e+"."+String(r);if(b[n])return b[n].call(t);var s=y(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(b[n]=o,o.call(t)):t[r]}var w={};function k(e,t,r){var i=e+"."+String(r);if(w[i])return w[i].bind(t);var n=y(e)[r];return"function"!=typeof n?t[r]:(w[i]=n,n.bind(t))}function x(){return y("MutationObserver").constructor}function C(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n={next:i},s=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return n.next.apply(this,t)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else e[t]=n.next}}catch(e){return()=>{}}}var I={childNodes:e=>S("Node",e,"childNodes"),parentNode:e=>S("Node",e,"parentNode"),parentElement:e=>S("Node",e,"parentElement"),textContent:e=>S("Node",e,"textContent"),contains:(e,t)=>k("Node",e,"contains")(t),getRootNode:e=>k("Node",e,"getRootNode")(),host:e=>e&&"host"in e?S("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?S("Element",e,"shadowRoot"):null,querySelector:(e,t)=>k("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>k("Element",e,"querySelectorAll")(t),mutationObserver:x,patch:C};function E(e){return e.nodeType===e.ELEMENT_NODE}function T(e){var t=e&&"host"in e&&"mode"in e&&I.host(e)||null;return Boolean(t&&"shadowRoot"in t&&I.shadowRoot(t)===e)}function M(e){return"[object ShadowRoot]"==={}.toString.call(e)}function R(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(i=Array.from(t,(e=>P(e,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(e){return null}var i}function P(e,t){var r;if(function(e){return"styleSheet"in e}(e)){var i;try{i=R(e.styleSheet)||function(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return U(i,e.styleSheet.href)}catch(e){}return i}var n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?U(n,t):n}class F{constructor(){a(this,"idNodeMap",new Map),a(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-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);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e))),E(e)){var r=I.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function L(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,n=e.type,s=e.maskInputFn,o=e.value||"",a=n&&A(n);return(r[i.toLowerCase()]||a&&r[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function A(e){return e.toLowerCase()}var O="__rrweb_original__";function D(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}catch(e){return null}}var N=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,B=/^(?:[a-z+]+:)?\/\//i,q=/^www\..*/i,H=/^(data:)([^,]*),(.*)/i;function U(e,t){return(e||"").replace(N,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(B.test(l)||q.test(l))return"url("+u+l+u+")";if(H.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var c=t.split("/"),d=l.split("/");for(var h of(c.pop(),d))"."!==h&&(".."===h?c.pop():c.push(h));return"url("+u+c.join("/")+u+")"}))}var z,W,V="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",j=4096,G=1,Q=new RegExp("[^a-z0-9-_:]"),Z=-2;function Y(){return G++}var K=/^[^ \t\n\r\u000c]+/,J=/^[, \t\n\r\u000c]+/,X=new WeakMap;function ee(e,t){return t&&""!==t.trim()?te(e,t):t}function te(e,t){var r=X.get(e);if(r||(r=e.createElement("a"),X.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function re(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?V:e}(e,t.maxBase64ImageLength):e}function ie(e,t,r,i,n,s){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&n){var a=null==(o=n.sheet)?void 0:o.href;if(a)return a}var l=ee(e,i);if(l.startsWith("data:")){if("img"===t&&n){var u=l;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(u=function(e,t,r,i){if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>j||e.naturalHeight>j)return t;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(e,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):t}catch(e){return t}}(n,l,s.type,s.quality)),re(u,s)}if("image"===t)return re(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=ee(e,i);return"image"===t&&c.startsWith("data:")?re(c,s):c}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,n=e.exec(t.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(J),t.length>r;){var s=i(K);if(","===s.slice(-1))s=ee(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=ee(e,s);for(var a=!1;;){var l=t.charAt(r);if(""===l){n.push((s+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,n.push((s+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return n.join(", ")}(e,i):"style"===r?U(i,te(e)):"object"===t&&"data"===r?ee(e,i):i:ee(e,i)}function ne(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function se(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&se(I.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&se(I.parentNode(e),t,r)}function oe(e,t,r,i){var n;if(E(e)){if(!I.childNodes(n=e).length)return!1}else{if(null===I.parentElement(e))return!1;n=I.parentElement(e)}try{if("string"==typeof t){if(i){if(n.closest("."+t))return!0}else if(n.classList.contains(t))return!0}else if(se(n,t,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(e){}return!1}function ae(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var le=new Map;function ue(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function ce(e){return null==e?"":e.toLowerCase()}var de=50,he=!1,pe=!1;function _e(e,t){var r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,c=t.inlineStylesheet,d=void 0===c||c,h=t.maskInputOptions,p=void 0===h?{}:h,g=t.maskTextFn,v=t.maskInputFn,f=t.slimDOMOptions,m=t.dataURLOptions,y=void 0===m?{}:m,b=t.inlineImages,S=void 0!==b&&b,w=t.recordCanvas,k=void 0!==w&&w,x=t.canvasMaskingConfigured,C=t.onSerialize,P=t.onIframeLoad,F=t.iframeLoadTimeout,N=void 0===F?5e3:F,B=t.onIframeListenerRegistered,q=t.onStylesheetLoad,H=t.stylesheetLoadTimeout,V=void 0===H?5e3:H,j=t.keepIframeSrcFn,G=void 0===j?()=>!1:j,K=t.newlyAddedElement,J=void 0!==K&&K,X=t.depth,ee=void 0===X?0:X,re=t.maxDepth,se=void 0===re?de:re,ge=t.needsMask,ve=t.preserveWhiteSpace,fe=void 0===ve||ve;if(ee>=se)return pe=!0,he||(he=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+se+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;ge||(ge=oe(e,o,a,void 0===ge));var me,ye=function(e,t){var r=t.doc,i=t.blockClass,n=t.blockSelector,s=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,c=t.maskInputFn,d=t.dataURLOptions,h=void 0===d?{}:d,p=t.inlineImages,g=t.recordCanvas,v=t.canvasMaskingConfigured,f=t.keepIframeSrcFn,m=t.newlyAddedElement,y=void 0!==m&&m,b=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:_.Document,childNodes:[],compatMode:e.compatMode}:{type:_.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:_.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s,o=t.doc,a=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,c=t.maskInputFn,d=t.dataURLOptions,h=void 0===d?{}:d,p=t.inlineImages,g=t.recordCanvas,v=t.canvasMaskingConfigured,f=t.keepIframeSrcFn,m=t.newlyAddedElement,y=void 0!==m&&m,b=t.rootId,S=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),w=function(e){if(e instanceof HTMLFormElement)return"form";var t=A(e.tagName);return Q.test(t)?"div":t}(e),k={},x=e.attributes.length,C=0;x>C;C++){var E=e.attributes[C];ne(w,E.name)||(k[E.name]=ie(o,w,A(E.name),E.value,e,h))}if("link"===w&&a){var T=e.sheet;if(!T){var M=function(e){return e.href}(e);M&&!(T=ue(o,M))&&M.includes(".css")&&(T=ue(o,window.location.origin+"/"+M.replace(window.location.href,"")))}var P=null;T&&(P=R(T)),P&&(delete k.rel,delete k.href,k._cssText=P)}if("style"===w&&e.sheet&&!(e.innerText||I.textContent(e)||"").trim().length){var F=R(e.sheet);F&&(k._cssText=F)}if("input"===w||"textarea"===w||"select"===w){var N=e.value,B=e.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&N?k.value=L({element:e,type:D(e),tagName:w,value:N,maskInputOptions:u,maskInputFn:c}):B&&(k.checked=B)}if("option"===w&&(e.selected&&!u.select?k.selected=!0:delete k.selected),"dialog"===w&&e.open)try{k.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===w&&g&&!(null==v?void 0:v()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var n=t.getImageData;if(new Uint32Array((O in n?n[O]:n).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(k.rr_dataURL=e.toDataURL(h.type,h.quality));else if(!("__context"in e)){var q=e.toDataURL(h.type,h.quality),H=o.createElement("canvas");H.width=e.width,H.height=e.height,q!==H.toDataURL(h.type,h.quality)&&(k.rr_dataURL=q)}if("img"===w&&p){z||(z=o.createElement("canvas"),W=z.getContext("2d"));var U=e,V=U.currentSrc||U.getAttribute("src")||"<unknown-src>",j=U.crossOrigin,G=()=>{ae(U,"load",G);try{z.width=U.naturalWidth,z.height=U.naturalHeight,W.drawImage(U,0,0),k.rr_dataURL=z.toDataURL(h.type,h.quality)}catch(e){if("anonymous"!==U.crossOrigin)return U.crossOrigin="anonymous",void(U.complete&&0!==U.naturalWidth?G():U.addEventListener("load",G));console.warn("Cannot inline img src="+V+"! Error: "+e)}"anonymous"===U.crossOrigin&&(j?k.crossOrigin=j:U.removeAttribute("crossorigin"))};U.complete&&0!==U.naturalWidth?G():U.addEventListener("load",G)}if("audio"===w||"video"===w){var Z=k;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}if(y||(e.scrollLeft&&(k.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(k.rr_scrollTop=e.scrollTop)),S){var Y=e.getBoundingClientRect(),K=Y.width,J=Y.height,X=Y.left,ee=Y.top,te=null==(r=o.defaultView)?void 0:r.getComputedStyle(e);k={class:k.class,rr_width:K+"px",rr_height:J+"px",rr_left:Math.floor(X+((null==(i=o.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(ee+((null==(n=o.defaultView)?void 0:n.scrollY)||0))+"px"},te&&(k.rr_position=te.position||"static",te.transform&&"none"!==te.transform&&(k.rr_transform=te.transform),te.display&&te.display.startsWith("inline")&&(k.rr_display=te.display))}"iframe"!==w||f(k.src)||(e.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(w)&&(s=!0)}catch(e){}return{type:_.Element,tagName:w,attributes:k,childNodes:[],isSVG:(re=e,Boolean("svg"===re.tagName||re.ownerSVGElement)||void 0),needBlock:S,rootId:b,isCustom:s};var re}(e,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:g,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:y,rootId:b});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,n=t.maskTextFn,s=t.rootId,o=I.parentNode(e),a=o&&o.tagName,l=I.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if(null==(r=o.sheet)?void 0:r.cssRules){var d=R(o.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(l=d)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}l=U(l,te(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,I.parentElement(e)):l.replace(/[\S]/g,"*")),{type:_.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:b});case e.CDATA_SECTION_NODE:return{type:_.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:_.Comment,textContent:I.textContent(e)||"",rootId:b};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,keepIframeSrcFn:G,newlyAddedElement:J});if(!ye)return console.warn(e,"not serialized"),null;me=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===_.Comment)return!0;if(e.type===_.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e,t){var r,i;try{i=new URL(e,window.location.href)}catch(e){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(ce(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ce(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ce(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&ce(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ce(e.attributes.property).match(/^(og|twitter|fb):/)||ce(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===ce(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(ce(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ce(e.attributes.name))||ce(e.attributes.property).match(/^article:/)||ce(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ce(e.attributes.name)))return!0}}return!1}(ye,f)||!fe&&ye.type===_.Text&&!ye.isStyle&&!ye.textContent.replace(/^\s+|\s+$/gm,"").length?Z:Y();var be=Object.assign(ye,{id:me});if(i.add(e,be),me===Z)return null;C&&C(e);var Se=!u;if(be.type===_.Element){Se=Se&&!be.needBlock,delete be.needBlock;var we=I.shadowRoot(e);we&&M(we)&&(be.isShadowHost=!0)}if((be.type===_.Document||be.type===_.Element)&&Se){f.headWhitespace&&be.type===_.Element&&"head"===be.tagName&&(fe=!1);var ke={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onIframeListenerRegistered:B,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee+1,maxDepth:se};if(be.type===_.Element&&"textarea"===be.tagName&&void 0!==be.attributes.value);else for(var xe of Array.from(I.childNodes(e))){var Ce=_e(xe,ke);Ce&&be.childNodes.push(Ce)}var Ie=null;if(E(e)&&(Ie=I.shadowRoot(e)))for(var Ee of Array.from(I.childNodes(Ie))){var Te=_e(Ee,ke);Te&&(M(Ie)&&(Te.isShadow=!0),be.childNodes.push(Te))}}var Me=I.parentNode(e);if(Me&&T(Me)&&M(Me)&&(be.isShadow=!0),be.type===_.Element&&"iframe"===be.tagName){var Re=function(e,t,r){var i,n=()=>{},s=e.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(e){return n}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),ae(e,"load",c),e.addEventListener("load",o),t())},c=()=>u();return l=setTimeout(u,r),e.addEventListener("load",c),()=>{null!==l&&(clearTimeout(l),l=null),a?ae(e,"load",o):(a=!0,ae(e,"load",c))}}var d,h="about:blank";try{d=s.location.href}catch(e){return n}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),ae(e,"load",o)}}return e.addEventListener("load",o),()=>{ae(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&P){var r=_e(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onIframeListenerRegistered:B,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee+1,maxDepth:se});r&&P(e,r)}}),N);null==B||B(e,Re)}return be.type===_.Element&&"link"===be.tagName&&"stylesheet"===be.attributes.rel&&function(t,l,u){if(!le.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,_=!1,m=()=>{if(!_){_=!0;try{(()=>{if(q){var t=_e(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ge,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:v,slimDOMOptions:f,dataURLOptions:y,inlineImages:S,recordCanvas:k,canvasMaskingConfigured:x,preserveWhiteSpace:fe,onSerialize:C,onIframeLoad:P,iframeLoadTimeout:N,onStylesheetLoad:q,stylesheetLoadTimeout:V,keepIframeSrcFn:G,depth:ee,maxDepth:se});t&&q(e,t)}})()}finally{le.delete(t),h.abort()}}},b=setTimeout(m,u);h.signal.addEventListener("abort",(()=>clearTimeout(b)),{once:!0}),t.addEventListener("load",m,{signal:h.signal,once:!0}),le.set(t,h)}}}(e,0,V),be}function ge(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class ve{constructor(){a(this,"parentElement",null),a(this,"parentNode",null),a(this,"ownerDocument"),a(this,"firstChild",null),a(this,"lastChild",null),a(this,"previousSibling",null),a(this,"nextSibling",null),a(this,"ELEMENT_NODE",1),a(this,"TEXT_NODE",3),a(this,"nodeType"),a(this,"nodeName"),a(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof ve))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"}}function fe(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>me(r,e,t,i)}function me(e,t,r,i){ye((()=>{var n=e.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(e,t,r,i):n.call(e,t,r))}))}function ye(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var be="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.",Se={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be)},has(){return console.error(be),!1},reset(){console.error(be)}};function we(e,t,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];var l=Date.now();n||!1!==r.leading||(n=l);var u=t-(l-n),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),n=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function ke(e,t,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(e){return}s.set.call(this,e)}}}),()=>ke(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Se=new Proxy(Se,{get(e,t,r){return"map"===t&&console.error(be),Reflect.get(e,t,r)}}));var xe=Date.now;function Ce(e){var t,r,i,n,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=I.parentElement(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=I.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function Ie(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ee(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Te(e){return e?e.nodeType===e.ELEMENT_NODE?e:I.parentElement(e):null}function Me(e,t,r,i){if(!e)return!1;var n=Te(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(i&&null!==n.closest("."+t))return!0}else if(se(n,t,i))return!0}catch(e){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Re(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Z}function Pe(e,t){if(T(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=I.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Pe(i,t))}function Fe(e){return Boolean(e.changedTouches)}function Le(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ae(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Oe(e){return!!e&&(e instanceof ve&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(I.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(xe=()=>(new Date).getTime());class De{constructor(){a(this,"id",1),a(this,"styleIDMap",new WeakMap),a(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):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}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 Ne(e){var t,r=null;return"getRootNode"in e&&(null==(t=I.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(e))&&(r=I.host(I.getRootNode(e))),r}function Be(e){var t=e.ownerDocument;return!!t&&(I.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Ne(r);)r=t;return r}(e);return I.contains(t,r)}(e))}function qe(e){return"__ln"in e}class He{constructor(){a(this,"length",0),a(this,"head",null),a(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)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&&qe(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&qe(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.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 $e,Ue=(e,t)=>e+"@"+t;class ze{constructor(){a(this,"frozen",!1),a(this,"locked",!1),a(this,"texts",[]),a(this,"attributes",[]),a(this,"attributeMap",new WeakMap),a(this,"removes",[]),a(this,"mapRemoves",[]),a(this,"movedMap",{}),a(this,"addedSet",new Set),a(this,"movedSet",new Set),a(this,"droppedSet",new Set),a(this,"removesSubTreeCache",new Set),a(this,"mutationCb"),a(this,"blockClass"),a(this,"blockSelector"),a(this,"maskTextClass"),a(this,"maskTextSelector"),a(this,"inlineStylesheet"),a(this,"maskInputOptions"),a(this,"maskTextFn"),a(this,"maskInputFn"),a(this,"keepIframeSrcFn"),a(this,"recordCanvas"),a(this,"canvasMaskingConfigured"),a(this,"inlineImages"),a(this,"slimDOMOptions"),a(this,"dataURLOptions"),a(this,"doc"),a(this,"mirror"),a(this,"iframeManager"),a(this,"stylesheetManager"),a(this,"shadowDomManager"),a(this,"canvasManager"),a(this,"processedNodeManager"),a(this,"unattachedDoc"),a(this,"canvasManagerReleased",!1),a(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),a(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var e=[],t=new Set,r=new He,i=e=>{for(var t=e,r=Z;r===Z;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=I.parentNode(n);if(s&&Be(n)&&"TEXTAREA"!==s.tagName){var o=T(s)?this.mirror.getId(Ne(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=_e(n,{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,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{Le(e,this.mirror)&&this.iframeManager.addIframe(e),Ae(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Oe(n)&&this.shadowDomManager.addShadowRoot(I.shadowRoot(n),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)Ve(this.removesSubTreeCache,s)&&!this.movedSet.has(I.parentNode(s))||n(s);for(var o of this.addedSet)je(this.droppedSet,o)||Ve(this.removesSubTreeCache,o)?je(this.movedSet,o)?n(o):this.droppedSet.add(o):n(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(I.parentNode(a.value)),c=i(a.value);-1!==u&&-1!==c&&(l=a)}if(!l)for(var d=r.tail;d;){var h=d;if(d=d.previous,h){var p=this.mirror.getId(I.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var _=I.parentNode(h.value);if(_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=I.host(_);if(-1!==this.mirror.getId(g)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),n(l.value)}var v={texts:this.texts.map((e=>{var t=e.node,r=I.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{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 t=e.attributes;if("string"==typeof t.style){var r=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+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};(v.texts.length||v.attributes.length||v.removes.length||v.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.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(v))}})),a(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),a(this,"genTextAreaValueMutation",(e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(I.childNodes(e),(e=>I.textContent(e)||"")).join("");t.attributes.value=L({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:D(e),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(e=>{if(!Re(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=I.textContent(e.target);Me(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:oe(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Te(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r=e.target,i=e.attributeName,n=e.target.getAttribute(i);if("value"===i){var s=D(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Me(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;var o=this.attributeMap.get(e.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(o||(this.attributes.push(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,o)),"type"===i&&"INPUT"===r.tagName&&"password"===(e.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!ne(r.tagName,i))if(o.attributes[i]=ie(this.doc,A(r.tagName),A(i),n,r,this.dataURLOptions),"style"===i){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.style.cssText=e.oldValue),Array.from(r.style))){var u=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);u!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?o.styleDiff[l]=""===c?u:[u,c]:o._unchangedStyles[l]=[u,c]}for(var d of Array.from(a.style))""===r.style.getPropertyValue(d)&&(o.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(o.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Me(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 r=this.mirror.getId(t),i=T(e.target)?this.mirror.getId(I.host(e.target)):this.mirror.getId(e.target);Me(e.target,this.blockClass,this.blockSelector,!1)||Re(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(We(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Pe(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ue(r,i)]?We(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!T(e.target)||!M(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),I.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),a(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Re(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[Ue(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Me(e,this.blockClass,this.blockSelector,!1)||(I.childNodes(e).forEach((e=>this.genAdds(e))),Oe(e)&&I.childNodes(I.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","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function We(e,t){e.delete(t),I.childNodes(t).forEach((t=>We(e,t)))}function Ve(e,t,r){return 0!==e.size&&function(e,t,r){var i=I.parentNode(t);return!!i&&e.has(i)}(e,t)}function je(e,t){return 0!==e.size&&Ge(e,t)}function Ge(e,t){var r=I.parentNode(t);return!!r&&(!!e.has(r)||Ge(e,r))}var Qe=e=>$e?function(){try{return e(...arguments)}catch(e){if($e&&!0===$e(e))return;throw e}}:e,Ze=[];function Ye(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 Ke(e,t){var r=new ze;Ze.push(r),r.init(e);var i=new(x())(Qe(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),i.observe(t,n),{observer:i,buffer:r}}function Je(e){var t=e.scrollCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Ye(e);if(o&&!Me(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=Ce(r.defaultView);l=d.left,u=d.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(c)!==h&&(a.set(c,h),t({id:c,x:l,y:u}))}},u=[fe("scroll",Qe(we(Qe((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(fe("scrollend",Qe(l),r)),()=>u.forEach((e=>e()))}function Xe(e,t){for(var r=Ze.length-1;r>=0;r--){var i=Ze[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Ze.splice(r,1))}}}var et=["INPUT","TEXTAREA","SELECT"],tt=new WeakMap;function rt(e){return function e(t,r){if(ot("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var n=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(n)}return r}(e,[])}function it(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}function nt(e,t){var r,i,n,s,o=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:I.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(n=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var t,r;try{r=null==(t=l.set)?void 0:t.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(e){}return r}}),Qe((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function st(e,t){void 0===t&&(t={});var i,n,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var r=e.mutationCb,i=e.mousemoveCb,n=e.mouseInteractionCb,s=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,c=e.styleDeclarationCb,d=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,_=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),n(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...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),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),c(...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),_(...arguments)}}(e,t),e.recordDOM){var o=Ke(e,e.doc);i=o.observer,n=o.buffer}var a,l,h,_,g,v,f,m,y,b=function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,n=e.mirror;if(!1===r.mousemove)return()=>{};var s,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],c=we(Qe((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),d=Qe(we(Qe((e=>{var t=Ye(e),r=Fe(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;s||(s=xe()),l.push({x:i,y:o,id:n.getId(t),timeOffset:xe()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)})),o,{trailing:!1})),h=[fe("mousemove",d,i),fe("touchmove",d,i),fe("drag",d,i)];return Qe((()=>{h.forEach((e=>e()))}))}(e),S=function(e){var t=e.mouseInteractionCb,i=e.doc,n=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.sampling;if(!1===a.mouseInteraction)return()=>{};var l=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[],h=null;return Object.keys(c).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e])).forEach((e=>{var a=A(e),l=(e=>i=>{var a=Ye(i);if(!Me(a,s,o,!0)){var l=null,u=e;if("pointerType"in i){switch(i.pointerType){case"mouse":l=d.Mouse;break;case"touch":l=d.Touch;break;case"pen":l=d.Pen}l===d.Touch&&(c[e]===c.MouseDown?u="TouchStart":c[e]===c.MouseUp&&(u="TouchEnd"))}else Fe(i)&&(l=d.Touch);null!==l?(h=l,(u.startsWith("Touch")&&l===d.Touch||u.startsWith("Mouse")&&l===d.Mouse)&&(l=null)):c[e]===c.Click&&(l=h,h=null);var p=Fe(i)?i.changedTouches[0]:i;if(p){var _=n.getId(a),g=p.clientX,v=p.clientY;Qe(t)(r({type:c[u],id:_,x:g,y:v},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(c[e]){case c.MouseDown:case c.MouseUp:a=a.replace("mouse","pointer");break;case c.TouchStart:case c.TouchEnd:return}u.push(fe(a,l,i))})),Qe((()=>{u.forEach((e=>e()))}))}(e),w=Je(e),k=function(e,t){var r=e.viewportResizeCb,i=t.win,n=-1,s=-1;return fe("resize",Qe(we(Qe((()=>{var e=Ie(),t=Ee();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:s}),x=function(e){var t=e.inputCb,i=e.doc,n=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.ignoreClass,l=e.ignoreSelector,u=e.maskInputOptions,c=e.maskInputFn,d=e.userTriggeredOnInput;function h(e){var t=Ye(e),r=e.isTrusted,n=i.defaultView;if(!t||!n||t instanceof n.HTMLElement){var h=t&&t.tagName;if(t&&"OPTION"===h&&(t=I.parentElement(t)),t&&h&&et.indexOf(h)>=0&&!Me(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var _=t.value,g=!1,v=D(t)||"";"radio"===v||"checkbox"===v?g=t.checked:(u[h.toLowerCase()]||u[v])&&(_=L({element:t,maskInputOptions:u,tagName:h,type:v,value:_,maskInputFn:c})),p(t,d?{text:_,isChecked:g,userTriggered:r}:{text:_,isChecked:g});var f=t.name;"radio"===v&&f&&g&&i.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;p(e,d?{text:r,isChecked:!g,userTriggered:!1}:{text:r,isChecked:!g})}}))}}}function p(e,i){var s=tt.get(e);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){tt.set(e,i);var o=n.getId(e);Qe(t)(r({},i,{id:o}))}}var _=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>fe(e,Qe(h),i))),g=i.defaultView;if(!g)return()=>{_.forEach((e=>e()))};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&_.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map((e=>ke(e[0],e[1],{set(){Qe(h)({target:this,isTrusted:!1})}},!1,g)))),Qe((()=>{_.forEach((e=>e()))}))}(e),E=(l=(a=e).mediaInteractionCb,h=a.blockClass,_=a.blockSelector,g=a.mirror,v=a.sampling,f=a.doc,m=Qe((e=>we(Qe((t=>{var r=Ye(t);if(r&&!Me(r,h,_,!0)){var i=r.currentTime,n=r.volume,s=r.muted,o=r.playbackRate,a=r.loop;l({type:e,id:g.getId(r),currentTime:i,volume:n,muted:s,playbackRate:o,loop:a})}})),v.media||500))),y=[fe("play",m(p.Play),f),fe("pause",m(p.Pause),f),fe("seeked",m(p.Seeked),f),fe("volumechange",m(p.VolumeChange),f),fe("ratechange",m(p.RateChange),f)],Qe((()=>{y.forEach((e=>e()))}))),T=()=>{},M=()=>{},R=()=>{},P=()=>{};e.recordDOM&&(T=function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,n=e.stylesheetManager,s=t.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var o=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Qe(((e,t,s)=>{var o=s[0],a=s[1],l=it(t,i,n.styleMirror),u=l.id,c=l.styleId;return(u&&-1!==u||c&&-1!==c)&&r({id:u,styleId:c,adds:[{rule:o,index:a}]}),e.apply(t,s)}))}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var a,l,u=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,removes:[{index:o}]}),e.apply(t,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,replace:o}),e.apply(t,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,replaceSync:o}),e.apply(t,s)}))}));var c={};at("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(at("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),at("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),at("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(c).forEach((e=>{var t=e[0],s=e[1];d[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[t].insertRule,{apply:Qe(((e,t,s)=>{var o=s[0],a=s[1],l=it(t.parentStyleSheet,i,n.styleMirror),u=l.id,c=l.styleId;return(u&&-1!==u||c&&-1!==c)&&r({id:u,styleId:c,adds:[{rule:o,index:[...rt(t),a||0]}]}),e.apply(t,s)}))}),s.prototype.deleteRule=new Proxy(d[t].deleteRule,{apply:Qe(((e,t,s)=>{var o=s[0],a=it(t.parentStyleSheet,i,n.styleMirror),l=a.id,u=a.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,removes:[{index:[...rt(t),o]}]}),e.apply(t,s)}))})})),Qe((()=>{s.CSSStyleSheet.prototype.insertRule=o,s.CSSStyleSheet.prototype.deleteRule=u,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach((e=>{var t=e[0],r=e[1];r.prototype.insertRule=d[t].insertRule,r.prototype.deleteRule=d[t].deleteRule}))}))}(e,{win:s}),M=nt(e,e.doc),R=function(e,t){var r=e.styleDeclarationCb,i=e.mirror,n=e.ignoreCSSAttributes,s=e.stylesheetManager,o=t.win,a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Qe(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2];if(n.has(u))return a.apply(t,[u,c,d]);var h=it(null==(l=t.parentRule)?void 0:l.parentStyleSheet,i,s.styleMirror),p=h.id,_=h.styleId;return(p&&-1!==p||_&&-1!==_)&&r({id:p,styleId:_,set:{property:u,value:c,priority:d},index:rt(t.parentRule)}),e.apply(t,o)}))});var l=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Qe(((e,t,o)=>{var a,u=o[0];if(n.has(u))return l.apply(t,[u]);var c=it(null==(a=t.parentRule)?void 0:a.parentStyleSheet,i,s.styleMirror),d=c.id,h=c.styleId;return(d&&-1!==d||h&&-1!==h)&&r({id:d,styleId:h,remove:{property:u},index:rt(t.parentRule)}),e.apply(t,o)}))}),Qe((()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:s}),e.collectFonts&&(P=function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=C(r.fonts,"add",(function(e){return function(r){return setTimeout(Qe((()=>{var e=s.get(r);e&&(t(e),s.delete(r))})),0),e.apply(this,[r])}}));return n.push((()=>{i.FontFace=o})),n.push(a),Qe((()=>{n.forEach((e=>e()))}))}(e)));var F=function(e){var t=e.doc,r=e.mirror,i=e.blockClass,n=e.blockSelector,s=e.selectionCb,o=!0,a=Qe((()=>{var e=t.getSelection();if(!(!e||o&&(null==e?void 0:e.isCollapsed))){o=e.isCollapsed||!1;for(var a=[],l=e.rangeCount||0,u=0;l>u;u++){var c=e.getRangeAt(u),d=c.startContainer,h=c.startOffset,p=c.endContainer,_=c.endOffset;Me(d,i,n,!0)||Me(p,i,n,!0)||a.push({start:r.getId(d),startOffset:h,end:r.getId(p),endOffset:_})}s({ranges:a})}}));return a(),fe("selectionchange",a)}(e),O=function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?C(r.customElements,"define",(function(e){return function(r,i,n){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,n])}})):()=>{}}(e),N=[];for(var B of e.plugins)N.push(B.observer(B.callback,s,B.options));return Qe((()=>{if(n){n.destroy(),n.reset();var t=Ze.indexOf(n);-1!==t&&Ze.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==i||i.disconnect(),b(),S(),w(),k(),x(),E(),T(),M(),R(),P(),F(),O(),N.forEach((e=>e()))}))}function ot(e){return void 0!==window[e]}function at(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class lt{constructor(e){a(this,"iframeIdToRemoteIdMap",new WeakMap),a(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){var n=r||this.getIdToRemoteIdMap(e),s=i||this.getRemoteIdToIdMap(e),o=n.get(t);return o||(o=this.generateIdFn(),n.set(t,o),s.set(o,t)),o}getIds(e,t){var r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,r,i)))}getRemoteId(e,t,r){var i=r||this.getRemoteIdToIdMap(e);return"number"!=typeof t?t:i.get(t)||-1}getRemoteIds(e,t){var r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,r)))}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||this.iframeIdToRemoteIdMap.set(e,t=new Map),t}getRemoteIdToIdMap(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||this.iframeRemoteIdToIdMap.set(e,t=new Map),t}}class ut{constructor(e){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new lt(Y)),a(this,"crossOriginIframeStyleMirror"),a(this,"crossOriginIframeRootIdMap",new WeakMap),a(this,"mirror"),a(this,"mutationCb"),a(this,"wrappedEmit"),a(this,"loadListener"),a(this,"pageHideListener"),a(this,"stylesheetManager"),a(this,"recordCrossOriginIframes"),a(this,"messageHandler"),a(this,"nestedIframeListeners",new Map),a(this,"attachedWindows",new WeakMap),a(this,"attachedDocuments",new WeakMap),a(this,"attachedIframes",new Map),a(this,"loadListenerDisposers",new WeakMap),a(this,"iframeElementsById",new Map),a(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new lt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null==(i=this.attachedIframes.get(e))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach((e=>ye(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{me(e.win,"pagehide",e.handler)})),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var n=this.attachedDocuments.get(e);n||this.attachedDocuments.set(e,n=new Set),n.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var o=this.handleMessage.bind(this);ye((()=>{s.addEventListener("message",o),this.nestedIframeListeners.set(s,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(s)}))}ye((()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var n=()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)};t.addEventListener("pagehide",n),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:n})}})),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 r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case l.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:l.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case l.Meta:case l.Load:case l.DomContentLoaded:return!1;case l.Plugin:return t;case l.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case l.IncrementalSnapshot:switch(t.data.source){case u.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)})),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 u.Drag:case u.TouchMove:case u.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(t.data,e,["id"]),t;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case u.Font:return t;case u.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case u.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,r,i){for(var n of i)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(r,t[n]):e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}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===_.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(me(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(me(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((e=>{ye((()=>this.mirror.removeNodeFromMap(e)))})),ye((()=>Xe(r,s))),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach(((t,r)=>{this.mirror.has(r)||e.push(r)})),e.forEach((e=>this.removeIframeById(e)))}}reattachIframes(){this.attachedIframes.forEach(((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)}))}destroy(){this.recordCrossOriginIframes&&me(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{me(t,"message",e)})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>e.add(t.element))),e.forEach((e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class ct{constructor(e){a(this,"shadowDoms",new WeakSet),a(this,"mutationCb"),a(this,"scrollCb"),a(this,"bypassOptions"),a(this,"mirror"),a(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){var i,n;if(M(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(i=null==(n=I.host(e))?void 0:n.ownerDocument)&&void 0!==i?i:t,o=Ke(r({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),a=o.observer,l=o.buffer;this.restoreHandlers.push({doc:s,handler(){a.disconnect(),l.destroy(),l.releaseCanvasManager();var e=Ze.indexOf(l);-1!==e&&Ze.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Je(r({},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(I.host(e))),this.restoreHandlers.push({doc:s,handler: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){var r=this;this.restoreHandlers.push({doc:t,handler:C(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=I.shadowRoot(this);return s&&Be(this)&&r.addShadowRoot(s,t),n}}))})}reset(){this.restoreHandlers.forEach((e=>{var t=e.handler;try{t()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}}var dt="skip-frame";function ht(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),gt=0;64>gt;gt++)_t[pt.charCodeAt(gt)]=gt;var vt=new Map,ft=(e,t,r)=>{if(e&&(bt(e,t)||"object"==typeof e)){var i=function(e,t){var r=vt.get(e);return r||vt.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),n=i.indexOf(e);return-1===n&&(n=i.length,i.push(e)),n}};function mt(e,t,r,i){if(e instanceof Array)return e.map((e=>mt(e,t,r,i)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){var n=e.constructor.name,s=function(e){var t,r=new Uint8Array(e),i=r.length,n="";for(t=0;i>t;t+=3)n+=pt[r[t]>>2],n+=pt[(3&r[t])<<4|r[t+1]>>4],n+=pt[(15&r[t+1])<<2|r[t+2]>>6],n+=pt[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e);return{rr_type:n,base64:s}}return e instanceof DataView?{rr_type:e.constructor.name,args:[mt(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[mt(e.data,t,r,i),e.width,e.height]}:bt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ft(e,t,r)}:e}var yt=(e,t,r,i)=>e.map((e=>mt(e,t,r,i))),bt=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(r.find((r=>e instanceof t[r])))},St=["webgl","webgl2"];function wt(e){return"nodeType"in e}function kt(e,t,i,n){var s=[];try{if(n){var o=function(e,t,i){var n=e.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return C(n.prototype,"configure",(function(n){return function(s){var o=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!o||wt(o)&&Me(o,t,i,!0))return n.call(this,s);wt(o)&&!("__context"in o)&&(o.__context="webgpu");var a=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return n.call(this,null!==a&&s?r({},s,{usage:"number"==typeof s.usage?s.usage|a:a}):s)}}))}(e,t,i);o&&s.push(o)}var a=C(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r){for(var s=function(e){return"experimental-webgl"===e?"webgl":e}(r),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!Me(this,t,i,!0)&&("__context"in this||(this.__context=s),n&&St.includes(s)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[r,...a])}}));s.push(a)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function xt(e,t,r,i,n,s,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=C(e,l,(function(e){return function(){for(var a=arguments.length,u=new Array(a),c=0;a>c;c++)u[c]=arguments[c];var d=e.apply(this,u);if(ft(d,s,this),"tagName"in this.canvas&&!Me(this.canvas,i,n,!0)){var h=yt(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(i){var c=ke(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(c)}};for(var c of l)u(c);return a}var Ct,It,Et,Tt='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',Mt="undefined"!=typeof self&&self.Blob&&new Blob([Tt],{type:"text/javascript;charset=utf-8"});function Rt(e){var t;try{if(!(t=Mt&&(self.URL||self.webkitURL).createObjectURL(Mt)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Tt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Pt{constructor(e){a(this,"pendingCanvasMutations",new Map),a(this,"rafStamps",{latestId:0,invokeId:null}),a(this,"mirror"),a(this,"mutationCb"),a(this,"resetObservers"),a(this,"frozen",!1),a(this,"locked",!1),a(this,"rafIdTimestamp",null),a(this,"rafIdFlush",null),a(this,"refCount",0),a(this,"torndown",!1),a(this,"resetFrameDedup",null),a(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 t=e.sampling,r=void 0===t?"all":t,i=e.win,n=e.blockClass,s=e.blockSelector,o=e.recordCanvas,l=e.dataURLOptions,u=e.resolutionScale,c=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,l),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:l,resolutionScale:u,canvasMasking:c})}onFullSnapshot(){var e;null==(e=this.resetFrameDedup)||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,r,i,n,s){var o=this;if("OffscreenCanvas"in r){var a,l="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=kt(r,i,n,!0),c=new Map;try{a=new Rt}catch(e){return}var d=!1;a.onerror=()=>{var e;d=!0,cancelAnimationFrame(p),null==(e=a.terminate)||e.call(a),this.resetFrameDedup=null},this.resetFrameDedup=()=>{a.postMessage({resetFrameDedup:!0})},a.onmessage=e=>{var t=e.data.id;if(c.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var p,_=1e3/e,g=0,v=e=>{var u,h;d||(g&&_>e-g||(g=e,(u=[],h=e=>{try{e.querySelectorAll("canvas").forEach((e=>{Me(e,i,n,!0)||u.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&h(e.shadowRoot)}))}catch(e){}},h(r.document),u).forEach(function(){var e=t((function*(e){var t,r,i=o.mirror.getId(e);if(!c.get(i)&&0!==e.width&&0!==e.height){c.set(i,!0);try{if(["webgl","webgl2"].includes(e.__context)){var n=e.getContext(e.__context);if(null==(t=null==n?void 0:n.isContextLost)?void 0:t.call(n))return void c.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var u=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(u*l)),p=Math.max(1,Math.round(d*l)),_=function(e,t,r,i,n,s){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return dt}if(void 0!==o){if(!Array.isArray(o)||!o.every(ht))return dt;var a=r/n,l=i/s;return o.filter((e=>e.width>0&&e.height>0)).map((e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}}))}}}(s.canvasMasking,e,h,p,u,d);if(_===dt)return void c.set(i,!1);var g=yield createImageBitmap(e,1>l?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});a.postMessage({id:i,bitmap:g,width:h,height:p,displayWidth:u,displayHeight:d,dataURLOptions:s.dataURLOptions,maskRegions:_},[g])}catch(e){c.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),p=requestAnimationFrame(v))};p=requestAnimationFrame(v),this.resetObservers=()=>{var e;u(),cancelAnimationFrame(p),null==(e=a.terminate)||e.call(a),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=kt(e,t,r,!1),s=function(e,t,r,i,n){var s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=C(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return Me(this.canvas,r,i,!0)||setTimeout((()=>{var r=yt(l,t,this,n);e(this.canvas,{type:h["2D"],property:o,args:r})}),0),s.apply(this,l)}}));s.push(a)}catch(r){var l=ke(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:h["2D"],property:o,args:[t],setter:!0})}});s.push(l)}};for(var l of o)a(l);return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,n){var s=[];return void 0!==t.WebGLRenderingContext&&s.push(...xt(t.WebGLRenderingContext.prototype,h.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...xt(t.WebGL2RenderingContext.prototype,h.WebGL2,e,r,i,t,n)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{n(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var n=r.map((e=>i(e,s)));this.mutationCb({id:t,type:r[0].type,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class Ft{constructor(e){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new De),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 r=this;if(0!==e.length){var i={id:t,styleIds:[]},n=[],s=function(e){var t;r.styleMirror.has(e)?t=r.styleMirror.getId(e):(t=r.styleMirror.add(e),n.push({styleId:t,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:P(t,e.href),index:r})))})),i.styleIds.push(t)};for(var o of e)s(o);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,le.forEach((e=>e.abort())),le.clear()}trackStylesheetInLinkElement(e){}}class Lt{constructor(){a(this,"nodeMap",new WeakMap),a(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).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 At=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Ot=document.createElement("iframe");document.body.appendChild(Ot),Array.from=(null==(n=Ot.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Ot)}}catch(e){console.debug("Unable to override Array.from",e)}var Dt=new F,Nt=new Set([u.Mutation,u.MediaInteraction,u.StyleSheetRule,u.CanvasMutation,u.Font,u.Log,u.StyleDeclaration,u.AdoptedStyleSheet]);function Bt(e){void 0===e&&(e={});var t=e,i=t.emit,n=t.checkoutEveryNms,s=t.checkoutEveryNth,o=t.blockClass,a=void 0===o?"rr-block":o,c=t.blockSelector,d=void 0===c?null:c,h=t.ignoreClass,p=void 0===h?"rr-ignore":h,_=t.ignoreSelector,g=void 0===_?null:_,v=t.maskTextClass,f=void 0===v?"rr-mask":v,m=t.maskTextSelector,y=void 0===m?null:m,b=t.inlineStylesheet,S=void 0===b||b,w=t.maskAllInputs,k=t.maskInputOptions,x=t.slimDOMOptions,C=t.maskInputFn,E=t.maskTextFn,T=t.hooks,M=t.packFn,R=t.sampling,P=void 0===R?{}:R,L=t.dataURLOptions,A=void 0===L?{}:L,O=t.canvasResolutionScale,D=t.canvasMasking,N=t.mousemoveWait,B=t.recordDOM,q=void 0===B||B,H=t.recordCanvas,U=void 0!==H&&H,z=t.recordCrossOriginIframes,W=void 0!==z&&z,V=t.recordAfter,j=void 0===V?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":V,G=t.userTriggeredOnInput,Q=void 0!==G&&G,Z=t.collectFonts,Y=void 0!==Z&&Z,K=t.inlineImages,J=void 0!==K&&K,X=t.plugins,ee=t.keepIframeSrcFn,te=void 0===ee?()=>!1:ee,re=t.ignoreCSSAttributes,ie=void 0===re?new Set([]):re,ne=t.attributeFilter;$e=t.errorHandler;var se=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},A),oe=!W||window.parent===window,ae=!1;if(!oe)try{window.parent.document&&(ae=!1)}catch(e){ae=!0}if(oe&&!i)throw new Error("emit function is required");if(!oe&&!ae)return()=>{};void 0!==N&&void 0===P.mousemove&&(P.mousemove=N),Dt.reset();var le,ue=!0===w?{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!==k?k:{password:!0},ce=ge(void 0!==x&&x);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var de,he,pe=0,ve=new Map,me=e=>{for(var t of X||[])t.eventProcessor&&(e=t.eventProcessor(e));return M&&!ae&&(e=M(e)),e};Ct=(e,t)=>{var r,o=e;if(o.timestamp=xe(),!(null==(r=Ze[0])?void 0:r.isFrozen())||o.type===l.FullSnapshot||o.type===l.IncrementalSnapshot&&Nt.has(o.data.source)||Ze.forEach((e=>e.unfreeze())),oe)null==i||i(me(o),t);else if(ae){var a={type:"rrweb",event:me(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===l.FullSnapshot)le=o,pe=0;else if(o.type===l.IncrementalSnapshot){if(o.data.source===u.Mutation&&o.data.isAttachIframe)return;pe++,(s&&pe>=s||n&&o.timestamp-le.timestamp>n)&&It(!0)}};var be=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map((e=>e.node.id))):null,i=new Set;if(e.adds.length>0)for(var n of e.adds){var s=Dt.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}e.removes.forEach((e=>{var r=e.id;if(!t||!t.has(r)){var n=Te.getIframeElementById(r);n&&i.has(n)?Te.forgetIframeId(r):(null==de||de(r),Te.removeIframeById(r))}})),null==he||he(),Te.cleanupDetachedIframes()}Ct({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},Se=e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),we=e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),ke=new Ft({mutationCb:be,adoptedStyleSheetCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),Te=new ut({mirror:Dt,mutationCb:be,stylesheetManager:ke,recordCrossOriginIframes:W,wrappedEmit:Ct});for(var Me of X||[])Me.getMirror&&Me.getMirror({nodeMirror:Dt,crossOriginIframeMirror:Te.crossOriginIframeMirror,crossOriginIframeStyleMirror:Te.crossOriginIframeStyleMirror});var Re=new Lt,Pe=null==D?void 0:D.configured;Et=new Pt({recordCanvas:U,mutationCb:we,win:window,blockClass:a,blockSelector:d,mirror:Dt,sampling:P.canvas,dataURLOptions:se,resolutionScale:O,canvasMasking:D});var Fe=new ct({mutationCb:be,scrollCb:Se,bypassOptions:{blockClass:a,blockSelector:d,maskTextClass:f,maskTextSelector:y,inlineStylesheet:S,maskInputOptions:ue,dataURLOptions:se,maskTextFn:E,maskInputFn:C,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,sampling:P,slimDOMOptions:ce,iframeManager:Te,stylesheetManager:ke,canvasManager:Et,keepIframeSrcFn:te,processedNodeManager:Re,attributeFilter:ne},mirror:Dt});It=function(e){if(void 0===e&&(e=!1),q){Ct({type:l.Meta,data:{href:window.location.href,width:Ee(),height:Ie()}},e),ke.reset(),Fe.init(),Ze.forEach((e=>e.lock()));var t=function(e,t){var r=t||{},i=r.mirror,n=void 0===i?new F:i,s=r.blockClass,o=r.blockSelector,a=r.maskTextClass,l=r.maskTextSelector,u=r.inlineStylesheet,c=r.inlineImages,d=void 0!==c&&c,h=r.recordCanvas,p=void 0!==h&&h,_=r.canvasMaskingConfigured,g=r.maskAllInputs,v=void 0!==g&&g,f=r.slimDOM,m=r.dataURLOptions,y=r.preserveWhiteSpace,b=r.onSerialize,S=r.onIframeLoad,w=r.iframeLoadTimeout,k=r.onIframeListenerRegistered,x=r.onStylesheetLoad,C=r.stylesheetLoadTimeout,I=r.keepIframeSrcFn,E=void 0===I?()=>!1:I,T=r.maxDepth;return _e(e,{doc:e,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===o?null:o,maskTextClass:void 0===a?"rr-mask":a,maskTextSelector:void 0===l?null:l,skipChild:!1,inlineStylesheet:void 0===u||u,maskInputOptions:!0===v?{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===v?{password:!0}:v,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:ge(void 0!==f&&f),dataURLOptions:m,inlineImages:d,recordCanvas:p,canvasMaskingConfigured:_,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:E,newlyAddedElement:!1,maxDepth:T})}(document,{mirror:Dt,blockClass:a,blockSelector:d,maskTextClass:f,maskTextSelector:y,inlineStylesheet:S,maskAllInputs:ue,maskTextFn:E,maskInputFn:C,slimDOM:ce,dataURLOptions:se,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,onSerialize(e){Le(e,Dt)&&Te.addIframe(e),Ae(e,Dt)&&ke.trackLinkElement(e),Oe(e)&&Fe.addShadowRoot(I.shadowRoot(e),document)},onIframeLoad(e,t){Te.attachIframe(e,t),Fe.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ke.attachLinkElement(e,t)},keepIframeSrcFn:te});if(!t)return console.warn("Failed to snapshot the document");Ct({type:l.FullSnapshot,data:{node:t,initialOffset:Ce(window)}},e),Ze.forEach((e=>e.unlock())),Et.onFullSnapshot(),W&&Te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ke.adoptStyleSheets(document.adoptedStyleSheets,Dt.getId(document))}};try{var De=[];de=e=>{var t=ve.get(e);t&&(t.forEach((e=>{ye(e);var t=De.indexOf(e);-1!==t&&De.splice(t,1)})),ve.delete(e))},he=()=>{for(var e of ve){var t=e[0],r=Dt.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==de||de(t)}catch(e){null==de||de(t)}else null==de||de(t)}};var Ne=e=>{var t;return Qe(st)({mutationCb:be,mousemoveCb:(e,t)=>Ct({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:Se,viewportResizeCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:we,fontCb:e=>Ct({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){Ct({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){Ct({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:a,ignoreClass:p,ignoreSelector:g,maskTextClass:f,maskTextSelector:y,maskInputOptions:ue,inlineStylesheet:S,sampling:P,recordDOM:q,recordCanvas:U,canvasMaskingConfigured:Pe,inlineImages:J,userTriggeredOnInput:Q,collectFonts:Y,doc:e,maskInputFn:C,maskTextFn:E,keepIframeSrcFn:te,blockSelector:d,slimDOMOptions:ce,dataURLOptions:se,mirror:Dt,iframeManager:Te,stylesheetManager:ke,shadowDomManager:Fe,processedNodeManager:Re,canvasManager:Et,ignoreCSSAttributes:ie,attributeFilter:ne,plugins:(null==(t=null==X?void 0:X.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ct({type:l.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},T)};Te.addLoadListener((e=>{try{var t=Dt.getId(e),r=Ne(e.contentDocument);if(De.push(r),-1!==t){var i=ve.get(t);i||ve.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Te.addPageHideListener((e=>{var t=Dt.getId(e);null==de||de(t),Xe(e)}));var Be=-1,qe=e=>Ct({type:l.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),He=()=>{var e,t,r,i,n=document,s=null!==(e=null!==(t=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==t?t:n.msFullscreenElement)&&void 0!==e?e:null,o=s?Dt.getId(s):-1;o!==Be&&(-1!==Be&&qe({id:Be,enter:!1}),Be=o,-1!==o&&qe({id:o,enter:!0}))},Ue=()=>{It(),De.push(Ne(document)),De.push(fe("fullscreenchange",He)),De.push(fe("webkitfullscreenchange",He)),De.push(fe("mozfullscreenchange",He)),De.push(fe("MSFullscreenChange",He)),At=!0};return["interactive","complete"].includes(document.readyState)?Ue():(De.push(fe("DOMContentLoaded",(()=>{Ct({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===j&&Ue()}))),De.push(fe("load",(()=>{Ct({type:l.Load,data:{}}),"load"===j&&Ue()}),window))),()=>{De.forEach((e=>ye(e))),Re.destroy(),Te.removeLoadListener(),Te.destroy(),ve.clear(),Fe.reset(),Dt.reset(),At=!1,$e=void 0}}catch(e){console.warn(e)}}Bt.addCustomEvent=(e,t)=>{if(!At)throw new Error("please add custom event after start recording");Ct({type:l.Custom,data:{tag:e,payload:t}})},Bt.freezePage=()=>{Ze.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!At)throw new Error("please take full snapshot after start recording");It(e)},Bt.mirror=Dt;var qt=Object.defineProperty,Ht=(e,t,r)=>((e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class $t{constructor(e){Ht(this,"fileName"),Ht(this,"functionName"),Ht(this,"lineNumber"),Ht(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?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var Ut=/(^|@)\S+:\d+/,zt=/^\s*at .*(\S+:\d+|\(native\))/m,Wt=/^(eval@)?(\[native code])?$/,Vt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(zt)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var 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(e){return e.stack.split("\n").filter((function(e){return!!e.match(zt)}),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,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new $t({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Wt)}),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 $t({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new $t({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(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(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new $t({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new $t({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter((function(e){return!!e.match(Ut)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new $t({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function jt(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var o=i.children[s];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&n.push(o)}n.length>1&&(r+=":eq("+n.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Gt(e){return Array.isArray(e)}function Qt(e){return"object"==typeof e&&null!==e&&!Gt(e)}function Zt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Qt(e[i])&&Zt(e[i],t-1))return!0;return!1}function Yt(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],n=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,e):n.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Qt(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Qt(o)&&Zt(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=Gt(u)?jt(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var Kt={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 Jt(e,t,r){var i,n=r?Object.assign({},Kt,r):Kt,s=n.logger;if(!s)return()=>{};i="string"==typeof s?t[s]:s;var o=0,a=!1,l=[];if(n.level.includes("error")){var u=t=>{var r=t.message,i=Vt.parse(t.error).map((e=>e.toString())),s=[Yt(r,n.stringifyOptions)];e({level:"error",trace:i,payload:s})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[Yt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Yt("Uncaught (in promise)",n.stringifyOptions),Yt(t.reason,n.stringifyOptions)]);var s=Vt.parse(r).map((e=>e.toString()));e({level:"error",trace:s,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of n.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,s,l){try{if(!(s in t))return()=>{};var u=t[s],c={next:u},d=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=Vt.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Yt(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Yt("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return c.next.apply(this,t)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),t[s]=d,()=>{if(t[s]!==d)for(var e=t[s];"function"==typeof e&&e.__rrweb_layer__;){var r=e.__rrweb_layer__;if(r.next===d)return void(r.next=c.next);e=r.next}else t[s]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Xt=e=>({name:"rrweb/console@1",observer:Jt,options:e}),er=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function tr(e){return"string"==typeof e||e}function rr(e){return"string"==typeof e?e:void 0}var ir,nr=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],sr=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),or=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ar="min_length",lr="max_length",ur=["$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"],cr=["token"],dr="NativeGzipValidationError",hr=e=>e.length>=2&&31===e[0]&&139===e[1],pr=(e,t)=>e===or.GZipJS||t===or.GZipJS||"gzip"===t,_r=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),gr=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return _r(e)||t===dr},vr=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=dr,t},fr=function(){var e=t((function*(e,t){18>e.size&&vr("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());hr(r)&&8===r[2]||vr("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(ir)return ir;ir=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;ir[e]=t>>>0}return ir})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&vr("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&vr("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function mr(e,t,r){return yr.apply(this,arguments)}function yr(){return yr=t((function*(e,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(n).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(s.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield fr(u,n),u}catch(e){if(null!=i&&i.rethrow)throw e;return r&&console.error("Failed to gzip compress data",e),null}})),yr.apply(this,arguments)}var br=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Sr=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return br.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function wr(e,t){return-1!==e.indexOf(t)}var kr=function(e){return e.trim()},xr=function(e){return e.replace(/^\$/,"")};function Cr(e){var t,r=[];return null!==(t=JSON.stringify(e,(function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}})))&&void 0!==t?t:"null"}var Ir=Object.prototype,Er=Ir.hasOwnProperty,Tr=Ir.toString,Mr=Array.isArray||function(e){return"[object Array]"===Tr.call(e)},Rr=e=>"function"==typeof e,Pr=e=>e===Object(e)&&!Mr(e),Fr=e=>{if(Pr(e)){for(var t in e)if(Er.call(e,t))return!1;return!0}return!1},Lr=e=>void 0===e,Ar=e=>"[object String]"==Tr.call(e),Or=e=>Ar(e)&&0===e.trim().length,Dr=e=>null===e,Nr=e=>Lr(e)||Dr(e),Br=e=>"[object Number]"==Tr.call(e)&&e==e,qr=e=>Br(e)&&e>0,Hr=e=>"[object Boolean]"===Tr.call(e),$r=e=>e instanceof FormData,Ur=e=>wr(ur,e),zr=e=>wr(cr,e);function Wr(e){return null===e||"object"!=typeof e}function Vr(e,t){return{}.toString.call(e)==="[object "+t+"]"}function jr(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Gr=[!0,"true",1,"1","yes"],Qr=e=>wr(Gr,e),Zr=[!1,"false",0,"0","no"];function Yr(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),Br(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),Yr(n||r,t,r,i))}class Kr{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Yr(e.bucketSize,0,100,e._logger),this._refillRate=Yr(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Yr(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),n=this._buckets[i];return n?this._applyRefill(n,r):this._buckets[i]=n={tokens:this._bucketSize,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}}var Jr="Mobile",Xr="iOS",ei="Android",ti="Tablet",ri=ei+" "+ti,ii="iPad",ni="Apple",si=ni+" Watch",oi="Safari",ai="BlackBerry",li="Samsung",ui=li+"Browser",ci=li+" Internet",di="Chrome",hi=di+" OS",pi=di+" "+Xr,_i="Internet Explorer",gi=_i+" "+Jr,vi="Opera",fi=vi+" Mini",mi="Edge",yi="Microsoft "+mi,bi="Firefox",Si=bi+" "+Xr,wi="Nintendo",ki="PlayStation",xi="Xbox",Ci=ei+" "+Jr,Ii=Jr+" "+oi,Ei="Windows",Ti=Ei+" Phone",Mi="Nokia",Ri="Ouya",Pi="Generic",Fi=Pi+" "+Jr.toLowerCase(),Li=Pi+" "+ti.toLowerCase(),Ai="Konqueror",Oi="Oculus Browser",Di="Vivaldi",Ni="Yandex",Bi="Whale",qi="DuckDuckGo",Hi="Pale Moon",$i="Waterfox",Ui="Brave",zi="Google Search App",Wi="(\\d+(\\.\\d+)?)",Vi=new RegExp("Version/"+Wi),ji=new RegExp(xi,"i"),Gi=new RegExp(ki+" \\w+","i"),Qi=new RegExp(wi+" \\w+","i"),Zi=new RegExp(ai+"|PlayBook|BB10","i"),Yi={"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"},Ki=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?Ui:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&wr(e,"GSA/")?zi:wr(e," OPR/")&&wr(e,"Mini")?fi:wr(e," OPR/")?vi:Zi.test(e)?ai:wr(e,"IE"+Jr)||wr(e,"WPDesktop")?gi:wr(e,"OculusBrowser")?Oi:wr(e,ui)?ci:wr(e,mi)||wr(e,"Edg/")?yi:wr(e,Di+"/")?Di:wr(e,"YaBrowser/")?Ni:wr(e,Bi+"/")?Bi:wr(e,qi+"/")||wr(e,"Ddg/")?qi:wr(e,"FBIOS")?"Facebook "+Jr:wr(e,"UCWEB")||wr(e,"UCBrowser")?"UC Browser":wr(e,"CriOS")?pi:wr(e,"CrMo")||wr(e,di)?di:wr(e,ei)&&wr(e,oi)?Ci:wr(e,"FxiOS")?Si:wr(e.toLowerCase(),Ai.toLowerCase())?Ai:wr(e,Ui+"/")?Ui:((e,t)=>t&&wr(t,ni)||function(e){return wr(e,oi)&&!wr(e,di)&&!wr(e,ei)}(e))(e,t)?wr(e,Jr)?Ii:oi:wr(e,"PaleMoon/")?Hi:wr(e,$i+"/")?$i:wr(e,bi)?bi:wr(e,"MSIE")||wr(e,"Trident/")?_i:wr(e,"Gecko")?bi:"")},Ji={[gi]:[new RegExp("rv:"+Wi)],[yi]:[new RegExp(mi+"?\\/"+Wi)],[di]:[new RegExp("("+di+"|CrMo)\\/"+Wi)],[pi]:[new RegExp("CriOS\\/"+Wi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Wi)],[oi]:[Vi],[Ii]:[Vi],[vi]:[new RegExp("(Opera|OPR)\\/"+Wi)],[bi]:[new RegExp(bi+"\\/"+Wi)],[Si]:[new RegExp("FxiOS\\/"+Wi)],[Ai]:[new RegExp("Konqueror[:/]?"+Wi,"i")],[ai]:[new RegExp(ai+" "+Wi),Vi],[Ci]:[new RegExp("android\\s"+Wi,"i")],[ci]:[new RegExp(ui+"\\/"+Wi)],[Oi]:[new RegExp("OculusBrowser\\/"+Wi)],[Di]:[new RegExp(Di+"\\/"+Wi)],[Ni]:[new RegExp("YaBrowser\\/"+Wi)],[Bi]:[new RegExp(Bi+"\\/"+Wi)],[Ui]:[new RegExp(Ui+"\\/"+Wi)],[qi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Wi)],[Hi]:[new RegExp("PaleMoon\\/"+Wi)],[$i]:[new RegExp($i+"\\/"+Wi)],[zi]:[new RegExp("GSA\\/"+Wi)],[_i]:[new RegExp("(rv:|MSIE )"+Wi)],Mozilla:[new RegExp("rv:"+Wi)]},Xi=function(e,t,r,i){var n=Ki(e,t,r,i),s=Ji[n];if(Lr(s))return null;for(var o=0;s.length>o;o++){var a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},en=[[new RegExp(xi+"; "+xi+" (.*?)[);]","i"),e=>[xi,e&&e[1]||""]],[new RegExp(wi,"i"),[wi,""]],[new RegExp(ki,"i"),[ki,""]],[Zi,[ai,""]],[new RegExp(Ei,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ti,""];if(new RegExp(Jr).test(t)&&!/IEMobile\b/.test(t))return[Ei+" "+Jr,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Yi[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[Ei,i]}return[Ei,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Xr,[e[3],e[4],e[5]||"0"].join(".")]:[Xr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Lr(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ei+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ei+")","i"),e=>e&&e[2]?[ei,[e[2],e[3],e[4]||"0"].join(".")]:[ei,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[hi,""]],[/Linux|debian/i,["Linux",""]]],tn=function(e){return Qi.test(e)?wi:Gi.test(e)?ki:ji.test(e)?xi:new RegExp(Ri,"i").test(e)?Ri:new RegExp("("+Ti+"|WPDesktop)","i").test(e)?Ti:/iPad/.test(e)?ii:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?si:Zi.test(e)?ai:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Mi,"i").test(e)?Mi:/(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(Jr).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)?ei:ri:new RegExp("(pda|"+Jr+")","i").test(e)?Fi:new RegExp(ti,"i").test(e)&&!new RegExp(ti+" pc","i").test(e)?Li:""},rn=function(e,t){var r,i,n,s,o=tn(e);return o===ii||o===ri||"Kobo"===o||"Kindle Fire"===o||o===Li?ti:o===wi||o===xi||o===ki||o===Ri?"Console":o===si?"Wearable":o?Jr:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(n=null==t?void 0:t.screenHeight)&&void 0!==n?n:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?Jr:ti:"Desktop"},nn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sn(e,t){return"string"==typeof(r=e)&&nn.test(r)?e:t();var r}function on(e){return e?e.split("#")[0]:e}function an(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function ln(e,t,r){return un.apply(this,arguments)}function un(){return(un=t((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,n)=>{i=an((()=>{try{null==r||r(),e()}catch(e){n(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var cn=e=>e instanceof Error,dn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},hn=dn.info;function pn(e){if(Hr(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Mr(e))return{arrayValue:{values:e.map((e=>pn(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function _n(e){var t=[];for(var r in e){var i=e[r];Dr(i)||Lr(i)||t.push({key:r,value:pn(i)})}return t}function gn(e,t){var i=dn[e.level||"info"]||hn,n=i.text,s=i.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),Nr(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),Nr(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=r({},a,e.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:n,body:{stringValue:e.body},attributes:_n(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Lr(e.trace_flags)||(u.flags=e.trace_flags),u}function vn(e,t,i){return r({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}function fn(e,t,r,i){return{resourceLogs:[{resource:{attributes:_n(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let mn=class{constructor(e,t,r,i,n,s,o){var a;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=n,this._waitForStoragePersist=s,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}reset(){this._clearFlushTimer(),this._flushPromise=null,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this._runBeforeSend(e);if(null!==t)if(t.body){if(this._checkRateLimit()){var r={record:gn(t,this._getContext())};this._onReady((()=>this._enqueue(r)))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Mr(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Log was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return t((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return t((function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o;e._evictedSinceAdvance=0;var a=Math.min(r.length,e._maxBatchRecordsPerPost),l=r.slice(0,a),u=l.map((e=>e.record)),c=fn(u,e._buildResourceAttributes(),null!==(s=e._scopeName)&&void 0!==s?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance._sendLogsBatch(c);if("too-large"===d.kind&&l.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(l.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?e._logger.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(l.length),r=null!==(o=e._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===d.kind)throw d.error}}}))()}_persistQueueAdvance(e){var r=this;return t((function*(){var t,i=Math.max(0,e-r._evictedSinceAdvance),n=null!==(t=r._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];r._instance.setPersistedProperty(sr.LogsQueue,n.slice(i)),yield r._waitForStoragePersist()}))()}_buildResourceAttributes(){return vn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(sr.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(sr.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=an((()=>{this._flushTimer=void 0,this._flushInBackground()}),e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(sr.LogsQueue);return!!e&&e.length>0}shutdown(e){var r=this;return t((function*(){r._clearFlushTimer();var t=r.flush().catch((()=>{}));void 0!==e?yield ln(t,e):yield t}))()}flushWithTimeout(e){var r=this;return t((function*(){var t=r.flush();yield ln(t,e,(()=>{t.catch((()=>{}))}))}))()}_flushInBackground(){this.flush().then((()=>{this._consecutiveFlushFailures=0}),(e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())}))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}};var yn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function bn(e){return String(e)+"000000"}function Sn(e,t,r,i){var n="";return i&&(n=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+n}let wn=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,r=this._flushPromise,i=function(){var i=t((function*(){r&&(yield r.catch((()=>{}))),yield e._doFlush()}));return function(){return i.apply(this,arguments)}}(),n=i().finally((()=>{this._flushPromise===n&&(this._flushPromise=null)}));return this._flushPromise=n,n}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var i,n;try{i=t.attributes?r({},t.attributes):void 0,n=Sn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var s=this._series.get(n);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(n,s)}var o=this._typeByName.get(t.name);void 0===o?this._typeByName.set(t.name,t.type):o===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(yn.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,yn)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Mr(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Metric was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=an((()=>{this._flushTimer=void 0,this.flush().catch((e=>{this._logger.error("Metrics flush failed:",e)}))}),this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return t((function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}}))()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return r({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:_n(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:t}]}]};var t,i,n,s}_buildMetrics(e){var t=bn(Date.now()),i=new Map;for(var n of e.values()){var s,o=Sn(n.type,n.name,n.unit,void 0),a=i.get(o);a||(a=r({name:n.name},n.unit&&{unit:n.unit}),"count"===n.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===n.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(o,a));var l=_n(null!==(s=n.attributes)&&void 0!==s?s:{}),u=bn(n.windowStartMs);if("count"===n.type){var c,d={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!==(c=n.total)&&void 0!==c?c:0};a.sum.dataPoints.push(d)}else if("gauge"===n.type){var h,p={attributes:l,timeUnixNano:t,asDouble:null!==(h=n.last)&&void 0!==h?h:0};a.gauge.dataPoints.push(p)}else n.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:n.hist.count,sum:n.hist.sum,min:n.hist.min,max:n.hist.max,bucketCounts:n.hist.bucketCounts,explicitBounds:yn})}return Array.from(i.values())}_mergeWindowBack(e){var t,r;for(var i of e){var n=i[0],s=i[1],o=this._series.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=s.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this._admitNewSeries()&&this._series.set(n,s)}}};function kn(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var xn,Cn,In;function En(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return In&&r.length===Cn||(Cn=r.length,In=r.reduce(((r,i)=>{xn||(xn={});var n=xn[i];if(n)r[n[0]]=n[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,xn[i]=[l,u];break}}return r}),{})),In}}class Tn{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),s=this.parseStacktrace(i,n);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var r=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Mr(t.stacktrace.frames)&&(t.stacktrace.frames=yield r.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,n;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),r({},e,{cause:i,stack:n})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var r=this;return t((function*(){var t=e;for(var i of r.modifiers)t=yield i(t);return t}))()}convertToExceptionList(e,t){var i,n,s,o={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(n=t.handled)||void 0===n||n,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,r({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:En(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var n=(r,i)=>{if(4>=i){var n=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,n)}};return r({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>n(e,i),next:e=>n(e,i+1)})}}var Mn="?";function Rn(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?Mn:r,in_app:!0};return Lr(i)||(s.lineno=i),Lr(n)||(s.colno=n),s}var Pn=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:Mn,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Fn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ln=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,An=/\((\S*)(?::(\d+))(?::(\d+))\)/,On=(e,t)=>{var r=Fn.exec(e);if(r)return Rn(t,r[1],Mn,+r[2],+r[3]);var i=Ln.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var n=An.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=Pn(i[1]||Mn,i[2]);return Rn(t,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Dn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Nn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Bn=(e,t)=>{var r=Dn.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=Nn.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||Mn,o=Pn(s,n);return Rn(t,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},qn=/\(error: (.*)\)/,Hn=50;class $n{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Ar(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Vr(e,"DOMException")}isDOMError(e){return Vr(e,"DOMError")}}class Un{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class zn{constructor(){}match(e){return Vr(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}var Wn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Vn{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),n=i[0],s=i[1];return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Wn);return i&&(t=i[1],r=i[2]),[t,r]}}var jn=["fatal","error","warning","log","info","debug"];function Gn(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(t>=n.length)return i===r.length?n:n.length>t?n.slice(0,t)+"...":n}return""}class Qn{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(r=t.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return jr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+Gn(e)}isSeverityLevel(e){return Ar(e)&&!Or(e)&&jn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(cn(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Zn{match(e){return jr(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Gn(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Yn{match(e){return Wr(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Kn{match(e){return Vr(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!jr(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return Wr(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Jn="$message",Xn="$timestamp",es=new Set([Jn,Xn]),ts={enabled:!0,max_bytes:32768};function rs(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ts.enabled,max_bytes:ns(e.max_bytes,ts.max_bytes)}:r({},ts)}class is{constructor(e){this._entries=[],this._totalBytes=0,this._config=rs(e)}setConfig(e){this._config=rs(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=Cr(e)}catch(e){return}try{var r=JSON.parse(t);if(!Pr(r))return;var i=r,n=i[Jn],s=i[Xn];if(!Ar(n)||0===n.trim().length)return;if(!Ar(s)&&!Br(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function ns(e,t){if(!Br(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var ss="undefined"!=typeof window?window:void 0,os="undefined"!=typeof globalThis?globalThis:ss,as=null==os?void 0:os.navigator,ls=null==os?void 0:os.document,us=null==os?void 0:os.location,cs=null==os?void 0:os.fetch,ds=null!=os&&os.XMLHttpRequest&&"withCredentials"in new os.XMLHttpRequest?os.XMLHttpRequest:void 0,hs=null==os?void 0:os.AbortController,ps=null==os?void 0:os.CompressionStream,_s=null==as?void 0:as.userAgent;function gs(){return!(!ss||!1===ss.navigator.onLine)}var vs=e=>"undefined"!=typeof Document&&e instanceof Document,fs={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"},ms=function(e,t){var r=(void 0===t?{}:t).debugEnabled,i={_log(t){if(ss&&(fs.DEBUG||ss.POSTHOG_DEBUG||r)&&!Lr(ss.console)&&ss.console){for(var i=("__rrweb_original__"in ss.console[t]?ss.console[t].__rrweb_original__:ss.console[t]),n=arguments.length,s=new Array(n>1?n-1:0),o=1;n>o;o++)s[o-1]=arguments[o];i(e,...s)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>ms(e+" "+t,r)};return i},ys=ms("[PostHog.js]"),bs=ys.createLogger;function Ss(e,t){Mr(e)&&e.forEach(t)}function ws(e,t){if(!Nr(e))if(Mr(e))e.forEach(t);else if($r(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)Er.call(e,r)&&t(e[r],r)}var ks=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)void 0!==n[s]&&(e[s]=n[s]);return e};function xs(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var Cs=function(e){try{return e()}catch(e){return}},Is=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){ys.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ys.critical(e)}}},Es=function(e){var t={};return ws(e,(function(e,r){(Ar(e)&&e.length>0||Br(e))&&(t[r]=e)})),t};var Ts=["herokuapp.com","vercel.app","netlify.app"];function Ms(e){var t=null==e?void 0:e.hostname;if(!Ar(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Ts)if(r===i)return!1;return!0}function Rs(e,t,r,i){var n=null!=i?i:{},s=n.capture,o=n.passive;null==e||e.addEventListener(t,r,{capture:void 0!==s&&s,passive:void 0===o||o})}function Ps(e){return"ph_toolbar_internal"===e.name}var Fs=["localhost","127.0.0.1"],Ls=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return Cr(e)}},As=e=>{var t=null==ls?void 0:ls.createElement("a");return Lr(t)?null:(t.href=e,t)},Os=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return ws(e,(function(e,t){Lr(e)||Lr(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},Ds=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===t){r=s;break}}if(!Mr(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){ys.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ns=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Mr(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Bs=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},qs=(e,t)=>e>=t&&gs(),Hs=(e,t,r,i)=>{if(0===e){if(gs()){var n=t+1;return n===r&&i(),n}return t}return 0},$s=()=>{};function Us(e,t,r){try{if(!(t in e))return $s;var i={next:e[t]},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)}));return Rr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e[t];Rr(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else e[t]=i.next}}catch(e){return $s}}function zs(e,t){var r,i=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),n={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of t.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}function Ws(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Rr(i))return t;try{var n=i(t);return Ar(n)&&n?n:t}catch(e){return ys.error("Error in get_current_url, falling back to window.location.href",e),t}}function Vs(e){var t,r=null==ss||null==(t=ss.location)?void 0:t.href;return Lr(r)?void 0:Ws(e,r)}var js="__POSTHOG_TOOLBAR__",Gs=1,Qs=3,Zs=11;function Ys(e){return e instanceof Element&&(e.id===js||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ks(e){return!!e&&e.nodeType===Gs}function Js(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Xs(e){return!!e&&e.nodeType===Qs}function eo(e){return!!e&&e.nodeType===Zs&&Ks(e.host)}var to=1e3;function ro(e){return e?kr(e).split(/\s+/):[]}function io(e,t){var r=Vs(t);return!!(r&&e&&e.some((e=>r.match(e))))}function no(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 ro(t)}function so(e){return Nr(e)?null:kr(e).split(/(\s+)/).filter((e=>Po(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function oo(e){var t="";return wo(e)&&!ko(e)&&e.childNodes&&e.childNodes.length&&ws(e.childNodes,(function(e){var r;Xs(e)&&e.textContent&&(t+=null!==(r=so(e.textContent))&&void 0!==r?r:"")})),kr(t)}function ao(e){var t;return Lr(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var lo=["a","button","form","input","select","textarea","label"];function uo(e,t){if(Lr(t))return!0;var r,i=function(e){if(t.some((t=>function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}(e,t))))return{v:!0}};for(var n of e)if(r=i(n))return r.v;return!1}function co(e){var t=e.parentNode;return!(!t||!Ks(t))&&t}var ho=[".ph-no-autocapture","[data-ph-no-autocapture]"],po=["next","previous","prev",">","<"],_o=[...po,"+","-","−","–"],go=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,vo=[".ph-no-deadclick",".ph-no-capture"],fo=[".ph-no-rageclick",".ph-no-capture"],mo=["","text","search","email","password","url","tel","number"];function yo(e,t){if(!ss||bo(e))return!1;var r,i,n,s,o;if(Hr(t)?(r=!!t&&fo,i=void 0,n=!1):(r=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:fo,i=null==t?void 0:t.content_ignorelist,n=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===r)return!1;if(n&&function(e){return!(!e||!Ks(e))&&(!!Js(e,"textarea")||(Js(e,"input")?wr(mo,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var a=So(e,!1).targetElementList;return!function(e,t){if(!1===e||Lr(e))return!1;var r;if(!0===e)r=po;else{if(!Mr(e))return!1;if(e.length>10)return ys.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map((e=>e.toLowerCase()))}return t.some((e=>{var t=e.safeText,i=e.ariaLabel;return r.some((e=>go(t,e)||go(i,e)))}))}(i,a.map((e=>{var t;return{safeText:oo(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!uo(a,r)}var bo=e=>!e||Js(e,"html")||!Ks(e),So=(e,t)=>{if(!ss||bo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],n=e;n.parentNode&&!Js(n,"body");)if(eo(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=co(n);if(!s)break;if(t||lo.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=ss.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}catch(e){}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function wo(e){for(var t=new Set,r=0,i=e;i.parentNode&&!Js(i,"body");i=i.parentNode){if(r++>=to||t.has(i))return!1;t.add(i);var n=no(i);if(wr(n,"ph-sensitive")||wr(n,"ph-no-capture"))return!1}if(wr(no(e),"ph-include"))return!0;var s=e.type||"";if(Ar(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!Ar(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function ko(e){return!!(Js(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Js(e,"select")||Js(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var xo=new RegExp("^(?:(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}))$"),Co=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Io=[16,15,14,13],Eo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),To=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Mo=/[0-9A-Za-z_]/;function Ro(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var n=e.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),t+=n,r=!r}return t%10==0}function Po(e,t){if(void 0===t&&(t=!0),Nr(e))return!1;if(Ar(e)){e=kr(e);var r=t?xo.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Co.lastIndex=0;t=Co.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of Io){var o=n+s;if(i.length>=o){var a=i.slice(n,o);if(xo.test(a)&&Ro(a))return!0}}}return!1}(e);if(r)return!1;var i=t?Eo.test(e):function(e){var t;for(To.lastIndex=0;t=To.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&Mo.test(r)&&Mo.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function Fo(e){var t=oo(e);return Po(t=(t+" "+Lo(e)).trim())?t:""}function Lo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ws(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=oo(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Lo(e)).trim())}catch(e){ys.error("[AutoCapture]",e)}})),t}function Ao(e){return e.replace(/"|\\"/g,'\\"')}function Oo(e){var t=e.attr__class;if(t)return Mr(t)?t:ro(t)}var Do="[SessionRecording]",No="redacted",Bo=1e6;function qo(e){var t;return Math.min(Bo,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Bo)}var Ho={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:Bo,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},$o=["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"],Uo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],zo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Wo=e=>{Nr(e)||ws(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return $o.includes(t)||zo.some((e=>t.includes(e)))})(t)&&(e[t]=No)}))},Vo=["/s/","/e/","/i/"];function jo(e,t,r,i){if(Nr(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Ar(n)&&(n=parseInt(n)),n>r?Do+" "+i+" body too large to record ("+n+" bytes)":e}function Go(e,t){if(Nr(e))return e;var r=e;return Po(r,!1)||(r=Do+" "+t+" body "+No),ws(Uo,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=Do+" "+t+" body "+No+" as might contain: "+e)})),r}var Qo=bs("[Recorder]"),Zo=e=>"navigation"===e.entryType,Yo=e=>"resource"===e.entryType;function Ko(e,t){return!!t&&(Hr(t)||t[e])}function Jo(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var Xo=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ea(e){var t=e.type,r=e.recordBody,i=e.headers;function n(e){var t=Object.keys(i).find((e=>"content-type"===e.toLowerCase())),r=t&&i[t];return e.some((e=>null==r?void 0:r.toLowerCase().includes(e)))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Jo(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(n(Xo))return!1;if(Hr(r))return!0;if(Mr(r))return n(r);var s=r[t];return Hr(s)?s:n(s)}function ta(e,t,r,i,n,s){return ra.apply(this,arguments)}function ra(){return ra=t((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Qo.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var s=e.length-1;s>=0;s-=1)if(Yo(o=e[s])&&o.initiatorType===t&&(Lr(i)||o.startTime>=i)&&(Lr(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),ta(e,t,r,i,n,s+1))})),ra.apply(this,arguments)}function ia(e){var t=e.body,r=e.options,i=e.url;if(Nr(t))return null;var n=zs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(Ar(t))return t;if(vs(t))return t.textContent;if($r(t))return Os(t);if(Pr(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 na=e=>!Dr(e)&&("navigation"===e.entryType||"resource"===e.entryType);function sa(e){var t=e.entry,i=e.method,n=e.status,s=e.networkRequest,o=e.isInitial,a=e.start,l=e.end,u=e.url,c=e.initiatorType;a=t?t.startTime:a,l=t?t.responseEnd:l;var d=Math.floor(Date.now()-performance.now()),h=Math.floor(d+(a||0)),p=[r({},t?t.toJSON():{name:u},{startTime:Lr(a)?void 0:Math.round(a),endTime:Lr(l)?void 0:Math.round(l),timeOrigin:d,timestamp:h,method:i,initiatorType:c||(t?t.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(na(t))for(var _ of t.serverTiming||[])p.push({timeOrigin:d,timestamp:h,startTime:Math.round(t.startTime),name:_.name,duration:_.duration,entryType:"serverTiming"});return p}var oa=["video/","audio/"];function aa(e){return Pr(e)&&Rr(e.getReader)&&Rr(e.tee)}var la=500,ua="[SessionReplay] Timeout while trying to read body",ca="[SessionReplay] Failed to read body";function da(e){return ca+": "+e}function ha(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function pa(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(ua)),la);try{e.clone().text().then((e=>t(e)),(e=>t(da(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(ca)}}))}(e);var r=qo(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>t}catch(e){return!1}}(e,r)?Promise.resolve(ha(r)):function(e,t){return new Promise((r=>{var i,n=!1;function s(){try{var e;null==(e=i)||e.cancel()}catch(e){}}function o(e){n||(n=!0,clearTimeout(l),s(),r(e))}var a,l=setTimeout((()=>o(ua)),la);try{a=e.clone()}catch(e){return void o(ca)}var u=a.body;if(aa(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(ca)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(n)s();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var n of e)r.set(n,i),i+=n.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(ha(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(da(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(da(e))))}catch(e){o(ca)}}))}(e,r)}function _a(){return _a=t((function*(e){var t=e.r,r=e.options,i=zs(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):pa(t,r)})),_a.apply(this,arguments)}function ga(){return ga=t((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,n=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=oa.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var a=zs(n,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return Dr(i)?pa(t,r):Promise.resolve(i)})),ga.apply(this,arguments)}var va=null;function fa(e,i,n){if(!("performance"in i))return()=>{};if(va)return Qo.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Ho,n):Ho,o=t=>{var i=[],n=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!n){var r=s.maskRequestFn(e);t||(n=!r),r&&i.push(r)}})),i.length>0&&e(r({},t,{requests:i}))},a=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Zo(e)||Yo(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>sa({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>Zo(e)||Yo(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>sa({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(o,i,s),l=()=>{},u=()=>{};return(s.recordHeaders||s.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Ko("request",r.recordHeaders),n=Ko("response",r.recordHeaders),s=Us(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,_=new Request(a),g={},v={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=d.send.bind(d);d.send=e=>(ea({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=ia({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",y),d.removeEventListener("abort",y),d.removeEventListener("timeout",y)},b=()=>{if(d.readyState===d.DONE){y(),p=t.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{var t=e.split(": "),r=t.shift(),n=t.join(": ");r&&(i[r]=n)})),n&&(g.responseHeaders=i),ea({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=ia({body:d.response,options:r,url:a})),ta(t,"xmlhttprequest",_.url,h,p).then((t=>{var r=sa({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:g,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",y),d.addEventListener("abort",y),d.addEventListener("timeout",y)}catch(e){Qo.error("Failed to instrument XHR for network capture",e)}s.call(d,o,a.toString(),l,u,c)}));return()=>{s()}}(o,i,s),u=function(e,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Ko("request",i.recordHeaders),s=Ko("response",i.recordHeaders),o=Us(r,"fetch",(o=>function(){var a=t((function*(t,a){var l,u;try{l=new Request(t,a)}catch(e){return Qo.error("Failed to instrument fetch for network capture",e),o(t,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),n&&(h.requestHeaders=p),!aa(null==a?void 0:a.body)&&ea({type:"request",headers:p,url:t,recordBody:i.recordBody})&&(h.requestBody=yield function(e){return _a.apply(this,arguments)}({r:l,options:i,url:t}))}catch(e){Qo.error("Failed to record fetch request for network capture",e)}c=r.performance.now(),u=Jo(t)?yield o(l):yield o(t,a),d=r.performance.now();var _={};return u.headers.forEach(((e,t)=>{_[t]=e})),s&&(h.responseHeaders=_),ea({type:"response",headers:_,url:t,recordBody:i.recordBody})&&(h.responseBody=yield function(e){return ga.apply(this,arguments)}({r:u,options:i,url:t})),u}finally{ta(r,"fetch",l.url,c,d).then((t=>{var r,i=sa({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return a.apply(this,arguments)}}()));return()=>{o()}}(o,i,s)),va=()=>{a(),l(),u(),va=null}}var ma=e=>({name:"rrweb/network@1",observer:fa,options:e}),ya="undefined"!=typeof globalThis?globalThis:ss;ya&&"undefined"==typeof self&&(ya.self=ya),ya&&"undefined"==typeof File&&(ya.File=function(){});var ba=null!=ss?ss:{};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Xt,getRecordNetworkPlugin:ma},ba.__PosthogExtensions__.rrweb={record:Bt,version:"v2",wasMaxDepthReached:()=>pe,resetMaxDepthState(){pe=!1,he=!1}},ba.rrweb={record:Bt,version:"v2"},ba.rrwebConsoleRecord={getRecordConsolePlugin:Xt},ba.getRecordNetworkPlugin=ma;var Sa,wa,ka,xa,Ca,Ia,Ea,Ta,Ma,Ra,Pa,Fa,La,Aa,Oa,Da={},Na=[],Ba=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qa=Array.isArray;function Ha(e,t){for(var r in t)e[r]=t[r];return e}function $a(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ua(e,t,r){var i,n,s,o={};for(s in t)"key"==s?i=t[s]:"ref"==s?n=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?Sa.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===o[s]&&(o[s]=e.defaultProps[s]);return za(e,o,i,n,null)}function za(e,t,r,i,n){var s={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++ka:n,__i:-1,__u:0};return null==n&&null!=wa.vnode&&wa.vnode(s),s}function Wa(e){return e.children}function Va(e,t){this.props=e,this.context=t}function $(e,t){if(null==t)return e.__?$(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?$(e):null}function ja(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Ha({},t);s.__v=t.__v+1,wa.vnode&&wa.vnode(s),rl(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?$(t):r,!!(32&t.__u),n),s.__v=t.__v,s.__.__k[s.__i]=s,nl(i,s,n),t.__e=t.__=null,s.__e!=r&&Ga(s)}}function Ga(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some((function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e})),Ga(e)}function Qa(e){(!e.__d&&(e.__d=!0)&&xa.push(e)&&!Za.__r++||Ca!=wa.debounceRendering)&&((Ca=wa.debounceRendering)||Ia)(Za)}function Za(){try{for(var e,t=1;xa.length;)xa.length>t&&xa.sort(Ea),e=xa.shift(),t=xa.length,ja(e)}finally{xa.length=Za.__r=0}}function Ya(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,_,g,v,f,m=i&&i.__k||Na,y=t.length;for(l=function(e,t,r,i,n){var s,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(n),s=0;n>s;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[s]=za(null,o,null,null,null):qa(o)?o=e.__k[s]=za(Wa,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=za(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,l=s+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=Ja(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(n>c?h--:c>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[s]=null;if(d)for(s=0;c>s;s++)null!=(a=r[s])&&0==(2&a.__u)&&(a.__e==i&&(i=$(a)),ll(a,a));return i}(r,t,m,l,y),d=0;y>d;d++)null!=(p=r.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Da,p.__i=d,v=rl(e,p,h,n,s,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&al(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=Ka(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=g,l}function Ka(e,t,r,i){var n,s;if("function"==typeof e.type){for(n=e.__k,s=0;n&&n.length>s;s++)n[s]&&(n[s].__=e,t=Ka(n[s],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=$(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ja(e,t,r,i){var n,s,o,a=e.key,l=e.type,u=t[r],c=null!=u&&0==(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return r;if(i>(c?1:0))for(n=r-1,s=r+1;n>=0||t.length>s;)if(null!=(u=t[o=0>n?s++:n--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Xa(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Ba.test(t)?r:r+"px"}function el(e,t,r,i,n){var s,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||Xa(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Xa(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(Pa,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?i?r[Ra]=i[Ra]:(r[Ra]=Fa,e.addEventListener(t,s?Aa:La,s)):e.removeEventListener(t,s?Aa:La,s);else{if("http://www.w3.org/2000/svg"==n)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&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function tl(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ma])t[Ma]=Fa++;else if(r[Ra]>t[Ma])return;return r(wa.event?wa.event(t):t)}}}function rl(e,t,r,i,n,s,o,a,l,u){var c,d,h,p,_,g,v,f,m,y,$,b,S,w,k,x,C=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=wa.__b)&&c(t);e:if("function"==typeof C){d=o.length;try{if(m=t.props,y=C.prototype&&C.prototype.render,$=(c=C.contextType)&&i[c.__c],b=c?$?$.props.value:c.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new C(m,b):(t.__c=h=new Va(m,b),h.constructor=C,h.render=ul),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=C.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Ha({},h.__s)),Ha(h.__s,C.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==C.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==C.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),Na.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(_,g,v)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=wa.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),Na.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Ha(Ha({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(_,g)),k=null!=c&&c.type===Wa&&null==c.key?sl(c.props.children):c,a=Ya(e,qa(k)?k:[k],t,r,i,n,s,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=s&&(s[s.indexOf(a)]=null),t.__e=a}else{if(null!=s)for(x=s.length;x--;)$a(s[x]);il(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||il(t);wa.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=ol(r.__e,t,r,i,n,s,o,l,u);return(c=wa.diffed)&&c(t),128&t.__u?void 0:a}function il(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(il))}function nl(e,t,r){for(var i=0;r.length>i;i++)al(r[i],r[++i],r[++i]);wa.__c&&wa.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){wa.__e(e,t.__v)}}))}function sl(e){return"object"!=typeof e||null==e||e.__b>0?e:qa(e)?e.map(sl):void 0!==e.constructor?null:Ha({},e)}function ol(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,_,g,v=r.props||Da,f=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;s.length>u;u++)if((p=s[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,s[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(n,m,f.is&&f),a&&(wa.__m&&wa.__m(t,s),a=!1),s=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(s="textarea"==m&&null!=f.defaultValue?null:s&&Sa.call(e.childNodes),!a&&null!=s)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||el(e,u,null,p,n);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?_=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||el(e,u,p,v[u],n);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Ya("template"==t.type?e.content:e,qa(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:r.__k&&$(r,0),a,l),null!=s)for(u=s.length;u--;)$a(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&el(e,u,_,v[u],n),u="checked",null!=g&&g!=e[u]&&el(e,u,g,v[u],n))}return e}function al(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){wa.__e(e,r)}}function ll(e,t,r){var i,n;if(wa.unmount&&wa.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||al(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){wa.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&ll(i[n],t,r||"function"!=typeof e.type);r||$a(e.__e),e.__c=e.__=e.__e=void 0}function ul(e,t,r){return this.constructor(e,r)}function cl(e,t,r){var i,n,s;t==document&&(t=document.documentElement),wa.__&&wa.__(e,t),i=t.__k,n=[],s=[],rl(t,e=t.__k=Ua(Wa,null,[e]),i||Da,Da,t.namespaceURI,i?null:t.firstChild?Sa.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),nl(n,e,s),e.props.children=null}Sa=Na.slice,wa={__e(e,t,r,i){for(var n,s,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},ka=0,Va.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Ha({},this.state),"function"==typeof e&&(e=e(Ha({},r),this.props)),e&&Ha(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Qa(this))},Va.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qa(this))},Va.prototype.render=Wa,xa=[],Ia="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ea=function(e,t){return e.__v.__b-t.__v.__b},Za.__r=0,Ta=Math.random().toString(8),Ma="__d"+Ta,Ra="__a"+Ta,Pa=/(PointerCapture)$|Capture$/i,Fa=0,La=tl(!1),Aa=tl(!0),Oa=0;var dl,hl,pl,_l,gl=0,vl=[],fl=wa,ml=fl.__b,yl=fl.__r,bl=fl.diffed,Sl=fl.__c,wl=fl.unmount,kl=fl.__;function xl(e,t){fl.__h&&fl.__h(hl,e,gl||t),gl=0;var r=hl.__H||(hl.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Cl(e){return gl=1,function(e,t,r){var i=xl(dl++,2);if(i.t=e,!i.__c&&(i.__=[Dl(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,e);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=hl,!hl.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s){var a=s.call(this,e,t,r);return n?a||o:a}return!n||o};hl.__f=!0;var s=hl.shouldComponentUpdate,o=hl.componentWillUpdate;hl.componentWillUpdate=function(e,t,r){if(this.__e){var i=s;s=void 0,n(e,t,r),s=i}o&&o.call(this,e,t,r)},hl.shouldComponentUpdate=n}return i.__N||i.__}(Dl,e)}function Il(e,t){var r=xl(dl++,3);!fl.__s&&Ol(r.__H,t)&&(r.__=e,r.u=t,hl.__H.__h.push(r))}function El(e){return gl=5,Tl((function(){return{current:e}}),[])}function Tl(e,t){var r=xl(dl++,7);return Ol(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ml(e){var t=hl.context[e.__c],r=xl(dl++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(hl)),t.props.value):e.__}function Rl(){for(var e;e=vl.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ll),t.__h.some(Al),t.__h=[]}catch(r){t.__h=[],fl.__e(r,e.__v)}}}fl.__b=function(e){hl=null,ml&&ml(e)},fl.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),kl&&kl(e,t)},fl.__r=function(e){yl&&yl(e),dl=0;var t=(hl=e.__c).__H;t&&(pl===hl?(t.__h=[],hl.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&Rl(),dl=0)),pl=hl},fl.diffed=function(e){bl&&bl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vl.push(t)&&_l===fl.requestAnimationFrame||((_l=fl.requestAnimationFrame)||Fl)(Rl)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),pl=hl=null},fl.__c=function(e,t){t.some((function(e){try{e.__h.some(Ll),e.__h=e.__h.filter((function(e){return!e.__||Al(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],fl.__e(r,e.__v)}})),Sl&&Sl(e,t)},fl.unmount=function(e){wl&&wl(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Ll(e)}catch(e){t=e}})),r.__H=void 0,t&&fl.__e(t,r.__v))};var Pl="function"==typeof requestAnimationFrame;function Fl(e){var t,r=function(){clearTimeout(i),Pl&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Pl&&(t=requestAnimationFrame(r))}function Ll(e){var t=hl,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),hl=t}function Al(e){var t=hl;e.__c=e.__(),hl=t}function Ol(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Dl(e,t){return"function"==typeof t?t(e):t}function Nl(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&Rr(r.then)&&r.then(void 0,(()=>{}))}}}}var Bl="gzip-js",ql="base64",Hl="events",$l="cancelEvents",Ul={Tab:"tab",Selector:"selector"},zl={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Wl={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Vl={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},jl={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Gl={End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ql="always",Zl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Yl={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_COMPLETED:"$survey_completed",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Kl="popover";function Jl(e){return"$survey_response_"+e}function Xl(e,t){if(!t)return null;var r=e[Jl(t)];return Mr(r)?[...r]:r}function eu(e,t){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!Lr(t.originalQuestionIndex)){var r,n=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,s=Xl(e,t.id);Lr(s)||(i[n]=s)}})),r({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:Xl(e,t.id)})))},e,i)}function tu(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function ru(e){return"string"==typeof e&&e.trim()?e.trim():null}function iu(e){return e.toLowerCase()}function nu(e,t,r){if(!e||!t)return null;var i=iu(t),n=Object.keys(e).find((e=>iu(e)===i));if(n)return null==r||r.debug("Found exact translation match: "+n),n;if(i.includes("-")){var s=i.split("-")[0],o=Object.keys(e).find((e=>iu(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}function su(e,t,i){var n,s=nu(e.translations,t,i),o=r({},e),a=!1;if(s){var l,u=null==(l=e.translations)?void 0:l[s];u&&(null==i||i.info("Applying survey-level translation for language: "+s),Lr(u.name)||(o.name=u.name,a=!0),o.appearance?(o.appearance=r({},o.appearance),Lr(u.thankYouMessageHeader)||(o.appearance.thankYouMessageHeader=u.thankYouMessageHeader,a=!0),Lr(u.thankYouMessageDescription)||(o.appearance.thankYouMessageDescription=u.thankYouMessageDescription,a=!0),Lr(u.thankYouMessageCloseButtonText)||(o.appearance.thankYouMessageCloseButtonText=u.thankYouMessageCloseButtonText,a=!0),Lr(u.submitButtonText)||(o.appearance.submitButtonText=u.submitButtonText,a=!0),Lr(u.backButtonText)||(o.appearance.backButtonText=u.backButtonText,a=!0)):function(e){return!(Lr(e.thankYouMessageHeader)&&Lr(e.thankYouMessageDescription)&&Lr(e.thankYouMessageCloseButtonText)&&Lr(e.submitButtonText)&&Lr(e.backButtonText))}(u)&&(a=!0))}var c=e.questions.map((e=>function(e,t,i){var n,s=nu(e.translations,t,i);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=null==(n=e.translations)?void 0:n[s];if(!o)return{question:e,matchedKey:null,hasChanges:!1};var a=r({},e),l=!1;return Lr(o.question)||(a.question=o.question,l=!0),Lr(o.description)||(a.description=o.description,l=!0),Lr(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!Lr(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!Lr(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!Lr(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return Mr(e.choices)}(o)&&(a.choices=o.choices,l=!0),{question:l?a:e,matchedKey:l?s:null,hasChanges:l}}(e,t,i))),d=c.map((e=>e.question)),h=c.some((e=>e.hasChanges)),p=null;return s||(p=(null==(n=c.find((e=>e.matchedKey)))?void 0:n.matchedKey)||null),h&&(o.questions=d,a=!0,null==i||i.info("Applied question-level translations for language: "+t)),{survey:o,matchedKey:a?s||p:null}}function ou(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function au(e){var t;return ou(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var lu=bs("[Surveys]");function uu(e){return!(!e.start_date||e.end_date)}function cu(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var du="seenSurvey_",hu="inProgressSurvey_",pu=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),_u=e=>pu(du,e),gu=e=>{try{var t=_u(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){lu.error("Failed to persist survey seen state",e)}},vu=[Vl.Popover,Vl.Widget,Vl.API],fu={ignoreConditions:!1,ignoreDelay:!1,displayType:Kl},mu="$people_distinct_id",yu="$device_id",bu="$device_model",Su="__alias",wu="__timers",ku="$autocapture_disabled_server_side",xu="$heatmaps_enabled_server_side",Cu="$exception_capture_enabled_server_side",Iu="$error_tracking_suppression_rules",Eu="$error_tracking_capture_extension_exceptions",Tu="$web_vitals_enabled_server_side",Mu="$dead_clicks_enabled_server_side",Ru="$product_tours_enabled_server_side",Pu="$web_vitals_allowed_metrics",Fu="$session_recording_remote_config",Lu="$replay_sample_rate",Au="$replay_override_sampling",Ou="$replay_override_linked_flag",Du="$replay_override_url_trigger",Nu="$replay_override_event_trigger",Bu="$sesid",qu="$session_is_sampled",Hu="$session_past_minimum_duration",$u="$session_recording_url_trigger_activated_session",Uu="$session_recording_event_trigger_activated_session",zu="$posthog_sr_group_event_trigger_",Wu="$posthog_sr_group_url_trigger_",Vu="$posthog_sr_group_sampling_",ju="$debug_first_full_snapshot_timestamp",Gu="$sess_rec_flush_size",Qu="$enabled_feature_flags",Zu="$active_feature_flags",Yu="$early_access_features",Ku="$feature_flag_details",Ju="$feature_flag_payloads",Xu="$feature_flag_request_id",ec="$minimal_flag_called_events",tc="$override_feature_flags",rc="$override_feature_flag_payloads",ic="$stored_person_properties",nc="$stored_group_properties",sc="$surveys",oc="$surveys_loaded_at",ac="$surveys_activated",lc="$surveys_activated_session",uc="ph_product_tours",cc="$flag_call_reported",dc="$flag_call_reported_session_id",hc="$feature_flag_errors",pc="$feature_flag_evaluated_at",_c="$user_state",gc="$client_session_props",vc="$capture_rate_limit",fc="$initial_campaign_params",mc="$initial_referrer_info",yc="$initial_person_info",bc="$epp",Sc="$posthog_cookieless",wc="$cookieless_mode",kc="$sdk_debug_extensions_init_method",xc="$sdk_debug_extensions_init_time_ms",Cc="$sdk_debug_recording_script_not_loaded",Ic="$sdk_debug_replay_event_trigger_status",Ec="$sdk_debug_replay_linked_flag_trigger_status",Tc="$sdk_debug_replay_matched_recording_trigger_groups",Mc="$sdk_debug_replay_remote_trigger_matching_config",Rc="$sdk_debug_replay_trigger_groups_count",Pc="$sdk_debug_replay_url_trigger_status",Fc="$session_recording_start_reason",Lc="PostHog loadExternalDependency extension not found.",Ac="on_reject",Oc="always",Dc="anonymous",Nc="identified",Bc="identified_only",qc="visibilitychange",Hc="beforeunload",$c="$pageview",Uc="$pageleave",zc="$identify",Wc="$groupidentify";Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Br(e)&&isFinite(e)&&Math.floor(e)===e});class Vc{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new Vc(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),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 Vc(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class jc{generate(){var e=this.generateOrAbort();if(!Lr(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Lr(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Vc.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())}constructor(){this._timestamp=0,this._counter=0,this._random=new Zc}}var Gc,Qc=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ss&&!Lr(ss.crypto)&&crypto.getRandomValues&&(Qc=e=>crypto.getRandomValues(e));class Zc{nextUint32(){return this._buffer.length>this._cursor||(Qc(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var Yc=()=>Kc().toString(),Kc=()=>(Gc||(Gc=new jc)).generate(),Jc=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Xc(e,t,r){return Ls({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var ed={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Jc(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Jc(t,e))))),icontains:(e,t)=>t.map(td).some((t=>e.map(td).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(td).every((t=>e.map(td).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r<parseFloat(e)))}))},td=e=>e.toLowerCase(),rd=new Set(["is_not","not_icontains","not_regex"]);function id(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,n=null==i?void 0:i[e.key],s=e.operator||"exact";if(Lr(n)||Dr(n))return rd.has(s);var o=ed[s];return!!o&&!Lr(e.value)&&!Dr(e.value)&&o(Mr(e.value)?e.value.map(String):[String(e.value)],Mr(n)?n.map(String):[String(n)])}))}function nd(e,t){return!e||Object.entries(e).every((e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(Lr(i)||Dr(i))return!1;var n=[String(i)],s=ed[r.operator];return!!s&&s(r.values,n)}))}var sd=e=>{if(ls){try{for(var t=e+"=",r=ls.cookie.split(";").filter((e=>e.length)),i=0;r.length>i;i++){for(var n=r[i];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},od="",ad=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ld={_is_supported:()=>!!ls,_error(e){ys.error("cookieStore error: "+e)},_get:sd,_parse(e){var t;try{t=JSON.parse(ld._get(e))||{}}catch(e){}return t},_set(e,t,r,i,n){if(!ls)return!1;try{var s="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=ls),od)return od;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),n="dmn_chk_"+Yc();!od&&i--;){var s=r.slice(i).join("."),o=n+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(n)&&(t.cookie=o+";max-age=0",od=s)}return od}(e);if(!r){var i=(e=>{var t=e.match(ad);return t?t[0]:""})(e);i!==r&&ys.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(ls.location.hostname,i);if(r){var l=new Date;l.setTime(l.getTime()+864e5*r),s="; expires="+l.toUTCString()}n&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ys.warn("cookieStore warning: large cookie, len="+u.length),ls.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=ls&&ls.cookie)try{ld._set(e,"",-1,t)}catch(e){return}}},ud=null,cd={_is_supported(){if(!Dr(ud))return ud;var e=!0;if(Lr(ss))e=!1;else try{var t="__mplssupport__";cd._set(t,"xyz"),'"xyz"'!==cd._get(t)&&(e=!1),cd._remove(t)}catch(t){e=!1}return e||ys.error("localStorage unsupported; falling back to cookie store"),ud=e,e},_error(e){ys.error("localStorage error: "+e)},_get(e){try{return null==ss?void 0:ss.localStorage.getItem(e)}catch(e){cd._error(e)}return null},_parse(e){try{return JSON.parse(cd._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ss||ss.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){cd._error(e)}return!1},_remove(e){try{null==ss||ss.localStorage.removeItem(e)}catch(e){cd._error(e)}}},dd=[yu,"distinct_id",Bu,qu,bc,yc,_c],hd={},pd={_is_supported:()=>!0,_error(e){ys.error("memoryStorage error: "+e)},_get:e=>hd[e]||null,_parse:e=>hd[e]||null,_set:(e,t)=>(hd[e]=t,!0),_remove(e){delete hd[e]}},_d=null,gd={_is_supported(){if(!Dr(_d))return _d;if(_d=!0,Lr(ss))_d=!1;else try{var e="__support__";gd._set(e,"xyz"),'"xyz"'!==gd._get(e)&&(_d=!1),gd._remove(e)}catch(e){_d=!1}return _d},_error(e){ys.error("sessionStorage error: ",e)},_get(e){try{return null==ss?void 0:ss.sessionStorage.getItem(e)}catch(e){gd._error(e)}return null},_parse(e){try{return JSON.parse(gd._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ss||ss.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){gd._error(e)}return!1},_remove(e){try{null==ss||ss.sessionStorage.removeItem(e)}catch(e){gd._error(e)}}},vd=bs("[Stylesheet Loader]"),fd=ss,md=ls,yd="#020617",bd={fontFamily:"inherit",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:zl.Right,widgetType:Ul.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:yd,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Sd=[zl.Center,zl.Left,zl.Right];function wd(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function kd(e){var t;void 0===e&&(e=bd.backgroundColor),"#"===e[0]&&(t=wd(e)),e.startsWith("rgb")&&(t=e);var r={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()];if(r&&(t=wd(r)),!t)return yd;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var n=parseInt(i[1]),s=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(n*n*.299+s*s*.587+o*o*.114)>127.5?yd:"white"}return yd}var xd=(e,t,i)=>{var n=Ud(e),s=md.querySelector("."+n);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=md.createElement("div");((e,t,i)=>{var n=r({},bd,i),s=e.style,o=!Sd.includes(n.position)||t===Vl.Widget&&(null==i?void 0:i.widgetType)===Ul.Tab;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),o?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",n.borderRadius+" "+n.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||kd(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",kd(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||kd(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",kd(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);var a=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor),l=a||n.inputBackground;a||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);var u=(null==i?void 0:i.inputTextColor)||kd(l);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(o,e.type,e.appearance),o.className=n;var a=o.attachShadow({mode:"open"}),l=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var n=(e=>{var t;return Rr(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return n&&(i=n(i)),i||(vd.error("prepare_external_dependency_stylesheet returned null"),null)})(md,':host{--ph-survey-font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI","Roboto",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:2147483645;--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px rgba(0,0,0,.15);--ph-survey-submit-button-color:#000;--ph-survey-submit-button-text-color:#fff;--ph-survey-rating-bg-color:#fff;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:#000;--ph-survey-rating-active-text-color:#fff;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:#fff;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:rgba(59,130,246,.8);--ph-survey-input-background:#fff;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:0.6}.ph-survey{bottom:0;height:fit-content;margin:0;max-width:85%;min-width:300px;position:fixed;width:var(--ph-survey-max-width);z-index:var(--ph-survey-z-index)}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;color:var(--ph-survey-text-primary-color);font-family:var(--ph-survey-font-family)}.ph-survey .multiple-choice-options label,.ph-survey input[type=text],.ph-survey textarea{background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;color:var(--ph-survey-input-text-color);padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input[type=text],.ph-survey textarea{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus,.ph-survey input[type=radio]:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey textarea:focus,.ph-survey textarea:focus-visible{border-color:var(--ph-survey-rating-active-bg-color);outline:1.5px solid var(--ph-survey-outline-color);outline-offset:2px}.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey textarea:focus:not(:focus-visible){outline:none}.ph-survey input[type=text]:hover:not(:focus),.ph-survey textarea:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey input[type=text],.ph-survey textarea{font-size:1rem}}.ph-survey .form-cancel,.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit,.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey label{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);border:none;border-radius:3px 3px 0 0;color:var(--ph-widget-text-color);cursor:pointer;padding:10px 12px;position:fixed;text-align:center;transition:padding .2s ease-out;z-index:var(--ph-survey-z-index)}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{gap:16px}.bottom-section,.survey-box{display:flex;flex-direction:column}.bottom-section{gap:8px}.thank-you-message-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message{display:flex;flex-direction:column;gap:8px}.survey-question{font-size:14px;font-weight:500}.survey-question-description{font-size:13px;opacity:.8;padding-top:4px}.survey-question-description,.thank-you-message-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body) embed,:is(.survey-question-description,.thank-you-message-body) iframe,:is(.survey-question-description,.thank-you-message-body) img,:is(.survey-question-description,.thank-you-message-body) object,:is(.survey-question-description,.thank-you-message-body) video{height:auto;max-width:100%}:is(.survey-question-description,.thank-you-message-body) svg{height:auto;max-width:100%}.question-textarea-wrapper{display:flex;flex-direction:column}.survey-form{animation:ph-survey-fade-in .3s ease-out forwards}.survey-form,.thank-you-message{background:var(--ph-survey-background-color);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);margin:0;padding:var(--ph-survey-box-padding);position:relative;text-align:left;width:100%;z-index:var(--ph-survey-z-index)}.survey-form input[type=text],.survey-form textarea{min-width:100%}:is(.survey-form textarea):focus,:is(.survey-form textarea):focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.08)}:is(.survey-form textarea):focus:not(:focus-visible){box-shadow:none}:is(.survey-box .question-header--empty)~.multiple-choice-options,:is(.survey-box .question-header--empty)~textarea{margin-top:0}.multiple-choice-options{border:none;display:flex;flex-direction:column;font-size:14px;gap:8px;margin:0;padding:1px 0}.multiple-choice-options .response-choice,.multiple-choice-options label{align-items:center;color:inherit;display:flex;gap:8px}.multiple-choice-options label{cursor:pointer;font-size:13px}:is(.multiple-choice-options label):hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px rgba(0,0,0,.08)}:is(.multiple-choice-options label):has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px rgba(0,0,0,.05)}.choice-option-open:is(.multiple-choice-options label){flex-wrap:wrap}:is(.multiple-choice-options label) span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--ph-survey-input-background);border-radius:3px;cursor:pointer;flex-shrink:0;height:1rem;position:relative;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;width:1rem;z-index:1}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{animation:ph-survey-checkmark-reveal .2s ease-out .1s forwards;border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;height:8px;left:4px;transform:rotate(45deg) scale(0);width:4px}.multiple-choice-options input[type=radio]:checked:after{animation:ph-survey-radio-reveal .15s ease-out .05s forwards;background:var(--ph-survey-rating-active-text-color);border-radius:50%;height:6px;left:5px;top:5px;transform:scale(0);width:6px}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{box-sizing:content-box;content:"";position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}:is(:is(.multiple-choice-options .choice-option-open) input[type=text])::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{display:flex;justify-content:space-between}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{background-color:transparent;border:none;font-size:16px;opacity:.5;padding:0}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;overflow:hidden}.rating-options-number .ratings-number{border:none;border-right:1px solid var(--ph-survey-border-color);color:var(--ph-survey-rating-text-color);cursor:pointer;font-weight:700;text-align:center}:is(.rating-options-number .ratings-number):last-of-type{border-right:0}.rating-active:is(.rating-options-number .ratings-number){background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb,var(--ph-survey-rating-active-bg-color) 14%,var(--ph-survey-rating-bg-color))}}.rating-text{font-size:11px;justify-content:space-between;opacity:.7}.form-buttons,.rating-text{display:flex;flex-direction:row}.form-buttons{gap:8px;width:100%}.form-buttons-with-back>.form-submit{flex:1 1 auto;min-width:0}.form-submit{background:var(--ph-survey-submit-button-color);border:none;border-radius:6px;box-shadow:0 2px 0 rgba(0,0,0,.045);color:var(--ph-survey-submit-button-text-color);cursor:pointer;font-weight:700;min-width:100%;padding:12px;text-align:center;user-select:none}.form-submit:not([disabled]):hover{box-shadow:0 4px 8px rgba(0,0,0,.1);transform:scale(1.02)}.form-submit:not([disabled]):active{box-shadow:0 1px 2px rgba(0,0,0,.05);transform:scale(.98)}.form-submit[disabled]{cursor:not-allowed;opacity:var(--ph-survey-disabled-button-opacity)}.form-back{background:transparent;border:1.5px solid var(--ph-survey-border-color);border-radius:6px;color:var(--ph-survey-text-primary-color);cursor:pointer;flex:0 0 auto;font-weight:600;padding:12px 16px;text-align:center;user-select:none}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{font-size:12px;margin-top:4px;opacity:.7}.form-cancel{background:#fff;border-radius:100%;cursor:pointer;line-height:0;padding:12px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%) scale(1.1)}.footer-branding{align-items:center;display:flex;font-size:11px;font-weight:500;gap:4px;justify-content:center;opacity:.6;text-decoration:none}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{font-size:14px;opacity:.8}.limit-height{max-height:256px;overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);scrollbar-width:thin}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}:is(.limit-height::-webkit-scrollbar-thumb):hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media (prefers-reduced-motion:reduce){.ph-survey *{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg) scale(0)}50%{opacity:1;transform:rotate(45deg) scale(1.2)}to{opacity:1;transform:rotate(45deg) scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(l){var u=a.querySelector("style");u&&a.removeChild(u),a.appendChild(l)}return md.body.appendChild(o),{shadow:a,isNewlyCreated:!0}},Cd=e=>{var t=e.responses,i=e.survey,n=e.surveySubmissionId,s=e.posthog,o=e.isSurveyCompleted,a=e.properties,l=e.surveyLanguage;s?(gu(i),s.capture(Zl.SENT,r({[Yl.SURVEY_NAME]:i.name,[Yl.SURVEY_ID]:i.id,[Yl.SURVEY_ITERATION]:i.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:i.current_iteration_start_date,[Yl.SURVEY_SUBMISSION_ID]:n,[Yl.SURVEY_COMPLETED]:o},l&&{[Yl.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},eu(t,i),a,{$set:{[tu(i,"responded")]:!0}})),o&&(fd.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:i.id}})),$d(i),s.reloadFeatureFlags())):lu.error("[survey sent] event not captured, PostHog instance not found.")},Id=(e,t,i)=>{return r({[Yl.SURVEY_NAME]:e.name,[Yl.SURVEY_ID]:e.id,[Yl.SURVEY_ITERATION]:e.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[Yl.SURVEY_PARTIALLY_COMPLETED]:(n=null==t?void 0:t.responses,void 0===n&&(n={}),Object.values(n).some((e=>!Nr(e))))},(null==t?void 0:t.surveyLanguage)&&{[Yl.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==i.get_session_replay_url?void 0:i.get_session_replay_url(),[Yl.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},eu(null==t?void 0:t.responses,e));var n},Ed=(e,t,i,n)=>{if(t){if(!i){var s=qd(e);t.capture(Zl.DISMISSED,r({},Id(e,s,t),n&&{[Yl.SURVEY_LANGUAGE]:n},{$set:{[tu(e,"dismissed")]:!0}})),$d(e),gu(e),fd.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else lu.error("[survey dismissed] event not captured, PostHog instance not found.")},Td=(e,t)=>{if(t){var r=(e=>pu("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=qd(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Zl.ABANDONED,Id(e,i,t),{transport:"sendBeacon"})}}else lu.error("[survey abandoned] event not captured, PostHog instance not found.")},Md=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Rd=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Pd=e=>e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Rd(e.questions,Md(e.questions)):e.questions,Fd=e=>au(e)||Hd(e),Ld=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach((function(e){e.__e=!0,Qa(e)}))},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Oa++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Ad=()=>Ml(Ld),Od=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,n,s,o,a=Ha({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==s?i=t[s]:"ref"==s?n=t[s]:a[s]=void 0===t[s]&&null!=o?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Sa.call(arguments,2):r),za(e.type,a,i||e.key,n||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Dd(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=Vs(t);if(!n)return!1;var s=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return ed[o](s,[n])}var Nd=e=>pu(hu,e),Bd=(e,t)=>{try{localStorage.setItem(Nd(e),JSON.stringify(t))}catch(e){lu.error("Error setting in-progress survey state in localStorage",e)}},qd=e=>{try{var t=localStorage.getItem(Nd(e));if(t)return JSON.parse(t)}catch(e){lu.error("Error getting in-progress survey state from localStorage",e)}return null},Hd=e=>{var t=qd(e);return!Nr(null==t?void 0:t.surveySubmissionId)},$d=e=>{try{localStorage.removeItem(Nd(e))}catch(e){lu.error("Error clearing in-progress survey state from localStorage",e)}};function Ud(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function zd(e,t,r){if(void 0===t&&(t=zl.Right),e===Vl.ExternalSurvey)return{};switch(t){case zl.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case zl.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case zl.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case zl.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case zl.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case zl.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case zl.Left:return{left:"30px"};case zl.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Vl.Widget&&r===Ul.Tab?"60px":"30px"}}}var Wd=0;function Vd(e,t,r,i,n,s){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Wd,__i:-1,__u:0,__source:n,__self:s};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return wa.vnode&&wa.vnode(u),u}var jd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Gd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Qd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Zd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Yd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Vd("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"})}),Kd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Vd("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Jd=Vd("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Vd("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Xd=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return Vd("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:r,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Vd("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Vd("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:r})]})},eh=Vd("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Vd("g",{"clip-path":"url(#clip0_2415_6911)",children:[Vd("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Vd("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Vd("g",{mask:"url(#mask0_2415_6911)",children:[Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"}),Vd("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"})]})]}),Vd("defs",{children:Vd("clipPath",{id:"clip0_2415_6911",children:Vd("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function th(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return Vd("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",eh]})}function rh(e){var t=e.text,r=e.submitDisabled,i=e.appearance,n=e.onSubmit,s=e.link,o=e.onPreviewSubmit,a=e.skipSubmitButton,l=e.canGoBack,u=e.onBack,c=Ml(Ld).isPreviewMode,d=!!l&&!!u,h=!a&&Vd("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){s&&(null==ss||ss.open(s)),c?null==o||o():n()},children:t});return Vd("div",{className:"bottom-section",children:[d?Vd("div",{className:"form-buttons form-buttons-with-back",children:[Vd("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&Vd(th,{urlParams:{utm_source:"survey-footer"}})]})}function ih(e){var t=e.question,r=e.forceDisableHtml;return Vd("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Vd(t.type===jl.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&Od({component:Ua("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function nh(e){return Vd("button",{className:"form-cancel",onClick:e.onClick,disabled:Ml(Ld).isPreviewMode,"aria-label":"Close survey",type:"button",children:Xd({fill:"black"})})}Vd("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Vd("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"})});var sh=ss;function oh(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onClose,a=Ml(Ld).isPopup;return Il((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Rs(sh,"keydown",e),()=>{sh.removeEventListener("keydown",e)}}),[o]),Vd("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&Vd(nh,{onClick:()=>o()}),Vd("h3",{className:"thank-you-message-header",children:t}),r&&Od({component:Ua("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&Vd(rh,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}var ah=e=>Mr(e)&&e.every((e=>Ar(e)));function lh(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,n=e.onSubmit,s=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=Ad().isPreviewMode,d=El(null),h=Cl((()=>Ar(a)?a:"")),p=h[0],_=h[1],g=null==i?void 0:i.disableAutofocus;Il((()=>{g||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,g]);var v="surveyQuestion"+o,f=Tl((()=>function(e,t,r){var i,n,s=e.trim();if(!r&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case ar:if(void 0!==o.value&&o.value>s.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case lr:if(void 0!==o.value&&s.length>o.value)return null!==(n=o.errorMessage)&&void 0!==n?n:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=kn(t.validation,ar),y=kn(t.validation,lr),b=Tl((()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y)),[m,y]),S=()=>{f||n(p.trim())},w=()=>{f||s(p.trim())};return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:t,forceDisableHtml:r,htmlFor:v}),Vd("textarea",{ref:d,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){_(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),c?w():S())},value:p}),b&&Vd("div",{className:"validation-hint",children:b})]}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function uh(e){var t=e.question,r=e.appearance,i=e.onSubmit,n=e.onPreviewSubmit,s=e.canGoBack,o=e.onBack;return Vd(Wa,{children:[Vd("div",{className:"question-container",children:Vd(ih,{question:t,forceDisableHtml:e.forceDisableHtml})}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:s,onBack:o})]})}function ch(e){var t,r=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=r.scale,h=10===r.scale?0:1,p=Cl((()=>Br(l)?l:Mr(l)&&l.length>0&&Br(parseInt(l[0]))?parseInt(l[0]):Ar(l)&&Br(parseInt(l))?parseInt(l):null)),_=p[0],g=p[1],v="emoji"===r.display&&2===r.scale,f=Ad().isPreviewMode,m=e=>f?a(e):o(e);return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:r,forceDisableHtml:i}),Vd("div",{className:"rating-section",children:[Vd("div",{className:"rating-options",children:["emoji"===r.display&&Vd("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=vh[r.scale])?void 0:t.map(((e,t)=>Vd("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===_?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;g(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&Vd("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:fh(r.scale).map(((e,t)=>Vd(dh,{displayQuestionIndex:n,active:_===e,appearance:s,num:e,setActiveNumber(e){g(e),r.skipSubmitButton&&m(e)}},t)))})]}),!v&&Vd("div",{className:"rating-text",children:[Vd("div",{children:r.lowerBoundLabel}),Vd("div",{children:r.upperBoundLabel})]})]})]}),Vd(rh,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Dr(_)&&!r.optional,appearance:s,onSubmit:()=>o(_),onPreviewSubmit:()=>a(_),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function dh(e){var t=e.num,r=e.setActiveNumber;return Vd("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function hh(e){var t=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=El(null),h=Tl((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Rd(t,Md(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),p=Cl((()=>((e,t)=>Ar(e)||ah(e)?e:t===jl.SingleChoice?null:[])(l,t.type))),_=p[0],g=p[1],v=Cl((()=>((e,t)=>{if(Ar(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(ah(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h))),f=v[0],m=v[1],y=Ad().isPreviewMode,b=t.type===jl.SingleChoice,S=t.type===jl.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var i=!f.isSelected;return m((e=>r({},e,{isSelected:i,inputValue:i?e.inputValue:""}))),b&&g(""),void(i&&setTimeout((()=>{var e;return null==(e=d.current)?void 0:e.focus()}),75))}if(b)return g(e),m((e=>r({},e,{isSelected:!1,inputValue:""}))),void(w&&(o(e),y&&a(e)));S&&Mr(_)&&(_.includes(e)?g(_.filter((t=>t!==e))):g([..._,e]))},x=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>r({},e,{inputValue:t}))),b&&g(t)},C=e=>{e.stopPropagation(),"Enter"!==e.key||I()||(e.preventDefault(),E()),"Escape"===e.key&&(e.preventDefault(),m((e=>r({},e,{isSelected:!1,inputValue:""}))),b&&g(null))},I=()=>!(t.optional||!Dr(_)&&(!Mr(_)||f.isSelected||0!==_.length)&&(!f.isSelected||""!==f.inputValue.trim())),E=()=>{f.isSelected&&S?Mr(_)&&(y?a([..._,f.inputValue]):o([..._,f.inputValue])):y?a(_):o(_)};return Vd(Wa,{children:[Vd("div",{className:"question-container",children:[Vd(ih,{question:t,forceDisableHtml:i}),Vd("fieldset",{className:"multiple-choice-options limit-height",children:[Vd("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),h.map(((e,r)=>{var i=!!t.hasOpenChoice&&r===t.choices.length-1,s="surveyQuestion"+n+"Choice"+r,o=s+"Open",a=i?f.isSelected:b?_===e:Mr(_)&&_.includes(e);return Vd("label",{className:i?"choice-option-open":"",children:[Vd("div",{className:"response-choice",children:[Vd("input",{type:b?"radio":"checkbox",name:s,checked:a,onChange:()=>k(e,i),id:s,"aria-controls":o}),Vd("span",{children:i?e+":":e})]}),i&&Vd("input",{type:"text",ref:d,id:o,name:"question"+n+"Open",value:f.inputValue,onKeyDown:C,onInput:x,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),Vd(rh,{text:t.buttonText||"Submit",submitDisabled:I(),appearance:s,onSubmit:E,onPreviewSubmit:E,skipSubmitButton:w,canGoBack:u,onBack:c})]})}var ph=[1,2,3,4,5],_h=[1,2,3,4,5,6,7],gh=[0,1,2,3,4,5,6,7,8,9,10],vh={2:[Kd,Jd],3:[Qd,Gd,jd],5:[Zd,Qd,Gd,jd,Yd]};function fh(e){switch(e){case 5:default:return ph;case 7:return _h;case 10:return gh}}var mh=bs("[Surveys]");function yh(e,t,r){var i,n=e.questions[t],s=t+1;if(null==(i=n.branching)||!i.type)return t===e.questions.length-1?Gl.End:s;if(n.branching.type===Gl.End)return Gl.End;if(n.branching.type===Gl.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===Gl.ResponseBased){if(n.type===jl.SingleChoice){var o,a=n.choices.indexOf(""+r);if(-1===a&&n.hasOpenChoice&&(a=n.choices.length-1),null!=(o=n.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=n.branching.responseValues[a];return Number.isInteger(l)?l:l===Gl.End?Gl.End:s}}else if(n.type===jl.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var c=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||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(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,n.scale);if(null!=(u=n.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=n.branching.responseValues[c];return Number.isInteger(d)?d:d===Gl.End?Gl.End:s}}return s}return mh.warn("Falling back to next question index due to unexpected branching type"),s}var bh="https?://(.*)",Sh=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],wh=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Sh],kh="<masked>",xh=["li_fat_id"];function Ch(e,t,r){if(!ls)return{};var i,n=t?[...Sh,...r||[]]:[],s=Ih(Ns(ls.URL,n,kh),e),o=(i={},ws(xh,(function(e){var t=sd(e);i[e]=t||null})),i);return ks(o,s)}function Ih(e,t){var r=wh.concat(t||[]),i={};return ws(r,(function(t){var r=Ds(e,t);i[t]=r||null})),i}function Eh(e){var t=function(e){return e?0===e.search(bh+"google.([^/?]*)")?"google":0===e.search(bh+"bing.com")?"bing":0===e.search(bh+"yahoo.com")?"yahoo":0===e.search(bh+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Dr(t)){i.$search_engine=t;var n=ls?Ds(ls.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function Th(){return navigator.language||navigator.userLanguage}var Mh="$direct";function Rh(){return(null==ls?void 0:ls.referrer)||Mh}function Ph(e,t,r){void 0===r&&(r=!1);var i=e?[...Sh,...t||[]]:[],n=r?on(null==us?void 0:us.href):null==us?void 0:us.href,s=null==n?void 0:n.substring(0,1e3);return{r:Rh().substring(0,1e3),u:s?Ns(s,i,kh):void 0}}function Fh(e,t){var r;void 0===t&&(t=!1);var i=e.r,n=e.u,s=t?on(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==Mh?Mh:null==(r=As(i))?void 0:r.host};if(s){o.$current_url=s;var a=As(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Ih(s);ks(o,l)}if(i){var u=Eh(i);ks(o,u)}return o}function Lh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ah(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Oh=bs("[SurveyTranslations]");function Dh(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,n=ru(e.overrideLanguage);if(n)return null==t||t.info("Using override display language: "+n),n;var s=function(e){return e&&"object"==typeof e&&"language"in e?ru(e.language):null}(r);if(s)return null==t||t.info("Using person property language: "+s),s;var o=ru(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Rr(e.get_property)?e.get_property(ic):void 0,locale:Th()},Oh)}(t);if(!r)return Oh.info("No user language detected"),{survey:e,language:null};var i=su(e,r,Oh);return{survey:i.survey,language:i.matchedKey}}var Nh=ss,Bh=ls,qh="ph:show_survey_widget",Hh="PHWidgetSurveyClickListener";function $h(e,t){try{var r=e.getBoundingClientRect(),i=Nh.innerHeight,n=Nh.innerWidth,s=r.left+r.width/2-t/2;s+t>n-20&&(s=n-t-20),20>s&&(s=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:s+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:bd.zIndex}}catch(e){return lu.warn("Failed to calculate trigger position:",e),null}}class Uh{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._prefillHandledSurveys=new Set,this.handlePageUnload=()=>{var e=this._posthog.get_property(sc);if(e)for(var t of e)Hd(t)&&Td(t,this._posthog)},this.handlePopoverSurvey=(e,t)=>{var i,n,s,o,a=this._translateSurveyForRendering(e),l=a.survey,u=a.language,c=null!=t&&t.position||null!=t&&t.selector?r({},l,{appearance:r({},l.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):l;this._clearSurveyTimeout(c.id);var d=null!=t?t:{},h=d.properties,p=d.initialResponses,_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(c,p,h,u);if(!_||null!=(i=c.appearance)&&i.displayThankYouMessage){this._addSurveyToFocus(c);var g={};if((null==(n=c.appearance)?void 0:n.position)===zl.NextToTrigger&&null!=(s=c.appearance)&&s.widgetSelector){var v,f=Bh.querySelector(c.appearance.widgetSelector);f&&(g=$h(f,parseInt((null==(v=c.appearance)?void 0:v.maxWidth)||bd.maxWidth))||{})}var m=(null==(o=c.appearance)?void 0:o.surveyPopupDelaySeconds)||0,y=xd(c,this._posthog).shadow,b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(0>=m)return cl(Vd(jh,r({},b)),y);var S=setTimeout((()=>{if(this._surveyTimeouts.delete(c.id),!this._shouldDisplaySurvey(c))return lu.info("Survey "+c.id+" no longer eligible when its display delay elapsed; not displaying"),this._removeSurveyFromFocus(c);cl(Vd(jh,r({},b,{survey:r({},c,{appearance:r({},c.appearance,{surveyPopupDelaySeconds:0})})})),y)}),1e3*m);this._surveyTimeouts.set(c.id,S)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xd(r,this._posthog),s=n.shadow;n.isNewlyCreated&&cl(Vd(Qh,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),s)},this._removeWidgetSelectorListener=e=>{this._removeSurveyFromDom(e);var t=this._widgetSelectorListeners.get(e.id);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Hh),this._widgetSelectorListeners.delete(e.id),lu.info("Removed click listener for survey "+e.id))},this._manageWidgetSelectorListener=(e,t)=>{var r=Bh.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;lu.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._removeWidgetSelectorListener(e)}if(!r.hasAttribute(Hh)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===zl.NextToTrigger?$h(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||bd.maxWidth)):{};Nh.dispatchEvent(new CustomEvent(qh,{detail:{surveyId:e.id,position:n}}))};Rs(r,"click",n),r.setAttribute(Hh,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),lu.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xd(r,this._posthog).shadow;cl(Vd(jh,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),n)},this.renderSurvey=(e,t,r)=>{var i,n=this._translateSurveyForRendering(e),s=n.survey,o=n.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(s,o,r)),cl(Vd(jh,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys((r=>{var i=r.filter((e=>t._shouldDisplaySurvey(e)));e(i)}),r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys((e=>{var r=e.filter((e=>e.type===Vl.Popover||e.type===Vl.Widget)),i=new Set(r.map((e=>e.id)));for(var n of Array.from(t._surveyTimeouts.keys()))i.has(n)||t.cancelSurvey(n);var s=t._sortSurveysByAppearanceDelay(r),o=new Set;s.forEach((e=>{if(e.type===Vl.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===Ul.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Ul.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}Dr(t._surveyInFocus)&&e.type===Vl.Popover&&t.handlePopoverSurvey(e)})),t._widgetSelectorListeners.forEach((e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{Dr(this._surveyInFocus)||lu.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&lu.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(lu.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null))}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,n=Hd(e),s=Hd(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===Ql,a=t.schedule===Ql;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)}))}_translateSurveyForRendering(e){return Dh(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=e.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var o=s.split("="),a=o[0],l=o[1];if(a&&!Lr(l)){var u=decodeURIComponent(a),c=decodeURIComponent(l);if("auto_submit"!==u||"true"!==c){var d=u.match(/^q(\d+)$/);if(d){var h=parseInt(d[1],10);t[h]||(t[h]=[]),t[h].push(c)}}else r=!0}}return{params:t,autoSubmit:r}}(Nh.location.search),n=i.params;if(0===Object.keys(n).length)return!1;lu.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,n,t);if(!s)return!1;var o=s.responses,a=s.submissionId,l=s.isSurveyCompleted,u=s.skippedResponses;return(Object.keys(u).length>0&&e.enable_partial_responses||l)&&Cd({responses:l?o:u,survey:e,surveySubmissionId:a,posthog:this._posthog,isSurveyCompleted:l,properties:r,surveyLanguage:t}),this._prefillHandledSurveys.add(e.id),l}_handleInitialResponses(e,t,r,i){var n={};for(var s of Object.entries(t)){var o=s[1];n[parseInt(s[0])]=Mr(o)?o.map(String):[String(o)]}lu.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);if(!a)return!1;var l=a.isSurveyCompleted;return Cd({responses:a.responses,survey:e,surveySubmissionId:a.submissionId,posthog:this._posthog,isSurveyCompleted:l,properties:r,surveyLanguage:i}),l}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach(((e,i)=>{if(t[i]&&e.id){var n=t[i],s=Jl(e.id);try{switch(e.type){case jl.SingleChoice:if(!e.choices||0===e.choices.length)return void ys.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(n[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void ys.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case jl.MultipleChoice:if(!e.choices||0===e.choices.length)return void ys.warn("[Survey Prefill] Question "+i+" has no choices");var a=n.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void ys.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&ys.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case jl.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void ys.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:ys.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){ys.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return lu.warn("[Survey Prefill] No valid responses after conversion"),null;var n=Yc(),s=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,n={},s=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=Jl(l.id);Lr(r[u])||(n[u]=r[u])}s.push(i);var c=yh(e,i,l.id?r[Jl(l.id)]:null);if(c===Gl.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:s};i=c}return{startQuestionIndex:i,skippedResponses:n,skippedIndices:s}}(e,s,i),a=o.startQuestionIndex,l=o.skippedResponses,u=a>=e.questions.length;return Bd(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:a,visitedIndices:o.skippedIndices,surveyLanguage:r}),lu.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:a,isSurveyCompleted:u,skippedResponses:l}}catch(e){return lu.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){var r;if(void 0===t&&(t=void 0),!e)return!0;var i,n=!(null==(r=this._posthog.featureFlags)||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),s=!0;return t&&(s=(null==(i=this._posthog.featureFlags)?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),n&&s}_isSurveyConditionMatched(e){return!e.conditions||Dd(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,n;if(!e||0===e.length)return!0;if(!_s)return!1;var s=rn(_s,{userAgentDataPlatform:null==as||null==(r=as.userAgentData)?void 0:r.platform,maxTouchPoints:null==as?void 0:as.maxTouchPoints,screenWidth:null==ss||null==(i=ss.screen)?void 0:i.width,screenHeight:null==ss||null==(n=ss.screen)?void 0:n.height,devicePixelRatio:null==ss?void 0:ss.devicePixelRatio});return ed[null!=t?t:"icontains"](e,[s])}(null==(t=e.conditions)?void 0:t.deviceTypes,null==(r=e.conditions)?void 0:r.deviceTypesMatchType)}(e)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==md||!md.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Fd(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._posthog.featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!uu(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!vu.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var n=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var s,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=new Date,n=Math.abs(i.getTime()-r.getTime());return Math.ceil(n/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,cd._get("lastSeenSurveyDate"))?(e=>!!cd._get(_u(e))&&!Fd(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(s=o.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!ou(e)&&!cu(e))return!0;var r=null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)?void 0:t.getSurveys();return!(null==r||!r.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every((e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=Bh.querySelector(Ud(e,!0));null!=t&&t.shadowRoot&&cl(null,t.shadowRoot),null==t||t.remove()}catch(t){lu.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this)}}}function zh(e,t){if(Bh&&Nh){var r,i=new Uh(e);if(e.config.disable_surveys_automatic_display)return lu.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return lu.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{Lr(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))};return n(),Rs(Bh,"visibilitychange",(()=>{Bh.hidden?Lr(r)||(clearInterval(r),r=void 0):(i.callSurveysAndEvaluateDisplayLogic(!1),n())})),i}}function Wh(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,n=e.setSurveyVisible,s=e.isPreviewMode,o=void 0!==s&&s,a=e.posthog;Il((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===Vl.Widget,s=Dd(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===Ul.Tab&&r;if(!s)return lu.info("Hiding survey "+t.id+" because URL does not match"),n(!1),i(t);o&&(lu.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),n(!0))};Rs(Nh,"popstate",r),Rs(Nh,"hashchange",r);var s=Nh.history.pushState,l=Nh.history.replaceState;return Nh.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.apply(this,t),r()},Nh.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{Nh.removeEventListener("popstate",r),Nh.removeEventListener("hashchange",r),Nh.history.pushState=s,Nh.history.replaceState=l}}}),[o,t,i,n,a])}function Vh(e){switch(void 0===e&&(e=Wl.Right),e){case Wl.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Wl.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Wl.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function jh(e){var t,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.style,h=void 0===d?{}:d,p=e.previewPageIndex,_=e.removeSurveyFromFocus,g=void 0===_?()=>{}:_,v=e.isPopup,f=void 0===v||v,m=e.onPreviewSubmit,y=void 0===m?()=>{}:m,b=e.onPreviewBack,S=void 0===b?()=>{}:b,w=e.onPopupSurveyDismissed,k=void 0===w?()=>{}:w,x=e.onCloseConfirmationMessage,C=void 0===x?()=>{}:x,I=e.properties,E=e.isSurveyCompleted,T=e.skipShownEvent,M=e.surveyLanguage,R=El(null),P=Number.isInteger(p),F=null!=(t=l.appearance)&&t.surveyPopupDelaySeconds?1e3*l.appearance.surveyPopupDelaySeconds:0,L=function(e,t,i,n,s,o,a,l,u){var c=Cl(n||0===i||e.type===Vl.ExternalSurvey),d=c[0],h=c[1],p=Cl(!1),_=p[0],g=p[1],v=()=>{var t=()=>{o&&s(e),h(!1)};Bh.startViewTransition?Bh.startViewTransition((()=>{var e;null==a||null==(e=a.current)||e.remove()})).finished.then((()=>{setTimeout((()=>{t()}),100)})):t()},f=t=>{t.detail.surveyId===e.id&&v()};return Il((()=>{if(t){if(!n){var s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return v();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&setTimeout((()=>{v()}),5e3)}},o=()=>{if(Dd(e,t)){h(!0),Nh.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(Zl.SHOWN,r({[Yl.SURVEY_NAME]:e.name,[Yl.SURVEY_ID]:e.id,[Yl.SURVEY_ITERATION]:e.current_iteration,[Yl.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[Yl.SURVEY_LANGUAGE]:u},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};if(Rs(Nh,"PHSurveyClosed",f),Rs(Nh,"PHSurveySent",s),i>0){var a=setTimeout(o,i);return()=>{clearTimeout(a),Nh.removeEventListener("PHSurveyClosed",f),Nh.removeEventListener("PHSurveySent",s)}}return o(),()=>{Nh.removeEventListener("PHSurveyClosed",f),Nh.removeEventListener("PHSurveySent",s)}}}else lu.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Wh({survey:e,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:t}),{isPopupVisible:d,isSurveySent:_,setIsPopupVisible:h,hidePopupWithViewTransition:v}}(l,c,F,P,g,f,R,T,M),A=L.isPopupVisible,O=L.hidePopupWithViewTransition,D=L.isSurveySent||p===l.questions.length||!0===E,N=Tl((()=>{var e=qd(l),t=(null==e?void 0:e.surveySubmissionId)||Yc();return{isPreviewMode:P,previewPageIndex:p,onPopupSurveyDismissed(){M?Ed(l,c,P,M):Ed(l,c,P),k()},isPopup:f||!1,surveySubmissionId:t,onPreviewSubmit:y,onPreviewBack:S,posthog:c,properties:I,surveyLanguage:M}}),[P,p,f,c,l,k,y,S,I,M]);return A?Vd(Ld.Provider,{value:N,children:Vd("div",{className:"ph-survey",style:r({},zd(l.type,null==(i=l.appearance)?void 0:i.position,null==(n=l.appearance)?void 0:n.widgetType),h),ref:R,children:D?Vd(oh,{header:(null==(s=l.appearance)?void 0:s.thankYouMessageHeader)||"Thank you!",description:(null==(o=l.appearance)?void 0:o.thankYouMessageDescription)||"",forceDisableHtml:!!u,contentType:null==(a=l.appearance)?void 0:a.thankYouMessageDescriptionContentType,appearance:l.appearance||bd,onClose(){O(),C()}}):Vd(Gh,{survey:l,forceDisableHtml:!!u,posthog:c})})}):null}function Gh(e){var t,i,n=e.survey,s=e.forceDisableHtml,o=e.posthog,a=Cl((()=>{var e=qd(n);return null!=e&&e.responses&&lu.info("Survey is already in progress, filling in initial responses"),(null==e?void 0:e.responses)||{}})),l=a[0],u=a[1],c=Ml(Ld),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,_=c.onPreviewSubmit,g=c.onPreviewBack,v=c.surveySubmissionId,f=c.isPreviewMode,m=c.properties,y=c.surveyLanguage,b=Cl((()=>{var e=qd(n);return d||(null==e?void 0:e.lastQuestionIndex)||0})),S=b[0],w=b[1],k=Cl((()=>{var e,t=qd(n);return null!==(e=null==t?void 0:t.visitedIndices)&&void 0!==e?e:[]})),x=k[0],C=k[1],I=Tl((()=>Pd(n)),[n]);Il((()=>{f&&!Lr(d)&&w(d)}),[d,f]);var E=!(null==(t=n.appearance)||!t.allowGoBack)&&(f?(null!=d?d:0)>0:x.length>0),T=I.at(S);return T?Vd("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(i=n.appearance)?void 0:i.hideCancelButton)&&Vd(nh,{onClick(){h()}}),Vd("div",{className:"survey-box","data-question-index":S,children:Zh({question:T,forceDisableHtml:s,displayQuestionIndex:S,appearance:n.appearance||bd,onSubmit:e=>(e=>{var t=e.res,i=e.displayQuestionIndex,s=e.questionId;if(o)if(s){var a=Jl(s),c=r({},l,{[a]:t});u(c);var d=yh(n,i,t),h=d===Gl.End,p=[...x,i];if(h||(C(p),w(d),Bd(n,{surveySubmissionId:v,responses:c,lastQuestionIndex:d,visitedIndices:p,surveyLanguage:y})),n.enable_partial_responses||h){var _=new Set(p.map((e=>{var t;return null==(t=I[e])?void 0:t.id})).filter((e=>!!e)).map((e=>Jl(e)))),g=Object.fromEntries(Object.entries(c).filter((e=>_.has(e[0]))));Cd({responses:g,survey:n,surveySubmissionId:v,isSurveyCompleted:h,posthog:o,properties:m,surveyLanguage:y})}}else lu.error("onNextButtonClick called without a questionId.");else lu.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:S,questionId:T.id}),onPreviewSubmit:_,initialValue:T.id?l[Jl(T.id)]:void 0,canGoBack:E,onBack(){if(f)g();else if(0!==x.length){var e=x[x.length-1],t=x.slice(0,-1);C(t),w(e),Bd(n,{surveySubmissionId:v,responses:l,lastQuestionIndex:e,visitedIndices:t,surveyLanguage:y})}}})})]}):null}function Qh(e){var t,r,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=Cl(!0),_=p[0],g=p[1],v=Cl(!1),f=v[0],m=v[1],y=Cl({}),b=y[0],S=y[1],w=()=>{m(!f)};if(Il((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(lu.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),w())};return Rs(Nh,qh,t),()=>{Nh.removeEventListener(qh,t)}}}else lu.error("FeedbackWidget called without a PostHog instance.")}),[c,d,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),Wh({survey:l,setSurveyVisible:g,posthog:c}),!_)return null;var k=()=>{l.schedule!==Ql&&g(!1),setTimeout((()=>{m(!1)}),200)};return Vd(Wa,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&Vd("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===Wl.Top?"widget-tab-top":""),onClick:w,disabled:d,style:Vh(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Vd(jh,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:k,onCloseConfirmationMessage:k,surveyLanguage:h})]})}var Zh=e=>{var t=e.question,i=e.onSubmit,n=e.onPreviewSubmit,s={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){n(e)},onSubmit(e){i(e)},initialValue:e.initialValue,displayQuestionIndex:e.displayQuestionIndex,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case jl.Open:return Ua(lh,r({},s,{question:t,key:t.id}));case jl.Link:return Ua(uh,r({},s,{question:t,key:t.id}));case jl.Rating:return Ua(ch,r({},s,{question:t,key:t.id}));case jl.SingleChoice:case jl.MultipleChoice:return Ua(hh,r({},s,{question:t,key:t.id}));default:return lu.error("Unsupported question type: "+t.type),null}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.generateSurveys=zh,ba.extendPostHogWithSurveys=zh;var Yh=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),Kh=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return Yh(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var n=0,s=Math.min(e.length,r.remaining-2);s>n;){var o=Math.ceil((n+s)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?s=o-1:n=o}return Yh(t,JSON.stringify(e.slice(0,n)),r)},Jh=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Xh=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},ep=(e,t,r)=>{if(!r.truncated)if(Pr(e)){if(r.seen.has(e))return void Xh(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(ep(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else Xh(t,e,r)},tp=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!Jh(e))return!n||Yh(t,"null",r);if(Dr(e)||(e=>{try{return Br(e)||Hr(e)}catch(e){return!1}})(e))return Yh(t,JSON.stringify(e),r);if("string"==typeof e)return Kh(e,t,r);if(!Pr(e)&&!Mr(e))return Yh(t,JSON.stringify(e),r);if(i.has(e))return Kh("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Rr(o))return tp(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return Kh(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return Yh(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return tp(l,t,r,i,n,s)}if(Mr(e)){if(!Yh(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!Yh(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!tp(d,t,r,i,!0))return!1}return Yh(t,"]",r)}if(!Yh(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var _=void 0;try{_=e[p]}catch(e){continue}if(s)try{ep(_,p,s)}catch(e){}if(Jh(_)){var g=(h?"":",")+JSON.stringify(p)+":";if(g.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!Yh(t,g,r))return!1;var y=t.length,b=tp(_,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return Yh(t,"}",r)},rp={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.logs={initializeLogs(e){var t={host:ba.location.host},i=!1,n=function(n){var s=ba.console[n],o=(s=>function(){for(var o=!1,a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];try{if(l.length>0&&!i&&e.is_capturing()){var c;i=!0,o=!0;var d=((e,t)=>{for(var r=[],i={remaining:1e4,truncated:!1},n=Pr(e[0])?{result:{},keysRemaining:50,sizeRemaining:1e4,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||Yh(r," ",i))&&tp(e[s],r,i,new WeakSet,!1,0===s?n:void 0);s++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==n?void 0:n.result)||{}}})(l),h=d.body,p=d.attributes,_=r({},t,d.truncated?{body_truncated:"true"}:{});null==(c=e.logs)||c._captureConsoleLog({level:rp[n],body:h,attributes:r({"log.source":"console."+n},_,p)})}}catch(e){}finally{o&&(i=!1),s.apply(ba.console,l)}})(s);o.__rrweb_original__=(e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e})(s),ba.console[n]=o};for(var s of Object.keys(rp))n(s)}};var ip=bs("[Error tracking]");function np(){return new Tn([new $n,new Kn,new zn,new Un,new Zn,new Qn,new Vn,new Yn],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];return function(t,n){void 0===n&&(n=0);for(var s=[],o=t.split("\n"),a=n;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=qn.test(l)?l.replace(qn,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of i){var d=c(u,e);if(d){s.push(d);break}}if(s.length>=Hn)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Hn).map((e=>{return r({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||Mn});var i}))}(s)}}("web:javascript",On,Bn))}var sp=bs("[ExceptionAutocapture]"),op=np(),ap={wrapOnError(e){var t=ss;t||sp.info("window not available, cannot wrap onerror");var r=t.onerror;return t.onerror=function(){var t,i=op.buildFromUnknown((arguments.length>4?arguments[4]:void 0)||(arguments.length>0?arguments[0]:void 0),{mechanism:{handled:!1}});return e(i),!!Rr(r)&&null!==(t=r(...arguments))&&void 0!==t&&t},t.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.onerror)||delete e.__POSTHOG_INSTRUMENTED__,t.onerror=r}},wrapUnhandledRejection(e){var t=ss;t||sp.info("window not available, cannot wrap onUnhandledRejection");var r=t.onunhandledrejection;return t.onunhandledrejection=function(t){var i,n=op.buildFromUnknown(t,{mechanism:{handled:!1}});return e(n),!!Rr(r)&&null!==(i=r(t))&&void 0!==i&&i},t.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,t.onunhandledrejection=r}},wrapConsoleError(e){var t=console;t||sp.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];t=1==n.length?n[0]:n.join(" ");var o=n.find((e=>e instanceof Error)),a=op.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),Rr(r)&&r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.errorWrappingFunctions=ap,ba.posthogErrorWrappingFunctions=ap;var lp="X-POSTHOG-SESSION-ID",up="X-POSTHOG-WINDOW-ID",cp="X-POSTHOG-DISTINCT-ID",dp=[lp,up,cp],hp=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],pp=(e,t)=>({}.hasOwnProperty.call(e,t)),_p=e=>"object"==typeof e&&!Dr(e)||Rr(e),gp=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),vp=e=>{try{var t;return gp(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==ss||null==(t=ss.location)?void 0:t.href).toString()}catch(e){return}},fp=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(Mr(e)&&!e.includes(s))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;n.set(lp,a.sessionId),n.set(up,l),o=!0}var u=(e=>Rr(e)?e():e)(t);return u&&u!==Sc&&(n.set(cp,u),o=!0),o};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{};var mp={_patchFetch:(e,t,i)=>Us(ss,"fetch",(n=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=vp(s);if(u)if(gp(s)){var c=new Request(s,o);fp(e,t,i,c.url,c.headers),l=[c]}else{var d=new Headers(_p(o)?o.headers:void 0);if(fp(e,t,i,u,d)){var h=((e,t)=>{if(Lr(e)||Dr(e))return{headers:t};if(_p(e)){var i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var n=Object.create(i);return Object.defineProperty(n,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),n}return new Proxy({headers:t},{get:(e,t)=>pp(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>pp(e,t)||t in i,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach((e=>t.add(e))),hp.forEach((e=>{e in i&&t.add(e)})),Array.from(t)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n)return n;if("string"==typeof t&&hp.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};var s=Reflect.getOwnPropertyDescriptor(i,t);return s?r({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})}})(o,d);h&&(l=[s,h])}}}catch(e){l=a}return n.apply(this,l)})),_patchXHR:(e,t,r)=>Us(ss.XMLHttpRequest.prototype,"open",(i=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=vp(s);d&&fp(e,t,r,d,c);var h=i.call(u,n,s,o,a,l);return dp.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};ba.__PosthogExtensions__.tracingHeadersPatchFns=mp,ba.postHogTracingHeadersPatchFns=mp,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0});var yp=-1,bp=e=>{addEventListener("pageshow",(t=>{t.persisted&&(yp=t.timeStamp,e(t))}),!0)},Sp=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},wp=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},kp=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},xp=()=>{var e,t;return null!==(e=null==(t=kp())?void 0:t.activationStart)&&void 0!==e?e:0},Cp=function(e,t){void 0===t&&(t=-1);var r=kp(),i="navigate";return 0>yp?r&&(document.prerendering||xp()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Ip=new WeakMap;function Ep(e,t){var r=Ip.get(t);return r||(r=new WeakMap,Ip.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Tp{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}}var Mp,Rp=function(e,t,i){void 0===i&&(i={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return n.observe(r({type:e,buffered:!0},i)),n}}catch(e){}},Pp=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Fp=-1,Lp=new Set,Ap=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Op=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Lp)t();isFinite(Fp)||(Fp="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Op,!0))}},Dp=()=>{if(0>Fp){var e,t=xp(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Fp=null!=r?r:Ap(),addEventListener("visibilitychange",Op,!0),addEventListener("prerenderingchange",Op,!0),bp((()=>{setTimeout((()=>{Fp=Ap()}))}))}return{get firstHiddenTime(){return Fp},onHidden(e){Lp.add(e)}}},Np=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Bp=[1800,3e3],qp=function(e,t){void 0===t&&(t={}),Np((()=>{var r,i=Dp(),n=Cp("FCP"),s=Rp("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-xp(),0),n.entries.push(t),r(!0)))}));s&&(r=Sp(e,n,Bp,t.reportAllChanges),bp((i=>{n=Cp("FCP"),r=Sp(e,n,Bp,t.reportAllChanges),wp((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},Hp=[.1,.25],$p=0,Up=1/0,zp=0,Wp=e=>{for(var t of e)t.interactionId&&(Up=Math.min(Up,t.interactionId),zp=Math.max(zp,t.interactionId),$p=zp?(zp-Up)/7+1:0)},Vp=()=>{var e;return Mp?$p:null!==(e=performance.interactionCount)&&void 0!==e?e:0},jp=0;class Gp{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){jp=Vp(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((Vp()-jp)/50));return this.l[e]}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.u.get(e.interactionId);if(i||10>this.l.length||e.duration>r.L){var n;if(i?e.duration>i.L?(i.entries=[e],i.L=e.duration):e.duration===i.L&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.u.set((i={id:e.interactionId,entries:[e],L:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.L-e.L)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.u.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}}var Qp=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Pp(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},Zp=[200,500];class Yp{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var Kp=[2500,4e3],Jp={onLCP(e,t){void 0===t&&(t={}),Np((()=>{var r,i=Dp(),n=Cp("LCP"),s=Ep(t,Yp),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.h(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-xp(),0),n.entries=[o],r())},a=Rp("largest-contentful-paint",o);if(a){r=Sp(e,n,Kp,t.reportAllChanges);var l=Pp((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(Qp(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});bp((i=>{n=Cp("LCP"),r=Sp(e,n,Kp,t.reportAllChanges),wp((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},onCLS(e,t){void 0===t&&(t={});var r=Dp();qp(Pp((()=>{var i,n=Cp("CLS",0),s=Ep(t,Tp),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=Rp("layout-shift",o);a&&(i=Sp(e,n,Hp,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),bp((()=>{s.i=0,n=Cp("CLS",0),i=Sp(e,n,Hp,t.reportAllChanges),wp(i)})),setTimeout(i))})))},onFCP:qp,onINP(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Dp();Np((()=>{var i;"interactionCount"in performance||Mp||(Mp=Rp("event",Wp,{durationThreshold:0}));var n,s=Cp("INP"),o=Ep(t,Gp),a=e=>{Qp((()=>{for(var t of e)o.h(t);var r=o.T();r&&r.L!==s.value&&(s.value=r.L,s.entries=r.entries,n())}))},l=Rp("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Sp(e,s,Zp,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),bp((()=>{o.v(),s=Cp("INP"),n=Sp(e,s,Zp,t.reportAllChanges)})))}))}}};ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.postHogWebVitalsCallbacks=Jp,ba.postHogWebVitalsCallbacks=Jp,ba.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Jp;class Xp{constructor(e){this.disabled=!1===e;var t=Pr(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var e_="$copy_autocapture",t_=bs("[AutoCapture]");function r_(e,t){return t.length>e?t.slice(0,e)+"...":t}function i_(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ks(t));return t}function n_(e,t){var i,n,s=t.e,o=t.maskAllElementAttributes,a=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,c=t.disableCaptureUrlHashes;if(!Ks(e))return{props:{}};for(var d=[e],h=new Set([e]),p=e;p.parentNode&&!Js(p,"body")&&to>d.length;)if(eo(p.parentNode)){var _=p.parentNode.host;if(h.has(_))break;h.add(_),d.push(_),p=_}else{if(!Ks(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var g,v,f=[],m={},y=!1,b=!1;if(ws(d,(e=>{var t=wo(e);if(Js(e,"a")){var r=e.getAttribute("href");y=!!(t&&r&&Po(r))&&(c?on(r):r)}wr(no(e),"ph-no-capture")&&(b=!0),f.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};lo.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?r_(1024,Fo(e)):r_(1024,oo(e)));var a=no(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),ws(e.attributes,(function(r){var s;if((!ko(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Po(r.value)&&(!Ar(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=ro(a).join(" ")),o["attr__"+r.name]=r_(1024,"href"===r.name&&n?on(a):a)}}));for(var l=1,u=1,c=e;c=i_(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,l,c));var i=function(e){if(!wo(e))return{};var t={};return ws(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Po(i)&&(t[r]=i)}})),t}(e);ks(m,i)})),b)return{props:{},explicitNoCapture:b};if(a||(f[0].$el_text=Js(e,"a")||Js(e,"button")?Fo(e):oo(e)),y){var S,w;f[0].attr__href=y;var k=null==(S=As(y))?void 0:S.host,x=null==ss||null==(w=ss.location)?void 0:w.host;k&&x&&k!==x&&(g=y)}return{props:ks({$event_type:s.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(v=f,function(e){return e.map((e=>{var t,i,n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))n+="."+s.replace(/"/g,"");var o=r({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return xs(o).sort(((e,t)=>e[0].localeCompare(t[0]))).forEach((e=>{var t=e[1];return a[Ao(e[0].toString())]=Ao(t.toString())})),(n+=":")+xs(a).map((e=>e[0]+'="'+e[1]+'"')).join("")})).join(";")}(function(e){return e.map((e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Oo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return xs(e).filter((e=>0===e[0].indexOf("attr__"))).forEach((e=>i.attributes[e[0]]=e[1])),i}))}(v)))},null!=(i=f[0])&&i.$el_text?{$el_text:null==(n=f[0])?void 0:n.$el_text}:{},g&&"click"===s.type?{$external_click_url:g}:{},m)}}var s_={};function o_(e,t){var r=s_[e];if(r)return r;var i=t[e];if((e=>Rr(e)&&-1!==e.toString().indexOf("[native code]"))(i)&&(null==ss||!ss.Zone))return s_[e]=i.bind(t);var n=t.document;if(n&&Rr(n.createElement)){var s,o=!1;try{(s=n.createElement("iframe")).hidden=!0,n.head.appendChild(s);var a,l,u=s.contentWindow;u&&u[e]&&(i=u[e],"MutationObserver"===e&&function(e){return wr(e,"AppleWebKit")&&!wr(e,"Chrome")}(null!==(a=null==(l=t.navigator)?void 0:l.userAgent)&&void 0!==a?a:"")&&(s.classList.add("rr-block","ph-no-capture"),o=!0))}catch(t){ys.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}finally{var c;!o&&null!=(c=s)&&c.parentNode&&s.parentNode.removeChild(s)}}return i&&Rr(i)?s_[e]=i.bind(t):i}function a_(e,t){var i=ao(e);return i?r({node:i,originalEvent:e,timestamp:Date.now()},t):null}function l_(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function u_(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var c_="canvas,video,audio,embed,object";function d_(e,t){return Br(e)&&e>=t}class h_{_asRequiredConfig(e){var t,r,i,n,s,o,a,l,u=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:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._onClick=e=>{var t=a_(e,{type:"click"});Dr(t)||this._ignore(t)||this._clicks.push(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach((t=>{Lr(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{"visible"===(null==ls?void 0:ls.visibilityState)&&(this._lastVisibilityChange=Date.now())},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!Lr(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var i=e,n=null==(t=i.changedTouches)?void 0:t[0];if(n){var s=n.clientX-r.x,o=n.clientY-r.y,a=s*s+o*o,l=this._config.swipe_threshold_px;if(a>=l*l&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some((e=>Br(e)&&e>=r.timestamp))){var u;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==ls||null==ls.elementsFromPoint?void 0:ls.elementsFromPoint(r.x,r.y))&&void 0!==u?u:[]).some((e=>null==e.matches?void 0:e.matches(c_))))return;var c=a_(i,{type:"swipe",swipeDirection:l_(s,o),swipeDistancePx:Math.round(Math.sqrt(a))});Dr(c)||this._ignore(c)||this._clicks.push(c),this._scheduleCheck()}}}},this.instance=e,this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return o_("MutationObserver",e)}(ba);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)||e.disconnect(),this._mutationObserver=void 0,ba.removeEventListener("click",this._onClick),ba.removeEventListener("scroll",this._onScroll,{capture:!0}),ba.removeEventListener("selectionchange",this._onSelectionChange),ba.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),ba.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),ba.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==ls||ls.removeEventListener("visibilitychange",this._onVisibilityChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Rs(ba,"click",this._onClick)}_scheduleCheck(){this._clicks.length&&Lr(this._checkClickTimer)&&(this._checkClickTimer=ba.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){Rs(ba,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Rs(ba,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Rs(ls,"visibilitychange",this._onVisibilityChange)}_startSwipeObserver(){Rs(ba,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Rs(ba,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Rs(ba,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=Lr(this._surfacesCheckedAt)||Br(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Lr(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==ls||!ls.querySelector(c_))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){if(Ys(e.node))return!0;var t=this._clicks.some((t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp)));return!(!t&&!Js(e.node,"html")&&Ks(e.node)&&function(e,t){var r;if(!ss||bo(e))return!1;var i=Hr(t)?vo:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:vo;return!uo(So(e,!1).targetElementList,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||(r=e.node,!(!ss||bo(r))&&So(r,!1).targetElementList.some((e=>Js(e,"a"))));var t,r}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0,t.visibilityChangedDelayMs=this._lastVisibilityChange?Math.abs(t.timestamp-this._lastVisibilityChange):void 0;var i=d_(t.scrollDelayMs,this._config.scroll_threshold_ms),n=d_(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=d_(t.mutationDelayMs,this._config.mutation_threshold_ms),o=d_(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=Br(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=Br(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=Br(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=Br(t.visibilityChangedDelayMs)&&this._config.selection_change_threshold_ms>t.visibilityChangedDelayMs;if(!(a||l||u||c)){var d=d_(t.visibilityChangedDelayMs,this._config.selection_change_threshold_ms);if(i||s||o||n||d){var h=u_(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:s,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:n,[h+"_visibility_changed_timeout"]:d})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}}this._scheduleCheck()}}_captureDeadClick(e,t){var i=u_(e);this.instance.capture(i,r({},t,n_(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,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[i+"_scroll_delay_ms"]:e.scrollDelayMs,[i+"_mutation_delay_ms"]:e.mutationDelayMs,[i+"_absolute_delay_ms"]:e.absoluteDelayMs,[i+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[i+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}}ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new h_(e,t);var p_={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},__={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},g_="disabled",v_="sampled",f_="active",m_="buffering",y_="paused",b_="lazy_loading",S_="awaiting_config",w_="missing_config",k_="rrweb_error",x_="trigger",C_=x_+"_activated",I_=x_+"_pending",E_=x_+"_"+g_;function T_(e,t,r,i,n,s){return 0===t?E_:(null==e?void 0:e.get_property(r?i+r:n))===s?C_:I_}function M_(e,t,r){return t.some((t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)}))}class R_{constructor(e){this._matchers=e}triggerStatus(e){var t=this._matchers.map((t=>t.triggerStatus(e)));return t.includes(C_)?C_:t.includes(I_)?I_:E_}stop(){this._matchers.forEach((e=>e.stop()))}}class P_{constructor(e){this._matchers=e}triggerStatus(e){var t=new Set;for(var r of this._matchers)t.add(r.triggerStatus(e));switch(t.delete(E_),t.size){case 0:return E_;case 1:return Array.from(t)[0];default:return I_}}stop(){this._matchers.forEach((e=>e.stop()))}}class F_{triggerStatus(){return C_}stop(){}}var L_=e=>"sessionRecording"in e;class A_{constructor(e,t){this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._instance=e,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(L_(e)?Pr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(L_(e)?Pr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){ys.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){ys.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return T_(this._instance,this._urlTriggers.length,this._groupId,Wu,$u,e)}triggerStatus(e){var t=this._urlTriggerStatus(e),r=t===C_?C_:t===I_?I_:E_;return this._instance.register_for_session({[Pc]:r}),r}checkUrlBlocklist(e,t){var r=Vs(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=M_(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=Vs(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=M_(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===C_,l=M_(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class O_{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=I_;return Nr(this.linkedFlag)&&(e=E_),this.linkedFlagSeen&&(e=C_),this._instance.register_for_session({[Ec]:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(L_(e)?Pr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Nr(this.linkedFlag)&&!this.linkedFlagSeen){var i=Ar(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=Ar(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(Pr(r)&&i in r){var o=r[i];s=Hr(o)?!0===o:n?o===n:!!o}var a=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,a&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class D_{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(L_(e)?Pr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return T_(this._instance,this._eventTriggers.length,this._groupId,zu,Uu,e)}triggerStatus(e){var t=this._eventTriggerStatus(e),r=t===C_?C_:t===I_?I_:E_;return this._instance.register_for_session({[Ic]:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===C_,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class N_{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new A_(e,t.id),this._eventTriggerMatching=new D_(e,t.id),this._linkedFlagMatching=new O_(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map((e=>e.name)),n={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,r);var s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new R_(s):new P_(s)}else this._combinedMatching=new F_}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Wu+this.group.id:zu+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function B_(e){if(e.rrwebError)return k_;if(!e.receivedFlags)return m_;if(!e.isRecordingEnabled)return g_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=!0===e.isSampled,r=new R_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?v_:r===C_?f_:r===I_?m_:!1===e.isSampled?g_:f_}function q_(e){if(e.rrwebError)return k_;if(!e.receivedFlags)return m_;if(!e.isRecordingEnabled)return g_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=new P_([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==E_,i=Hr(e.isSampled);return r&&t===I_?m_:r&&t===E_||i&&!e.isSampled?g_:!0===e.isSampled?v_:f_}function H_(){var e=[];return function(t,r){if(Pr(r)||Mr(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function $_(e){var t=JSON.stringify(e,H_());return t?new Blob([t]).size:0}function U_(e){if(Dr(e))return 4;if(Lr(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Mr(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=Lr(i)||Dr(i)?4:U_(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];Lr(l)||(o||(s+=1),o=!1,s+=a.length+3+U_(l))}return s;default:return 0}}function z_(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),n=e.sizes.slice(r);return[z_({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),z_({size:n.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var W_=Uint8Array,V_=Uint16Array,j_=Uint32Array,G_=new W_([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]),Q_=new W_([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]),Z_=new W_([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y_=function(e,t){for(var r=new V_(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new j_(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},K_=Y_(G_,2),J_=K_[1];K_[0][28]=258,J_[258]=28;for(var X_=Y_(Q_,0)[1],eg=new V_(32768),tg=0;32768>tg;++tg){var rg=(43690&tg)>>>1|(21845&tg)<<1;eg[tg]=((65280&(rg=(61680&(rg=(52428&rg)>>>2|(13107&rg)<<2))>>>4|(3855&rg)<<4))>>>8|(255&rg)<<8)>>>1}var ig=function(e,t,r){for(var i=e.length,n=0,s=new V_(t);i>n;++n)++s[e[n]-1];var o,a=new V_(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new V_(1<<t);var l=15-t;for(n=0;i>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[eg[d]>>>l]=u}else for(o=new V_(i),n=0;i>n;++n)o[n]=eg[a[e[n]-1]++]>>>15-e[n];return o},ng=new W_(288);for(tg=0;144>tg;++tg)ng[tg]=8;for(tg=144;256>tg;++tg)ng[tg]=9;for(tg=256;280>tg;++tg)ng[tg]=7;for(tg=280;288>tg;++tg)ng[tg]=8;var sg=new W_(32);for(tg=0;32>tg;++tg)sg[tg]=5;var og=ig(ng,9,0),ag=ig(sg,5,0),lg=function(e){return(e/8>>0)+(7&e&&1)},ug=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof V_?V_:e instanceof j_?j_:W_)(r-t);return i.set(e.subarray(t,r)),i},cg=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},dg=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},hg=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,s=r.slice();if(!n)return[new W_(0),0];if(1==n){var o=new W_(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(i=1;n>i;++i)s[i].s>h&&(h=s[i].s);var p=new V_(h+1),_=pg(r[c-1],p,0);if(_>t){i=0;var g=0,v=_-t,f=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n>i;++i){var m=s[i].s;if(t>=p[m])break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=s[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=s[i].s;p[b]==t&&(--p[b],++g)}_=t}return[new W_(p),_]},pg=function(e,t,r){return-1==e.s?Math.max(pg(e.l,t,r+1),pg(e.r,t,r+1)):t[e.s]=r},_g=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new V_(++t),i=0,n=e[0],s=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[r.subarray(0,i),t]},gg=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},vg=function(e,t,r){var i=r.length,n=lg(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;i>s;++s)e[n+s+4]=r[s];return 8*(n+4+i)},fg=function(e,t,r,i,n,s,o,a,l,u,c){cg(t,c++,r),++n[256];for(var d=hg(n,15),h=d[0],p=d[1],_=hg(s,15),g=_[0],v=_[1],f=_g(h),m=f[0],y=f[1],b=_g(g),S=b[0],w=b[1],k=new V_(19),x=0;m.length>x;++x)k[31&m[x]]++;for(x=0;S.length>x;++x)k[31&S[x]]++;for(var C=hg(k,7),I=C[0],E=C[1],T=19;T>4&&!I[Z_[T-1]];--T);var M,R,P,F,L=u+5<<3,A=gg(n,ng)+gg(s,sg)+o,O=gg(n,h)+gg(s,g)+o+14+3*T+gg(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return vg(t,c,e.subarray(l,l+u));if(cg(t,c,1+(A>O)),c+=2,A>O){M=ig(h,p,0),R=h,P=ig(g,v,0),F=g;var D=ig(I,E,0);for(cg(t,c,y-257),cg(t,c+5,w-1),cg(t,c+10,T-4),c+=14,x=0;T>x;++x)cg(t,c+3*x,I[Z_[x]]);c+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(x=0;q.length>x;++x)cg(t,c,D[H=31&q[x]]),c+=I[H],H>15&&(cg(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else M=og,R=ng,P=ag,F=sg;for(x=0;a>x;++x)if(i[x]>255){var H;dg(t,c,M[257+(H=i[x]>>>18&31)]),c+=R[H+257],H>7&&(cg(t,c,i[x]>>>23&31),c+=G_[H]);var U=31&i[x];dg(t,c,P[U]),c+=F[U],U>3&&(dg(t,c,i[x]>>>5&8191),c+=Q_[U])}else dg(t,c,M[i[x]]),c+=R[i[x]];return dg(t,c,M[256]),c+R[256]},mg=new j_([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yg=function(){for(var e=new j_(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),bg=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=yg[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},Sg=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new W_(i+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(i,a.length-n),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=vg(l,u,e.subarray(c,d)):(l[c]=true,u=vg(l,u,e.subarray(c,o)))}else{for(var h=mg[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new V_(32768),f=new V_(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new j_(25e3),w=new V_(288),k=new V_(32),x=0,C=0,I=(c=0,0),E=0,T=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(v[R]=P,f[M]=R,c>=E){var F=o-c;if((x>7e3||I>24576)&&F>423){u=fg(e,l,0,S,w,k,C,I,T,c-T,u),I=x=C=0,T=c;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=R-P&32767;if(F>2&&M==b(c-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,c),H=Math.min(258,F);q>=N&&--D&&R!=P;){if(e[c+A]==e[c+A-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var z=Math.min(N,U-2),W=0;for(L=0;z>L;++L){var V=c-N+L+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,P=V)}}}N+=(R=P)-(P=v[R])+32768&32767}if(O){S[I++]=268435456|J_[A]<<18|X_[O];var G=31&J_[A],Q=31&X_[O];C+=G_[G]+Q_[Q],++w[257+G],++k[Q],E=c+A,++x}else S[I++]=e[c],++w[e[c]]}}u=fg(e,l,true,S,w,k,C,I,T,c-T,u)}return ug(a,0,i+lg(u)+n)}(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,r,i)},wg=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},kg=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&wg(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}},xg=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Cg(e,t){void 0===t&&(t={});var r=bg(),i=e.length;r.p(e);var n=Sg(e,t,xg(t),8),s=n.length;return kg(n,t),wg(n,s-8,r.d()),wg(n,s-4,i),n}function Ig(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new W_(e.length+(e.length>>>1)),n=0,s=function(e){i[n++]=e},o=0;r>o;++o){if(n+5>i.length){var a=new W_(n+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?s(l):2048>l?(s(192|l>>>6),s(128|63&l)):l>55295&&57344>l?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return ug(i,0,n)}function Eg(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}class Tg{constructor(e,t){var r,i;void 0===t&&(t={}),this._loggedTracker={},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,n,s,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(n=e.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(o=e.texts)?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t[0])&&e})));var i=this._numberOfChanges(t);return 0!==i||r===i?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new Kr({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:ys})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}fs.DEBUG=!1,fs.LIB_VERSION="1.410.3",fs.LIB_NAME="web";class Mg{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(Gu,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Gu);return Pr(t=r)&&Ar(t.sessionId)&&Br(t.size)&&r.sessionId===e?r.size:0}}function Rg(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<Yr(100*t,0,100,ys)}var Pg=bs("[SessionRecording]");function Fg(e,t){return t?e:"!"+e}function Lg(e,t){return e===t||e!=="!"+t&&null}class Ag{constructor(e,t,r,i,n,s,o){this._sampleRate=null,this._recordingStatusFunction=q_,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=Br(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new R_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=B_):(this._triggerStatusMatcher=new P_([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=q_),this._instance.register_for_session({[Mc]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,((e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()}))}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return Br(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&Nr(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){Pg.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!Br(n))return null==(r=this._instance.persistence)||r.unregister(qu),void(null==(i=this._instance.persistence)||i.unregister(Lu));var s=this._instance.get_property(qu),o=this._instance.get_property(Lu),a=Lg(s,e),l=Br(o)&&o!==n,u=Lr(o)&&s===e,c=l||u||!Hr(a),d=c?Rg(e,n):a;c&&(d?this._reportStarted("sampled"):Pg.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[qu]:Fg(e,d),[Lu]:Dr(o)&&s===e?null:n})}ensureSamplingDecision(e){if(Br(this._sampleRate)){var t=this._instance.get_property(qu);Hr(Lg(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Uu),null==(t=this._instance.persistence)||t.unregister($u),null==(r=this._instance.persistence)||r.unregister(qu),null==(i=this._instance.persistence)||i.unregister(Lu),null==(n=this._instance.persistence)||n.unregister(Hu)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===I_}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class Og{constructor(e,t,r,i,n){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Mc]:"v2_trigger_groups",[Rc]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):Pg.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return k_;if(e.urlTriggerMatching.urlBlocked)return y_;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return g_;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===C_){var a=s.group.id,l=r.get(a);Lr(l)?ys.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===I_&&(i=!0)}return n?v_:i?m_:g_}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;Br(i)&&(Dr(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var n=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var s=function(i){i.checkUrlTriggerConditions(t,r,(t=>{n._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),n.updateActiveTriggers(e),n._onTriggerActivated())}),e)};for(var o of this._triggerGroupMatchers)s(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return Pg.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var n=function(r){r.checkEventTriggerConditions(e.event,(n=>{if(i._checkGroupLevelProperties(r,e.properties)){var s=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(ic),a=s.some((t=>!t.properties||0===t.properties.length||id(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t),i._onTriggerActivated())}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){Pg.error("Could not activate event trigger for trigger groups",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,n=i.id,s=i.sampleRate,o=Vu+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(Pr(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,c=Br(p)&&p!==s,l=h===e&&Br(p)&&p===s&&Hr(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var g=u||c||d||!Hr(l),v=g?Rg(e+n,s):l;g&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:v}),this._triggerGroupSamplingResults.set(n,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:s,sampled:v}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(qu),null==(t=this._instance.persistence)||t.unregister(Lu),null==(r=this._instance.persistence)||r.unregister(Hu),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister(zu+a),null==(s=this._instance.persistence)||s.unregister(Wu+a),null==(o=this._instance.persistence)||o.unregister(Vu+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);s&&t.push({id:n,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Tc]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===I_)return!0;return!1}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||id(r,t,this._instance.get_property(ic))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new N_(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}function Dg(e){return Pr(e)?e.network_timing:e}var Ng,Bg,qg=36e5,Hg="[SessionRecording]",$g=bs(Hg),Ug=[__.MouseMove,__.MouseInteraction,__.Scroll,__.ViewportResize,__.Input,__.TouchMove,__.MediaInteraction,__.Drag],zg=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Wg(){var e;return null==ba||null==(e=ba.__PosthogExtensions__)?void 0:e.rrweb}function Vg(){var e;return null==(e=Wg())?void 0:e.record}function jg(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,H_())}}function Gg(e){return Eg(Cg(Ig(jg(e))))}function Qg(e){return Zg.apply(this,arguments)}function Zg(){return(Zg=t((function*(e){var t=jg(e),r=yield mr(t,fs.DEBUG,{rethrow:!0});return Eg(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Yg="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Kg=!1;function Jg(e){return Mr(e)&&0===e.length?Ng=null!=Ng?Ng:Gg([]):Gg(e)}function Xg(e){return ev.apply(this,arguments)}function ev(){return(ev=t((function*(e){return Mr(e)&&0===e.length?Ng||(Bg=null!=Bg?Bg:Qg([]).then((e=>(Ng=e,e))).catch((e=>{throw Ng=void 0,Bg=void 0,e}))):Qg(e)}))).apply(this,arguments)}function tv(e){return Yg&&!Kg&&function(e){return e.type===p_.FullSnapshot||e.type===p_.IncrementalSnapshot&&(e.data.source===__.Mutation||e.data.source===__.StyleSheetRule)}(e)}function rv(e){return{event:e,size:U_(e)}}function iv(e,t){return r({},e,{data:t,cv:"2024-10"})}function nv(e,t){return r({},e,{cv:"2024-10",data:r({},e.data,t)})}function sv(e){try{if(e.type===p_.FullSnapshot)return rv(iv(e,Gg(e.data)));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.Mutation)return rv(nv(e,{texts:Jg(e.data.texts),attributes:Jg(e.data.attributes),removes:Jg(e.data.removes),adds:Jg(e.data.adds)}));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.StyleSheetRule)return rv(nv(e,{adds:e.data.adds?Gg(e.data.adds):void 0,removes:e.data.removes?Gg(e.data.removes):void 0}))}catch(e){$g.error("could not compress event - will use uncompressed event",e)}return{event:e,size:$_(e)}}function ov(){return ov=t((function*(e){try{if(e.type===p_.FullSnapshot)return rv(iv(e,yield Qg(e.data)));if(e.type===p_.IncrementalSnapshot&&e.data.source===__.Mutation){var t=yield Promise.all([Xg(e.data.texts),Xg(e.data.attributes),Xg(e.data.removes),Xg(e.data.adds)]);return rv(nv(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(e.type===p_.IncrementalSnapshot&&e.data.source===__.StyleSheetRule){var r=yield Promise.all([e.data.adds?Qg(e.data.adds):void 0,e.data.removes?Qg(e.data.removes):void 0]);return rv(nv(e,{adds:r[0],removes:r[1]}))}}catch(t){return gr(t)&&(Kg=!0),$g.error("could not compress event asynchronously - trying synchronous compression",t),sv(e)}return{event:e,size:$_(e)}})),ov.apply(this,arguments)}function av(e,t){return e.type===p_.Custom&&e.data.tag===t}function lv(e){return av(e,"sessionIdle")}function uv(e){return av(e,"$session_ending")}function cv(e){return av(e,"$session_starting")}class dv{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(Hg+" must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Lg(this._instance.get_property(qu),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return Br(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e){this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._hasWarnedClientMaskingOverride=!1,this._maskRegionsFnFailed=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,n,s;if(r&&(e!==this._sessionId||t!==this._windowId)){var o,a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(o=this._flushedSizeTracker)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(ju),this._maxDepthExceeded=!1,null==(n=Wg())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t||(this._isIdle="unknown",this.stop(),this.start("session_id_changed")),a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(s=this._strategy)||s.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Hu])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return Br(r)&&Br(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!Br(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return Br(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!Dr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Hu]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==m_?(this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=ls&&ls.visibilityState&&this._tryAddCustomEvent("window "+ls.visibilityState,{})},this._instance=e;var t=this._sessionManager.checkAndGetSessionAndWindowId(),r=t.windowId;this._sessionId=t.sessionId,this._windowId=r,this._linkedFlagMatching=new O_(this._instance),this._urlTriggerMatching=new A_(this._instance),this._eventTriggerMatching=new D_(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||$g.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new Mg(this._instance)}get _masking(){var e,t,r,i,n,s,o,a=null==(e=this._remoteConfig)?void 0:e.masking,l={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},u=null!==(n=null==l?void 0:l.maskAllInputs)&&void 0!==n?n:null==a?void 0:a.maskAllInputs,c=null!==(s=null==l?void 0:l.maskTextSelector)&&void 0!==s?s:null==a?void 0:a.maskTextSelector,d=null!==(o=null==l?void 0:l.blockSelector)&&void 0!==o?o:null==a?void 0:a.blockSelector;return Lr(u)&&Lr(c)&&Lr(d)?void 0:{maskAllInputs:null==u||u,maskTextSelector:c,blockSelector:d}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!Nr(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((e=>{var i=null==r?void 0:r[e],n=t[e];return!Lr(i)&&i!==n}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,$g.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:t}))}}}get _canvasResolutionScale(){var e;return Yr(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,bs("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,n,s,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,c=null!==(i=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:Yr(c,0,12,bs("canvas recording fps"),4),quality:Yr(d,0,1,bs("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,n={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),a=Dg(this._instance.config.capture_performance),l=Dg(null==i?void 0:i.capturePerformance),u=!!(Hr(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,i=[],n=null==(e=ba.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());var s=null==(t=ba.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this._networkPayloadCapture&&Rr(s)&&(!Fs.includes(us.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(s(((e,t)=>{var i,n={payloadSizeLimitBytes:Ho.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Ho.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Ho.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=qo(n),e=>(null!=e&&e.requestBody&&(e.requestBody=jo(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=jo(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t)=>{var r,i=As(e.name),n=0===t.indexOf("http")?null==(r=As(t))?void 0:r.pathname:t;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Vo.some((e=>0===s.indexOf(e)))))return e})((Wo((r=t).requestHeaders),Wo(r.responseHeaders),r),e.api_host));var r},c=Rr(e.session_recording.maskNetworkRequestFn);return c&&Rr(e.session_recording.maskCapturedNetworkRequestFn)&&ys.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return r({},t,{name:null==i?void 0:i.url})}),n.maskRequestFn=Rr(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r,i=u(t);return i&&null!==(r=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:e=>function(e){if(!Lr(e))return e.requestBody=Go(e.requestBody,"Request"),e.responseBody=Go(e.responseBody,"Response"),e}(u(e)),r({},Ho,n,{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture))):$g.info("NetworkCapture not started because we are on localhost.")),i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?on(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?on(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Sh,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Ns(r,i,kh))}_maskUrl(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,i=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(t.maskNetworkRequestFn){var n=t.maskNetworkRequestFn({url:e});return null==n?void 0:n.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):$g.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(zg((()=>Vg().addCustomEvent(e,t))))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!ss)return;var e=new URL(ss.location.href),t=this._maskReplayUrl(e.origin+e.pathname+e.search);this._lastHref!==t&&(this._lastHref=t,this._tryAddCustomEvent("$url_changed",{href:t}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)}))}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(zg((()=>Vg().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return Br(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_onTriggerActivated(){!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,clearInterval(this._fullSnapshotTimer),$g.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlTriggerMatching.urlBlocked&&(this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),$g.info("recording resumed"))}_activateTrigger(e,t){var r;if(!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===e?$u:Uu]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(Fu);if(e){var t;try{t=Pr(e)?e:JSON.parse(e)}catch(e){return void $g.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,n=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>qg)return $g.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(Fu))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(e){var t,r,i=this._remoteConfig;if(i){this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var n=this._sessionManager.checkAndGetSessionAndWindowId(),s=n.windowId;this._sessionId=n.sessionId,this._windowId=s,null==(t=this._instance.persistence)||t.unregister(ju),null!=i&&i.endpoint&&(this._endpoint=null==i?void 0:i.endpoint),this._strategy=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new Og(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Ag(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(i),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(Au,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Au)})),this._checkOverride(Ou,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ou)})),this._checkOverride(Nu,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Nu)})),this._checkOverride(Du,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Du)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Rs(ss,"beforeunload",this._onBeforeUnload),Rs(ss,"offline",this._onOffline),Rs(ss,"online",this._onOnline),Rs(ss,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Rr(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Rr(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",(()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId(((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)}))})):Rr(this._sessionManager.on)||$g.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Nr(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){$g.error("Could not add $pageview to rrweb session",e)}}))),this.status===f_&&this._reportStarted(e||"recording_initialized"))}else $g.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,n,s;null==ss||ss.removeEventListener("beforeunload",this._onBeforeUnload),null==ss||ss.removeEventListener("offline",this._onOffline),null==ss||ss.removeEventListener("online",this._onOnline),null==ss||ss.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(e=this._removePageViewCaptureHook)||e.call(this),this._removePageViewCaptureHook=void 0,null==(t=this._removeEventTriggerCaptureHook)||t.call(this),this._removeEventTriggerCaptureHook=void 0,null==(r=this._onSessionIdListener)||r.call(this),this._onSessionIdListener=void 0,null==(i=this._onSessionIdleResetForcedListener)||i.call(this),this._onSessionIdleResetForcedListener=void 0,null==(n=this._forceIdleSessionIdListener)||n.call(this),this._forceIdleSessionIdListener=void 0,null==(s=this._strategy)||s.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._stopRrweb)||t.call(this),this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch((()=>{})).then((()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._teardown(),$g.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),$g.info("stopped")})),!0}stop(){this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),$g.info("stopped"))}discard(){this._clearBuffer(),this._teardown(),$g.info("discarded")}_captureProcessedEvent(e,t,r,i,n){var s,o={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:n};e.type===p_.FullSnapshot&&null!=(s=Wg())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this.status!==g_?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(o)):this._clearBuffer()}_ensureFullSnapshotForSession(e,t){e.type!==p_.FullSnapshot?e.type===p_.IncrementalSnapshot&&(Lr(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,$g.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter((t=>t!==e))}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.compressionEnabled?sv(e.event):{event:e.event,size:$_(e.event)};this._captureQueuedCompressionEvent(e,t.event,t.size)}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach((e=>{this._processQueuedCompressionEventSync(e)}))}_enqueueCompression(e,r,i,n){var s=this,o={event:e,compressionEnabled:r,targetSessionId:i,targetWindowId:n,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(o),this._queuedCompressionEvents+=1;var a=function(){var i=t((function*(){try{if(o.processed)return;var t,i;try{var n=r?tv(e)?yield function(e){return ov.apply(this,arguments)}(e):sv(e):{event:e,size:$_(e)};t=n.event,i=n.size}catch(r){$g.error("could not process queued compression event - will use uncompressed event",r),t=e,i=$_(e)}s._captureQueuedCompressionEvent(o,t,i)}finally{s._finishQueuedCompressionEvent(o)}}));return function(){return i.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(a):a()}onRRwebEmit(e){var t,r,i,n,s,o,a;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&Pr(e))){if(e.type===p_.Meta){var l=this._maskReplayUrl(e.data.href);if(this._lastHref=l,!l)return;e.data.href=l}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,(()=>this._pauseRecording()),(()=>this._resumeRecording()),((e,t)=>this._activateTrigger(e,t))),!this._urlTriggerMatching.urlBlocked||function(e){return e.type===p_.Custom&&"recording paused"===e.data.tag}(e)){var u,c;e.type===p_.FullSnapshot&&(this._scheduleFullSnapshot(),null==(u=this._mutationThrottler)||u.reset(),null==(c=this._instance.persistence)||c.register_once({[ju]:e.timestamp},void 0)),e.type===p_.FullSnapshot&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)&&this._clearBufferBeforeMostRecentMeta();var d=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(d){var h=function(e){var t=e;if(t&&Pr(t)&&6===t.type&&Pr(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 r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(d),p=function(e){return uv(e)?e.data.payload:null}(h),_=function(e){return cv(e)?e.data.payload:null}(h);if(p||_){var g=null!=p?p:_;null!=g&&g.lastActivityTimestamp&&(h.timestamp=g.lastActivityTimestamp)}else this._updateWindowAndSessionIds(h);e.type===p_.FullSnapshot&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var v=null!==(i=null!==(n=null==p?void 0:p.currentSessionId)&&void 0!==n?n:null==_?void 0:_.nextSessionId)&&void 0!==i?i:this._sessionId,f=null!==(s=null!==(o=null==p?void 0:p.currentWindowId)&&void 0!==o?o:null==_?void 0:_.nextWindowId)&&void 0!==s?s:this._windowId;if(!0!==this._isIdle||function(e){return lv(e)||uv(e)||cv(e)}(h)){if(lv(h)){var m=h.data.payload;m&&(h.timestamp=m.lastActivityTimestamp+m.threshold)}var y=null===(a=this._instance.config.session_recording.compress_events)||void 0===a||a;if(this._queuedCompressionEvents>0||y&&tv(h))this._enqueueCompression(h,y,v,f);else{var b=y?sv(h):{event:h,size:$_(h)};this._captureProcessedEvent(h,b.event,b.size,v,f)}}}}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):g_}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[qu]:this.sessionId,[Lu]:null}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_currentMaskedHostname(){try{var e,t=null==ss||null==(e=ss.location)?void 0:e.href;if(!t)return;var r=this._maskReplayUrl(t);if(!r)return;return new URL(r).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_flushBuffer(){var e;this._clearFlushBufferTimer(),null==(e=this._strategy)||e.ensureSamplingDecision(this.sessionId);var t=this._isBelowMinimumDuration();if(this.status===m_||this.status===y_||this.status===g_||t)return this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this._buffer;if(this._buffer.data.length>0){var r,i=this._currentMaskedHostname();z_(this._buffer).forEach((e=>{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION,$snapshot_host:i})})),null==(r=this._strategy)||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,n=this._buffer.sessionId!==i;(n||!0!==this._isIdle&&this._buffer.size+e.$snapshot_bytes+r>943718.4)&&(this._buffer=this._flushBuffer(),n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id),this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),this._flushBufferTimer||!0===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})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1],i=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(this._buffer.data[t].type===p_.Meta){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce(((e,t)=>e+t),0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Fc]:e}),$g.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",r({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Ug.indexOf(null==(t=e.data)?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 r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var i="unknown"===this._isIdle;this._isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!0!==this._isIdle){var n=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),s=n.windowId,o=n.sessionId,a=this._sessionId!==o,l=this._windowId!==s;this._windowId=s,this._sessionId=o,a||l?(this.stop(),this.start("session_id_changed")):r&&this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t=this._sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:t.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(e=this._flushedSizeTracker)?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_rrweb_attached:!!this._stopRrweb,$sdk_debug_rrweb_start_attempted:this._rrwebStartAttempted}}_startRecorder(){var e;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var t,i,n,s={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,sampling:void 0,attributeFilter:void 0},o=this._instance.config.session_recording;for(var a of Object.entries(o||{})){var l=a[0],u=a[1];if(l in s)if("maskInputOptions"===l)s.maskInputOptions=r({password:!0},u);else if("sampling"===l){var c=null!=u?u:{},d={};Lr(c.mousemove)||(d.mousemove=c.mousemove),Lr(c.mouseInteraction)||(d.mouseInteraction=c.mouseInteraction),s.sampling=d}else s[l]=u}this._canvasRecording&&this._canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling=r({},s.sampling,{canvas:this._canvasRecording.fps}),s.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},s.canvasResolutionScale=this._canvasResolutionScale,s.canvasMasking={configured:()=>{var e;return Rr(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(Rr(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,$g.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(s.maskAllInputs=null===(t=this._masking.maskAllInputs)||void 0===t||t,s.maskTextSelector=null!==(i=this._masking.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this._masking.blockSelector)&&void 0!==n?n:void 0),this._warnIfClientMaskingShadowsServer();var h=Vg();if(h){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new Tg(h,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";$g.info(r,{node:t}),this.log(Hg+" "+r,"warn")}});var p=this._gatherRRWebPlugins();if(this._stopRrweb=h(r({emit:e=>{this.onRRwebEmit(e)},plugins:p},s)),!this._stopRrweb)return this._rrwebError=!0,void $g.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,this._lastActivityTimestamp=Date.now(),this._isIdle=Hr(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:p.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else $g.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}ba.__PosthogExtensions__=ba.__PosthogExtensions__||{},ba.__PosthogExtensions__.initSessionRecording=e=>new dv(e);class hv{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===Oc||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Ac}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}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 e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Qr(e)?1:wr(Zr,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?cd:ld;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?ld:cd;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Qr(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==as?void 0:as.doNotTrack,null==as?void 0:as.msDoNotTrack,ba.doNotTrack].some((e=>Qr(e)))}}var pv=bs("[Dead Clicks]"),_v=()=>!0,gv=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Mu)),i=e.instance.config.capture_dead_clicks;return Hr(i)?i:!!Pr(i)||r};class vv{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Mu]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?pv.error("failed to load script",t):e()}))}_start(){var e;if(ls){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=ba.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Pr(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=ba.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ls),pv.info("starting...")}}else pv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,pv.info("stopping..."))}}var fv=bs("[SegmentIntegration]");var mv="posthog-js";function yv(e,t){var i=void 0===t?{}:t,n=i.organization,s=i.projectId,o=i.prefix,a=i.severityAllowList,l=void 0===a?["error"]:a,u=i.sendExceptionsToPostHog,c=void 0===u||u;return t=>{var i,a,u,d,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,g=(null==(i=t.exception)?void 0:i.values)||[],v=g.map((e=>r({},e,{stacktrace:e.stacktrace?r({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>r({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(h=g[0])?void 0:h.type,$sentry_tags:t.tags};return n&&s&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+t.event_id),c&&(null==(_=e.exceptions)||_.sendExceptionEvent(f)),t}}class bv{constructor(e,t,r,i,n,s){this.name=mv,this.setupOnce=function(o){o(yv(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class Sv{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(ys.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var r,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(r=null==ss?void 0:ss.location.pathname)&&void 0!==r?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var s=n.maxScrollHeight,o=n.lastScrollY,a=n.maxScrollY,l=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(Lr(s)||Lr(o)||Lr(a)||Lr(l)||Lr(u)||Lr(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s>1?Yr(o/s,0,1,ys):1,h=s>1?Yr(a/s,0,1,ys):1,p=l>1?Yr(u/l,0,1,ys):1,_=l>1?Yr(c/l,0,1,ys):1;i=ks(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var wv=["flags","surveys"],kv={[mu]:{exposure:"hidden"},[Su]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[wu]:{exposure:"hidden"},[ku]:{exposure:"event"},[xu]:{exposure:"hidden"},[Cu]:{exposure:"event"},[Iu]:{exposure:"hidden"},[Eu]:{exposure:"event"},[Tu]:{exposure:"event"},[Mu]:{exposure:"event"},[Ru]:{exposure:"hidden"},[Pu]:{exposure:"event"},[Fu]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Bu]:{exposure:"hidden"},[qu]:{exposure:"event"},[Lu]:{exposure:"event",shouldSkipFromEventProperties:e=>Dr(e)},[Hu]:{exposure:"event"},[$u]:{exposure:"event"},[Uu]:{exposure:"event"},[ju]:{exposure:"event"},[Gu]:{exposure:"hidden"},[Qu]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Pr(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[Zu]:{exposure:"event",storageGroup:"flags"},[Yu]:{exposure:"hidden"},[Ku]:{exposure:"hidden",storageGroup:"flags"},[Ju]:{exposure:"event",storageGroup:"flags"},[Xu]:{exposure:"event",storageGroup:"flags",volatile:!0},[ec]:{exposure:"hidden",storageGroup:"flags"},[tc]:{exposure:"event"},[rc]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[nc]:{exposure:"hidden"},[sc]:{exposure:"hidden",storageGroup:"surveys"},[oc]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ac]:{exposure:"event"},[lc]:{exposure:"hidden"},[uc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[cc]:{exposure:"hidden"},[dc]:{exposure:"hidden"},[hc]:{exposure:"hidden"},[pc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_c]:{exposure:"hidden"},[gc]:{exposure:"hidden"},[vc]:{exposure:"hidden"},[fc]:{exposure:"hidden"},[mc]:{exposure:"hidden"},[yc]:{exposure:"hidden"},[bc]:{exposure:"hidden"},[Au]:{exposure:"event"},[Ou]:{exposure:"event"},[Du]:{exposure:"event"},[Nu]:{exposure:"event"},[kc]:{exposure:"event"},[xc]:{exposure:"event"},[Cc]:{exposure:"event"},[Ic]:{exposure:"event"},[Ec]:{exposure:"event"},[Tc]:{exposure:"event"},[Mc]:{exposure:"event"},[Rc]:{exposure:"event"},[Pc]:{exposure:"event"},[Fc]:{exposure:"event"}},xv=[[zu,{exposure:"hidden"}],[Wu,{exposure:"hidden"}],[Vu,{exposure:"hidden"}]],Cv=e=>{var t=kv[e];if(t)return t;for(var r of xv){var i=r[1];if(0===e.indexOf(r[0]))return i}},Iv={flags:pc,surveys:oc},Ev=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Tv="main";class Mv{constructor(e,t,i){if(void 0===i&&(i=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=i,this.props={},this._campaign_params_url=void 0,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._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&ys.info("Persistence loaded",e.persistence,r({},this.props)),this.update_config(e,e,t),this.save(),ss){var n=()=>this.flush();Rs(ss,"beforeunload",n,{capture:!1}),Rs(ss,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Br(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Ev.indexOf(e.persistence.toLowerCase())&&(ys.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var i=[...dd,...e];return r({},cd,{_parse(e){try{var r={};try{r=ld._parse(e)||{}}catch(e){}var i,n=JSON.parse(cd._get(e)||"{}");if(t){var s={};for(var o in r){var a=r[o];Dr(a)||""===a||(s[o]=a)}i=ks(n,s)}else i=ks(r,n);return cd._set(e,i),i}catch(e){}return null},_set(e,t,r,n,s,o){var a=cd._set(e,t,void 0,void 0,o);try{var l={};i.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ld._set(e,l,r,n,s,o)}catch(e){cd._error(e)}return a},_remove(e,t){try{null==ss||ss.localStorage.removeItem(e),ld._remove(e,t)}catch(e){cd._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return"localstorage"===s&&cd._is_supported()?(t=cd,n=!0):"localstorage+cookie"===s&&i._is_supported()?(t=i,n=!0):"sessionstorage"===s&&gd._is_supported()?t=gd:"memory"===s?t=pd:"cookie"===s?t=ld:i._is_supported()?(t=i,n=!0):t=ld,this._splitStorageEligible=n,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[pc];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return ws(this.props,((t,r)=>{var i=Cv(r);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,r===Qu?()=>this._isFeatureFlagCacheStale():()=>!1))return;i.transformToEventProperties&&ks(e,i.transformToEventProperties(t))}else if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,(()=>!1)))return;e[r]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=ks({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of wv){var t=cd._parse(this._groupEntryName(e));if(t&&!Fr(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||ks(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Cv(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=Iv[e];if(!r)return!1;var i=t[r],n=this.props[r];return Br(i)&&Br(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Cv(e))?void 0:t.storageGroup:void 0,i=r?cd._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var n=this._storage._parse(this._name);if(n&&e in n)return void this._setProp(e,n[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Lr(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Lr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Tv))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,r=e.groups;for(var i of(this._writeEntry(this._storage,this._name,t,Tv),wv)){var n,s=r[i];(!Fr(s)||null!=(n=this._slotState[i])&&n.persisted)&&this._writeEntry(cd,this._groupEntryName(i),s,i)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return ws(this.props,((r,i)=>{var n,s=null==(n=Cv(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Tv)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return ws(e,((e,t)=>{var i;r[t]=null!=(i=Cv(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n=this._slotWriteState(i);if(i===Tv||n.dirty||Lr(n.fingerprint)){var s;try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return void(n.dirty=!1)}catch(e){s=void 0}e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Tv&&(n.persisted=!0),Lr(s)||(n.fingerprint=s)):this._config.debug&&ys.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(Lr(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of wv)cd._remove(this._groupEntryName(i));r?delete this._slotState[Tv]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Pr(e)){Lr(t)&&(t="None"),this._expire_days=Lr(r)?this._default_expiry:r;var i=!1;if(ws(e,((e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Pr(e)){this._expire_days=Lr(t)?this._default_expiry:t;var r=!1;if(ws(e,((t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this._setProp(i,t),r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){var e=null==ls?void 0:ls.URL;if(e!==this._campaign_params_url){var t=Ch(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Fr(Es(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==ls?void 0:ls.referrer)?Eh(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Rh(),$referring_domain:null!=ls&&ls.referrer&&(null==(e=As(ls.referrer))?void 0:e.host)||Mh},void 0)}set_initial_person_info(){this.props[fc]||this.props[mc]||this.register_once({[yc]:Ph(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};ws([mc,fc],(t=>{var r=this.props[t];r&&ws(r,(function(t,r){e["$initial_"+xr(r)]=t}))}));var t=this.props[yc];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Fh(e,t),i={};return ws(r,(function(e,t){i["$initial_"+xr(t)]=e})),i}(t,this._config.disable_capture_url_hashes);ks(e,r)}return e}safe_merge(e){return ws(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every(((e,t)=>e===i[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i?this._buildStorage(e):this._storage,s=this._resolveSplitStorage(e);if(i||s!==this._splitStorage){var o=this.props;this.clear(),this._storage=n,this._splitStorage=s,this.props=o,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({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[wu]||{};r[e]=t,this._setProp(wu,r),this.save()}remove_event_timer(e){var t=this.props[wu]||{},r=t[e];return Lr(r)||(delete t[e],this._setProp(wu,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var r;this.props[e]=t,null!=(r=Cv(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=Cv(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Rv=bs("[RateLimiter]");class Pv{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Rv.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Rv.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;void 0===e&&(e=!1);var n=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(vc))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>n&&(a.tokens=n);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(vc,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Fv=bs("[RemoteConfig]");class Lv{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=ba._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Fv.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void Fv.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Fv.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){Fv.error("Error loading remote config",e),this._onRemoteConfig()}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&ls&&"hidden"!==ls.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){e||Fv.error("Failed to fetch remote config from PostHog.");try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Fv.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var t;null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded()}catch(e){Fv.error("Error loading feature flags",e)}}}var Av=!!ds||!!cs,Ov="text/plain",Dv=!1,Nv=(e,t)=>{var r=e.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},Bv=function(e,t,i){var n;void 0===i&&(i=!0);var s=e.split("?"),o=s[0],a=s[1],l=r({},t),u=null!==(n=null==a?void 0:a.split("&").map((e=>{var t,r=e.split("="),n=r[0],s=i&&null!==(t=l[n])&&void 0!==t?t:r[1];return delete l[n],n+"="+s})))&&void 0!==n?n:[],c=Os(l);return c&&u.push(c),u.length>0?o+"?"+u.join("&"):o},qv=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===Bl){var i=Cg(Ig(Ls(t)),{mtime:0});return{contentType:Ov,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===ql){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ls(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ls(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Ls(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Hv=e=>{var t,i,n=()=>"sendBeacon"===e.transport?{url:Bv(e.url,{compression:ql}),encodedBody:qv(r({},e,{compression:ql,_encodedBody:void 0}))}:{url:Nv(e.url,"compression"),encodedBody:qv(r({},e,{compression:void 0,_encodedBody:void 0}))};try{t=qv(e)}catch(t){if(pr(e.compression,Ds(e.url,"compression")))return ys.error("Failed to gzip request body, sending uncompressed payload",t),n();throw t}return t&&pr(e.compression,Ds(e.url,"compression"))&&!((i=t.body)instanceof ArrayBuffer?hr(new Uint8Array(i)):ArrayBuffer.isView(i)&&hr(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Dv=!0,n()):{url:e.url,encodedBody:t}},$v=e=>{try{return Hv(e)}catch(t){return ys.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Uv=function(){var e=t((function*(e){var t=Ls(e.data),i=yield mr(t,fs.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return r({},e,{_encodedBody:{contentType:Ov,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),zv=/Failed to fetch|NetworkError|Load failed/i,Wv=e=>{var t=$v(e);if(t){var i=t.url,n=t.encodedBody,s=null!=n?n:{},o=s.contentType,a=s.body,l=s.estimatedSize,u=new Headers;ws(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var c=null,d=!1;if(hs){var h=new hs;c={signal:h.signal,timeout:setTimeout((()=>{var t,r;d=!0,h.abort((t=e.timeout,(r=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",r))}),e.timeout)}}var p=t=>{d&&"AbortError"===(null==t?void 0:t.name)||(e=>"TypeError"===(null==e?void 0:e.name)&&zv.test((null==e?void 0:e.message)||""))(t)?ys.warn(t):ys.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var _;cs(i,r({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(_=c)?void 0:_.signal},e.fetchOptions)).then((t=>t.text().then((r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){ys.error(e)}null==e.callback||e.callback(i)})))).catch(p).finally((()=>c?clearTimeout(c.timeout):null))}catch(e){c&&clearTimeout(c.timeout),p(e)}}},Vv=e=>{try{var t,i=Hv(e),n=i.url,s=i.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(as.sendBeacon(n,u))return;var c=Mr(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Mr(c)&&c.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(c.length/2),h=t=>Mr(e.data)?t:r({},e.data,{batch:t});return Vv(r({},e,{data:h(c.slice(0,d))})),void Vv(r({},e,{data:h(c.slice(d))}))}ys.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Wv(r({},e,{_keepaliveDisabled:!0}))}catch(e){ys.warn("Beacon send failed",e)}},jv=(e,t,i,n)=>{var s="query"===n?"POST"===t?"sent_at":"_":void 0;return Bv(i===Bl?Nv(e,"compression"):e,r({},s?{[s]:Date.now().toString()}:{},i===Bl?{}:{compression:i}))},Gv=[];cs&&Gv.push({transport:"fetch",method:Wv}),ds&&Gv.push({transport:"XHR",method(e){var t=$v(e);if(t){var r=new ds,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var n=null!=i?i:{},s=n.contentType,o=n.body;ws(e.headers,(function(e,t){r.setRequestHeader(t,e)})),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(o)}}}),null!=as&&as.sendBeacon&&Gv.push({transport:"sendBeacon",method:Vv});var Qv=3e3;class Zv{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Yr((null==t?void 0:t.flush_interval_ms)||Qv,250,5e3,ys.createLogger("flush interval"),Qv),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this._sendRequestSafely(r({},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(),r=function(){var r=t[i],n=(new Date).getTime();r.data&&Mr(r.data)&&ws(r.data,(e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){ys.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return ws(this._queue,(t=>{var i,n=t,s=(n?n.batchKey:null)||n.url;Lr(e[s])&&(e[s]=r({},n,{data:[]})),null==(i=e[s].data)||i.push(n.data)})),this._queue=[],e}}var Yv=["retriesPerformedSoFar"];class Kv{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Lr(ss)&&"onLine"in ss.navigator&&(this._areWeOnline=ss.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Rs(ss,"online",this._onlineListener),Rs(ss,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,n=i(e,Yv);qr(t)&&(n.url=Bv(n.url,{retry_count:t})),this._instance._send_request(r({},n,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(r({retriesPerformedSoFar:t},n));0===e.statusCode&&ys.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==n.callback||n.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),n=Math.random()-.5;return Math.ceil(i+n*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),ys.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter((r=>e>r.retryAt||(t.push(r),!1)));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Lr(ss)||(this._onlineListener&&(ss.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ss.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(r({},t,{transport:"sendBeacon"}))}catch(e){ys.error(e)}}this._queue=[]}}class Jv{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(s),this._context.maxScrollY=Math.max(s,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Rs(ss,"scroll",this._updateScrollData,{capture:!0}),Rs(ss,"scrollend",this._updateScrollData,{capture:!0}),Rs(ss,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ss?void 0:ss.document.documentElement;var e=Mr(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var r=null==ss?void 0:ss.document.querySelector(t);if(r)return r}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[t]||0}return ss?"y"===e?ss.scrollY||ss.pageYOffset||ss.document.documentElement.scrollTop||0:ss.scrollX||ss.pageXOffset||ss.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var Xv=e=>Ph(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class ef{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[gc]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||Xv,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[gc]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Fh(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return ws(Es(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+xr(r)]=t})),e}}class tf{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 r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}}var rf=bs("[SessionId]");class nf{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new tf,this._sessionHasBeenIdleTooLong=(e,t)=>!(!qr(e)||!qr(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Oc)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Yc,this._windowIdGenerator=r||Yc;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Yr(this._config.session_idle_timeout_seconds||1800,60,36e3,rf.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var s=gd._parse(this._window_id_storage_key),o=gd._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:gd._remove(this._window_id_storage_key),gd._set(this._primary_window_exists_storage_key,!0)}if(null!=(i=this._config.bootstrap)&&i.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.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._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){rf.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Lr(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&&gd._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&gd._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?gd._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Dr(t)&&!Dr(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!i||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Bu]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return qr(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Bu):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Dr(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Bu]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=qr(e)?e:0,r=qr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[Bu];return Mr(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&ss&&(ss.removeEventListener(Hc,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&gd._remove(this._primary_window_exists_storage_key)},Rs(ss,Hc,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===Oc)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),i=this._getSessionId(),n=i[1],s=i[2],o=this._freshestActivityTimestamp(),a=this._getWindowId(),l=qr(s)&&Math.abs(r-s)>864e5,u=!1,c=!1,d=!n,h=n,p=!d&&!e&&this._sessionHasBeenIdleTooLong(r,o);if(p){(p=this._isSessionIdleAfterCrossTabRefresh(r))||rf.info("cross-tab refresh kept the session alive",{sessionId:n});var _=this._getSessionId();n=_[1],s=_[2]}d||p||l?(n=this._sessionIdGenerator(),a=this._windowIdGenerator(),rf.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),s=r,u=!0):(a||(a=this._windowIdGenerator(),u=!0),(c=n!==h)&&(rf.info("adopted cross-tab session id",{sessionId:n,windowId:a}),u=!0));var g=qr(o)&&e&&!l?o:r,v=qr(s)?s:(new Date).getTime();this._setWindowId(a),this._setSessionId(n,g,v),e||this._resetIdleTimer();var f={noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:c};return u&&this._sessionIdChangedHandlers.forEach((e=>e(n,a,f))),{sessionId:n,windowId:a,sessionStartTimestamp:v,changeReason:u?f:void 0,lastActivityTimestamp:o}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}var sf=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&Sr(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>Sr(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function of(){return of=t((function*(){var e=null==as?void 0:as.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),r=null==t?void 0:t.model;return Ar(r)&&r.length>0?r:void 0}catch(e){return void ys.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),of.apply(this,arguments)}var af="custom",lf="i.posthog.com",uf=/^\/static\//;class cf{constructor(e){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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+lf,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":af),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(uf.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return""+r+t}if(this.region===af)return this.apiHost+t;var i=lf+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var df=bs("[PostHog ExternalIntegrations]"),hf={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class pf{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return df.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,n,s=r[0],o=r[1];!o||null!=(t=ba.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[s]||e._loadScript(hf[s],(()=>{var t;null==(t=ba.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[s])||t.start(e._instance)})),!o&&null!=(i=ba.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[s]&&(null==(n=ba.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[s])||n.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class _f{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var r=this;return t((function*(){if(r._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(r._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');r._extensions.set(e.name,e);try{var t=e.setup(r._client);t&&(yield t)}catch(t){var i=r._extensions.get(e.name)===e;i&&r._extensions.delete(e.name),r._logger.error('Failed to set up browser extension "'+e.name+'"',t),i&&r._disposeExtension(e)}}))()}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&Rr(t.then)&&t.then(void 0,(t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}))}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class gf{constructor(e){this._instance=e}get(e){var t;return null==(t=this._instance.persistence)?void 0:t.get_property(e)}set(e,t){var r;null==(r=this._instance.persistence)||r.set_property(e,t)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var vf="extensionsRemoteConfig";class ff{constructor(e){this._disposed=!1,this.instance=e,this._logger=ys.createLogger("[BrowserExtensions]"),this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new gf(e),this.onEvent=e=>Nl(this.instance.on("eventCaptured",(t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}}))),this.onRemoteConfig=e=>{if(this._disposed)return Nl((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(vf,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Nl(r)},this._runtime=new _f(this._logger,this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property(yu))&&void 0!==e?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==n?void 0:n.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==n?void 0:n.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}capture(e,r,i){var n=this;return t((function*(){i?n.instance.capture(e,r,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(e,r)}))()}registerDynamicEventProperties(e){return Nl(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(vf,e))}sendRequest(e,r){var i=this;return t((function*(){var t;void 0===r&&(r={});var n=i.instance.requestRouter.endpointFor(null!==(t=r.target)&&void 0!==t?t:"api",e),s={method:r.method,url:r.query?Bv(n,r.query):n,data:r.body,headers:r.headers,timeout:r.timeoutMs,fireCallbackOnDrop:!0,transport:r.transport};return"sendBeacon"===r.transport?(i.instance._send_request(s),{statusCode:202}):new Promise((e=>{s.callback=e,i.instance._send_request(s)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var mf={},yf=0,bf=()=>{},Sf='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',wf="Surveys module not available",kf="sanitize_properties is deprecated. Use before_send instead",xf="Invalid value for property_denylist config: ",Cf=["token","distinct_id",wc],If="posthog",Ef=!Av&&-1===(null==_s?void 0:_s.indexOf("MSIE"))&&-1===(null==_s?void 0:_s.indexOf("Mozilla")),Tf=e=>{var t;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ms(null==ls?void 0:ls.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:bf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:us&&Ar(null==us?void 0:us.search)&&-1!==us.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ss||null==(t=ss.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){ys.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Bc,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Qv},error_tracking:{},_onCapture:bf},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:_o,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},Mf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Rf=e=>{var t={};for(var r of Mf){var i=r[0],n=r[1];Lr(e[i])||(t[n]=e[i])}var s=ks({},t,e),o=e.__preview_external_dependency_versioned_paths;return Lr(o)||(Lr(e.strict_script_versioning)&&(s.strict_script_versioning=!!o),Ar(o)&&Lr(e.asset_host)&&(s.asset_host=o)),Mr(e.property_blacklist)&&(Lr(e.property_denylist)?s.property_denylist=e.property_blacklist:Mr(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:ys.error(xf+e.property_denylist)),s};class Pf{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){ys.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Ff{_replaceExtension(e,t){if(e){var r=this._extensions.indexOf(e);-1!==r&&this._extensions.splice(r,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===Oc||this.config.cookieless_mode===Ac&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Pf,this._personProcessingSetOncePropertiesSent=!1,this.version=fs.LIB_VERSION,this._internalEventEmitter=new tf,this._extensions=[],this._extensionEventPropertyProducers=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Tf(),this.SentryIntegration=bv,this.sentryIntegration=e=>function(e,t){var r=yv(e,t);return{name:mv,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Jv(this),this.pageViewManager=new Sv(this),this.rateLimiter=new Pv(this),this.requestRouter=new cf(this),this.consent=new hv(this),this.externalIntegrations=new pf(this);var t=null!==(e=Ff.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=Ar(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Ar(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>ys.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==If){var i,n=null!==(i=mf[r])&&void 0!==i?i:new Ff;return n._init(e,t,r),mf[r]=n,mf[If][r]=n,n}return this._init(e,t,r)}_init(e,t,i){var n,s;void 0===t&&(t={});var o,a=Ar(e)?e.trim():"";if(!a)return ys.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Tf(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=Tf(t.defaults),u=Rf(t),c=ks({},l,u,{name:i,token:a});Pr(l.rageclick)&&Pr(u.rageclick)&&(c.rageclick=ks({},l.rageclick,u.rageclick)),Pr(l.session_recording)&&Pr(u.session_recording)&&(c.session_recording=ks({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&ys.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Bl;var d=this._is_persistence_disabled();this.persistence=new Mv(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mv(r({},this.config,{persistence:"sessionStorage"}),d,!1);var h=r({},this.persistence.props),p=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Zv((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Kv(this),this.__request_queue=[];var _=this._inCookielessMode();if(_||(this.sessionManager=new nf(this),this.sessionPropsManager=new ef(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ys.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(_)}),0)):(ys.info("Initializing extensions synchronously"),this._initExtensions(_)),fs.DEBUG=fs.DEBUG||this.config.debug,fs.DEBUG&&ys.info("Starting in debug mode",{this:this,config:t,thisC:r({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=r({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),f=this.persistence.get_property(_c);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===Dc)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===Nc)ys.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var m=this.config.get_device_id(Yc()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(_c,t.bootstrap.isIdentifiedID?Nc:Dc),this.register({distinct_id:g,$device_id:y})}}if(_)this.register_once({distinct_id:Sc,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Yc());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(_c,Dc)}return Rs(ss,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||Yc();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(_c,Nc)),t()},n=r.user();"then"in n&&Rr(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||fv.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(fv.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(fv.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(r,t.event.properties);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,$c),identify:e=>t(e,zc),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Rr(this.config._onCapture)&&this.config._onCapture!==bf&&(ys.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&ys.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return of.apply(this,arguments)}().then((e=>{e&&this.register({[bu]:e})})).catch(bf),this}_initExtensions(e){var t,i,n,s,o,a,l,u,c=performance.now(),d=r({},Ff.__defaultExtensionClasses,this.config.__extensionClasses),h=[];d.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new d.featureFlags(this)),d.exceptions&&this._extensions.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new d.exceptions(this)),d.historyAutocapture&&this._extensions.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this._extensions.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this._extensions.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this._extensions.push(this.autocapture=new d.autocapture(this)),d.surveys&&this._extensions.push(this.surveys=null!==(n=this.surveys)&&void 0!==n?n:new d.surveys(this)),d.logs&&this._extensions.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new d.logs(this)),d.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this._extensions.push(this.productTours=new d.productTours(this)),d.heatmaps&&this._extensions.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this._extensions.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,gv)),d.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this._extensions.forEach((e=>{e.initialize&&h.push((()=>{null==e.initialize||e.initialize()}))})),h.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}})),this._processInitTaskQueue(h,c)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var r=e.shift();if(r)try{r()}catch(e){ys.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[kc]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[xc]:i}),this.config.__preview_deferred_init_extensions&&ys.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!ls||!ls.body)return ys.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=wr(i.supportedCompression,Bl)?Bl:wr(i.supportedCompression,ql)?ql:void 0),null!=(r=i.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Bc}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){ys.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=us&&us.hostname){var e=us.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new Lv(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ss(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Uc),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(n=this._retryQueue)||n.unload()):this._shouldCapturePageleave()&&this.capture(Uc,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Ef?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=r({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Lr(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,n,s=r({},e);s.timeout=s.timeout||6e4;var o,a,l,u,c,d=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Lr(s.compression)&&s.data&&(s.compression=ql),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(a=null==(c=(u=Mr(o=s.data)?o:[o])[0])||null==(l=c.properties)?void 0:l.token)&&void 0!==a?a:null==c?void 0:c.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),Mr(e)?e.map((e=>r({},e,{sent_at:t}))):r({},e,{sent_at:t})}(s.data))),s.url=jv(s.url,s.method,s.compression,s.timestampMode);var h=Gv.filter((e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport))),p=null!==(i=null==(n=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,(e=>e.transport===d)))?void 0:n.method)&&void 0!==i?i:h[0].method;if(!p)throw new Error("No available transport method");"sendBeacon"!==d&&s.data&&s.compression===Bl&&ps&&"undefined"!=typeof Promise&&!Dv?Uv(s).then((e=>{p(e)})).catch((t=>{if(_r(t))return Dv=!0,void p(r({},s,{compression:void 0,url:jv(e.url,e.method,void 0,e.timestampMode)}));gr(t)&&(Dv=!0),p(s)})):p(s)})(r({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){yf++;try{var t,r=[],i=[],n=[];Ss(e,(e=>{if(e)if(Mr(t=e[0]))n.push(e);else if(Rr(e))try{e.call(this)}catch(t){ys.error("Error executing queued PostHog call",e,t)}else Mr(e)&&"alias"===t?r.push(e):Mr(e)&&-1!==t.indexOf("capture")&&Rr(this[t])?n.push(e):i.push(e)}));var s=function(e,t){Ss(e,(function(e){try{if(Mr(e[0])){var r=t;ws(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){ys.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{yf--}}push(e){if(yf>0&&Mr(e)&&Ar(e[0])){var t=Ff.prototype[e[0]];Rr(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var n,s,o,a,l,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Lr(e)&&Ar(e)){var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var h=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){if(this._extensionEventPropertyProducers.length>0){var p={};for(var _ of this._extensionEventPropertyProducers.slice())try{ks(p,_())}catch(e){ys.error("Failed to produce browser extension event properties",e)}t=r({},p,null!=t?t:{})}var g;null!=(n=t)&&n.$current_url&&!Ar(null==(s=t)?void 0:s.$current_url)&&(ys.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(g=t)||delete g.$current_url),"$exception"!==e||null!=i&&i._originatedFromCaptureException||ys.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,f=(null==i?void 0:i.timestamp)||v,m=sn(null==i?void 0:i.uuid,Yc),y={uuid:m,event:e,properties:this.calculateEventProperties(e,t||{},f,m)};e===$c&&this.config.__preview_capture_bot_pageviews&&d&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),h&&(y.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var b="$feature_flag_called"===e&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(ec);(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);var S=null==i?void 0:i.$unset;S&&(y.$unset=S);var w=b?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==Wc,e===zc);if(w&&(y.$set_once=w),null!=i&&i._noTruncate||(a=this.config.properties_string_max_length,l=y,u=e=>Ar(e)?e.slice(0,a):e,c=new Set,y=function e(t,r){if(t!==Object(t))return u?u(t):t;if(!c.has(t)){var i;if(c.add(t),Mr(t))i=[],Ss(t,(t=>{i.push(e(t))}));else{var n={};ws(t,((t,r)=>{c.has(t)||(n[r]=e(t,r))})),i=n}return i}}(l)),y.timestamp=f,Lr(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=v),b&&(y.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return nr.forEach(i),t.forEach(i),r}(y.properties,Cf)),e===Zl.DISMISSED||e===Zl.SENT){var k,x,C=null==(k=t)?void 0:k[Yl.SURVEY_ID],I=null==(x=t)?void 0:x[Yl.SURVEY_ITERATION];gu({id:C,current_iteration:I}),y.$set=r({},y.$set,{[tu({id:C,current_iteration:I},e===Zl.SENT?"responded":"dismissed")]:!0})}else e===Zl.SHOWN&&(y.$set=r({},y.$set,{[Yl.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if("product tour shown"===e){var E,T=null==(E=t)?void 0:E.$product_tour_type;T&&(y.$set=r({},y.$set,{["$product_tour_last_seen_date/"+T]:(new Date).toISOString()}))}var M=r({},y.properties.$set,y.$set);if(Fr(M)||this.setPersonPropertiesForFlags(M),!Nr(this.config.before_send)){var R=this._runBeforeSend(y);if(!R)return;(y=R).uuid=sn(y.uuid,Yc)}this._internalEventEmitter.emit("eventCaptured",y);var P=null!==(o=null==i?void 0:i._url)&&void 0!==o?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),F={method:"POST",url:P,data:y,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(F):this._requestQueue.enqueue(F),y}ys.critical("This capture call is ignored due to client rate limiting.")}}else ys.error("No event name provided to posthog.capture")}else ys.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new ff(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}calculateEventProperties(e,t,i,n,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=r({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this._inCookielessMode()&&(a[wc]=!0),"$snapshot"===e){var l=r({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ar(a.distinct_id)&&!Br(a.distinct_id)||Or(a.distinct_id))&&ys.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=function(e,t,r,i){var n,s,o,a;if(void 0===i&&(i=!1),!_s)return{};var l,u=e?[...Sh,...t||[]]:[],c=function(e){for(var t=0;en.length>t;t++){var r=en[t],i=r[1],n=r[0].exec(e),s=n&&(Rr(i)?i(n,e):i);if(s)return s}return["",""]}(_s),d=c[0],h=c[1],p=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},_={};Lr(r)||(_.detectGoogleSearchApp=r);var g={},v=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,f=null==(s=navigator)?void 0:s.maxTouchPoints,m=null==ss||null==(o=ss.screen)?void 0:o.width,y=null==ss||null==(a=ss.screen)?void 0:a.height,b=null==ss?void 0:ss.devicePixelRatio;Lr(v)||(g.userAgentDataPlatform=v),Lr(f)||(g.maxTouchPoints=f),Lr(m)||(g.screenWidth=m),Lr(y)||(g.screenHeight=y),Lr(b)||(g.devicePixelRatio=b);var S,w=ks(Es({$os:d,$os_version:h,$browser:Ki(_s,navigator.vendor,p,_),$device:tn(_s),$device_type:rn(_s,g),$timezone:Lh(),$timezone_offset:Ah()}),{$current_url:Ns(i?on(null==us?void 0:us.href):null==us?void 0:us.href,u,kh),$host:null==us?void 0:us.host,$pathname:null==us?void 0:us.pathname,$raw_user_agent:_s.length>1e3?_s.substring(0,997)+"...":_s,$browser_version:Xi(_s,navigator.vendor,p,_),$browser_language:Th(),$browser_language_prefix:(S=Th(),"string"==typeof S?S.split("-")[0]:void 0),$screen_height:null==ss?void 0:ss.screen.height,$screen_width:null==ss?void 0:ss.screen.width,$viewport_height:null==ss?void 0:ss.innerHeight,$viewport_width:null==ss?void 0:ss.innerWidth,$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return fs.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=fs.SDK_DIST_CHANNEL),w}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime()),h=d.windowId;a.$session_id=d.sessionId,a.$window_id=h}this.sessionPropsManager&&ks(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&ks(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===af&&(a.$lib_custom_api_host=this.config.api_host),u=e!==$c||s?e!==Uc||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=ks(a,u),e===$c&&ls&&(a.title=ls.title),!Lr(o)){var _=i.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}_s&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),v=this.sessionPersistence.properties();ws(["$referrer","$referring_domain"],(e=>{e in g&&delete v[e]})),(a=ks({},c,g,v,a)).$is_identified=this._isIdentified(),Mr(this.config.property_denylist)?ws(this.config.property_denylist,(function(e){delete a[e]})):ys.error(xf+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(ys.error(kf),a=f(a,e));var m=this._hasPersonProcessing();return a.$process_person_profile=m,m&&!s&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var n=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=ks({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&(ys.error(kf),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Fr(o)?void 0:o}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:wf}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:wf})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:wf})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=fu),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:wf}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:wf})}_validateIdentifyId(e){return!e||Or(e)?(ys.critical("Unique user id has not been set in posthog.identify"),!1):e===Sc?(ys.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ys.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.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return ys.uninitializedWarning("posthog.identify");if(Br(e)&&(e=e.toString(),ys.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(yu)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(Su)&&(this.unregister(Su),this.register({distinct_id:e}));var n,s=(this.persistence.get_property(_c)||Dc)===Dc,o=e!==i,a=!o&&s;if(o&&s)this.persistence.set_property(_c,Nc),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(zc,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Xc(e,t,r),null==(n=this.featureFlags)||n.setAnonymousDistinctId(i);else if(a){this.persistence.set_property(_c,Nc);var l=t||{},u=r||{};this.setPersonPropertiesForFlags({$set:l,$set_once:u},!1),this.capture("$set",{$set:l,$set_once:u}),this._cachedPersonProperties=Xc(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);o?(this.reloadFeatureFlags(),this.unregister(cc)):a&&(t||r)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=Xc(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):ys.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(Mr(e)?e:[e]).filter((e=>Ar(e)&&e.length>0));0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,i){if(e&&t){var n=this.getGroups(),s=n[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:r({},n,{[e]:t})}),s||i){var o={$group_type:e,$group_key:t};i&&(o.$group_set=i),this.capture(Wc,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else ys.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,r,i,n,s,o,a,l,u,c;if(ys.info("reset"),!this.__loaded)return ys.uninitializedWarning("posthog.reset");var d,h=this.get_property(yu),p=this.get_property(bu),_=this.get_property(Fu);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),Lr(_)||null==(d=this.persistence)||d.register({[Fu]:_}),null==(i=this.surveys)||i.reset(),null==(n=this._remoteConfigLoader)||n.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(_c,Dc),null==(c=this.sessionManager)||c.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Oc)this.register_once({distinct_id:Sc,$device_id:null},"");else{var g=this.config.get_device_id(Yc());this.register_once({distinct_id:g,$device_id:e?g:h},""),e||Lr(p)||this.register({[bu]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return t((function*(){var e,t,i,n,s,o,a;r.__loaded?(null==(e=r._remoteConfigLoader)||e.stop(),null==(t=r._browserClientAdapter)||t.dispose(),null==(i=r.logs)||i.flushLogs("sendBeacon"),null==(n=r.metrics)||n.flush("sendBeacon"),null==(s=r._requestQueue)||s.unload(),null==(o=r._retryQueue)||o.unload(),null==(a=r.featureFlags)||a.destroy()):ys.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return i}alias(e,t){return e===this.get_property(mu)?(ys.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Lr(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Su,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ys.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=r({},this.config);if(Pr(e)){var i,n,s,o,a,l,u,c,d,h,p;ks(this.config,Rf(e));var _=this._is_persistence_disabled();null==(i=this.persistence)||i.update_config(this.config,t,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mv(r({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this._checkLocalStorageForDebug(this.config.debug);Hr(g)&&(this.config.debug=g),Hr(this.config.debug)&&(this.config.debug?(fs.DEBUG=!0,cd._is_supported()&&cd._set("ph_debug",!0),ys.info("set_config",{config:e,oldConfig:t,newConfig:r({},this.config)})):(fs.DEBUG=!1,cd._is_supported()&&cd._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){fs.LIB_NAME=e,fs.LIB_VERSION=t}startSessionRecording(e){var t,r,i,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(r({},n,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Ff._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:If;return t!==If&&(t=If+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(_c))===Nc||(null==(t=this.sessionPersistence)?void 0:t.get_property(_c))===Nc}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Bc&&!this._isIdentified()&&Fr(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Su])&&(null==(t=this.persistence)||null==(t=t.props)||!t[bc]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(ys.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(bc,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ac)}_sync_opt_out_with_persistence(){var e,t,r,i,n=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(i=this.sessionPersistence)||i.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Oc){if(this._inCookielessMode()){var r,i,n,s,o;this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=new nf(this),this.pageViewManager=new Sv(this),this.persistence&&(this.sessionPropsManager=new ef(this,this.sessionManager,this.persistence));var a,l=null!==(n=null==(s=this.config.__extensionClasses)?void 0:s.sessionRecording)&&void 0!==n?n:null==(o=Ff.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ac&&(null==(u=this.surveys)||u.loadIfEnabled()),(Lr(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else ys.warn(Sf)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Oc?(this.config.cookieless_mode===Ac&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Ac&&(this.register({distinct_id:Sc,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):ys.warn(Sf)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Oc||(this.config.cookieless_mode===Ac?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return as?sf(as,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ls&&("visible"===ls.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture($c,{title:ls.title},{send_instantly:!0}),this._visibilityStateListener&&(ls.removeEventListener(qc,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Rs(ls,qc,this._visibilityStateListener)))}debug(e){!1===e?(null==ss||ss.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ss||ss.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)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ys.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,r,i,n){var s=t in e&&!Nr(e[t]),o=r in e&&!Nr(e[r]);return s?e[t]:!!o&&(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,ys)}_runBeforeSend(e){var t;if(Nr(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(zr),i=Mr(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i){if(n=s(n),Nr(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Ur(e.event)?ys.warn(o+". This can cause unexpected behavior."):ys.info(o),null}n.properties&&!Fr(n.properties)||ys.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of r)if(n.properties&&Nr(n.properties[a]))return ys.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=Hr(e)&&!e,r=cd._is_supported()&&"true"===cd._get("ph_debug");return!t&&(!!r||e)}}Ff.__defaultExtensionClasses={},Ff._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Is(e.prototype[t[r]])}(Ff,["identify"]);var Lf=bs("[ExceptionAutocapture]"),Af=bs("[TracingHeaders]"),Of=bs("[Web Vitals]"),Df=9e5,Nf="[SessionRecording]",Bf=bs(Nf),qf=bs("[Heatmaps]");function Hf(e){return Pr(e)&&"clientX"in e&&"clientY"in e&&Br(e.clientX)&&Br(e.clientY)}var $f=bs("[Product Tours]"),Uf=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(Ru))},zf=["$set_once","$set"],Wf=bs("[SiteApps]"),Vf="Error while initializing PostHog app with config id ";function jf(e,t,r){if(Nr(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Gf{constructor(e){this._debugEventEmitter=new tf,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),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,t;Lr(null==(e=this._instance)?void 0:e._addCaptureHook)||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)})))}register(e){var t,r;if(!Lr(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,r;null==(t=this._actionRegistry)||t.add(e),null==(r=e.steps)||r.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(r=this._instance)&&r.autocapture)){var i,n=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&n.add(null==e?void 0:e.selector)}))})),null==(i=this._instance)||i.autocapture.setElementSelectors(n)}}on(e,t){var r;null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry&&(null==(r=this._actionRegistry)?void 0:r.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 r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!jf(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>jf(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&jf((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>jf(e.text,t.text,t.text_matching||"exact")||jf(e.$el_text,t.text,t.text_matching||"exact")));var n,s,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(n=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!Nr(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),s=t.text,o=t.text_matching||"exact",n.some((e=>jf(e,s,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var n=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||nd(t.properties.reduce(((e,t)=>{var r=Mr(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class Qf{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,null==(t=this._instance)||null==t.onSessionId||t.onSessionId((e=>this._onSessionIdChanged(e)))}_doesEventMatchFilter(e,t){return!!e&&nd(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach((e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach((t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}}))})),r}_getMatchingItems(e,t,r){var i=(r===Hl?this._eventToItems:this._cancelEventToItems).get(e),n=[];return this._getItems((e=>{n=e.filter((e=>null==i?void 0:i.includes(e.id)))})),n.filter((i=>{var n,s=null==(n=i.conditions)||null==(n=n[r])||null==(n=n.values)?void 0:n.find((t=>t.name===e));return this._doesEventMatchFilter(s,t)}))}register(e){var t;Lr(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(e){var t=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0}));0!==t.length&&(null==this._actionMatcher&&(this._actionMatcher=new Gf(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,r,i,n,s;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(r=e.conditions)&&null!=(r=r.actions)&&r.values&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0&&(null==(n=this._actionMatcher)||n.register(e.conditions.actions.values),null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||s.forEach((t=>{if(t&&t.name){var r=this._actionToItems.get(t.name);r&&r.push(e.id),this._actionToItems.set(t.name,r||[e.id])}})))})))}_setupEventBasedItems(e){var t,r=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})),i=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0}));0===r.length&&0===i.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,Hl),this._cancelEventToItems=this._buildEventToItemMap(e,$l))}onEvent(e,t){var r,i,n=this._getLogger(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var o=this._activationOutcome(e,s);if("consume"===o)return n.info("event consumed activated item, removing it",{event:e,itemId:s}),void this._deactivateItems([s]);if("persist"===o)return n.info("shown item promoted to persisted activation",{event:e,itemId:s}),void this._persistActivation(s)}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,$l);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map((e=>e.id))}),this._deactivateItems(a.map((e=>e.id))),a.forEach((e=>this._cancelPendingItem(e.id))))}if(this._eventToItems.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,Hl);this._activateItems(l.map((e=>e.id)))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){0!==e.length&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...e])],this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter((t=>t!==e));var t=this._getPersistedActivatedIds();t.includes(e)||(this._setActivatedItems([...t,e]),this._stampActivationSession())}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getRawPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession())}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],n=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return n&&i===n?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];r&&r!==e&&(this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession())}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class Zf extends Qf{constructor(e){super(e)}_getActivatedKey(){return ac}_getActivatedSessionKey(){return lc}_getShownEventName(){return Zl.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return lu}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ac]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[lc]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(lc)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||au(r)?e===Zl.SHOWN?"consume":"ignore":e===Zl.SHOWN?"persist":e===Zl.DISMISSED||e===Zl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Yf="SDK is not enabled or survey functionality is not yet loaded",Kf="Disabled. Not loading surveys.",Jf=null!=ss&&ss.location?Bs(ss.location.hash,"__posthog")||Bs(location.hash,"state"):null,Xf="_postHogToolbarParams",em=bs("[Toolbar]"),tm=bs("[FeatureFlags]"),rm=bs("[FeatureFlags]",{debugEnabled:!0}),im="\" failed. Feature flags didn't load in time.",nm=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},sm=e=>{var t={};for(var r of xs(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},om="Refusing to render web experiment since the viewer is a likely bot",am={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Jc(t,e),not_regex:(e,t)=>!Jc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class lm{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{lm._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(lm._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t._flagToExperiments)||r.set(e.feature_flag_key,e));var i=t._instance.getFeatureFlag(e.feature_flag_key);Ar(i)&&e.variants[i]&&t._applyTransforms(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];lm._matchesTestVariant(s,t._instance)&&t._applyTransforms(e.name,n,s.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())lm._logInfo(om);else if(!this._config.disable_web_experiments){if(Nr(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();lm._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),n=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=n&&n.variants[i]&&this._applyTransforms(n.name,i,n.variants[i].transforms)}}))}}previewWebExperiment(){var e=lm.getWindowLocation();if(null!=e&&e.search){var t=Ds(null==e?void 0:e.search,"__experiment_id"),r=Ds(null==e?void 0:e.search,"__experiment_variant");t&&r&&(lm._logInfo("previewing web experiments "+t+" && "+r),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),r,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var 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._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(lm._logInfo("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this._applyTransforms(i[0].name,t,i[0].variants[t].transforms))}static _matchesTestVariant(e,t){return!Nr(e.conditions)&&lm._matchUrlConditions(e,t)&&lm._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(Nr(e.conditions)||Nr(null==(r=e.conditions)?void 0:r.url))return!0;var i=lm.getWindowLocation();if(i){var n,s,o,a=Ws(t,i.href);return null==(n=e.conditions)||!n.url||am[null!==(s=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,a)}return!1}static getWindowLocation(){return null==ss?void 0:ss.location}static _matchUTMConditions(e){var t;if(Nr(e.conditions)||Nr(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Ch();if(r.utm_source){var i,n,s,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==r.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==r.utm_medium,_=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==r.utm_term;return d&&p&&_&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];ys.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?lm._logInfo(om):"control"!==t?r.forEach((r=>{if(r.selector){var i;lm._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var n=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==n||n.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):lm._logInfo("Control variants leave the page unmodified.")}_is_bot(){return as&&this._instance?sf(as,this._config.custom_blocked_useragents):void 0}}var um=bs("[Conversations]"),cm="Conversations not available yet.",dm="console",hm={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],ss&&Rs(ss,"online",this._onOnline)}destroy(){null==ss||ss.removeEventListener("online",this._onOnline)}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,tm.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(tm.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||tm.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}_getValidFlagKeys(){var e=this._config.flag_keys;if(!Lr(e)){if(Mr(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||tm.error("Invalid flag key found:",e,"Expected non-empty string"),t}));tm.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,r=this._instance.config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var n,s,o=null!==(n=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==n?n:{},a=Object.keys(i).filter((e=>!!i[e])).reduce(((e,t)=>(e[t]=i[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var n,s,o=null!=i&&i.merge&&null!==(n=this._prop(Qu))&&void 0!==n?n:{},a=null!=i&&i.merge&&null!==(s=this._prop(Ju))&&void 0!==s?s:{},l=r({},o,e),u=r({},a,t),c={};for(var d of Object.entries(l)){var h=d[0],p=d[1];c[h]={key:h,enabled:tr(p),variant:rr(p),reason:void 0,metadata:Lr(null==u?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(Ku),t=this._prop(tc),i=this._prop(rc);if(!i&&!t)return e||{};var n=ks({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of s){var a,l,u=n[o],c=null==t?void 0:t[o],d=Lr(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,h=Lr(c)?u.variant:"string"==typeof c?c:void 0,p=null==i?void 0:i[o],_=r({},u,{enabled:d,variant:d?null!=h?h:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(_.original_enabled=null==u?void 0:u.enabled),h!==(null==u?void 0:u.variant)&&(_.original_variant=null==u?void 0:u.variant),p&&(_.metadata=r({},null==u?void 0:u.metadata,{payload:p,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),n[o]=_}return this._override_warning||(tm.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:n}),this._override_warning=!0),n}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((r=>{var i=e[r];return{key:r,enabled:tr(i),variant:rr(i),payload:er(t[r])}}))}getFlagVariants(){var e=this._prop(Qu),t=this._prop(tc);if(!t)return e||{};for(var r=ks({},e),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(tm.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(Ju),t=this._prop(rc);if(!t)return e||{};for(var r=ks({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(tm.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._hasStatusZeroCircuitBreakerTripped()||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags()&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var i=this._config.token,n=this._prop(yu),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:r({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(ic)||{},{$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION}),group_properties:this._prop(nc),timezone:Lh()};Dr(n)||Lr(n)||(s.$device_id=n),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._getValidFlagKeys();Lr(o)||(s.flag_keys=o);var a=!!this._config.advanced_only_evaluate_survey_feature_flags,l=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._config.disable_compression?void 0:ql,timestampMode:"body",timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,n=!0;if(this._trackStatusZeroReachability(e.statusCode),200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),n=!1),this._requestInFlight=!1,!s.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var l,u=!(null==(r=e.json)||null==(r=r.quotaLimited)||!r.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(i=this._persistence)||i.register({[hc]:o}),u)tm.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},n,{partialResponse:a}),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}_hasStatusZeroCircuitBreakerTripped(){return qs(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Hs(e,this._consecutiveStatusZeroFailures,3,(()=>tm.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else tm.warn('getFeatureFlag for key "'+e+im)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r=this.getFlagVariants(),i=e in r,n=r[e],s=this.getFlagPayloads()[e],o=String(n),a=this._prop(Xu)||void 0,l=this._prop(pc)||void 0,u=this._prop(cc)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this._prop(dc);d&&d!==h&&(u={},null==(c=this._persistence)||c.register({[cc]:u,[dc]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,_,g,v,f,m,y,b,S,w,k;Mr(u[e])?u[e].push(o):u[e]=[o],null==(p=this._persistence)||p.register({[cc]:u});var x=this.getFeatureFlagDetails(e),C=[...null!==(_=this._prop(hc))&&void 0!==_?_:[]];Lr(n)&&C.push("flag_missing");var I={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Lr(null==x||null==(f=x.metadata)?void 0:f.has_experiment)||(I.$feature_flag_has_experiment=x.metadata.has_experiment),Lr(null==x||null==(m=x.metadata)?void 0:m.version)||(I.$feature_flag_version=x.metadata.version);var E,T=null!==(y=null==x||null==(b=x.reason)?void 0:b.description)&&void 0!==y?y:null==x||null==(S=x.reason)?void 0:S.code;T&&(I.$feature_flag_reason=T),null!=x&&null!=(w=x.metadata)&&w.id&&(I.$feature_flag_id=x.metadata.id),Lr(null==x?void 0:x.original_variant)&&Lr(null==x?void 0:x.original_enabled)||(I.$feature_flag_original_response=Lr(x.original_variant)?x.original_enabled:x.original_variant),null!=x&&null!=(k=x.metadata)&&k.original_payload&&(I.$feature_flag_original_payload=null==x||null==(E=x.metadata)?void 0:E.original_payload),C.length&&(I.$feature_flag_error=C.join(",")),this._instance.capture("$feature_flag_called",I)}if(i)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:er(s)}}}else tm.warn('getFeatureFlagResult for key "'+e+im)}getRemoteConfigPayload(e,t){var r=this._config.token,i={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:fs.LIB_NAME,$lib_version:fs.LIB_VERSION}};this._shouldIncludeEvaluationEnvironments()&&(i.evaluation_contexts=this._getValidEvaluationEnvironments());var n=this._getValidFlagKeys();Lr(n)||(i.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this._config.disable_compression?void 0:ql,timestampMode:"body",timeout:this._config.feature_flag_request_timeout_ms,callback(r){var i,n=null==(i=r.json)?void 0:i.featureFlagPayloads;t((null==n?void 0:n[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return tm.warn('isFeatureEnabled for key "'+e+im),t.defaultValue;var r=this.getFeatureFlag(e,t);return Lr(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,i){if(this._persistence){this._hasLoadedFlags=!0;var n=this.getFlagVariants(),s=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,i,n,s,o){void 0===i&&(i={}),void 0===n&&(n={}),void 0===s&&(s={});var a=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var r;return[e,null!==(r=t[e].variant)&&void 0!==r?r:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var r;return null==(r=t[e].metadata)?void 0:r.payload})).map((e=>{var r;return[e,null==(r=t[e].metadata)?void 0:r.payload]})))):e.featureFlags&&tm.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var d=e.requestId,h=e.evaluatedAt;if(Mr(u)){tm.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var _=0;u.length>_;_++)p[u[_]]=!0;t&&t.register({[Zu]:u,[Qu]:p,[ec]:!1})}else{var g=u,v=c,f=l;if(null!=o&&o.partialResponse)g=r({},i,g),v=r({},n,v),f=r({},s,f);else if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((e=>{var t;return!(null!=(t=l[e])&&t.failed)})));g=r({},i,Object.fromEntries(Object.entries(g).filter((e=>m.has(e[0]))))),v=r({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>m.has(e[0]))))),f=r({},s,Object.fromEntries(Object.entries(f||{}).filter((e=>m.has(e[0])))))}else g=r({},i,g),v=r({},n,v),f=r({},s,f);t&&t.register(r({[Zu]:Object.keys(sm(g)),[Qu]:g||{},[Ju]:v||{},[Ku]:f||{},[ec]:!0===e.minimalFlagCalledEvents},d?{[Xu]:d}:{},h?{[pc]:h}:{}))}}}(e,this._persistence,n,s,o,i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),tm.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return tm.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(tc),this._persistence.unregister(rc),this._fireFeatureFlagsCallbacks(),rm.info("All overrides cleared");if(Mr(e)){var t=nm(e);return this._persistence.register({[tc]:t}),this._fireFeatureFlagsCallbacks(),rm.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var r,i=e;if(this._override_warning=Boolean(null!==(r=i.suppressWarning)&&void 0!==r&&r),"flags"in i)if(!1===i.flags)this._persistence.unregister(tc),rm.info("Flag overrides cleared");else if(i.flags){if(Mr(i.flags)){var n=nm(i.flags);this._persistence.register({[tc]:n})}else this._persistence.register({[tc]:i.flags});rm.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._persistence.unregister(rc),rm.info("Payload overrides cleared")):i.payloads&&(this._persistence.register({[rc]:i.payloads}),rm.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[tc]:e}),this._fireFeatureFlagsCallbacks(),rm.info("Flag overrides set",{flags:e});tm.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){tm.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n,s=(this._prop(Yu)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=r({},this.getFlagVariants(),{[e]:t});null==(n=this._persistence)||n.register({[Zu]:Object.keys(sm(l)),[Qu]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(Yu),n=r?"&"+r.map((e=>"stage="+e)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+n),method:"GET",timestampMode:"query",callback:t=>{var r,i;if(t.json){var n=t.json.earlyAccessFeatures;return null==(r=this._persistence)||r.unregister(Yu),null==(i=this._persistence)||i.register({[Yu]:n}),e(n)}}})}_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,r)=>(e[r]=t[r],e)),{})}}_fireFeatureFlagsCallbacks(e){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((t=>{try{t(r,i,{errorsLoading:e})}catch(e){tm.error("Error while running feature flags callback",e)}}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(ic)||{},n=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,o={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in i||(o[a]=s[a]));this._instance.register({[ic]:r({},i,o,n)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=r({},this._prop(ic)||{});e.forEach((e=>{delete i[e]})),this._instance.register({[ic]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(ic),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._prop(nc)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=r({},i[t],e[t]),delete e[t]})),this._instance.register({[nc]:r({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(nc)||{};this._instance.register({[nc]:r({},t,{[e]:{}})})}else this._instance.unregister(nc)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},pm={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===S_||this._recordingStatus===w_?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=g_,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw Bf.error("started without valid sessionManager"),new Error(Nf+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===Oc)throw new Error(Nf+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(Fu))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return ss&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var r=!Lr(Object.assign)&&!Lr(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),Bf.info("starting")):(this._recordingStatus=g_,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==S_&&this._recordingStatus!==w_&&(this._recordingStatus=b_),null!=ba&&null!=(t=ba.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=ba.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=ba.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return Bf.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(qu),null==(t=this._persistence)||t.unregister(Lu)}_validateSampleRate(e,t){if(Nr(e))return null;var r,i=Br(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(Bf.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,i,n=this._persistence,s=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Nr(a)&&this._resetSampling();var l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[Fu]:r({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:r({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Lr(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):(this._recordingStatus===S_&&(this._recordingStatus=w_,Bf.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):Bf.warn("log called before recorder was ready")}get _scriptName(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Fu);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,r=this._instance.get_property(Fu);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return Bf.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var i=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return Date.now()-i<=qg}_onScriptLoaded(e){var t,r;if(null==(t=ba.__PosthogExtensions__)||!t.initSessionRecording)return Bf.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Cc]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(r=ba.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===w_||this._recordingStatus===S_)return;return this._recordingStatus=S_,Bf.info("persisted remote config is stale, requesting fresh config before starting"),void new Lv(this._instance).load()}this._recordingStatus=b_,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Ou]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Au]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?Du:Nu]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}}},_m={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Xp(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,r=Pr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=null==(e=r.url_allowlist)?void 0:e.map((e=>new RegExp(e))),r.url_ignorelist=null==(t=r.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ss&&ls){var e=e=>{e=e||(null==ss?void 0:ss.event);try{this._captureEvent(e)}catch(e){t_.error("Failed to capture event",e)}};if(Rs(ls,"submit",e,{capture:!0}),Rs(ls,"change",e,{capture:!0}),Rs(ls,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ss?void 0:ss.event);try{this._captureEvent(e,e_)}catch(e){t_.error("Failed to capture copy/cut event",e)}};Rs(ls,"copy",t,{capture:!0}),Rs(ls,"cut",t,{capture:!0})}}}else t_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r=t.autocapture_opt_out;Hr(r)&&(this.instance.persistence&&this.instance.persistence.register({[ku]:r}),this._isDisabledServerSide=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var i=null==ls?void 0:ls.querySelectorAll(t);null==i||i.forEach((i=>{e===i&&r.push(t)}))})),r}get isEnabled(){var e,t,r=null==(e=this.instance.persistence)?void 0:e.props[ku],i=this._isDisabledServerSide,n=this.instance._shouldDisableFlags()&&!this._hasReceivedConfigResponse;if(Dr(i)&&!Hr(r)&&!n)return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,i=ao(e);Xs(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&yo(i,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===e_;if(i&&function(e,t,r,i,n,s){var o;if(!ss||bo(e))return!1;if(null!=r&&r.url_allowlist&&!io(r.url_allowlist,s))return!1;if(null!=r&&r.url_ignorelist&&io(r.url_ignorelist,s))return!1;if(null!=r&&r.dom_event_allowlist){var a=r.dom_event_allowlist;if(a&&!a.some((e=>t.type===e)))return!1}var l=So(e,i),u=l.parentIsUsefulElement,c=l.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(Lr(r))return!0;var i,n=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e)if(i=n(s))return i.v;return!1}(c,r))return!1;if(!uo(c,null==r?void 0:r.css_selector_allowlist))return!1;if(uo(c,null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:ho))return!1;try{var d=ss.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return u?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(lo.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this._config,n,n?["copy","cut"]:void 0,this.instance)){var s=n_(i,{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,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===e_){var l,u=so(null==ss||null==(l=ss.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=c}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Rr(null==ls?void 0:ls.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ss||null==(t=ss.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ys.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,ys.info("History API monitoring stopped")}monitorHistoryChanges(){ss&&ss.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ss&&(null==(t=ss.history[e])||!t.__posthog_wrapped__)){var r=this;Us(ss.history,e,(t=>function(i,n,s){t.call(this,i,n,s),r._capturePageview(e)}))}}_capturePageview(e){try{var t,r=null==ss||null==(t=ss.location)?void 0:t.pathname;if(!r)return;r!==this._lastPathname&&this.isEnabled&&this._instance.capture($c,{navigation_type:e}),this._lastPathname=r}catch(t){ys.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Rs(ss,"popstate",e),this._popstateListener=()=>{ss&&ss.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[xu]),this.rageclicks=new Xp(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Pr(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Nr(this._config.capture_heatmaps)?Nr(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;qf.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[xu]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){Hf(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(ls)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ss&&ls&&(this._flushHandler=this._flush.bind(this),Rs(ss,Hc,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ss?void 0:ss.event)),Rs(ls,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ss?void 0:ss.event)),Rs(ls,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new vv(this.instance,_v,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Rs(ls,qc,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ss&&ls&&(this._flushHandler&&ss.removeEventListener(Hc,this._flushHandler),this._onClickHandler&&ls.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&ls.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&ls.removeEventListener(qc,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),s=function(e,t,r){for(var i=e;i&&Ks(i)&&!Js(i,"body");){if(i===r)return!1;var n=void 0;try{var s,o,a;n=null==(s=null!==(o=null==(a=i.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:ss)?void 0:s.getComputedStyle(i).position}catch(e){return!1}if(wr(t,n))return!0;i=co(i)}return!1}(ao(e),["fixed","sticky"],n);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:r),target_fixed:s,type:t}}_onClick(e,t){var i;if(void 0===t&&(t="click"),!Ys(e.target)&&Hf(e)){var n=this._getProperties(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&yo(ao(e),this.instance.config.rageclick)&&this._capture(r({},n,{type:"rageclick"})),this._capture(n)}}_onMouseMove(e){!Ys(e.target)&&Hf(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ss){var t=this._config.disable_capture_url_hashes?on(ss.location.href):ss.location.href,r=this._config.custom_personal_data_properties,i=this._config.mask_personal_data_properties?[...Sh,...r||[]]:[],n=Ns(t,i,kh);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(e)}}_flush(){this._buffer&&!Fr(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:vv,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>r({},e,{["$web_vitals_"+t.name+"_event"]:r({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this._currentURL();if(!Lr(i))if(Nr(null==e?void 0:e.name)||Nr(null==e?void 0:e.value))Of.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==i&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Lr(this._buffer.url)&&(this._buffer.url=i),this._buffer.firstMetricTimestamp=Lr(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=r({},e,{$current_url:i,timestamp:Date.now()});Lr(n)||(s.$session_id=n.sessionId,s.$window_id=n.windowId),this._buffer.metrics.push(s),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Of.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=ba.__PosthogExtensions__;if(!Lr(n)&&!Lr(n.postHogWebVitalsCallbacks)){var s=n.postHogWebVitalsCallbacks;e=s.onLCP,t=s.onCLS,r=s.onFCP,i=s.onINP}e&&t&&r&&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&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this)),this._initialized=!0):Of.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Tu]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=Pr(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Nr(r)?(null==(t=this._instance.persistence)?void 0:t.props[Pu])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Pr(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Pr(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Pr(this._perfConfig)&&Br(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Df;return e>0&&6e4>=e?Df:e}get isEnabled(){var e=null==us?void 0:us.protocol;if("http:"!==e&&"https:"!==e)return Of.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Pr(this._perfConfig)?this._perfConfig.web_vitals:Hr(this._perfConfig)?this._perfConfig:void 0;return Hr(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Of.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=Pr(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Pr(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Tu]:r}),this._instance.persistence.register({[Pu]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Of.error("failed to load script",t):e()}))}_currentURL(){var e=ss?this._instance.config.disable_capture_url_hashes?on(ss.location.href):ss.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Sh,...t||[]]:[];return Ns(e,r,kh)}Of.error("Could not determine current URL")}}},gm={exceptionObserver:class{constructor(e){var t;this._startCapturing=()=>{var e;if(ss&&this.isEnabled&&null!=(e=ba.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=ba.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=ba.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=ba.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=r(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=i(this.captureException.bind(this)))}catch(e){Lf.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Cu]),this._rateLimiter=new Kr(r({},function(e){var t,r,i,n;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:Lf})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Pr(e)?t=r({},t,e):(Lr(e)?this._remoteEnabled:e)&&(t=r({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Lf.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Lf.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Cu]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,n=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(n)?Lf.info("Skipping exception capture because of client rate limiting.",{exception:n}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=np(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Iu))&&void 0!==t?t:[],this._exceptionStepsConfig=rs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new is(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=rs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var n=e.config;if("errorTracking"in n){var s=null!==(t=null==(r=n.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=n.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[Iu]:this._suppressionRules,[Eu]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Eu),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=r?r:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Ar(e)||0===e.trim().length)return void ip.warn("Ignoring exception step because message must be a non-empty string");var i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>es.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),n=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&ip.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(r({[Jn]:e,[Xn]:(new Date).toISOString()},n))}catch(e){ip.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void ip.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void ip.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void ip.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Nr(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(s=globalThis._posthogReleaseId)&&s.length>0?s:void 0;i&&(r.$release_id=i);try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return n&&this._exceptionStepsBuffer.clear(),n}catch(e){return ip.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void ip.error("Failed to process exception event. Ignoring this exception.",e)}var s}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:r({},e,{$exception_steps:t})}catch(t){return ip.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Jn]:e,[Xn]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Pr(e)?r({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce(((e,t)=>{var r=t.type,i=t.value;return Ar(r)&&r.length>0&&e.$exception_types.push(r),Ar(i)&&i.length>0&&e.$exception_values.push(i),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var r=e.values.map((e=>{var r=ed[e.operator],i=t[e.key];if(!r||!i)return!1;var n=Mr(e.value)?e.value:[e.value];return n.length>0&&r(n,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return ip.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap((e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}));return t.some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,r,i,n,s=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!Nr(e)&&Mr(e)}}},vm=r({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[Ru]:!!t.productTours}),!Uf(this._instance))return!this._productTourManager&&Nr(null==(r=this._persistence)?void 0:r.props[uc])||$f.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&Uf(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?$f.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=ba.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=ba.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Mr(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[uc];if(Mr(i)&&!t)return this._cachedTours=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:t=>{if(Uf(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return $f.error(n),void e([],{isLoaded:!1,error:n})}var s=Mr(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[uc]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Nr(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(uc)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},hm),fm={siteApps:class{constructor(e){this._siteAppElementPatchCount=0,this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=ba._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,n,s,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var p of Object.entries(h)){var _=p[0];c[_]={id:d[_],type:_,properties:p[1]}}var g=e.$set_once,v=e.$set;return{event:r({},i(e,zf),{properties:r({},e.properties,v?{$set:r({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:r({},null!==(s=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==s?s:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Wf.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Wf.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,i,n,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==ls?void 0:ls.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var c=[],d=this,h=new WeakSet,p=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),c.push((()=>{e[t]=i}))}},_=e=>{if(h.has(e))return e;var t=d._prepareElementForSiteApp(e);return t&&h.add(t),t},g=e=>e.map((e=>"string"==typeof e?e:_(e))).filter((e=>!Dr(e)));return p(u,"appendChild",(e=>function(t){var r=_(t);return r?e.call(this,r):t})),p(u,"insertBefore",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):t})),p(u,"replaceChild",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):r})),[null==(t=l.Element)?void 0:t.prototype,null==(r=l.Document)?void 0:r.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach((e=>{p(e,"append",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"prepend",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}))})),[null==(n=l.Element)?void 0:n.prototype,null==(s=l.CharacterData)?void 0:s.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((e=>{p(e,"before",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"after",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),p(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var n=g(r);return r.length&&!n.length?void 0:e.apply(this,n)}))})),p(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(e=>function(t,r){var i=_(r);return i?e.call(this,t,i):null})),this._restoreSiteAppElementPatches=()=>{c.forEach((e=>e())),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(Wf.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>this._runWithPreparedSiteAppElements((()=>null==t.processEvent?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,n=n=>{t.errored=!n,t.loaded=!0,Wf.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var s=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1).processEvent;s&&(t.processEvent=s),i=!0}catch(t){Wf.error(Vf+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){Wf.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements((()=>null==i.processEvent?void 0:i.processEvent(r)))}catch(t){Wf.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(e){var t,r,i,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void Wf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var s=e.config;if(null!=(i=s.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;ba["__$$ph_site_app_"+t]=n._instance,null==(e=ba.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(n._instance,r,(e=>{if(e)return Wf.error(Vf+t,e)}))};for(var a of s.siteApps)o()}else Wf.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},mm={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(Lr(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=ba.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Lr(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=ba.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=ba.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=ba.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Af.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Mr(e)?(Mr(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Mr(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},ym=r({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){if(!e.ok)return lu.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Nr(t))return lu.warn("Flags not loaded yet. Not loading surveys.");var r=Mr(t);this._isSurveysEnabled=r?t.length>0:t,lu.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith(du)||null!=i&&i.startsWith(hu))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)lu.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)lu.info(Kf);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())lu.info("Not loading surveys in cookieless mode without consent.");else{var e=null==ba?void 0:ba.__PosthogExtensions__;if(e){if(!Lr(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var r=e.generateSurveys;if(r)return void this._completeSurveyInitialization(r,t);var i=e.loadExternalDependency;if(!i)return void this._handleSurveyLoadError(Lc);i(this._instance,"surveys",(r=>{r||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",r):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else lu.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Zf(this._instance),lu.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){lu.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return lu.info(Kf),e([]);var r,i=this._instance.get_property(sc);if(i&&!t)return e(i,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>e(t.surveys,t.context))):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{r=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timestampMode:"query",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var i;this._getSurveysInFlightPromise=null;var n=t.statusCode;if(200!==n||!t.json){var s="Surveys API could not be loaded, status: "+n;lu.error(s),this._lastSurveyRefreshFailedAt=Date.now();var o={isLoaded:!1,error:s};return e([],o),void(null==r||r({surveys:[],context:o}))}this._lastSurveyRefreshFailedAt=null;var a,l=t.json.surveys||[],u=l.filter((e=>uu(e)&&(ou(e)||cu(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(i=this._instance.persistence)||i.register({[sc]:l,[oc]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e=this._instance.get_property(oc);return Br(e)&&Date.now()-e>3e5}_isSurveyRefreshBackingOff(){return Br(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r,i={id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null};gu(i);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){lu.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Nr(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);lu.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((r=>{var i;t=null!==(i=r.find((t=>t.id===e)))&&void 0!==i?i:null})),t}_checkSurveyEligibility(e){if(Nr(this._surveyManager))return{eligible:!1,reason:Yf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(Nr(this._surveyManager))return{eligible:!1,reason:Yf};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Nr(this._surveyManager))return lu.warn("init was not called"),{visible:!1,disabledReason:Yf};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Nr(this._surveyManager)?(lu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Yf})):new Promise((r=>{this.getSurveys((t=>{var i,n=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(n){var s=this._checkSurveyRenderability(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(Nr(this._surveyManager))lu.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(vu.includes(n.type)){var s=null==ls?void 0:ls.querySelector(t);if(s)return null!=(i=n.appearance)&&i.surveyPopupDelaySeconds?(lu.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;lu.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,s,r),lu.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);lu.warn("Survey element not found")}else lu.warn("Surveys of type "+n.type+" cannot be rendered in the app");else lu.warn("Survey not found")}}displaySurvey(e,t){var i;if(Nr(this._surveyManager))lu.warn("init was not called");else{var n=this._getSurveyById(e);if(n){var s=n;if(null!=(i=n.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=r({},n,{appearance:r({},n.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Kl&&t.initialResponses&&lu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this._checkSurveyEligibility(n);if(!o.eligible)return void lu.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else lu.warn("Survey not found")}}cancelPendingSurvey(e){Nr(this._surveyManager)?lu.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}},hm),bm={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){ba.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=ba.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),Ps(this.instance.config))return!1;if(!ss||!ls)return!1;e=null!=e?e:ss.location,r=null!=r?r:ss.history;try{if(!t){try{ss.localStorage.setItem("test","test"),ss.localStorage.removeItem("test")}catch(e){return!1}t=null==ss?void 0:ss.localStorage}var i,n=Jf||Bs(e.hash,"__posthog")||Bs(e.hash,"state"),s=n?Cs((()=>JSON.parse(atob(decodeURIComponent(n)))))||Cs((()=>JSON.parse(decodeURIComponent(n)))):null;return s&&"ph_authorize"===s.action?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?e.hash=s.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Xf)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}_callLoadToolbar(e){var t=ba.ph_load_toolbar||ba.ph_load_editor;!Nr(t)&&Rr(t)?t(e,this.instance):em.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==ls||!ls.getElementById(js));if(!ss||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=r({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(ss.localStorage.setItem(Xf,JSON.stringify(r({},n,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(n);else if(0===this._getToolbarState()){var s;this._setToolbarState(1),null==(s=ba.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return em.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),Rs(ss,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(n)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},Sm=r({experiments:lm},hm),wm={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;Nr(t)||(Hr(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Ps(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==ba?void 0:ba.__PosthogExtensions__;if(e&&!Lr(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(Lc);r(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else um.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),um.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else um.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){um.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():um.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Dr(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,r,i){var n=this;return t((function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,r,i):(um.warn(cm),null)}))()}getMessages(e,r){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,r):(um.warn(cm),null)}))()}markAsRead(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.markAsRead(e):(um.warn(cm),null)}))()}getTickets(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getTickets(e):(um.warn(cm),null)}))()}requestRestoreLink(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.requestRestoreLink(e):(um.warn(cm),null)}))()}restoreFromToken(e){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.restoreFromToken(e):(um.warn(cm),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(um.warn(cm),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},km={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=bs("[logs]"),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._onReconnect=()=>{var e,t;this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),ss&&Rs(ss,"online",this._onReconnect)}_buildCore(e,t,r,i){var n,s=function(e,t){var r,i,n,s,o,a,l,u=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,c=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,d=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,h=Lr(d)?Math.max(c,2048):Math.max(c,d),p=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(s=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==s?s:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(n=this._instance)||null==(n=n.config)?void 0:n.logs,r);return[new mn(this._createHost(e,t),s,this._logger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore((()=>this._queue),(e=>{this._queue=e}));this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},dm);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var r=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!Nr(r)&&r&&(this._isLogsEnabled=!0,this.loadIfEnabled())}}reset(){var e,t;this._queue=[],null==(e=this._core)||e.reset(),this._consoleQueue=[],null==(t=this._consoleCore)||t.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._getCore().captureLog(e)}_captureConsoleLog(e){this._getConsoleCore().captureLog(e)}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch((e=>this._logger.error("PostHog logs flush failed:",e))),this._consoleCore&&this._consoleCore.flush().catch((e=>this._logger.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=null==ba?void 0:ba.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(t=>{var r;t||null==(r=e.logs)||!r.initializeLogs?this._logger.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this._isLoaded=!0)})):this._logger.error(Lc)}else this._logger.error("PostHog Extensions not found.")}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===sr.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===sr.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>fs.LIB_NAME,getLibraryVersion:()=>fs.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(qs(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(n),t(e))},n=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}}))}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=Hs(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,fs.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,dm,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=fn(s,vn(r,fs.LIB_NAME,fs.LIB_VERSION),i,fs.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,Nr(n)||(t.sessionStartTimestamp=n),Nr(s)||(t.lastActivityTimestamp=s)}if(null!=ba&&null!=(e=ba.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?on(ba.location.href):ba.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},xm={metrics:class{constructor(e){this._logger=bs("[metrics]"),this._instance=e}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new wn(this._createHost(),function(e){var t,r,i,n,s,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(s=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==s?s:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch((e=>this._logger.error("PostHog metrics flush failed:",e)))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>fs.LIB_NAME,getLibraryVersion:()=>fs.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((i=>{var n=!1,s=e=>{n||(n=!0,clearTimeout(o),i(e))},o=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(r({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;if(t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;s({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("metrics request failed with status "+t)})}}}))}))}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Cm=r({},hm,pm,_m,gm,vm,fm,ym,mm,bm,Sm,wm,km,xm);Ff.__defaultExtensionClasses=r({},Cm),function(){fs.SDK_DIST_CHANNEL="cdn";var e=ba.posthog;if(!e||Mr(e._i)){var t=mf[If]=new Ff;if(e){var r=[];ws(e._i,(function(i){if(i&&Mr(i)){var n=t.init(i[0],i[1],i[2]),s=e[i[2]]||e;n.__loaded&&-1===r.indexOf(s)&&(r.push(s),n._execute_array.call(n.people,s.people),n._execute_array(s))}}))}t.__SV=1,ba.posthog=t,function(){function e(){e.done||(e.done=!0,Ef=!1,ws(mf,(function(e){e._dom_loaded()})))}null!=ls&&ls.addEventListener?"complete"===ls.readyState?e():Rs(ls,"DOMContentLoaded",e,{capture:!1}):ss&&ys.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}();
2
2
  //# sourceMappingURL=array.full.no-external.js.map